0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-03 10:57:48 -05:00
liabru-matter-js/demo/lib/matter-tools.inspector.js

1738 lines
313 KiB
JavaScript
Raw Normal View History

2016-11-20 19:41:57 -05:00
/*!
2021-01-12 18:04:12 -05:00
* matter-tools 0.12.2 by @liabru 2021-01-12
2016-11-20 19:41:57 -05:00
* https://github.com/liabru/matter-tools
* License MIT
2021-01-12 18:04:12 -05:00
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Liam Brummitt
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
2016-11-20 19:41:57 -05:00
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
2021-01-12 18:04:12 -05:00
module.exports = factory(require("matter-js"), require("matter-tools"));
2016-11-20 19:41:57 -05:00
else if(typeof define === 'function' && define.amd)
2021-01-12 18:04:12 -05:00
define("Inspector", ["matter-js", "matter-tools"], factory);
2016-11-20 19:41:57 -05:00
else if(typeof exports === 'object')
2021-01-12 18:04:12 -05:00
exports["Inspector"] = factory(require("matter-js"), require("matter-tools"));
2016-11-20 19:41:57 -05:00
else
2021-01-12 18:04:12 -05:00
root["MatterTools"] = root["MatterTools"] || {}, root["MatterTools"]["Inspector"] = factory(root["Matter"], root["MatterTools"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__) {
2016-11-20 19:41:57 -05:00
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
2021-01-12 18:04:12 -05:00
/******/
2016-11-20 19:41:57 -05:00
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
2021-01-12 18:04:12 -05:00
/******/
2016-11-20 19:41:57 -05:00
/******/ // Check if module is in cache
2021-01-12 18:04:12 -05:00
/******/ if(installedModules[moduleId]) {
2016-11-20 19:41:57 -05:00
/******/ return installedModules[moduleId].exports;
2021-01-12 18:04:12 -05:00
/******/ }
2016-11-20 19:41:57 -05:00
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
2021-01-12 18:04:12 -05:00
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
2016-11-20 19:41:57 -05:00
/******/ };
2021-01-12 18:04:12 -05:00
/******/
2016-11-20 19:41:57 -05:00
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2021-01-12 18:04:12 -05:00
/******/
2016-11-20 19:41:57 -05:00
/******/ // Flag the module as loaded
2021-01-12 18:04:12 -05:00
/******/ module.l = true;
/******/
2016-11-20 19:41:57 -05:00
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
2021-01-12 18:04:12 -05:00
/******/
/******/
2016-11-20 19:41:57 -05:00
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
2021-01-12 18:04:12 -05:00
/******/
2016-11-20 19:41:57 -05:00
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
2021-01-12 18:04:12 -05:00
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
2016-11-20 19:41:57 -05:00
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/demo/lib";
2021-01-12 18:04:12 -05:00
/******/
/******/
2016-11-20 19:41:57 -05:00
/******/ // Load entry module and return exports
2021-01-12 18:04:12 -05:00
/******/ return __webpack_require__(__webpack_require__.s = 4);
2016-11-20 19:41:57 -05:00
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
2021-01-12 18:04:12 -05:00
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
2016-11-20 19:41:57 -05:00
/* 1 */
2021-01-12 18:04:12 -05:00
/***/ (function(module, exports) {
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
/***/ }),
2016-11-20 19:41:57 -05:00
/* 2 */
2021-01-12 18:04:12 -05:00
/***/ (function(module, exports, __webpack_require__) {
2017-01-26 18:42:07 -05:00
2021-01-12 18:04:12 -05:00
"use strict";
2017-01-26 18:42:07 -05:00
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
/**
* @class Common
*/
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
const Common = module.exports = {};
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
Common.injectStyles = function(styles, id) {
if (document.getElementById(id)) {
return;
}
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
let root = document.createElement('div');
root.innerHTML = `<style id="${id}" type="text/css">${styles}</style>`;
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
let lastStyle = document.head.querySelector('style:last-of-type');
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
if (lastStyle) {
Common.domInsertBefore(root.firstElementChild, lastStyle);
} else {
document.head.appendChild(root.firstElementChild);
}
};
2017-07-02 18:56:24 -04:00
2021-01-12 18:04:12 -05:00
Common.injectScript = function(url, id, callback) {
if (document.getElementById(id)) {
return;
}
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
let script = document.createElement('script');
script.id = id;
script.src = url;
script.onload = callback;
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
document.body.appendChild(script);
};
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
Common.domRemove = function(element) {
return element.parentElement.removeChild(element);
};
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
Common.domInsertBefore = function(element, before) {
return before.parentNode.insertBefore(element, before.previousElementSibling);
};
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict"; true&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* A tool for inspecting worlds.
* @module Inspector
*/
const Inspector = module.exports = {};
const km = __webpack_require__(5);
const $ = __webpack_require__(3);
__webpack_require__(6);
const ToolsCommon = __webpack_require__(2);
const Serializer = __webpack_require__(1).Serializer;
const Matter = __webpack_require__(0);
const Body = Matter.Body;
const Bounds = Matter.Bounds;
const Composite = Matter.Composite;
const Common = Matter.Common;
const Events = Matter.Events;
const Mouse = Matter.Mouse;
const Query = Matter.Query;
const Vertices = Matter.Vertices;
const Vector = Matter.Vector;
const 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) {
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;
let styles = __webpack_require__(7);
ToolsCommon.injectStyles(styles, 'js-tree-style');
styles = __webpack_require__(8);
ToolsCommon.injectStyles(styles, 'matter-inspector-style');
inspector.keyBind = Common.chain(km, (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((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(inspector) {
var controls = inspector.controls;
var $inspectorContainer = $('<div class="ins-container">'),
$topPanel = $('<div class="ins-top-panel">'),
$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 aria-label="Add composite body" title="Add composite body" class="ins-add-button ins-button">+</button>');
if (Serializer) {
$buttonGroup.append($pauseButton, $importButton, $exportButton, $helpButton);
} else {
$buttonGroup.append($pauseButton, $helpButton);
}
$inspectorContainer.prepend($topPanel, $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() {
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(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(inspector) {
var engine = inspector.engine,
controls = inspector.controls,
deferTimeout;
var worldTreeOptions = {
'core': {
'check_callback': true,
'animation': false
},
'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(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(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(inspector) {
return Vector.add(inspector.mouse.position, inspector.offset);
};
var _initEngineEvents = function(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(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(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(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(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(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(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(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(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(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(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(tree, data) {
data[0].state = data[0].state || { opened: true };
tree.settings.core.data = data;
tree.refresh(-1);
};
var _generateCompositeTreeNode = function(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(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(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(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(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(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(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
*/
/***/ }),
/* 5 */
/***/ (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);
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! jsTree - v3.3.11 - 2020-12-18 - (MIT) */
!function(a){"use strict"; true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __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}(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,j=window.setImmediate,k=window.Promise;!j&&k&&(j=function(a,b){k.resolve(b).then(a)}),a.jstree={version:"3.3.11",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,loaded_state:!1,restore_focus:!0,compute_elements_positions:!1,keyboard:{"ctrl-space":function(b){b.type="click",a(b.currentTarget).trigger(b)},enter:function(b){b.type="click",a(b.currentTarget).trigger(b)},left:function(b){if(b.preventDefault(),this.is_open(b.currentTarget))this.close_node(b.currentTarget);else{var c=this.get_parent(b.currentTarget);c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus()}},up:function(a){a.preventDefault();var b=this.get_prev_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},right:function(b){if(b.preventDefault(),this.is_closed(b.currentTarget))this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()});else if(this.is_open(b.currentTarget)){var c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0];c&&a(this._firstChild(c)).children(".jstree-anchor").focus()}},down:function(a){a.preventDefault();var b=this.get_next_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(b){b.preventDefault();var c=this._firstChild(this.get_container_ul()[0]);c&&a(c).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault(),this.edit(a.currentTarget)}}},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,
if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children.concat(l.children_d)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&this.settings.core.restore_focus&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1;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.childNodes[1].setAttribute("aria-selected",!!f.state.selected),b.childNodes[1].setAttribute("aria-level",f.parents.length),this.settings.core.compute_elements_positions&&(b.childNodes[1].setAttribute("aria-setsize",p[f.parent].children.length),b.childNodes[1].setAttribute("aria-posinset",p[f.parent].children.indexOf(f.id)+1)),f.state.disabled&&b.childNodes[1].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-h
for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.check("edit",b,this.get_parent(b))?(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a("<span></span>"),j=c,k=a("<div></div>",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo(i.body),l=a("<input />",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("<div></div>").append(a.parseHTML(j)).html(),b=this.get_node(b),this.set_text(b,j),m=!!this.rename_node(b,i?a("<div></div>").text(f).text():a("<div></div>").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o,f),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"",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()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!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+"/theme
position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+="<ul>"),a.each(b,function(b,d){return d?(c.items.push(d),!f&&d.separator_before&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),f=!1,e+="<li class='"+(d._class||"")+(d._disabled===!0||a.isFunction(d._disabled)&&d._disabled({item:d,reference:c.reference,element:c.element})?" vakata-contextmenu-disabled ":"")+"' "+(d.shortcut?" data-shortcut='"+d.shortcut+"' ":"")+">",e+="<a href='#' rel='"+(c.items.length-1)+"' "+(d.title?"title='"+d.title+"'":"")+">",a.vakata.context.settings.icons&&(e+="<i ",d.icon&&(e+=-1!==d.icon.indexOf("/")||-1!==d.icon.indexOf(".")?" style='background:url(\""+d.icon+"\") center center no-repeat' ":" class='"+d.icon+"' "),e+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),e+=(a.isFunction(d.label)?d.label({item:b,reference:c.reference,element:c.element}):d.label)+(d.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+d.shortcut+'">'+(d.shortcut_label||"")+"</span>":"")+"</a>",d.submenu&&(g=a.vakata.context._parse(d.submenu,!0),g&&(e+=g)),e+="</li>",void(d.separator_after&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",f=!0))):!0}),e=e.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),d&&(e+="</ul>"),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,j,k,l,m,n,o,p=!0;switch(c.element&&c.element.length&&c.element.width(""),p){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo(i.body),h=c.element,j=c.position_x,k=c.position_y,l=h.width(),m=h.height(),n=a(window).width()+a(window).scrollLeft(),o=a(window).height()+a(window).scrollTop(),b&&(j-=h.outerWidth()-a(d).outerWidth(),j<a(window).scrollLeft()+20&&(j=a(window).scrollLeft()+20)),j+l+20>n&&(j=n-(l+20)),k+m+20>o&&(k=o-(m+20)),c.element.css({left:j,top:k}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a(i.body).css("direction");var d=!1;c.element=a("<ul class='vakata-context'></ul>"),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.c
g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id,b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depth<k)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;f=this.get_node(f.parent),j=this.get_rules(f),k++}while(f)}}return!0},this.get_rules=function(a){if(a=this.get_node(a),!a)return!1;var c=this.get_type(a,!0);return c.max_depth===b&&(c.max_depth=-1),c.max_children===b&&(c.max_children=-1),c.valid_children===b&&(c.valid_children=-1),c},this.get_type=function(b,c){return b=this.get_node(b),b?c?a.extend({type:b.type},this.settings.types[b.type]):b.type:!1},this.set_type=function(c,d){var e=this._model.data,f,g,h,i,j,k,l,m;if(a.isArray(c)){for(c=c.slice(),g=0,h=c.length;h>g;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)f
/***/ }),
2016-11-20 19:41:57 -05:00
/* 7 */
2021-01-12 18:04:12 -05:00
/***/ (function(module, exports) {
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
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.jstree-contextmenu .jstree-anchor {\n -webkit-user-select: none;\n /* disable selection/Copy of UIWebView */\n -webkit-touch-callout: none;\n /* disable the IOS popup when long-press on a link */\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 2px #0a6aa1;\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: 1px solid #e2e3e3;\n height: 1px;\n min-height: 1px;\n max-height: 1px;\n padding: 0;\n margin: 0 0 0 2.4em;\n border-left: 1px 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-di
2016-11-20 19:41:57 -05:00
2021-01-12 18:04:12 -05:00
/***/ }),
2016-11-20 19:41:57 -05:00
/* 8 */
2021-01-12 18:04:12 -05:00
/***/ (function(module, exports) {
module.exports = "/*\n*\tMatterTools.Inspector\n*/\n\n.ins-container,\n.jstree {\n -webkit-touch-callout: none;\n -webkit-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 z-index: 10;\n width: 245px;\n bottom: 0;\n top: 0;\n left: 0;\n background: #17171f;\n padding: 0;\n font-size: 13px;\n color: #7c7c85;\n\n box-shadow:\n 0 0px 1.6px rgba(0, 0, 0, 0.025),\n 0 0px 3.9px rgba(0, 0, 0, 0.036),\n 0 0px 7.4px rgba(0, 0, 0, 0.045),\n 0 0px 13.2px rgba(0, 0, 0, 0.054),\n 0 0px 24.7px rgba(0, 0, 0, 0.065),\n 0 0px 60px rgba(0, 0, 0, 0.09)\n ;\n}\n\n.ins-container,\n.ins-container * {\n box-sizing: border-box;\n font-family: \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.ins-container {\n transform: translate(-220px, 0);\n transition: transform ease;\n transition-delay: 2000ms;\n transition-duration: 300ms;\n}\n\n.ins-container:hover {\n transform: translate(0, 0);\n transition-delay: 0ms;\n transition-duration: 400ms;\n}\n\n@media only screen and (min-width : 1300px) {\n .ins-container,\n .ins-container:hover {\n transition-delay: 0ms;\n transform: translate(0, 0);\n }\n}\n\n.ins-world-tree {\n position: absolute;\n overflow: auto;\n top: 91px;\n left: 3px;\n right: 0;\n bottom: 0;\n scrollbar-color: #17171f #17171f;\n scrollbar-width: thin;\n}\n\n.ins-world-tree:hover {\n scrollbar-color: #2a2a31 #17171f;\n scrollbar-width: thin;\n}\n\n.ins-world-tree::-webkit-scrollbar {\n background: #17171f;\n width: 6px;\n height: 6px;\n}\n\n.ins-world-tree::-webkit-scrollbar-track,\n.ins-world-tree::-webkit-scrollbar-corner {\n background: #17171f;\n}\n \n.ins-world-tree::-webkit-scrollbar-thumb {\n background: #17171f;\n border-radius: 3px;\n}\n\n.ins-world-tree:hover::-webkit-scrollbar-thumb {\n background: #2a2a31;\n}\n\n.ins-add-button.ins-button {\n width: auto;\n height: auto;\n padding: 2px 5px;\n margin: 1px 10px 0px 0;\n right: 0px;\n min-width: 0;\n position: absolute;\n z-index: 100;\n}\n\n.ins-top-panel {\n height: 48px;\n background: #14151f;\n}\n\n.ins-search-box {\n margin: 7px 5px 9px 5px;\n border: 0;\n padding: 7px 8px;\n font-size: 13px;\n width: 235px;\n border-radius: 3px;\n background: #12131b;\n color: #8e8d96;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n}\n\n.ins-search-box:focus {\n background: #0f1017;\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: 15px;\n width: 8px;\n cursor: pointer;\n}\n\n.ins-search-box::-webkit-search-cancel-button:before {\n height: 10px;\n width: 10px;\n content: 'x';\n line-height: 0;\n font-size: 13px;\n color: #999;\n font-weight: bold;\n cursor: pointer;\n}\n\n.ins-search-box::-webkit-input-placeholder {\n color: #56565f;\n}\n\n.ins-search-box:-moz-placeholder {\n color: #56565f;\n}\n\n.ins-search-box::-moz-placeholder {\n color: #56565f;\n}\n\n.ins-search-box:-ms-input-placeholder { \n color: #56565f;\n}\n\n.ins-control-group {\n display: block;\n clear: both;\n overflow: hidden;\n padding: 14px 20px 12px 20px;\n background: #17171f;\n border-bottom: 1px solid #29292d;\n}\n\n.ins-button {\n display: block;\n float: left;\n font-size: 11px;\n line-height: 1;\n padding: 10px 11px;\n min-width: 49px;\n text-align: center;\n background: #0e0f15;\n border: 0;\n color: #b1b1c3;\n border-radius: 2px;\n outline: none;\n margin: 0;\n}\n\n.ins-button:hover {\n background: #000;\n}\n\n.ins-button:active {\n -webkit-transform: translateY(1px);\n -ms-transform: translateY(1px);\n transform: translateY(1px);\n background:
/***/ })
/******/ ]);
});