2016-11-20 19:41:57 -05:00
/ * !
2017-01-26 18:42:07 -05:00
* matter - tools 0.9 . 1 by Liam Brummitt 2017 - 01 - 26
2016-11-20 19:41:57 -05:00
* https : //github.com/liabru/matter-tools
* License MIT
* /
( function webpackUniversalModuleDefinition ( root , factory ) {
if ( typeof exports === 'object' && typeof module === 'object' )
2017-01-26 18:42:07 -05:00
module . exports = factory ( require ( "Matter" ) , require ( "MatterTools" ) , require ( "jQuery" ) ) ;
2016-11-20 19:41:57 -05:00
else if ( typeof define === 'function' && define . amd )
2017-01-26 18:42:07 -05:00
define ( [ "Matter" , "MatterTools" , "jQuery" ] , factory ) ;
2016-11-20 19:41:57 -05:00
else if ( typeof exports === 'object' )
2017-01-26 18:42:07 -05:00
exports [ "Inspector" ] = factory ( require ( "Matter" ) , require ( "MatterTools" ) , require ( "jQuery" ) ) ;
2016-11-20 19:41:57 -05:00
else
2017-01-26 18:42:07 -05:00
root [ "MatterTools" ] = root [ "MatterTools" ] || { } , root [ "MatterTools" ] [ "Inspector" ] = factory ( root [ "Matter" ] , root [ "MatterTools" ] , root [ "jQuery" ] ) ;
} ) ( this , function ( _ _WEBPACK _EXTERNAL _MODULE _1 _ _ , _ _WEBPACK _EXTERNAL _MODULE _2 _ _ , _ _WEBPACK _EXTERNAL _MODULE _7 _ _ ) {
2016-11-20 19:41:57 -05:00
return /******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] )
/******/ return installedModules [ moduleId ] . exports ;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ exports : { } ,
/******/ id : moduleId ,
/******/ loaded : false
/******/ } ;
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/ // Flag the module as loaded
/******/ module . loaded = true ;
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "/demo/lib" ;
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( 0 ) ;
/******/ } )
/************************************************************************/
/******/ ( [
/* 0 */
/***/ function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
/ * *
* A tool for inspecting worlds .
* @ module Inspector
* /
var Inspector = module . exports = { } ;
var $ = _ _webpack _require _ _ ( 7 ) ;
_ _webpack _require _ _ ( 8 ) ;
2017-01-26 18:42:07 -05:00
var ToolsCommon = _ _webpack _require _ _ ( 3 ) ;
var Serializer = _ _webpack _require _ _ ( 2 ) . Serializer ;
2016-11-20 19:41:57 -05:00
var km = _ _webpack _require _ _ ( 9 ) ;
2017-01-26 18:42:07 -05:00
var Matter = _ _webpack _require _ _ ( 1 ) ;
2016-11-20 19:41:57 -05:00
var Body = Matter . Body ;
var Bounds = Matter . Bounds ;
var Composite = Matter . Composite ;
var Common = Matter . Common ;
var Events = Matter . Events ;
var Mouse = Matter . Mouse ;
var Query = Matter . Query ;
var Vertices = Matter . Vertices ;
var Vector = Matter . Vector ;
var MouseConstraint = Matter . MouseConstraint ;
var $body ;
/ * *
* Creates an inspector
* @ function Gui . create
* @ param { engine } engine
* @ param { render } [ render ]
* @ param { object } options
* @ return { inspector } The created inspector instance .
* /
Inspector . create = function ( engine , render , options ) {
if ( ! $ ) {
console . log ( 'Could not create inspector, missing jQuery.' ) ;
return ;
}
var inspector = {
engine : null ,
render : null ,
isPaused : false ,
selected : [ ] ,
selectStart : null ,
selectEnd : null ,
selectBounds : Bounds . create ( ) ,
mousePrevPosition : { x : 0 , y : 0 } ,
offset : { x : 0 , y : 0 } ,
autoHide : true ,
autoRewind : true ,
bodyClass : '' ,
exportIndent : 0 ,
clipboard : [ ] ,
controls : {
container : null ,
worldTree : null
} ,
root : Composite . create ( {
label : 'Root'
} ) ,
keyBindings : [ ]
} ;
inspector = Common . extend ( inspector , options ) ;
Inspector . instance = inspector ;
inspector . engine = engine ;
inspector . render = render ;
if ( inspector . render ) {
inspector . mouse = Mouse . create ( inspector . render . canvas ) ;
inspector . mouseConstraint = MouseConstraint . create ( engine , { mouse : inspector . mouse } ) ;
} else {
inspector . mouse = {
position : {
x : 0 ,
y : 0
}
} ;
}
if ( Serializer ) {
inspector . serializer = Serializer . create ( ) ;
localStorage . removeItem ( 'pauseState' ) ;
}
$body = $ ( 'body' ) ;
Composite . add ( inspector . root , engine . world ) ;
engine . world . isModified = true ;
engine . world . parent = null ;
var styles = _ _webpack _require _ _ ( 10 ) ;
ToolsCommon . injectStyles ( styles , 'js-tree-style' ) ;
styles = _ _webpack _require _ _ ( 11 ) ;
ToolsCommon . injectStyles ( styles , 'matter-inspector-style' ) ;
inspector . keyBind = Common . chain ( km , function ( key ) {
inspector . keyBindings . push ( key ) ;
} ) ;
_initControls ( inspector ) ;
_initEngineEvents ( inspector ) ;
_initTree ( inspector ) ;
_initKeybinds ( inspector ) ;
return inspector ;
} ;
/ * *
* Destroys the inspector
* @ function Gui . destroy
* @ param { Inspector } inspector
* /
Inspector . destroy = function ( inspector ) {
inspector . controls . worldTree . data ( 'jstree' ) . destroy ( ) ;
var inspectorElements = [ ] . slice . call ( document . body . querySelectorAll ( '.ins-container' , '.vakata-context' , '.jstree-marker' ) ) ;
inspectorElements . forEach ( ToolsCommon . domRemove ) ;
inspector . keyBindings . forEach ( function ( key ) {
km . unbind ( key ) ;
} ) ;
Events . off ( inspector . engine , 'beforeUpdate' , inspector . beforeEngineUpdate ) ;
if ( inspector . render ) {
Events . off ( inspector . render , 'afterRender' , inspector . afterRender ) ;
Events . off ( inspector . mouseConstraint ) ;
}
} ;
var _initControls = function _initControls ( inspector ) {
var controls = inspector . controls ;
var $inspectorContainer = $ ( '<div class="ins-container">' ) ,
$buttonGroup = $ ( '<div class="ins-control-group">' ) ,
$searchBox = $ ( '<input class="ins-search-box" type="search" placeholder="search">' ) ,
$importButton = $ ( '<button class="ins-import-button ins-button">Import</button>' ) ,
$exportButton = $ ( '<button class="ins-export-button ins-button">Export</button>' ) ,
$pauseButton = $ ( '<button class="ins-pause-button ins-button">Pause</button>' ) ,
$helpButton = $ ( '<button class="ins-help-button ins-button">Help</button>' ) ,
$addCompositeButton = $ ( '<button class="ins-add-button ins-button">+</button>' ) ;
if ( Serializer ) {
$buttonGroup . append ( $pauseButton , $importButton , $exportButton , $helpButton ) ;
} else {
$buttonGroup . append ( $pauseButton , $helpButton ) ;
}
$inspectorContainer . prepend ( $searchBox , $addCompositeButton ) ;
$body . prepend ( $inspectorContainer ) ;
controls . pauseButton = $pauseButton ;
controls . importButton = $importButton ;
controls . exportButton = $exportButton ;
controls . helpButton = $helpButton ;
controls . searchBox = $searchBox ;
controls . container = $inspectorContainer ;
controls . addCompositeButton = $addCompositeButton ;
controls . pauseButton . click ( function ( ) {
_setPaused ( inspector , ! inspector . isPaused ) ;
} ) ;
controls . exportButton . click ( function ( ) {
_exportFile ( inspector ) ;
} ) ;
controls . importButton . click ( function ( ) {
_importFile ( inspector ) ;
} ) ;
controls . helpButton . click ( function ( ) {
_showHelp ( inspector ) ;
} ) ;
controls . addCompositeButton . click ( function ( ) {
_addNewComposite ( inspector ) ;
} ) ;
var searchTimeout ;
controls . searchBox . keyup ( function ( ) {
clearTimeout ( searchTimeout ) ;
searchTimeout = setTimeout ( function ( ) {
var value = controls . searchBox . val ( ) ,
worldTree = controls . worldTree . data ( 'jstree' ) ;
worldTree . search ( value ) ;
} , 250 ) ;
} ) ;
} ;
var _showHelp = function _showHelp ( ) {
var help = "Matter Tools\n\n" ;
help += "Drag nodes in the tree to move them between composites.\n" ;
help += "Use browser's developer console to inspect selected objects.\n" ;
help += "Note: selections only render if renderer supports it.\n\n" ;
help += "[shift + space] pause or play simulation.\n" ;
help += "[right click] and drag on empty space to select a region.\n" ;
help += "[right click] and drag on an object to move it.\n" ;
help += "[right click + shift] and drag to move whole selection.\n\n" ;
help += "[ctrl-c] to copy selected world objects.\n" ;
help += "[ctrl-v] to paste copied world objects to mouse position.\n" ;
help += "[del] or [backspace] delete selected objects.\n\n" ;
help += "[shift + s] scale-xy selected objects with mouse or arrows.\n" ;
help += "[shift + s + d] scale-x selected objects with mouse or arrows.\n" ;
help += "[shift + s + f] scale-y selected objects with mouse or arrows.\n" ;
help += "[shift + r] rotate selected objects with mouse or arrows.\n\n" ;
help += "[shift + q] set selected objects as static (can't be undone).\n" ;
help += "[shift + i] import objects.\n" ;
help += "[shift + o] export selected objects.\n" ;
help += "[shift + h] toggle Matter.Gui.\n" ;
help += "[shift + y] toggle auto-hide.\n" ;
help += "[shift + r] toggle auto-rewind on play/pause.\n\n" ;
help += "[shift + j] show this help message." ;
alert ( help ) ;
} ;
var _initKeybinds = function _initKeybinds ( inspector ) {
inspector . keyBind ( 'shift+space' , function ( ) {
_setPaused ( inspector , ! inspector . isPaused ) ;
} ) ;
if ( inspector . serializer ) {
inspector . keyBind ( 'shift+o' , function ( ) {
_exportFile ( inspector ) ;
} ) ;
inspector . keyBind ( 'shift+i' , function ( ) {
_importFile ( inspector ) ;
} ) ;
}
inspector . keyBind ( 'shift+j' , function ( ) {
_showHelp ( inspector ) ;
} ) ;
inspector . keyBind ( 'shift+y' , function ( ) {
inspector . autoHide = ! inspector . autoHide ;
$body . toggleClass ( 'ins-auto-hide gui-auto-hide' , inspector . autoHide ) ;
} ) ;
inspector . keyBind ( 'shift+r' , function ( ) {
inspector . autoRewind = ! inspector . autoRewind ;
if ( ! inspector . autoRewind ) localStorage . removeItem ( 'pauseState' ) ;
} ) ;
inspector . keyBind ( 'shift+q' , function ( ) {
for ( var i = 0 ; i < inspector . selected . length ; i ++ ) {
var object = inspector . selected [ i ] . data ;
if ( object . type === 'body' && ! object . isStatic ) Body . setStatic ( object , true ) ;
}
} ) ;
inspector . keyBind ( 'del' , function ( ) {
_deleteSelectedObjects ( inspector ) ;
} ) ;
inspector . keyBind ( 'backspace' , function ( ) {
_deleteSelectedObjects ( inspector ) ;
} ) ;
if ( inspector . serializer ) {
inspector . keyBind ( 'ctrl+c' , function ( ) {
_copySelectedObjects ( inspector ) ;
} ) ;
inspector . keyBind ( 'ctrl+v' , function ( ) {
_pasteSelectedObjects ( inspector ) ;
} ) ;
}
// prevent the backspace key from navigating back
// http://stackoverflow.com/questions/1495219/how-can-i-prevent-the-backspace-key-from-navigating-back
$ ( document ) . unbind ( 'keydown' ) . bind ( 'keydown' , function ( event ) {
var doPrevent = false ;
if ( event . keyCode === 8 ) {
var d = event . srcElement || event . target ;
if ( d . tagName . toUpperCase ( ) === 'INPUT' && ( d . type . toUpperCase ( ) === 'TEXT' || d . type . toUpperCase ( ) === 'PASSWORD' || d . type . toUpperCase ( ) === 'FILE' || d . type . toUpperCase ( ) === 'EMAIL' || d . type . toUpperCase ( ) === 'SEARCH' ) || d . tagName . toUpperCase ( ) === 'TEXTAREA' ) {
doPrevent = d . readOnly || d . disabled ;
} else {
doPrevent = true ;
}
}
if ( doPrevent ) {
event . preventDefault ( ) ;
}
} ) ;
} ;
var _initTree = function _initTree ( inspector ) {
var engine = inspector . engine ,
controls = inspector . controls ,
deferTimeout ;
var worldTreeOptions = {
'core' : {
'check_callback' : true
} ,
'dnd' : {
'copy' : false
} ,
'search' : {
'show_only_matches' : true ,
'fuzzy' : false
} ,
'types' : {
'#' : {
'valid_children' : [ ]
} ,
'body' : {
'valid_children' : [ ]
} ,
'constraint' : {
'valid_children' : [ ]
} ,
'composite' : {
'valid_children' : [ ]
} ,
'bodies' : {
'valid_children' : [ 'body' ]
} ,
'constraints' : {
'valid_children' : [ 'constraint' ]
} ,
'composites' : {
'valid_children' : [ 'composite' ]
}
} ,
'plugins' : [ 'dnd' , 'types' , 'unique' , 'search' ]
} ;
controls . worldTree = $ ( '<div class="ins-world-tree">' ) . jstree ( worldTreeOptions ) ;
controls . container . append ( controls . worldTree ) ;
controls . worldTree . on ( 'changed.jstree' , function ( event , data ) {
var selected = [ ] ,
worldTree = controls . worldTree . data ( 'jstree' ) ;
if ( data . action !== 'select_node' ) return ;
// defer selection update until selection has finished propagating
clearTimeout ( deferTimeout ) ;
deferTimeout = setTimeout ( function ( ) {
data . selected = worldTree . get _selected ( ) ;
for ( var i = 0 ; i < data . selected . length ; i ++ ) {
var nodeId = data . selected [ i ] ,
objectType = nodeId . split ( '_' ) [ 0 ] ,
objectId = nodeId . split ( '_' ) [ 1 ] ,
worldObject = Composite . get ( engine . world , objectId , objectType ) ;
switch ( objectType ) {
case 'body' :
case 'constraint' :
case 'composite' :
selected . push ( worldObject ) ;
break ;
}
}
_setSelectedObjects ( inspector , selected ) ;
} , 1 ) ;
} ) ;
$ ( document ) . on ( 'dnd_stop.vakata' , function ( event , data ) {
var worldTree = controls . worldTree . data ( 'jstree' ) ,
nodes = data . data . nodes ;
// handle drag and drop
// move items between composites
for ( var i = 0 ; i < nodes . length ; i ++ ) {
var node = worldTree . get _node ( nodes [ i ] ) ,
parentNode = worldTree . get _node ( worldTree . get _parent ( nodes [ i ] ) ) ,
prevCompositeId = node . data . compositeId ,
newCompositeId = parentNode . data . compositeId ;
if ( prevCompositeId === newCompositeId ) continue ;
var nodeId = nodes [ i ] ,
objectType = nodeId . split ( '_' ) [ 0 ] ,
objectId = nodeId . split ( '_' ) [ 1 ] ,
worldObject = Composite . get ( inspector . root , objectId , objectType ) ,
prevComposite = Composite . get ( inspector . root , prevCompositeId , 'composite' ) ,
newComposite = Composite . get ( inspector . root , newCompositeId , 'composite' ) ;
Composite . move ( prevComposite , worldObject , newComposite ) ;
}
} ) ;
controls . worldTree . on ( 'dblclick.jstree' , function ( ) {
var worldTree = controls . worldTree . data ( 'jstree' ) ,
selected = worldTree . get _selected ( ) ;
// select all children of double clicked node
for ( var i = 0 ; i < selected . length ; i ++ ) {
var nodeId = selected [ i ] ,
objectType = nodeId . split ( '_' ) [ 0 ] ;
switch ( objectType ) {
case 'composite' :
case 'composites' :
case 'bodies' :
case 'constraints' :
var children = worldTree . get _node ( nodeId ) . children ;
for ( var j = 0 ; j < children . length ; j ++ ) {
worldTree . select _node ( children [ j ] , false ) ;
} break ;
}
}
} ) ;
} ;
var _addBodyClass = function _addBodyClass ( inspector , classNames ) {
// only apply changes to prevent DOM lag
if ( inspector . bodyClass . indexOf ( ' ' + classNames ) === - 1 ) {
$body . addClass ( classNames ) ;
inspector . bodyClass = ' ' + $body . attr ( 'class' ) ;
}
} ;
var _removeBodyClass = function _removeBodyClass ( inspector , classNames ) {
// only apply changes to prevent DOM lag
var updateRequired = false ,
classes = classNames . split ( ' ' ) ;
for ( var i = 0 ; i < classes . length ; i ++ ) {
updateRequired = inspector . bodyClass . indexOf ( ' ' + classes [ i ] ) !== - 1 ;
if ( updateRequired ) break ;
}
if ( updateRequired ) {
$body . removeClass ( classNames ) ;
inspector . bodyClass = ' ' + $body . attr ( 'class' ) ;
}
} ;
var _getMousePosition = function _getMousePosition ( inspector ) {
return Vector . add ( inspector . mouse . position , inspector . offset ) ;
} ;
var _initEngineEvents = function _initEngineEvents ( inspector ) {
var engine = inspector . engine ,
mouse = inspector . mouse ,
mousePosition = _getMousePosition ( inspector ) ,
controls = inspector . controls ;
inspector . beforeEngineUpdate = function ( ) {
// update mouse position reference
mousePosition = _getMousePosition ( inspector ) ;
var mouseDelta = mousePosition . x - inspector . mousePrevPosition . x ,
keyDelta = km . isPressed ( 'up' ) + km . isPressed ( 'right' ) - km . isPressed ( 'down' ) - km . isPressed ( 'left' ) ,
delta = mouseDelta + keyDelta ;
// update interface when world changes
if ( engine . world . isModified ) {
var data = _generateCompositeTreeNode ( inspector . root , null , true ) ;
_updateTree ( controls . worldTree . data ( 'jstree' ) , data ) ;
_setSelectedObjects ( inspector , [ ] ) ;
}
// update region selection
if ( inspector . selectStart !== null ) {
inspector . selectEnd . x = mousePosition . x ;
inspector . selectEnd . y = mousePosition . y ;
Bounds . update ( inspector . selectBounds , [ inspector . selectStart , inspector . selectEnd ] ) ;
}
// rotate mode
if ( km . shift && km . isPressed ( 'r' ) ) {
var rotateSpeed = 0.03 ,
angle = Math . max ( - 2 , Math . min ( 2 , delta ) ) * rotateSpeed ;
_addBodyClass ( inspector , 'ins-cursor-rotate' ) ;
_rotateSelectedObjects ( inspector , angle ) ;
} else {
_removeBodyClass ( inspector , 'ins-cursor-rotate' ) ;
}
// scale mode
if ( km . shift && km . isPressed ( 's' ) ) {
var scaleSpeed = 0.02 ,
scale = 1 + Math . max ( - 2 , Math . min ( 2 , delta ) ) * scaleSpeed ;
_addBodyClass ( inspector , 'ins-cursor-scale' ) ;
var scaleX , scaleY ;
if ( km . isPressed ( 'd' ) ) {
scaleX = scale ;
scaleY = 1 ;
} else if ( km . isPressed ( 'f' ) ) {
scaleX = 1 ;
scaleY = scale ;
} else {
scaleX = scaleY = scale ;
}
_scaleSelectedObjects ( inspector , scaleX , scaleY ) ;
} else {
_removeBodyClass ( inspector , 'ins-cursor-scale' ) ;
}
// translate mode
if ( mouse . button === 2 ) {
_addBodyClass ( inspector , 'ins-cursor-move' ) ;
_moveSelectedObjects ( inspector , mousePosition . x , mousePosition . y ) ;
} else {
_removeBodyClass ( inspector , 'ins-cursor-move' ) ;
}
inspector . mousePrevPosition = Common . clone ( mousePosition ) ;
} ;
Events . on ( inspector . engine , 'beforeUpdate' , inspector . beforeEngineUpdate ) ;
if ( inspector . mouseConstraint ) {
Events . on ( inspector . mouseConstraint , 'mouseup' , function ( ) {
// select objects in region if making a region selection
if ( inspector . selectStart !== null ) {
var selected = Query . region ( Composite . allBodies ( engine . world ) , inspector . selectBounds ) ;
_setSelectedObjects ( inspector , selected ) ;
}
// clear selection region
inspector . selectStart = null ;
inspector . selectEnd = null ;
Events . trigger ( inspector , 'selectEnd' ) ;
} ) ;
Events . on ( inspector . mouseConstraint , 'mousedown' , function ( ) {
var bodies = Composite . allBodies ( engine . world ) ,
constraints = Composite . allConstraints ( engine . world ) ,
isUnionSelect = km . shift || km . control ,
worldTree = inspector . controls . worldTree . data ( 'jstree' ) ,
i ;
if ( mouse . button === 2 ) {
var hasSelected = false ;
for ( i = 0 ; i < bodies . length ; i ++ ) {
var body = bodies [ i ] ;
if ( Bounds . contains ( body . bounds , mousePosition ) && Vertices . contains ( body . vertices , mousePosition ) ) {
if ( isUnionSelect ) {
_addSelectedObject ( inspector , body ) ;
} else {
_setSelectedObjects ( inspector , [ body ] ) ;
}
hasSelected = true ;
break ;
}
}
if ( ! hasSelected ) {
for ( i = 0 ; i < constraints . length ; i ++ ) {
var constraint = constraints [ i ] ,
bodyA = constraint . bodyA ,
bodyB = constraint . bodyB ;
if ( constraint . label . indexOf ( 'Mouse Constraint' ) !== - 1 ) continue ;
var pointAWorld = constraint . pointA ,
pointBWorld = constraint . pointB ;
if ( bodyA ) pointAWorld = Vector . add ( bodyA . position , constraint . pointA ) ;
if ( bodyB ) pointBWorld = Vector . add ( bodyB . position , constraint . pointB ) ;
if ( ! pointAWorld || ! pointBWorld ) continue ;
var distA = Vector . magnitudeSquared ( Vector . sub ( mousePosition , pointAWorld ) ) ,
distB = Vector . magnitudeSquared ( Vector . sub ( mousePosition , pointBWorld ) ) ;
if ( distA < 100 || distB < 100 ) {
if ( isUnionSelect ) {
_addSelectedObject ( inspector , constraint ) ;
} else {
_setSelectedObjects ( inspector , [ constraint ] ) ;
}
hasSelected = true ;
break ;
}
}
if ( ! hasSelected ) {
worldTree . deselect _all ( true ) ;
_setSelectedObjects ( inspector , [ ] ) ;
inspector . selectStart = Common . clone ( mousePosition ) ;
inspector . selectEnd = Common . clone ( mousePosition ) ;
Bounds . update ( inspector . selectBounds , [ inspector . selectStart , inspector . selectEnd ] ) ;
Events . trigger ( inspector , 'selectStart' ) ;
} else {
inspector . selectStart = null ;
inspector . selectEnd = null ;
}
}
}
if ( mouse . button === 2 && inspector . selected . length > 0 ) {
_addBodyClass ( inspector , 'ins-cursor-move' ) ;
_updateSelectedMouseDownOffset ( inspector ) ;
}
} ) ;
}
if ( inspector . render ) {
inspector . afterRender = function ( ) {
var renderController = inspector . render . controller ,
context = inspector . render . context ;
if ( renderController . inspector ) renderController . inspector ( inspector , context ) ;
} ;
Events . on ( inspector . render , 'afterRender' , inspector . afterRender ) ;
}
} ;
var _deleteSelectedObjects = function _deleteSelectedObjects ( inspector ) {
var objects = [ ] ,
object ,
worldTree = inspector . controls . worldTree . data ( 'jstree' ) ,
i ;
// delete objects in world
for ( i = 0 ; i < inspector . selected . length ; i ++ ) {
object = inspector . selected [ i ] . data ;
if ( object !== inspector . engine . world ) objects . push ( object ) ;
}
// also delete non-world composites (selected only in the UI tree)
var selectedNodes = worldTree . get _selected ( ) ;
for ( i = 0 ; i < selectedNodes . length ; i ++ ) {
var node = worldTree . get _node ( selectedNodes [ i ] ) ;
if ( node . type === 'composite' ) {
node = worldTree . get _node ( node . children [ 0 ] ) ;
if ( node . data ) {
var compositeId = node . data . compositeId ;
object = Composite . get ( inspector . root , compositeId , 'composite' ) ;
if ( object && object !== inspector . engine . world ) {
objects . push ( object ) ;
worldTree . delete _node ( selectedNodes [ i ] ) ;
}
}
}
}
Composite . remove ( inspector . root , objects , true ) ;
_setSelectedObjects ( inspector , [ ] ) ;
} ;
var _copySelectedObjects = function _copySelectedObjects ( inspector ) {
inspector . clipboard . length = 0 ;
// put selected objects into clipboard
for ( var i = 0 ; i < inspector . selected . length ; i ++ ) {
var object = inspector . selected [ i ] . data ;
if ( object . type !== 'body' ) continue ;
inspector . clipboard . push ( object ) ;
}
} ;
var _pasteSelectedObjects = function _pasteSelectedObjects ( inspector ) {
if ( ! inspector . serializer ) {
return ;
}
var objects = [ ] ,
worldTree = inspector . controls . worldTree . data ( 'jstree' ) ;
// copy objects in world
for ( var i = 0 ; i < inspector . clipboard . length ; i ++ ) {
var object = inspector . clipboard [ i ] ,
clone = Serializer . clone ( inspector . serializer , object ) ;
Body . translate ( clone , { x : 50 , y : 50 } ) ;
// add the clone to the same composite as original
var node = worldTree . get _node ( object . type + '_' + object . id , false ) ,
compositeId = node . data . compositeId ,
composite = Composite . get ( inspector . engine . world , compositeId , 'composite' ) ;
Composite . add ( composite , clone ) ;
objects . push ( clone ) ;
}
// select clones after waiting for tree to update
setTimeout ( function ( ) {
_setSelectedObjects ( inspector , objects ) ;
} , 200 ) ;
} ;
var _updateSelectedMouseDownOffset = function _updateSelectedMouseDownOffset ( inspector ) {
var selected = inspector . selected ,
mousePosition = _getMousePosition ( inspector ) ,
item ,
data ;
for ( var i = 0 ; i < selected . length ; i ++ ) {
item = selected [ i ] ;
data = item . data ;
if ( data . position ) {
item . mousedownOffset = {
x : mousePosition . x - data . position . x ,
y : mousePosition . y - data . position . y
} ;
} else if ( data . pointA && ! data . bodyA ) {
item . mousedownOffset = {
x : mousePosition . x - data . pointA . x ,
y : mousePosition . y - data . pointA . y
} ;
} else if ( data . pointB && ! data . bodyB ) {
item . mousedownOffset = {
x : mousePosition . x - data . pointB . x ,
y : mousePosition . y - data . pointB . y
} ;
}
}
} ;
var _moveSelectedObjects = function _moveSelectedObjects ( inspector , x , y ) {
var selected = inspector . selected ,
item ,
data ;
for ( var i = 0 ; i < selected . length ; i ++ ) {
item = selected [ i ] ;
data = item . data ;
if ( ! item . mousedownOffset ) continue ;
switch ( data . type ) {
case 'body' :
var delta = {
x : x - data . position . x - item . mousedownOffset . x ,
y : y - data . position . y - item . mousedownOffset . y
} ;
Body . translate ( data , delta ) ;
data . positionPrev . x = data . position . x ;
data . positionPrev . y = data . position . y ;
break ;
case 'constraint' :
var point = data . pointA ;
if ( data . bodyA ) point = data . pointB ;
point . x = x - item . mousedownOffset . x ;
point . y = y - item . mousedownOffset . y ;
var initialPointA = data . bodyA ? Vector . add ( data . bodyA . position , data . pointA ) : data . pointA ,
initialPointB = data . bodyB ? Vector . add ( data . bodyB . position , data . pointB ) : data . pointB ;
data . length = Vector . magnitude ( Vector . sub ( initialPointA , initialPointB ) ) ;
break ;
}
}
} ;
var _scaleSelectedObjects = function _scaleSelectedObjects ( inspector , scaleX , scaleY ) {
var selected = inspector . selected ,
item ,
data ;
for ( var i = 0 ; i < selected . length ; i ++ ) {
item = selected [ i ] ;
data = item . data ;
switch ( data . type ) {
case 'body' :
Body . scale ( data , scaleX , scaleY , data . position ) ;
if ( data . circleRadius ) data . circleRadius *= scaleX ;
break ;
}
}
} ;
var _rotateSelectedObjects = function _rotateSelectedObjects ( inspector , angle ) {
var selected = inspector . selected ,
item ,
data ;
for ( var i = 0 ; i < selected . length ; i ++ ) {
item = selected [ i ] ;
data = item . data ;
switch ( data . type ) {
case 'body' :
Body . rotate ( data , angle ) ;
break ;
}
}
} ;
var _setPaused = function _setPaused ( inspector , isPaused ) {
if ( isPaused ) {
if ( inspector . autoRewind && inspector . serializer ) {
_setSelectedObjects ( inspector , [ ] ) ;
Serializer . loadState ( inspector . serializer , inspector . engine , 'pauseState' ) ;
}
inspector . engine . timing . timeScale = 0 ;
inspector . isPaused = true ;
inspector . controls . pauseButton . text ( 'Play' ) ;
Events . trigger ( inspector , 'paused' ) ;
} else {
if ( inspector . autoRewind && inspector . serializer ) {
Serializer . saveState ( inspector . serializer , inspector . engine , 'pauseState' ) ;
}
inspector . engine . timing . timeScale = 1 ;
inspector . isPaused = false ;
inspector . controls . pauseButton . text ( 'Pause' ) ;
Events . trigger ( inspector , 'play' ) ;
}
} ;
var _setSelectedObjects = function _setSelectedObjects ( inspector , objects ) {
var worldTree = inspector . controls . worldTree . data ( 'jstree' ) ,
data ,
i ;
for ( i = 0 ; i < inspector . selected . length ; i ++ ) {
data = inspector . selected [ i ] . data ;
worldTree . deselect _node ( data . type + '_' + data . id , true ) ;
}
inspector . selected = [ ] ;
if ( objects . length > 0 ) {
console . clear ( ) ;
}
for ( i = 0 ; i < objects . length ; i ++ ) {
data = objects [ i ] ;
if ( data ) {
// add the object to the selection
_addSelectedObject ( inspector , data ) ;
// log selected objects to console for property inspection
if ( i < 5 ) {
console . log ( data . label + ' ' + data . id + ': %O' , data ) ;
} else if ( i === 6 ) {
console . warn ( 'Omitted inspecting ' + ( objects . length - 5 ) + ' more objects' ) ;
}
}
}
} ;
var _addSelectedObject = function _addSelectedObject ( inspector , object ) {
if ( ! object ) return ;
var worldTree = inspector . controls . worldTree . data ( 'jstree' ) ;
inspector . selected . push ( { data : object } ) ;
worldTree . select _node ( object . type + '_' + object . id , true ) ;
} ;
var _updateTree = function _updateTree ( tree , data ) {
data [ 0 ] . state = data [ 0 ] . state || { opened : true } ;
tree . settings . core . data = data ;
tree . refresh ( - 1 ) ;
} ;
var _generateCompositeTreeNode = function _generateCompositeTreeNode ( composite , compositeId , isRoot ) {
var children = [ ] ,
node = {
id : 'composite_' + composite . id ,
data : {
compositeId : compositeId
} ,
type : 'composite' ,
text : ( composite . label ? composite . label : 'Composite' ) + ' ' + composite . id ,
'li_attr' : {
'class' : 'jstree-node-type-composite'
}
} ;
var childNode = _generateCompositesTreeNode ( composite . composites , composite . id ) ;
childNode . id = 'composites_' + composite . id ;
children . push ( childNode ) ;
if ( isRoot ) return childNode . children ;
childNode = _generateBodiesTreeNode ( composite . bodies , composite . id ) ;
childNode . id = 'bodies_' + composite . id ;
children . push ( childNode ) ;
childNode = _generateConstraintsTreeNode ( composite . constraints , composite . id ) ;
childNode . id = 'constraints_' + composite . id ;
children . push ( childNode ) ;
node . children = children ;
return node ;
} ;
var _generateCompositesTreeNode = function _generateCompositesTreeNode ( composites , compositeId ) {
var node = {
type : 'composites' ,
text : 'Composites' ,
data : {
compositeId : compositeId
} ,
children : [ ] ,
'li_attr' : {
'class' : 'jstree-node-type-composites'
}
} ;
for ( var i = 0 ; i < composites . length ; i ++ ) {
var composite = composites [ i ] ;
node . children . push ( _generateCompositeTreeNode ( composite , compositeId ) ) ;
}
return node ;
} ;
var _generateBodiesTreeNode = function _generateBodiesTreeNode ( bodies , compositeId ) {
var node = {
type : 'bodies' ,
text : 'Bodies' ,
data : {
compositeId : compositeId
} ,
children : [ ] ,
'li_attr' : {
'class' : 'jstree-node-type-bodies'
}
} ;
for ( var i = 0 ; i < bodies . length ; i ++ ) {
var body = bodies [ i ] ;
node . children . push ( {
type : 'body' ,
id : 'body_' + body . id ,
data : {
compositeId : compositeId
} ,
text : ( body . label ? body . label : 'Body' ) + ' ' + body . id ,
'li_attr' : {
'class' : 'jstree-node-type-body'
}
} ) ;
}
return node ;
} ;
var _generateConstraintsTreeNode = function _generateConstraintsTreeNode ( constraints , compositeId ) {
var node = {
type : 'constraints' ,
text : 'Constraints' ,
data : {
compositeId : compositeId
} ,
children : [ ] ,
'li_attr' : {
'class' : 'jstree-node-type-constraints'
}
} ;
for ( var i = 0 ; i < constraints . length ; i ++ ) {
var constraint = constraints [ i ] ;
node . children . push ( {
type : 'constraint' ,
id : 'constraint_' + constraint . id ,
data : {
compositeId : compositeId
} ,
text : ( constraint . label ? constraint . label : 'Constraint' ) + ' ' + constraint . id ,
'li_attr' : {
'class' : 'jstree-node-type-constraint'
}
} ) ;
}
return node ;
} ;
var _addNewComposite = function _addNewComposite ( inspector ) {
var newComposite = Composite . create ( ) ;
Composite . add ( inspector . root , newComposite ) ;
// move new composite to the start so that it appears top of tree
inspector . root . composites . splice ( inspector . root . composites . length - 1 , 1 ) ;
inspector . root . composites . unshift ( newComposite ) ;
Composite . setModified ( inspector . engine . world , true , true , false ) ;
} ;
var _exportFile = function _exportFile ( inspector ) {
if ( ! inspector . serializer ) {
alert ( 'No serializer.' ) ;
return ;
}
if ( inspector . selected . length === 0 ) {
alert ( 'No objects were selected, so export could not be created. Can only export objects that are in the World composite.' ) ;
return ;
}
var fileName = 'export-objects' ,
exportComposite = Composite . create ( {
label : 'Exported Objects'
} ) ;
// add everything else, must be in top-down order
for ( var i = 0 ; i < inspector . selected . length ; i ++ ) {
var object = inspector . selected [ i ] . data ;
// skip if it's already in the composite tree
// this means orphans will be added in the root
if ( Composite . get ( exportComposite , object . id , object . type ) ) continue ;
Composite . add ( exportComposite , object ) ;
// better filename for small exports
if ( inspector . selected . length === 1 ) fileName = 'export-' + object . label + '-' + object . id ;
}
// santise filename
fileName = fileName . toLowerCase ( ) . replace ( /[^\w\-]/g , '' ) + '.json' ;
// serialise
var json = Serializer . serialise ( inspector . serializer , exportComposite , inspector . exportIndent ) ;
// launch export download
var _isWebkit = 'WebkitAppearance' in document . documentElement . style ;
if ( _isWebkit ) {
var blob = new Blob ( [ json ] , { type : 'application/json' } ) ,
anchor = document . createElement ( 'a' ) ;
anchor . download = fileName ;
anchor . href = ( window . webkitURL || window . URL ) . createObjectURL ( blob ) ;
anchor . dataset . downloadurl = [ 'application/json' , anchor . download , anchor . href ] . join ( ':' ) ;
anchor . click ( ) ;
} else {
window . open ( 'data:application/json;charset=utf-8,' + escape ( json ) ) ;
}
Events . trigger ( inspector , 'export' ) ;
} ;
var _importFile = function _importFile ( inspector ) {
if ( ! inspector . serializer ) {
alert ( 'No serializer.' ) ;
return ;
}
var element = document . createElement ( 'div' ) ,
fileInput ;
element . innerHTML = '<input type="file">' ;
fileInput = element . firstChild ;
fileInput . addEventListener ( 'change' , function ( ) {
var file = fileInput . files [ 0 ] ;
if ( file . name . match ( /\.(txt|json)$/ ) ) {
var reader = new FileReader ( ) ;
reader . onload = function ( ) {
var importedComposite = inspector . serializer . parse ( reader . result ) ;
if ( importedComposite ) {
importedComposite . label = 'Imported Objects' ;
Composite . rebase ( importedComposite ) ;
Composite . add ( inspector . root , importedComposite ) ;
// move imported composite to the start so that it appears top of tree
inspector . root . composites . splice ( inspector . root . composites . length - 1 , 1 ) ;
inspector . root . composites . unshift ( importedComposite ) ;
var worldTree = inspector . controls . worldTree . data ( 'jstree' ) ,
data = _generateCompositeTreeNode ( inspector . root , null , true ) ;
_updateTree ( worldTree , data ) ;
}
} ;
reader . readAsText ( file ) ;
} else {
alert ( 'File not supported, .json or .txt JSON files only' ) ;
}
} ) ;
fileInput . click ( ) ;
} ;
/ *
*
* Events Documentation
*
* /
/ * *
* Fired after the inspector ' s import button pressed
*
* @ event export
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/ * *
* Fired after the inspector ' s export button pressed
*
* @ event import
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/ * *
* Fired after the inspector user starts making a selection
*
* @ event selectStart
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/ * *
* Fired after the inspector user ends making a selection
*
* @ event selectEnd
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/ * *
* Fired after the inspector is paused
*
* @ event pause
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/ * *
* Fired after the inspector is played
*
* @ event play
* @ param { } event An event object
* @ param { } event . source The source object of the event
* @ param { } event . name The name of the event
* /
/*** EXPORTS FROM exports-loader ***/
/***/ } ,
/* 1 */
/***/ function ( module , exports ) {
module . exports = _ _WEBPACK _EXTERNAL _MODULE _1 _ _ ;
/***/ } ,
/* 2 */
2017-01-26 18:42:07 -05:00
/***/ function ( module , exports ) {
module . exports = _ _WEBPACK _EXTERNAL _MODULE _2 _ _ ;
/***/ } ,
/* 3 */
2016-11-20 19:41:57 -05:00
/***/ function ( module , exports ) {
"use strict" ;
/ * *
* @ class Common
* /
var Common = module . exports = { } ;
Common . injectStyles = function ( styles , id ) {
if ( document . getElementById ( id ) ) {
return ;
}
var root = document . createElement ( 'div' ) ;
root . innerHTML = '<style id="' + id + '" type="text/css">' + styles + '</style>' ;
2017-01-26 18:42:07 -05:00
var lastStyle = document . head . querySelector ( 'style:last-of-type' ) ;
2016-11-20 19:41:57 -05:00
Common . domInsertBefore ( root . firstElementChild , lastStyle ) ;
} ;
Common . injectScript = function ( url , id , callback ) {
if ( document . getElementById ( id ) ) {
return ;
}
var script = document . createElement ( 'script' ) ;
script . id = id ;
script . src = url ;
script . onload = callback ;
document . body . appendChild ( script ) ;
} ;
Common . domRemove = function ( element ) {
return element . parentElement . removeChild ( element ) ;
} ;
Common . domInsertBefore = function ( element , before ) {
return before . parentNode . insertBefore ( element , before . previousElementSibling ) ;
} ;
/*** EXPORTS FROM exports-loader ***/
/***/ } ,
/* 4 */ ,
2017-01-26 18:42:07 -05:00
/* 5 */ ,
2016-11-20 19:41:57 -05:00
/* 6 */ ,
/* 7 */
/***/ function ( module , exports ) {
module . exports = _ _WEBPACK _EXTERNAL _MODULE _7 _ _ ;
/***/ } ,
/* 8 */
/***/ function ( module , exports , _ _webpack _require _ _ ) {
var _ _WEBPACK _AMD _DEFINE _FACTORY _ _ , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ , _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; /*! jsTree - v3.3.3 - 2016-10-31 - (MIT) */
! function ( a ) { "use strict" ; true ? ! ( _ _WEBPACK _AMD _DEFINE _ARRAY _ _ = [ _ _webpack _require _ _ ( 7 ) ] , _ _WEBPACK _AMD _DEFINE _FACTORY _ _ = ( a ) , _ _WEBPACK _AMD _DEFINE _RESULT _ _ = ( typeof _ _WEBPACK _AMD _DEFINE _FACTORY _ _ === 'function' ? ( _ _WEBPACK _AMD _DEFINE _FACTORY _ _ . apply ( exports , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ ) ) : _ _WEBPACK _AMD _DEFINE _FACTORY _ _ ) , _ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) ) : "undefined" != typeof module && module . exports ? module . exports = a ( require ( "jquery" ) ) : a ( jQuery ) } ( function ( a , b ) { "use strict" ; if ( ! a . jstree ) { var c = 0 , d = ! 1 , e = ! 1 , f = ! 1 , g = [ ] , h = a ( "script:last" ) . attr ( "src" ) , i = window . document ; a . jstree = { version : "3.3.3" , defaults : { plugins : [ ] } , plugins : { } , path : h && - 1 !== h . indexOf ( "/" ) ? h . replace ( /\/[^\/]+$/ , "" ) : "" , idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g , root : "#" } , a . jstree . create = function ( b , d ) { var e = new a . jstree . core ( ++ c ) , f = d ; return d = a . extend ( ! 0 , { } , a . jstree . defaults , d ) , f && f . plugins && ( d . plugins = f . plugins ) , a . each ( d . plugins , function ( a , b ) { "core" !== a && ( e = e . plugin ( b , d [ b ] ) ) } ) , a ( b ) . data ( "jstree" , e ) , e . init ( b , d ) , e } , a . jstree . destroy = function ( ) { a ( ".jstree:jstree" ) . jstree ( "destroy" ) , a ( i ) . off ( ".jstree" ) } , a . jstree . core = function ( a ) { this . _id = a , this . _cnt = 0 , this . _wrk = null , this . _data = { core : { themes : { name : ! 1 , dots : ! 1 , icons : ! 1 , ellipsis : ! 1 } , selected : [ ] , last _error : { } , working : ! 1 , worker _queue : [ ] , focused : null } } } , a . jstree . reference = function ( b ) { var c = null , d = null ; if ( ! b || ! b . id || b . tagName && b . nodeType || ( b = b . id ) , ! d || ! d . length ) try { d = a ( b ) } catch ( e ) { } if ( ! d || ! d . length ) try { d = a ( "#" + b . replace ( a . jstree . idregex , "\\$&" ) ) } catch ( e ) { } return d && d . length && ( d = d . closest ( ".jstree" ) ) . length && ( d = d . data ( "jstree" ) ) ? c = d : a ( ".jstree" ) . each ( function ( ) { var d = a ( this ) . data ( "jstree" ) ; return d && d . _model . data [ b ] ? ( c = d , ! 1 ) : void 0 } ) , c } , a . fn . jstree = function ( c ) { var d = "string" == typeof c , e = Array . prototype . slice . call ( arguments , 1 ) , f = null ; return c !== ! 0 || this . length ? ( this . each ( function ( ) { var g = a . jstree . reference ( this ) , h = d && g ? g [ c ] : null ; return f = d && h ? h . apply ( g , e ) : null , g || d || c !== b && ! a . isPlainObject ( c ) || a . jstree . create ( this , c ) , ( g && ! d || c === ! 0 ) && ( f = g || ! 1 ) , null !== f && f !== b ? ! 1 : void 0 } ) , null !== f && f !== b ? f : this ) : ! 1 } , a . expr . pseudos . jstree = a . expr . createPseudo ( function ( c ) { return function ( c ) { return a ( c ) . hasClass ( "jstree" ) && a ( c ) . data ( "jstree" ) !== b } } ) , a . jstree . defaults . core = { data : ! 1 , strings : ! 1 , check _callback : ! 1 , error : a . noop , animation : 200 , multiple : ! 0 , themes : { name : ! 1 , url : ! 1 , dir : ! 1 , dots : ! 0 , icons : ! 0 , ellipsis : ! 1 , stripes : ! 1 , variant : ! 1 , responsive : ! 1 } , expand _selected _onload : ! 0 , worker : ! 0 , force _text : ! 1 , dblclick _toggle : ! 0 } , a . jstree . core . prototype = { plugin : function ( b , c ) { var d = a . jstree . plugins [ b ] ; return d ? ( this . _data [ b ] = { } , d . prototype = this , new d ( c , this ) ) : this } , init : function ( b , c ) { this . _model = { data : { } , changed : [ ] , force _full _redraw : ! 1 , redraw _timeout : ! 1 , default _state : { loaded : ! 0 , opened : ! 1 , selected : ! 1 , disabled : ! 1 } } , this . _model . data [ a . jstree . root ] = { id : a . jstree . root , parent : null , parents : [ ] , children : [ ] , children _d : [ ] , state : { loaded : ! 1 } } , this . element = a ( b ) . addClass ( "jstree jstree-" + this . _id ) , this . settings = c , this . _data . core . ready = ! 1 , this . _data . core . loaded = ! 1 , this . _data . core . rtl = "rtl" === this . element . css ( "direction" ) , this . element [ this . _data . core . rtl ? "addClass" : "removeClass" ] ( "jstree-rtl" ) , this . element . attr ( "role" , "tree" ) , this . settings . core . multiple && this . element . attr ( "aria-multiselectable" , ! 0 ) , this . element . attr ( "tabindex" ) || this . element . attr ( "tabindex" , "0" ) , this . bind ( ) , this . trigger ( "init" ) , this . _data . core . original _container _html = this . element . find ( " > ul > li" ) . clone ( ! 0 ) , this . _data . core . original _container _html . find ( "li" ) . addBack ( ) . contents ( ) . filter ( function ( ) { return 3 === this . nodeType && ( ! this . nodeValue || /^\s+$/ . test ( this . nodeValue ) ) } ) . remove ( ) , this . element . html ( "<ul class='jstree-container-ul jstree-children' role='group'><li id='j" + this . _id + "_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this . get _string ( "Loading ..." ) + "</a></li></ul>" ) , this . element . attr ( "aria-activedescendant" , "j" + this . _id + "_loading" ) , this . _data . core . li _height = this . get _conta
if ( ! f ) return ! 1 ; if ( f . id === a . jstree . root ) return this . redraw ( ! 0 ) ; if ( c = c || 0 === f . children . length , b = i . querySelector ? this . element [ 0 ] . querySelector ( "#" + ( - 1 !== "0123456789" . indexOf ( f . id [ 0 ] ) ? "\\3" + f . id [ 0 ] + " " + f . id . substr ( 1 ) . replace ( a . jstree . idregex , "\\$&" ) : f . id . replace ( a . jstree . idregex , "\\$&" ) ) ) : i . getElementById ( f . id ) ) b = a ( b ) , d || ( g = b . parent ( ) . parent ( ) [ 0 ] , g === this . element [ 0 ] && ( g = null ) , h = b . index ( ) ) , c || ! f . children . length || b . children ( ".jstree-children" ) . length || ( c = ! 0 ) , c || ( j = b . children ( ".jstree-children" ) [ 0 ] ) , q = b . children ( ".jstree-anchor" ) [ 0 ] === i . activeElement , b . remove ( ) ; else if ( c = ! 0 , ! d ) { if ( g = f . parent !== a . jstree . root ? a ( "#" + f . parent . replace ( a . jstree . idregex , "\\$&" ) , this . element ) [ 0 ] : null , ! ( null === g || g && p [ f . parent ] . state . opened ) ) return ! 1 ; h = a . inArray ( f . id , null === g ? p [ a . jstree . root ] . children : p [ f . parent ] . children ) } b = this . _data . core . node . cloneNode ( ! 0 ) , n = "jstree-node " ; for ( k in f . li _attr ) if ( f . li _attr . hasOwnProperty ( k ) ) { if ( "id" === k ) continue ; "class" !== k ? b . setAttribute ( k , f . li _attr [ k ] ) : n += f . li _attr [ k ] } for ( f . a _attr . id || ( f . a _attr . id = f . id + "_anchor" ) , b . setAttribute ( "aria-selected" , ! ! f . state . selected ) , b . setAttribute ( "aria-level" , f . parents . length ) , b . setAttribute ( "aria-labelledby" , f . a _attr . id ) , f . state . disabled && b . setAttribute ( "aria-disabled" , ! 0 ) , k = 0 , l = f . children . length ; l > k ; k ++ ) if ( ! p [ f . children [ k ] ] . state . hidden ) { v = ! 0 ; break } if ( null !== f . parent && p [ f . parent ] && ! f . state . hidden && ( k = a . inArray ( f . id , p [ f . parent ] . children ) , w = f . id , - 1 !== k ) ) for ( k ++ , l = p [ f . parent ] . children . length ; l > k ; k ++ ) if ( p [ p [ f . parent ] . children [ k ] ] . state . hidden || ( w = p [ f . parent ] . children [ k ] ) , w !== f . id ) break ; f . state . hidden && ( n += " jstree-hidden" ) , f . state . loaded && ! v ? n += " jstree-leaf" : ( n += f . state . opened && f . state . loaded ? " jstree-open" : " jstree-closed" , b . setAttribute ( "aria-expanded" , f . state . opened && f . state . loaded ) ) , w === f . id && ( n += " jstree-last" ) , b . id = f . id , b . className = n , n = ( f . state . selected ? " jstree-clicked" : "" ) + ( f . state . disabled ? " jstree-disabled" : "" ) ; for ( l in f . a _attr ) if ( f . a _attr . hasOwnProperty ( l ) ) { if ( "href" === l && "#" === f . a _attr [ l ] ) continue ; "class" !== l ? b . childNodes [ 1 ] . setAttribute ( l , f . a _attr [ l ] ) : n += " " + f . a _attr [ l ] } if ( n . length && ( b . childNodes [ 1 ] . className = "jstree-anchor " + n ) , ( f . icon && f . icon !== ! 0 || f . icon === ! 1 ) && ( f . icon === ! 1 ? b . childNodes [ 1 ] . childNodes [ 0 ] . className += " jstree-themeicon-hidden" : - 1 === f . icon . indexOf ( "/" ) && - 1 === f . icon . indexOf ( "." ) ? b . childNodes [ 1 ] . childNodes [ 0 ] . className += " " + f . icon + " jstree-themeicon-custom" : ( b . childNodes [ 1 ] . childNodes [ 0 ] . style . backgroundImage = 'url("' + f . icon + '")' , b . childNodes [ 1 ] . childNodes [ 0 ] . style . backgroundPosition = "center center" , b . childNodes [ 1 ] . childNodes [ 0 ] . style . backgroundSize = "auto" , b . childNodes [ 1 ] . childNodes [ 0 ] . className += " jstree-themeicon-custom" ) ) , this . settings . core . force _text ? b . childNodes [ 1 ] . appendChild ( o . createTextNode ( f . text ) ) : b . childNodes [ 1 ] . innerHTML += f . text , c && f . children . length && ( f . state . opened || e ) && f . state . loaded ) { for ( m = o . createElement ( "UL" ) , m . setAttribute ( "role" , "group" ) , m . className = "jstree-children" , k = 0 , l = f . children . length ; l > k ; k ++ ) m . appendChild ( this . redraw _node ( f . children [ k ] , c , ! 0 ) ) ; b . appendChild ( m ) } if ( j && b . appendChild ( j ) , ! d ) { for ( g || ( g = this . element [ 0 ] ) , k = 0 , l = g . childNodes . length ; l > k ; k ++ ) if ( g . childNodes [ k ] && g . childNodes [ k ] . className && - 1 !== g . childNodes [ k ] . className . indexOf ( "jstree-children" ) ) { s = g . childNodes [ k ] ; break } s || ( s = o . createElement ( "UL" ) , s . setAttribute ( "role" , "group" ) , s . className = "jstree-children" , g . appendChild ( s ) ) , g = s , h < g . childNodes . length ? g . insertBefore ( b , g . childNodes [ h ] ) : g . appendChild ( b ) , q && ( t = this . element [ 0 ] . scrollTop , u = this . element [ 0 ] . scrollLeft , b . childNodes [ 1 ] . focus ( ) , this . element [ 0 ] . scrollTop = t , this . element [ 0 ] . scrollLeft = u ) } return f . state . opened && ! f . state . loaded && ( f . state . opened = ! 1 , setTimeout ( a . proxy ( function ( ) { this . open _node ( f . id , ! 1 , 0 ) } , this ) , 0 ) ) , b } , open _node : function ( c , d , e ) { var f , g , h , i ; if ( a . isArray ( c ) ) { for ( c = c . slice ( ) , f = 0 , g = c . length ; g > f ; f ++ ) this . open _node ( c [ f ] , d , e ) ; return ! 0 } return c = this . get _node ( c ) , c && c . id !== a . jstree . root ? ( e = e === b ? this . settings . core . animation : e , this . is _closed ( c ) ? this . is _loaded ( c ) ? ( h = this . get _node ( c , ! 0 ) , i = this , h . length && ( e && h . children ( ".jstree-children" ) . length && h . children ( ".jstree-children" ) . stop ( ! 0 , ! 0 ) , c . children . length && ! this . _firstChild ( h . c
fontWeight : g . css ( "fontWeight" ) || "" , fontStyle : g . css ( "fontStyle" ) || "" , fontStretch : g . css ( "fontStretch" ) || "" , fontVariant : g . css ( "fontVariant" ) || "" , letterSpacing : g . css ( "letterSpacing" ) || "" , wordSpacing : g . css ( "wordSpacing" ) || "" } , h . attr ( "class" , g . attr ( "class" ) ) . append ( g . contents ( ) . clone ( ) ) . append ( l ) , g . replaceWith ( h ) , k . css ( m ) , l . css ( m ) . width ( Math . min ( k . text ( "pW" + l [ 0 ] . value ) . width ( ) , f ) ) [ 0 ] . select ( ) , void a ( i ) . one ( "mousedown.jstree touchstart.jstree dnd_start.vakata" , function ( b ) { l && b . target !== l && a ( l ) . blur ( ) } ) ) : ! 1 } , set _theme : function ( b , c ) { if ( ! b ) return ! 1 ; if ( c === ! 0 ) { var d = this . settings . core . themes . dir ; d || ( d = a . jstree . path + "/themes" ) , c = d + "/" + b + "/style.css" } c && - 1 === a . inArray ( c , g ) && ( a ( "head" ) . append ( '<link rel="stylesheet" href="' + c + '" type="text/css" />' ) , g . push ( c ) ) , this . _data . core . themes . name && this . element . removeClass ( "jstree-" + this . _data . core . themes . name ) , this . _data . core . themes . name = b , this . element . addClass ( "jstree-" + b ) , this . element [ this . settings . core . themes . responsive ? "addClass" : "removeClass" ] ( "jstree-" + b + "-responsive" ) , this . trigger ( "set_theme" , { theme : b } ) } , get _theme : function ( ) { return this . _data . core . themes . name } , set _theme _variant : function ( a ) { this . _data . core . themes . variant && this . element . removeClass ( "jstree-" + this . _data . core . themes . name + "-" + this . _data . core . themes . variant ) , this . _data . core . themes . variant = a , a && this . element . addClass ( "jstree-" + this . _data . core . themes . name + "-" + this . _data . core . themes . variant ) } , get _theme _variant : function ( ) { return this . _data . core . themes . variant } , show _stripes : function ( ) { this . _data . core . themes . stripes = ! 0 , this . get _container _ul ( ) . addClass ( "jstree-striped" ) , this . trigger ( "show_stripes" ) } , hide _stripes : function ( ) { this . _data . core . themes . stripes = ! 1 , this . get _container _ul ( ) . removeClass ( "jstree-striped" ) , this . trigger ( "hide_stripes" ) } , toggle _stripes : function ( ) { this . _data . core . themes . stripes ? this . hide _stripes ( ) : this . show _stripes ( ) } , show _dots : function ( ) { this . _data . core . themes . dots = ! 0 , this . get _container _ul ( ) . removeClass ( "jstree-no-dots" ) , this . trigger ( "show_dots" ) } , hide _dots : function ( ) { this . _data . core . themes . dots = ! 1 , this . get _container _ul ( ) . addClass ( "jstree-no-dots" ) , this . trigger ( "hide_dots" ) } , toggle _dots : function ( ) { this . _data . core . themes . dots ? this . hide _dots ( ) : this . show _dots ( ) } , show _icons : function ( ) { this . _data . core . themes . icons = ! 0 , this . get _container _ul ( ) . removeClass ( "jstree-no-icons" ) , this . trigger ( "show_icons" ) } , hide _icons : function ( ) { this . _data . core . themes . icons = ! 1 , this . get _container _ul ( ) . addClass ( "jstree-no-icons" ) , this . trigger ( "hide_icons" ) } , toggle _icons : function ( ) { this . _data . core . themes . icons ? this . hide _icons ( ) : this . show _icons ( ) } , show _ellipsis : function ( ) { this . _data . core . themes . ellipsis = ! 0 , this . get _container _ul ( ) . addClass ( "jstree-ellipsis" ) , this . trigger ( "show_ellipsis" ) } , hide _ellipsis : function ( ) { this . _data . core . themes . ellipsis = ! 1 , this . get _container _ul ( ) . removeClass ( "jstree-ellipsis" ) , this . trigger ( "hide_ellipsis" ) } , toggle _ellipsis : function ( ) { this . _data . core . themes . ellipsis ? this . hide _ellipsis ( ) : this . show _ellipsis ( ) } , set _icon : function ( c , d ) { var e , f , g , h ; if ( a . isArray ( c ) ) { for ( c = c . slice ( ) , e = 0 , f = c . length ; f > e ; e ++ ) this . set _icon ( c [ e ] , d ) ; return ! 0 } return c = this . get _node ( c ) , c && c . id !== a . jstree . root ? ( h = c . icon , c . icon = d === ! 0 || null === d || d === b || "" === d ? ! 0 : d , g = this . get _node ( c , ! 0 ) . children ( ".jstree-anchor" ) . children ( ".jstree-themeicon" ) , d === ! 1 ? this . hide _icon ( c ) : d === ! 0 || null === d || d === b || "" === d ? ( g . removeClass ( "jstree-themeicon-custom " + h ) . css ( "background" , "" ) . removeAttr ( "rel" ) , h === ! 1 && this . show _icon ( c ) ) : - 1 === d . indexOf ( "/" ) && - 1 === d . indexOf ( "." ) ? ( g . removeClass ( h ) . css ( "background" , "" ) , g . addClass ( d + " jstree-themeicon-custom" ) . attr ( "rel" , d ) , h === ! 1 && this . show _icon ( c ) ) : ( g . removeClass ( h ) . css ( "background" , "" ) , g . addClass ( "jstree-themeicon-custom" ) . css ( "background" , "url('" + d + "') center center no-repeat" ) . attr ( "rel" , d ) , h === ! 1 && this . show _icon ( c ) ) , ! 0 ) : ! 1 } , get _icon : function ( b ) { return b = this . get _node ( b ) , b && b . id !== a . jstree . root ? b . icon : ! 1 } , hide _icon : function ( b ) { var c , d ; if ( a . isArray ( b ) ) { for ( b = b . slice ( ) , c = 0 , d = b . length ; d > c ; c ++ ) this . hide _icon ( b [ c ] ) ; return ! 0 } return b = this . get _node ( b ) , b && b !== a . jstree . root ? ( b . icon = ! 1 , this . get _node ( b , ! 0 ) . children ( ".jstree-anchor" ) . children ( " . jstree - t
d . length || ( d = c . element . find ( "ul:visible" ) . addBack ( ) . last ( ) . children ( "li:not(.vakata-context-separator)" ) . last ( ) ) , d . addClass ( "vakata-context-hover" ) . children ( "a" ) . focus ( ) , b . stopImmediatePropagation ( ) , b . preventDefault ( ) ) ; break ; case 39 : c . is _visible && ( c . element . find ( ".vakata-context-hover" ) . last ( ) . children ( "ul" ) . show ( ) . children ( "li:not(.vakata-context-separator)" ) . removeClass ( "vakata-context-hover" ) . first ( ) . addClass ( "vakata-context-hover" ) . children ( "a" ) . focus ( ) , b . stopImmediatePropagation ( ) , b . preventDefault ( ) ) ; break ; case 40 : c . is _visible && ( d = c . element . find ( "ul:visible" ) . addBack ( ) . last ( ) . children ( ".vakata-context-hover" ) . removeClass ( "vakata-context-hover" ) . nextAll ( "li:not(.vakata-context-separator)" ) . first ( ) , d . length || ( d = c . element . find ( "ul:visible" ) . addBack ( ) . last ( ) . children ( "li:not(.vakata-context-separator)" ) . first ( ) ) , d . addClass ( "vakata-context-hover" ) . children ( "a" ) . focus ( ) , b . stopImmediatePropagation ( ) , b . preventDefault ( ) ) ; break ; case 27 : a . vakata . context . hide ( ) , b . preventDefault ( ) } } ) . on ( "keydown" , function ( a ) { a . preventDefault ( ) ; var b = c . element . find ( ".vakata-contextmenu-shortcut-" + a . which ) . parent ( ) ; b . parent ( ) . not ( ".vakata-context-disabled" ) && b . click ( ) } ) , a ( i ) . on ( "mousedown.vakata.jstree" , function ( b ) { c . is _visible && ! a . contains ( c . element [ 0 ] , b . target ) && a . vakata . context . hide ( ) } ) . on ( "context_show.vakata.jstree" , function ( a , d ) { c . element . find ( "li:has(ul)" ) . children ( "a" ) . addClass ( "vakata-context-parent" ) , b && c . element . addClass ( "vakata-context-rtl" ) . css ( "direction" , "rtl" ) , c . element . find ( "ul" ) . hide ( ) . end ( ) } ) } ) } ( a ) , a . jstree . defaults . dnd = { copy : ! 0 , open _timeout : 500 , is _draggable : ! 0 , check _while _dragging : ! 0 , always _copy : ! 1 , inside _pos : 0 , drag _selection : ! 0 , touch : ! 0 , large _drop _target : ! 1 , large _drag _target : ! 1 , use _html5 : ! 1 } ; var k , l ; a . jstree . plugins . dnd = function ( b , c ) { this . init = function ( a , b ) { c . init . call ( this , a , b ) , this . settings . dnd . use _html5 = this . settings . dnd . use _html5 && "draggable" in i . createElement ( "span" ) } , this . bind = function ( ) { c . bind . call ( this ) , this . element . on ( this . settings . dnd . use _html5 ? "dragstart.jstree" : "mousedown.jstree touchstart.jstree" , this . settings . dnd . large _drag _target ? ".jstree-node" : ".jstree-anchor" , a . proxy ( function ( b ) { if ( this . settings . dnd . large _drag _target && a ( b . target ) . closest ( ".jstree-node" ) [ 0 ] !== b . currentTarget ) return ! 0 ; if ( "touchstart" === b . type && ( ! this . settings . dnd . touch || "selected" === this . settings . dnd . touch && ! a ( b . currentTarget ) . closest ( ".jstree-node" ) . children ( ".jstree-anchor" ) . hasClass ( "jstree-clicked" ) ) ) return ! 0 ; var c = this . get _node ( b . target ) , d = this . is _selected ( c ) && this . settings . dnd . drag _selection ? this . get _top _selected ( ) . length : 1 , e = d > 1 ? d + " " + this . get _string ( "nodes" ) : this . get _text ( b . currentTarget ) ; if ( this . settings . core . force _text && ( e = a . vakata . html . escape ( e ) ) , c && c . id && c . id !== a . jstree . root && ( 1 === b . which || "touchstart" === b . type || "dragstart" === b . type ) && ( this . settings . dnd . is _draggable === ! 0 || a . isFunction ( this . settings . dnd . is _draggable ) && this . settings . dnd . is _draggable . call ( this , d > 1 ? this . get _top _selected ( ! 0 ) : [ c ] , b ) ) ) { if ( k = { jstree : ! 0 , origin : this , obj : this . get _node ( c , ! 0 ) , nodes : d > 1 ? this . get _top _selected ( ) : [ c . id ] } , l = b . currentTarget , ! this . settings . dnd . use _html5 ) return this . element . trigger ( "mousedown.jstree" ) , a . vakata . dnd . start ( b , k , '<div id="jstree-dnd" class="jstree-' + this . get _theme ( ) + " jstree-" + this . get _theme ( ) + "-" + this . get _theme _variant ( ) + " " + ( this . settings . core . themes . responsive ? " jstree-dnd-responsive" : "" ) + '"><i class="jstree-icon jstree-er"></i>' + e + '<ins class="jstree-copy" style="display:none;">+</ins></div>' ) ; a . vakata . dnd . _trigger ( "start" , b , { helper : a ( ) , element : l , data : k } ) } } , this ) ) , this . settings . dnd . use _html5 && this . element . on ( "dragover.jstree" , function ( b ) { return b . preventDefault ( ) , a . vakata . dnd . _trigger ( "move" , b , { helper : a ( ) , element : l , data : k } ) , ! 1 } ) . on ( "drop.jstree" , a . proxy ( function ( b ) { return b . preventDefault ( ) , a . vakata . dnd . _trigger ( "stop" , b , { helper : a ( ) , element : l , data : k } ) , ! 1 } , this ) ) } , this . redraw _node = function ( a , b , d , e ) { if ( a = c . redraw _node . apply ( this , arguments ) , a && this . settings . dnd . use _html5 ) if ( this . settings . dnd . large _drag _target ) a . setAttribute ( "draggable" , ! 0 ) ; else { var f , g , h = null ; for ( f = 0 , g = a . childNodes . length ; g > f ; f ++ ) if ( a . childNodes [ f ] && a . childNodes [ f ] . classNa
if ( c = c && c . id ? c : this . get _node ( c ) , e = e && e . id ? e : this . get _node ( e ) , ! e || ! e . children ) return ! 0 ; var h = "rename_node" === b ? f : c . text , i = [ ] , j = this . settings . unique . case _sensitive , k = this . _model . data , l , m ; for ( l = 0 , m = e . children . length ; m > l ; l ++ ) i . push ( j ? k [ e . children [ l ] ] . text : k [ e . children [ l ] ] . text . toLowerCase ( ) ) ; switch ( j || ( h = h . toLowerCase ( ) ) , b ) { case "delete_node" : return ! 0 ; case "rename_node" : return l = - 1 === a . inArray ( h , i ) || c . text && c . text [ j ? "toString" : "toLowerCase" ] ( ) === h , l || ( this . _data . core . last _error = { error : "check" , plugin : "unique" , id : "unique_01" , reason : "Child with name " + h + " already exists. Preventing: " + b , data : JSON . stringify ( { chk : b , pos : f , obj : c && c . id ? c . id : ! 1 , par : e && e . id ? e . id : ! 1 } ) } ) , l ; case "create_node" : return l = - 1 === a . inArray ( h , i ) , l || ( this . _data . core . last _error = { error : "check" , plugin : "unique" , id : "unique_04" , reason : "Child with name " + h + " already exists. Preventing: " + b , data : JSON . stringify ( { chk : b , pos : f , obj : c && c . id ? c . id : ! 1 , par : e && e . id ? e . id : ! 1 } ) } ) , l ; case "copy_node" : return l = - 1 === a . inArray ( h , i ) , l || ( this . _data . core . last _error = { error : "check" , plugin : "unique" , id : "unique_02" , reason : "Child with name " + h + " already exists. Preventing: " + b , data : JSON . stringify ( { chk : b , pos : f , obj : c && c . id ? c . id : ! 1 , par : e && e . id ? e . id : ! 1 } ) } ) , l ; case "move_node" : return l = c . parent === e . id && ( ! g || ! g . is _multi ) || - 1 === a . inArray ( h , i ) , l || ( this . _data . core . last _error = { error : "check" , plugin : "unique" , id : "unique_03" , reason : "Child with name " + h + " already exists. Preventing: " + b , data : JSON . stringify ( { chk : b , pos : f , obj : c && c . id ? c . id : ! 1 , par : e && e . id ? e . id : ! 1 } ) } ) , l } return ! 0 } , this . create _node = function ( c , e , f , g , h ) { if ( ! e || e . text === b ) { if ( null === c && ( c = a . jstree . root ) , c = this . get _node ( c ) , ! c ) return d . create _node . call ( this , c , e , f , g , h ) ; if ( f = f === b ? "last" : f , ! f . toString ( ) . match ( /^(before|after)$/ ) && ! h && ! this . is _loaded ( c ) ) return d . create _node . call ( this , c , e , f , g , h ) ; e || ( e = { } ) ; var i , j , k , l , m , n = this . _model . data , o = this . settings . unique . case _sensitive , p = this . settings . unique . duplicate ; for ( j = i = this . get _string ( "New node" ) , k = [ ] , l = 0 , m = c . children . length ; m > l ; l ++ ) k . push ( o ? n [ c . children [ l ] ] . text : n [ c . children [ l ] ] . text . toLowerCase ( ) ) ; l = 1 ; while ( - 1 !== a . inArray ( o ? j : j . toLowerCase ( ) , k ) ) j = p . call ( this , i , ++ l ) . toString ( ) ; e . text = j } return d . create _node . call ( this , c , e , f , g , h ) } } ; var n = i . createElement ( "DIV" ) ; if ( n . setAttribute ( "unselectable" , "on" ) , n . setAttribute ( "role" , "presentation" ) , n . className = "jstree-wholerow" , n . innerHTML = " " , a . jstree . plugins . wholerow = function ( b , c ) { this . bind = function ( ) { c . bind . call ( this ) , this . element . on ( "ready.jstree set_state.jstree" , a . proxy ( function ( ) { this . hide _dots ( ) } , this ) ) . on ( "init.jstree loading.jstree ready.jstree" , a . proxy ( function ( ) { this . get _container _ul ( ) . addClass ( "jstree-wholerow-ul" ) } , this ) ) . on ( "deselect_all.jstree" , a . proxy ( function ( a , b ) { this . element . find ( ".jstree-wholerow-clicked" ) . removeClass ( "jstree-wholerow-clicked" ) } , this ) ) . on ( "changed.jstree" , a . proxy ( function ( a , b ) { this . element . find ( ".jstree-wholerow-clicked" ) . removeClass ( "jstree-wholerow-clicked" ) ; var c = ! 1 , d , e ; for ( d = 0 , e = b . selected . length ; e > d ; d ++ ) c = this . get _node ( b . selected [ d ] , ! 0 ) , c && c . length && c . children ( ".jstree-wholerow" ) . addClass ( "jstree-wholerow-clicked" ) } , this ) ) . on ( "open_node.jstree" , a . proxy ( function ( a , b ) { this . get _node ( b . node , ! 0 ) . find ( ".jstree-clicked" ) . parent ( ) . children ( ".jstree-wholerow" ) . addClass ( "jstree-wholerow-clicked" ) } , this ) ) . on ( "hover_node.jstree dehover_node.jstree" , a . proxy ( function ( a , b ) { "hover_node" === a . type && this . is _disabled ( b . node ) || this . get _node ( b . node , ! 0 ) . children ( ".jstree-wholerow" ) [ "hover_node" === a . type ? "addClass" : "removeClass" ] ( "jstree-wholerow-hovered" ) } , this ) ) . on ( "contextmenu.jstree" , ".jstree-wholerow" , a . proxy ( function ( b ) { if ( this . _data . contextmenu ) { b . preventDefault ( ) ; var c = a . Event ( "contextmenu" , { metaKey : b . metaKey , ctrlKey : b . ctrlKey , altKey : b . altKey , shiftKey : b . shiftKey , pageX : b . pageX , pageY : b . pageY } ) ; a ( b . currentTarget ) . closest ( ".jstree-node" ) . children ( ".jstree-anchor" ) . first ( ) . trigger ( c ) } } , this ) ) . on ( "click.jstree" , ".jstree-wholerow" , function ( b ) { b . stopImmediatePropagation ( ) ; var c = a . Event ( "click" , { metaKey : b . metaKey , ctrlKey : b . ctrlKey , altKey : b . altKey , shiftKey : b . shiftKey } ) ; a ( b . currentTarget ) . closest ( ".jstree-node" ) . children ( ".jstree-anchor" ) . first ( ) . trigger ( c ) . focus ( )
/***/ } ,
/* 9 */
/***/ function ( module , exports , _ _webpack _require _ _ ) {
// keymaster.js
// (c) 2011-2013 Thomas Fuchs
// keymaster.js may be freely distributed under the MIT license.
; ( function ( global ) {
var k ,
_handlers = { } ,
_mods = { 16 : false , 18 : false , 17 : false , 91 : false } ,
_scope = 'all' ,
// modifier keys
_MODIFIERS = {
'⇧' : 16 , shift : 16 ,
'⌥' : 18 , alt : 18 , option : 18 ,
'⌃' : 17 , ctrl : 17 , control : 17 ,
'⌘' : 91 , command : 91
} ,
// special keys
_MAP = {
backspace : 8 , tab : 9 , clear : 12 ,
enter : 13 , 'return' : 13 ,
esc : 27 , escape : 27 , space : 32 ,
left : 37 , up : 38 ,
right : 39 , down : 40 ,
del : 46 , 'delete' : 46 ,
home : 36 , end : 35 ,
pageup : 33 , pagedown : 34 ,
',' : 188 , '.' : 190 , '/' : 191 ,
'`' : 192 , '-' : 189 , '=' : 187 ,
';' : 186 , '\'' : 222 ,
'[' : 219 , ']' : 221 , '\\' : 220
} ,
code = function ( x ) {
return _MAP [ x ] || x . toUpperCase ( ) . charCodeAt ( 0 ) ;
} ,
_downKeys = [ ] ;
for ( k = 1 ; k < 20 ; k ++ ) _MAP [ 'f' + k ] = 111 + k ;
// IE doesn't support Array#indexOf, so have a simple replacement
function index ( array , item ) {
var i = array . length ;
while ( i -- ) if ( array [ i ] === item ) return i ;
return - 1 ;
}
// for comparing mods before unassignment
function compareArray ( a1 , a2 ) {
if ( a1 . length != a2 . length ) return false ;
for ( var i = 0 ; i < a1 . length ; i ++ ) {
if ( a1 [ i ] !== a2 [ i ] ) return false ;
}
return true ;
}
var modifierMap = {
16 : 'shiftKey' ,
18 : 'altKey' ,
17 : 'ctrlKey' ,
91 : 'metaKey'
} ;
function updateModifierKey ( event ) {
for ( k in _mods ) _mods [ k ] = event [ modifierMap [ k ] ] ;
} ;
// handle keydown event
function dispatch ( event ) {
var key , handler , k , i , modifiersMatch , scope ;
key = event . keyCode ;
if ( index ( _downKeys , key ) == - 1 ) {
_downKeys . push ( key ) ;
}
// if a modifier key, set the key.<modifierkeyname> property to true and return
if ( key == 93 || key == 224 ) key = 91 ; // right command on webkit, command on Gecko
if ( key in _mods ) {
_mods [ key ] = true ;
// 'assignKey' from inside this closure is exported to window.key
for ( k in _MODIFIERS ) if ( _MODIFIERS [ k ] == key ) assignKey [ k ] = true ;
return ;
}
updateModifierKey ( event ) ;
// see if we need to ignore the keypress (filter() can can be overridden)
// by default ignore key presses if a select, textarea, or input is focused
if ( ! assignKey . filter . call ( this , event ) ) return ;
// abort if no potentially matching shortcuts found
if ( ! ( key in _handlers ) ) return ;
scope = getScope ( ) ;
// for each potential shortcut
for ( i = 0 ; i < _handlers [ key ] . length ; i ++ ) {
handler = _handlers [ key ] [ i ] ;
// see if it's in the current scope
if ( handler . scope == scope || handler . scope == 'all' ) {
// check if modifiers match if any
modifiersMatch = handler . mods . length > 0 ;
for ( k in _mods )
if ( ( ! _mods [ k ] && index ( handler . mods , + k ) > - 1 ) ||
( _mods [ k ] && index ( handler . mods , + k ) == - 1 ) ) modifiersMatch = false ;
// call the handler and stop the event if neccessary
if ( ( handler . mods . length == 0 && ! _mods [ 16 ] && ! _mods [ 18 ] && ! _mods [ 17 ] && ! _mods [ 91 ] ) || modifiersMatch ) {
if ( handler . method ( event , handler ) === false ) {
if ( event . preventDefault ) event . preventDefault ( ) ;
else event . returnValue = false ;
if ( event . stopPropagation ) event . stopPropagation ( ) ;
if ( event . cancelBubble ) event . cancelBubble = true ;
}
}
}
}
} ;
// unset modifier keys on keyup
function clearModifier ( event ) {
var key = event . keyCode , k ,
i = index ( _downKeys , key ) ;
// remove key from _downKeys
if ( i >= 0 ) {
_downKeys . splice ( i , 1 ) ;
}
if ( key == 93 || key == 224 ) key = 91 ;
if ( key in _mods ) {
_mods [ key ] = false ;
for ( k in _MODIFIERS ) if ( _MODIFIERS [ k ] == key ) assignKey [ k ] = false ;
}
} ;
function resetModifiers ( ) {
for ( k in _mods ) _mods [ k ] = false ;
for ( k in _MODIFIERS ) assignKey [ k ] = false ;
} ;
// parse and assign shortcut
function assignKey ( key , scope , method ) {
var keys , mods ;
keys = getKeys ( key ) ;
if ( method === undefined ) {
method = scope ;
scope = 'all' ;
}
// for each shortcut
for ( var i = 0 ; i < keys . length ; i ++ ) {
// set modifier keys if any
mods = [ ] ;
key = keys [ i ] . split ( '+' ) ;
if ( key . length > 1 ) {
mods = getMods ( key ) ;
key = [ key [ key . length - 1 ] ] ;
}
// convert to keycode and...
key = key [ 0 ]
key = code ( key ) ;
// ...store handler
if ( ! ( key in _handlers ) ) _handlers [ key ] = [ ] ;
_handlers [ key ] . push ( { shortcut : keys [ i ] , scope : scope , method : method , key : keys [ i ] , mods : mods } ) ;
}
} ;
// unbind all handlers for given key in current scope
function unbindKey ( key , scope ) {
var multipleKeys , keys ,
mods = [ ] ,
i , j , obj ;
multipleKeys = getKeys ( key ) ;
for ( j = 0 ; j < multipleKeys . length ; j ++ ) {
keys = multipleKeys [ j ] . split ( '+' ) ;
if ( keys . length > 1 ) {
mods = getMods ( keys ) ;
key = keys [ keys . length - 1 ] ;
}
key = code ( key ) ;
if ( scope === undefined ) {
scope = getScope ( ) ;
}
if ( ! _handlers [ key ] ) {
return ;
}
for ( i = 0 ; i < _handlers [ key ] . length ; i ++ ) {
obj = _handlers [ key ] [ i ] ;
// only clear handlers if correct scope and mods match
if ( obj . scope === scope && compareArray ( obj . mods , mods ) ) {
_handlers [ key ] [ i ] = { } ;
}
}
}
} ;
// Returns true if the key with code 'keyCode' is currently down
// Converts strings into key codes.
function isPressed ( keyCode ) {
if ( typeof ( keyCode ) == 'string' ) {
keyCode = code ( keyCode ) ;
}
return index ( _downKeys , keyCode ) != - 1 ;
}
function getPressedKeyCodes ( ) {
return _downKeys . slice ( 0 ) ;
}
function filter ( event ) {
var tagName = ( event . target || event . srcElement ) . tagName ;
// ignore keypressed in any elements that support keyboard data input
return ! ( tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA' ) ;
}
// initialize key.<modifier> to false
for ( k in _MODIFIERS ) assignKey [ k ] = false ;
// set current scope (default 'all')
function setScope ( scope ) { _scope = scope || 'all' } ;
function getScope ( ) { return _scope || 'all' } ;
// delete all handlers for a given scope
function deleteScope ( scope ) {
var key , handlers , i ;
for ( key in _handlers ) {
handlers = _handlers [ key ] ;
for ( i = 0 ; i < handlers . length ; ) {
if ( handlers [ i ] . scope === scope ) handlers . splice ( i , 1 ) ;
else i ++ ;
}
}
} ;
// abstract key logic for assign and unassign
function getKeys ( key ) {
var keys ;
key = key . replace ( /\s/g , '' ) ;
keys = key . split ( ',' ) ;
if ( ( keys [ keys . length - 1 ] ) == '' ) {
keys [ keys . length - 2 ] += ',' ;
}
return keys ;
}
// abstract mods logic for assign and unassign
function getMods ( key ) {
var mods = key . slice ( 0 , key . length - 1 ) ;
for ( var mi = 0 ; mi < mods . length ; mi ++ )
mods [ mi ] = _MODIFIERS [ mods [ mi ] ] ;
return mods ;
}
// cross-browser events
function addEvent ( object , event , method ) {
if ( object . addEventListener )
object . addEventListener ( event , method , false ) ;
else if ( object . attachEvent )
object . attachEvent ( 'on' + event , function ( ) { method ( window . event ) } ) ;
} ;
// set the handlers globally on document
addEvent ( document , 'keydown' , function ( event ) { dispatch ( event ) } ) ; // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
addEvent ( document , 'keyup' , clearModifier ) ;
// reset modifiers to false whenever the window is (re)focused.
addEvent ( window , 'focus' , resetModifiers ) ;
// store previously defined key
var previousKey = global . key ;
// restore previously defined key and return reference to our key object
function noConflict ( ) {
var k = global . key ;
global . key = previousKey ;
return k ;
}
// set window.key and window.key.set/get/deleteScope, and the default filter
global . key = assignKey ;
global . key . setScope = setScope ;
global . key . getScope = getScope ;
global . key . deleteScope = deleteScope ;
global . key . filter = filter ;
global . key . isPressed = isPressed ;
global . key . getPressedKeyCodes = getPressedKeyCodes ;
global . key . noConflict = noConflict ;
global . key . unbind = unbindKey ;
if ( true ) module . exports = assignKey ;
} ) ( this ) ;
/***/ } ,
/* 10 */
/***/ function ( module , exports ) {
module . exports = "/* jsTree default theme */\n.jstree-node,\n.jstree-children,\n.jstree-container-ul {\n display: block;\n margin: 0;\n padding: 0;\n list-style-type: none;\n list-style-image: none;\n}\n.jstree-node {\n white-space: nowrap;\n}\n.jstree-anchor {\n display: inline-block;\n color: black;\n white-space: nowrap;\n padding: 0 4px 0 1px;\n margin: 0;\n vertical-align: top;\n}\n.jstree-anchor:focus {\n outline: 0;\n}\n.jstree-anchor,\n.jstree-anchor:link,\n.jstree-anchor:visited,\n.jstree-anchor:hover,\n.jstree-anchor:active {\n text-decoration: none;\n color: inherit;\n}\n.jstree-icon {\n display: inline-block;\n text-decoration: none;\n margin: 0;\n padding: 0;\n vertical-align: top;\n text-align: center;\n}\n.jstree-icon:empty {\n display: inline-block;\n text-decoration: none;\n margin: 0;\n padding: 0;\n vertical-align: top;\n text-align: center;\n}\n.jstree-ocl {\n cursor: pointer;\n}\n.jstree-leaf > .jstree-ocl {\n cursor: default;\n}\n.jstree .jstree-open > .jstree-children {\n display: block;\n}\n.jstree .jstree-closed > .jstree-children,\n.jstree .jstree-leaf > .jstree-children {\n display: none;\n}\n.jstree-anchor > .jstree-themeicon {\n margin-right: 2px;\n}\n.jstree-no-icons .jstree-themeicon,\n.jstree-anchor > .jstree-themeicon-hidden {\n display: none;\n}\n.jstree-hidden,\n.jstree-node.jstree-hidden {\n display: none;\n}\n.jstree-rtl .jstree-anchor {\n padding: 0 1px 0 4px;\n}\n.jstree-rtl .jstree-anchor > .jstree-themeicon {\n margin-left: 2px;\n margin-right: 0;\n}\n.jstree-rtl .jstree-node {\n margin-left: 0;\n}\n.jstree-rtl .jstree-container-ul > .jstree-node {\n margin-right: 0;\n}\n.jstree-wholerow-ul {\n position: relative;\n display: inline-block;\n min-width: 100%;\n}\n.jstree-wholerow-ul .jstree-leaf > .jstree-ocl {\n cursor: pointer;\n}\n.jstree-wholerow-ul .jstree-anchor,\n.jstree-wholerow-ul .jstree-icon {\n position: relative;\n}\n.jstree-wholerow-ul .jstree-wholerow {\n width: 100%;\n cursor: pointer;\n position: absolute;\n left: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.vakata-context {\n display: none;\n}\n.vakata-context,\n.vakata-context ul {\n margin: 0;\n padding: 2px;\n position: absolute;\n background: #f5f5f5;\n border: 1px solid #979797;\n box-shadow: 2px 2px 2px #999999;\n}\n.vakata-context ul {\n list-style: none;\n left: 100%;\n margin-top: -2.7em;\n margin-left: -4px;\n}\n.vakata-context .vakata-context-right ul {\n left: auto;\n right: 100%;\n margin-left: auto;\n margin-right: -4px;\n}\n.vakata-context li {\n list-style: none;\n}\n.vakata-context li > a {\n display: block;\n padding: 0 2em 0 2em;\n text-decoration: none;\n width: auto;\n color: black;\n white-space: nowrap;\n line-height: 2.4em;\n text-shadow: 1px 1px 0 white;\n border-radius: 1px;\n}\n.vakata-context li > a:hover {\n position: relative;\n background-color: #e8eff7;\n box-shadow: 0 0 2px #0a6aa1;\n}\n.vakata-context li > a.vakata-context-parent {\n background-image: url(\"data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==\" ) ; \ n background - position : right center ; \ n background - repeat : no - repeat ; \ n } \ n . vakata - context li > a : focus { \ n outline : 0 ; \ n } \ n . vakata - context . vakata - context - hover > a { \ n position : relative ; \ n background - color : # e8eff7 ; \ n box - shadow : 0 0 2 px # 0 a6aa1 ; \ n } \ n . vakata - context . vakata - context - separator > a , \ n . vakata - context . vakata - context - separator > a : hover { \ n background : white ; \ n border : 0 ; \ n border - top : 1 px solid # e2e3e3 ; \ n height : 1 px ; \ n min - height : 1 px ; \ n max - height : 1 px ; \ n padding : 0 ; \ n margin : 0 0 0 2.4 em ; \ n border - left : 1 px solid # e0e0e0 ; \ n text - shadow : 0 0 0 transparent ; \ n box - shadow : 0 0 0 transparent ; \ n border - radius : 0 ; \ n } \ n . vakata - context . vakata - contextmenu - disabled a , \ n . vakata - context . vakata - contextmenu - disabled a : hover { \ n color : silver ; \ n background - color : transparent ; \ n border : 0 ; \ n box - shadow : 0 0 0 ; \ n } \ n . vakata - context li > a > i { \ n text - decoratio
/***/ } ,
/* 11 */
/***/ function ( module , exports ) {
2017-01-26 18:42:07 -05:00
module . exports = " /*\n*\tMatterTools.Inspector\n*/ \ n \ n . ins - container , \ n . jstree { \ n - webkit - touch - callout : none ; \ n - webkit - user - select : none ; \ n - khtml - user - select : none ; \ n - moz - user - select : none ; \ n - ms - user - select : none ; \ n user - select : none ; \ n } \ n \ n . ins - cursor - move canvas { \ n cursor : move ! important ; \ n } \ n \ n . ins - cursor - rotate canvas { \ n cursor : ew - resize ! important ; \ n } \ n \ n . ins - cursor - scale canvas { \ n cursor : nwse - resize ! important ; \ n } \ n \ n . ins - container { \ n position : fixed ; \ n overflow : auto ; \ n overflow - x : hidden ; \ n z - index : 10 ; \ n width : 245 px ; \ n bottom : 0 ; \ n top : 0 ; \ n left : 0 ; \ n background : # 1 c1c25 ; \ n padding : 0 ; \ n font - family : Arial ; \ n font - size : 12 px ; \ n color : # aaa ; \ n box - shadow : 0 0 30 px rgba ( 0 , 0 , 0 , 0.2 ) ; \ n } \ n \ nbody . ins - container : : - webkit - scrollbar { \ n background : # 1 c1c25 ; \ n width : 12 px ; \ n } \ n \ nbody . ins - container : : - webkit - scrollbar - thumb { \ n background : transparent ; \ n width : 5 px ; \ n border - left : 5 px solid transparent ; \ n border - right : 6 px solid # 2 a2a31 ; \ n border - radius : 0 ; \ n } \ n \ n @ media only screen and ( max - width : 1500 px ) { \ n . ins - container { \ n transform : translate ( - 230 px , 0 ) ; \ n } \ n \ n . ins - container : hover { \ n transform : none ; \ n } \ n \ n . ins - container { \ n - webkit - transition : all 500 ms cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n - moz - transition : all 500 ms cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n - o - transition : all 500 ms cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n transition : all 500 ms cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n \ n - webkit - transition - timing - function : cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n - moz - transition - timing - function : cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n - o - transition - timing - function : cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n transition - timing - function : cubic - bezier ( 0.965 , 0.025 , 0.735 , 0.415 ) ; \ n \ n transition - delay : 3 s ; \ n - webkit - transition - delay : 3 s ; \ n } \ n \ n . ins - container : hover { \ n - webkit - transition : all 500 ms cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n - moz - transition : all 500 ms cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n - o - transition : all 500 ms cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n transition : all 500 ms cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n \ n - webkit - transition - timing - function : cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n - moz - transition - timing - function : cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n - o - transition - timing - function : cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n transition - timing - function : cubic - bezier ( 0.095 , 0.665 , 0.400 , 0.835 ) ; \ n \ n transition - delay : 0 ; \ n - webkit - transition - delay : 0 ; \ n } \ n } \ n \ n . ins - add - button . ins - button { \ n width : auto ; \ n height : auto ; \ n padding : 2 px 5 px ; \ n margin : 4 px 0 0 0 ; \ n right : 0 px ; \ n min - width : 0 ; \ n position : absolute ; \ n z - index : 100 ; \ n } \ n \ n . ins - search - box { \ n margin : 20 px 0 px 16 px 13 px ; \ n border : 0 ; \ n padding : 7 px 8 px ; \ n font - size : 12 px ; \ n width : 100 % ; \ n box - sizing : border - box ; \ n border - radius : 3 px ; \ n background : # 111117 ; \ n color : # 919691 ; \ n appearance : none ; \ n - webkit - appearance : none ; \ n - moz - appearance : none ; \ n } \ n \ n . ins - search - box : focus { \ n background : # 15151 d ; \ n border : 0 ; \ n outline : 0 ; \ n } \ n \ n . ins - search - box : : - webkit - search - cancel - button { \ n appearance : none ; \ n - webkit - appearance : none ; \ n - moz - appearance : none ; \ n height : 15 px ; \ n width : 8 px ; \ n cursor : pointer ; \ n } \ n \ n . ins - search - box : : - webkit - search - cancel - button : before { \ n height : 10 px ; \ n width : 10 px ; \ n content : 'x' ; \ n font - family : Arial ; \ n line - height : 0 ; \ n font - size : 13 px ; \ n color : # 999 ; \ n font - weight : bold ; \ n cursor : pointer ; \ n } \ n \ n . ins - search - box : : - webkit - input - placeholder { \ n color : # 777 ; \ n } \ n \ n . ins - search - box : - moz - placeholder { \ n color : # 777 ; \ n } \ n \ n . ins - search - box : : - moz - placeholder { \ n color : # 777 ; \ n } \ n \ n . ins - search - box : - ms - input - placeholder { \ n color : # 777 ; \ n } \ n \ n . ins - world - tree { \ n \ n } \ n \ n . ins - control - group { \ n display : block ; \ n clear : both ; \ n overflow : hidden ; \ n padding : 14 px 20 px 12 px 20 px ; \ n background : # 0 d0f1b ; \ n border - bottom : 1 px solid # 29292 d ; \ n } \ n \ n . ins - button { \ n displ
2016-11-20 19:41:57 -05:00
/***/ }
/******/ ] )
} ) ;
;