From 8a67787735585f02c4b46eabf7b9fcc1c7c321da Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 23 Jun 2024 22:10:10 +0100 Subject: [PATCH 1/2] release 0.20.0 --- CHANGELOG.md | 48 + RELEASE.md | 63 + build/matter.js | 1055 +++++++++++------ build/matter.min.js | 4 +- demo/index.html | 33 +- demo/js/matter-demo.01bd65.min.js | 6 + demo/js/matter-demo.6283b1.min.js | 6 - ....min.js => matter-demo.main.cf6d09.min.js} | 2 +- .../js/matter-demo.matter-tools.0f82d2.min.js | 117 ++ .../js/matter-demo.matter-tools.97f38a.min.js | 117 -- ... => matter-demo.matter-wrap.f14474.min.js} | 2 +- ...n.js => matter-demo.pathseg.f137cc.min.js} | 2 +- ... => matter-demo.poly-decomp.6b3373.min.js} | 2 +- package-lock.json | 4 +- package.json | 2 +- 15 files changed, 985 insertions(+), 478 deletions(-) create mode 100644 demo/js/matter-demo.01bd65.min.js delete mode 100644 demo/js/matter-demo.6283b1.min.js rename demo/js/{matter-demo.main.5754e1.min.js => matter-demo.main.cf6d09.min.js} (97%) create mode 100644 demo/js/matter-demo.matter-tools.0f82d2.min.js delete mode 100644 demo/js/matter-demo.matter-tools.97f38a.min.js rename demo/js/{matter-demo.matter-wrap.dbda1f.min.js => matter-demo.matter-wrap.f14474.min.js} (98%) rename demo/js/{matter-demo.pathseg.cf21c2.min.js => matter-demo.pathseg.f137cc.min.js} (99%) rename demo/js/{matter-demo.poly-decomp.c3d015.min.js => matter-demo.poly-decomp.6b3373.min.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a2e11e..b5785fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,51 @@ +## 0.20.0 (2024-06-23) + +* added event passive options to Matter.Mouse, closes #930, closes #976 ([e888f3c](https://github.com/liabru/matter-js/commit/e888f3c)), closes [#930](https://github.com/liabru/matter-js/issues/930) [#976](https://github.com/liabru/matter-js/issues/976) +* added arrow key navigation of examples in development demo ([45cad77](https://github.com/liabru/matter-js/commit/45cad77)) +* added body removal to Example.remove ([1209e88](https://github.com/liabru/matter-js/commit/1209e88)) +* added Constraint.currentLength, closes #1184 ([812f8af](https://github.com/liabru/matter-js/commit/812f8af)), closes [#1184](https://github.com/liabru/matter-js/issues/1184) +* added doc and warning for `Bodies.trapezioid` slope parameter range, closes #1075 ([7ea5bc1](https://github.com/liabru/matter-js/commit/7ea5bc1)), closes [#1075](https://github.com/liabru/matter-js/issues/1075) +* added docs for `body.chamfer` property, closes #1059 ([5ed985d](https://github.com/liabru/matter-js/commit/5ed985d)), closes [#1059](https://github.com/liabru/matter-js/issues/1059) +* added engine beforeSolve event, closes #1173 ([8dd0e99](https://github.com/liabru/matter-js/commit/8dd0e99)), closes [#1173](https://github.com/liabru/matter-js/issues/1173) +* added event.timestamp and event.delta to collision events, closes #368 ([2af54d5](https://github.com/liabru/matter-js/commit/2af54d5)), closes [#368](https://github.com/liabru/matter-js/issues/368) +* added Example.renderResize ([b88c82f](https://github.com/liabru/matter-js/commit/b88c82f)) +* added Example.stress4 ([0f0ac93](https://github.com/liabru/matter-js/commit/0f0ac93)) +* added Example.substep ([205aaa5](https://github.com/liabru/matter-js/commit/205aaa5)) +* added high delta warning to Matter.Engine ([72e6e89](https://github.com/liabru/matter-js/commit/72e6e89)) +* added local pairs functions in Pairs.update ([e9da32c](https://github.com/liabru/matter-js/commit/e9da32c)) +* added new Matter.Runner with default fixed timestep ([3e61951](https://github.com/liabru/matter-js/commit/3e61951)) +* added pixel ratio scaling to render debug stats ([7ec38a1](https://github.com/liabru/matter-js/commit/7ec38a1)) +* added render.options.wireframeStrokeStyle, closes #406 ([401553d](https://github.com/liabru/matter-js/commit/401553d)), closes [#406](https://github.com/liabru/matter-js/issues/406) +* added Render.setSize, closes #955, closes #595 ([fc05839](https://github.com/liabru/matter-js/commit/fc05839)), closes [#955](https://github.com/liabru/matter-js/issues/955) [#595](https://github.com/liabru/matter-js/issues/595) +* added repeats and updates options to test tools ([6142991](https://github.com/liabru/matter-js/commit/6142991)) +* added updates per frame to Matter.Render debug ([a5b5767](https://github.com/liabru/matter-js/commit/a5b5767)) +* changed Composte.removeComposite and Composte.removeBody to reset body.sleepCounter ([6d10c3d](https://github.com/liabru/matter-js/commit/6d10c3d)) +* changed Pair.id format to use shorter ids ([5b6f30b](https://github.com/liabru/matter-js/commit/5b6f30b)) +* fixed collision events for sleeping pairs, closes #1077 ([51f49ce](https://github.com/liabru/matter-js/commit/51f49ce)), closes [#1077](https://github.com/liabru/matter-js/issues/1077) +* fixed missing `mouse.sourceEvents.mousewheel`, closes #1146 ([272049a](https://github.com/liabru/matter-js/commit/272049a)), closes [#1146](https://github.com/liabru/matter-js/issues/1146) +* fixed Body.setStatic when applied multiple times, closes #641 ([9655785](https://github.com/liabru/matter-js/commit/9655785)), closes [#641](https://github.com/liabru/matter-js/issues/641) +* fixed compare tool layer order in demo testbed ([a3e801a](https://github.com/liabru/matter-js/commit/a3e801a)) ([0cc4d96](https://github.com/liabru/matter-js/commit/0cc4d96)) +* fixed Runner.stop docs re. runner.enabled, closes #586, closes #1054 ([2ecc563](https://github.com/liabru/matter-js/commit/2ecc563)), closes [#586](https://github.com/liabru/matter-js/issues/586) [#1054](https://github.com/liabru/matter-js/issues/1054) +* improved Example.substep comments ([8046341](https://github.com/liabru/matter-js/commit/8046341)) +* improved Matter.Runner ([b8a1563](https://github.com/liabru/matter-js/commit/b8a1563)) ([7206600](https://github.com/liabru/matter-js/commit/7206600)) +* improved Matter.Runner docs ([283cd96](https://github.com/liabru/matter-js/commit/283cd96)) ([dc693e7](https://github.com/liabru/matter-js/commit/dc693e7)) ([6e302a8](https://github.com/liabru/matter-js/commit/6e302a8)) +* improved test comparison report ([962fba5](https://github.com/liabru/matter-js/commit/962fba5)) ([2cc1c1c](https://github.com/liabru/matter-js/commit/2cc1c1c)) +* improved `body.parts` docs ([013698b](https://github.com/liabru/matter-js/commit/013698b)) ([411af06](https://github.com/liabru/matter-js/commit/411af06)), closes #600 ([c1f9584](https://github.com/liabru/matter-js/commit/c1f9584)), closes [#600](https://github.com/liabru/matter-js/issues/600) +* optimised Collision._findSupports ([653a110](https://github.com/liabru/matter-js/commit/653a110)) +* optimised Collision.collides ([6f8a54b](https://github.com/liabru/matter-js/commit/6f8a54b)) +* optimised contacts and supports memory and gc use ([97d502e](https://github.com/liabru/matter-js/commit/97d502e)) +* optimised pairs and collisions memory and gc use ([f9208df](https://github.com/liabru/matter-js/commit/f9208df)) +* optimised Resolver.solvePosition ([89963f7](https://github.com/liabru/matter-js/commit/89963f7)) +* optimised Resolver.solveVelocity ([182ba90](https://github.com/liabru/matter-js/commit/182ba90)) +* preserve pair.contacts order ([e891d37](https://github.com/liabru/matter-js/commit/e891d37)) +* reduced canvas hit testing in demo when using matter-tools ([da99acb](https://github.com/liabru/matter-js/commit/da99acb)) +* removed redundant runner.isFixed from examples ([aba0e9e](https://github.com/liabru/matter-js/commit/aba0e9e)) +* removed Collision._projectToAxis ([4c56e5b](https://github.com/liabru/matter-js/commit/4c56e5b)) +* removed pair.confirmedActive ([72bc203](https://github.com/liabru/matter-js/commit/72bc203)) +* renamed Composites function xx and yy params, closes #1095 ([6bda7e8](https://github.com/liabru/matter-js/commit/6bda7e8)), closes [#1095](https://github.com/liabru/matter-js/issues/1095) +* updated development demo render options ([0b131a4](https://github.com/liabru/matter-js/commit/0b131a4)) +* updated benchmark tests ([e668c02](https://github.com/liabru/matter-js/commit/e668c02)) + ## 0.19.0 (2023-02-16) See the release [readme](https://github.com/liabru/matter-js/blob/0.19.0/README.md) for further information. diff --git a/RELEASE.md b/RELEASE.md index 818faede..3b8fd6ba 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,66 @@ +## ▲.● matter.js `0.20.0` + +Release notes for `0.20.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.20.0/README.md) for further information. + +### Highlights ✺ + +- added support for high refresh rate displays with fixed timestep in `Matter.Runner` +- added support for sub-stepping for higher quality simulations in `Matter.Runner` +- changed to a fixed timestep by default in `Matter.Runner` +- improved frame pacing and average performance up to ~6% (see [#1238](https://github.com/liabru/matter-js/pull/1238)) +- reduced average memory usage up to ~30% (see [#1238](https://github.com/liabru/matter-js/pull/1238)) +- reduced memory garbage collection +- bug fixes and improvements see [changelog](https://github.com/liabru/matter-js/blob/0.20.0/CHANGELOG.md) + +### Changes ✲ + +See the release [compare page](https://github.com/liabru/matter-js/compare/0.19.0...0.20.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.20.0/CHANGELOG.md) for a detailed list of changes. + +### Migration ⌲ + +`Matter.Runner` related changes [#1254](https://github.com/liabru/matter-js/pull/1254): + +- `Matter.Runner` now defaults to a fixed deterministic timestep and support for non-fixed timestep is removed +- optionally set your performance budgets `runner.maxFrameTime` (see docs) +- note that `Matter.Runner` can now call zero, one, or multiple engine updates and events per display frame (see docs) +- if needed set up your polyfill for `window.requestAnimationFrame` +- see `Matter.Runner` updated docs throughout + +Performance related changes [#1238](https://github.com/liabru/matter-js/pull/1238): + +- `Matter.Collision` use `collision.supportCount` instead of `collision.supports.length` for active support count +- `Matter.Pair` use `pair.contacts` instead of `pair.activeContacts` +- `Matter.Pair` use `pair.contactCount` instead of `pair.contacts.length` for active contact count +- `Pair.id` format has changed + +### Comparison ⎄ + +For more information see [comparison method](https://github.com/liabru/matter-js/pull/794). + +```ocaml +Output sample comparison estimates of 44 examples against previous release matter-js@0.19.0: + +Similarity 99.80% Overlap -1.92% Filesize +3.38% 81.58 KB + +airFriction · · avalanche ● · ballPool ● · bridge ● · car ● · catapult ● · +chains ● · circleStack · · cloth ● · collisionFiltering ● · compositeManipulation ● · +compound · · compoundStack ● · concave ● · constraints ● · doublePendulum · · +events ● · friction · · gravity ● · gyro ● · manipulation ● ◆ +mixed ● · newtonsCradle · · pyramid ● · ragdoll ● · raycasting ● · +remove ● ◆ restitution · · rounded ● · sensors · · sleeping ● ◆ +slingshot ● · softBody ● · sprites ● · stack · · staticFriction ● · +stats ● · stress ● · stress2 ● · stress3 ● · stress4 ● · +timescale ● · views ● · wreckingBall ● · + +where for the sample · no change detected ● extrinsics changed ◆ intrinsics changed +``` + +### Contributors ♥︎ + +Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.19.0...0.20.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support. + +--- + ## ▲.● matter.js `0.19.0` Release notes for `0.19.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.19.0/README.md) for further information. diff --git a/build/matter.js b/build/matter.js index 8a80bbb2..089996b3 100644 --- a/build/matter.js +++ b/build/matter.js @@ -1,5 +1,5 @@ /*! - * matter-js 0.19.0 by @liabru + * matter-js 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT * @@ -1843,18 +1843,19 @@ var Axes = __webpack_require__(11); Body.setStatic = function(body, isStatic) { for (var i = 0; i < body.parts.length; i++) { var part = body.parts[i]; - part.isStatic = isStatic; if (isStatic) { - part._original = { - restitution: part.restitution, - friction: part.friction, - mass: part.mass, - inertia: part.inertia, - density: part.density, - inverseMass: part.inverseMass, - inverseInertia: part.inverseInertia - }; + if (!part.isStatic) { + part._original = { + restitution: part.restitution, + friction: part.friction, + mass: part.mass, + inertia: part.inertia, + density: part.density, + inverseMass: part.inverseMass, + inverseInertia: part.inverseInertia + }; + } part.restitution = 0; part.friction = 1; @@ -1879,6 +1880,8 @@ var Axes = __webpack_require__(11); part._original = null; } + + part.isStatic = isStatic; } }; @@ -1959,10 +1962,17 @@ var Axes = __webpack_require__(11); }; /** - * Sets the parts of the `body` and updates mass, inertia and centroid. - * Each part will have its parent set to `body`. - * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` - * Note that this method will ensure that the first part in `body.parts` will always be the `body`. + * Sets the parts of the `body`. + * + * See `body.parts` for details and requirements on how parts are used. + * + * See Bodies.fromVertices for a related utility. + * + * This function updates `body` mass, inertia and centroid based on the parts geometry. + * Sets each `part.parent` to be this `body`. + * + * The convex hull is computed and set on this `body` (unless `autoHull` is `false`). + * Automatically ensures that the first part in `body.parts` is the `body`. * @method setParts * @param {body} body * @param {body[]} parts @@ -2505,12 +2515,28 @@ var Axes = __webpack_require__(11); /** * _Read only_. Use `Body.setParts` to set. * - * An array of bodies that make up this body. - * The first body in the array must always be a self reference to the current body instance. - * All bodies in the `parts` array together form a single rigid compound body. - * Parts are allowed to overlap, have gaps or holes or even form concave bodies. - * Parts themselves should never be added to a `World`, only the parent body should be. - * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * See `Bodies.fromVertices` for a related utility. + * + * An array of bodies (the 'parts') that make up this body (the 'parent'). The first body in this array must always be a self-reference to this `body`. + * + * The parts are fixed together and therefore perform as a single unified rigid body. + * + * Parts in relation to each other are allowed to overlap, as well as form gaps or holes, so can be used to create complex concave bodies unlike when using a single part. + * + * Use properties and functions on the parent `body` rather than on parts. + * + * Outside of their geometry, most properties on parts are not considered or updated. + * As such 'per-part' material properties among others are not currently considered. + * + * Parts should be created specifically for their parent body. + * Parts should not be shared or reused between bodies, only one parent is supported. + * Parts should not have their own parts, they are not handled recursively. + * Parts should not be added to the world directly or any other composite. + * Parts own vertices must be convex and in clockwise order. + * + * A body with more than one part is sometimes referred to as a 'compound' body. + * + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. * * @readOnly * @property parts @@ -3020,6 +3046,19 @@ var Axes = __webpack_require__(11); * @type bounds */ + /** + * Temporarily may hold parameters to be passed to `Vertices.chamfer` where supported by external functions. + * + * See `Vertices.chamfer` for possible parameters this object may hold. + * + * Currently only functions inside `Matter.Bodies` provide a utility using this property as a vertices pre-processing option. + * + * Alternatively consider using `Vertices.chamfer` directly on vertices before passing them to a body creation function. + * + * @property chamfer + * @type object|null|undefined + */ + })(); @@ -3339,8 +3378,15 @@ var Body = __webpack_require__(4); */ Composite.removeComposite = function(compositeA, compositeB, deep) { var position = Common.indexOf(compositeA.composites, compositeB); + if (position !== -1) { + var bodies = Composite.allBodies(compositeB); + Composite.removeCompositeAt(compositeA, position); + + for (var i = 0; i < bodies.length; i++) { + bodies[i].sleepCounter = 0; + } } if (deep) { @@ -3391,8 +3437,10 @@ var Body = __webpack_require__(4); */ Composite.removeBody = function(composite, body, deep) { var position = Common.indexOf(composite.bodies, body); + if (position !== -1) { Composite.removeBodyAt(composite, position); + body.sleepCounter = 0; } if (deep) { @@ -3443,6 +3491,7 @@ var Body = __webpack_require__(4); */ Composite.removeConstraint = function(composite, constraint, deep) { var position = Common.indexOf(composite.constraints, constraint); + if (position !== -1) { Composite.removeConstraintAt(composite, position); } @@ -4062,7 +4111,8 @@ var Pair = __webpack_require__(9); normal: { x: 0, y: 0 }, tangent: { x: 0, y: 0 }, penetration: { x: 0, y: 0 }, - supports: [] + supports: [null, null], + supportCount: 0 }; }; @@ -4114,27 +4164,32 @@ var Pair = __webpack_require__(9); } var normal = collision.normal, + tangent = collision.tangent, + penetration = collision.penetration, supports = collision.supports, + depth = minOverlap.overlap, minAxis = minOverlap.axis, - minAxisX = minAxis.x, - minAxisY = minAxis.y; + normalX = minAxis.x, + normalY = minAxis.y, + deltaX = bodyB.position.x - bodyA.position.x, + deltaY = bodyB.position.y - bodyA.position.y; // ensure normal is facing away from bodyA - if (minAxisX * (bodyB.position.x - bodyA.position.x) + minAxisY * (bodyB.position.y - bodyA.position.y) < 0) { - normal.x = minAxisX; - normal.y = minAxisY; - } else { - normal.x = -minAxisX; - normal.y = -minAxisY; + if (normalX * deltaX + normalY * deltaY >= 0) { + normalX = -normalX; + normalY = -normalY; } + + normal.x = normalX; + normal.y = normalY; - collision.tangent.x = -normal.y; - collision.tangent.y = normal.x; + tangent.x = -normalY; + tangent.y = normalX; - collision.depth = minOverlap.overlap; + penetration.x = normalX * depth; + penetration.y = normalY * depth; - collision.penetration.x = normal.x * collision.depth; - collision.penetration.y = normal.y * collision.depth; + collision.depth = depth; // find support points, there is always either exactly one or two var supportsB = Collision._findSupports(bodyA, bodyB, normal, 1), @@ -4167,8 +4222,8 @@ var Pair = __webpack_require__(9); supports[supportCount++] = supportsB[0]; } - // update supports array size - supports.length = supportCount; + // update support count + collision.supportCount = supportCount; return collision; }; @@ -4247,32 +4302,6 @@ var Pair = __webpack_require__(9); result.overlap = overlapMin; }; - /** - * Projects vertices on an axis and returns an interval. - * @method _projectToAxis - * @private - * @param {} projection - * @param {} vertices - * @param {} axis - */ - Collision._projectToAxis = function(projection, vertices, axis) { - var min = vertices[0].x * axis.x + vertices[0].y * axis.y, - max = min; - - for (var i = 1; i < vertices.length; i += 1) { - var dot = vertices[i].x * axis.x + vertices[i].y * axis.y; - - if (dot > max) { - max = dot; - } else if (dot < min) { - min = dot; - } - } - - projection.min = min; - projection.max = max; - }; - /** * Finds supporting vertices given two bodies along a given direction using hill-climbing. * @method _findSupports @@ -4290,15 +4319,15 @@ var Pair = __webpack_require__(9); bodyAPositionY = bodyA.position.y, normalX = normal.x * direction, normalY = normal.y * direction, - nearestDistance = Number.MAX_VALUE, - vertexA, - vertexB, + vertexA = vertices[0], + vertexB = vertexA, + nearestDistance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y), vertexC, distance, j; // find deepest vertex relative to the axis - for (j = 0; j < verticesLength; j += 1) { + for (j = 1; j < verticesLength; j += 1) { vertexB = vertices[j]; distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y); @@ -4413,6 +4442,10 @@ var Pair = __webpack_require__(9); /** * An array of body vertices that represent the support points in the collision. + * + * _Note:_ Only the first `collision.supportCount` items of `collision.supports` are active. + * Therefore use `collision.supportCount` instead of `collision.supports.length` when iterating the active supports. + * * These are the deepest vertices (along the collision normal) of each body that are contained by the other body's vertices. * * @property supports @@ -4420,6 +4453,17 @@ var Pair = __webpack_require__(9); * @default [] */ + /** + * The number of active supports for this collision found in `collision.supports`. + * + * _Note:_ Only the first `collision.supportCount` items of `collision.supports` are active. + * Therefore use `collision.supportCount` instead of `collision.supports.length` when iterating the active supports. + * + * @property supportCount + * @type number + * @default 0 + */ + })(); @@ -4457,11 +4501,10 @@ var Contact = __webpack_require__(16); bodyA: bodyA, bodyB: bodyB, collision: collision, - contacts: [], - activeContacts: [], + contacts: [Contact.create(), Contact.create()], + contactCount: 0, separation: 0, isActive: true, - confirmedActive: true, isSensor: bodyA.isSensor || bodyB.isSensor, timeCreated: timestamp, timeUpdated: timestamp, @@ -4485,12 +4528,11 @@ var Contact = __webpack_require__(16); * @param {number} timestamp */ Pair.update = function(pair, collision, timestamp) { - var contacts = pair.contacts, - supports = collision.supports, - activeContacts = pair.activeContacts, + var supports = collision.supports, + supportCount = collision.supportCount, + contacts = pair.contacts, parentA = collision.parentA, - parentB = collision.parentB, - parentAVerticesLength = parentA.vertices.length; + parentB = collision.parentB; pair.isActive = true; pair.timeUpdated = timestamp; @@ -4502,20 +4544,24 @@ var Contact = __webpack_require__(16); pair.restitution = parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution; pair.slop = parentA.slop > parentB.slop ? parentA.slop : parentB.slop; + pair.contactCount = supportCount; collision.pair = pair; - activeContacts.length = 0; - - for (var i = 0; i < supports.length; i++) { - var support = supports[i], - contactId = support.body === parentA ? support.index : parentAVerticesLength + support.index, - contact = contacts[contactId]; - if (contact) { - activeContacts.push(contact); - } else { - activeContacts.push(contacts[contactId] = Contact.create(support)); - } + var supportA = supports[0], + contactA = contacts[0], + supportB = supports[1], + contactB = contacts[1]; + + // match contacts to supports + if (contactB.vertex === supportA || contactA.vertex === supportB) { + contacts[1] = contactA; + contacts[0] = contactA = contactB; + contactB = contacts[1]; } + + // update contacts + contactA.vertex = supportA; + contactB.vertex = supportB; }; /** @@ -4531,7 +4577,7 @@ var Contact = __webpack_require__(16); pair.timeUpdated = timestamp; } else { pair.isActive = false; - pair.activeContacts.length = 0; + pair.contactCount = 0; } }; @@ -4543,11 +4589,8 @@ var Contact = __webpack_require__(16); * @return {string} Unique pairId */ Pair.id = function(bodyA, bodyB) { - if (bodyA.id < bodyB.id) { - return 'A' + bodyA.id + 'B' + bodyB.id; - } else { - return 'A' + bodyB.id + 'B' + bodyA.id; - } + return bodyA.id < bodyB.id ? bodyA.id.toString(36) + ':' + bodyB.id.toString(36) + : bodyB.id.toString(36) + ':' + bodyA.id.toString(36); }; })(); @@ -4894,6 +4937,33 @@ var Common = __webpack_require__(0); }; }; + /** + * Returns the current length of the constraint. + * This is the distance between both of the constraint's end points. + * See `constraint.length` for the target rest length. + * @method currentLength + * @param {constraint} constraint + * @returns {number} the current length + */ + Constraint.currentLength = function(constraint) { + var pointAX = (constraint.bodyA ? constraint.bodyA.position.x : 0) + + (constraint.pointA ? constraint.pointA.x : 0); + + var pointAY = (constraint.bodyA ? constraint.bodyA.position.y : 0) + + (constraint.pointA ? constraint.pointA.y : 0); + + var pointBX = (constraint.bodyB ? constraint.bodyB.position.x : 0) + + (constraint.pointB ? constraint.pointB.x : 0); + + var pointBY = (constraint.bodyB ? constraint.bodyB.position.y : 0) + + (constraint.pointB ? constraint.pointB.y : 0); + + var deltaX = pointAX - pointBX; + var deltaY = pointAY - pointBY; + + return Math.sqrt(deltaX * deltaX + deltaY * deltaY); + }; + /* * * Properties Documentation @@ -5177,6 +5247,7 @@ var Vector = __webpack_require__(2); /** * Creates a new rigid body model with a trapezoid hull. + * The `slope` is parameterised as a fraction of `width` and must be < 1 to form a valid trapezoid. * The options parameter is an object that specifies any properties you wish to override the defaults. * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. * @method trapezoid @@ -5184,13 +5255,17 @@ var Vector = __webpack_require__(2); * @param {number} y * @param {number} width * @param {number} height - * @param {number} slope + * @param {number} slope Must be a number < 1. * @param {object} [options] * @return {body} A new trapezoid body */ Bodies.trapezoid = function(x, y, width, height, slope, options) { options = options || {}; + if (slope >= 1) { + Common.warn('Bodies.trapezoid: slope parameter must be < 1.'); + } + slope *= 0.5; var roof = (1 - (slope * 2)) * width; @@ -5509,6 +5584,7 @@ var Collision = __webpack_require__(8); Detector.create = function(options) { var defaults = { bodies: [], + collisions: [], pairs: null }; @@ -5532,6 +5608,7 @@ var Collision = __webpack_require__(8); */ Detector.clear = function(detector) { detector.bodies = []; + detector.collisions = []; }; /** @@ -5544,12 +5621,13 @@ var Collision = __webpack_require__(8); * @return {collision[]} collisions */ Detector.collisions = function(detector) { - var collisions = [], - pairs = detector.pairs, + var pairs = detector.pairs, bodies = detector.bodies, bodiesLength = bodies.length, canCollide = Detector.canCollide, collides = Collision.collides, + collisions = detector.collisions, + collisionIndex = 0, i, j; @@ -5591,7 +5669,7 @@ var Collision = __webpack_require__(8); var collision = collides(bodyA, bodyB, pairs); if (collision) { - collisions.push(collision); + collisions[collisionIndex++] = collision; } } else { var partsAStart = partsALength > 1 ? 1 : 0, @@ -5613,7 +5691,7 @@ var Collision = __webpack_require__(8); var collision = collides(partA, partB, pairs); if (collision) { - collisions.push(collision); + collisions[collisionIndex++] = collision; } } } @@ -5621,6 +5699,10 @@ var Collision = __webpack_require__(8); } } + if (collisions.length !== collisionIndex) { + collisions.length = collisionIndex; + } + return collisions; }; @@ -5667,6 +5749,13 @@ var Collision = __webpack_require__(8); * @default [] */ + /** + * The array of `Matter.Collision` found in the last call to `Detector.collisions` on this detector. + * @property collisions + * @type collision[] + * @default [] + */ + /** * Optional. A `Matter.Pairs` object from which previous collision objects may be reused. Intended for internal `Matter.Engine` usage. * @property pairs @@ -5783,6 +5872,7 @@ var Common = __webpack_require__(0); mouse.mousewheel = function(event) { mouse.wheelDelta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail)); event.preventDefault(); + mouse.sourceEvents.mousewheel = event; }; Mouse.setElement(mouse, mouse.element); @@ -5799,16 +5889,15 @@ var Common = __webpack_require__(0); Mouse.setElement = function(mouse, element) { mouse.element = element; - element.addEventListener('mousemove', mouse.mousemove); - element.addEventListener('mousedown', mouse.mousedown); - element.addEventListener('mouseup', mouse.mouseup); + element.addEventListener('mousemove', mouse.mousemove, { passive: true }); + element.addEventListener('mousedown', mouse.mousedown, { passive: true }); + element.addEventListener('mouseup', mouse.mouseup, { passive: true }); - element.addEventListener('mousewheel', mouse.mousewheel); - element.addEventListener('DOMMouseScroll', mouse.mousewheel); - - element.addEventListener('touchmove', mouse.mousemove); - element.addEventListener('touchstart', mouse.mousedown); - element.addEventListener('touchend', mouse.mouseup); + element.addEventListener('wheel', mouse.mousewheel, { passive: false }); + + element.addEventListener('touchmove', mouse.mousemove, { passive: false }); + element.addEventListener('touchstart', mouse.mousedown, { passive: false }); + element.addEventListener('touchend', mouse.mouseup, { passive: false }); }; /** @@ -6260,7 +6349,7 @@ module.exports = Contact; /** * Creates a new contact. * @method create - * @param {vertex} vertex + * @param {vertex} [vertex] * @return {contact} A new contact */ Contact.create = function(vertex) { @@ -6304,6 +6393,8 @@ var Body = __webpack_require__(4); (function() { + Engine._deltaMax = 1000 / 60; + /** * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. * All properties have default values, and many are pre-calculated automatically based on other properties. @@ -6331,7 +6422,8 @@ var Body = __webpack_require__(4); timestamp: 0, timeScale: 1, lastDelta: 0, - lastElapsed: 0 + lastElapsed: 0, + lastUpdatesPerFrame: 0 } }; @@ -6340,6 +6432,7 @@ var Body = __webpack_require__(4); engine.world = options.world || Composite.create({ label: 'World' }); engine.pairs = options.pairs || Pairs.create(); engine.detector = options.detector || Detector.create(); + engine.detector.pairs = engine.pairs; // for temporary back compatibility only engine.grid = { buckets: [] }; @@ -6352,7 +6445,7 @@ var Body = __webpack_require__(4); /** * Moves the simulation forward in time by `delta` milliseconds. - * Triggers `beforeUpdate` and `afterUpdate` events. + * Triggers `beforeUpdate`, `beforeSolve` and `afterUpdate` events. * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. * @method update * @param {engine} engine @@ -6368,6 +6461,13 @@ var Body = __webpack_require__(4); timestamp = timing.timestamp, i; + // warn if high delta + if (delta > Engine._deltaMax) { + Common.warnOnce( + 'Matter.Engine.update: delta argument is recommended to be less than or equal to', Engine._deltaMax.toFixed(3), 'ms.' + ); + } + delta = typeof delta !== 'undefined' ? delta : Common._baseDelta; delta *= timing.timeScale; @@ -6408,6 +6508,8 @@ var Body = __webpack_require__(4); Engine._bodiesUpdate(allBodies, delta); } + Events.trigger(engine, 'beforeSolve', event); + // update all constraints (first pass) Constraint.preSolveAll(allBodies); for (i = 0; i < engine.constraintIterations; i++) { @@ -6416,7 +6518,6 @@ var Body = __webpack_require__(4); Constraint.postSolveAll(allBodies); // find all collisions - detector.pairs = engine.pairs; var collisions = Detector.collisions(detector); // update collision pairs @@ -6427,8 +6528,13 @@ var Body = __webpack_require__(4); Sleeping.afterCollisions(pairs.list); // trigger collision events - if (pairs.collisionStart.length > 0) - Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart }); + if (pairs.collisionStart.length > 0) { + Events.trigger(engine, 'collisionStart', { + pairs: pairs.collisionStart, + timestamp: timing.timestamp, + delta: delta + }); + } // iteratively resolve position between collisions var positionDamping = Common.clamp(20 / engine.positionIterations, 0, 1); @@ -6456,11 +6562,21 @@ var Body = __webpack_require__(4); Engine._bodiesUpdateVelocities(allBodies); // trigger collision events - if (pairs.collisionActive.length > 0) - Events.trigger(engine, 'collisionActive', { pairs: pairs.collisionActive }); + if (pairs.collisionActive.length > 0) { + Events.trigger(engine, 'collisionActive', { + pairs: pairs.collisionActive, + timestamp: timing.timestamp, + delta: delta + }); + } - if (pairs.collisionEnd.length > 0) - Events.trigger(engine, 'collisionEnd', { pairs: pairs.collisionEnd }); + if (pairs.collisionEnd.length > 0) { + Events.trigger(engine, 'collisionEnd', { + pairs: pairs.collisionEnd, + timestamp: timing.timestamp, + delta: delta + }); + } // clear force buffers Engine._bodiesClearForces(allBodies); @@ -6607,6 +6723,17 @@ var Body = __webpack_require__(4); * @param {string} event.name The name of the event */ + /** + * Fired after bodies updated based on their velocity and forces, but before any collision detection, constraints and resolving etc. + * + * @event beforeSolve + * @param {object} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {number} event.delta The delta time in milliseconds value used in the update + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + /** * Fired after engine update and all collision events * @@ -6860,7 +6987,7 @@ var Bounds = __webpack_require__(1); Resolver.preSolvePosition = function(pairs) { var i, pair, - activeCount, + contactCount, pairsLength = pairs.length; // find total contacts on each body @@ -6870,9 +6997,9 @@ var Bounds = __webpack_require__(1); if (!pair.isActive) continue; - activeCount = pair.activeContacts.length; - pair.collision.parentA.totalContacts += activeCount; - pair.collision.parentB.totalContacts += activeCount; + contactCount = pair.contactCount; + pair.collision.parentA.totalContacts += contactCount; + pair.collision.parentB.totalContacts += contactCount; } }; @@ -6910,8 +7037,8 @@ var Bounds = __webpack_require__(1); // get current separation between body edges involved in collision pair.separation = - normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x) - + normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y); + collision.depth + normal.x * (bodyB.positionImpulse.x - bodyA.positionImpulse.x) + + normal.y * (bodyB.positionImpulse.y - bodyA.positionImpulse.y); } for (i = 0; i < pairsLength; i++) { @@ -7007,8 +7134,8 @@ var Bounds = __webpack_require__(1); if (!pair.isActive || pair.isSensor) continue; - var contacts = pair.activeContacts, - contactsLength = contacts.length, + var contacts = pair.contacts, + contactCount = pair.contactCount, collision = pair.collision, bodyA = collision.parentA, bodyB = collision.parentB, @@ -7016,7 +7143,7 @@ var Bounds = __webpack_require__(1); tangent = collision.tangent; // resolve each contact - for (j = 0; j < contactsLength; j++) { + for (j = 0; j < contactCount; j++) { var contact = contacts[j], contactVertex = contact.vertex, normalImpulse = contact.normalImpulse, @@ -7079,28 +7206,26 @@ var Bounds = __webpack_require__(1); var collision = pair.collision, bodyA = collision.parentA, bodyB = collision.parentB, - bodyAVelocity = bodyA.velocity, - bodyBVelocity = bodyB.velocity, normalX = collision.normal.x, normalY = collision.normal.y, tangentX = collision.tangent.x, tangentY = collision.tangent.y, - contacts = pair.activeContacts, - contactsLength = contacts.length, - contactShare = 1 / contactsLength, - inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass, - friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier; - - // update body velocities - bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x; - bodyAVelocity.y = bodyA.position.y - bodyA.positionPrev.y; - bodyBVelocity.x = bodyB.position.x - bodyB.positionPrev.x; - bodyBVelocity.y = bodyB.position.y - bodyB.positionPrev.y; - bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev; - bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev; + inverseMassTotal = pair.inverseMass, + friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier, + contacts = pair.contacts, + contactCount = pair.contactCount, + contactShare = 1 / contactCount; + + // get body velocities + var bodyAVelocityX = bodyA.position.x - bodyA.positionPrev.x, + bodyAVelocityY = bodyA.position.y - bodyA.positionPrev.y, + bodyAAngularVelocity = bodyA.angle - bodyA.anglePrev, + bodyBVelocityX = bodyB.position.x - bodyB.positionPrev.x, + bodyBVelocityY = bodyB.position.y - bodyB.positionPrev.y, + bodyBAngularVelocity = bodyB.angle - bodyB.anglePrev; // resolve each contact - for (j = 0; j < contactsLength; j++) { + for (j = 0; j < contactCount; j++) { var contact = contacts[j], contactVertex = contact.vertex; @@ -7109,10 +7234,10 @@ var Bounds = __webpack_require__(1); offsetBX = contactVertex.x - bodyB.position.x, offsetBY = contactVertex.y - bodyB.position.y; - var velocityPointAX = bodyAVelocity.x - offsetAY * bodyA.angularVelocity, - velocityPointAY = bodyAVelocity.y + offsetAX * bodyA.angularVelocity, - velocityPointBX = bodyBVelocity.x - offsetBY * bodyB.angularVelocity, - velocityPointBY = bodyBVelocity.y + offsetBX * bodyB.angularVelocity; + var velocityPointAX = bodyAVelocityX - offsetAY * bodyAAngularVelocity, + velocityPointAY = bodyAVelocityY + offsetAX * bodyAAngularVelocity, + velocityPointBX = bodyBVelocityX - offsetBY * bodyBAngularVelocity, + velocityPointBY = bodyBVelocityY + offsetBX * bodyBAngularVelocity; var relativeVelocityX = velocityPointAX - velocityPointBX, relativeVelocityY = velocityPointAY - velocityPointBY; @@ -7243,27 +7368,24 @@ var Common = __webpack_require__(0); * @param {number} timestamp */ Pairs.update = function(pairs, collisions, timestamp) { - var pairsList = pairs.list, - pairsListLength = pairsList.length, + var pairUpdate = Pair.update, + pairCreate = Pair.create, + pairSetActive = Pair.setActive, pairsTable = pairs.table, - collisionsLength = collisions.length, + pairsList = pairs.list, + pairsListLength = pairsList.length, + pairsListIndex = pairsListLength, collisionStart = pairs.collisionStart, collisionEnd = pairs.collisionEnd, collisionActive = pairs.collisionActive, + collisionsLength = collisions.length, + collisionStartIndex = 0, + collisionEndIndex = 0, + collisionActiveIndex = 0, collision, - pairIndex, pair, i; - // clear collision state arrays, but maintain old reference - collisionStart.length = 0; - collisionEnd.length = 0; - collisionActive.length = 0; - - for (i = 0; i < pairsListLength; i++) { - pairsList[i].confirmedActive = false; - } - for (i = 0; i < collisionsLength; i++) { collision = collisions[i]; pair = collision.pair; @@ -7272,49 +7394,62 @@ var Common = __webpack_require__(0); // pair already exists (but may or may not be active) if (pair.isActive) { // pair exists and is active - collisionActive.push(pair); - } else { - // pair exists but was inactive, so a collision has just started again - collisionStart.push(pair); + collisionActive[collisionActiveIndex++] = pair; } // update the pair - Pair.update(pair, collision, timestamp); - pair.confirmedActive = true; + pairUpdate(pair, collision, timestamp); } else { // pair did not exist, create a new pair - pair = Pair.create(collision, timestamp); + pair = pairCreate(collision, timestamp); pairsTable[pair.id] = pair; - // push the new pair - collisionStart.push(pair); - pairsList.push(pair); + // add the new pair + collisionStart[collisionStartIndex++] = pair; + pairsList[pairsListIndex++] = pair; } } // find pairs that are no longer active - var removePairIndex = []; + pairsListIndex = 0; pairsListLength = pairsList.length; for (i = 0; i < pairsListLength; i++) { pair = pairsList[i]; - if (!pair.confirmedActive) { - Pair.setActive(pair, false, timestamp); - collisionEnd.push(pair); + // pair is active if updated this timestep + if (pair.timeUpdated >= timestamp) { + // keep active pairs + pairsList[pairsListIndex++] = pair; + } else { + pairSetActive(pair, false, timestamp); - if (!pair.collision.bodyA.isSleeping && !pair.collision.bodyB.isSleeping) { - removePairIndex.push(i); + // keep inactive pairs if both bodies may be sleeping + if (pair.collision.bodyA.sleepCounter > 0 && pair.collision.bodyB.sleepCounter > 0) { + pairsList[pairsListIndex++] = pair; + } else { + // remove inactive pairs if either body awake + collisionEnd[collisionEndIndex++] = pair; + delete pairsTable[pair.id]; } } } - // remove inactive pairs - for (i = 0; i < removePairIndex.length; i++) { - pairIndex = removePairIndex[i] - i; - pair = pairsList[pairIndex]; - pairsList.splice(pairIndex, 1); - delete pairsTable[pair.id]; + // update array lengths if changed + if (pairsList.length !== pairsListIndex) { + pairsList.length = pairsListIndex; + } + + if (collisionStart.length !== collisionStartIndex) { + collisionStart.length = collisionStartIndex; + } + + if (collisionEnd.length !== collisionEndIndex) { + collisionEnd.length = collisionEndIndex; + } + + if (collisionActive.length !== collisionActiveIndex) { + collisionActive.length = collisionActiveIndex; } }; @@ -7410,7 +7545,7 @@ var Common = __webpack_require__(0); * @readOnly * @type {String} */ - Matter.version = true ? "0.19.0" : undefined; + Matter.version = true ? "0.20.0" : undefined; /** * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. @@ -7499,8 +7634,8 @@ var deprecated = Common.deprecated; * Create a new composite containing bodies created in the callback in a grid arrangement. * This function uses the body's bounds to prevent overlaps. * @method stack - * @param {number} xx - * @param {number} yy + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. * @param {number} columns * @param {number} rows * @param {number} columnGap @@ -7508,10 +7643,10 @@ var deprecated = Common.deprecated; * @param {function} callback * @return {composite} A new composite containing objects created in the callback */ - Composites.stack = function(xx, yy, columns, rows, columnGap, rowGap, callback) { + Composites.stack = function(x, y, columns, rows, columnGap, rowGap, callback) { var stack = Composite.create({ label: 'Stack' }), - x = xx, - y = yy, + currentX = x, + currentY = y, lastBody, i = 0; @@ -7519,7 +7654,7 @@ var deprecated = Common.deprecated; var maxHeight = 0; for (var column = 0; column < columns; column++) { - var body = callback(x, y, column, row, lastBody, i); + var body = callback(currentX, currentY, column, row, lastBody, i); if (body) { var bodyHeight = body.bounds.max.y - body.bounds.min.y, @@ -7530,19 +7665,19 @@ var deprecated = Common.deprecated; Body.translate(body, { x: bodyWidth * 0.5, y: bodyHeight * 0.5 }); - x = body.bounds.max.x + columnGap; + currentX = body.bounds.max.x + columnGap; Composite.addBody(stack, body); lastBody = body; i += 1; } else { - x += columnGap; + currentX += columnGap; } } - y += maxHeight + rowGap; - x = xx; + currentY += maxHeight + rowGap; + currentX = x; } return stack; @@ -7640,8 +7775,8 @@ var deprecated = Common.deprecated; * Create a new composite containing bodies created in the callback in a pyramid arrangement. * This function uses the body's bounds to prevent overlaps. * @method pyramid - * @param {number} xx - * @param {number} yy + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. * @param {number} columns * @param {number} rows * @param {number} columnGap @@ -7649,8 +7784,8 @@ var deprecated = Common.deprecated; * @param {function} callback * @return {composite} A new composite containing objects created in the callback */ - Composites.pyramid = function(xx, yy, columns, rows, columnGap, rowGap, callback) { - return Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y, column, row, lastBody, i) { + Composites.pyramid = function(x, y, columns, rows, columnGap, rowGap, callback) { + return Composites.stack(x, y, columns, rows, columnGap, rowGap, function(stackX, stackY, column, row, lastBody, i) { var actualRows = Math.min(rows, Math.ceil(columns / 2)), lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0; @@ -7673,7 +7808,7 @@ var deprecated = Common.deprecated; var xOffset = lastBody ? column * lastBodyWidth : 0; - return callback(xx + xOffset + column * columnGap, y, column, row, lastBody, i); + return callback(x + xOffset + column * columnGap, stackY, column, row, lastBody, i); }); }; @@ -7681,21 +7816,21 @@ var deprecated = Common.deprecated; * This has now moved to the [newtonsCradle example](https://github.com/liabru/matter-js/blob/master/examples/newtonsCradle.js), follow that instead as this function is deprecated here. * @deprecated moved to newtonsCradle example * @method newtonsCradle - * @param {number} xx - * @param {number} yy + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. * @param {number} number * @param {number} size * @param {number} length * @return {composite} A new composite newtonsCradle body */ - Composites.newtonsCradle = function(xx, yy, number, size, length) { + Composites.newtonsCradle = function(x, y, number, size, length) { var newtonsCradle = Composite.create({ label: 'Newtons Cradle' }); for (var i = 0; i < number; i++) { var separation = 1.9, - circle = Bodies.circle(xx + i * (size * separation), yy + length, size, + circle = Bodies.circle(x + i * (size * separation), y + length, size, { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }), - constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle }); + constraint = Constraint.create({ pointA: { x: x + i * (size * separation), y: y }, bodyB: circle }); Composite.addBody(newtonsCradle, circle); Composite.addConstraint(newtonsCradle, constraint); @@ -7710,14 +7845,14 @@ var deprecated = Common.deprecated; * This has now moved to the [car example](https://github.com/liabru/matter-js/blob/master/examples/car.js), follow that instead as this function is deprecated here. * @deprecated moved to car example * @method car - * @param {number} xx - * @param {number} yy + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. * @param {number} width * @param {number} height * @param {number} wheelSize * @return {composite} A new composite car body */ - Composites.car = function(xx, yy, width, height, wheelSize) { + Composites.car = function(x, y, width, height, wheelSize) { var group = Body.nextGroup(true), wheelBase = 20, wheelAOffset = -width * 0.5 + wheelBase, @@ -7725,7 +7860,7 @@ var deprecated = Common.deprecated; wheelYOffset = 0; var car = Composite.create({ label: 'Car' }), - body = Bodies.rectangle(xx, yy, width, height, { + body = Bodies.rectangle(x, y, width, height, { collisionFilter: { group: group }, @@ -7735,14 +7870,14 @@ var deprecated = Common.deprecated; density: 0.0002 }); - var wheelA = Bodies.circle(xx + wheelAOffset, yy + wheelYOffset, wheelSize, { + var wheelA = Bodies.circle(x + wheelAOffset, y + wheelYOffset, wheelSize, { collisionFilter: { group: group }, friction: 0.8 }); - var wheelB = Bodies.circle(xx + wheelBOffset, yy + wheelYOffset, wheelSize, { + var wheelB = Bodies.circle(x + wheelBOffset, y + wheelYOffset, wheelSize, { collisionFilter: { group: group }, @@ -7781,8 +7916,8 @@ var deprecated = Common.deprecated; * and the [cloth example](https://github.com/liabru/matter-js/blob/master/examples/cloth.js), follow those instead as this function is deprecated here. * @deprecated moved to softBody and cloth examples * @method softBody - * @param {number} xx - * @param {number} yy + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. * @param {number} columns * @param {number} rows * @param {number} columnGap @@ -7793,12 +7928,12 @@ var deprecated = Common.deprecated; * @param {} constraintOptions * @return {composite} A new composite softBody */ - Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { + Composites.softBody = function(x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { particleOptions = Common.extend({ inertia: Infinity }, particleOptions); constraintOptions = Common.extend({ stiffness: 0.2, render: { type: 'line', anchors: false } }, constraintOptions); - var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) { - return Bodies.circle(x, y, particleRadius, particleOptions); + var softBody = Composites.stack(x, y, columns, rows, columnGap, rowGap, function(stackX, stackY) { + return Bodies.circle(stackX, stackY, particleRadius, particleOptions); }); Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions); @@ -8572,7 +8707,7 @@ var Vertices = __webpack_require__(3); /***/ (function(module, exports, __webpack_require__) { /** -* The `Matter.Render` module is a simple canvas based renderer for visualising instances of `Matter.Engine`. +* The `Matter.Render` module is a lightweight, optional utility which provides a simple canvas based renderer for visualising instances of `Matter.Engine`. * It is intended for development and debugging purposes, but may also be suitable for simple games. * It includes a number of drawing options including wireframe, vector with support for sprites and viewports. * @@ -8634,6 +8769,7 @@ var Mouse = __webpack_require__(14); timestampElapsedHistory: [], engineDeltaHistory: [], engineElapsedHistory: [], + engineUpdatesHistory: [], elapsedHistory: [] }, options: { @@ -8642,6 +8778,7 @@ var Mouse = __webpack_require__(14); pixelRatio: 1, background: '#14151f', wireframeBackground: '#14151f', + wireframeStrokeStyle: '#bbb', hasBounds: !!options.bounds, enabled: true, wireframes: true, @@ -8716,6 +8853,8 @@ var Mouse = __webpack_require__(14); Render.world(render, time); + render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0); + if (render.options.showStats || render.options.showDebug) { Render.stats(render, render.context, time); } @@ -8723,6 +8862,8 @@ var Mouse = __webpack_require__(14); if (render.options.showPerformance || render.options.showDebug) { Render.performance(render, render.context, time); } + + render.context.setTransform(1, 0, 0, 1, 0, 0); })(); }; @@ -8758,6 +8899,36 @@ var Mouse = __webpack_require__(14); canvas.style.height = options.height + 'px'; }; + /** + * Sets the render `width` and `height`. + * + * Updates the canvas accounting for `render.options.pixelRatio`. + * + * Updates the bottom right render bound `render.bounds.max` relative to the provided `width` and `height`. + * The top left render bound `render.bounds.min` isn't changed. + * + * Follow this call with `Render.lookAt` if you need to change the render bounds. + * + * See also `Render.setPixelRatio`. + * @method setSize + * @param {render} render + * @param {number} width The width (in CSS pixels) + * @param {number} height The height (in CSS pixels) + */ + Render.setSize = function(render, width, height) { + render.options.width = width; + render.options.height = height; + render.bounds.max.x = render.bounds.min.x + width; + render.bounds.max.y = render.bounds.min.y + height; + + if (render.options.pixelRatio !== 1) { + Render.setPixelRatio(render, render.options.pixelRatio); + } else { + render.canvas.width = width; + render.canvas.height = height; + } + }; + /** * Positions and sizes the viewport around the given object bounds. * Objects must have at least one of the following properties: @@ -9090,15 +9261,19 @@ var Mouse = __webpack_require__(14); elapsedHistory = timing.elapsedHistory, timestampElapsedHistory = timing.timestampElapsedHistory, engineDeltaHistory = timing.engineDeltaHistory, + engineUpdatesHistory = timing.engineUpdatesHistory, engineElapsedHistory = timing.engineElapsedHistory, + lastEngineUpdatesPerFrame = engine.timing.lastUpdatesPerFrame, lastEngineDelta = engine.timing.lastDelta; var deltaMean = _mean(deltaHistory), elapsedMean = _mean(elapsedHistory), engineDeltaMean = _mean(engineDeltaHistory), + engineUpdatesMean = _mean(engineUpdatesHistory), engineElapsedMean = _mean(engineElapsedHistory), timestampElapsedMean = _mean(timestampElapsedHistory), rateMean = (timestampElapsedMean / deltaMean) || 0, + neededUpdatesPerFrame = Math.round(deltaMean / lastEngineDelta), fps = (1000 / deltaMean) || 0; var graphHeight = 4, @@ -9110,7 +9285,7 @@ var Mouse = __webpack_require__(14); // background context.fillStyle = '#0e0f19'; - context.fillRect(0, 50, gap * 4 + width * 5 + 22, height); + context.fillRect(0, 50, gap * 5 + width * 6 + 22, height); // show FPS Render.status( @@ -9128,17 +9303,25 @@ var Mouse = __webpack_require__(14); function(i) { return (engineDeltaHistory[i] / engineDeltaMean) - 1; } ); + // show engine updates per frame + Render.status( + context, x + (gap + width) * 2, y, width, graphHeight, engineUpdatesHistory.length, + lastEngineUpdatesPerFrame + ' upf', + Math.pow(Common.clamp((engineUpdatesMean / neededUpdatesPerFrame) || 1, 0, 1), 4), + function(i) { return (engineUpdatesHistory[i] / engineUpdatesMean) - 1; } + ); + // show engine update time Render.status( - context, x + (gap + width) * 2, y, width, graphHeight, engineElapsedHistory.length, + context, x + (gap + width) * 3, y, width, graphHeight, engineElapsedHistory.length, engineElapsedMean.toFixed(2) + ' ut', - 1 - (engineElapsedMean / Render._goodFps), + 1 - (lastEngineUpdatesPerFrame * engineElapsedMean / Render._goodFps), function(i) { return (engineElapsedHistory[i] / engineElapsedMean) - 1; } ); // show render time Render.status( - context, x + (gap + width) * 3, y, width, graphHeight, elapsedHistory.length, + context, x + (gap + width) * 4, y, width, graphHeight, elapsedHistory.length, elapsedMean.toFixed(2) + ' rt', 1 - (elapsedMean / Render._goodFps), function(i) { return (elapsedHistory[i] / elapsedMean) - 1; } @@ -9146,7 +9329,7 @@ var Mouse = __webpack_require__(14); // show effective speed Render.status( - context, x + (gap + width) * 4, y, width, graphHeight, timestampElapsedHistory.length, + context, x + (gap + width) * 5, y, width, graphHeight, timestampElapsedHistory.length, rateMean.toFixed(2) + ' x', rateMean * rateMean * rateMean, function(i) { return (((timestampElapsedHistory[i] / deltaHistory[i]) / rateMean) || 0) - 1; } @@ -9364,7 +9547,7 @@ var Mouse = __webpack_require__(14); c.fill(); } else { c.lineWidth = 1; - c.strokeStyle = '#bbb'; + c.strokeStyle = render.options.wireframeStrokeStyle; c.stroke(); } } @@ -9423,7 +9606,7 @@ var Mouse = __webpack_require__(14); } c.lineWidth = 1; - c.strokeStyle = '#bbb'; + c.strokeStyle = render.options.wireframeStrokeStyle; c.stroke(); }; @@ -9747,8 +9930,8 @@ var Mouse = __webpack_require__(14); continue; collision = pair.collision; - for (j = 0; j < pair.activeContacts.length; j++) { - var contact = pair.activeContacts[j], + for (j = 0; j < pair.contactCount; j++) { + var contact = pair.contacts[j], vertex = contact.vertex; c.rect(vertex.x - 1.5, vertex.y - 1.5, 3.5, 3.5); } @@ -9772,13 +9955,13 @@ var Mouse = __webpack_require__(14); collision = pair.collision; - if (pair.activeContacts.length > 0) { - var normalPosX = pair.activeContacts[0].vertex.x, - normalPosY = pair.activeContacts[0].vertex.y; + if (pair.contactCount > 0) { + var normalPosX = pair.contacts[0].vertex.x, + normalPosY = pair.contacts[0].vertex.y; - if (pair.activeContacts.length === 2) { - normalPosX = (pair.activeContacts[0].vertex.x + pair.activeContacts[1].vertex.x) / 2; - normalPosY = (pair.activeContacts[0].vertex.y + pair.activeContacts[1].vertex.y) / 2; + if (pair.contactCount === 2) { + normalPosX = (pair.contacts[0].vertex.x + pair.contacts[1].vertex.x) / 2; + normalPosY = (pair.contacts[0].vertex.y + pair.contacts[1].vertex.y) / 2; } if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic === true) { @@ -9971,6 +10154,9 @@ var Mouse = __webpack_require__(14); timing.timestampElapsedHistory.unshift(timing.timestampElapsed); timing.timestampElapsedHistory.length = Math.min(timing.timestampElapsedHistory.length, historySize); + timing.engineUpdatesHistory.unshift(engine.timing.lastUpdatesPerFrame); + timing.engineUpdatesHistory.length = Math.min(timing.engineUpdatesHistory.length, historySize); + timing.engineElapsedHistory.unshift(engine.timing.lastElapsed); timing.engineElapsedHistory.length = Math.min(timing.engineElapsedHistory.length, historySize); @@ -10202,7 +10388,7 @@ var Mouse = __webpack_require__(14); */ /** - * A CSS background color string to use when `render.options.wireframes` is enabled. + * A CSS color string to use for background when `render.options.wireframes` is enabled. * This may be also set to `'transparent'` or equivalent. * * @property options.wireframeBackground @@ -10210,6 +10396,15 @@ var Mouse = __webpack_require__(14); * @default '#14151f' */ + /** + * A CSS color string to use for stroke when `render.options.wireframes` is enabled. + * This may be also set to `'transparent'` or equivalent. + * + * @property options.wireframeStrokeStyle + * @type string + * @default '#bbb' + */ + /** * A flag that specifies if `render.bounds` should be used when rendering. * @@ -10251,6 +10446,7 @@ var Mouse = __webpack_require__(14); * * - average render frequency (e.g. 60 fps) * - exact engine delta time used for last update (e.g. 16.66ms) + * - average updates per frame (e.g. 1) * - average engine execution duration (e.g. 5.00ms) * - average render execution duration (e.g. 0.40ms) * - average effective play speed (e.g. '1.00x' is 'real-time') @@ -10410,11 +10606,11 @@ var Mouse = __webpack_require__(14); /***/ (function(module, exports, __webpack_require__) { /** -* The `Matter.Runner` module is an optional utility which provides a game loop, -* that handles continuously updating a `Matter.Engine` for you within a browser. -* It is intended for development and debugging purposes, but may also be suitable for simple games. -* If you are using your own game loop instead, then you do not need the `Matter.Runner` module. -* Instead just call `Engine.update(engine, delta)` in your own loop. +* The `Matter.Runner` module is an optional utility that provides a game loop for running a `Matter.Engine` inside a browser environment. +* A runner will continuously update a `Matter.Engine` whilst synchronising engine updates with the browser frame rate. +* This runner favours a smoother user experience over perfect time keeping. +* This runner is optional and is used for development and debugging but could be useful as a starting point for implementing some games and experiences. +* Alternatively see `Engine.update` to step the engine directly inside your own game loop implementation as may be needed inside other environments. * * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). * @@ -10431,73 +10627,59 @@ var Common = __webpack_require__(0); (function() { - var _requestAnimationFrame, - _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame || window.msRequestAnimationFrame; - - _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame - || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame; - } - - if (!_requestAnimationFrame) { - var _frameTimeout; - - _requestAnimationFrame = function(callback){ - _frameTimeout = setTimeout(function() { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = function() { - clearTimeout(_frameTimeout); - }; - } + Runner._maxFrameDelta = 1000 / 15; + Runner._frameDeltaFallback = 1000 / 60; + Runner._timeBufferMargin = 1.5; + Runner._elapsedNextEstimate = 1; + Runner._smoothingLowerBound = 0.1; + Runner._smoothingUpperBound = 0.9; /** - * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. + * Creates a new Runner. + * See the properties section below for detailed information on what you can pass via the `options` object. * @method create * @param {} options */ Runner.create = function(options) { var defaults = { - fps: 60, - deltaSampleSize: 60, - counterTimestamp: 0, - frameCounter: 0, - deltaHistory: [], - timePrev: null, + delta: 1000 / 60, + frameDelta: null, + frameDeltaSmoothing: true, + frameDeltaSnapping: true, + frameDeltaHistory: [], + frameDeltaHistorySize: 100, frameRequestId: null, - isFixed: false, + timeBuffer: 0, + timeLastTick: null, + maxUpdates: null, + maxFrameTime: 1000 / 30, + lastUpdatesDeferred: 0, enabled: true }; var runner = Common.extend(defaults, options); - runner.delta = runner.delta || 1000 / runner.fps; - runner.deltaMin = runner.deltaMin || 1000 / runner.fps; - runner.deltaMax = runner.deltaMax || 1000 / (runner.fps * 0.5); - runner.fps = 1000 / runner.delta; + // for temporary back compatibility only + runner.fps = 0; return runner; }; /** - * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. + * Runs a `Matter.Engine` whilst synchronising engine updates with the browser frame rate. + * See module and properties descriptions for more information on this runner. + * Alternatively see `Engine.update` to step the engine directly inside your own game loop implementation. * @method run - * @param {engine} engine + * @param {runner} runner + * @param {engine} [engine] + * @return {runner} runner */ Runner.run = function(runner, engine) { - // create runner if engine is first argument - if (typeof runner.positionIterations !== 'undefined') { - engine = runner; - runner = Runner.create(); - } + // initial time buffer for the first frame + runner.timeBuffer = Runner._frameDeltaFallback; - (function run(time){ - runner.frameRequestId = _requestAnimationFrame(run); + (function onFrame(time){ + runner.frameRequestId = Runner._onNextFrame(runner, onFrame); if (time && runner.enabled) { Runner.tick(runner, engine, time); @@ -10508,84 +10690,190 @@ var Common = __webpack_require__(0); }; /** - * A game loop utility that updates the engine and renderer by one step (a 'tick'). - * Features delta smoothing, time correction and fixed or dynamic timing. - * Consider just `Engine.update(engine, delta)` if you're using your own loop. + * Performs a single runner tick as used inside `Runner.run`. + * See module and properties descriptions for more information on this runner. + * Alternatively see `Engine.update` to step the engine directly inside your own game loop implementation. * @method tick * @param {runner} runner * @param {engine} engine * @param {number} time */ Runner.tick = function(runner, engine, time) { - var timing = engine.timing, - delta; + var tickStartTime = Common.now(), + engineDelta = runner.delta, + updateCount = 0; - if (runner.isFixed) { - // fixed timestep - delta = runner.delta; - } else { - // dynamic timestep based on wall clock between calls - delta = (time - runner.timePrev) || runner.delta; - runner.timePrev = time; + // find frame delta time since last call + var frameDelta = time - runner.timeLastTick; + + // fallback for unusable frame delta values (e.g. 0, NaN, on first frame or long pauses) + if (!frameDelta || !runner.timeLastTick || frameDelta > Math.max(Runner._maxFrameDelta, runner.maxFrameTime)) { + // reuse last accepted frame delta else fallback + frameDelta = runner.frameDelta || Runner._frameDeltaFallback; + } + + if (runner.frameDeltaSmoothing) { + // record frame delta over a number of frames + runner.frameDeltaHistory.push(frameDelta); + runner.frameDeltaHistory = runner.frameDeltaHistory.slice(-runner.frameDeltaHistorySize); + + // sort frame delta history + var deltaHistorySorted = runner.frameDeltaHistory.slice(0).sort(); - // optimistically filter delta over a few frames, to improve stability - runner.deltaHistory.push(delta); - runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize); - delta = Math.min.apply(null, runner.deltaHistory); + // sample a central window to limit outliers + var deltaHistoryWindow = runner.frameDeltaHistory.slice( + deltaHistorySorted.length * Runner._smoothingLowerBound, + deltaHistorySorted.length * Runner._smoothingUpperBound + ); - // limit delta - delta = delta < runner.deltaMin ? runner.deltaMin : delta; - delta = delta > runner.deltaMax ? runner.deltaMax : delta; + // take the mean of the central window + var frameDeltaSmoothed = _mean(deltaHistoryWindow); + frameDelta = frameDeltaSmoothed || frameDelta; + } - // update engine timing object - runner.delta = delta; + if (runner.frameDeltaSnapping) { + // snap frame delta to the nearest 1 Hz + frameDelta = 1000 / Math.round(1000 / frameDelta); } - // create an event object + // update runner values for next call + runner.frameDelta = frameDelta; + runner.timeLastTick = time; + + // accumulate elapsed time + runner.timeBuffer += runner.frameDelta; + + // limit time buffer size to a single frame of updates + runner.timeBuffer = Common.clamp( + runner.timeBuffer, 0, runner.frameDelta + engineDelta * Runner._timeBufferMargin + ); + + // reset count of over budget updates + runner.lastUpdatesDeferred = 0; + + // get max updates per frame + var maxUpdates = runner.maxUpdates || Math.ceil(runner.maxFrameTime / engineDelta); + + // create event object var event = { - timestamp: timing.timestamp + timestamp: engine.timing.timestamp }; + // tick events before update Events.trigger(runner, 'beforeTick', event); + Events.trigger(runner, 'tick', event); - // fps counter - runner.frameCounter += 1; - if (time - runner.counterTimestamp >= 1000) { - runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000); - runner.counterTimestamp = time; - runner.frameCounter = 0; - } + var updateStartTime = Common.now(); - Events.trigger(runner, 'tick', event); + // simulate time elapsed between calls + while (engineDelta > 0 && runner.timeBuffer >= engineDelta * Runner._timeBufferMargin) { + // update the engine + Events.trigger(runner, 'beforeUpdate', event); + Engine.update(engine, engineDelta); + Events.trigger(runner, 'afterUpdate', event); - // update - Events.trigger(runner, 'beforeUpdate', event); + // consume time simulated from buffer + runner.timeBuffer -= engineDelta; + updateCount += 1; - Engine.update(engine, delta); + // find elapsed time during this tick + var elapsedTimeTotal = Common.now() - tickStartTime, + elapsedTimeUpdates = Common.now() - updateStartTime, + elapsedNextEstimate = elapsedTimeTotal + Runner._elapsedNextEstimate * elapsedTimeUpdates / updateCount; - Events.trigger(runner, 'afterUpdate', event); + // defer updates if over performance budgets for this frame + if (updateCount >= maxUpdates || elapsedNextEstimate > runner.maxFrameTime) { + runner.lastUpdatesDeferred = Math.round(Math.max(0, (runner.timeBuffer / engineDelta) - Runner._timeBufferMargin)); + break; + } + } + // track timing metrics + engine.timing.lastUpdatesPerFrame = updateCount; + + // tick events after update Events.trigger(runner, 'afterTick', event); + + // show useful warnings if needed + if (runner.frameDeltaHistory.length >= 100) { + if (runner.lastUpdatesDeferred && Math.round(runner.frameDelta / engineDelta) > maxUpdates) { + Common.warnOnce('Matter.Runner: runner reached runner.maxUpdates, see docs.'); + } else if (runner.lastUpdatesDeferred) { + Common.warnOnce('Matter.Runner: runner reached runner.maxFrameTime, see docs.'); + } + + if (typeof runner.isFixed !== 'undefined') { + Common.warnOnce('Matter.Runner: runner.isFixed is now redundant, see docs.'); + } + + if (runner.deltaMin || runner.deltaMax) { + Common.warnOnce('Matter.Runner: runner.deltaMin and runner.deltaMax were removed, see docs.'); + } + + if (runner.fps !== 0) { + Common.warnOnce('Matter.Runner: runner.fps was replaced by runner.delta, see docs.'); + } + } }; /** - * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop. - * If you wish to only temporarily pause the engine, see `engine.enabled` instead. + * Ends execution of `Runner.run` on the given `runner` by canceling the frame loop. + * Alternatively to temporarily pause the runner, see `runner.enabled`. * @method stop * @param {runner} runner */ Runner.stop = function(runner) { - _cancelAnimationFrame(runner.frameRequestId); + Runner._cancelNextFrame(runner); + }; + + /** + * Schedules the `callback` on this `runner` for the next animation frame. + * @private + * @method _onNextFrame + * @param {runner} runner + * @param {function} callback + * @return {number} frameRequestId + */ + Runner._onNextFrame = function(runner, callback) { + if (typeof window !== 'undefined' && window.requestAnimationFrame) { + runner.frameRequestId = window.requestAnimationFrame(callback); + } else { + throw new Error('Matter.Runner: missing required global window.requestAnimationFrame.'); + } + + return runner.frameRequestId; }; /** - * Alias for `Runner.run`. - * @method start + * Cancels the last callback scheduled by `Runner._onNextFrame` on this `runner`. + * @private + * @method _cancelNextFrame * @param {runner} runner - * @param {engine} engine */ - Runner.start = function(runner, engine) { - Runner.run(runner, engine); + Runner._cancelNextFrame = function(runner) { + if (typeof window !== 'undefined' && window.cancelAnimationFrame) { + window.cancelAnimationFrame(runner.frameRequestId); + } else { + throw new Error('Matter.Runner: missing required global window.cancelAnimationFrame.'); + } + }; + + /** + * Returns the mean of the given numbers. + * @method _mean + * @private + * @param {Number[]} values + * @return {Number} the mean of given values. + */ + var _mean = function(values) { + var result = 0, + valuesLength = values.length; + + for (var i = 0; i < valuesLength; i += 1) { + result += values[i]; + } + + return (result / valuesLength) || 0; }; /* @@ -10595,7 +10883,7 @@ var Common = __webpack_require__(0); */ /** - * Fired at the start of a tick, before any updates to the engine or timing + * Fired once at the start of the browser frame, before any engine updates. * * @event beforeTick * @param {} event An event object @@ -10605,7 +10893,7 @@ var Common = __webpack_require__(0); */ /** - * Fired after engine timing updated, but just before update + * Fired once at the start of the browser frame, after `beforeTick`. * * @event tick * @param {} event An event object @@ -10615,7 +10903,7 @@ var Common = __webpack_require__(0); */ /** - * Fired at the end of a tick, after engine update and after rendering + * Fired once at the end of the browser frame, after `beforeTick`, `tick` and after any engine updates. * * @event afterTick * @param {} event An event object @@ -10625,7 +10913,8 @@ var Common = __webpack_require__(0); */ /** - * Fired before update + * Fired before each and every engine update in this browser frame (if any). + * There may be multiple engine update calls per browser frame (or none) depending on framerate and timestep delta. * * @event beforeUpdate * @param {} event An event object @@ -10635,7 +10924,8 @@ var Common = __webpack_require__(0); */ /** - * Fired after update + * Fired after each and every engine update in this browser frame (if any). + * There may be multiple engine update calls per browser frame (or none) depending on framerate and timestep delta. * * @event afterUpdate * @param {} event An event object @@ -10651,7 +10941,31 @@ var Common = __webpack_require__(0); */ /** - * A flag that specifies whether the runner is running or not. + * The fixed timestep size used for `Engine.update` calls in milliseconds, known as `delta`. + * + * This value is recommended to be `1000 / 60` ms or smaller (i.e. equivalent to at least 60hz). + * + * Smaller `delta` values provide higher quality results at the cost of performance. + * + * You should usually avoid changing `delta` during running, otherwise quality may be affected. + * + * For smoother frame pacing choose a `delta` that is an even multiple of each display FPS you target, i.e. `1000 / (n * fps)` as this helps distribute an equal number of updates over each display frame. + * + * For example with a 60 Hz `delta` i.e. `1000 / 60` the runner will on average perform one update per frame on displays running 60 FPS and one update every two frames on displays running 120 FPS, etc. + * + * Where as e.g. using a 240 Hz `delta` i.e. `1000 / 240` the runner will on average perform four updates per frame on displays running 60 FPS and two updates per frame on displays running 120 FPS, etc. + * + * Therefore `Runner.run` will call multiple engine updates (or none) as needed to simulate the time elapsed between browser frames. + * + * In practice the number of updates in any particular frame may be restricted to respect the runner's performance budgets. These are specified by `runner.maxFrameTime` and `runner.maxUpdates`, see those properties for details. + * + * @property delta + * @type number + * @default 1000 / 60 + */ + + /** + * A flag that can be toggled to enable or disable tick calls on this runner, therefore pausing engine updates and events while the runner loop remains running. * * @property enabled * @type boolean @@ -10659,23 +10973,88 @@ var Common = __webpack_require__(0); */ /** - * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). - * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). - * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). + * The accumulated time elapsed that has yet to be simulated in milliseconds. + * This value is clamped within certain limits (see `Runner.tick` code). + * + * @private + * @property timeBuffer + * @type number + * @default 0 + */ + + /** + * The measured time elapsed between the last two browser frames measured in milliseconds. + * This is useful e.g. to estimate the current browser FPS using `1000 / runner.frameDelta`. * - * @property isFixed + * @readonly + * @property frameDelta + * @type number + */ + + /** + * Enables averaging to smooth frame rate measurements and therefore stabilise play rate. + * + * @property frameDeltaSmoothing * @type boolean - * @default false + * @default true */ /** - * A `Number` that specifies the time step between updates in milliseconds. - * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. - * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. + * Rounds measured browser frame delta to the nearest 1 Hz. + * This option can help smooth frame rate measurements and simplify handling hardware timing differences e.g. 59.94Hz and 60Hz displays. + * For best results you should also round your `runner.delta` equivalent to the nearest 1 Hz. * - * @property delta + * @property frameDeltaSnapping + * @type boolean + * @default true + */ + + /** + * A performance budget that limits execution time allowed for this runner per browser frame in milliseconds. + * + * To calculate the effective browser FPS at which this throttle is applied use `1000 / runner.maxFrameTime`. + * + * This performance budget is intended to help maintain browser interactivity and help improve framerate recovery during temporary high CPU usage. + * + * This budget only covers the measured time elapsed executing the functions called in the scope of the runner tick, including `Engine.update` and its related user event callbacks. + * + * You may also reduce this budget to allow for any significant additional processing you perform on the same thread outside the scope of this runner tick, e.g. rendering time. + * + * See also `runner.maxUpdates`. + * + * @property maxFrameTime * @type number - * @default 1000 / 60 + * @default 1000 / 30 + */ + + /** + * An optional limit for maximum engine update count allowed per frame tick in addition to `runner.maxFrameTime`. + * + * Unless you set a value it is automatically chosen based on `runner.delta` and `runner.maxFrameTime`. + * + * See also `runner.maxFrameTime`. + * + * @property maxUpdates + * @type number + * @default null + */ + + /** + * The timestamp of the last call to `Runner.tick` used to measure `frameDelta`. + * + * @private + * @property timeLastTick + * @type number + * @default 0 + */ + + /** + * The id of the last call to `Runner._onNextFrame`. + * + * @private + * @property frameRequestId + * @type number + * @default null */ })(); diff --git a/build/matter.min.js b/build/matter.min.js index 1b312157..d401fc45 100644 --- a/build/matter.min.js +++ b/build/matter.min.js @@ -1,6 +1,6 @@ /*! - * matter-js 0.19.0 by @liabru + * matter-js 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Matter",[],t):"object"==typeof exports?exports.Matter=t():e.Matter=t()}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){var n={};e.exports=n,function(){n._baseDelta=1e3/60,n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n._warnedOnce={},n._decomp=null,n.extend=function(e,t){var i,o;"boolean"==typeof t?(i=2,o=t):(i=1,o=!0);for(var r=i;r0;t--){var i=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[i],e[i]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warnOnce=function(){var e=Array.prototype.slice.call(arguments).join(" ");n._warnedOnce[e]||(n.warn(e),n._warnedOnce[e]=!0)},n.deprecated=function(e,t,i){e[t]=n.chain((function(){n.warnOnce("🔅 deprecated 🔅",i)}),e[t])},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;ne.max.x&&(e.max.x=o.x),o.xe.max.y&&(e.max.y=o.y),o.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,i=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+i}},function(e,t){var n={};e.exports=n,n.create=function(e,t){return{x:e||0,y:t||0}},n.clone=function(e){return{x:e.x,y:e.y}},n.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},n.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},n.rotate=function(e,t,n){var i=Math.cos(t),o=Math.sin(t);n||(n={});var r=e.x*i-e.y*o;return n.y=e.x*o+e.y*i,n.x=r,n},n.rotateAbout=function(e,t,n,i){var o=Math.cos(t),r=Math.sin(t);i||(i={});var a=n.x+((e.x-n.x)*o-(e.y-n.y)*r);return i.y=n.y+((e.x-n.x)*r+(e.y-n.y)*o),i.x=a,i},n.normalise=function(e){var t=n.magnitude(e);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},n.dot=function(e,t){return e.x*t.x+e.y*t.y},n.cross=function(e,t){return e.x*t.y-e.y*t.x},n.cross3=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)},n.add=function(e,t,n){return n||(n={}),n.x=e.x+t.x,n.y=e.y+t.y,n},n.sub=function(e,t,n){return n||(n={}),n.x=e.x-t.x,n.y=e.y-t.y,n},n.mult=function(e,t){return{x:e.x*t,y:e.y*t}},n.div=function(e,t){return{x:e.x/t,y:e.y/t}},n.perp=function(e,t){return{x:(t=!0===t?-1:1)*-e.y,y:t*e.x}},n.neg=function(e){return{x:-e.x,y:-e.y}},n.angle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(e,t,n){var i={};e.exports=i;var o=n(2),r=n(0);i.create=function(e,t){for(var n=[],i=0;i0)return!1;a=n}return!0},i.scale=function(e,t,n,r){if(1===t&&1===n)return e;var a,s;r=r||i.centre(e);for(var l=0;l=0?l-1:e.length-1],u=e[l],d=e[(l+1)%e.length],p=t[l0&&(r|=2),3===r)return!1;return 0!==r||null},i.hull=function(e){var t,n,i=[],r=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&o.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];i.length>=2&&o.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return i.pop(),r.pop(),i.concat(r)}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(2),a=n(7),s=n(0),l=n(1),c=n(11);!function(){i._timeCorrection=!0,i._inertiaScale=4,i._nextCollidingGroupId=1,i._nextNonCollidingGroupId=-1,i._nextCategory=1,i._baseDelta=1e3/60,i.create=function(t){var n={id:s.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:o.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:1e3/60,_original:null},i=s.extend(n,t);return e(i,t),i},i.nextGroup=function(e){return e?i._nextNonCollidingGroupId--:i._nextCollidingGroupId++},i.nextCategory=function(){return i._nextCategory=i._nextCategory<<1,i._nextCategory};var e=function(e,t){t=t||{},i.set(e,{bounds:e.bounds||l.create(e.vertices),positionPrev:e.positionPrev||r.clone(e.position),anglePrev:e.anglePrev||e.angle,vertices:e.vertices,parts:e.parts||[e],isStatic:e.isStatic,isSleeping:e.isSleeping,parent:e.parent||e}),o.rotate(e.vertices,e.angle,e.position),c.rotate(e.axes,e.angle),l.update(e.bounds,e.vertices,e.velocity),i.set(e,{axes:t.axes||e.axes,area:t.area||e.area,mass:t.mass||e.mass,inertia:t.inertia||e.inertia});var n=e.isStatic?"#14151f":s.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),a=e.isStatic?"#555":"#ccc",u=e.isStatic&&null===e.render.fillStyle?1:0;e.render.fillStyle=e.render.fillStyle||n,e.render.strokeStyle=e.render.strokeStyle||a,e.render.lineWidth=e.render.lineWidth||u,e.render.sprite.xOffset+=-(e.bounds.min.x-e.position.x)/(e.bounds.max.x-e.bounds.min.x),e.render.sprite.yOffset+=-(e.bounds.min.y-e.position.y)/(e.bounds.max.y-e.bounds.min.y)};i.set=function(e,t,n){var o;for(o in"string"==typeof t&&(o=t,(t={})[o]=n),t)if(Object.prototype.hasOwnProperty.call(t,o))switch(n=t[o],o){case"isStatic":i.setStatic(e,n);break;case"isSleeping":a.set(e,n);break;case"mass":i.setMass(e,n);break;case"density":i.setDensity(e,n);break;case"inertia":i.setInertia(e,n);break;case"vertices":i.setVertices(e,n);break;case"position":i.setPosition(e,n);break;case"angle":i.setAngle(e,n);break;case"velocity":i.setVelocity(e,n);break;case"angularVelocity":i.setAngularVelocity(e,n);break;case"speed":i.setSpeed(e,n);break;case"angularSpeed":i.setAngularSpeed(e,n);break;case"parts":i.setParts(e,n);break;case"centre":i.setCentre(e,n);break;default:e[o]=n}},i.setStatic=function(e,t){for(var n=0;n0&&r.rotateAbout(s.position,i,e.position,s.position)}},i.setVelocity=function(e,t){var n=e.deltaTime/i._baseDelta;e.positionPrev.x=e.position.x-t.x*n,e.positionPrev.y=e.position.y-t.y*n,e.velocity.x=(e.position.x-e.positionPrev.x)/n,e.velocity.y=(e.position.y-e.positionPrev.y)/n,e.speed=r.magnitude(e.velocity)},i.getVelocity=function(e){var t=i._baseDelta/e.deltaTime;return{x:(e.position.x-e.positionPrev.x)*t,y:(e.position.y-e.positionPrev.y)*t}},i.getSpeed=function(e){return r.magnitude(i.getVelocity(e))},i.setSpeed=function(e,t){i.setVelocity(e,r.mult(r.normalise(i.getVelocity(e)),t))},i.setAngularVelocity=function(e,t){var n=e.deltaTime/i._baseDelta;e.anglePrev=e.angle-t*n,e.angularVelocity=(e.angle-e.anglePrev)/n,e.angularSpeed=Math.abs(e.angularVelocity)},i.getAngularVelocity=function(e){return(e.angle-e.anglePrev)*i._baseDelta/e.deltaTime},i.getAngularSpeed=function(e){return Math.abs(i.getAngularVelocity(e))},i.setAngularSpeed=function(e,t){i.setAngularVelocity(e,s.sign(i.getAngularVelocity(e))*t)},i.translate=function(e,t,n){i.setPosition(e,r.add(e.position,t),n)},i.rotate=function(e,t,n,o){if(n){var r=Math.cos(t),a=Math.sin(t),s=e.position.x-n.x,l=e.position.y-n.y;i.setPosition(e,{x:n.x+(s*r-l*a),y:n.y+(s*a+l*r)},o),i.setAngle(e,e.angle+t,o)}else i.setAngle(e,e.angle+t,o)},i.scale=function(e,t,n,r){var a=0,s=0;r=r||e.position;for(var u=0;u0&&(a+=d.area,s+=d.inertia),d.position.x=r.x+(d.position.x-r.x)*t,d.position.y=r.y+(d.position.y-r.y)*n,l.update(d.bounds,d.vertices,e.velocity)}e.parts.length>1&&(e.area=a,e.isStatic||(i.setMass(e,e.density*a),i.setInertia(e,s))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},i.update=function(e,t){var n=(t=(void 0!==t?t:1e3/60)*e.timeScale)*t,a=i._timeCorrection?t/(e.deltaTime||t):1,u=1-e.frictionAir*(t/s._baseDelta),d=(e.position.x-e.positionPrev.x)*a,p=(e.position.y-e.positionPrev.y)*a;e.velocity.x=d*u+e.force.x/e.mass*n,e.velocity.y=p*u+e.force.y/e.mass*n,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.deltaTime=t,e.angularVelocity=(e.angle-e.anglePrev)*u*a+e.torque/e.inertia*n,e.anglePrev=e.angle,e.angle+=e.angularVelocity;for(var f=0;f0&&(v.position.x+=e.velocity.x,v.position.y+=e.velocity.y),0!==e.angularVelocity&&(o.rotate(v.vertices,e.angularVelocity,e.position),c.rotate(v.axes,e.angularVelocity),f>0&&r.rotateAbout(v.position,e.angularVelocity,e.position,v.position)),l.update(v.bounds,v.vertices,e.velocity)}},i.updateVelocities=function(e){var t=i._baseDelta/e.deltaTime,n=e.velocity;n.x=(e.position.x-e.positionPrev.x)*t,n.y=(e.position.y-e.positionPrev.y)*t,e.speed=Math.sqrt(n.x*n.x+n.y*n.y),e.angularVelocity=(e.angle-e.anglePrev)*t,e.angularSpeed=Math.abs(e.angularVelocity)},i.applyForce=function(e,t,n){var i=t.x-e.position.x,o=t.y-e.position.y;e.force.x+=n.x,e.force.y+=n.y,e.torque+=i*n.y-o*n.x},i._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n0){n||(n={}),i=t.split(" ");for(var c=0;c0&&l.motion=l.sleepThreshold/n&&i.set(l,!0)):l.sleepCounter>0&&(l.sleepCounter-=1)}else i.set(l,!1)}},i.afterCollisions=function(e){for(var t=i._motionSleepThreshold,n=0;nt&&i.set(l,!1)}}}},i.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||r.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&r.trigger(e,"sleepEnd"))}},function(e,t,n){var i={};e.exports=i;var o,r,a,s=n(3),l=n(9);o=[],r={overlap:0,axis:null},a={overlap:0,axis:null},i.create=function(e,t){return{pair:null,collided:!1,bodyA:e,bodyB:t,parentA:e.parent,parentB:t.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},i.collides=function(e,t,n){if(i._overlapAxes(r,e.vertices,t.vertices,e.axes),r.overlap<=0)return null;if(i._overlapAxes(a,t.vertices,e.vertices,t.axes),a.overlap<=0)return null;var o,c,u=n&&n.table[l.id(e,t)];u?o=u.collision:((o=i.create(e,t)).collided=!0,o.bodyA=e.idP?P=s:sC?C=s:so?o=a:al.frictionStatic?s.frictionStatic:l.frictionStatic,e.restitution=s.restitution>l.restitution?s.restitution:l.restitution,e.slop=s.slop>l.slop?s.slop:l.slop,t.pair=e,a.length=0;for(var u=0;u0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(a.type="pin",a.anchors=!1):t.stiffness<.9&&(a.type="spring"),t.render=c.extend(a,t.render),t},i.preSolveAll=function(e){for(var t=0;t=1||0===e.length?e.stiffness*t:e.stiffness*t*t,h=e.damping*t,b=r.mult(u,g*x),S=(n?n.inverseMass:0)+(o?o.inverseMass:0),w=S+((n?n.inverseInertia:0)+(o?o.inverseInertia:0));if(h>0){var A=r.create();v=r.div(u,d),m=r.sub(o&&r.sub(o.position,o.positionPrev)||A,n&&r.sub(n.position,n.positionPrev)||A),y=r.dot(v,m)}n&&!n.isStatic&&(f=n.inverseMass/S,n.constraintImpulse.x-=b.x*f,n.constraintImpulse.y-=b.y*f,n.position.x-=b.x*f,n.position.y-=b.y*f,h>0&&(n.positionPrev.x-=h*v.x*y*f,n.positionPrev.y-=h*v.y*y*f),p=r.cross(a,b)/w*i._torqueDampen*n.inverseInertia*(1-e.angularStiffness),n.constraintImpulse.angle-=p,n.angle-=p),o&&!o.isStatic&&(f=o.inverseMass/S,o.constraintImpulse.x+=b.x*f,o.constraintImpulse.y+=b.y*f,o.position.x+=b.x*f,o.position.y+=b.y*f,h>0&&(o.positionPrev.x+=h*v.x*y*f,o.positionPrev.y+=h*v.y*y*f),p=r.cross(s,b)/w*i._torqueDampen*o.inverseInertia*(1-e.angularStiffness),o.constraintImpulse.angle+=p,o.angle+=p)}}},i.postSolveAll=function(e){for(var t=0;t0&&(d.position.x+=c.x,d.position.y+=c.y),0!==c.angle&&(o.rotate(d.vertices,c.angle,n.position),l.rotate(d.axes,c.angle),u>0&&r.rotateAbout(d.position,c.angle,n.position,d.position)),s.update(d.bounds,d.vertices,n.velocity)}c.angle*=i._warming,c.x*=i._warming,c.y*=i._warming}}},i.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),y:(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0)}},i.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0),y:(e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0)}}},function(e,t,n){var i={};e.exports=i;var o=n(2),r=n(0);i.fromVertices=function(e){for(var t={},n=0;n0&&o.area(M)1?(v=a.create(r.extend({parts:y.slice(0)},i)),a.setPosition(v,{x:e,y:t}),v):y[0]}},function(e,t,n){var i={};e.exports=i;var o=n(0),r=n(8);i.create=function(e){return o.extend({bodies:[],pairs:null},e)},i.setBodies=function(e,t){e.bodies=t.slice(0)},i.clear=function(e){e.bodies=[]},i.collisions=function(e){var t,n,o=[],a=e.pairs,s=e.bodies,l=s.length,c=i.canCollide,u=r.collides;for(s.sort(i._compareBoundsX),t=0;tf)break;if(!(vB.max.y)&&(!m||!h.isStatic&&!h.isSleeping)&&c(d.collisionFilter,h.collisionFilter)){var b=h.parts.length;if(x&&1===b)(C=u(d,h,a))&&o.push(C);else for(var S=b>1?1:0,w=g>1?1:0;wB.max.x||p.max.xB.max.y||(C=u(A,M,a))&&o.push(C)}}}}return o},i.canCollide=function(e,t){return e.group===t.group&&0!==e.group?e.group>0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)},i._compareBoundsX=function(e,t){return e.bounds.min.x-t.bounds.min.x}},function(e,t,n){var i={};e.exports=i;var o=n(0);i.create=function(e){var t={};return e||o.log("Mouse.create: element was undefined, defaulting to document.body","warn"),t.element=e||document.body,t.absolute={x:0,y:0},t.position={x:0,y:0},t.mousedownPosition={x:0,y:0},t.mouseupPosition={x:0,y:0},t.offset={x:0,y:0},t.scale={x:1,y:1},t.wheelDelta=0,t.button=-1,t.pixelRatio=parseInt(t.element.getAttribute("data-pixel-ratio"),10)||1,t.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},t.mousemove=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&(t.button=0,e.preventDefault()),t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.sourceEvents.mousemove=e},t.mousedown=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches?(t.button=0,e.preventDefault()):t.button=e.button,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mousedownPosition.x=t.position.x,t.mousedownPosition.y=t.position.y,t.sourceEvents.mousedown=e},t.mouseup=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&e.preventDefault(),t.button=-1,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mouseupPosition.x=t.position.x,t.mouseupPosition.y=t.position.y,t.sourceEvents.mouseup=e},t.mousewheel=function(e){t.wheelDelta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),e.preventDefault()},i.setElement(t,t.element),t},i.setElement=function(e,t){e.element=t,t.addEventListener("mousemove",e.mousemove),t.addEventListener("mousedown",e.mousedown),t.addEventListener("mouseup",e.mouseup),t.addEventListener("mousewheel",e.mousewheel),t.addEventListener("DOMMouseScroll",e.mousewheel),t.addEventListener("touchmove",e.mousemove),t.addEventListener("touchstart",e.mousedown),t.addEventListener("touchend",e.mouseup)},i.clearSourceEvents=function(e){e.sourceEvents.mousemove=null,e.sourceEvents.mousedown=null,e.sourceEvents.mouseup=null,e.sourceEvents.mousewheel=null,e.wheelDelta=0},i.setOffset=function(e,t){e.offset.x=t.x,e.offset.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},i.setScale=function(e,t){e.scale.x=t.x,e.scale.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},i._getRelativeMousePosition=function(e,t,n){var i,o,r=t.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,s=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,l=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,c=e.changedTouches;return c?(i=c[0].pageX-r.left-s,o=c[0].pageY-r.top-l):(i=e.pageX-r.left-s,o=e.pageY-r.top-l),{x:i/(t.clientWidth/(t.width||t.clientWidth)*n),y:o/(t.clientHeight/(t.height||t.clientHeight)*n)}}},function(e,t,n){var i={};e.exports=i;var o=n(0);i._registry={},i.register=function(e){if(i.isPlugin(e)||o.warn("Plugin.register:",i.toString(e),"does not implement all required fields."),e.name in i._registry){var t=i._registry[e.name],n=i.versionParse(e.version).number,r=i.versionParse(t.version).number;n>r?(o.warn("Plugin.register:",i.toString(t),"was upgraded to",i.toString(e)),i._registry[e.name]=e):n-1},i.isFor=function(e,t){var n=e.for&&i.dependencyParse(e.for);return!e.for||t.name===n.name&&i.versionSatisfies(t.version,n.range)},i.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=i.dependencies(e),r=o.topologicalSort(n),a=[],s=0;s0&&o.info(a.join(" "))}else o.warn("Plugin.use:",i.toString(e),"does not specify any dependencies to install.")},i.dependencies=function(e,t){var n=i.dependencyParse(e),r=n.name;if(!(r in(t=t||{}))){e=i.resolve(e)||e,t[r]=o.map(e.uses||[],(function(t){i.isPlugin(t)&&i.register(t);var r=i.dependencyParse(t),a=i.resolve(t);return a&&!i.versionSatisfies(a.version,r.range)?(o.warn("Plugin.dependencies:",i.toString(a),"does not satisfy",i.toString(r),"used by",i.toString(n)+"."),a._warned=!0,e._warned=!0):a||(o.warn("Plugin.dependencies:",i.toString(t),"used by",i.toString(n),"could not be resolved."),e._warned=!0),r.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;t.test(e)||o.warn("Plugin.versionParse:",e,"is not a valid version or range.");var n=t.exec(e),i=Number(n[4]),r=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:e,operator:n[1]||n[2]||"",major:i,minor:r,patch:a,parts:[i,r,a],prerelease:n[7],number:1e8*i+1e4*r+a}},i.versionSatisfies=function(e,t){t=t||"*";var n=i.versionParse(t),o=i.versionParse(e);if(n.isRange){if("*"===n.operator||"*"===e)return!0;if(">"===n.operator)return o.number>n.number;if(">="===n.operator)return o.number>=n.number;if("~"===n.operator)return o.major===n.major&&o.minor===n.minor&&o.patch>=n.patch;if("^"===n.operator)return n.major>0?o.major===n.major&&o.number>=n.number:n.minor>0?o.minor===n.minor&&o.patch>=n.patch:o.patch===n.patch}return e===t||"*"===e}},function(e,t){var n={};e.exports=n,n.create=function(e){return{vertex:e,normalImpulse:0,tangentImpulse:0}}},function(e,t,n){var i={};e.exports=i;var o=n(7),r=n(18),a=n(13),s=n(19),l=n(5),c=n(6),u=n(10),d=n(0),p=n(4);i.create=function(e){e=e||{};var t=d.extend({positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},e);return t.world=e.world||c.create({label:"World"}),t.pairs=e.pairs||s.create(),t.detector=e.detector||a.create(),t.grid={buckets:[]},t.world.gravity=t.gravity,t.broadphase=t.grid,t.metrics={},t},i.update=function(e,t){var n,p=d.now(),f=e.world,v=e.detector,y=e.pairs,m=e.timing,g=m.timestamp;t=void 0!==t?t:d._baseDelta,t*=m.timeScale,m.timestamp+=t,m.lastDelta=t;var x={timestamp:m.timestamp,delta:t};l.trigger(e,"beforeUpdate",x);var h=c.allBodies(f),b=c.allConstraints(f);for(f.isModified&&(a.setBodies(v,h),c.setModified(f,!1,!1,!0)),e.enableSleeping&&o.update(h,t),i._bodiesApplyGravity(h,e.gravity),t>0&&i._bodiesUpdate(h,t),u.preSolveAll(h),n=0;n0&&l.trigger(e,"collisionStart",{pairs:y.collisionStart});var w=d.clamp(20/e.positionIterations,0,1);for(r.preSolvePosition(y.list),n=0;n0&&l.trigger(e,"collisionActive",{pairs:y.collisionActive}),y.collisionEnd.length>0&&l.trigger(e,"collisionEnd",{pairs:y.collisionEnd}),i._bodiesClearForces(h),l.trigger(e,"afterUpdate",x),e.timing.lastElapsed=d.now()-p,e},i.merge=function(e,t){if(d.extend(e,t),t.world){e.world=t.world,i.clear(e);for(var n=c.allBodies(e.world),r=0;rU?(o=q>0?q:-q,(n=y.friction*(q>0?1:-1)*c)<-o?n=-o:n>o&&(n=o)):(n=q,o=f);var N=R*w-V*S,z=E*w-L*S,X=B/(_+g.inverseInertia*N*N+x.inverseInertia*z*z),Q=(1+y.restitution)*j*X;if(n*=X,j0&&(I.normalImpulse=0),Q=I.normalImpulse-Y}if(q<-d||q>d)I.tangentImpulse=0;else{var Z=I.tangentImpulse;I.tangentImpulse+=n,I.tangentImpulse<-o&&(I.tangentImpulse=-o),I.tangentImpulse>o&&(I.tangentImpulse=o),n=I.tangentImpulse-Z}var $=S*Q+A*n,J=w*Q+P*n;g.isStatic||g.isSleeping||(g.positionPrev.x+=$*g.inverseMass,g.positionPrev.y+=J*g.inverseMass,g.anglePrev+=(R*J-V*$)*g.inverseInertia),x.isStatic||x.isSleeping||(x.positionPrev.x-=$*x.inverseMass,x.positionPrev.y-=J*x.inverseMass,x.anglePrev-=(E*J-L*$)*x.inverseInertia)}}}}},function(e,t,n){var i={};e.exports=i;var o=n(9),r=n(0);i.create=function(e){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},i.update=function(e,t,n){var i,r,a,s,l=e.list,c=l.length,u=e.table,d=t.length,p=e.collisionStart,f=e.collisionEnd,v=e.collisionActive;for(p.length=0,f.length=0,v.length=0,s=0;sy&&(y=x),s.translate(g,{x:.5*h,y:.5*x}),d=g.bounds.max.x+r,o.addBody(u,g),c=g,f+=1}else d+=r}p+=y+a,d=e}return u},i.chain=function(e,t,n,i,s,l){for(var c=e.bodies,u=1;u0)for(c=0;c0&&(p=f[c-1+(l-1)*t],o.addConstraint(e,r.create(a.extend({bodyA:p,bodyB:d},s)))),i&&cp||a<(c=p-c)||a>n-1-c))return 1===d&&s.translate(u,{x:(a+(n%2==1?1:-1))*f,y:0}),l(e+(u?a*f:0)+a*r,i,a,c,u,d)}))},i.newtonsCradle=function(e,t,n,i,a){for(var s=o.create({label:"Newtons Cradle"}),c=0;cu.bounds.max.x||f.bounds.max.yu.bounds.max.y))){var v=i._getRegion(e,f);if(!f.region||v.id!==f.region.id||o){f.region&&!o||(f.region=v);var y=i._regionUnion(v,f.region);for(a=y.startCol;a<=y.endCol;a++)for(s=y.startRow;s<=y.endRow;s++){l=d[c=i._getBucketId(a,s)];var m=a>=v.startCol&&a<=v.endCol&&s>=v.startRow&&s<=v.endRow,g=a>=f.region.startCol&&a<=f.region.endCol&&s>=f.region.startRow&&s<=f.region.endRow;!m&&g&&g&&l&&i._bucketRemoveBody(e,l,f),(f.region===v||m&&!g||o)&&(l||(l=i._createBucket(d,c)),i._bucketAddBody(e,l,f))}f.region=v,p=!0}}}p&&(e.pairsList=i._createActivePairsList(e))},a(i,"update","Grid.update ➤ replaced by Matter.Detector"),i.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},a(i,"clear","Grid.clear ➤ replaced by Matter.Detector"),i._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),o=Math.max(e.endCol,t.endCol),r=Math.min(e.startRow,t.startRow),a=Math.max(e.endRow,t.endRow);return i._createRegion(n,o,r,a)},i._getRegion=function(e,t){var n=t.bounds,o=Math.floor(n.min.x/e.bucketWidth),r=Math.floor(n.max.x/e.bucketWidth),a=Math.floor(n.min.y/e.bucketHeight),s=Math.floor(n.max.y/e.bucketHeight);return i._createRegion(o,r,a,s)},i._createRegion=function(e,t,n,i){return{id:e+","+t+","+n+","+i,startCol:e,endCol:t,startRow:n,endRow:i}},i._getBucketId=function(e,t){return"C"+e+"R"+t},i._createBucket=function(e,t){return e[t]=[]},i._bucketAddBody=function(e,t,n){var i,r=e.pairs,a=o.id,s=t.length;for(i=0;i0?s.push(t):delete i[o[n]];return s}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(7),a=n(14),s=n(5),l=n(13),c=n(10),u=n(6),d=n(0),p=n(1);i.create=function(e,t){var n=(e?e.mouse:null)||(t?t.mouse:null);n||(e&&e.render&&e.render.canvas?n=a.create(e.render.canvas):t&&t.element?n=a.create(t.element):(n=a.create(),d.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var o={type:"mouseConstraint",mouse:n,element:null,body:null,constraint:c.create({label:"Mouse Constraint",pointA:n.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),collisionFilter:{category:1,mask:4294967295,group:0}},r=d.extend(o,t);return s.on(e,"beforeUpdate",(function(){var t=u.allBodies(e.world);i.update(r,t),i._triggerEvents(r)})),r},i.update=function(e,t){var n=e.mouse,i=e.constraint,a=e.body;if(0===n.button){if(i.bodyB)r.set(i.bodyB,!1),i.pointA=n.position;else for(var c=0;c1?1:0;uo.max.x&&(o.max.x=c.x),l.yo.max.y&&(o.max.y=c.y))}var d=o.max.x-o.min.x+2*n.x,p=o.max.y-o.min.y+2*n.y,f=e.canvas.height,v=e.canvas.width/f,y=d/p,m=1,g=1;y>v?g=y/v:m=v/y,e.options.hasBounds=!0,e.bounds.min.x=o.min.x,e.bounds.max.x=o.min.x+d*m,e.bounds.min.y=o.min.y,e.bounds.max.y=o.min.y+p*g,i&&(e.bounds.min.x+=.5*d-d*m*.5,e.bounds.max.x+=.5*d-d*m*.5,e.bounds.min.y+=.5*p-p*g*.5,e.bounds.max.y+=.5*p-p*g*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(u.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),u.setOffset(e.mouse,e.bounds.min))},i.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,i=t/e.options.width,o=n/e.options.height;e.context.setTransform(e.options.pixelRatio/i,0,0,e.options.pixelRatio/o,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},i.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},i.world=function(e,t){var n,o=r.now(),d=e.engine,p=d.world,f=e.canvas,v=e.context,m=e.options,g=e.timing,x=a.allBodies(p),h=a.allConstraints(p),b=m.wireframes?m.wireframeBackground:m.background,S=[],w=[],A={timestamp:d.timing.timestamp};if(l.trigger(e,"beforeRender",A),e.currentBackground!==b&&y(e,b),v.globalCompositeOperation="source-in",v.fillStyle="transparent",v.fillRect(0,0,f.width,f.height),v.globalCompositeOperation="source-over",m.hasBounds){for(n=0;n1?1:0;a1?1:0;s1?1:0;r1?1:0;s1?1:0;r1?1:0;r1?1:0;o0)){var u=i.activeContacts[0].vertex.x,d=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(u=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,d=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),o.bodyB===o.supports[0].body||!0===o.bodyA.isStatic?s.moveTo(u-8*o.normal.x,d-8*o.normal.y):s.moveTo(u+8*o.normal.x,d+8*o.normal.y),s.lineTo(u,d)}l.wireframes?s.strokeStyle="rgba(255,165,0,0.7)":s.strokeStyle="orange",s.lineWidth=1,s.stroke()},i.separations=function(e,t,n){var i,o,r,a,s,l=n,c=e.options;for(l.beginPath(),s=0;se.deltaMax?e.deltaMax:i,e.delta=i);var s={timestamp:a.timestamp};o.trigger(e,"beforeTick",s),e.frameCounter+=1,n-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((n-e.counterTimestamp)/1e3),e.counterTimestamp=n,e.frameCounter=0),o.trigger(e,"tick",s),o.trigger(e,"beforeUpdate",s),r.update(t,i),o.trigger(e,"afterUpdate",s),o.trigger(e,"afterTick",s)},i.stop=function(e){t(e.frameRequestId)},i.start=function(e,t){i.run(e,t)}}()},function(e,t,n){var i={};e.exports=i;var o=n(8),r=n(0).deprecated;i.collides=function(e,t){return o.collides(e,t)},r(i,"collides","SAT.collides ➤ replaced by Collision.collides")},function(e,t,n){var i={};e.exports=i;n(1);var o=n(0);i.pathToVertices=function(e,t){"undefined"==typeof window||"SVGPathSeg"in window||o.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,r,a,s,l,c,u,d,p,f,v,y=[],m=0,g=0,x=0;t=t||15;var h=function(e,t,n){var i=n%2==1&&n>1;if(!p||e!=p.x||t!=p.y){p&&i?(f=p.x,v=p.y):(f=0,v=0);var o={x:f+e,y:v+t};!i&&p||(p=o),y.push(o),g=f+e,x=v+t}},b=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":g=e.x,x=e.y;break;case"H":g=e.x;break;case"V":x=e.y}h(g,x,e.pathSegType)}};for(i._svgPathToAbsolute(e),a=e.getTotalLength(),c=[],n=0;n0;t--){var o=Math.floor(n.random()*(t+1)),i=e[t];e[t]=e[o],e[o]=i}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warnOnce=function(){var e=Array.prototype.slice.call(arguments).join(" ");n._warnedOnce[e]||(n.warn(e),n._warnedOnce[e]=!0)},n.deprecated=function(e,t,o){e[t]=n.chain((function(){n.warnOnce("🔅 deprecated 🔅",o)}),e[t])},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;ne.max.x&&(e.max.x=i.x),i.xe.max.y&&(e.max.y=i.y),i.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,o=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+o}},function(e,t){var n={};e.exports=n,n.create=function(e,t){return{x:e||0,y:t||0}},n.clone=function(e){return{x:e.x,y:e.y}},n.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},n.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},n.rotate=function(e,t,n){var o=Math.cos(t),i=Math.sin(t);n||(n={});var r=e.x*o-e.y*i;return n.y=e.x*i+e.y*o,n.x=r,n},n.rotateAbout=function(e,t,n,o){var i=Math.cos(t),r=Math.sin(t);o||(o={});var a=n.x+((e.x-n.x)*i-(e.y-n.y)*r);return o.y=n.y+((e.x-n.x)*r+(e.y-n.y)*i),o.x=a,o},n.normalise=function(e){var t=n.magnitude(e);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},n.dot=function(e,t){return e.x*t.x+e.y*t.y},n.cross=function(e,t){return e.x*t.y-e.y*t.x},n.cross3=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)},n.add=function(e,t,n){return n||(n={}),n.x=e.x+t.x,n.y=e.y+t.y,n},n.sub=function(e,t,n){return n||(n={}),n.x=e.x-t.x,n.y=e.y-t.y,n},n.mult=function(e,t){return{x:e.x*t,y:e.y*t}},n.div=function(e,t){return{x:e.x/t,y:e.y/t}},n.perp=function(e,t){return{x:(t=!0===t?-1:1)*-e.y,y:t*e.x}},n.neg=function(e){return{x:-e.x,y:-e.y}},n.angle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(e,t,n){var o={};e.exports=o;var i=n(2),r=n(0);o.create=function(e,t){for(var n=[],o=0;o0)return!1;a=n}return!0},o.scale=function(e,t,n,r){if(1===t&&1===n)return e;var a,s;r=r||o.centre(e);for(var l=0;l=0?l-1:e.length-1],u=e[l],d=e[(l+1)%e.length],p=t[l0&&(r|=2),3===r)return!1;return 0!==r||null},o.hull=function(e){var t,n,o=[],r=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&i.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];o.length>=2&&i.cross3(o[o.length-2],o[o.length-1],t)<=0;)o.pop();o.push(t)}return o.pop(),r.pop(),o.concat(r)}},function(e,t,n){var o={};e.exports=o;var i=n(3),r=n(2),a=n(7),s=n(0),l=n(1),c=n(11);!function(){o._timeCorrection=!0,o._inertiaScale=4,o._nextCollidingGroupId=1,o._nextNonCollidingGroupId=-1,o._nextCategory=1,o._baseDelta=1e3/60,o.create=function(t){var n={id:s.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:i.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:1e3/60,_original:null},o=s.extend(n,t);return e(o,t),o},o.nextGroup=function(e){return e?o._nextNonCollidingGroupId--:o._nextCollidingGroupId++},o.nextCategory=function(){return o._nextCategory=o._nextCategory<<1,o._nextCategory};var e=function(e,t){t=t||{},o.set(e,{bounds:e.bounds||l.create(e.vertices),positionPrev:e.positionPrev||r.clone(e.position),anglePrev:e.anglePrev||e.angle,vertices:e.vertices,parts:e.parts||[e],isStatic:e.isStatic,isSleeping:e.isSleeping,parent:e.parent||e}),i.rotate(e.vertices,e.angle,e.position),c.rotate(e.axes,e.angle),l.update(e.bounds,e.vertices,e.velocity),o.set(e,{axes:t.axes||e.axes,area:t.area||e.area,mass:t.mass||e.mass,inertia:t.inertia||e.inertia});var n=e.isStatic?"#14151f":s.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),a=e.isStatic?"#555":"#ccc",u=e.isStatic&&null===e.render.fillStyle?1:0;e.render.fillStyle=e.render.fillStyle||n,e.render.strokeStyle=e.render.strokeStyle||a,e.render.lineWidth=e.render.lineWidth||u,e.render.sprite.xOffset+=-(e.bounds.min.x-e.position.x)/(e.bounds.max.x-e.bounds.min.x),e.render.sprite.yOffset+=-(e.bounds.min.y-e.position.y)/(e.bounds.max.y-e.bounds.min.y)};o.set=function(e,t,n){var i;for(i in"string"==typeof t&&(i=t,(t={})[i]=n),t)if(Object.prototype.hasOwnProperty.call(t,i))switch(n=t[i],i){case"isStatic":o.setStatic(e,n);break;case"isSleeping":a.set(e,n);break;case"mass":o.setMass(e,n);break;case"density":o.setDensity(e,n);break;case"inertia":o.setInertia(e,n);break;case"vertices":o.setVertices(e,n);break;case"position":o.setPosition(e,n);break;case"angle":o.setAngle(e,n);break;case"velocity":o.setVelocity(e,n);break;case"angularVelocity":o.setAngularVelocity(e,n);break;case"speed":o.setSpeed(e,n);break;case"angularSpeed":o.setAngularSpeed(e,n);break;case"parts":o.setParts(e,n);break;case"centre":o.setCentre(e,n);break;default:e[i]=n}},o.setStatic=function(e,t){for(var n=0;n0&&r.rotateAbout(s.position,o,e.position,s.position)}},o.setVelocity=function(e,t){var n=e.deltaTime/o._baseDelta;e.positionPrev.x=e.position.x-t.x*n,e.positionPrev.y=e.position.y-t.y*n,e.velocity.x=(e.position.x-e.positionPrev.x)/n,e.velocity.y=(e.position.y-e.positionPrev.y)/n,e.speed=r.magnitude(e.velocity)},o.getVelocity=function(e){var t=o._baseDelta/e.deltaTime;return{x:(e.position.x-e.positionPrev.x)*t,y:(e.position.y-e.positionPrev.y)*t}},o.getSpeed=function(e){return r.magnitude(o.getVelocity(e))},o.setSpeed=function(e,t){o.setVelocity(e,r.mult(r.normalise(o.getVelocity(e)),t))},o.setAngularVelocity=function(e,t){var n=e.deltaTime/o._baseDelta;e.anglePrev=e.angle-t*n,e.angularVelocity=(e.angle-e.anglePrev)/n,e.angularSpeed=Math.abs(e.angularVelocity)},o.getAngularVelocity=function(e){return(e.angle-e.anglePrev)*o._baseDelta/e.deltaTime},o.getAngularSpeed=function(e){return Math.abs(o.getAngularVelocity(e))},o.setAngularSpeed=function(e,t){o.setAngularVelocity(e,s.sign(o.getAngularVelocity(e))*t)},o.translate=function(e,t,n){o.setPosition(e,r.add(e.position,t),n)},o.rotate=function(e,t,n,i){if(n){var r=Math.cos(t),a=Math.sin(t),s=e.position.x-n.x,l=e.position.y-n.y;o.setPosition(e,{x:n.x+(s*r-l*a),y:n.y+(s*a+l*r)},i),o.setAngle(e,e.angle+t,i)}else o.setAngle(e,e.angle+t,i)},o.scale=function(e,t,n,r){var a=0,s=0;r=r||e.position;for(var u=0;u0&&(a+=d.area,s+=d.inertia),d.position.x=r.x+(d.position.x-r.x)*t,d.position.y=r.y+(d.position.y-r.y)*n,l.update(d.bounds,d.vertices,e.velocity)}e.parts.length>1&&(e.area=a,e.isStatic||(o.setMass(e,e.density*a),o.setInertia(e,s))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},o.update=function(e,t){var n=(t=(void 0!==t?t:1e3/60)*e.timeScale)*t,a=o._timeCorrection?t/(e.deltaTime||t):1,u=1-e.frictionAir*(t/s._baseDelta),d=(e.position.x-e.positionPrev.x)*a,p=(e.position.y-e.positionPrev.y)*a;e.velocity.x=d*u+e.force.x/e.mass*n,e.velocity.y=p*u+e.force.y/e.mass*n,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.deltaTime=t,e.angularVelocity=(e.angle-e.anglePrev)*u*a+e.torque/e.inertia*n,e.anglePrev=e.angle,e.angle+=e.angularVelocity;for(var f=0;f0&&(v.position.x+=e.velocity.x,v.position.y+=e.velocity.y),0!==e.angularVelocity&&(i.rotate(v.vertices,e.angularVelocity,e.position),c.rotate(v.axes,e.angularVelocity),f>0&&r.rotateAbout(v.position,e.angularVelocity,e.position,v.position)),l.update(v.bounds,v.vertices,e.velocity)}},o.updateVelocities=function(e){var t=o._baseDelta/e.deltaTime,n=e.velocity;n.x=(e.position.x-e.positionPrev.x)*t,n.y=(e.position.y-e.positionPrev.y)*t,e.speed=Math.sqrt(n.x*n.x+n.y*n.y),e.angularVelocity=(e.angle-e.anglePrev)*t,e.angularSpeed=Math.abs(e.angularVelocity)},o.applyForce=function(e,t,n){var o=t.x-e.position.x,i=t.y-e.position.y;e.force.x+=n.x,e.force.y+=n.y,e.torque+=o*n.y-i*n.x},o._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n0){n||(n={}),o=t.split(" ");for(var c=0;c0&&l.motion=l.sleepThreshold/n&&o.set(l,!0)):l.sleepCounter>0&&(l.sleepCounter-=1)}else o.set(l,!1)}},o.afterCollisions=function(e){for(var t=o._motionSleepThreshold,n=0;nt&&o.set(l,!1)}}}},o.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||r.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&r.trigger(e,"sleepEnd"))}},function(e,t,n){var o={};e.exports=o;var i,r,a,s=n(3),l=n(9);i=[],r={overlap:0,axis:null},a={overlap:0,axis:null},o.create=function(e,t){return{pair:null,collided:!1,bodyA:e,bodyB:t,parentA:e.parent,parentB:t.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[null,null],supportCount:0}},o.collides=function(e,t,n){if(o._overlapAxes(r,e.vertices,t.vertices,e.axes),r.overlap<=0)return null;if(o._overlapAxes(a,t.vertices,e.vertices,t.axes),a.overlap<=0)return null;var i,c,u=n&&n.table[l.id(e,t)];u?i=u.collision:((i=o.create(e,t)).collided=!0,i.bodyA=e.id=0&&(g=-g,x=-x),d.x=g,d.y=x,p.x=-x,p.y=g,f.x=g*m,f.y=x*m,i.depth=m;var h=o._findSupports(e,t,d,1),b=0;if(s.contains(e.vertices,h[0])&&(v[b++]=h[0]),s.contains(e.vertices,h[1])&&(v[b++]=h[1]),b<2){var S=o._findSupports(t,e,d,-1);s.contains(t.vertices,S[0])&&(v[b++]=S[0]),b<2&&s.contains(t.vertices,S[1])&&(v[b++]=S[1])}return 0===b&&(v[b++]=h[0]),i.supportCount=b,i},o._overlapAxes=function(e,t,n,o){var i,r,a,s,l,c,u=t.length,d=n.length,p=t[0].x,f=t[0].y,v=n[0].x,m=n[0].y,y=o.length,g=Number.MAX_VALUE,x=0;for(l=0;lP?P=s:sB?B=s:ss.frictionStatic?a.frictionStatic:s.frictionStatic,e.restitution=a.restitution>s.restitution?a.restitution:s.restitution,e.slop=a.slop>s.slop?a.slop:s.slop,e.contactCount=i,t.pair=e;var l=o[0],c=r[0],u=o[1],d=r[1];d.vertex!==l&&c.vertex!==u||(r[1]=c,r[0]=c=d,d=r[1]),c.vertex=l,d.vertex=u},o.setActive=function(e,t,n){t?(e.isActive=!0,e.timeUpdated=n):(e.isActive=!1,e.contactCount=0)},o.id=function(e,t){return e.id0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(a.type="pin",a.anchors=!1):t.stiffness<.9&&(a.type="spring"),t.render=c.extend(a,t.render),t},o.preSolveAll=function(e){for(var t=0;t=1||0===e.length?e.stiffness*t:e.stiffness*t*t,h=e.damping*t,b=r.mult(u,g*x),S=(n?n.inverseMass:0)+(i?i.inverseMass:0),w=S+((n?n.inverseInertia:0)+(i?i.inverseInertia:0));if(h>0){var A=r.create();v=r.div(u,d),y=r.sub(i&&r.sub(i.position,i.positionPrev)||A,n&&r.sub(n.position,n.positionPrev)||A),m=r.dot(v,y)}n&&!n.isStatic&&(f=n.inverseMass/S,n.constraintImpulse.x-=b.x*f,n.constraintImpulse.y-=b.y*f,n.position.x-=b.x*f,n.position.y-=b.y*f,h>0&&(n.positionPrev.x-=h*v.x*m*f,n.positionPrev.y-=h*v.y*m*f),p=r.cross(a,b)/w*o._torqueDampen*n.inverseInertia*(1-e.angularStiffness),n.constraintImpulse.angle-=p,n.angle-=p),i&&!i.isStatic&&(f=i.inverseMass/S,i.constraintImpulse.x+=b.x*f,i.constraintImpulse.y+=b.y*f,i.position.x+=b.x*f,i.position.y+=b.y*f,h>0&&(i.positionPrev.x+=h*v.x*m*f,i.positionPrev.y+=h*v.y*m*f),p=r.cross(s,b)/w*o._torqueDampen*i.inverseInertia*(1-e.angularStiffness),i.constraintImpulse.angle+=p,i.angle+=p)}}},o.postSolveAll=function(e){for(var t=0;t0&&(d.position.x+=c.x,d.position.y+=c.y),0!==c.angle&&(i.rotate(d.vertices,c.angle,n.position),l.rotate(d.axes,c.angle),u>0&&r.rotateAbout(d.position,c.angle,n.position,d.position)),s.update(d.bounds,d.vertices,n.velocity)}c.angle*=o._warming,c.x*=o._warming,c.y*=o._warming}}},o.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),y:(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0)}},o.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0),y:(e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0)}},o.currentLength=function(e){var t=(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),n=(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0),o=t-((e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0)),i=n-((e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0));return Math.sqrt(o*o+i*i)}},function(e,t,n){var o={};e.exports=o;var i=n(2),r=n(0);o.fromVertices=function(e){for(var t={},n=0;n=1&&r.warn("Bodies.trapezoid: slope parameter must be < 1.");var c,u=n*(s*=.5),d=u+(1-2*s)*n,p=d+u;c=s<.5?"L 0 0 L "+u+" "+-o+" L "+d+" "+-o+" L "+p+" 0":"L 0 0 L "+d+" "+-o+" L "+p+" 0";var f={label:"Trapezoid Body",position:{x:e,y:t},vertices:i.fromPath(c)};if(l.chamfer){var v=l.chamfer;f.vertices=i.chamfer(f.vertices,v.radius,v.quality,v.qualityMin,v.qualityMax),delete l.chamfer}return a.create(r.extend({},f,l))},o.circle=function(e,t,n,i,a){i=i||{};var s={label:"Circle Body",circleRadius:n};a=a||25;var l=Math.ceil(Math.max(10,Math.min(a,n)));return l%2==1&&(l+=1),o.polygon(e,t,l,n,r.extend({},s,i))},o.polygon=function(e,t,n,s,l){if(l=l||{},n<3)return o.circle(e,t,s,l);for(var c=2*Math.PI/n,u="",d=.5*c,p=0;p0&&i.area(M)1?(v=a.create(r.extend({parts:m.slice(0)},o)),a.setPosition(v,{x:e,y:t}),v):m[0]}},function(e,t,n){var o={};e.exports=o;var i=n(0),r=n(8);o.create=function(e){return i.extend({bodies:[],collisions:[],pairs:null},e)},o.setBodies=function(e,t){e.bodies=t.slice(0)},o.clear=function(e){e.bodies=[],e.collisions=[]},o.collisions=function(e){var t,n,i=e.pairs,a=e.bodies,s=a.length,l=o.canCollide,c=r.collides,u=e.collisions,d=0;for(a.sort(o._compareBoundsX),t=0;tv)break;if(!(mC.max.y)&&(!g||!b.isStatic&&!b.isSleeping)&&l(p.collisionFilter,b.collisionFilter)){var S=b.parts.length;if(h&&1===S)(M=c(p,b,i))&&(u[d++]=M);else for(var w=S>1?1:0,A=x>1?1:0;AC.max.x||f.max.xC.max.y||(M=c(P,_,i))&&(u[d++]=M)}}}}return u.length!==d&&(u.length=d),u},o.canCollide=function(e,t){return e.group===t.group&&0!==e.group?e.group>0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)},o._compareBoundsX=function(e,t){return e.bounds.min.x-t.bounds.min.x}},function(e,t,n){var o={};e.exports=o;var i=n(0);o.create=function(e){var t={};return e||i.log("Mouse.create: element was undefined, defaulting to document.body","warn"),t.element=e||document.body,t.absolute={x:0,y:0},t.position={x:0,y:0},t.mousedownPosition={x:0,y:0},t.mouseupPosition={x:0,y:0},t.offset={x:0,y:0},t.scale={x:1,y:1},t.wheelDelta=0,t.button=-1,t.pixelRatio=parseInt(t.element.getAttribute("data-pixel-ratio"),10)||1,t.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},t.mousemove=function(e){var n=o._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&(t.button=0,e.preventDefault()),t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.sourceEvents.mousemove=e},t.mousedown=function(e){var n=o._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches?(t.button=0,e.preventDefault()):t.button=e.button,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mousedownPosition.x=t.position.x,t.mousedownPosition.y=t.position.y,t.sourceEvents.mousedown=e},t.mouseup=function(e){var n=o._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&e.preventDefault(),t.button=-1,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mouseupPosition.x=t.position.x,t.mouseupPosition.y=t.position.y,t.sourceEvents.mouseup=e},t.mousewheel=function(e){t.wheelDelta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),e.preventDefault(),t.sourceEvents.mousewheel=e},o.setElement(t,t.element),t},o.setElement=function(e,t){e.element=t,t.addEventListener("mousemove",e.mousemove,{passive:!0}),t.addEventListener("mousedown",e.mousedown,{passive:!0}),t.addEventListener("mouseup",e.mouseup,{passive:!0}),t.addEventListener("wheel",e.mousewheel,{passive:!1}),t.addEventListener("touchmove",e.mousemove,{passive:!1}),t.addEventListener("touchstart",e.mousedown,{passive:!1}),t.addEventListener("touchend",e.mouseup,{passive:!1})},o.clearSourceEvents=function(e){e.sourceEvents.mousemove=null,e.sourceEvents.mousedown=null,e.sourceEvents.mouseup=null,e.sourceEvents.mousewheel=null,e.wheelDelta=0},o.setOffset=function(e,t){e.offset.x=t.x,e.offset.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},o.setScale=function(e,t){e.scale.x=t.x,e.scale.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},o._getRelativeMousePosition=function(e,t,n){var o,i,r=t.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,s=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,l=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,c=e.changedTouches;return c?(o=c[0].pageX-r.left-s,i=c[0].pageY-r.top-l):(o=e.pageX-r.left-s,i=e.pageY-r.top-l),{x:o/(t.clientWidth/(t.width||t.clientWidth)*n),y:i/(t.clientHeight/(t.height||t.clientHeight)*n)}}},function(e,t,n){var o={};e.exports=o;var i=n(0);o._registry={},o.register=function(e){if(o.isPlugin(e)||i.warn("Plugin.register:",o.toString(e),"does not implement all required fields."),e.name in o._registry){var t=o._registry[e.name],n=o.versionParse(e.version).number,r=o.versionParse(t.version).number;n>r?(i.warn("Plugin.register:",o.toString(t),"was upgraded to",o.toString(e)),o._registry[e.name]=e):n-1},o.isFor=function(e,t){var n=e.for&&o.dependencyParse(e.for);return!e.for||t.name===n.name&&o.versionSatisfies(t.version,n.range)},o.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=o.dependencies(e),r=i.topologicalSort(n),a=[],s=0;s0&&i.info(a.join(" "))}else i.warn("Plugin.use:",o.toString(e),"does not specify any dependencies to install.")},o.dependencies=function(e,t){var n=o.dependencyParse(e),r=n.name;if(!(r in(t=t||{}))){e=o.resolve(e)||e,t[r]=i.map(e.uses||[],(function(t){o.isPlugin(t)&&o.register(t);var r=o.dependencyParse(t),a=o.resolve(t);return a&&!o.versionSatisfies(a.version,r.range)?(i.warn("Plugin.dependencies:",o.toString(a),"does not satisfy",o.toString(r),"used by",o.toString(n)+"."),a._warned=!0,e._warned=!0):a||(i.warn("Plugin.dependencies:",o.toString(t),"used by",o.toString(n),"could not be resolved."),e._warned=!0),r.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;t.test(e)||i.warn("Plugin.versionParse:",e,"is not a valid version or range.");var n=t.exec(e),o=Number(n[4]),r=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:e,operator:n[1]||n[2]||"",major:o,minor:r,patch:a,parts:[o,r,a],prerelease:n[7],number:1e8*o+1e4*r+a}},o.versionSatisfies=function(e,t){t=t||"*";var n=o.versionParse(t),i=o.versionParse(e);if(n.isRange){if("*"===n.operator||"*"===e)return!0;if(">"===n.operator)return i.number>n.number;if(">="===n.operator)return i.number>=n.number;if("~"===n.operator)return i.major===n.major&&i.minor===n.minor&&i.patch>=n.patch;if("^"===n.operator)return n.major>0?i.major===n.major&&i.number>=n.number:n.minor>0?i.minor===n.minor&&i.patch>=n.patch:i.patch===n.patch}return e===t||"*"===e}},function(e,t){var n={};e.exports=n,n.create=function(e){return{vertex:e,normalImpulse:0,tangentImpulse:0}}},function(e,t,n){var o={};e.exports=o;var i=n(7),r=n(18),a=n(13),s=n(19),l=n(5),c=n(6),u=n(10),d=n(0),p=n(4);o._deltaMax=1e3/60,o.create=function(e){e=e||{};var t=d.extend({positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0,lastUpdatesPerFrame:0}},e);return t.world=e.world||c.create({label:"World"}),t.pairs=e.pairs||s.create(),t.detector=e.detector||a.create(),t.detector.pairs=t.pairs,t.grid={buckets:[]},t.world.gravity=t.gravity,t.broadphase=t.grid,t.metrics={},t},o.update=function(e,t){var n,p=d.now(),f=e.world,v=e.detector,m=e.pairs,y=e.timing,g=y.timestamp;t>o._deltaMax&&d.warnOnce("Matter.Engine.update: delta argument is recommended to be less than or equal to",o._deltaMax.toFixed(3),"ms."),t=void 0!==t?t:d._baseDelta,t*=y.timeScale,y.timestamp+=t,y.lastDelta=t;var x={timestamp:y.timestamp,delta:t};l.trigger(e,"beforeUpdate",x);var h=c.allBodies(f),b=c.allConstraints(f);for(f.isModified&&(a.setBodies(v,h),c.setModified(f,!1,!1,!0)),e.enableSleeping&&i.update(h,t),o._bodiesApplyGravity(h,e.gravity),t>0&&o._bodiesUpdate(h,t),l.trigger(e,"beforeSolve",x),u.preSolveAll(h),n=0;n0&&l.trigger(e,"collisionStart",{pairs:m.collisionStart,timestamp:y.timestamp,delta:t});var w=d.clamp(20/e.positionIterations,0,1);for(r.preSolvePosition(m.list),n=0;n0&&l.trigger(e,"collisionActive",{pairs:m.collisionActive,timestamp:y.timestamp,delta:t}),m.collisionEnd.length>0&&l.trigger(e,"collisionEnd",{pairs:m.collisionEnd,timestamp:y.timestamp,delta:t}),o._bodiesClearForces(h),l.trigger(e,"afterUpdate",x),e.timing.lastElapsed=d.now()-p,e},o.merge=function(e,t){if(d.extend(e,t),t.world){e.world=t.world,o.clear(e);for(var n=c.allBodies(e.world),r=0;rz?(i=W>0?W:-W,(n=m.friction*(W>0?1:-1)*c)<-i?n=-i:n>i&&(n=i)):(n=W,i=f);var X=L*b-F*h,Q=O*b-H*h,Y=_/(A+g.inverseInertia*X*X+x.inverseInertia*Q*Q),Z=(1+m.restitution)*U*Y;if(n*=Y,U0&&(V.normalImpulse=0),Z=V.normalImpulse-$}if(W<-d||W>d)V.tangentImpulse=0;else{var J=V.tangentImpulse;V.tangentImpulse+=n,V.tangentImpulse<-i&&(V.tangentImpulse=-i),V.tangentImpulse>i&&(V.tangentImpulse=i),n=V.tangentImpulse-J}var K=h*Z+S*n,ee=b*Z+w*n;g.isStatic||g.isSleeping||(g.positionPrev.x+=K*g.inverseMass,g.positionPrev.y+=ee*g.inverseMass,g.anglePrev+=(L*ee-F*K)*g.inverseInertia),x.isStatic||x.isSleeping||(x.positionPrev.x-=K*x.inverseMass,x.positionPrev.y-=ee*x.inverseMass,x.anglePrev-=(O*ee-H*K)*x.inverseInertia)}}}}},function(e,t,n){var o={};e.exports=o;var i=n(9),r=n(0);o.create=function(e){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},o.update=function(e,t,n){var o,r,a,s=i.update,l=i.create,c=i.setActive,u=e.table,d=e.list,p=d.length,f=p,v=e.collisionStart,m=e.collisionEnd,y=e.collisionActive,g=t.length,x=0,h=0,b=0;for(a=0;a=n?d[f++]=r:(c(r,!1,n),r.collision.bodyA.sleepCounter>0&&r.collision.bodyB.sleepCounter>0?d[f++]=r:(m[h++]=r,delete u[r.id]));d.length!==f&&(d.length=f),v.length!==x&&(v.length=x),m.length!==h&&(m.length=h),y.length!==b&&(y.length=b)},o.clear=function(e){return e.table={},e.list.length=0,e.collisionStart.length=0,e.collisionActive.length=0,e.collisionEnd.length=0,e}},function(e,t,n){var o=e.exports=n(21);o.Axes=n(11),o.Bodies=n(12),o.Body=n(4),o.Bounds=n(1),o.Collision=n(8),o.Common=n(0),o.Composite=n(6),o.Composites=n(22),o.Constraint=n(10),o.Contact=n(16),o.Detector=n(13),o.Engine=n(17),o.Events=n(5),o.Grid=n(23),o.Mouse=n(14),o.MouseConstraint=n(24),o.Pair=n(9),o.Pairs=n(19),o.Plugin=n(15),o.Query=n(25),o.Render=n(26),o.Resolver=n(18),o.Runner=n(27),o.SAT=n(28),o.Sleeping=n(7),o.Svg=n(29),o.Vector=n(2),o.Vertices=n(3),o.World=n(30),o.Engine.run=o.Runner.run,o.Common.deprecated(o.Engine,"run","Engine.run ➤ use Matter.Runner.run(engine) instead")},function(e,t,n){var o={};e.exports=o;var i=n(15),r=n(0);o.name="matter-js",o.version="0.20.0",o.uses=[],o.used=[],o.use=function(){i.use(o,Array.prototype.slice.call(arguments))},o.before=function(e,t){return e=e.replace(/^Matter./,""),r.chainPathBefore(o,e,t)},o.after=function(e,t){return e=e.replace(/^Matter./,""),r.chainPathAfter(o,e,t)}},function(e,t,n){var o={};e.exports=o;var i=n(6),r=n(10),a=n(0),s=n(4),l=n(12),c=a.deprecated;o.stack=function(e,t,n,o,r,a,l){for(var c,u=i.create({label:"Stack"}),d=e,p=t,f=0,v=0;vm&&(m=x),s.translate(g,{x:.5*h,y:.5*x}),d=g.bounds.max.x+r,i.addBody(u,g),c=g,f+=1}else d+=r}p+=m+a,d=e}return u},o.chain=function(e,t,n,o,s,l){for(var c=e.bodies,u=1;u0)for(c=0;c0&&(p=f[c-1+(l-1)*t],i.addConstraint(e,r.create(a.extend({bodyA:p,bodyB:d},s)))),o&&cp||a<(c=p-c)||a>n-1-c))return 1===d&&s.translate(u,{x:(a+(n%2==1?1:-1))*f,y:0}),l(e+(u?a*f:0)+a*r,o,a,c,u,d)}))},o.newtonsCradle=function(e,t,n,o,a){for(var s=i.create({label:"Newtons Cradle"}),c=0;cu.bounds.max.x||f.bounds.max.yu.bounds.max.y))){var v=o._getRegion(e,f);if(!f.region||v.id!==f.region.id||i){f.region&&!i||(f.region=v);var m=o._regionUnion(v,f.region);for(a=m.startCol;a<=m.endCol;a++)for(s=m.startRow;s<=m.endRow;s++){l=d[c=o._getBucketId(a,s)];var y=a>=v.startCol&&a<=v.endCol&&s>=v.startRow&&s<=v.endRow,g=a>=f.region.startCol&&a<=f.region.endCol&&s>=f.region.startRow&&s<=f.region.endRow;!y&&g&&g&&l&&o._bucketRemoveBody(e,l,f),(f.region===v||y&&!g||i)&&(l||(l=o._createBucket(d,c)),o._bucketAddBody(e,l,f))}f.region=v,p=!0}}}p&&(e.pairsList=o._createActivePairsList(e))},a(o,"update","Grid.update ➤ replaced by Matter.Detector"),o.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},a(o,"clear","Grid.clear ➤ replaced by Matter.Detector"),o._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),i=Math.max(e.endCol,t.endCol),r=Math.min(e.startRow,t.startRow),a=Math.max(e.endRow,t.endRow);return o._createRegion(n,i,r,a)},o._getRegion=function(e,t){var n=t.bounds,i=Math.floor(n.min.x/e.bucketWidth),r=Math.floor(n.max.x/e.bucketWidth),a=Math.floor(n.min.y/e.bucketHeight),s=Math.floor(n.max.y/e.bucketHeight);return o._createRegion(i,r,a,s)},o._createRegion=function(e,t,n,o){return{id:e+","+t+","+n+","+o,startCol:e,endCol:t,startRow:n,endRow:o}},o._getBucketId=function(e,t){return"C"+e+"R"+t},o._createBucket=function(e,t){return e[t]=[]},o._bucketAddBody=function(e,t,n){var o,r=e.pairs,a=i.id,s=t.length;for(o=0;o0?s.push(t):delete o[i[n]];return s}},function(e,t,n){var o={};e.exports=o;var i=n(3),r=n(7),a=n(14),s=n(5),l=n(13),c=n(10),u=n(6),d=n(0),p=n(1);o.create=function(e,t){var n=(e?e.mouse:null)||(t?t.mouse:null);n||(e&&e.render&&e.render.canvas?n=a.create(e.render.canvas):t&&t.element?n=a.create(t.element):(n=a.create(),d.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var i={type:"mouseConstraint",mouse:n,element:null,body:null,constraint:c.create({label:"Mouse Constraint",pointA:n.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),collisionFilter:{category:1,mask:4294967295,group:0}},r=d.extend(i,t);return s.on(e,"beforeUpdate",(function(){var t=u.allBodies(e.world);o.update(r,t),o._triggerEvents(r)})),r},o.update=function(e,t){var n=e.mouse,o=e.constraint,a=e.body;if(0===n.button){if(o.bodyB)r.set(o.bodyB,!1),o.pointA=n.position;else for(var c=0;c1?1:0;ui.max.x&&(i.max.x=c.x),l.yi.max.y&&(i.max.y=c.y))}var d=i.max.x-i.min.x+2*n.x,p=i.max.y-i.min.y+2*n.y,f=e.canvas.height,v=e.canvas.width/f,m=d/p,y=1,g=1;m>v?g=m/v:y=v/m,e.options.hasBounds=!0,e.bounds.min.x=i.min.x,e.bounds.max.x=i.min.x+d*y,e.bounds.min.y=i.min.y,e.bounds.max.y=i.min.y+p*g,o&&(e.bounds.min.x+=.5*d-d*y*.5,e.bounds.max.x+=.5*d-d*y*.5,e.bounds.min.y+=.5*p-p*g*.5,e.bounds.max.y+=.5*p-p*g*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(u.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),u.setOffset(e.mouse,e.bounds.min))},o.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,o=t/e.options.width,i=n/e.options.height;e.context.setTransform(e.options.pixelRatio/o,0,0,e.options.pixelRatio/i,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},o.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},o.world=function(e,t){var n,i=r.now(),d=e.engine,p=d.world,f=e.canvas,v=e.context,y=e.options,g=e.timing,x=a.allBodies(p),h=a.allConstraints(p),b=y.wireframes?y.wireframeBackground:y.background,S=[],w=[],A={timestamp:d.timing.timestamp};if(l.trigger(e,"beforeRender",A),e.currentBackground!==b&&m(e,b),v.globalCompositeOperation="source-in",v.fillStyle="transparent",v.fillRect(0,0,f.width,f.height),v.globalCompositeOperation="source-over",y.hasBounds){for(n=0;n1?1:0;a1?1:0;s1?1:0;r1?1:0;s1?1:0;r1?1:0;r1?1:0;i0)){var u=o.contacts[0].vertex.x,d=o.contacts[0].vertex.y;2===o.contactCount&&(u=(o.contacts[0].vertex.x+o.contacts[1].vertex.x)/2,d=(o.contacts[0].vertex.y+o.contacts[1].vertex.y)/2),i.bodyB===i.supports[0].body||!0===i.bodyA.isStatic?s.moveTo(u-8*i.normal.x,d-8*i.normal.y):s.moveTo(u+8*i.normal.x,d+8*i.normal.y),s.lineTo(u,d)}l.wireframes?s.strokeStyle="rgba(255,165,0,0.7)":s.strokeStyle="orange",s.lineWidth=1,s.stroke()},o.separations=function(e,t,n){var o,i,r,a,s,l=n,c=e.options;for(l.beginPath(),s=0;sMath.max(o._maxFrameDelta,t.maxFrameTime))&&(d=t.frameDelta||o._frameDeltaFallback),t.frameDeltaSmoothing){t.frameDeltaHistory.push(d),t.frameDeltaHistory=t.frameDeltaHistory.slice(-t.frameDeltaHistorySize);var p=t.frameDeltaHistory.slice(0).sort(),f=t.frameDeltaHistory.slice(p.length*o._smoothingLowerBound,p.length*o._smoothingUpperBound);d=e(f)||d}t.frameDeltaSnapping&&(d=1e3/Math.round(1e3/d)),t.frameDelta=d,t.timeLastTick=s,t.timeBuffer+=t.frameDelta,t.timeBuffer=a.clamp(t.timeBuffer,0,t.frameDelta+c*o._timeBufferMargin),t.lastUpdatesDeferred=0;var v=t.maxUpdates||Math.ceil(t.maxFrameTime/c),m={timestamp:n.timing.timestamp};i.trigger(t,"beforeTick",m),i.trigger(t,"tick",m);for(var y=a.now();c>0&&t.timeBuffer>=c*o._timeBufferMargin;){i.trigger(t,"beforeUpdate",m),r.update(n,c),i.trigger(t,"afterUpdate",m),t.timeBuffer-=c,u+=1;var g=a.now()-l,x=a.now()-y,h=g+o._elapsedNextEstimate*x/u;if(u>=v||h>t.maxFrameTime){t.lastUpdatesDeferred=Math.round(Math.max(0,t.timeBuffer/c-o._timeBufferMargin));break}}n.timing.lastUpdatesPerFrame=u,i.trigger(t,"afterTick",m),t.frameDeltaHistory.length>=100&&(t.lastUpdatesDeferred&&Math.round(t.frameDelta/c)>v?a.warnOnce("Matter.Runner: runner reached runner.maxUpdates, see docs."):t.lastUpdatesDeferred&&a.warnOnce("Matter.Runner: runner reached runner.maxFrameTime, see docs."),void 0!==t.isFixed&&a.warnOnce("Matter.Runner: runner.isFixed is now redundant, see docs."),(t.deltaMin||t.deltaMax)&&a.warnOnce("Matter.Runner: runner.deltaMin and runner.deltaMax were removed, see docs."),0!==t.fps&&a.warnOnce("Matter.Runner: runner.fps was replaced by runner.delta, see docs."))},o.stop=function(e){o._cancelNextFrame(e)},o._onNextFrame=function(e,t){if("undefined"==typeof window||!window.requestAnimationFrame)throw new Error("Matter.Runner: missing required global window.requestAnimationFrame.");return e.frameRequestId=window.requestAnimationFrame(t),e.frameRequestId},o._cancelNextFrame=function(e){if("undefined"==typeof window||!window.cancelAnimationFrame)throw new Error("Matter.Runner: missing required global window.cancelAnimationFrame.");window.cancelAnimationFrame(e.frameRequestId)};var e=function(e){for(var t=0,n=e.length,o=0;o1;if(!p||e!=p.x||t!=p.y){p&&o?(f=p.x,v=p.y):(f=0,v=0);var i={x:f+e,y:v+t};!o&&p||(p=i),m.push(i),g=f+e,x=v+t}},b=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":g=e.x,x=e.y;break;case"H":g=e.x;break;case"V":x=e.y}h(g,x,e.pathSegType)}};for(o._svgPathToAbsolute(e),a=e.getTotalLength(),c=[],n=0;n - - - - - - + + + + + + \ No newline at end of file diff --git a/demo/js/matter-demo.01bd65.min.js b/demo/js/matter-demo.01bd65.min.js new file mode 100644 index 00000000..934b2997 --- /dev/null +++ b/demo/js/matter-demo.01bd65.min.js @@ -0,0 +1,6 @@ +/*! + * matter-demo bundle 0.20.0 by @liabru + * http://brm.io/matter-js/ + * License MIT + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MatterDemo",[],t):"object"==typeof exports?exports.MatterDemo=t():e.MatterDemo=t()}(this,(function(){return(this.webpackJsonpMatterDemo=this.webpackJsonpMatterDemo||[]).push([[0],{"+QOk":function(e,t,n){var r=r||{};r.timescale=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.Composite,a=Matter.Composites,s=Matter.Common,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0}});t.run(m);var f=n.create();n.run(f,u),i.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var g=1,v=s.now();o.on(u,"afterUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;u.timing.timeScale+=12*(g-u.timing.timeScale)*t,s.now()-v>=2e3&&(g=g<1?1:0,function(e,t){for(var n=1e3/60/t,o=i.allBodies(e.world),a=0;a=500){var l=.05*c.mass*n;r.applyForce(c,c.position,{x:(l+s.random()*l)*s.choose([1,-1]),y:-l+s.random()*-l})}}}(u,e.delta),v=s.now())}));var y={frictionAir:0,friction:1e-4,restitution:.8};i.add(p,a.stack(20,100,15,3,20,40,(function(e,t){return d.circle(e,t,s.random(10,20),y)}))),i.add(p,a.stack(50,50,8,3,0,0,(function(e,t){switch(Math.round(s.random(0,1))){case 0:return s.random()<.8?d.rectangle(e,t,s.random(20,50),s.random(20,50),y):d.rectangle(e,t,s.random(80,120),s.random(20,30),y);case 1:return d.polygon(e,t,Math.round(s.random(4,8)),s.random(20,50),y)}})));var x=l.create(m.canvas),h=c.create(u,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(p,h),m.mouse=x,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.timescale.title="Time Scaling",r.timescale.for=">=0.14.2",e.exports=r.timescale},"+jwT":function(e,t,n){var r=r||{};r.constraints=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=(Matter.Composites,Matter.Common,Matter.Constraint),o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=s.polygon(150,200,5,30),m=r.create({pointA:{x:150,y:100},bodyB:p,pointB:{x:-10,y:-10}});a.add(l,[p,m]);p=s.polygon(280,100,3,30),m=r.create({pointA:{x:280,y:120},bodyB:p,pointB:{x:-10,y:-7},stiffness:.001});a.add(l,[p,m]);p=s.polygon(400,100,4,30),m=r.create({pointA:{x:400,y:120},bodyB:p,pointB:{x:-10,y:-10},stiffness:.001,damping:.05});a.add(l,[p,m]);p=s.rectangle(600,200,200,20);var f=s.circle(550,150,20);m=r.create({pointA:{x:600,y:200},bodyB:p,length:0});a.add(l,[p,f,m]);p=s.rectangle(500,400,100,20,{collisionFilter:{group:-1}}),f=s.circle(600,400,20,{collisionFilter:{group:-1}}),m=r.create({bodyA:p,bodyB:f});a.add(l,[p,f,m]);var g=s.polygon(100,400,6,20),v=s.polygon(200,400,1,50);m=r.create({bodyA:g,pointA:{x:-10,y:-10},bodyB:v,pointB:{x:-10,y:-10}});a.add(l,[g,v,m]);g=s.polygon(300,400,4,20),v=s.polygon(400,400,3,30),m=r.create({bodyA:g,pointA:{x:-10,y:-10},bodyB:v,pointB:{x:-10,y:-7},stiffness:.001});a.add(l,[g,v,m]);g=s.polygon(500,400,6,30),v=s.polygon(600,400,7,60),m=r.create({bodyA:g,pointA:{x:-10,y:-10},bodyB:v,pointB:{x:-10,y:-10},stiffness:.001,damping:.1});a.add(l,[g,v,m]),a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var y=i.create(d.canvas),x=o.create(c,{mouse:y,constraint:{angularStiffness:0,render:{visible:!1}}});return a.add(l,x),d.mouse=y,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.constraints.title="Constraints",r.constraints.for=">=0.14.2",e.exports=r.constraints},"/iAh":function(e,t,n){var r=r||{};r.svg=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Vertices,l=Matter.Svg,d=Matter.Bodies;o.setDecomp(n("Dded"));var u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600}});t.run(m);var f=r.create();if(r.run(f,u),"undefined"!=typeof fetch){var g=function(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))},v=function(e){return fetch(e).then((function(e){return e.text()})).then((function(e){return(new window.DOMParser).parseFromString(e,"image/svg+xml")}))};["./svg/iconmonstr-check-mark-8-icon.svg","./svg/iconmonstr-paperclip-2-icon.svg","./svg/iconmonstr-puzzle-icon.svg","./svg/iconmonstr-user-icon.svg"].forEach((function(e,t){v(e).then((function(e){var n=o.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),r=g(e,"path").map((function(e){return c.scale(l.pathToVertices(e,30),.4,.4)}));s.add(p,d.fromVertices(100+150*t,200+50*t,r,{render:{fillStyle:n,strokeStyle:n,lineWidth:1}},!0))}))})),v("./svg/svg.svg").then((function(e){var t=o.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),n=g(e,"path").map((function(e){return l.pathToVertices(e,30)}));s.add(p,d.fromVertices(400,80,n,{render:{fillStyle:t,strokeStyle:t,lineWidth:1}},!0))}))}else o.warn("Fetch is not available. Could not load SVG.");s.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var y=a.create(m.canvas),x=i.create(u,{mouse:y,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(p,x),m.mouse=y,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.svg.title="Concave SVG Paths",r.svg.for=">0.16.1",e.exports=r.svg},"/kat":function(e,t,n){var r=r||{};r.renderResize=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composite,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=(r=Matter.Composite,Matter.Bodies),l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0,pixelRatio:2}});t.run(u);var p=n.create();n.run(p,l);var m=o.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(i.random(1,8)),r=null;switch(n>2&&i.random()>.7&&(r={radius:10}),Math.round(i.random(0,1))){case 0:return i.random()<.8?c.rectangle(e,t,i.random(25,50),i.random(25,50),{chamfer:r}):c.rectangle(e,t,i.random(80,120),i.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,i.random(25,50),{chamfer:r})}}));r.add(d,m),r.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=s.create(u.canvas),g=a.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});r.add(d,g),u.mouse=f,u.canvas.style.position="fixed";var v=function(){var e=window.innerWidth,n=window.innerHeight;t.setSize(u,e,n),t.lookAt(u,r.allBodies(l.world),{x:50,y:50})};return window.addEventListener("resize",v),v(),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.renderResize.title="Render Resize",r.renderResize.for=">=0.20.0",e.exports=r.renderResize},"02te":function(e,t,n){var r=r||{};r.ballPool=function(){try{"undefined"!=typeof MatterWrap?Matter.use("matter-wrap"):Matter.use(n("OPlj"))}catch(e){}var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composite,i=Matter.Composites,a=Matter.Common,s=Matter.MouseConstraint,c=Matter.Mouse,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0}});t.run(p);var m=r.create();r.run(m,d),o.add(u,[l.rectangle(400,600,1200,50.5,{isStatic:!0,render:{fillStyle:"#060a19"}})]);var f=i.stack(100,0,10,8,10,10,(function(e,t){return l.circle(e,t,a.random(15,30),{restitution:.6,friction:.1})}));o.add(u,[f,l.polygon(200,460,3,60),l.polygon(400,460,5,60),l.rectangle(600,460,80,80)]);var g=c.create(p.canvas),v=s.create(d,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});o.add(u,v),p.mouse=g,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}});for(var y=o.allBodies(u),x=0;x1;if(!p||e!=p.x||t!=p.y){p&&r?(m=p.x,f=p.y):(m=0,f=0);var o={x:m+e,y:f+t};!r&&p||(p=o),g.push(o),y=m+e,x=f+t}},M=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":y=e.x,x=e.y;break;case"H":y=e.x;break;case"V":x=e.y}h(y,x,e.pathSegType)}};for(r._svgPathToAbsolute(e),a=e.getTotalLength(),l=[],n=0;n0)return!1;a=n}return!0},r.scale=function(e,t,n,i){if(1===t&&1===n)return e;var a,s;i=i||r.centre(e);for(var c=0;c=0?c-1:e.length-1],d=e[c],u=e[(c+1)%e.length],p=t[c0&&(i|=2),3===i)return!1;return 0!==i||null},r.hull=function(e){var t,n,r=[],i=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&o.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];r.length>=2&&o.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}return r.pop(),i.pop(),r.concat(i)}},"0mtl":function(e,t,n){var r=r||{};r.catapult=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Constraint,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=Matter.Body,d=Matter.Vector,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0,showVelocity:!0}});t.run(m);var f=n.create();n.run(f,u);var g=l.nextGroup(!0),v=r.stack(250,255,1,6,0,0,(function(e,t){return c.rectangle(e,t,30,30)})),y=c.rectangle(400,520,320,20,{collisionFilter:{group:g}});s.add(p,[v,y,c.rectangle(400,600,800,50.5,{isStatic:!0,render:{fillStyle:"#060a19"}}),c.rectangle(250,555,20,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),c.rectangle(400,535,20,80,{isStatic:!0,collisionFilter:{group:g},render:{fillStyle:"#060a19"}}),c.circle(560,100,50,{density:.005}),o.create({bodyA:y,pointB:d.clone(y.position),stiffness:1,length:0})]);var x=a.create(m.canvas),h=i.create(u,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(p,h),m.mouse=x,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.catapult.title="Catapult",r.catapult.for=">=0.14.2",e.exports=r.catapult},"136C":function(e,t,n){var r=r||{};r.slingshot=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Events,i=Matter.Constraint,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Body,l=Matter.Composite,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0}});t.run(m);var f=n.create();n.run(f,u);var g=d.rectangle(395,600,815,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),v={density:.004},y=d.polygon(170,450,8,20,v),x=i.create({pointA:{x:170,y:450},bodyB:y,length:.01,damping:.01,stiffness:.05}),h=r.pyramid(500,300,9,10,0,0,(function(e,t){return d.rectangle(e,t,25,40)})),M=d.rectangle(610,250,200,20,{isStatic:!0,render:{fillStyle:"#060a19"}}),b=r.pyramid(550,0,5,10,0,0,(function(e,t){return d.rectangle(e,t,25,40)}));l.add(u.world,[g,h,M,b,y,x]),o.on(u,"afterUpdate",(function(){-1===w.mouse.button&&(y.position.x>190||y.position.y<430)&&(c.getSpeed(y)>45&&c.setSpeed(y,45),y=d.polygon(170,450,7,20,v),l.add(u.world,y),x.bodyB=y)}));var S=s.create(m.canvas),w=a.create(u,{mouse:S,constraint:{stiffness:.2,render:{visible:!1}}});return l.add(p,w),m.mouse=S,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.slingshot.title="Slingshot",r.slingshot.for=">=0.14.2",e.exports=r.slingshot},"2Og8":function(e,t,n){var r={};e.exports=r;var o=n("571F");r._registry={},r.register=function(e){if(r.isPlugin(e)||o.warn("Plugin.register:",r.toString(e),"does not implement all required fields."),e.name in r._registry){var t=r._registry[e.name],n=r.versionParse(e.version).number,i=r.versionParse(t.version).number;n>i?(o.warn("Plugin.register:",r.toString(t),"was upgraded to",r.toString(e)),r._registry[e.name]=e):n-1},r.isFor=function(e,t){var n=e.for&&r.dependencyParse(e.for);return!e.for||t.name===n.name&&r.versionSatisfies(t.version,n.range)},r.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=r.dependencies(e),i=o.topologicalSort(n),a=[],s=0;s0&&o.info(a.join(" "))}else o.warn("Plugin.use:",r.toString(e),"does not specify any dependencies to install.")},r.dependencies=function(e,t){var n=r.dependencyParse(e),i=n.name;if(!(i in(t=t||{}))){e=r.resolve(e)||e,t[i]=o.map(e.uses||[],(function(t){r.isPlugin(t)&&r.register(t);var i=r.dependencyParse(t),a=r.resolve(t);return a&&!r.versionSatisfies(a.version,i.range)?(o.warn("Plugin.dependencies:",r.toString(a),"does not satisfy",r.toString(i),"used by",r.toString(n)+"."),a._warned=!0,e._warned=!0):a||(o.warn("Plugin.dependencies:",r.toString(t),"used by",r.toString(n),"could not be resolved."),e._warned=!0),i.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;t.test(e)||o.warn("Plugin.versionParse:",e,"is not a valid version or range.");var n=t.exec(e),r=Number(n[4]),i=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:e,operator:n[1]||n[2]||"",major:r,minor:i,patch:a,parts:[r,i,a],prerelease:n[7],number:1e8*r+1e4*i+a}},r.versionSatisfies=function(e,t){t=t||"*";var n=r.versionParse(t),o=r.versionParse(e);if(n.isRange){if("*"===n.operator||"*"===e)return!0;if(">"===n.operator)return o.number>n.number;if(">="===n.operator)return o.number>=n.number;if("~"===n.operator)return o.major===n.major&&o.minor===n.minor&&o.patch>=n.patch;if("^"===n.operator)return n.major>0?o.major===n.major&&o.number>=n.number:n.minor>0?o.minor===n.minor&&o.patch>=n.patch:o.patch===n.patch}return e===t||"*"===e}},"2oV2":function(e,t,n){var r=r||{};r.raycasting=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composite,i=Matter.Composites,a=Matter.Common,s=Matter.Query,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Events,u=Matter.Vertices,p=Matter.Bodies,m=e.create(),f=m.world,g=t.create({element:document.body,engine:m,options:{width:800,height:600,showAngleIndicator:!0}});t.run(g);var v=r.create();r.run(v,m);var y=i.stack(20,20,12,4,0,0,(function(e,t){switch(Math.round(a.random(0,1))){case 0:return a.random()<.8?p.rectangle(e,t,a.random(20,50),a.random(20,50)):p.rectangle(e,t,a.random(80,120),a.random(20,30));case 1:var n=Math.round(a.random(1,8));return n=3===n?4:n,p.polygon(e,t,n,a.random(20,50))}}));a.setDecomp(n("Dded"));var x=u.fromPath("50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38"),h=p.fromVertices(200,200,x);o.add(f,[y,h,p.rectangle(400,0,800,50,{isStatic:!0}),p.rectangle(400,600,800,50,{isStatic:!0}),p.rectangle(800,300,50,600,{isStatic:!0}),p.rectangle(0,300,50,600,{isStatic:!0})]);var M=[],b={x:400,y:100};d.on(m,"afterUpdate",(function(){var e=w.mouse,t=o.allBodies(m.world),n=e.position||{x:100,y:600};M=s.ray(t,b,n)})),d.on(g,"afterRender",(function(){var e=w.mouse,n=g.context,r=e.position||{x:100,y:600};t.startViewTransform(g),n.beginPath(),n.moveTo(b.x,b.y),n.lineTo(r.x,r.y),M.length>0?n.strokeStyle="#fff":n.strokeStyle="#555",n.lineWidth=.5,n.stroke();for(var o=0;o0.16.1",e.exports=r.raycasting},"3Slt":function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("571F"),a=n("Tgw/");r._restingThresh=2,r._restingThreshTangent=Math.sqrt(6),r._positionDampen=.9,r._positionWarming=.8,r._frictionNormalMultiplier=5,r._frictionMaxStatic=Number.MAX_VALUE,r.preSolvePosition=function(e){var t,n,r,o=e.length;for(t=0;tz?(o=j>0?j:-j,(n=g.friction*(j>0?1:-1)*l)<-o?n=-o:n>o&&(n=o)):(n=j,o=m);var Z=V*M-L*h,Q=O*M-U*h,X=k/(w+y.inverseInertia*Z*Z+x.inverseInertia*Q*Q),Y=(1+g.restitution)*q*X;if(n*=X,q0&&(F.normalImpulse=0),Y=F.normalImpulse-J}if(j<-u||j>u)F.tangentImpulse=0;else{var K=F.tangentImpulse;F.tangentImpulse+=n,F.tangentImpulse<-o&&(F.tangentImpulse=-o),F.tangentImpulse>o&&(F.tangentImpulse=o),n=F.tangentImpulse-K}var $=h*Y+b*n,ee=M*Y+S*n;y.isStatic||y.isSleeping||(y.positionPrev.x+=$*y.inverseMass,y.positionPrev.y+=ee*y.inverseMass,y.anglePrev+=(V*ee-L*$)*y.inverseInertia),x.isStatic||x.isSleeping||(x.positionPrev.x-=$*x.inverseMass,x.positionPrev.y-=ee*x.inverseMass,x.anglePrev-=(O*ee-U*$)*x.inverseInertia)}}}}},"4XQC":function(e,t,n){var r=r||{};r.staticFriction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Composites,i=Matter.Events,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showVelocity:!0}});t.run(p);var m=n.create();n.run(m,d);var f=l.rectangle(400,500,200,60,{isStatic:!0,chamfer:10,render:{fillStyle:"#060a19"}}),g=o.stack(350,170,1,6,0,0,(function(e,t){return l.rectangle(e,t,100,50,{slop:.5,friction:1,frictionStatic:1/0})}));c.add(u,[f,g,l.rectangle(400,0,800,50,{isStatic:!0}),l.rectangle(400,600,800,50,{isStatic:!0}),l.rectangle(800,300,50,600,{isStatic:!0}),l.rectangle(0,300,50,600,{isStatic:!0})]),i.on(d,"beforeUpdate",(function(){if(!(d.timing.timestamp<1500)){var e=400+100*Math.sin(.001*(d.timing.timestamp-1500));"0.18.0"===Matter.version&&r.setVelocity(f,{x:e-f.position.x,y:0}),r.setPosition(f,{x:e,y:f.position.y},!0)}}));var v=s.create(p.canvas),y=a.create(d,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(u,y),p.mouse=v,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.staticFriction.title="Static Friction",r.staticFriction.for=">=0.14.2",e.exports=r.staticFriction},"4d8i":function(e,t,n){var r={};e.exports=r;var o=n("yTB+"),i=n("nIFq"),a=n("571F");!function(){r._maxFrameDelta=1e3/15,r._frameDeltaFallback=1e3/60,r._timeBufferMargin=1.5,r._elapsedNextEstimate=1,r._smoothingLowerBound=.1,r._smoothingUpperBound=.9,r.create=function(e){var t=a.extend({delta:1e3/60,frameDelta:null,frameDeltaSmoothing:!0,frameDeltaSnapping:!0,frameDeltaHistory:[],frameDeltaHistorySize:100,frameRequestId:null,timeBuffer:0,timeLastTick:null,maxUpdates:null,maxFrameTime:1e3/30,lastUpdatesDeferred:0,enabled:!0},e);return t.fps=0,t},r.run=function(e,t){return e.timeBuffer=r._frameDeltaFallback,function n(o){e.frameRequestId=r._onNextFrame(e,n),o&&e.enabled&&r.tick(e,t,o)}(),e},r.tick=function(t,n,s){var c=a.now(),l=t.delta,d=0,u=s-t.timeLastTick;if((!u||!t.timeLastTick||u>Math.max(r._maxFrameDelta,t.maxFrameTime))&&(u=t.frameDelta||r._frameDeltaFallback),t.frameDeltaSmoothing){t.frameDeltaHistory.push(u),t.frameDeltaHistory=t.frameDeltaHistory.slice(-t.frameDeltaHistorySize);var p=t.frameDeltaHistory.slice(0).sort(),m=t.frameDeltaHistory.slice(p.length*r._smoothingLowerBound,p.length*r._smoothingUpperBound);u=e(m)||u}t.frameDeltaSnapping&&(u=1e3/Math.round(1e3/u)),t.frameDelta=u,t.timeLastTick=s,t.timeBuffer+=t.frameDelta,t.timeBuffer=a.clamp(t.timeBuffer,0,t.frameDelta+l*r._timeBufferMargin),t.lastUpdatesDeferred=0;var f=t.maxUpdates||Math.ceil(t.maxFrameTime/l),g={timestamp:n.timing.timestamp};o.trigger(t,"beforeTick",g),o.trigger(t,"tick",g);for(var v=a.now();l>0&&t.timeBuffer>=l*r._timeBufferMargin;){o.trigger(t,"beforeUpdate",g),i.update(n,l),o.trigger(t,"afterUpdate",g),t.timeBuffer-=l,d+=1;var y=a.now()-c,x=a.now()-v,h=y+r._elapsedNextEstimate*x/d;if(d>=f||h>t.maxFrameTime){t.lastUpdatesDeferred=Math.round(Math.max(0,t.timeBuffer/l-r._timeBufferMargin));break}}n.timing.lastUpdatesPerFrame=d,o.trigger(t,"afterTick",g),t.frameDeltaHistory.length>=100&&(t.lastUpdatesDeferred&&Math.round(t.frameDelta/l)>f?a.warnOnce("Matter.Runner: runner reached runner.maxUpdates, see docs."):t.lastUpdatesDeferred&&a.warnOnce("Matter.Runner: runner reached runner.maxFrameTime, see docs."),void 0!==t.isFixed&&a.warnOnce("Matter.Runner: runner.isFixed is now redundant, see docs."),(t.deltaMin||t.deltaMax)&&a.warnOnce("Matter.Runner: runner.deltaMin and runner.deltaMax were removed, see docs."),0!==t.fps&&a.warnOnce("Matter.Runner: runner.fps was replaced by runner.delta, see docs."))},r.stop=function(e){r._cancelNextFrame(e)},r._onNextFrame=function(e,t){if("undefined"==typeof window||!window.requestAnimationFrame)throw new Error("Matter.Runner: missing required global window.requestAnimationFrame.");return e.frameRequestId=window.requestAnimationFrame(t),e.frameRequestId},r._cancelNextFrame=function(e){if("undefined"==typeof window||!window.cancelAnimationFrame)throw new Error("Matter.Runner: missing required global window.cancelAnimationFrame.");window.cancelAnimationFrame(e.frameRequestId)};var e=function(e){for(var t=0,n=e.length,r=0;r0.16.1",e.exports=r.terrain},"571F":function(e,t){var n={};e.exports=n,function(){n._baseDelta=1e3/60,n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n._warnedOnce={},n._decomp=null,n.extend=function(e,t){var r,o;"boolean"==typeof t?(r=2,o=t):(r=1,o=!0);for(var i=r;i0;t--){var r=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[r],e[r]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warnOnce=function(){var e=Array.prototype.slice.call(arguments).join(" ");n._warnedOnce[e]||(n.warn(e),n._warnedOnce[e]=!0)},n.deprecated=function(e,t,r){e[t]=n.chain((function(){n.warnOnce("🔅 deprecated 🔅",r)}),e[t])},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n=0.14.2",e.exports=r.pyramid},"6IAi":function(e,t,n){var r=r||{};r.airFriction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showVelocity:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(200,100,60,60,{frictionAir:.001}),a.rectangle(400,100,60,60,{frictionAir:.05}),a.rectangle(600,100,60,60,{frictionAir:.1}),a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.airFriction.title="Air Friction",r.airFriction.for=">=0.14.2",e.exports=r.airFriction},"71Xj":function(e,t,n){var r=n("akk5");e.exports={demo:function(e,t){var n=r.Demo.create({toolbar:{title:"matter-js"+(t?" ・ dev":""),url:"https://github.com/liabru/matter-js",reset:!0,source:!0,inspector:!0,tools:!0,fullscreen:!0,exampleSelect:!0},tools:{inspector:!0,gui:!0},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!0,startExample:"mixed",examples:e});if(window.MatterDemoInstance=n,document.body.appendChild(n.dom.root),document.title="Matter.js Demo"+(t?" ・ Dev":""),t){Matter.Common.chainPathAfter(r,"Gui.create",(function(){this.datGui.__folders.Engine.add(n,"delta",0,1e3/55).onChange((function(){n.example.instance.runner.delta=n.delta})).step(.001).listen()})),Matter.after("Runner.create",(function(){n.delta=this.delta}));var o=n.dom.buttonSource,i=o.cloneNode(!0);i.textContent="⎄",i.title="Compare",i.href="?compare",i.target="",i.className="matter-btn matter-btn-compare",i.addEventListener("click",(function(e){window.location="?compare#"+n.example.id,e.preventDefault()})),o.parentNode.insertBefore(i,o.nextSibling),Matter.before("Render.create",(function(e){e.options.showDebug=!0,e.options.pixelRatio="auto",e.options.wireframeStrokeStyle="#aaa"})),document.addEventListener("keyup",(function(e){var t="ArrowLeft"===e.key||"ArrowUp"===e.key,o="ArrowRight"===e.key||"ArrowDown"===e.key;if(t||o){var i=t?-1:1,a=n.examples.findIndex((function(e){return e.id===n.example.id})),s=n.examples[(n.examples.length+a+i)%n.examples.length];r.Demo.setExample(n,s)}}))}r.Demo.start(n)}}},"74MQ":function(e,t,n){var r=r||{};r.doublePendulum=function(){var e=Matter.Engine,t=Matter.Events,n=Matter.Render,r=Matter.Runner,o=Matter.Body,i=Matter.Composite,a=Matter.Composites,s=Matter.Constraint,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=Matter.Vector,p=e.create(),m=p.world,f=n.create({element:document.body,engine:p,options:{width:800,height:600,wireframes:!1}});n.run(f);var g=r.create();r.run(g,p);var v=o.nextGroup(!0),y=a.stack(350,160,2,1,-20,0,(function(e,t){return d.rectangle(e,t,200,25,{collisionFilter:{group:v},frictionAir:0,chamfer:5,render:{fillStyle:"transparent",lineWidth:1}})}));p.gravity.scale=.002,a.chain(y,.45,0,-.45,0,{stiffness:.9,length:0,angularStiffness:.7,render:{strokeStyle:"#4a485b"}}),i.add(y,s.create({bodyB:y.bodies[0],pointB:{x:-84,y:0},pointA:{x:y.bodies[0].position.x-84,y:y.bodies[0].position.y},stiffness:.9,length:0,render:{strokeStyle:"#4a485b"}}));var x=y.bodies[1];o.rotate(x,.3*-Math.PI,{x:x.position.x-100,y:x.position.y}),i.add(m,y);var h=[];t.on(f,"afterRender",(function(){h.unshift({position:u.clone(x.position),speed:x.speed}),n.startViewTransform(f),f.context.globalAlpha=.7;for(var e=0;e2e3&&h.pop()}));var M=l.create(f.canvas),b=c.create(p,{mouse:M,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(m,b),f.mouse=M,n.lookAt(f,{min:{x:0,y:0},max:{x:700,y:600}}),{engine:p,runner:g,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(g)}}},r.doublePendulum.title="Double Pendulum",r.doublePendulum.for=">0.16.1",e.exports=r.doublePendulum},"7Bfy":function(e,t,n){var r=n("akk5");e.exports={multi:function(e,t){var n=r.Demo.create({toolbar:{title:"matter-js ・ "+(t?"dev":"")+" ・ multi",url:"https://github.com/liabru/matter-js",reset:!1,source:!1,inspector:!1,tools:!1,fullscreen:!1,exampleSelect:!1},tools:{inspector:!1,gui:!1},inline:!1,preventZoom:!1,resetOnOrientation:!1,routing:!1,startExample:!1}),o=window.location.hash,i=e.map((function(e){return e.id})),a=o?o.slice(1).split(","):i.slice(0,4),s=Math.ceil(Math.sqrt(a.length)),c=document.createElement("div");c.style="display: grid; grid-template-columns: repeat("+s+", 1fr); grid-template-rows: repeat("+s+", 1fr); max-width: calc(100vmin * 1.25 - 40px); max-height: 100vmin;",n.dom.root.appendChild(c),document.body.appendChild(n.dom.root),document.title="Matter.js Multi"+(t?" ・ Dev":""),console.info("Demo.Multi: matter-js@"+Matter.version),Matter.before("Render.create",(function(e){e.options.showDebug=!0})),Matter.after("Runner.create",(function(){this.isFixed=!0}));!function(t){for(var n=0;ng&&(g=x),s.translate(y,{x:.5*h,y:.5*x}),u=y.bounds.max.x+i,o.addBody(d,y),l=y,m+=1}else u+=i}p+=g+a,u=e}return d},r.chain=function(e,t,n,r,s,c){for(var l=e.bodies,d=1;d0)for(l=0;l0&&(p=m[l-1+(c-1)*t],o.addConstraint(e,i.create(a.extend({bodyA:p,bodyB:u},s)))),r&&lp||a<(l=p-l)||a>n-1-l))return 1===u&&s.translate(d,{x:(a+(n%2==1?1:-1))*m,y:0}),c(e+(d?a*m:0)+a*i,r,a,l,d,u)}))},r.newtonsCradle=function(e,t,n,r,a){for(var s=o.create({label:"Newtons Cradle"}),l=0;l=0.14.2",e.exports=r.avalanche},"C6Q+":function(e,t,n){var r=r||{};r.events=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.Composite,a=Matter.Composites,s=Matter.Common,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,wireframes:!1}});t.run(m);var f=n.create();n.run(f,u),o.on(p,"afterAdd",(function(e){}));var g=s.now();o.on(u,"beforeUpdate",(function(e){var t=e.source;s.now()-g>=5e3&&(x(t),g=s.now())})),o.on(u,"collisionStart",(function(e){for(var t=e.pairs,n=0;n=500){var c=.03*a.mass*t;r.applyForce(a,a.position,{x:(c+s.random()*c)*s.choose([1,-1]),y:-c+s.random()*-c})}}},h=l.create(m.canvas),M=c.create(u,{mouse:h,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(p,M),m.mouse=h,o.on(M,"mousedown",(function(e){var t=e.mouse.position;console.log("mousedown at "+t.x+" "+t.y),x(u)})),o.on(M,"mouseup",(function(e){var t=e.mouse.position;console.log("mouseup at "+t.x+" "+t.y)})),o.on(M,"startdrag",(function(e){console.log("startdrag",e)})),o.on(M,"enddrag",(function(e){console.log("enddrag",e)})),t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.events.title="Events",r.events.for=">=0.14.2",e.exports=r.events},Czbd:function(e,t,n){var r=r||{};r.softBody=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=(Matter.Composites,Matter.MouseConstraint),i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!1}});t.run(d);var u=n.create();n.run(u,c);var p={friction:.05,frictionStatic:.1,render:{visible:!0}};a.add(l,[r.softBody.softBody(250,100,5,5,0,0,!0,18,p),r.softBody.softBody(400,300,8,3,0,0,!0,15,p),r.softBody.softBody(250,400,4,4,0,0,!0,15,p),s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.9,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.softBody.title="Soft Body",r.softBody.for=">=0.14.2",r.softBody.softBody=function(e,t,n,r,o,i,a,s,c,l){var d=Matter.Common,u=Matter.Composites,p=Matter.Bodies;c=d.extend({inertia:1/0},c),l=d.extend({stiffness:.2,render:{type:"line",anchors:!1}},l);var m=u.stack(e,t,n,r,o,i,(function(e,t){return p.circle(e,t,s,c)}));return u.mesh(m,n,r,a,l),m.label="Soft Body",m},e.exports=r.softBody},DeYi:function(e,t,n){var r=r||{};r.friction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showVelocity:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]),i.add(c,[a.rectangle(300,180,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,70,40,40,{friction:.001})]),i.add(c,[a.rectangle(300,350,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,250,40,40,{friction:5e-4})]),i.add(c,[a.rectangle(300,520,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,430,40,40,{friction:0})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.friction.title="Friction",r.friction.for=">=0.14.2",e.exports=r.friction},DqtB:function(e,t,n){var r={};e.exports=r;var o=n("Z/YF"),i=n("571F").deprecated;r.collides=function(e,t){return o.collides(e,t)},i(r,"collides","SAT.collides ➤ replaced by Collision.collides")},EUdY:function(e,t,n){var r=r||{};r.stress=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(90,50,18,15,0,0,(function(e,t){return s.rectangle(e,t,35,35)}));a.add(l,[p,s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.stress.title="Stress",r.stress.for=">=0.14.2",e.exports=r.stress},H5X8:function(e,t,n){var r=r||{};r.stress3=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create({positionIterations:10,velocityIterations:10}),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(u);var p=n.create();n.run(p,l);var m=.3,f=r.stack(40,40,38,18,0,0,(function(e,t){var n=Math.round(o.random(1,8));switch(Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50)*m,o.random(25,50)*m):c.rectangle(e,t,o.random(80,120)*m,o.random(25,30)*m);case 1:return c.polygon(e,t,n,o.random(25,50)*m)}}));s.add(d,f),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var g=a.create(u.canvas),v=i.create(l,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=g,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.stress3.title="Stress 3",r.stress3.for=">=0.14.2",e.exports=r.stress3},I5nt:function(e,t,n){var r={};e.exports=r;var o=n("571F");r.create=function(e){var t={};return e||o.log("Mouse.create: element was undefined, defaulting to document.body","warn"),t.element=e||document.body,t.absolute={x:0,y:0},t.position={x:0,y:0},t.mousedownPosition={x:0,y:0},t.mouseupPosition={x:0,y:0},t.offset={x:0,y:0},t.scale={x:1,y:1},t.wheelDelta=0,t.button=-1,t.pixelRatio=parseInt(t.element.getAttribute("data-pixel-ratio"),10)||1,t.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},t.mousemove=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&(t.button=0,e.preventDefault()),t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.sourceEvents.mousemove=e},t.mousedown=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches?(t.button=0,e.preventDefault()):t.button=e.button,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mousedownPosition.x=t.position.x,t.mousedownPosition.y=t.position.y,t.sourceEvents.mousedown=e},t.mouseup=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&e.preventDefault(),t.button=-1,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mouseupPosition.x=t.position.x,t.mouseupPosition.y=t.position.y,t.sourceEvents.mouseup=e},t.mousewheel=function(e){t.wheelDelta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),e.preventDefault(),t.sourceEvents.mousewheel=e},r.setElement(t,t.element),t},r.setElement=function(e,t){e.element=t,t.addEventListener("mousemove",e.mousemove,{passive:!0}),t.addEventListener("mousedown",e.mousedown,{passive:!0}),t.addEventListener("mouseup",e.mouseup,{passive:!0}),t.addEventListener("wheel",e.mousewheel,{passive:!1}),t.addEventListener("touchmove",e.mousemove,{passive:!1}),t.addEventListener("touchstart",e.mousedown,{passive:!1}),t.addEventListener("touchend",e.mouseup,{passive:!1})},r.clearSourceEvents=function(e){e.sourceEvents.mousemove=null,e.sourceEvents.mousedown=null,e.sourceEvents.mouseup=null,e.sourceEvents.mousewheel=null,e.wheelDelta=0},r.setOffset=function(e,t){e.offset.x=t.x,e.offset.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},r.setScale=function(e,t){e.scale.x=t.x,e.scale.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},r._getRelativeMousePosition=function(e,t,n){var r,o,i=t.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,s=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,c=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,l=e.changedTouches;return l?(r=l[0].pageX-i.left-s,o=l[0].pageY-i.top-c):(r=e.pageX-i.left-s,o=e.pageY-i.top-c),{x:r/(t.clientWidth/(t.width||t.clientWidth)*n),y:o/(t.clientHeight/(t.height||t.clientHeight)*n)}}},IOLg:function(e,t,n){var r=r||{};r.concave=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Vertices,d=Matter.Bodies;i.setDecomp(n("Dded"));var u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600}});t.run(m);var f=r.create();r.run(f,u),c.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var g=l.fromPath("40 0 40 20 100 20 100 80 40 80 40 100 0 50"),v=l.fromPath("100 0 75 50 100 100 25 100 0 50 25 0"),y=l.fromPath("50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38"),x=l.fromPath("35 7 19 17 14 38 14 58 25 79 45 85 65 84 65 66 46 67 34 59 30 44 33 29 45 23 66 23 66 7 53 7"),h=o.stack(50,50,6,4,10,10,(function(e,t){var n=i.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]);return d.fromVertices(e,t,i.choose([g,v,y,x]),{render:{fillStyle:n,strokeStyle:n,lineWidth:1}},!0)}));c.add(p,h);var M=s.create(m.canvas),b=a.create(u,{mouse:M,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(p,b),m.mouse=M,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.concave.title="Concave",r.concave.for=">0.16.1",e.exports=r.concave},IbIC:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("m6Dm"),a=n("yw0d"),s=n("571F"),c=n("Tgw/"),l=n("JKEF");!function(){r._timeCorrection=!0,r._inertiaScale=4,r._nextCollidingGroupId=1,r._nextNonCollidingGroupId=-1,r._nextCategory=1,r._baseDelta=1e3/60,r.create=function(t){var n={id:s.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:o.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:1e3/60,_original:null},r=s.extend(n,t);return e(r,t),r},r.nextGroup=function(e){return e?r._nextNonCollidingGroupId--:r._nextCollidingGroupId++},r.nextCategory=function(){return r._nextCategory=r._nextCategory<<1,r._nextCategory};var e=function(e,t){t=t||{},r.set(e,{bounds:e.bounds||c.create(e.vertices),positionPrev:e.positionPrev||i.clone(e.position),anglePrev:e.anglePrev||e.angle,vertices:e.vertices,parts:e.parts||[e],isStatic:e.isStatic,isSleeping:e.isSleeping,parent:e.parent||e}),o.rotate(e.vertices,e.angle,e.position),l.rotate(e.axes,e.angle),c.update(e.bounds,e.vertices,e.velocity),r.set(e,{axes:t.axes||e.axes,area:t.area||e.area,mass:t.mass||e.mass,inertia:t.inertia||e.inertia});var n=e.isStatic?"#14151f":s.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),a=e.isStatic?"#555":"#ccc",d=e.isStatic&&null===e.render.fillStyle?1:0;e.render.fillStyle=e.render.fillStyle||n,e.render.strokeStyle=e.render.strokeStyle||a,e.render.lineWidth=e.render.lineWidth||d,e.render.sprite.xOffset+=-(e.bounds.min.x-e.position.x)/(e.bounds.max.x-e.bounds.min.x),e.render.sprite.yOffset+=-(e.bounds.min.y-e.position.y)/(e.bounds.max.y-e.bounds.min.y)};r.set=function(e,t,n){var o;for(o in"string"==typeof t&&(o=t,(t={})[o]=n),t)if(Object.prototype.hasOwnProperty.call(t,o))switch(n=t[o],o){case"isStatic":r.setStatic(e,n);break;case"isSleeping":a.set(e,n);break;case"mass":r.setMass(e,n);break;case"density":r.setDensity(e,n);break;case"inertia":r.setInertia(e,n);break;case"vertices":r.setVertices(e,n);break;case"position":r.setPosition(e,n);break;case"angle":r.setAngle(e,n);break;case"velocity":r.setVelocity(e,n);break;case"angularVelocity":r.setAngularVelocity(e,n);break;case"speed":r.setSpeed(e,n);break;case"angularSpeed":r.setAngularSpeed(e,n);break;case"parts":r.setParts(e,n);break;case"centre":r.setCentre(e,n);break;default:e[o]=n}},r.setStatic=function(e,t){for(var n=0;n0&&i.rotateAbout(s.position,r,e.position,s.position)}},r.setVelocity=function(e,t){var n=e.deltaTime/r._baseDelta;e.positionPrev.x=e.position.x-t.x*n,e.positionPrev.y=e.position.y-t.y*n,e.velocity.x=(e.position.x-e.positionPrev.x)/n,e.velocity.y=(e.position.y-e.positionPrev.y)/n,e.speed=i.magnitude(e.velocity)},r.getVelocity=function(e){var t=r._baseDelta/e.deltaTime;return{x:(e.position.x-e.positionPrev.x)*t,y:(e.position.y-e.positionPrev.y)*t}},r.getSpeed=function(e){return i.magnitude(r.getVelocity(e))},r.setSpeed=function(e,t){r.setVelocity(e,i.mult(i.normalise(r.getVelocity(e)),t))},r.setAngularVelocity=function(e,t){var n=e.deltaTime/r._baseDelta;e.anglePrev=e.angle-t*n,e.angularVelocity=(e.angle-e.anglePrev)/n,e.angularSpeed=Math.abs(e.angularVelocity)},r.getAngularVelocity=function(e){return(e.angle-e.anglePrev)*r._baseDelta/e.deltaTime},r.getAngularSpeed=function(e){return Math.abs(r.getAngularVelocity(e))},r.setAngularSpeed=function(e,t){r.setAngularVelocity(e,s.sign(r.getAngularVelocity(e))*t)},r.translate=function(e,t,n){r.setPosition(e,i.add(e.position,t),n)},r.rotate=function(e,t,n,o){if(n){var i=Math.cos(t),a=Math.sin(t),s=e.position.x-n.x,c=e.position.y-n.y;r.setPosition(e,{x:n.x+(s*i-c*a),y:n.y+(s*a+c*i)},o),r.setAngle(e,e.angle+t,o)}else r.setAngle(e,e.angle+t,o)},r.scale=function(e,t,n,i){var a=0,s=0;i=i||e.position;for(var d=0;d0&&(a+=u.area,s+=u.inertia),u.position.x=i.x+(u.position.x-i.x)*t,u.position.y=i.y+(u.position.y-i.y)*n,c.update(u.bounds,u.vertices,e.velocity)}e.parts.length>1&&(e.area=a,e.isStatic||(r.setMass(e,e.density*a),r.setInertia(e,s))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},r.update=function(e,t){var n=(t=(void 0!==t?t:1e3/60)*e.timeScale)*t,a=r._timeCorrection?t/(e.deltaTime||t):1,d=1-e.frictionAir*(t/s._baseDelta),u=(e.position.x-e.positionPrev.x)*a,p=(e.position.y-e.positionPrev.y)*a;e.velocity.x=u*d+e.force.x/e.mass*n,e.velocity.y=p*d+e.force.y/e.mass*n,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.deltaTime=t,e.angularVelocity=(e.angle-e.anglePrev)*d*a+e.torque/e.inertia*n,e.anglePrev=e.angle,e.angle+=e.angularVelocity;for(var m=0;m0&&(f.position.x+=e.velocity.x,f.position.y+=e.velocity.y),0!==e.angularVelocity&&(o.rotate(f.vertices,e.angularVelocity,e.position),l.rotate(f.axes,e.angularVelocity),m>0&&i.rotateAbout(f.position,e.angularVelocity,e.position,f.position)),c.update(f.bounds,f.vertices,e.velocity)}},r.updateVelocities=function(e){var t=r._baseDelta/e.deltaTime,n=e.velocity;n.x=(e.position.x-e.positionPrev.x)*t,n.y=(e.position.y-e.positionPrev.y)*t,e.speed=Math.sqrt(n.x*n.x+n.y*n.y),e.angularVelocity=(e.angle-e.anglePrev)*t,e.angularSpeed=Math.abs(e.angularVelocity)},r.applyForce=function(e,t,n){var r=t.x-e.position.x,o=t.y-e.position.y;e.force.x+=n.x,e.force.y+=n.y,e.torque+=r*n.y-o*n.x},r._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n=0.14.2",e.exports=r.sleeping},LS1c:function(e,t,n){var r=r||{};r.wreckingBall=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Constraint,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(400,175,5,10,0,0,(function(e,t){return c.rectangle(e,t,40,40)}));a.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=c.circle(100,400,50,{density:.04,frictionAir:.005});a.add(d,f),a.add(d,s.create({pointA:{x:300,y:100},bodyB:f}));var g=i.create(u.canvas),v=o.create(l,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(d,v),u.mouse=g,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.wreckingBall.title="Wrecking Ball",r.wreckingBall.for=">=0.14.2",e.exports=r.wreckingBall},Me0I:function(e,t,n){var r=r||{};r.car=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=(Matter.Composites,Matter.MouseConstraint),i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0}});t.run(d);var u=n.create();n.run(u,c),a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var p=.9;a.add(l,r.car.car(150,100,150*p,30*p,30*p)),p=.8,a.add(l,r.car.car(350,300,150*p,30*p,30*p)),a.add(l,[s.rectangle(200,150,400,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),s.rectangle(500,350,650,20,{isStatic:!0,angle:.06*-Math.PI,render:{fillStyle:"#060a19"}}),s.rectangle(300,560,600,20,{isStatic:!0,angle:.04*Math.PI,render:{fillStyle:"#060a19"}})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.car.title="Car",r.car.for=">=0.14.2",r.car.car=function(e,t,n,r,o){var i=Matter.Body,a=Matter.Bodies,s=Matter.Composite,c=Matter.Constraint,l=i.nextGroup(!0),d=.5*-n+20,u=.5*n-20,p=s.create({label:"Car"}),m=a.rectangle(e,t,n,r,{collisionFilter:{group:l},chamfer:{radius:.5*r},density:2e-4}),f=a.circle(e+d,t+0,o,{collisionFilter:{group:l},friction:.8}),g=a.circle(e+u,t+0,o,{collisionFilter:{group:l},friction:.8}),v=c.create({bodyB:m,pointB:{x:d,y:0},bodyA:f,stiffness:1,length:0}),y=c.create({bodyB:m,pointB:{x:u,y:0},bodyA:g,stiffness:1,length:0});return s.addBody(p,m),s.addBody(p,f),s.addBody(p,g),s.addConstraint(p,v),s.addConstraint(p,y),p},e.exports=r.car},MhOg:function(e,t,n){var r=r||{};r.views=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Events,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Vector,d=Matter.Bounds,u=Matter.Bodies,p=e.create(),m=p.world,f=t.create({element:document.body,engine:p,options:{width:800,height:600,hasBounds:!0,showAngleIndicator:!0}});t.run(f);var g=n.create();n.run(g,p);var v=s.create(f.canvas),y=a.create(p,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});c.add(m,y),f.mouse=v;var x=o.stack(20,20,10,4,0,0,(function(e,t){switch(Math.round(i.random(0,1))){case 0:return i.random()<.8?u.rectangle(e,t,i.random(20,50),i.random(20,50)):u.rectangle(e,t,i.random(80,120),i.random(20,30));case 1:var n=Math.round(i.random(1,8));return n=3===n?4:n,u.polygon(e,t,n,i.random(20,50))}}));c.add(m,[x,u.rectangle(400,0,800,50,{isStatic:!0}),u.rectangle(400,600,800,50,{isStatic:!0}),u.rectangle(800,300,50,600,{isStatic:!0}),u.rectangle(0,300,50,600,{isStatic:!0})]);var h={x:.5*f.options.width,y:.5*f.options.height},M={x:-300,y:-300},b={x:1100,y:900},S=1,w={x:1,y:1};return r.on(f,"beforeRender",(function(){p.world;var e,t=y.mouse,n=-.1*t.wheelDelta;0!==n&&(n<0&&w.x>=.6||n>0&&w.x<=1.4)&&(S+=n),Math.abs(w.x-S)>.01&&(n=.2*(S-w.x),w.x+=n,w.y+=n,f.bounds.max.x=f.bounds.min.x+f.options.width*w.x,f.bounds.max.y=f.bounds.min.y+f.options.height*w.y,e={x:f.options.width*n*-.5,y:f.options.height*n*-.5},d.translate(f.bounds,e),s.setScale(t,w),s.setOffset(t,f.bounds.min));var r=l.sub(t.absolute,h),o=l.magnitude(r);if(o>50){var i=l.normalise(r),a=Math.min(10,2e-4*Math.pow(o-50,2));e=l.mult(i,a),f.bounds.min.x+e.xb.x&&(e.x=b.x-f.bounds.max.x),f.bounds.min.y+e.yb.y&&(e.y=b.y-f.bounds.max.y),d.translate(f.bounds,e),s.setOffset(t,f.bounds.min)}})),{engine:p,runner:g,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(g)}}},r.views.title="Views",r.views.for=">=0.14.2",e.exports=r.views},Minm:function(e,t,n){var r=r||{};r.stress4=function(){var e=Matter.Engine,t=Matter.Events,n=Matter.Render,r=Matter.Runner,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Bodies,d=e.create({positionIterations:25,velocityIterations:35}),u=d.world,p=n.create({element:document.body,engine:d,options:{width:800,height:600,showStats:!0,showPerformance:!0}});n.run(p);var m=r.create();r.run(m,d);var f=function(e,t,n){return o.stack(40,40,t,n,0,0,(function(t,n){var r=Math.round(i.random(1,8));switch(Math.round(i.random(0,1))){case 0:return i.random()<.8?l.rectangle(t,n,i.random(25,50)*e,i.random(25,50)*e):l.rectangle(t,n,i.random(80,120)*e,i.random(25,30)*e);case 1:return l.polygon(t,n,r,i.random(25,50)*e)}}))};c.add(u,[f(.2,61,15),f(.3,31,12),l.rectangle(400,0,800,50,{isStatic:!0,render:{visible:!1}}),l.rectangle(400,600,800,50,{isStatic:!0,render:{visible:!1}}),l.rectangle(800,300,50,600,{isStatic:!0,render:{visible:!1}}),l.rectangle(0,300,50,600,{isStatic:!0,render:{visible:!1}})]),d.timing.timeScale=.9,d.gravity.scale=7e-4,t.on(d,"beforeUpdate",(function(){d.gravity.x=Math.cos(5e-4*d.timing.timestamp),d.gravity.y=Math.sin(5e-4*d.timing.timestamp)}));var g=s.create(p.canvas),v=a.create(d,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(u,v),p.mouse=g,n.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.stress4.title="Stress 4",r.stress4.for=">=0.14.2",e.exports=r.stress4},NDQ1:function(e,t,n){var r={};e.exports=r;var o=n("m6Dm"),i=n("Z/YF"),a=n("Tgw/"),s=n("oT59"),c=n("0kzT");r.collides=function(e,t){for(var n=[],r=t.length,o=e.bounds,s=i.collides,c=a.overlaps,l=0;ld.bounds.max.x||m.bounds.max.yd.bounds.max.y))){var f=r._getRegion(e,m);if(!m.region||f.id!==m.region.id||o){m.region&&!o||(m.region=f);var g=r._regionUnion(f,m.region);for(a=g.startCol;a<=g.endCol;a++)for(s=g.startRow;s<=g.endRow;s++){c=u[l=r._getBucketId(a,s)];var v=a>=f.startCol&&a<=f.endCol&&s>=f.startRow&&s<=f.endRow,y=a>=m.region.startCol&&a<=m.region.endCol&&s>=m.region.startRow&&s<=m.region.endRow;!v&&y&&y&&c&&r._bucketRemoveBody(e,c,m),(m.region===f||v&&!y||o)&&(c||(c=r._createBucket(u,l)),r._bucketAddBody(e,c,m))}m.region=f,p=!0}}}p&&(e.pairsList=r._createActivePairsList(e))},a(r,"update","Grid.update ➤ replaced by Matter.Detector"),r.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},a(r,"clear","Grid.clear ➤ replaced by Matter.Detector"),r._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),o=Math.max(e.endCol,t.endCol),i=Math.min(e.startRow,t.startRow),a=Math.max(e.endRow,t.endRow);return r._createRegion(n,o,i,a)},r._getRegion=function(e,t){var n=t.bounds,o=Math.floor(n.min.x/e.bucketWidth),i=Math.floor(n.max.x/e.bucketWidth),a=Math.floor(n.min.y/e.bucketHeight),s=Math.floor(n.max.y/e.bucketHeight);return r._createRegion(o,i,a,s)},r._createRegion=function(e,t,n,r){return{id:e+","+t+","+n+","+r,startCol:e,endCol:t,startRow:n,endRow:r}},r._getBucketId=function(e,t){return"C"+e+"R"+t},r._createBucket=function(e,t){return e[t]=[]},r._bucketAddBody=function(e,t,n){var r,i=e.pairs,a=o.id,s=t.length;for(r=0;r0?s.push(t):delete r[o[n]];return s}},"Tgw/":function(e,t){var n={};e.exports=n,n.create=function(e){var t={min:{x:0,y:0},max:{x:0,y:0}};return e&&n.update(t,e),t},n.update=function(e,t,n){e.min.x=1/0,e.max.x=-1/0,e.min.y=1/0,e.max.y=-1/0;for(var r=0;re.max.x&&(e.max.x=o.x),o.xe.max.y&&(e.max.y=o.y),o.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,r=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+r}},Uh3T:function(e,t,n){var r=r||{};r.substep=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Events,o=Matter.Composite,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,wireframes:!1,showDebug:!0,background:"#000",pixelRatio:2}});t.run(d);var u=n.create({delta:1e3/600,maxFrameTime:20});n.run(u,c),o.add(l,[s.rectangle(250,250,300,1.25,{frictionAir:0,friction:0,restitution:.9,angle:.5,render:{lineWidth:.5,fillStyle:"#f55a3c"}}),s.circle(200,200,2.25,{frictionAir:0,friction:0,restitution:.9,angle:.5,render:{fillStyle:"#fff"}})]),o.add(l,[s.rectangle(400,0,800,50,{isStatic:!0,render:{visible:!1}}),s.rectangle(400,600,800,50,{isStatic:!0,render:{visible:!1}}),s.rectangle(800,300,50,600,{isStatic:!0,render:{visible:!1}}),s.rectangle(0,300,50,600,{isStatic:!0,render:{visible:!1}})]),r.on(c,"afterUpdate",(function(e){c.gravity.scale=35e-5,c.gravity.x=Math.cos(5e-4*c.timing.timestamp),c.gravity.y=Math.sin(5e-4*c.timing.timestamp)}));var p=a.create(d.canvas),m=i.create(c,{mouse:p,constraint:{stiffness:.2,render:{visible:!1}}});return o.add(l,m),d.mouse=p,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.substep.title="High Substeps (Low Delta)",r.substep.for=">=0.20.0",e.exports=r.substep},VZUp:function(e,t,n){var r=r||{};r.manipulation=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAxes:!0,showCollisions:!0,showConvexHulls:!0}});t.run(u);var p=n.create();n.run(p,l);var m=c.rectangle(100,300,50,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),f=c.rectangle(200,200,50,50),g=c.rectangle(300,200,50,50),v=c.rectangle(400,200,50,50),y=c.rectangle(550,200,50,50),x=c.rectangle(700,200,50,50),h=c.circle(400,100,25,{render:{fillStyle:"#060a19"}}),M=c.rectangle(600,200,96,40,{render:{fillStyle:"#060a19"}}),b=c.rectangle(660,200,40,152,{render:{fillStyle:"#060a19"}}),S=r.create({parts:[M,b],isStatic:!0});r.setPosition(S,{x:600,y:300}),s.add(d,[m,f,g,v,y,x,h,S]),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var w=0,C=.6;o.on(l,"beforeUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;C>0&&(r.scale(x,1+C*t,1+C*t),y.vertices[0].x-=.2*t,y.vertices[0].y-=.2*t,y.vertices[1].x+=.2*t,y.vertices[1].y-=.2*t,r.setVertices(y,y.vertices));var n=300+100*Math.sin(.002*l.timing.timestamp);"0.18.0"===Matter.version&&(r.setVelocity(m,{x:0,y:n-m.position.y}),r.setVelocity(S,{x:0,y:n-S.position.y}),r.setAngularVelocity(S,1*Math.PI*t)),r.setPosition(m,{x:100,y:n},!0),r.setPosition(S,{x:600,y:n},!0),r.rotate(S,1*Math.PI*t,null,!0),l.timing.timestamp>=800&&r.setStatic(h,!0),l.timing.timestamp-w>=1500&&(r.setVelocity(f,{x:0,y:-10}),r.setAngle(g,.26*-Math.PI),r.setAngularVelocity(v,.2),C=0,w=l.timing.timestamp)}));var A=a.create(u.canvas),B=i.create(l,{mouse:A,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,B),u.mouse=A,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.manipulation.title="Manipulation",r.manipulation.for=">=0.14.2",e.exports=r.manipulation},Vyp4:function(e,t,n){var r=r||{};r.remove=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=Matter.Events,d=e.create({enableSleeping:!0}),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0,showSleeping:!0}});t.run(p);var m=n.create();n.run(m,d);var f=function(){return r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}))},g=null,v=f(),y=0;l.on(d,"afterUpdate",(function(e){e.timestamp-y<800||(y=e.timestamp,s.remove(v,v.bodies[0]),s.add(v,c.rectangle(o.random(100,500),50,o.random(25,50),o.random(25,50))),g&&s.remove(u,g),g=f(),s.add(u,g))})),s.add(u,[v,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var x=a.create(p.canvas),h=i.create(d,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(u,h),p.mouse=x,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.remove.title="Composite Remove",r.remove.for=">=0.14.2",e.exports=r.remove},"Z/YF":function(e,t,n){var r={};e.exports=r;var o,i,a,s=n("0kzT"),c=n("t8gT");o=[],i={overlap:0,axis:null},a={overlap:0,axis:null},r.create=function(e,t){return{pair:null,collided:!1,bodyA:e,bodyB:t,parentA:e.parent,parentB:t.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[null,null],supportCount:0}},r.collides=function(e,t,n){if(r._overlapAxes(i,e.vertices,t.vertices,e.axes),i.overlap<=0)return null;if(r._overlapAxes(a,t.vertices,e.vertices,t.axes),a.overlap<=0)return null;var o,l,d=n&&n.table[c.id(e,t)];d?o=d.collision:((o=r.create(e,t)).collided=!0,o.bodyA=e.id=0&&(y=-y,x=-x),u.x=y,u.y=x,p.x=-x,p.y=y,m.x=y*g,m.y=x*g,o.depth=g;var h=r._findSupports(e,t,u,1),M=0;if(s.contains(e.vertices,h[0])&&(f[M++]=h[0]),s.contains(e.vertices,h[1])&&(f[M++]=h[1]),M<2){var b=r._findSupports(t,e,u,-1);s.contains(t.vertices,b[0])&&(f[M++]=b[0]),M<2&&s.contains(t.vertices,b[1])&&(f[M++]=b[1])}return 0===M&&(f[M++]=h[0]),o.supportCount=M,o},r._overlapAxes=function(e,t,n,r){var o,i,a,s,c,l,d=t.length,u=n.length,p=t[0].x,m=t[0].y,f=n[0].x,g=n[0].y,v=r.length,y=Number.MAX_VALUE,x=0;for(c=0;cC?C=s:sA?A=s:s=0.14.2",e.exports=r.restitution},ZUN1:function(e,t,n){var r=r||{};r.chains=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Composite,i=Matter.Composites,a=Matter.Constraint,s=Matter.MouseConstraint,c=Matter.Mouse,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0,showVelocity:!0}});t.run(p);var m=n.create();n.run(m,d);var f=r.nextGroup(!0),g=i.stack(100,50,8,1,10,10,(function(e,t){return l.rectangle(e,t,50,20,{collisionFilter:{group:f}})}));i.chain(g,.5,0,-.5,0,{stiffness:.8,length:2,render:{type:"line"}}),o.add(g,a.create({bodyB:g.bodies[0],pointB:{x:-25,y:0},pointA:{x:g.bodies[0].position.x,y:g.bodies[0].position.y},stiffness:.5})),f=r.nextGroup(!0);var v=i.stack(350,50,10,1,10,10,(function(e,t){return l.circle(e,t,20,{collisionFilter:{group:f}})}));i.chain(v,.5,0,-.5,0,{stiffness:.8,length:2,render:{type:"line"}}),o.add(v,a.create({bodyB:v.bodies[0],pointB:{x:-20,y:0},pointA:{x:v.bodies[0].position.x,y:v.bodies[0].position.y},stiffness:.5})),f=r.nextGroup(!0);var y=i.stack(600,50,13,1,10,10,(function(e,t){return l.rectangle(e-20,t,50,20,{collisionFilter:{group:f},chamfer:5})}));i.chain(y,.3,0,-.3,0,{stiffness:1,length:0}),o.add(y,a.create({bodyB:y.bodies[0],pointB:{x:-20,y:0},pointA:{x:y.bodies[0].position.x,y:y.bodies[0].position.y},stiffness:.5})),o.add(u,[g,v,y,l.rectangle(400,600,1200,50.5,{isStatic:!0})]);var x=c.create(p.canvas),h=s.create(d,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return o.add(u,h),p.mouse=x,t.lookAt(p,{min:{x:0,y:0},max:{x:700,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.chains.title="Chains",r.chains.for=">=0.14.2",e.exports=r.chains},Zo9v:function(e,t,n){var r=r||{};r.collisionFiltering=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composite,o=Matter.Composites,i=(Matter.Common,Matter.MouseConstraint),a=Matter.Mouse,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,wireframes:!1}});t.run(d);var u=n.create();n.run(u,c);var p="#f55a3c",m="#063e7b",f="#f5d259";r.add(l,s.rectangle(400,600,900,50,{isStatic:!0,render:{fillStyle:"transparent",lineWidth:1}})),r.add(l,o.stack(275,100,5,9,10,10,(function(e,t,n,r){var o=2,i=p;return r>5?(o=8,i=m):r>2&&(o=4,i=f),s.circle(e,t,20,{collisionFilter:{category:o},render:{strokeStyle:i,fillStyle:"transparent",lineWidth:1}})}))),r.add(l,s.circle(310,40,30,{collisionFilter:{mask:5},render:{fillStyle:f}})),r.add(l,s.circle(400,40,30,{collisionFilter:{mask:3},render:{fillStyle:p}})),r.add(l,s.circle(480,40,30,{collisionFilter:{mask:9},render:{fillStyle:m}}));var g=a.create(d.canvas),v=i.create(c,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return r.add(l,v),d.mouse=g,v.collisionFilter.mask=13,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.collisionFiltering.title="Collision Filtering",r.collisionFiltering.for=">=0.14.2",e.exports=r.collisionFiltering},ZpbE:function(e,t,n){var r=r||{};r.stack=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(200,380.75,10,5,0,0,(function(e,t){return s.rectangle(e,t,40,40)}));a.add(l,[p,s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0}),s.rectangle(400,606,800,50.5,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.stack.title="Stack",r.stack.for=">=0.14.2",e.exports=r.stack},"a+ms":function(e,t,n){var r=n("akk5"),o=n("lniP"),i=n("lniP");e.exports={compare:function(e,t){var n=r.Demo.create({toolbar:{title:"matter-js ・ "+(t?"dev":"")+" ・ comparing to "+i.version,url:"https://github.com/liabru/matter-js",reset:!0,source:!0,inspector:!1,tools:!1,fullscreen:!0,exampleSelect:!0},tools:{inspector:!1,gui:!1},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!0,startExample:!1,examples:e}),a=r.Demo.create({toolbar:{title:"matter-js-compare-build",reset:!1,source:!1,inspector:!1,tools:!1,fullscreen:!1,exampleSelect:!1},tools:{inspector:!1,gui:!1},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!1,startExample:!1,examples:e.map((function(e){return Matter.Common.extend({},e)}))});i.Runner.run=function(){},i.Render.run=function(){},o.Runner._tick=o.Runner.tick,o.Render._world=o.Render.world,i.Mouse._setElement=i.Mouse.setElement,r.Demo._setExample=r.Demo.setExample,r.Demo.setExample=function(e,t){i.Common._nextId=i.Common._seed=0,o.Common._nextId=o.Common._seed=0,i.Plugin._registry=o.Plugin._registry,i.use.apply(null,o.used),window.Matter=o,r.Demo._setExample(n,n.examples.find((function(e){return e.name===t.name})));var s=parseFloat(window.location.search.split("=")[1]),c=0;o.Runner.tick=function(e,t,n){if(-1!==c){if(c>=s)return console.info("Demo.Compare: ran "+c+" ticks, timestamp is now "+t.timing.timestamp.toFixed(2)),void(c=-1);c+=1;var r=a.example.instance;return e.delta=r.runner.delta=1e3/60,window.Matter=i,i.Runner.tick(r.runner,r.engine,n),window.Matter=o,o.Runner._tick(e,t,n)}},o.Render.world=function(e){return window.Matter=i,i.Render.world(a.example.instance.render),window.Matter=o,o.Render._world(e)},i.Mouse.setElement=function(e){return i.Mouse._setElement(e,n.example.instance.render.canvas)},window.Matter=i,r.Demo._setExample(a,a.examples.find((function(e){return e.name===t.name}))),window.Matter=o},r.Demo._reset=r.Demo.reset,r.Demo.reset=function(e){i.Common._nextId=i.Common._seed=0,o.Common._nextId=o.Common._seed=0,window.Matter=i,r.Demo._reset(a),window.Matter=o,r.Demo._reset(n)},document.body.appendChild(n.dom.root),document.body.appendChild(a.dom.root),r.Demo.start(n),document.title="Matter.js Compare"+(t?" ・ Dev":""),console.info("Demo.Compare: matter-js@"+o.version+" with matter-js@"+i.version)}}},a3OZ:function(e,t,n){var r=r||{};r.compositeManipulation=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Events,o=Matter.Composite,i=Matter.Composites,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l),o.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.stack(200,200,4,4,0,0,(function(e,t){return c.rectangle(e,t,40,40)}));o.add(d,m),l.gravity.y=0,r.on(l,"afterUpdate",(function(e){var t=l.timing.timestamp,n=(e.delta||1e3/60)/1e3;o.translate(m,{x:10*Math.sin(.001*t)*n,y:0}),o.rotate(m,.75*Math.sin(.001*t)*n,{x:300,y:300});var r=1+.75*Math.sin(.001*t)*n;o.scale(m,r,r,{x:300,y:300})}));var f=s.create(u.canvas),g=a.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return o.add(d,g),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.compositeManipulation.title="Composite Manipulation",r.compositeManipulation.for=">0.16.1",e.exports=r.compositeManipulation},c7us:function(e,t,n){var r=r||{};r.ragdoll=function(){var e=Matter.Engine,t=Matter.Events,n=Matter.Render,o=Matter.Runner,i=Matter.Body,a=Matter.Common,s=Matter.Composite,c=Matter.Composites,l=Matter.MouseConstraint,d=Matter.Mouse,u=Matter.Bodies,p=e.create(),m=p.world,f=n.create({element:document.body,engine:p,options:{width:800,height:600,showAngleIndicator:!0}});n.run(f);var g=o.create();o.run(g,p);for(var v=(f.bounds.max.y-f.bounds.min.y)/50,y=c.stack(0,0,v+2,1,0,0,(function(e,t,n){return u.rectangle(e-50,t+50*n,100,1e3,{isStatic:!0,render:{fillStyle:"#060a19",strokeStyle:"#ffffff",lineWidth:1}})})),x=c.stack(300,0,15,3,10,10,(function(e,t,n){var r=Math.round(a.random(1,8)),o={render:{fillStyle:a.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"])}};switch(Math.round(a.random(0,1))){case 0:return a.random()<.8?u.rectangle(e,t,a.random(25,50),a.random(25,50),o):u.rectangle(e,t,a.random(80,120),a.random(25,30),o);case 1:return u.polygon(e,t,r,a.random(25,50),o)}})),h=s.create(),M=0;M<1;M+=1){var b=r.ragdoll.ragdoll(200,-1e3*M,1.3);s.add(h,b)}s.add(m,[y,x,h]);var S=1,w=a.now();t.on(p,"afterUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;-1===C.button?p.timing.timeScale+=3*(S-p.timing.timeScale)*t:p.timing.timeScale=1,a.now()-w>=2e3&&(S=S<1?1:.05,w=a.now());for(var n=0;nf.bounds.max.y+100&&s.translate(o,{x:.9*-c.min.x,y:-f.bounds.max.y-400})}for(n=0;nf.bounds.max.y+100&&i.translate(r,{x:-c.min.x,y:-f.bounds.max.y-300})}}));var C=d.create(f.canvas),A=l.create(p,{mouse:C,constraint:{stiffness:.6,length:0,angularStiffness:0,render:{visible:!1}}});return s.add(m,A),f.mouse=C,n.lookAt(f,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:p,runner:g,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(g)}}},r.ragdoll.ragdoll=function(e,t,n,r){n=void 0===n?1:n;var o=Matter.Body,i=Matter.Bodies,a=Matter.Constraint,s=Matter.Composite,c=Matter.Common,l=c.extend({label:"head",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:[15*n,15*n,15*n,15*n]},render:{fillStyle:"#FFBC42"}},r),d=c.extend({label:"chest",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:[20*n,20*n,26*n,26*n]},render:{fillStyle:"#E0A423"}},r),u=c.extend({label:"left-arm",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),p=c.extend({},u,{render:{fillStyle:"#E59B12"}}),m=c.extend({label:"right-arm",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),f=c.extend({},m,{render:{fillStyle:"#E59B12"}}),g=c.extend({label:"left-leg",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),v=c.extend({},g,{render:{fillStyle:"#E59B12"}}),y=c.extend({label:"right-leg",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),x=c.extend({},y,{render:{fillStyle:"#E59B12"}}),h=i.rectangle(e,t-60*n,34*n,40*n,l),M=i.rectangle(e,t,55*n,80*n,d),b=i.rectangle(e+39*n,t-15*n,20*n,40*n,m),S=i.rectangle(e+39*n,t+25*n,20*n,60*n,f),w=i.rectangle(e-39*n,t-15*n,20*n,40*n,u),C=i.rectangle(e-39*n,t+25*n,20*n,60*n,p),A=i.rectangle(e-20*n,t+57*n,20*n,40*n,g),B=i.rectangle(e-20*n,t+97*n,20*n,60*n,v),k=i.rectangle(e+20*n,t+57*n,20*n,40*n,y),R=i.rectangle(e+20*n,t+97*n,20*n,60*n,x),P=a.create({bodyA:M,pointA:{x:24*n,y:-23*n},pointB:{x:0,y:-8*n},bodyB:b,stiffness:.6,render:{visible:!1}}),I=a.create({bodyA:M,pointA:{x:-24*n,y:-23*n},pointB:{x:0,y:-8*n},bodyB:w,stiffness:.6,render:{visible:!1}}),_=a.create({bodyA:M,pointA:{x:-10*n,y:30*n},pointB:{x:0,y:-10*n},bodyB:A,stiffness:.6,render:{visible:!1}}),E=a.create({bodyA:M,pointA:{x:10*n,y:30*n},pointB:{x:0,y:-10*n},bodyB:k,stiffness:.6,render:{visible:!1}}),T=a.create({bodyA:b,bodyB:S,pointA:{x:0,y:15*n},pointB:{x:0,y:-25*n},stiffness:.6,render:{visible:!1}}),F=a.create({bodyA:w,bodyB:C,pointA:{x:0,y:15*n},pointB:{x:0,y:-25*n},stiffness:.6,render:{visible:!1}}),D=a.create({bodyA:A,bodyB:B,pointA:{x:0,y:20*n},pointB:{x:0,y:-20*n},stiffness:.6,render:{visible:!1}}),V=a.create({bodyA:k,bodyB:R,pointA:{x:0,y:20*n},pointB:{x:0,y:-20*n},stiffness:.6,render:{visible:!1}}),L=a.create({bodyA:h,pointA:{x:0,y:25*n},pointB:{x:0,y:-35*n},bodyB:M,stiffness:.6,render:{visible:!1}}),O=a.create({bodyA:B,bodyB:R,stiffness:.01,render:{visible:!1}});return s.create({bodies:[M,h,C,w,S,b,B,R,A,k],constraints:[F,T,I,P,L,D,V,_,E,O]})},r.ragdoll.title="Ragdoll",r.ragdoll.for=">=0.14.2",e.exports=r.ragdoll},djnZ:function(e,t,n){var r=r||{};r.compound=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Constraint,i=Matter.Composite,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAxes:!0,showConvexHulls:!0}});t.run(u);var p=n.create();n.run(p,l);var m=200,f=200,g=200,v=c.rectangle(f,g,m,m/5),y=c.rectangle(f,g,m/5,m,{render:v.render}),x=r.create({parts:[v,y]});m=150,f=400,g=300;var h=c.circle(f,g,30),M=c.circle(f+m,g,30),b=c.circle(f+m,g+m,30),S=c.circle(f,g+m,30),w=r.create({parts:[h,M,b,S]}),C=o.create({pointA:{x:400,y:100},bodyB:w,pointB:{x:0,y:0}});i.add(d,[x,w,C,c.rectangle(400,600,800,50.5,{isStatic:!0})]);var A=s.create(u.canvas),B=a.create(l,{mouse:A,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(d,B),u.mouse=A,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.compound.title="Compound Bodies",r.compound.for=">=0.14.2",e.exports=r.compound},elWf:function(e,t,n){var r=r||{};r.rounded=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showAxes:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]),i.add(c,[a.rectangle(200,200,100,100,{chamfer:{radius:20}}),a.rectangle(300,200,100,100,{chamfer:{radius:[90,0,0,0]}}),a.rectangle(400,200,200,200,{chamfer:{radius:[150,20,40,20]}}),a.rectangle(200,200,200,200,{chamfer:{radius:[150,20,150,20]}}),a.rectangle(300,200,200,50,{chamfer:{radius:[25,25,0,0]}}),a.polygon(200,100,8,80,{chamfer:{radius:30}}),a.polygon(300,100,5,80,{chamfer:{radius:[10,40,20,40,10]}}),a.polygon(400,200,3,50,{chamfer:{radius:[20,0,20]}})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.rounded.title="Rounded Corners (Chamfering)",r.rounded.for=">=0.14.2",e.exports=r.rounded},ga9t:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("m6Dm"),a=n("yw0d"),s=n("Tgw/"),c=n("JKEF"),l=n("571F");r._warming=.4,r._torqueDampen=1,r._minLength=1e-6,r.create=function(e){var t=e;t.bodyA&&!t.pointA&&(t.pointA={x:0,y:0}),t.bodyB&&!t.pointB&&(t.pointB={x:0,y:0});var n=t.bodyA?i.add(t.bodyA.position,t.pointA):t.pointA,r=t.bodyB?i.add(t.bodyB.position,t.pointB):t.pointB,o=i.magnitude(i.sub(n,r));t.length=void 0!==t.length?t.length:o,t.id=t.id||l.nextId(),t.label=t.label||"Constraint",t.type="constraint",t.stiffness=t.stiffness||(t.length>0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(a.type="pin",a.anchors=!1):t.stiffness<.9&&(a.type="spring"),t.render=l.extend(a,t.render),t},r.preSolveAll=function(e){for(var t=0;t=1||0===e.length?e.stiffness*t:e.stiffness*t*t,h=e.damping*t,M=i.mult(d,y*x),b=(n?n.inverseMass:0)+(o?o.inverseMass:0),S=b+((n?n.inverseInertia:0)+(o?o.inverseInertia:0));if(h>0){var w=i.create();f=i.div(d,u),v=i.sub(o&&i.sub(o.position,o.positionPrev)||w,n&&i.sub(n.position,n.positionPrev)||w),g=i.dot(f,v)}n&&!n.isStatic&&(m=n.inverseMass/b,n.constraintImpulse.x-=M.x*m,n.constraintImpulse.y-=M.y*m,n.position.x-=M.x*m,n.position.y-=M.y*m,h>0&&(n.positionPrev.x-=h*f.x*g*m,n.positionPrev.y-=h*f.y*g*m),p=i.cross(a,M)/S*r._torqueDampen*n.inverseInertia*(1-e.angularStiffness),n.constraintImpulse.angle-=p,n.angle-=p),o&&!o.isStatic&&(m=o.inverseMass/b,o.constraintImpulse.x+=M.x*m,o.constraintImpulse.y+=M.y*m,o.position.x+=M.x*m,o.position.y+=M.y*m,h>0&&(o.positionPrev.x+=h*f.x*g*m,o.positionPrev.y+=h*f.y*g*m),p=i.cross(s,M)/S*r._torqueDampen*o.inverseInertia*(1-e.angularStiffness),o.constraintImpulse.angle+=p,o.angle+=p)}}},r.postSolveAll=function(e){for(var t=0;t0&&(u.position.x+=l.x,u.position.y+=l.y),0!==l.angle&&(o.rotate(u.vertices,l.angle,n.position),c.rotate(u.axes,l.angle),d>0&&i.rotateAbout(u.position,l.angle,n.position,u.position)),s.update(u.bounds,u.vertices,n.velocity)}l.angle*=r._warming,l.x*=r._warming,l.y*=r._warming}}},r.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),y:(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0)}},r.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0),y:(e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0)}},r.currentLength=function(e){var t=(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),n=(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0),r=t-((e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0)),o=n-((e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0));return Math.sqrt(r*r+o*o)}},ibhy:function(e,t,n){var r=r||{};r.mixed=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}));s.add(d,m),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=a.create(u.canvas),g=i.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,g),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.mixed.title="Mixed Shapes",r.mixed.for=">=0.14.2",e.exports=r.mixed},"ix+/":function(e,t,n){var r={};e.exports=r;var o=n("571F"),i=n("Z/YF");r.create=function(e){return o.extend({bodies:[],collisions:[],pairs:null},e)},r.setBodies=function(e,t){e.bodies=t.slice(0)},r.clear=function(e){e.bodies=[],e.collisions=[]},r.collisions=function(e){var t,n,o=e.pairs,a=e.bodies,s=a.length,c=r.canCollide,l=i.collides,d=e.collisions,u=0;for(a.sort(r._compareBoundsX),t=0;tf)break;if(!(gR.max.y)&&(!y||!M.isStatic&&!M.isSleeping)&&c(p.collisionFilter,M.collisionFilter)){var b=M.parts.length;if(h&&1===b)(B=l(p,M,o))&&(d[u++]=B);else for(var S=b>1?1:0,w=x>1?1:0;wR.max.x||m.max.xR.max.y||(B=l(C,k,o))&&(d[u++]=B)}}}}return d.length!==u&&(d.length=u),d},r.canCollide=function(e,t){return e.group===t.group&&0!==e.group?e.group>0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)},r._compareBoundsX=function(e,t){return e.bounds.min.x-t.bounds.min.x}},k7Ch:function(e,t,n){var r=r||{};r.gyro=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}));if(s.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]),"undefined"!=typeof window){var f=function(e){var t=void 0!==window.orientation?window.orientation:0,n=l.gravity;0===t?(n.x=o.clamp(e.gamma,-90,90)/90,n.y=o.clamp(e.beta,-90,90)/90):180===t?(n.x=o.clamp(e.gamma,-90,90)/90,n.y=o.clamp(-e.beta,-90,90)/90):90===t?(n.x=o.clamp(e.beta,-90,90)/90,n.y=o.clamp(-e.gamma,-90,90)/90):-90===t&&(n.x=o.clamp(-e.beta,-90,90)/90,n.y=o.clamp(e.gamma,-90,90)/90)};window.addEventListener("deviceorientation",f)}var g=a.create(u.canvas),v=i.create(l,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=g,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p),"undefined"!=typeof window&&window.removeEventListener("deviceorientation",f)}}},r.gyro.title="Gyroscope",r.gyro.for=">=0.14.2",e.exports=r.gyro},lWug:function(e,t,n){var r={};e.exports=r;var o=n("IbIC"),i=n("571F"),a=n("wAS/"),s=n("Tgw/"),c=n("yTB+"),l=n("m6Dm"),d=n("I5nt");!function(){var e,t;"undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout((function(){e(i.now())}),1e3/60)},t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),r._goodFps=30,r._goodDelta=1e3/60,r.create=function(e){var t={engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],engineUpdatesHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",wireframeStrokeStyle:"#bbb",hasBounds:!!e.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},n=i.extend(t,e);return n.canvas&&(n.canvas.width=n.options.width||n.canvas.width,n.canvas.height=n.options.height||n.canvas.height),n.mouse=e.mouse,n.engine=e.engine,n.canvas=n.canvas||p(n.options.width,n.options.height),n.context=n.canvas.getContext("2d"),n.textures={},n.bounds=n.bounds||{min:{x:0,y:0},max:{x:n.canvas.width,y:n.canvas.height}},n.controller=r,n.options.showBroadphase=!1,1!==n.options.pixelRatio&&r.setPixelRatio(n,n.options.pixelRatio),i.isElement(n.element)&&n.element.appendChild(n.canvas),n},r.run=function(t){!function o(i){t.frameRequestId=e(o),n(t,i),r.world(t,i),t.context.setTransform(t.options.pixelRatio,0,0,t.options.pixelRatio,0,0),(t.options.showStats||t.options.showDebug)&&r.stats(t,t.context,i),(t.options.showPerformance||t.options.showDebug)&&r.performance(t,t.context,i),t.context.setTransform(1,0,0,1,0,0)}()},r.stop=function(e){t(e.frameRequestId)},r.setPixelRatio=function(e,t){var n=e.options,r=e.canvas;"auto"===t&&(t=m(r)),n.pixelRatio=t,r.setAttribute("data-pixel-ratio",t),r.width=n.width*t,r.height=n.height*t,r.style.width=n.width+"px",r.style.height=n.height+"px"},r.setSize=function(e,t,n){e.options.width=t,e.options.height=n,e.bounds.max.x=e.bounds.min.x+t,e.bounds.max.y=e.bounds.min.y+n,1!==e.options.pixelRatio?r.setPixelRatio(e,e.options.pixelRatio):(e.canvas.width=t,e.canvas.height=n)},r.lookAt=function(e,t,n,r){r=void 0===r||r,t=i.isArray(t)?t:[t],n=n||{x:0,y:0};for(var o={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},a=0;ao.max.x&&(o.max.x=l.x),c.yo.max.y&&(o.max.y=l.y))}var u=o.max.x-o.min.x+2*n.x,p=o.max.y-o.min.y+2*n.y,m=e.canvas.height,f=e.canvas.width/m,g=u/p,v=1,y=1;g>f?y=g/f:v=f/g,e.options.hasBounds=!0,e.bounds.min.x=o.min.x,e.bounds.max.x=o.min.x+u*v,e.bounds.min.y=o.min.y,e.bounds.max.y=o.min.y+p*y,r&&(e.bounds.min.x+=.5*u-u*v*.5,e.bounds.max.x+=.5*u-u*v*.5,e.bounds.min.y+=.5*p-p*y*.5,e.bounds.max.y+=.5*p-p*y*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(d.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),d.setOffset(e.mouse,e.bounds.min))},r.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,r=t/e.options.width,o=n/e.options.height;e.context.setTransform(e.options.pixelRatio/r,0,0,e.options.pixelRatio/o,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},r.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},r.world=function(e,t){var n,o=i.now(),u=e.engine,p=u.world,m=e.canvas,f=e.context,v=e.options,y=e.timing,x=a.allBodies(p),h=a.allConstraints(p),M=v.wireframes?v.wireframeBackground:v.background,b=[],S=[],w={timestamp:u.timing.timestamp};if(c.trigger(e,"beforeRender",w),e.currentBackground!==M&&g(e,M),f.globalCompositeOperation="source-in",f.fillStyle="transparent",f.fillRect(0,0,m.width,m.height),f.globalCompositeOperation="source-over",v.hasBounds){for(n=0;n1?1:0;a1?1:0;s1?1:0;i1?1:0;s1?1:0;i1?1:0;i1?1:0;o0)){var d=r.contacts[0].vertex.x,u=r.contacts[0].vertex.y;2===r.contactCount&&(d=(r.contacts[0].vertex.x+r.contacts[1].vertex.x)/2,u=(r.contacts[0].vertex.y+r.contacts[1].vertex.y)/2),o.bodyB===o.supports[0].body||!0===o.bodyA.isStatic?s.moveTo(d-8*o.normal.x,u-8*o.normal.y):s.moveTo(d+8*o.normal.x,u+8*o.normal.y),s.lineTo(d,u)}c.wireframes?s.strokeStyle="rgba(255,165,0,0.7)":s.strokeStyle="orange",s.lineWidth=1,s.stroke()},r.separations=function(e,t,n){var r,o,i,a,s,c=n,l=e.options;for(c.beginPath(),s=0;sr._deltaMax&&u.warnOnce("Matter.Engine.update: delta argument is recommended to be less than or equal to",r._deltaMax.toFixed(3),"ms."),t=void 0!==t?t:u._baseDelta,t*=v.timeScale,v.timestamp+=t,v.lastDelta=t;var x={timestamp:v.timestamp,delta:t};c.trigger(e,"beforeUpdate",x);var h=l.allBodies(m),M=l.allConstraints(m);for(m.isModified&&(a.setBodies(f,h),l.setModified(m,!1,!1,!0)),e.enableSleeping&&o.update(h,t),r._bodiesApplyGravity(h,e.gravity),t>0&&r._bodiesUpdate(h,t),c.trigger(e,"beforeSolve",x),d.preSolveAll(h),n=0;n0&&c.trigger(e,"collisionStart",{pairs:g.collisionStart,timestamp:v.timestamp,delta:t});var S=u.clamp(20/e.positionIterations,0,1);for(i.preSolvePosition(g.list),n=0;n0&&c.trigger(e,"collisionActive",{pairs:g.collisionActive,timestamp:v.timestamp,delta:t}),g.collisionEnd.length>0&&c.trigger(e,"collisionEnd",{pairs:g.collisionEnd,timestamp:v.timestamp,delta:t}),r._bodiesClearForces(h),c.trigger(e,"afterUpdate",x),e.timing.lastElapsed=u.now()-p,e},r.merge=function(e,t){if(u.extend(e,t),t.world){e.world=t.world,r.clear(e);for(var n=l.allBodies(e.world),i=0;i=1&&i.warn("Bodies.trapezoid: slope parameter must be < 1.");var l,d=n*(s*=.5),u=d+(1-2*s)*n,p=u+d;l=s<.5?"L 0 0 L "+d+" "+-r+" L "+u+" "+-r+" L "+p+" 0":"L 0 0 L "+u+" "+-r+" L "+p+" 0";var m={label:"Trapezoid Body",position:{x:e,y:t},vertices:o.fromPath(l)};if(c.chamfer){var f=c.chamfer;m.vertices=o.chamfer(m.vertices,f.radius,f.quality,f.qualityMin,f.qualityMax),delete c.chamfer}return a.create(i.extend({},m,c))},r.circle=function(e,t,n,o,a){o=o||{};var s={label:"Circle Body",circleRadius:n};a=a||25;var c=Math.ceil(Math.max(10,Math.min(a,n)));return c%2==1&&(c+=1),r.polygon(e,t,c,n,i.extend({},s,o))},r.polygon=function(e,t,n,s,c){if(c=c||{},n<3)return r.circle(e,t,s,c);for(var l=2*Math.PI/n,d="",u=.5*l,p=0;p0&&o.area(B)1?(f=a.create(i.extend({parts:g.slice(0)},r)),a.setPosition(f,{x:e,y:t}),f):g[0]}},"pm/U":function(e,t,n){var r={};e.exports=r;var o=n("2Og8"),i=n("571F");r.name="matter-js",r.version="*",r.uses=[],r.used=[],r.use=function(){o.use(r,Array.prototype.slice.call(arguments))},r.before=function(e,t){return e=e.replace(/^Matter./,""),i.chainPathBefore(r,e,t)},r.after=function(e,t){return e=e.replace(/^Matter./,""),i.chainPathAfter(r,e,t)}},q4y7:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("yw0d"),a=n("I5nt"),s=n("yTB+"),c=n("ix+/"),l=n("ga9t"),d=n("wAS/"),u=n("571F"),p=n("Tgw/");r.create=function(e,t){var n=(e?e.mouse:null)||(t?t.mouse:null);n||(e&&e.render&&e.render.canvas?n=a.create(e.render.canvas):t&&t.element?n=a.create(t.element):(n=a.create(),u.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var o={type:"mouseConstraint",mouse:n,element:null,body:null,constraint:l.create({label:"Mouse Constraint",pointA:n.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),collisionFilter:{category:1,mask:4294967295,group:0}},i=u.extend(o,t);return s.on(e,"beforeUpdate",(function(){var t=d.allBodies(e.world);r.update(i,t),r._triggerEvents(i)})),i},r.update=function(e,t){var n=e.mouse,r=e.constraint,a=e.body;if(0===n.button){if(r.bodyB)i.set(r.bodyB,!1),r.pointA=n.position;else for(var l=0;l1?1:0;d=0.14.2",r.cloth.cloth=function(e,t,n,r,o,i,a,s,c,l){var d=Matter.Body,u=Matter.Bodies,p=Matter.Common,m=Matter.Composites,f=d.nextGroup(!0);c=p.extend({inertia:1/0,friction:1e-5,collisionFilter:{group:f},render:{visible:!1}},c),l=p.extend({stiffness:.06,render:{type:"line",anchors:!1}},l);var g=m.stack(e,t,n,r,o,i,(function(e,t){return u.circle(e,t,s,c)}));return m.mesh(g,n,r,a,l),g.label="Cloth Body",g},e.exports=r.cloth},t8gT:function(e,t,n){var r={};e.exports=r;var o=n("9K63");r.create=function(e,t){var n=e.bodyA,i=e.bodyB,a={id:r.id(n,i),bodyA:n,bodyB:i,collision:e,contacts:[o.create(),o.create()],contactCount:0,separation:0,isActive:!0,isSensor:n.isSensor||i.isSensor,timeCreated:t,timeUpdated:t,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return r.update(a,e,t),a},r.update=function(e,t,n){var r=t.supports,o=t.supportCount,i=e.contacts,a=t.parentA,s=t.parentB;e.isActive=!0,e.timeUpdated=n,e.collision=t,e.separation=t.depth,e.inverseMass=a.inverseMass+s.inverseMass,e.friction=a.frictions.frictionStatic?a.frictionStatic:s.frictionStatic,e.restitution=a.restitution>s.restitution?a.restitution:s.restitution,e.slop=a.slop>s.slop?a.slop:s.slop,e.contactCount=o,t.pair=e;var c=r[0],l=i[0],d=r[1],u=i[1];u.vertex!==c&&l.vertex!==d||(i[1]=l,i[0]=l=u,u=i[1]),l.vertex=c,u.vertex=d},r.setActive=function(e,t,n){t?(e.isActive=!0,e.timeUpdated=n):(e.isActive=!1,e.contactCount=0)},r.id=function(e,t){return e.id.35?c.rectangle(e,t,64,64,{render:{strokeStyle:"#ffffff",sprite:{texture:"./img/box.png"}}}):c.circle(e,t,46,{density:5e-4,frictionAir:.06,restitution:.3,friction:.01,render:{sprite:{texture:"./img/ball.png"}}})}));s.add(d,f);var g=a.create(u.canvas),v=i.create(l,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=g,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.sprites.title="Sprites",r.sprites.for=">=0.14.2",e.exports=r.sprites},ttsO:function(e,t,n){var r={};e.exports=r;var o=n("t8gT"),i=n("571F");r.create=function(e){return i.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},r.update=function(e,t,n){var r,i,a,s=o.update,c=o.create,l=o.setActive,d=e.table,u=e.list,p=u.length,m=p,f=e.collisionStart,g=e.collisionEnd,v=e.collisionActive,y=t.length,x=0,h=0,M=0;for(a=0;a=n?u[m++]=i:(l(i,!1,n),i.collision.bodyA.sleepCounter>0&&i.collision.bodyB.sleepCounter>0?u[m++]=i:(g[h++]=i,delete d[i.id]));u.length!==m&&(u.length=m),f.length!==x&&(f.length=x),g.length!==h&&(g.length=h),v.length!==M&&(v.length=M)},r.clear=function(e){return e.table={},e.list.length=0,e.collisionStart.length=0,e.collisionActive.length=0,e.collisionEnd.length=0,e}},uZME:function(e,t,n){var r=n("lniP"),o=n("JBRW"),i=n("a+ms").compare,a=n("7Bfy").multi,s=n("71Xj").demo;window.pathseg=n("v5Dj"),window.MatterTools=n("akk5"),window.Matter=r;var c=r.Common.keys(o).map((function(e){return{id:e,sourceLink:"https://github.com/liabru/matter-js/blob/master/examples/"+e+".js",name:o[e].title,init:o[e]}})),l=window.location.search.indexOf("compare")>=0,d=window.location.search.indexOf("multi")>=0,u=!1;l?i(c,u):d?a(c,u):s(c,u)},vSND:function(e,t,n){var r=r||{};r.stats=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Common,o=Matter.Composites,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.World,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(u);var p=n.create();n.run(p,l);var m=o.stack(70,30,13,9,5,5,(function(e,t){return c.circle(e,t,10+20*r.random())}));s.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=a.create(u.canvas),g=i.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,g),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.stats.title="Stats & Performance",r.stats.for=">=0.16.1",e.exports=r.stats},"wAS/":function(e,t,n){var r={};e.exports=r;var o=n("yTB+"),i=n("571F"),a=n("Tgw/"),s=n("IbIC");r.create=function(e){return i.extend({id:i.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},e)},r.setModified=function(e,t,n,o){if(e.isModified=t,t&&e.cache&&(e.cache.allBodies=null,e.cache.allConstraints=null,e.cache.allComposites=null),n&&e.parent&&r.setModified(e.parent,t,n,o),o)for(var i=0;i=0.14.2",e.exports=r.bridge},xoNv:function(e,t,n){var r=r||{};r.newtonsCradle=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=Matter.Body,i=(Matter.Composites,Matter.MouseConstraint),a=Matter.Mouse,s=Matter.Composite,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showVelocity:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.newtonsCradle.newtonsCradle(280,100,5,30,200);s.add(l,p),o.translate(p.bodies[0],{x:-180,y:-100}),p=r.newtonsCradle.newtonsCradle(280,380,7,20,140),s.add(l,p),o.translate(p.bodies[0],{x:-140,y:-100});var m=a.create(d.canvas),f=i.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:50},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.newtonsCradle.title="Newton's Cradle",r.newtonsCradle.for=">=0.14.2",r.newtonsCradle.newtonsCradle=function(e,t,n,r,o){for(var i=Matter.Composite,a=Matter.Constraint,s=Matter.Bodies,c=i.create({label:"Newtons Cradle"}),l=0;l0){n||(n={}),r=t.split(" ");for(var l=0;l=0.14.2",e.exports=r.sensors},yw0d:function(e,t,n){var r={};e.exports=r;var o=n("IbIC"),i=n("yTB+"),a=n("571F");r._motionWakeThreshold=.18,r._motionSleepThreshold=.08,r._minBias=.9,r.update=function(e,t){for(var n=t/a._baseDelta,i=r._motionSleepThreshold,s=0;s0&&c.motion=c.sleepThreshold/n&&r.set(c,!0)):c.sleepCounter>0&&(c.sleepCounter-=1)}else r.set(c,!1)}},r.afterCollisions=function(e){for(var t=r._motionSleepThreshold,n=0;nt&&r.set(c,!1)}}}},r.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||i.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&i.trigger(e,"sleepEnd"))}},zc7U:function(e,t,n){var r=r||{};r.circleStack=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(100,179,10,10,20,0,(function(e,t){return s.circle(e,t,20)}));a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0}),p]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.circleStack.title="Circle Stack",r.circleStack.for=">=0.14.2",e.exports=r.circleStack}},[["uZME",1,2,3,4,5]]])})); \ No newline at end of file diff --git a/demo/js/matter-demo.6283b1.min.js b/demo/js/matter-demo.6283b1.min.js deleted file mode 100644 index 9bb62fb3..00000000 --- a/demo/js/matter-demo.6283b1.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * matter-demo bundle 0.19.0 by @liabru - * http://brm.io/matter-js/ - * License MIT - */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MatterDemo",[],t):"object"==typeof exports?exports.MatterDemo=t():e.MatterDemo=t()}(this,(function(){return(this.webpackJsonpMatterDemo=this.webpackJsonpMatterDemo||[]).push([[0],{"+QOk":function(e,t,n){var r=r||{};r.timescale=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.Composite,a=Matter.Composites,s=Matter.Common,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0}});t.run(m);var f=n.create();n.run(f,u),i.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var v=1,g=s.now();o.on(u,"afterUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;u.timing.timeScale+=12*(v-u.timing.timeScale)*t,s.now()-g>=2e3&&(v=v<1?1:0,function(e,t){for(var n=1e3/60/t,o=i.allBodies(e.world),a=0;a=500){var l=.05*c.mass*n;r.applyForce(c,c.position,{x:(l+s.random()*l)*s.choose([1,-1]),y:-l+s.random()*-l})}}}(u,e.delta),g=s.now())}));var y={frictionAir:0,friction:1e-4,restitution:.8};i.add(p,a.stack(20,100,15,3,20,40,(function(e,t){return d.circle(e,t,s.random(10,20),y)}))),i.add(p,a.stack(50,50,8,3,0,0,(function(e,t){switch(Math.round(s.random(0,1))){case 0:return s.random()<.8?d.rectangle(e,t,s.random(20,50),s.random(20,50),y):d.rectangle(e,t,s.random(80,120),s.random(20,30),y);case 1:return d.polygon(e,t,Math.round(s.random(4,8)),s.random(20,50),y)}})));var x=l.create(m.canvas),h=c.create(u,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(p,h),m.mouse=x,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.timescale.title="Time Scaling",r.timescale.for=">=0.14.2",e.exports=r.timescale},"+jwT":function(e,t,n){var r=r||{};r.constraints=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=(Matter.Composites,Matter.Common,Matter.Constraint),o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=s.polygon(150,200,5,30),m=r.create({pointA:{x:150,y:100},bodyB:p,pointB:{x:-10,y:-10}});a.add(l,[p,m]);p=s.polygon(280,100,3,30),m=r.create({pointA:{x:280,y:120},bodyB:p,pointB:{x:-10,y:-7},stiffness:.001});a.add(l,[p,m]);p=s.polygon(400,100,4,30),m=r.create({pointA:{x:400,y:120},bodyB:p,pointB:{x:-10,y:-10},stiffness:.001,damping:.05});a.add(l,[p,m]);p=s.rectangle(600,200,200,20);var f=s.circle(550,150,20);m=r.create({pointA:{x:600,y:200},bodyB:p,length:0});a.add(l,[p,f,m]);p=s.rectangle(500,400,100,20,{collisionFilter:{group:-1}}),f=s.circle(600,400,20,{collisionFilter:{group:-1}}),m=r.create({bodyA:p,bodyB:f});a.add(l,[p,f,m]);var v=s.polygon(100,400,6,20),g=s.polygon(200,400,1,50);m=r.create({bodyA:v,pointA:{x:-10,y:-10},bodyB:g,pointB:{x:-10,y:-10}});a.add(l,[v,g,m]);v=s.polygon(300,400,4,20),g=s.polygon(400,400,3,30),m=r.create({bodyA:v,pointA:{x:-10,y:-10},bodyB:g,pointB:{x:-10,y:-7},stiffness:.001});a.add(l,[v,g,m]);v=s.polygon(500,400,6,30),g=s.polygon(600,400,7,60),m=r.create({bodyA:v,pointA:{x:-10,y:-10},bodyB:g,pointB:{x:-10,y:-10},stiffness:.001,damping:.1});a.add(l,[v,g,m]),a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var y=i.create(d.canvas),x=o.create(c,{mouse:y,constraint:{angularStiffness:0,render:{visible:!1}}});return a.add(l,x),d.mouse=y,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.constraints.title="Constraints",r.constraints.for=">=0.14.2",e.exports=r.constraints},"/iAh":function(e,t,n){var r=r||{};r.svg=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Vertices,l=Matter.Svg,d=Matter.Bodies;o.setDecomp(n("Dded"));var u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600}});t.run(m);var f=r.create();if(r.run(f,u),"undefined"!=typeof fetch){var v=function(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))},g=function(e){return fetch(e).then((function(e){return e.text()})).then((function(e){return(new window.DOMParser).parseFromString(e,"image/svg+xml")}))};["./svg/iconmonstr-check-mark-8-icon.svg","./svg/iconmonstr-paperclip-2-icon.svg","./svg/iconmonstr-puzzle-icon.svg","./svg/iconmonstr-user-icon.svg"].forEach((function(e,t){g(e).then((function(e){var n=o.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),r=v(e,"path").map((function(e){return c.scale(l.pathToVertices(e,30),.4,.4)}));s.add(p,d.fromVertices(100+150*t,200+50*t,r,{render:{fillStyle:n,strokeStyle:n,lineWidth:1}},!0))}))})),g("./svg/svg.svg").then((function(e){var t=o.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),n=v(e,"path").map((function(e){return l.pathToVertices(e,30)}));s.add(p,d.fromVertices(400,80,n,{render:{fillStyle:t,strokeStyle:t,lineWidth:1}},!0))}))}else o.warn("Fetch is not available. Could not load SVG.");s.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var y=a.create(m.canvas),x=i.create(u,{mouse:y,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(p,x),m.mouse=y,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.svg.title="Concave SVG Paths",r.svg.for=">0.16.1",e.exports=r.svg},"02te":function(e,t,n){var r=r||{};r.ballPool=function(){try{"undefined"!=typeof MatterWrap?Matter.use("matter-wrap"):Matter.use(n("OPlj"))}catch(e){}var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composite,i=Matter.Composites,a=Matter.Common,s=Matter.MouseConstraint,c=Matter.Mouse,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0}});t.run(p);var m=r.create();r.run(m,d),o.add(u,[l.rectangle(400,600,1200,50.5,{isStatic:!0,render:{fillStyle:"#060a19"}})]);var f=i.stack(100,0,10,8,10,10,(function(e,t){return l.circle(e,t,a.random(15,30),{restitution:.6,friction:.1})}));o.add(u,[f,l.polygon(200,460,3,60),l.polygon(400,460,5,60),l.rectangle(600,460,80,80)]);var v=c.create(p.canvas),g=s.create(d,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});o.add(u,g),p.mouse=v,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}});for(var y=o.allBodies(u),x=0;x1;if(!p||e!=p.x||t!=p.y){p&&r?(m=p.x,f=p.y):(m=0,f=0);var o={x:m+e,y:f+t};!r&&p||(p=o),v.push(o),y=m+e,x=f+t}},b=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":y=e.x,x=e.y;break;case"H":y=e.x;break;case"V":x=e.y}h(y,x,e.pathSegType)}};for(r._svgPathToAbsolute(e),a=e.getTotalLength(),l=[],n=0;n0)return!1;a=n}return!0},r.scale=function(e,t,n,i){if(1===t&&1===n)return e;var a,s;i=i||r.centre(e);for(var c=0;c=0?c-1:e.length-1],d=e[c],u=e[(c+1)%e.length],p=t[c0&&(i|=2),3===i)return!1;return 0!==i||null},r.hull=function(e){var t,n,r=[],i=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&o.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];r.length>=2&&o.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}return r.pop(),i.pop(),r.concat(i)}},"0mtl":function(e,t,n){var r=r||{};r.catapult=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Constraint,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=Matter.Body,d=Matter.Vector,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0,showVelocity:!0}});t.run(m);var f=n.create();n.run(f,u);var v=l.nextGroup(!0),g=r.stack(250,255,1,6,0,0,(function(e,t){return c.rectangle(e,t,30,30)})),y=c.rectangle(400,520,320,20,{collisionFilter:{group:v}});s.add(p,[g,y,c.rectangle(400,600,800,50.5,{isStatic:!0,render:{fillStyle:"#060a19"}}),c.rectangle(250,555,20,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),c.rectangle(400,535,20,80,{isStatic:!0,collisionFilter:{group:v},render:{fillStyle:"#060a19"}}),c.circle(560,100,50,{density:.005}),o.create({bodyA:y,pointB:d.clone(y.position),stiffness:1,length:0})]);var x=a.create(m.canvas),h=i.create(u,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(p,h),m.mouse=x,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.catapult.title="Catapult",r.catapult.for=">=0.14.2",e.exports=r.catapult},"136C":function(e,t,n){var r=r||{};r.slingshot=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Events,i=Matter.Constraint,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Body,l=Matter.Composite,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,showAngleIndicator:!0}});t.run(m);var f=n.create();n.run(f,u);var v=d.rectangle(395,600,815,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),g={density:.004},y=d.polygon(170,450,8,20,g),x=i.create({pointA:{x:170,y:450},bodyB:y,length:.01,damping:.01,stiffness:.05}),h=r.pyramid(500,300,9,10,0,0,(function(e,t){return d.rectangle(e,t,25,40)})),b=d.rectangle(610,250,200,20,{isStatic:!0,render:{fillStyle:"#060a19"}}),M=r.pyramid(550,0,5,10,0,0,(function(e,t){return d.rectangle(e,t,25,40)}));l.add(u.world,[v,h,b,M,y,x]),o.on(u,"afterUpdate",(function(){-1===w.mouse.button&&(y.position.x>190||y.position.y<430)&&(c.getSpeed(y)>45&&c.setSpeed(y,45),y=d.polygon(170,450,7,20,g),l.add(u.world,y),x.bodyB=y)}));var S=s.create(m.canvas),w=a.create(u,{mouse:S,constraint:{stiffness:.2,render:{visible:!1}}});return l.add(p,w),m.mouse=S,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.slingshot.title="Slingshot",r.slingshot.for=">=0.14.2",e.exports=r.slingshot},"2Og8":function(e,t,n){var r={};e.exports=r;var o=n("571F");r._registry={},r.register=function(e){if(r.isPlugin(e)||o.warn("Plugin.register:",r.toString(e),"does not implement all required fields."),e.name in r._registry){var t=r._registry[e.name],n=r.versionParse(e.version).number,i=r.versionParse(t.version).number;n>i?(o.warn("Plugin.register:",r.toString(t),"was upgraded to",r.toString(e)),r._registry[e.name]=e):n-1},r.isFor=function(e,t){var n=e.for&&r.dependencyParse(e.for);return!e.for||t.name===n.name&&r.versionSatisfies(t.version,n.range)},r.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=r.dependencies(e),i=o.topologicalSort(n),a=[],s=0;s0&&o.info(a.join(" "))}else o.warn("Plugin.use:",r.toString(e),"does not specify any dependencies to install.")},r.dependencies=function(e,t){var n=r.dependencyParse(e),i=n.name;if(!(i in(t=t||{}))){e=r.resolve(e)||e,t[i]=o.map(e.uses||[],(function(t){r.isPlugin(t)&&r.register(t);var i=r.dependencyParse(t),a=r.resolve(t);return a&&!r.versionSatisfies(a.version,i.range)?(o.warn("Plugin.dependencies:",r.toString(a),"does not satisfy",r.toString(i),"used by",r.toString(n)+"."),a._warned=!0,e._warned=!0):a||(o.warn("Plugin.dependencies:",r.toString(t),"used by",r.toString(n),"could not be resolved."),e._warned=!0),i.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;t.test(e)||o.warn("Plugin.versionParse:",e,"is not a valid version or range.");var n=t.exec(e),r=Number(n[4]),i=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:e,operator:n[1]||n[2]||"",major:r,minor:i,patch:a,parts:[r,i,a],prerelease:n[7],number:1e8*r+1e4*i+a}},r.versionSatisfies=function(e,t){t=t||"*";var n=r.versionParse(t),o=r.versionParse(e);if(n.isRange){if("*"===n.operator||"*"===e)return!0;if(">"===n.operator)return o.number>n.number;if(">="===n.operator)return o.number>=n.number;if("~"===n.operator)return o.major===n.major&&o.minor===n.minor&&o.patch>=n.patch;if("^"===n.operator)return n.major>0?o.major===n.major&&o.number>=n.number:n.minor>0?o.minor===n.minor&&o.patch>=n.patch:o.patch===n.patch}return e===t||"*"===e}},"2oV2":function(e,t,n){var r=r||{};r.raycasting=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composite,i=Matter.Composites,a=Matter.Common,s=Matter.Query,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Events,u=Matter.Vertices,p=Matter.Bodies,m=e.create(),f=m.world,v=t.create({element:document.body,engine:m,options:{width:800,height:600,showAngleIndicator:!0}});t.run(v);var g=r.create();r.run(g,m);var y=i.stack(20,20,12,4,0,0,(function(e,t){switch(Math.round(a.random(0,1))){case 0:return a.random()<.8?p.rectangle(e,t,a.random(20,50),a.random(20,50)):p.rectangle(e,t,a.random(80,120),a.random(20,30));case 1:var n=Math.round(a.random(1,8));return n=3===n?4:n,p.polygon(e,t,n,a.random(20,50))}}));a.setDecomp(n("Dded"));var x=u.fromPath("50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38"),h=p.fromVertices(200,200,x);o.add(f,[y,h,p.rectangle(400,0,800,50,{isStatic:!0}),p.rectangle(400,600,800,50,{isStatic:!0}),p.rectangle(800,300,50,600,{isStatic:!0}),p.rectangle(0,300,50,600,{isStatic:!0})]);var b=[],M={x:400,y:100};d.on(m,"afterUpdate",(function(){var e=w.mouse,t=o.allBodies(m.world),n=e.position||{x:100,y:600};b=s.ray(t,M,n)})),d.on(v,"afterRender",(function(){var e=w.mouse,n=v.context,r=e.position||{x:100,y:600};t.startViewTransform(v),n.beginPath(),n.moveTo(M.x,M.y),n.lineTo(r.x,r.y),b.length>0?n.strokeStyle="#fff":n.strokeStyle="#555",n.lineWidth=.5,n.stroke();for(var o=0;o0.16.1",e.exports=r.raycasting},"3Slt":function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("571F"),a=n("Tgw/");r._restingThresh=2,r._restingThreshTangent=Math.sqrt(6),r._positionDampen=.9,r._positionWarming=.8,r._frictionNormalMultiplier=5,r._frictionMaxStatic=Number.MAX_VALUE,r.preSolvePosition=function(e){var t,n,r,o=e.length;for(t=0;tG?(o=q>0?q:-q,(n=v.friction*(q>0?1:-1)*l)<-o?n=-o:n>o&&(n=o)):(n=q,o=m);var N=E*S-T*M,z=F*S-V*M,Z=k/(R+y.inverseInertia*N*N+x.inverseInertia*z*z),Q=(1+v.restitution)*j*Z;if(n*=Z,j0&&(I.normalImpulse=0),Q=I.normalImpulse-X}if(q<-u||q>u)I.tangentImpulse=0;else{var Y=I.tangentImpulse;I.tangentImpulse+=n,I.tangentImpulse<-o&&(I.tangentImpulse=-o),I.tangentImpulse>o&&(I.tangentImpulse=o),n=I.tangentImpulse-Y}var J=M*Q+w*n,K=S*Q+C*n;y.isStatic||y.isSleeping||(y.positionPrev.x+=J*y.inverseMass,y.positionPrev.y+=K*y.inverseMass,y.anglePrev+=(E*K-T*J)*y.inverseInertia),x.isStatic||x.isSleeping||(x.positionPrev.x-=J*x.inverseMass,x.positionPrev.y-=K*x.inverseMass,x.anglePrev-=(F*K-V*J)*x.inverseInertia)}}}}},"4XQC":function(e,t,n){var r=r||{};r.staticFriction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Composites,i=Matter.Events,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showVelocity:!0}});t.run(p);var m=n.create();n.run(m,d);var f=l.rectangle(400,500,200,60,{isStatic:!0,chamfer:10,render:{fillStyle:"#060a19"}}),v=o.stack(350,170,1,6,0,0,(function(e,t){return l.rectangle(e,t,100,50,{slop:.5,friction:1,frictionStatic:1/0})}));c.add(u,[f,v,l.rectangle(400,0,800,50,{isStatic:!0}),l.rectangle(400,600,800,50,{isStatic:!0}),l.rectangle(800,300,50,600,{isStatic:!0}),l.rectangle(0,300,50,600,{isStatic:!0})]),i.on(d,"beforeUpdate",(function(){if(!(d.timing.timestamp<1500)){var e=400+100*Math.sin(.001*(d.timing.timestamp-1500));"0.18.0"===Matter.version&&r.setVelocity(f,{x:e-f.position.x,y:0}),r.setPosition(f,{x:e,y:f.position.y},!0)}}));var g=s.create(p.canvas),y=a.create(d,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(u,y),p.mouse=g,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.staticFriction.title="Static Friction",r.staticFriction.for=">=0.14.2",e.exports=r.staticFriction},"4d8i":function(e,t,n){var r={};e.exports=r;var o=n("yTB+"),i=n("nIFq"),a=n("571F");!function(){var e,t,n;("undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),e)||(e=function(e){n=setTimeout((function(){e(a.now())}),1e3/60)},t=function(){clearTimeout(n)});r.create=function(e){var t=a.extend({fps:60,deltaSampleSize:60,counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,frameRequestId:null,isFixed:!1,enabled:!0},e);return t.delta=t.delta||1e3/t.fps,t.deltaMin=t.deltaMin||1e3/t.fps,t.deltaMax=t.deltaMax||1e3/(.5*t.fps),t.fps=1e3/t.delta,t},r.run=function(t,n){return void 0!==t.positionIterations&&(n=t,t=r.create()),function o(i){t.frameRequestId=e(o),i&&t.enabled&&r.tick(t,n,i)}(),t},r.tick=function(e,t,n){var r,a=t.timing;e.isFixed?r=e.delta:(r=n-e.timePrev||e.delta,e.timePrev=n,e.deltaHistory.push(r),e.deltaHistory=e.deltaHistory.slice(-e.deltaSampleSize),r=(r=(r=Math.min.apply(null,e.deltaHistory))e.deltaMax?e.deltaMax:r,e.delta=r);var s={timestamp:a.timestamp};o.trigger(e,"beforeTick",s),e.frameCounter+=1,n-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((n-e.counterTimestamp)/1e3),e.counterTimestamp=n,e.frameCounter=0),o.trigger(e,"tick",s),o.trigger(e,"beforeUpdate",s),i.update(t,r),o.trigger(e,"afterUpdate",s),o.trigger(e,"afterTick",s)},r.stop=function(e){t(e.frameRequestId)},r.start=function(e,t){r.run(e,t)}}()},"52dP":function(e,t,n){var r=r||{};r.terrain=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Query,d=Matter.Svg,u=Matter.Bodies;i.setDecomp(n("Dded"));var p=e.create(),m=p.world,f=t.create({element:document.body,engine:p,options:{width:800,height:600}});t.run(f);var v,g=r.create();if(r.run(g,p),"undefined"!=typeof fetch){(v="./svg/terrain.svg",fetch(v).then((function(e){return e.text()})).then((function(e){return(new window.DOMParser).parseFromString(e,"image/svg+xml")}))).then((function(e){var t=function(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))}(e,"path").map((function(e){return d.pathToVertices(e,30)})),n=u.fromVertices(400,350,t,{isStatic:!0,render:{fillStyle:"#060a19",strokeStyle:"#060a19",lineWidth:1}},!0);c.add(m,n);var r={frictionAir:0,friction:1e-4,restitution:.6};c.add(m,o.stack(80,100,20,20,10,10,(function(e,t){if(0===l.point([n],{x:e,y:t}).length)return u.polygon(e,t,5,12,r)})))}))}else i.warn("Fetch is not available. Could not load SVG.");var y=s.create(f.canvas),x=a.create(p,{mouse:y,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(m,x),f.mouse=y,t.lookAt(f,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:p,runner:g,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(g)}}},r.terrain.title="Terrain",r.terrain.for=">0.16.1",e.exports=r.terrain},"571F":function(e,t){var n={};e.exports=n,function(){n._baseDelta=1e3/60,n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n._warnedOnce={},n._decomp=null,n.extend=function(e,t){var r,o;"boolean"==typeof t?(r=2,o=t):(r=1,o=!0);for(var i=r;i0;t--){var r=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[r],e[r]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warnOnce=function(){var e=Array.prototype.slice.call(arguments).join(" ");n._warnedOnce[e]||(n.warn(e),n._warnedOnce[e]=!0)},n.deprecated=function(e,t,r){e[t]=n.chain((function(){n.warnOnce("🔅 deprecated 🔅",r)}),e[t])},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n=0.14.2",e.exports=r.pyramid},"6IAi":function(e,t,n){var r=r||{};r.airFriction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showVelocity:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(200,100,60,60,{frictionAir:.001}),a.rectangle(400,100,60,60,{frictionAir:.05}),a.rectangle(600,100,60,60,{frictionAir:.1}),a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.airFriction.title="Air Friction",r.airFriction.for=">=0.14.2",e.exports=r.airFriction},"71Xj":function(e,t,n){var r=n("akk5");e.exports={demo:function(e,t){var n=r.Demo.create({toolbar:{title:"matter-js"+(t?" ・ dev":""),url:"https://github.com/liabru/matter-js",reset:!0,source:!0,inspector:!0,tools:!0,fullscreen:!0,exampleSelect:!0},tools:{inspector:!0,gui:!0},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!0,startExample:"mixed",examples:e});if(window.MatterDemoInstance=n,document.body.appendChild(n.dom.root),document.title="Matter.js Demo"+(t?" ・ Dev":""),t){var o=n.dom.buttonSource,i=o.cloneNode(!0);i.textContent="⎄",i.title="Compare",i.href="?compare",i.target="",i.className="matter-btn matter-btn-compare",i.addEventListener("click",(function(e){window.location="?compare#"+n.example.id,e.preventDefault()})),o.parentNode.insertBefore(i,o.nextSibling),Matter.before("Render.create",(function(e){e.options.showDebug=!0}))}r.Demo.start(n)}}},"74MQ":function(e,t,n){var r=r||{};r.doublePendulum=function(){var e=Matter.Engine,t=Matter.Events,n=Matter.Render,r=Matter.Runner,o=Matter.Body,i=Matter.Composite,a=Matter.Composites,s=Matter.Constraint,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=Matter.Vector,p=e.create(),m=p.world,f=n.create({element:document.body,engine:p,options:{width:800,height:600,wireframes:!1}});n.run(f);var v=r.create();r.run(v,p);var g=o.nextGroup(!0),y=a.stack(350,160,2,1,-20,0,(function(e,t){return d.rectangle(e,t,200,25,{collisionFilter:{group:g},frictionAir:0,chamfer:5,render:{fillStyle:"transparent",lineWidth:1}})}));p.gravity.scale=.002,a.chain(y,.45,0,-.45,0,{stiffness:.9,length:0,angularStiffness:.7,render:{strokeStyle:"#4a485b"}}),i.add(y,s.create({bodyB:y.bodies[0],pointB:{x:-84,y:0},pointA:{x:y.bodies[0].position.x-84,y:y.bodies[0].position.y},stiffness:.9,length:0,render:{strokeStyle:"#4a485b"}}));var x=y.bodies[1];o.rotate(x,.3*-Math.PI,{x:x.position.x-100,y:x.position.y}),i.add(m,y);var h=[];t.on(f,"afterRender",(function(){h.unshift({position:u.clone(x.position),speed:x.speed}),n.startViewTransform(f),f.context.globalAlpha=.7;for(var e=0;e2e3&&h.pop()}));var b=l.create(f.canvas),M=c.create(p,{mouse:b,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(m,M),f.mouse=b,n.lookAt(f,{min:{x:0,y:0},max:{x:700,y:600}}),{engine:p,runner:v,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(v)}}},r.doublePendulum.title="Double Pendulum",r.doublePendulum.for=">0.16.1",e.exports=r.doublePendulum},"7MJU":function(e,t,n){var r=r||{};r.gravity=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showVelocity:!0,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50.5,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]),l.gravity.y=-1;var m=r.stack(50,120,11,5,0,0,(function(e,t){switch(Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(20,50),o.random(20,50)):c.rectangle(e,t,o.random(80,120),o.random(20,30));case 1:return c.polygon(e,t,Math.round(o.random(1,8)),o.random(20,50))}}));s.add(d,m);var f=a.create(u.canvas),v=i.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.gravity.title="Reverse Gravity",r.gravity.for=">0.16.1",e.exports=r.gravity},"9K63":function(e,t){var n={};e.exports=n,n.create=function(e){return{vertex:e,normalImpulse:0,tangentImpulse:0}}},"9Nbg":function(e,t,n){var r={};e.exports=r;var o=n("wAS/"),i=n("ga9t"),a=n("571F"),s=n("IbIC"),c=n("oT59"),l=a.deprecated;r.stack=function(e,t,n,r,i,a,c){for(var l,d=o.create({label:"Stack"}),u=e,p=t,m=0,f=0;fv&&(v=x),s.translate(y,{x:.5*h,y:.5*x}),u=y.bounds.max.x+i,o.addBody(d,y),l=y,m+=1}else u+=i}p+=v+a,u=e}return d},r.chain=function(e,t,n,r,s,c){for(var l=e.bodies,d=1;d0)for(l=0;l0&&(p=m[l-1+(c-1)*t],o.addConstraint(e,i.create(a.extend({bodyA:p,bodyB:u},s)))),r&&lp||a<(l=p-l)||a>n-1-l))return 1===u&&s.translate(d,{x:(a+(n%2==1?1:-1))*m,y:0}),c(e+(d?a*m:0)+a*i,r,a,l,d,u)}))},r.newtonsCradle=function(e,t,n,r,a){for(var s=o.create({label:"Newtons Cradle"}),l=0;l=0.14.2",e.exports=r.avalanche},"C6Q+":function(e,t,n){var r=r||{};r.events=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.Composite,a=Matter.Composites,s=Matter.Common,c=Matter.MouseConstraint,l=Matter.Mouse,d=Matter.Bodies,u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600,wireframes:!1}});t.run(m);var f=n.create();n.run(f,u),o.on(p,"afterAdd",(function(e){}));var v=s.now();o.on(u,"beforeUpdate",(function(e){var t=e.source;s.now()-v>=5e3&&(x(t),v=s.now())})),o.on(u,"collisionStart",(function(e){for(var t=e.pairs,n=0;n=500){var c=.03*a.mass*t;r.applyForce(a,a.position,{x:(c+s.random()*c)*s.choose([1,-1]),y:-c+s.random()*-c})}}},h=l.create(m.canvas),b=c.create(u,{mouse:h,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(p,b),m.mouse=h,o.on(b,"mousedown",(function(e){var t=e.mouse.position;console.log("mousedown at "+t.x+" "+t.y),x(u)})),o.on(b,"mouseup",(function(e){var t=e.mouse.position;console.log("mouseup at "+t.x+" "+t.y)})),o.on(b,"startdrag",(function(e){console.log("startdrag",e)})),o.on(b,"enddrag",(function(e){console.log("enddrag",e)})),t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.events.title="Events",r.events.for=">=0.14.2",e.exports=r.events},Czbd:function(e,t,n){var r=r||{};r.softBody=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=(Matter.Composites,Matter.MouseConstraint),i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!1}});t.run(d);var u=n.create();n.run(u,c);var p={friction:.05,frictionStatic:.1,render:{visible:!0}};a.add(l,[r.softBody.softBody(250,100,5,5,0,0,!0,18,p),r.softBody.softBody(400,300,8,3,0,0,!0,15,p),r.softBody.softBody(250,400,4,4,0,0,!0,15,p),s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.9,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.softBody.title="Soft Body",r.softBody.for=">=0.14.2",r.softBody.softBody=function(e,t,n,r,o,i,a,s,c,l){var d=Matter.Common,u=Matter.Composites,p=Matter.Bodies;c=d.extend({inertia:1/0},c),l=d.extend({stiffness:.2,render:{type:"line",anchors:!1}},l);var m=u.stack(e,t,n,r,o,i,(function(e,t){return p.circle(e,t,s,c)}));return u.mesh(m,n,r,a,l),m.label="Soft Body",m},e.exports=r.softBody},DeYi:function(e,t,n){var r=r||{};r.friction=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showVelocity:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]),i.add(c,[a.rectangle(300,180,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,70,40,40,{friction:.001})]),i.add(c,[a.rectangle(300,350,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,250,40,40,{friction:5e-4})]),i.add(c,[a.rectangle(300,520,700,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),a.rectangle(300,430,40,40,{friction:0})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.friction.title="Friction",r.friction.for=">=0.14.2",e.exports=r.friction},DqtB:function(e,t,n){var r={};e.exports=r;var o=n("Z/YF"),i=n("571F").deprecated;r.collides=function(e,t){return o.collides(e,t)},i(r,"collides","SAT.collides ➤ replaced by Collision.collides")},EUdY:function(e,t,n){var r=r||{};r.stress=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(90,50,18,15,0,0,(function(e,t){return s.rectangle(e,t,35,35)}));a.add(l,[p,s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.stress.title="Stress",r.stress.for=">=0.14.2",e.exports=r.stress},H5X8:function(e,t,n){var r=r||{};r.stress3=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create({positionIterations:10,velocityIterations:10}),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(u);var p=n.create({isFixed:!0});n.run(p,l);var m=.3,f=r.stack(40,40,38,18,0,0,(function(e,t){var n=Math.round(o.random(1,8));switch(Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50)*m,o.random(25,50)*m):c.rectangle(e,t,o.random(80,120)*m,o.random(25,30)*m);case 1:return c.polygon(e,t,n,o.random(25,50)*m)}}));s.add(d,f),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var v=a.create(u.canvas),g=i.create(l,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,g),u.mouse=v,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.stress3.title="Stress 3",r.stress3.for=">=0.14.2",e.exports=r.stress3},I5nt:function(e,t,n){var r={};e.exports=r;var o=n("571F");r.create=function(e){var t={};return e||o.log("Mouse.create: element was undefined, defaulting to document.body","warn"),t.element=e||document.body,t.absolute={x:0,y:0},t.position={x:0,y:0},t.mousedownPosition={x:0,y:0},t.mouseupPosition={x:0,y:0},t.offset={x:0,y:0},t.scale={x:1,y:1},t.wheelDelta=0,t.button=-1,t.pixelRatio=parseInt(t.element.getAttribute("data-pixel-ratio"),10)||1,t.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},t.mousemove=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&(t.button=0,e.preventDefault()),t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.sourceEvents.mousemove=e},t.mousedown=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches?(t.button=0,e.preventDefault()):t.button=e.button,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mousedownPosition.x=t.position.x,t.mousedownPosition.y=t.position.y,t.sourceEvents.mousedown=e},t.mouseup=function(e){var n=r._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&e.preventDefault(),t.button=-1,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mouseupPosition.x=t.position.x,t.mouseupPosition.y=t.position.y,t.sourceEvents.mouseup=e},t.mousewheel=function(e){t.wheelDelta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),e.preventDefault()},r.setElement(t,t.element),t},r.setElement=function(e,t){e.element=t,t.addEventListener("mousemove",e.mousemove),t.addEventListener("mousedown",e.mousedown),t.addEventListener("mouseup",e.mouseup),t.addEventListener("mousewheel",e.mousewheel),t.addEventListener("DOMMouseScroll",e.mousewheel),t.addEventListener("touchmove",e.mousemove),t.addEventListener("touchstart",e.mousedown),t.addEventListener("touchend",e.mouseup)},r.clearSourceEvents=function(e){e.sourceEvents.mousemove=null,e.sourceEvents.mousedown=null,e.sourceEvents.mouseup=null,e.sourceEvents.mousewheel=null,e.wheelDelta=0},r.setOffset=function(e,t){e.offset.x=t.x,e.offset.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},r.setScale=function(e,t){e.scale.x=t.x,e.scale.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},r._getRelativeMousePosition=function(e,t,n){var r,o,i=t.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,s=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,c=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,l=e.changedTouches;return l?(r=l[0].pageX-i.left-s,o=l[0].pageY-i.top-c):(r=e.pageX-i.left-s,o=e.pageY-i.top-c),{x:r/(t.clientWidth/(t.width||t.clientWidth)*n),y:o/(t.clientHeight/(t.height||t.clientHeight)*n)}}},IOLg:function(e,t,n){var r=r||{};r.concave=function(){var e=Matter.Engine,t=Matter.Render,r=Matter.Runner,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Vertices,d=Matter.Bodies;i.setDecomp(n("Dded"));var u=e.create(),p=u.world,m=t.create({element:document.body,engine:u,options:{width:800,height:600}});t.run(m);var f=r.create();r.run(f,u),c.add(p,[d.rectangle(400,0,800,50,{isStatic:!0}),d.rectangle(400,600,800,50,{isStatic:!0}),d.rectangle(800,300,50,600,{isStatic:!0}),d.rectangle(0,300,50,600,{isStatic:!0})]);var v=l.fromPath("40 0 40 20 100 20 100 80 40 80 40 100 0 50"),g=l.fromPath("100 0 75 50 100 100 25 100 0 50 25 0"),y=l.fromPath("50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38"),x=l.fromPath("35 7 19 17 14 38 14 58 25 79 45 85 65 84 65 66 46 67 34 59 30 44 33 29 45 23 66 23 66 7 53 7"),h=o.stack(50,50,6,4,10,10,(function(e,t){var n=i.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]);return d.fromVertices(e,t,i.choose([v,g,y,x]),{render:{fillStyle:n,strokeStyle:n,lineWidth:1}},!0)}));c.add(p,h);var b=s.create(m.canvas),M=a.create(u,{mouse:b,constraint:{stiffness:.2,render:{visible:!1}}});return c.add(p,M),m.mouse=b,t.lookAt(m,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:u,runner:f,render:m,canvas:m.canvas,stop:function(){Matter.Render.stop(m),Matter.Runner.stop(f)}}},r.concave.title="Concave",r.concave.for=">0.16.1",e.exports=r.concave},IbIC:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("m6Dm"),a=n("yw0d"),s=n("571F"),c=n("Tgw/"),l=n("JKEF");!function(){r._timeCorrection=!0,r._inertiaScale=4,r._nextCollidingGroupId=1,r._nextNonCollidingGroupId=-1,r._nextCategory=1,r._baseDelta=1e3/60,r.create=function(t){var n={id:s.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:o.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:1e3/60,_original:null},r=s.extend(n,t);return e(r,t),r},r.nextGroup=function(e){return e?r._nextNonCollidingGroupId--:r._nextCollidingGroupId++},r.nextCategory=function(){return r._nextCategory=r._nextCategory<<1,r._nextCategory};var e=function(e,t){t=t||{},r.set(e,{bounds:e.bounds||c.create(e.vertices),positionPrev:e.positionPrev||i.clone(e.position),anglePrev:e.anglePrev||e.angle,vertices:e.vertices,parts:e.parts||[e],isStatic:e.isStatic,isSleeping:e.isSleeping,parent:e.parent||e}),o.rotate(e.vertices,e.angle,e.position),l.rotate(e.axes,e.angle),c.update(e.bounds,e.vertices,e.velocity),r.set(e,{axes:t.axes||e.axes,area:t.area||e.area,mass:t.mass||e.mass,inertia:t.inertia||e.inertia});var n=e.isStatic?"#14151f":s.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),a=e.isStatic?"#555":"#ccc",d=e.isStatic&&null===e.render.fillStyle?1:0;e.render.fillStyle=e.render.fillStyle||n,e.render.strokeStyle=e.render.strokeStyle||a,e.render.lineWidth=e.render.lineWidth||d,e.render.sprite.xOffset+=-(e.bounds.min.x-e.position.x)/(e.bounds.max.x-e.bounds.min.x),e.render.sprite.yOffset+=-(e.bounds.min.y-e.position.y)/(e.bounds.max.y-e.bounds.min.y)};r.set=function(e,t,n){var o;for(o in"string"==typeof t&&(o=t,(t={})[o]=n),t)if(Object.prototype.hasOwnProperty.call(t,o))switch(n=t[o],o){case"isStatic":r.setStatic(e,n);break;case"isSleeping":a.set(e,n);break;case"mass":r.setMass(e,n);break;case"density":r.setDensity(e,n);break;case"inertia":r.setInertia(e,n);break;case"vertices":r.setVertices(e,n);break;case"position":r.setPosition(e,n);break;case"angle":r.setAngle(e,n);break;case"velocity":r.setVelocity(e,n);break;case"angularVelocity":r.setAngularVelocity(e,n);break;case"speed":r.setSpeed(e,n);break;case"angularSpeed":r.setAngularSpeed(e,n);break;case"parts":r.setParts(e,n);break;case"centre":r.setCentre(e,n);break;default:e[o]=n}},r.setStatic=function(e,t){for(var n=0;n0&&i.rotateAbout(s.position,r,e.position,s.position)}},r.setVelocity=function(e,t){var n=e.deltaTime/r._baseDelta;e.positionPrev.x=e.position.x-t.x*n,e.positionPrev.y=e.position.y-t.y*n,e.velocity.x=(e.position.x-e.positionPrev.x)/n,e.velocity.y=(e.position.y-e.positionPrev.y)/n,e.speed=i.magnitude(e.velocity)},r.getVelocity=function(e){var t=r._baseDelta/e.deltaTime;return{x:(e.position.x-e.positionPrev.x)*t,y:(e.position.y-e.positionPrev.y)*t}},r.getSpeed=function(e){return i.magnitude(r.getVelocity(e))},r.setSpeed=function(e,t){r.setVelocity(e,i.mult(i.normalise(r.getVelocity(e)),t))},r.setAngularVelocity=function(e,t){var n=e.deltaTime/r._baseDelta;e.anglePrev=e.angle-t*n,e.angularVelocity=(e.angle-e.anglePrev)/n,e.angularSpeed=Math.abs(e.angularVelocity)},r.getAngularVelocity=function(e){return(e.angle-e.anglePrev)*r._baseDelta/e.deltaTime},r.getAngularSpeed=function(e){return Math.abs(r.getAngularVelocity(e))},r.setAngularSpeed=function(e,t){r.setAngularVelocity(e,s.sign(r.getAngularVelocity(e))*t)},r.translate=function(e,t,n){r.setPosition(e,i.add(e.position,t),n)},r.rotate=function(e,t,n,o){if(n){var i=Math.cos(t),a=Math.sin(t),s=e.position.x-n.x,c=e.position.y-n.y;r.setPosition(e,{x:n.x+(s*i-c*a),y:n.y+(s*a+c*i)},o),r.setAngle(e,e.angle+t,o)}else r.setAngle(e,e.angle+t,o)},r.scale=function(e,t,n,i){var a=0,s=0;i=i||e.position;for(var d=0;d0&&(a+=u.area,s+=u.inertia),u.position.x=i.x+(u.position.x-i.x)*t,u.position.y=i.y+(u.position.y-i.y)*n,c.update(u.bounds,u.vertices,e.velocity)}e.parts.length>1&&(e.area=a,e.isStatic||(r.setMass(e,e.density*a),r.setInertia(e,s))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},r.update=function(e,t){var n=(t=(void 0!==t?t:1e3/60)*e.timeScale)*t,a=r._timeCorrection?t/(e.deltaTime||t):1,d=1-e.frictionAir*(t/s._baseDelta),u=(e.position.x-e.positionPrev.x)*a,p=(e.position.y-e.positionPrev.y)*a;e.velocity.x=u*d+e.force.x/e.mass*n,e.velocity.y=p*d+e.force.y/e.mass*n,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.deltaTime=t,e.angularVelocity=(e.angle-e.anglePrev)*d*a+e.torque/e.inertia*n,e.anglePrev=e.angle,e.angle+=e.angularVelocity;for(var m=0;m0&&(f.position.x+=e.velocity.x,f.position.y+=e.velocity.y),0!==e.angularVelocity&&(o.rotate(f.vertices,e.angularVelocity,e.position),l.rotate(f.axes,e.angularVelocity),m>0&&i.rotateAbout(f.position,e.angularVelocity,e.position,f.position)),c.update(f.bounds,f.vertices,e.velocity)}},r.updateVelocities=function(e){var t=r._baseDelta/e.deltaTime,n=e.velocity;n.x=(e.position.x-e.positionPrev.x)*t,n.y=(e.position.y-e.positionPrev.y)*t,e.speed=Math.sqrt(n.x*n.x+n.y*n.y),e.angularVelocity=(e.angle-e.anglePrev)*t,e.angularSpeed=Math.abs(e.angularVelocity)},r.applyForce=function(e,t,n){var r=t.x-e.position.x,o=t.y-e.position.y;e.force.x+=n.x,e.force.y+=n.y,e.torque+=r*n.y-o*n.x},r._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n=0.14.2",e.exports=r.sleeping},LS1c:function(e,t,n){var r=r||{};r.wreckingBall=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Constraint,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(400,175,5,10,0,0,(function(e,t){return c.rectangle(e,t,40,40)}));a.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=c.circle(100,400,50,{density:.04,frictionAir:.005});a.add(d,f),a.add(d,s.create({pointA:{x:300,y:100},bodyB:f}));var v=i.create(u.canvas),g=o.create(l,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(d,g),u.mouse=v,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.wreckingBall.title="Wrecking Ball",r.wreckingBall.for=">=0.14.2",e.exports=r.wreckingBall},Me0I:function(e,t,n){var r=r||{};r.car=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=(Matter.Composites,Matter.MouseConstraint),i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0}});t.run(d);var u=n.create();n.run(u,c),a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0})]);var p=.9;a.add(l,r.car.car(150,100,150*p,30*p,30*p)),p=.8,a.add(l,r.car.car(350,300,150*p,30*p,30*p)),a.add(l,[s.rectangle(200,150,400,20,{isStatic:!0,angle:.06*Math.PI,render:{fillStyle:"#060a19"}}),s.rectangle(500,350,650,20,{isStatic:!0,angle:.06*-Math.PI,render:{fillStyle:"#060a19"}}),s.rectangle(300,560,600,20,{isStatic:!0,angle:.04*Math.PI,render:{fillStyle:"#060a19"}})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.car.title="Car",r.car.for=">=0.14.2",r.car.car=function(e,t,n,r,o){var i=Matter.Body,a=Matter.Bodies,s=Matter.Composite,c=Matter.Constraint,l=i.nextGroup(!0),d=.5*-n+20,u=.5*n-20,p=s.create({label:"Car"}),m=a.rectangle(e,t,n,r,{collisionFilter:{group:l},chamfer:{radius:.5*r},density:2e-4}),f=a.circle(e+d,t+0,o,{collisionFilter:{group:l},friction:.8}),v=a.circle(e+u,t+0,o,{collisionFilter:{group:l},friction:.8}),g=c.create({bodyB:m,pointB:{x:d,y:0},bodyA:f,stiffness:1,length:0}),y=c.create({bodyB:m,pointB:{x:u,y:0},bodyA:v,stiffness:1,length:0});return s.addBody(p,m),s.addBody(p,f),s.addBody(p,v),s.addConstraint(p,g),s.addConstraint(p,y),p},e.exports=r.car},MhOg:function(e,t,n){var r=r||{};r.views=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Events,o=Matter.Composites,i=Matter.Common,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Composite,l=Matter.Vector,d=Matter.Bounds,u=Matter.Bodies,p=e.create(),m=p.world,f=t.create({element:document.body,engine:p,options:{width:800,height:600,hasBounds:!0,showAngleIndicator:!0}});t.run(f);var v=n.create();n.run(v,p);var g=s.create(f.canvas),y=a.create(p,{mouse:g,constraint:{stiffness:.2,render:{visible:!1}}});c.add(m,y),f.mouse=g;var x=o.stack(20,20,10,4,0,0,(function(e,t){switch(Math.round(i.random(0,1))){case 0:return i.random()<.8?u.rectangle(e,t,i.random(20,50),i.random(20,50)):u.rectangle(e,t,i.random(80,120),i.random(20,30));case 1:var n=Math.round(i.random(1,8));return n=3===n?4:n,u.polygon(e,t,n,i.random(20,50))}}));c.add(m,[x,u.rectangle(400,0,800,50,{isStatic:!0}),u.rectangle(400,600,800,50,{isStatic:!0}),u.rectangle(800,300,50,600,{isStatic:!0}),u.rectangle(0,300,50,600,{isStatic:!0})]);var h={x:.5*f.options.width,y:.5*f.options.height},b={x:-300,y:-300},M={x:1100,y:900},S=1,w={x:1,y:1};return r.on(f,"beforeRender",(function(){p.world;var e,t=y.mouse,n=-.1*t.wheelDelta;0!==n&&(n<0&&w.x>=.6||n>0&&w.x<=1.4)&&(S+=n),Math.abs(w.x-S)>.01&&(n=.2*(S-w.x),w.x+=n,w.y+=n,f.bounds.max.x=f.bounds.min.x+f.options.width*w.x,f.bounds.max.y=f.bounds.min.y+f.options.height*w.y,e={x:f.options.width*n*-.5,y:f.options.height*n*-.5},d.translate(f.bounds,e),s.setScale(t,w),s.setOffset(t,f.bounds.min));var r=l.sub(t.absolute,h),o=l.magnitude(r);if(o>50){var i=l.normalise(r),a=Math.min(10,2e-4*Math.pow(o-50,2));e=l.mult(i,a),f.bounds.min.x+e.xM.x&&(e.x=M.x-f.bounds.max.x),f.bounds.min.y+e.yM.y&&(e.y=M.y-f.bounds.max.y),d.translate(f.bounds,e),s.setOffset(t,f.bounds.min)}})),{engine:p,runner:v,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(v)}}},r.views.title="Views",r.views.for=">=0.14.2",e.exports=r.views},NDQ1:function(e,t,n){var r={};e.exports=r;var o=n("m6Dm"),i=n("Z/YF"),a=n("Tgw/"),s=n("oT59"),c=n("0kzT");r.collides=function(e,t){for(var n=[],r=t.length,o=e.bounds,s=i.collides,c=a.overlaps,l=0;ld.bounds.max.x||m.bounds.max.yd.bounds.max.y))){var f=r._getRegion(e,m);if(!m.region||f.id!==m.region.id||o){m.region&&!o||(m.region=f);var v=r._regionUnion(f,m.region);for(a=v.startCol;a<=v.endCol;a++)for(s=v.startRow;s<=v.endRow;s++){c=u[l=r._getBucketId(a,s)];var g=a>=f.startCol&&a<=f.endCol&&s>=f.startRow&&s<=f.endRow,y=a>=m.region.startCol&&a<=m.region.endCol&&s>=m.region.startRow&&s<=m.region.endRow;!g&&y&&y&&c&&r._bucketRemoveBody(e,c,m),(m.region===f||g&&!y||o)&&(c||(c=r._createBucket(u,l)),r._bucketAddBody(e,c,m))}m.region=f,p=!0}}}p&&(e.pairsList=r._createActivePairsList(e))},a(r,"update","Grid.update ➤ replaced by Matter.Detector"),r.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},a(r,"clear","Grid.clear ➤ replaced by Matter.Detector"),r._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),o=Math.max(e.endCol,t.endCol),i=Math.min(e.startRow,t.startRow),a=Math.max(e.endRow,t.endRow);return r._createRegion(n,o,i,a)},r._getRegion=function(e,t){var n=t.bounds,o=Math.floor(n.min.x/e.bucketWidth),i=Math.floor(n.max.x/e.bucketWidth),a=Math.floor(n.min.y/e.bucketHeight),s=Math.floor(n.max.y/e.bucketHeight);return r._createRegion(o,i,a,s)},r._createRegion=function(e,t,n,r){return{id:e+","+t+","+n+","+r,startCol:e,endCol:t,startRow:n,endRow:r}},r._getBucketId=function(e,t){return"C"+e+"R"+t},r._createBucket=function(e,t){return e[t]=[]},r._bucketAddBody=function(e,t,n){var r,i=e.pairs,a=o.id,s=t.length;for(r=0;r0?s.push(t):delete r[o[n]];return s}},"Tgw/":function(e,t){var n={};e.exports=n,n.create=function(e){var t={min:{x:0,y:0},max:{x:0,y:0}};return e&&n.update(t,e),t},n.update=function(e,t,n){e.min.x=1/0,e.max.x=-1/0,e.min.y=1/0,e.max.y=-1/0;for(var r=0;re.max.x&&(e.max.x=o.x),o.xe.max.y&&(e.max.y=o.y),o.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,r=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+r}},VZUp:function(e,t,n){var r=r||{};r.manipulation=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Events,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAxes:!0,showCollisions:!0,showConvexHulls:!0}});t.run(u);var p=n.create();n.run(p,l);var m=c.rectangle(100,300,50,50,{isStatic:!0,render:{fillStyle:"#060a19"}}),f=c.rectangle(200,200,50,50),v=c.rectangle(300,200,50,50),g=c.rectangle(400,200,50,50),y=c.rectangle(550,200,50,50),x=c.rectangle(700,200,50,50),h=c.circle(400,100,25,{render:{fillStyle:"#060a19"}}),b=c.rectangle(600,200,96,40,{render:{fillStyle:"#060a19"}}),M=c.rectangle(660,200,40,152,{render:{fillStyle:"#060a19"}}),S=r.create({parts:[b,M],isStatic:!0});r.setPosition(S,{x:600,y:300}),s.add(d,[m,f,v,g,y,x,h,S]),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var w=0,C=.6;o.on(l,"beforeUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;C>0&&(r.scale(x,1+C*t,1+C*t),y.vertices[0].x-=.2*t,y.vertices[0].y-=.2*t,y.vertices[1].x+=.2*t,y.vertices[1].y-=.2*t,r.setVertices(y,y.vertices));var n=300+100*Math.sin(.002*l.timing.timestamp);"0.18.0"===Matter.version&&(r.setVelocity(m,{x:0,y:n-m.position.y}),r.setVelocity(S,{x:0,y:n-S.position.y}),r.setAngularVelocity(S,1*Math.PI*t)),r.setPosition(m,{x:100,y:n},!0),r.setPosition(S,{x:600,y:n},!0),r.rotate(S,1*Math.PI*t,null,!0),l.timing.timestamp>=800&&r.setStatic(h,!0),l.timing.timestamp-w>=1500&&(r.setVelocity(f,{x:0,y:-10}),r.setAngle(v,.26*-Math.PI),r.setAngularVelocity(g,.2),C=0,w=l.timing.timestamp)}));var A=a.create(u.canvas),B=i.create(l,{mouse:A,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,B),u.mouse=A,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.manipulation.title="Manipulation",r.manipulation.for=">=0.14.2",e.exports=r.manipulation},Vyp4:function(e,t,n){var r=r||{};r.remove=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=Matter.Events,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0}});t.run(p);var m=n.create();n.run(m,d);var f=null,v=0,g=function(){return r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}))};l.on(d,"afterUpdate",(function(e){f&&e.timestamp-v<800||(v=e.timestamp,f&&s.remove(u,f),f=g(),s.add(u,f))})),s.add(u,g()),s.add(u,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var y=a.create(p.canvas),x=i.create(d,{mouse:y,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(u,x),p.mouse=y,t.lookAt(p,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.remove.title="Composite Remove",r.remove.for=">=0.14.2",e.exports=r.remove},"Z/YF":function(e,t,n){var r={};e.exports=r;var o,i,a,s=n("0kzT"),c=n("t8gT");o=[],i={overlap:0,axis:null},a={overlap:0,axis:null},r.create=function(e,t){return{pair:null,collided:!1,bodyA:e,bodyB:t,parentA:e.parent,parentB:t.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},r.collides=function(e,t,n){if(r._overlapAxes(i,e.vertices,t.vertices,e.axes),i.overlap<=0)return null;if(r._overlapAxes(a,t.vertices,e.vertices,t.axes),a.overlap<=0)return null;var o,l,d=n&&n.table[c.id(e,t)];d?o=d.collision:((o=r.create(e,t)).collided=!0,o.bodyA=e.idC?C=s:sA?A=s:so?o=a:a=0.14.2",e.exports=r.restitution},ZUN1:function(e,t,n){var r=r||{};r.chains=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Composite,i=Matter.Composites,a=Matter.Constraint,s=Matter.MouseConstraint,c=Matter.Mouse,l=Matter.Bodies,d=e.create(),u=d.world,p=t.create({element:document.body,engine:d,options:{width:800,height:600,showAngleIndicator:!0,showCollisions:!0,showVelocity:!0}});t.run(p);var m=n.create();n.run(m,d);var f=r.nextGroup(!0),v=i.stack(100,50,8,1,10,10,(function(e,t){return l.rectangle(e,t,50,20,{collisionFilter:{group:f}})}));i.chain(v,.5,0,-.5,0,{stiffness:.8,length:2,render:{type:"line"}}),o.add(v,a.create({bodyB:v.bodies[0],pointB:{x:-25,y:0},pointA:{x:v.bodies[0].position.x,y:v.bodies[0].position.y},stiffness:.5})),f=r.nextGroup(!0);var g=i.stack(350,50,10,1,10,10,(function(e,t){return l.circle(e,t,20,{collisionFilter:{group:f}})}));i.chain(g,.5,0,-.5,0,{stiffness:.8,length:2,render:{type:"line"}}),o.add(g,a.create({bodyB:g.bodies[0],pointB:{x:-20,y:0},pointA:{x:g.bodies[0].position.x,y:g.bodies[0].position.y},stiffness:.5})),f=r.nextGroup(!0);var y=i.stack(600,50,13,1,10,10,(function(e,t){return l.rectangle(e-20,t,50,20,{collisionFilter:{group:f},chamfer:5})}));i.chain(y,.3,0,-.3,0,{stiffness:1,length:0}),o.add(y,a.create({bodyB:y.bodies[0],pointB:{x:-20,y:0},pointA:{x:y.bodies[0].position.x,y:y.bodies[0].position.y},stiffness:.5})),o.add(u,[v,g,y,l.rectangle(400,600,1200,50.5,{isStatic:!0})]);var x=c.create(p.canvas),h=s.create(d,{mouse:x,constraint:{stiffness:.2,render:{visible:!1}}});return o.add(u,h),p.mouse=x,t.lookAt(p,{min:{x:0,y:0},max:{x:700,y:600}}),{engine:d,runner:m,render:p,canvas:p.canvas,stop:function(){Matter.Render.stop(p),Matter.Runner.stop(m)}}},r.chains.title="Chains",r.chains.for=">=0.14.2",e.exports=r.chains},Zo9v:function(e,t,n){var r=r||{};r.collisionFiltering=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composite,o=Matter.Composites,i=(Matter.Common,Matter.MouseConstraint),a=Matter.Mouse,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,wireframes:!1}});t.run(d);var u=n.create();n.run(u,c);var p="#f55a3c",m="#063e7b",f="#f5d259";r.add(l,s.rectangle(400,600,900,50,{isStatic:!0,render:{fillStyle:"transparent",lineWidth:1}})),r.add(l,o.stack(275,100,5,9,10,10,(function(e,t,n,r){var o=2,i=p;return r>5?(o=8,i=m):r>2&&(o=4,i=f),s.circle(e,t,20,{collisionFilter:{category:o},render:{strokeStyle:i,fillStyle:"transparent",lineWidth:1}})}))),r.add(l,s.circle(310,40,30,{collisionFilter:{mask:5},render:{fillStyle:f}})),r.add(l,s.circle(400,40,30,{collisionFilter:{mask:3},render:{fillStyle:p}})),r.add(l,s.circle(480,40,30,{collisionFilter:{mask:9},render:{fillStyle:m}}));var v=a.create(d.canvas),g=i.create(c,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return r.add(l,g),d.mouse=v,g.collisionFilter.mask=13,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.collisionFiltering.title="Collision Filtering",r.collisionFiltering.for=">=0.14.2",e.exports=r.collisionFiltering},ZpbE:function(e,t,n){var r=r||{};r.stack=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(200,380.75,10,5,0,0,(function(e,t){return s.rectangle(e,t,40,40)}));a.add(l,[p,s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0}),s.rectangle(400,606,800,50.5,{isStatic:!0})]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.stack.title="Stack",r.stack.for=">=0.14.2",e.exports=r.stack},"a+ms":function(e,t,n){var r=n("akk5"),o=n("lniP"),i=n("lniP");e.exports={compare:function(e,t){var n=r.Demo.create({toolbar:{title:"matter-js ・ "+(t?"dev":"")+" ・ comparing to "+i.version,url:"https://github.com/liabru/matter-js",reset:!0,source:!0,inspector:!1,tools:!1,fullscreen:!0,exampleSelect:!0},tools:{inspector:!1,gui:!1},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!0,startExample:!1,examples:e}),a=r.Demo.create({toolbar:{title:"matter-js-compare-build",reset:!1,source:!1,inspector:!1,tools:!1,fullscreen:!1,exampleSelect:!1},tools:{inspector:!1,gui:!1},inline:!1,preventZoom:!0,resetOnOrientation:!0,routing:!1,startExample:!1,examples:e.map((function(e){return Matter.Common.extend({},e)}))});i.Runner.run=function(){},i.Render.run=function(){},o.Runner._tick=o.Runner.tick,o.Render._world=o.Render.world,i.Mouse._setElement=i.Mouse.setElement,r.Demo._setExample=r.Demo.setExample,r.Demo.setExample=function(e,t){i.Common._nextId=i.Common._seed=0,o.Common._nextId=o.Common._seed=0,i.Plugin._registry=o.Plugin._registry,i.use.apply(null,o.used),window.Matter=o,r.Demo._setExample(n,n.examples.find((function(e){return e.name===t.name})));var s=parseFloat(window.location.search.split("=")[1]),c=0;o.Runner.tick=function(e,t,n){if(-1!==c){if(c>=s)return console.info("Demo.Compare: ran "+c+" ticks, timestamp is now "+t.timing.timestamp.toFixed(2)),void(c=-1);c+=1;var r=a.example.instance;return e.isFixed=r.runner.isFixed=!0,e.delta=r.runner.delta=1e3/60,window.Matter=i,i.Runner.tick(r.runner,r.engine,n),window.Matter=o,o.Runner._tick(e,t,n)}},o.Render.world=function(e){return window.Matter=i,i.Render.world(a.example.instance.render),window.Matter=o,o.Render._world(e)},i.Mouse.setElement=function(e){return i.Mouse._setElement(e,n.example.instance.render.canvas)},window.Matter=i,r.Demo._setExample(a,a.examples.find((function(e){return e.name===t.name}))),window.Matter=o},r.Demo._reset=r.Demo.reset,r.Demo.reset=function(e){i.Common._nextId=i.Common._seed=0,o.Common._nextId=o.Common._seed=0,window.Matter=i,r.Demo._reset(a),window.Matter=o,r.Demo._reset(n)},document.body.appendChild(n.dom.root),document.body.appendChild(a.dom.root),r.Demo.start(n),document.title="Matter.js Compare"+(t?" ・ Dev":""),console.info("Demo.Compare: matter-js@"+o.version+" with matter-js@"+i.version)}}},a3OZ:function(e,t,n){var r=r||{};r.compositeManipulation=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Events,o=Matter.Composite,i=Matter.Composites,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l),o.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var m=i.stack(200,200,4,4,0,0,(function(e,t){return c.rectangle(e,t,40,40)}));o.add(d,m),l.gravity.y=0,r.on(l,"afterUpdate",(function(e){var t=l.timing.timestamp,n=(e.delta||1e3/60)/1e3;o.translate(m,{x:10*Math.sin(.001*t)*n,y:0}),o.rotate(m,.75*Math.sin(.001*t)*n,{x:300,y:300});var r=1+.75*Math.sin(.001*t)*n;o.scale(m,r,r,{x:300,y:300})}));var f=s.create(u.canvas),v=a.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return o.add(d,v),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.compositeManipulation.title="Composite Manipulation",r.compositeManipulation.for=">0.16.1",e.exports=r.compositeManipulation},c7us:function(e,t,n){var r=r||{};r.ragdoll=function(){var e=Matter.Engine,t=Matter.Events,n=Matter.Render,o=Matter.Runner,i=Matter.Body,a=Matter.Common,s=Matter.Composite,c=Matter.Composites,l=Matter.MouseConstraint,d=Matter.Mouse,u=Matter.Bodies,p=e.create(),m=p.world,f=n.create({element:document.body,engine:p,options:{width:800,height:600,showAngleIndicator:!0}});n.run(f);var v=o.create();o.run(v,p);for(var g=(f.bounds.max.y-f.bounds.min.y)/50,y=c.stack(0,0,g+2,1,0,0,(function(e,t,n){return u.rectangle(e-50,t+50*n,100,1e3,{isStatic:!0,render:{fillStyle:"#060a19",strokeStyle:"#ffffff",lineWidth:1}})})),x=c.stack(300,0,15,3,10,10,(function(e,t,n){var r=Math.round(a.random(1,8)),o={render:{fillStyle:a.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"])}};switch(Math.round(a.random(0,1))){case 0:return a.random()<.8?u.rectangle(e,t,a.random(25,50),a.random(25,50),o):u.rectangle(e,t,a.random(80,120),a.random(25,30),o);case 1:return u.polygon(e,t,r,a.random(25,50),o)}})),h=s.create(),b=0;b<1;b+=1){var M=r.ragdoll.ragdoll(200,-1e3*b,1.3);s.add(h,M)}s.add(m,[y,x,h]);var S=1,w=a.now();t.on(p,"afterUpdate",(function(e){var t=(e.delta||1e3/60)/1e3;-1===C.button?p.timing.timeScale+=3*(S-p.timing.timeScale)*t:p.timing.timeScale=1,a.now()-w>=2e3&&(S=S<1?1:.05,w=a.now());for(var n=0;nf.bounds.max.y+100&&s.translate(o,{x:.9*-c.min.x,y:-f.bounds.max.y-400})}for(n=0;nf.bounds.max.y+100&&i.translate(r,{x:-c.min.x,y:-f.bounds.max.y-300})}}));var C=d.create(f.canvas),A=l.create(p,{mouse:C,constraint:{stiffness:.6,length:0,angularStiffness:0,render:{visible:!1}}});return s.add(m,A),f.mouse=C,n.lookAt(f,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:p,runner:v,render:f,canvas:f.canvas,stop:function(){Matter.Render.stop(f),Matter.Runner.stop(v)}}},r.ragdoll.ragdoll=function(e,t,n,r){n=void 0===n?1:n;var o=Matter.Body,i=Matter.Bodies,a=Matter.Constraint,s=Matter.Composite,c=Matter.Common,l=c.extend({label:"head",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:[15*n,15*n,15*n,15*n]},render:{fillStyle:"#FFBC42"}},r),d=c.extend({label:"chest",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:[20*n,20*n,26*n,26*n]},render:{fillStyle:"#E0A423"}},r),u=c.extend({label:"left-arm",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),p=c.extend({},u,{render:{fillStyle:"#E59B12"}}),m=c.extend({label:"right-arm",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),f=c.extend({},m,{render:{fillStyle:"#E59B12"}}),v=c.extend({label:"left-leg",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),g=c.extend({},v,{render:{fillStyle:"#E59B12"}}),y=c.extend({label:"right-leg",collisionFilter:{group:o.nextGroup(!0)},chamfer:{radius:10*n},render:{fillStyle:"#FFBC42"}},r),x=c.extend({},y,{render:{fillStyle:"#E59B12"}}),h=i.rectangle(e,t-60*n,34*n,40*n,l),b=i.rectangle(e,t,55*n,80*n,d),M=i.rectangle(e+39*n,t-15*n,20*n,40*n,m),S=i.rectangle(e+39*n,t+25*n,20*n,60*n,f),w=i.rectangle(e-39*n,t-15*n,20*n,40*n,u),C=i.rectangle(e-39*n,t+25*n,20*n,60*n,p),A=i.rectangle(e-20*n,t+57*n,20*n,40*n,v),B=i.rectangle(e-20*n,t+97*n,20*n,60*n,g),k=i.rectangle(e+20*n,t+57*n,20*n,40*n,y),R=i.rectangle(e+20*n,t+97*n,20*n,60*n,x),P=a.create({bodyA:b,pointA:{x:24*n,y:-23*n},pointB:{x:0,y:-8*n},bodyB:M,stiffness:.6,render:{visible:!1}}),I=a.create({bodyA:b,pointA:{x:-24*n,y:-23*n},pointB:{x:0,y:-8*n},bodyB:w,stiffness:.6,render:{visible:!1}}),_=a.create({bodyA:b,pointA:{x:-10*n,y:30*n},pointB:{x:0,y:-10*n},bodyB:A,stiffness:.6,render:{visible:!1}}),E=a.create({bodyA:b,pointA:{x:10*n,y:30*n},pointB:{x:0,y:-10*n},bodyB:k,stiffness:.6,render:{visible:!1}}),T=a.create({bodyA:M,bodyB:S,pointA:{x:0,y:15*n},pointB:{x:0,y:-25*n},stiffness:.6,render:{visible:!1}}),F=a.create({bodyA:w,bodyB:C,pointA:{x:0,y:15*n},pointB:{x:0,y:-25*n},stiffness:.6,render:{visible:!1}}),V=a.create({bodyA:A,bodyB:B,pointA:{x:0,y:20*n},pointB:{x:0,y:-20*n},stiffness:.6,render:{visible:!1}}),D=a.create({bodyA:k,bodyB:R,pointA:{x:0,y:20*n},pointB:{x:0,y:-20*n},stiffness:.6,render:{visible:!1}}),L=a.create({bodyA:h,pointA:{x:0,y:25*n},pointB:{x:0,y:-35*n},bodyB:b,stiffness:.6,render:{visible:!1}}),O=a.create({bodyA:B,bodyB:R,stiffness:.01,render:{visible:!1}});return s.create({bodies:[b,h,C,w,S,M,B,R,A,k],constraints:[F,T,I,P,L,V,D,_,E,O]})},r.ragdoll.title="Ragdoll",r.ragdoll.for=">=0.14.2",e.exports=r.ragdoll},djnZ:function(e,t,n){var r=r||{};r.compound=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Body,o=Matter.Constraint,i=Matter.Composite,a=Matter.MouseConstraint,s=Matter.Mouse,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAxes:!0,showConvexHulls:!0}});t.run(u);var p=n.create();n.run(p,l);var m=200,f=200,v=200,g=c.rectangle(f,v,m,m/5),y=c.rectangle(f,v,m/5,m,{render:g.render}),x=r.create({parts:[g,y]});m=150,f=400,v=300;var h=c.circle(f,v,30),b=c.circle(f+m,v,30),M=c.circle(f+m,v+m,30),S=c.circle(f,v+m,30),w=r.create({parts:[h,b,M,S]}),C=o.create({pointA:{x:400,y:100},bodyB:w,pointB:{x:0,y:0}});i.add(d,[x,w,C,c.rectangle(400,600,800,50.5,{isStatic:!0})]);var A=s.create(u.canvas),B=a.create(l,{mouse:A,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(d,B),u.mouse=A,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.compound.title="Compound Bodies",r.compound.for=">=0.14.2",e.exports=r.compound},elWf:function(e,t,n){var r=r||{};r.rounded=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.MouseConstraint,o=Matter.Mouse,i=Matter.Composite,a=Matter.Bodies,s=e.create(),c=s.world,l=t.create({element:document.body,engine:s,options:{width:800,height:600,showAxes:!0}});t.run(l);var d=n.create();n.run(d,s),i.add(c,[a.rectangle(400,0,800,50,{isStatic:!0}),a.rectangle(400,600,800,50,{isStatic:!0}),a.rectangle(800,300,50,600,{isStatic:!0}),a.rectangle(0,300,50,600,{isStatic:!0})]),i.add(c,[a.rectangle(200,200,100,100,{chamfer:{radius:20}}),a.rectangle(300,200,100,100,{chamfer:{radius:[90,0,0,0]}}),a.rectangle(400,200,200,200,{chamfer:{radius:[150,20,40,20]}}),a.rectangle(200,200,200,200,{chamfer:{radius:[150,20,150,20]}}),a.rectangle(300,200,200,50,{chamfer:{radius:[25,25,0,0]}}),a.polygon(200,100,8,80,{chamfer:{radius:30}}),a.polygon(300,100,5,80,{chamfer:{radius:[10,40,20,40,10]}}),a.polygon(400,200,3,50,{chamfer:{radius:[20,0,20]}})]);var u=o.create(l.canvas),p=r.create(s,{mouse:u,constraint:{stiffness:.2,render:{visible:!1}}});return i.add(c,p),l.mouse=u,t.lookAt(l,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:s,runner:d,render:l,canvas:l.canvas,stop:function(){Matter.Render.stop(l),Matter.Runner.stop(d)}}},r.rounded.title="Rounded Corners (Chamfering)",r.rounded.for=">=0.14.2",e.exports=r.rounded},ga9t:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("m6Dm"),a=n("yw0d"),s=n("Tgw/"),c=n("JKEF"),l=n("571F");r._warming=.4,r._torqueDampen=1,r._minLength=1e-6,r.create=function(e){var t=e;t.bodyA&&!t.pointA&&(t.pointA={x:0,y:0}),t.bodyB&&!t.pointB&&(t.pointB={x:0,y:0});var n=t.bodyA?i.add(t.bodyA.position,t.pointA):t.pointA,r=t.bodyB?i.add(t.bodyB.position,t.pointB):t.pointB,o=i.magnitude(i.sub(n,r));t.length=void 0!==t.length?t.length:o,t.id=t.id||l.nextId(),t.label=t.label||"Constraint",t.type="constraint",t.stiffness=t.stiffness||(t.length>0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(a.type="pin",a.anchors=!1):t.stiffness<.9&&(a.type="spring"),t.render=l.extend(a,t.render),t},r.preSolveAll=function(e){for(var t=0;t=1||0===e.length?e.stiffness*t:e.stiffness*t*t,h=e.damping*t,b=i.mult(d,y*x),M=(n?n.inverseMass:0)+(o?o.inverseMass:0),S=M+((n?n.inverseInertia:0)+(o?o.inverseInertia:0));if(h>0){var w=i.create();f=i.div(d,u),g=i.sub(o&&i.sub(o.position,o.positionPrev)||w,n&&i.sub(n.position,n.positionPrev)||w),v=i.dot(f,g)}n&&!n.isStatic&&(m=n.inverseMass/M,n.constraintImpulse.x-=b.x*m,n.constraintImpulse.y-=b.y*m,n.position.x-=b.x*m,n.position.y-=b.y*m,h>0&&(n.positionPrev.x-=h*f.x*v*m,n.positionPrev.y-=h*f.y*v*m),p=i.cross(a,b)/S*r._torqueDampen*n.inverseInertia*(1-e.angularStiffness),n.constraintImpulse.angle-=p,n.angle-=p),o&&!o.isStatic&&(m=o.inverseMass/M,o.constraintImpulse.x+=b.x*m,o.constraintImpulse.y+=b.y*m,o.position.x+=b.x*m,o.position.y+=b.y*m,h>0&&(o.positionPrev.x+=h*f.x*v*m,o.positionPrev.y+=h*f.y*v*m),p=i.cross(s,b)/S*r._torqueDampen*o.inverseInertia*(1-e.angularStiffness),o.constraintImpulse.angle+=p,o.angle+=p)}}},r.postSolveAll=function(e){for(var t=0;t0&&(u.position.x+=l.x,u.position.y+=l.y),0!==l.angle&&(o.rotate(u.vertices,l.angle,n.position),c.rotate(u.axes,l.angle),d>0&&i.rotateAbout(u.position,l.angle,n.position,u.position)),s.update(u.bounds,u.vertices,n.velocity)}l.angle*=r._warming,l.x*=r._warming,l.y*=r._warming}}},r.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+(e.pointA?e.pointA.x:0),y:(e.bodyA?e.bodyA.position.y:0)+(e.pointA?e.pointA.y:0)}},r.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+(e.pointB?e.pointB.x:0),y:(e.bodyB?e.bodyB.position.y:0)+(e.pointB?e.pointB.y:0)}}},ibhy:function(e,t,n){var r=r||{};r.mixed=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}));s.add(d,m),s.add(d,[c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=a.create(u.canvas),v=i.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.mixed.title="Mixed Shapes",r.mixed.for=">=0.14.2",e.exports=r.mixed},"ix+/":function(e,t,n){var r={};e.exports=r;var o=n("571F"),i=n("Z/YF");r.create=function(e){return o.extend({bodies:[],pairs:null},e)},r.setBodies=function(e,t){e.bodies=t.slice(0)},r.clear=function(e){e.bodies=[]},r.collisions=function(e){var t,n,o=[],a=e.pairs,s=e.bodies,c=s.length,l=r.canCollide,d=i.collides;for(s.sort(r._compareBoundsX),t=0;tm)break;if(!(fk.max.y)&&(!g||!h.isStatic&&!h.isSleeping)&&l(u.collisionFilter,h.collisionFilter)){var b=h.parts.length;if(x&&1===b)(A=d(u,h,a))&&o.push(A);else for(var M=b>1?1:0,S=y>1?1:0;Sk.max.x||p.max.xk.max.y||(A=d(w,B,a))&&o.push(A)}}}}return o},r.canCollide=function(e,t){return e.group===t.group&&0!==e.group?e.group>0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)},r._compareBoundsX=function(e,t){return e.bounds.min.x-t.bounds.min.x}},k7Ch:function(e,t,n){var r=r||{};r.gyro=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.Common,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.Composite,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showAngleIndicator:!0}});t.run(u);var p=n.create();n.run(p,l);var m=r.stack(20,20,10,5,0,0,(function(e,t){var n=Math.round(o.random(1,8)),r=null;switch(n>2&&o.random()>.7&&(r={radius:10}),Math.round(o.random(0,1))){case 0:return o.random()<.8?c.rectangle(e,t,o.random(25,50),o.random(25,50),{chamfer:r}):c.rectangle(e,t,o.random(80,120),o.random(25,30),{chamfer:r});case 1:return c.polygon(e,t,n,o.random(25,50),{chamfer:r})}}));if(s.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]),"undefined"!=typeof window){var f=function(e){var t=void 0!==window.orientation?window.orientation:0,n=l.gravity;0===t?(n.x=o.clamp(e.gamma,-90,90)/90,n.y=o.clamp(e.beta,-90,90)/90):180===t?(n.x=o.clamp(e.gamma,-90,90)/90,n.y=o.clamp(-e.beta,-90,90)/90):90===t?(n.x=o.clamp(e.beta,-90,90)/90,n.y=o.clamp(-e.gamma,-90,90)/90):-90===t&&(n.x=o.clamp(-e.beta,-90,90)/90,n.y=o.clamp(e.gamma,-90,90)/90)};window.addEventListener("deviceorientation",f)}var v=a.create(u.canvas),g=i.create(l,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,g),u.mouse=v,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p),"undefined"!=typeof window&&window.removeEventListener("deviceorientation",f)}}},r.gyro.title="Gyroscope",r.gyro.for=">=0.14.2",e.exports=r.gyro},lWug:function(e,t,n){var r={};e.exports=r;var o=n("IbIC"),i=n("571F"),a=n("wAS/"),s=n("Tgw/"),c=n("yTB+"),l=n("m6Dm"),d=n("I5nt");!function(){var e,t;"undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout((function(){e(i.now())}),1e3/60)},t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),r._goodFps=30,r._goodDelta=1e3/60,r.create=function(e){var t={engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!e.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},n=i.extend(t,e);return n.canvas&&(n.canvas.width=n.options.width||n.canvas.width,n.canvas.height=n.options.height||n.canvas.height),n.mouse=e.mouse,n.engine=e.engine,n.canvas=n.canvas||p(n.options.width,n.options.height),n.context=n.canvas.getContext("2d"),n.textures={},n.bounds=n.bounds||{min:{x:0,y:0},max:{x:n.canvas.width,y:n.canvas.height}},n.controller=r,n.options.showBroadphase=!1,1!==n.options.pixelRatio&&r.setPixelRatio(n,n.options.pixelRatio),i.isElement(n.element)&&n.element.appendChild(n.canvas),n},r.run=function(t){!function o(i){t.frameRequestId=e(o),n(t,i),r.world(t,i),(t.options.showStats||t.options.showDebug)&&r.stats(t,t.context,i),(t.options.showPerformance||t.options.showDebug)&&r.performance(t,t.context,i)}()},r.stop=function(e){t(e.frameRequestId)},r.setPixelRatio=function(e,t){var n=e.options,r=e.canvas;"auto"===t&&(t=m(r)),n.pixelRatio=t,r.setAttribute("data-pixel-ratio",t),r.width=n.width*t,r.height=n.height*t,r.style.width=n.width+"px",r.style.height=n.height+"px"},r.lookAt=function(e,t,n,r){r=void 0===r||r,t=i.isArray(t)?t:[t],n=n||{x:0,y:0};for(var o={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},a=0;ao.max.x&&(o.max.x=l.x),c.yo.max.y&&(o.max.y=l.y))}var u=o.max.x-o.min.x+2*n.x,p=o.max.y-o.min.y+2*n.y,m=e.canvas.height,f=e.canvas.width/m,v=u/p,g=1,y=1;v>f?y=v/f:g=f/v,e.options.hasBounds=!0,e.bounds.min.x=o.min.x,e.bounds.max.x=o.min.x+u*g,e.bounds.min.y=o.min.y,e.bounds.max.y=o.min.y+p*y,r&&(e.bounds.min.x+=.5*u-u*g*.5,e.bounds.max.x+=.5*u-u*g*.5,e.bounds.min.y+=.5*p-p*y*.5,e.bounds.max.y+=.5*p-p*y*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(d.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),d.setOffset(e.mouse,e.bounds.min))},r.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,r=t/e.options.width,o=n/e.options.height;e.context.setTransform(e.options.pixelRatio/r,0,0,e.options.pixelRatio/o,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},r.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},r.world=function(e,t){var n,o=i.now(),u=e.engine,p=u.world,m=e.canvas,f=e.context,g=e.options,y=e.timing,x=a.allBodies(p),h=a.allConstraints(p),b=g.wireframes?g.wireframeBackground:g.background,M=[],S=[],w={timestamp:u.timing.timestamp};if(c.trigger(e,"beforeRender",w),e.currentBackground!==b&&v(e,b),f.globalCompositeOperation="source-in",f.fillStyle="transparent",f.fillRect(0,0,m.width,m.height),f.globalCompositeOperation="source-over",g.hasBounds){for(n=0;n1?1:0;a1?1:0;s1?1:0;i1?1:0;s1?1:0;i1?1:0;i1?1:0;o0)){var d=r.activeContacts[0].vertex.x,u=r.activeContacts[0].vertex.y;2===r.activeContacts.length&&(d=(r.activeContacts[0].vertex.x+r.activeContacts[1].vertex.x)/2,u=(r.activeContacts[0].vertex.y+r.activeContacts[1].vertex.y)/2),o.bodyB===o.supports[0].body||!0===o.bodyA.isStatic?s.moveTo(d-8*o.normal.x,u-8*o.normal.y):s.moveTo(d+8*o.normal.x,u+8*o.normal.y),s.lineTo(d,u)}c.wireframes?s.strokeStyle="rgba(255,165,0,0.7)":s.strokeStyle="orange",s.lineWidth=1,s.stroke()},r.separations=function(e,t,n){var r,o,i,a,s,c=n,l=e.options;for(c.beginPath(),s=0;s0&&r._bodiesUpdate(h,t),d.preSolveAll(h),n=0;n0&&c.trigger(e,"collisionStart",{pairs:v.collisionStart});var S=u.clamp(20/e.positionIterations,0,1);for(i.preSolvePosition(v.list),n=0;n0&&c.trigger(e,"collisionActive",{pairs:v.collisionActive}),v.collisionEnd.length>0&&c.trigger(e,"collisionEnd",{pairs:v.collisionEnd}),r._bodiesClearForces(h),c.trigger(e,"afterUpdate",x),e.timing.lastElapsed=u.now()-p,e},r.merge=function(e,t){if(u.extend(e,t),t.world){e.world=t.world,r.clear(e);for(var n=l.allBodies(e.world),i=0;i0&&o.area(B)1?(f=a.create(i.extend({parts:v.slice(0)},r)),a.setPosition(f,{x:e,y:t}),f):v[0]}},"pm/U":function(e,t,n){var r={};e.exports=r;var o=n("2Og8"),i=n("571F");r.name="matter-js",r.version="*",r.uses=[],r.used=[],r.use=function(){o.use(r,Array.prototype.slice.call(arguments))},r.before=function(e,t){return e=e.replace(/^Matter./,""),i.chainPathBefore(r,e,t)},r.after=function(e,t){return e=e.replace(/^Matter./,""),i.chainPathAfter(r,e,t)}},q4y7:function(e,t,n){var r={};e.exports=r;var o=n("0kzT"),i=n("yw0d"),a=n("I5nt"),s=n("yTB+"),c=n("ix+/"),l=n("ga9t"),d=n("wAS/"),u=n("571F"),p=n("Tgw/");r.create=function(e,t){var n=(e?e.mouse:null)||(t?t.mouse:null);n||(e&&e.render&&e.render.canvas?n=a.create(e.render.canvas):t&&t.element?n=a.create(t.element):(n=a.create(),u.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var o={type:"mouseConstraint",mouse:n,element:null,body:null,constraint:l.create({label:"Mouse Constraint",pointA:n.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),collisionFilter:{category:1,mask:4294967295,group:0}},i=u.extend(o,t);return s.on(e,"beforeUpdate",(function(){var t=d.allBodies(e.world);r.update(i,t),r._triggerEvents(i)})),i},r.update=function(e,t){var n=e.mouse,r=e.constraint,a=e.body;if(0===n.button){if(r.bodyB)i.set(r.bodyB,!1),r.pointA=n.position;else for(var l=0;l1?1:0;d=0.14.2",r.cloth.cloth=function(e,t,n,r,o,i,a,s,c,l){var d=Matter.Body,u=Matter.Bodies,p=Matter.Common,m=Matter.Composites,f=d.nextGroup(!0);c=p.extend({inertia:1/0,friction:1e-5,collisionFilter:{group:f},render:{visible:!1}},c),l=p.extend({stiffness:.06,render:{type:"line",anchors:!1}},l);var v=m.stack(e,t,n,r,o,i,(function(e,t){return u.circle(e,t,s,c)}));return m.mesh(v,n,r,a,l),v.label="Cloth Body",v},e.exports=r.cloth},t8gT:function(e,t,n){var r={};e.exports=r;var o=n("9K63");r.create=function(e,t){var n=e.bodyA,o=e.bodyB,i={id:r.id(n,o),bodyA:n,bodyB:o,collision:e,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||o.isSensor,timeCreated:t,timeUpdated:t,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return r.update(i,e,t),i},r.update=function(e,t,n){var r=e.contacts,i=t.supports,a=e.activeContacts,s=t.parentA,c=t.parentB,l=s.vertices.length;e.isActive=!0,e.timeUpdated=n,e.collision=t,e.separation=t.depth,e.inverseMass=s.inverseMass+c.inverseMass,e.friction=s.frictionc.frictionStatic?s.frictionStatic:c.frictionStatic,e.restitution=s.restitution>c.restitution?s.restitution:c.restitution,e.slop=s.slop>c.slop?s.slop:c.slop,t.pair=e,a.length=0;for(var d=0;d.35?c.rectangle(e,t,64,64,{render:{strokeStyle:"#ffffff",sprite:{texture:"./img/box.png"}}}):c.circle(e,t,46,{density:5e-4,frictionAir:.06,restitution:.3,friction:.01,render:{sprite:{texture:"./img/ball.png"}}})}));s.add(d,f);var v=a.create(u.canvas),g=i.create(l,{mouse:v,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,g),u.mouse=v,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.sprites.title="Sprites",r.sprites.for=">=0.14.2",e.exports=r.sprites},ttsO:function(e,t,n){var r={};e.exports=r;var o=n("t8gT"),i=n("571F");r.create=function(e){return i.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},r.update=function(e,t,n){var r,i,a,s,c=e.list,l=c.length,d=e.table,u=t.length,p=e.collisionStart,m=e.collisionEnd,f=e.collisionActive;for(p.length=0,m.length=0,f.length=0,s=0;s=0?i(s,false):a(s,false)},vSND:function(e,t,n){var r=r||{};r.stats=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Common,o=Matter.Composites,i=Matter.MouseConstraint,a=Matter.Mouse,s=Matter.World,c=Matter.Bodies,l=e.create(),d=l.world,u=t.create({element:document.body,engine:l,options:{width:800,height:600,showStats:!0,showPerformance:!0}});t.run(u);var p=n.create();n.run(p,l);var m=o.stack(70,30,13,9,5,5,(function(e,t){return c.circle(e,t,10+20*r.random())}));s.add(d,[m,c.rectangle(400,0,800,50,{isStatic:!0}),c.rectangle(400,600,800,50,{isStatic:!0}),c.rectangle(800,300,50,600,{isStatic:!0}),c.rectangle(0,300,50,600,{isStatic:!0})]);var f=a.create(u.canvas),v=i.create(l,{mouse:f,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(d,v),u.mouse=f,t.lookAt(u,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:l,runner:p,render:u,canvas:u.canvas,stop:function(){Matter.Render.stop(u),Matter.Runner.stop(p)}}},r.stats.title="Stats & Performance",r.stats.for=">=0.16.1",e.exports=r.stats},"wAS/":function(e,t,n){var r={};e.exports=r;var o=n("yTB+"),i=n("571F"),a=n("Tgw/"),s=n("IbIC");r.create=function(e){return i.extend({id:i.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},e)},r.setModified=function(e,t,n,o){if(e.isModified=t,t&&e.cache&&(e.cache.allBodies=null,e.cache.allConstraints=null,e.cache.allComposites=null),n&&e.parent&&r.setModified(e.parent,t,n,o),o)for(var i=0;i=0.14.2",e.exports=r.bridge},xoNv:function(e,t,n){var r=r||{};r.newtonsCradle=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,o=Matter.Body,i=(Matter.Composites,Matter.MouseConstraint),a=Matter.Mouse,s=Matter.Composite,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showVelocity:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.newtonsCradle.newtonsCradle(280,100,5,30,200);s.add(l,p),o.translate(p.bodies[0],{x:-180,y:-100}),p=r.newtonsCradle.newtonsCradle(280,380,7,20,140),s.add(l,p),o.translate(p.bodies[0],{x:-140,y:-100});var m=a.create(d.canvas),f=i.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return s.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:50},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.newtonsCradle.title="Newton's Cradle",r.newtonsCradle.for=">=0.14.2",r.newtonsCradle.newtonsCradle=function(e,t,n,r,o){for(var i=Matter.Composite,a=Matter.Constraint,s=Matter.Bodies,c=i.create({label:"Newtons Cradle"}),l=0;l0){n||(n={}),r=t.split(" ");for(var l=0;l=0.14.2",e.exports=r.sensors},yw0d:function(e,t,n){var r={};e.exports=r;var o=n("IbIC"),i=n("yTB+"),a=n("571F");r._motionWakeThreshold=.18,r._motionSleepThreshold=.08,r._minBias=.9,r.update=function(e,t){for(var n=t/a._baseDelta,i=r._motionSleepThreshold,s=0;s0&&c.motion=c.sleepThreshold/n&&r.set(c,!0)):c.sleepCounter>0&&(c.sleepCounter-=1)}else r.set(c,!1)}},r.afterCollisions=function(e){for(var t=r._motionSleepThreshold,n=0;nt&&r.set(c,!1)}}}},r.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||i.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&i.trigger(e,"sleepEnd"))}},zc7U:function(e,t,n){var r=r||{};r.circleStack=function(){var e=Matter.Engine,t=Matter.Render,n=Matter.Runner,r=Matter.Composites,o=Matter.MouseConstraint,i=Matter.Mouse,a=Matter.Composite,s=Matter.Bodies,c=e.create(),l=c.world,d=t.create({element:document.body,engine:c,options:{width:800,height:600,showAngleIndicator:!0}});t.run(d);var u=n.create();n.run(u,c);var p=r.stack(100,179,10,10,20,0,(function(e,t){return s.circle(e,t,20)}));a.add(l,[s.rectangle(400,0,800,50,{isStatic:!0}),s.rectangle(400,600,800,50,{isStatic:!0}),s.rectangle(800,300,50,600,{isStatic:!0}),s.rectangle(0,300,50,600,{isStatic:!0}),p]);var m=i.create(d.canvas),f=o.create(c,{mouse:m,constraint:{stiffness:.2,render:{visible:!1}}});return a.add(l,f),d.mouse=m,t.lookAt(d,{min:{x:0,y:0},max:{x:800,y:600}}),{engine:c,runner:u,render:d,canvas:d.canvas,stop:function(){Matter.Render.stop(d),Matter.Runner.stop(u)}}},r.circleStack.title="Circle Stack",r.circleStack.for=">=0.14.2",e.exports=r.circleStack}},[["uZME",1,2,3,4,5]]])})); \ No newline at end of file diff --git a/demo/js/matter-demo.main.5754e1.min.js b/demo/js/matter-demo.main.cf6d09.min.js similarity index 97% rename from demo/js/matter-demo.main.5754e1.min.js rename to demo/js/matter-demo.main.cf6d09.min.js index 96e16ab9..cc2b5fb4 100644 --- a/demo/js/matter-demo.main.5754e1.min.js +++ b/demo/js/matter-demo.main.cf6d09.min.js @@ -1,5 +1,5 @@ /*! - * matter-demo bundle 0.19.0 by @liabru + * matter-demo bundle 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT */!function(e){function t(t){for(var n,l,a=t[0],f=t[1],i=t[2],c=0,s=[];c${e}`;let i=document.head.querySelector("style:last-of-type");i?r.domInsertBefore(n.firstElementChild,i):document.head.appendChild(n.firstElementChild)},r.injectScript=function(e,t,n){if(document.getElementById(t))return;let r=document.createElement("script");r.id=t,r.src=e,r.onload=n,document.body.appendChild(r)},r.domRemove=function(e){return e.parentElement.removeChild(e)},r.domInsertBefore=function(e,t){return t.parentNode.insertBefore(e,t.previousElementSibling)}},function(e,t,n){"use strict";const r=e.exports={},i=n(8),o=n(0),s=o.Common,a=o.Engine;r.create=function(){let e=new i({prefix:"$",cleanup:!0});return e.parse=e.resurrect,e},r.clone=function(e,t){var n=e.parse(r.serialise(e,t));return n.id=s.nextId(),n},r.saveState=function(e,t,n){localStorage.setItem(n,r.serialise(e,t.world))},r.loadState=function(e,t,n){var r=e.parse(localStorage.getItem(n));r&&a.merge(t,{world:r})},r.serialise=function(e,t,n){return n=n||0,e.stringify(t,(function(e,t){if(!/^#/.exec(e)&&"number"==typeof t){var n=parseFloat(t.toFixed(3));return 0===n&&0!==t?t:n}return t}),n)}},function(e,t,n){"use strict";const r=e.exports={},i=n(7),o=n(1),s=n(2),a=n(0),l=a.Engine,d=a.Detector,c=a.Grid,h=a.World,u=a.Bodies,p=a.Events,f=a.Composite;r.create=function(e,t,r){i.GUI.TEXT_CLOSED="▲",i.GUI.TEXT_OPEN="▼";var a={engine:e,runner:t,render:r,datGui:new i.GUI({autoPlace:!1}),broadphase:"grid",broadphaseCache:{grid:e.broadphase.controller===c?e.broadphase:c.create(),bruteForce:{detector:d.bruteForce}},amount:1,size:40,sides:4,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,offset:{x:0,y:0},renderer:"canvas",chamfer:0,isRecording:!1};s&&(a.serializer=s.create());let l=n(9);return o.injectStyles(l,"matter-gui-style"),g(a),a},r.update=function(e){var t,n=e.datGui;for(t in n.__folders)r.update(e,n.__folders[t]);for(t in n.__controllers){var i=n.__controllers[t];i.updateDisplay&&i.updateDisplay()}},r.closeAll=function(e){var t=e.datGui;for(var n in t.__folders)t.__folders[n].close()},r.destroy=function(e){e.datGui.domElement.parentElement.removeChild(e.datGui.domElement),e.datGui.destroy()};var g=function(e){var t=e.engine,n=e.runner,r=e.datGui,i={addBody:function(){_(e)},clear:function(){m(e)},save:function(){s.saveState(e.serializer,t,"guiState"),p.trigger(e,"save")},load:function(){s.loadState(e.serializer,t,"guiState"),p.trigger(e,"load")}},o=r.addFolder("Metrics");if(n&&o.add(n,"fps").listen(),t.metrics.extended&&(n&&(o.add(n,"delta").listen(),o.add(n,"correction").listen()),t&&(o.add(t.metrics,"bodies").listen(),o.add(t.metrics,"collisions").listen(),o.add(t.metrics,"pairs").listen(),o.add(t.metrics,"broadEff").listen(),o.add(t.metrics,"midEff").listen(),o.add(t.metrics,"narrowEff").listen(),o.add(t.metrics,"narrowReuse").listen()),o.open()),t){var a=r.addFolder("Add Body");a.add(e,"amount",1,5).step(1),a.add(e,"size",5,150).step(1),a.add(e,"sides",1,8).step(1),a.add(e,"density",1e-4,.01).step(.001),a.add(e,"friction",0,1).step(.05),a.add(e,"frictionStatic",0,10).step(.1),a.add(e,"frictionAir",0,10*e.frictionAir).step(e.frictionAir/10),a.add(e,"restitution",0,1).step(.1),a.add(e,"chamfer",0,30).step(2),a.add(i,"addBody"),a.open();var l=r.addFolder("World");e.serializer&&(l.add(i,"load"),l.add(i,"save")),l.add(i,"clear"),l.open();var d=r.addFolder("Gravity");d.add(t.world.gravity,"scale",0,.001).step(1e-4),d.add(t.world.gravity,"x",-1,1).step(.01),d.add(t.world.gravity,"y",-1,1).step(.01);var c=r.addFolder("Engine");c.add(t,"enableSleeping"),c.add(t.timing,"timeScale",0,1.2).step(.05).listen(),c.add(t,"velocityIterations",1,10).step(1),c.add(t,"positionIterations",1,10).step(1),c.add(t,"constraintIterations",1,10).step(1),n&&c.add(n,"enabled")}if(e.render){var h=r.addFolder("Render");h.add(e.render.options,"wireframes").onFinishChange((function(e){e||(f.setValue(!1),u.setValue(!1))})),h.add(e.render.options,"showDebug"),h.add(e.render.options,"showPositions"),h.add(e.render.options,"showBroadphase"),h.add(e.render.options,"showBounds"),h.add(e.render.options,"showVelocity"),h.add(e.render.options,"showCollisions"),h.add(e.render.options,"showSeparations");var u=h.add(e.render.options,"showAxes"),f=h.add(e.render.options,"showAngleIndicator");h.add(e.render.options,"showSleeping"),h.add(e.render.options,"showIds"),h.add(e.render.options,"showVertexNumbers"),h.add(e.render.options,"showConvexHulls"),h.add(e.render.options,"showInternalEdges"),h.add(e.render.options,"enabled"),h.open()}document.body.appendChild(e.datGui.domElement)},_=function(e){var t=e.engine,n={density:e.density,friction:e.friction,frictionStatic:e.frictionStatic,frictionAir:e.frictionAir,restitution:e.restitution};e.chamfer&&e.sides>2&&(n.chamfer={radius:e.chamfer});for(var r=0;r{d.keyBindings.push(e)})),x(d),E(d),k(d),j(d),d},r.destroy=function(e){e.controls.worldTree.data("jstree").destroy(),[].slice.call(document.body.querySelectorAll(".ins-container",".vakata-context",".jstree-marker")).forEach(s.domRemove),e.keyBindings.forEach((e=>{i.unbind(e)})),p.off(e.engine,"beforeUpdate",e.beforeEngineUpdate),e.render&&(p.off(e.render,"afterRender",e.afterRender),p.off(e.mouseConstraint))};var x=function(e){var t,n=e.controls,r=o('
'),i=o('
'),s=o('
'),l=o(''),d=o(''),c=o(''),h=o(''),u=o(''),p=o('');a?s.append(h,d,c,u):s.append(h,u),r.prepend(i,l,p),b.prepend(r),n.pauseButton=h,n.importButton=d,n.exportButton=c,n.helpButton=u,n.searchBox=l,n.container=r,n.addCompositeButton=p,n.pauseButton.click((function(){D(e,!e.isPaused)})),n.exportButton.click((function(){V(e)})),n.importButton.click((function(){K(e)})),n.helpButton.click((function(){y(e)})),n.addCompositeButton.click((function(){U(e)})),n.searchBox.keyup((function(){clearTimeout(t),t=setTimeout((function(){var e=n.searchBox.val();n.worldTree.data("jstree").search(e)}),250)}))},y=function(){alert("Matter Tools\n\nDrag nodes in the tree to move them between composites.\nUse browser's developer console to inspect selected objects.\nNote: selections only render if renderer supports it.\n\n[shift + space] pause or play simulation.\n[right click] and drag on empty space to select a region.\n[right click] and drag on an object to move it.\n[right click + shift] and drag to move whole selection.\n\n[ctrl-c] to copy selected world objects.\n[ctrl-v] to paste copied world objects to mouse position.\n[del] or [backspace] delete selected objects.\n\n[shift + s] scale-xy selected objects with mouse or arrows.\n[shift + s + d] scale-x selected objects with mouse or arrows.\n[shift + s + f] scale-y selected objects with mouse or arrows.\n[shift + r] rotate selected objects with mouse or arrows.\n\n[shift + q] set selected objects as static (can't be undone).\n[shift + i] import objects.\n[shift + o] export selected objects.\n[shift + h] toggle Matter.Gui.\n[shift + y] toggle auto-hide.\n[shift + r] toggle auto-rewind on play/pause.\n\n[shift + j] show this help message.")},j=function(e){e.keyBind("shift+space",(function(){D(e,!e.isPaused)})),e.serializer&&(e.keyBind("shift+o",(function(){V(e)})),e.keyBind("shift+i",(function(){K(e)}))),e.keyBind("shift+j",(function(){y(e)})),e.keyBind("shift+y",(function(){e.autoHide=!e.autoHide,b.toggleClass("ins-auto-hide gui-auto-hide",e.autoHide)})),e.keyBind("shift+r",(function(){e.autoRewind=!e.autoRewind,e.autoRewind||localStorage.removeItem("pauseState")})),e.keyBind("shift+q",(function(){for(var t=0;t').jstree({core:{check_callback:!0,animation:!1},dnd:{copy:!1},search:{show_only_matches:!0,fuzzy:!1},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"]}),r.container.append(r.worldTree),e.hasExpanded=!1,r.worldTree.on("refresh.jstree",(function(){e.autoExpand&&!e.hasExpanded&&(e.hasExpanded=!0,r.worldTree.jstree("open_all"))})),r.worldTree.on("changed.jstree",(function(i,o){var s=[],a=r.worldTree.data("jstree");"select_node"===o.action&&(clearTimeout(t),t=setTimeout((function(){o.selected=a.get_selected();for(var t=0;t0&&(w(e,"ins-cursor-move"),N(e))}))),e.render&&(e.afterRender=function(){var t=e.render.controller,n=e.render.context;t.inspector&&t.inspector(e,n)},p.on(e.render,"afterRender",e.afterRender))},S=function(e){var t,n,r=[],i=e.controls.worldTree.data("jstree");for(n=0;n0&&console.clear(),r=0;r',(t=n.firstChild).addEventListener("change",(function(){var n=t.files[0];if(n.name.match(/\.(txt|json)$/)){var r=new FileReader;r.onload=function(){var t=e.serializer.parse(r.result);if(t){t.label="Imported Objects",h.rebase(t),h.add(e.root,t),e.root.composites.splice(e.root.composites.length-1,1),e.root.composites.unshift(t);var n=e.controls.worldTree.data("jstree"),i=M(e.root,null,!0);H(n,i)}},r.readAsText(n)}else alert("File not supported, .json or .txt JSON files only")})),t.click()}else alert("No serializer.")}},function(e,t,n){var r;/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,(function(n,i){"use strict";var o=[],s=Object.getPrototypeOf,a=o.slice,l=o.flat?function(e){return o.flat.call(e)}:function(e){return o.concat.apply([],e)},d=o.push,c=o.indexOf,h={},u=h.toString,p=h.hasOwnProperty,f=p.toString,g=f.call(Object),_={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},v=function(e){return null!=e&&e===e.window},b=n.document,x={type:!0,src:!0,nonce:!0,noModule:!0};function y(e,t,n){var r,i,o=(n=n||b).createElement("script");if(o.text=e,t)for(r in x)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function j(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?h[u.call(e)]||"object":typeof e}var k="3.5.1",w=function(e,t){return new w.fn.init(e,t)};function A(e){var t=!!e&&"length"in e&&e.length,n=j(e);return!m(e)&&!v(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+F+")"+F+"*"),K=new RegExp(F+"|>"),$=new RegExp(z),G=new RegExp("^"+H+"$"),W={ID:new RegExp("^#("+H+")"),CLASS:new RegExp("^\\.("+H+")"),TAG:new RegExp("^("+H+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},X=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+F+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){u()},se=xe((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{B.apply(O=P.call(y.childNodes),y.childNodes),O[y.childNodes.length].nodeType}catch(t){B={apply:O.length?function(e,t){L.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ae(e,t,r,i){var o,a,d,c,h,f,m,v=t&&t.ownerDocument,y=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==y&&9!==y&&11!==y)return r;if(!i&&(u(t),t=t||p,g)){if(11!==y&&(h=Z.exec(e)))if(o=h[1]){if(9===y){if(!(d=t.getElementById(o)))return r;if(d.id===o)return r.push(d),r}else if(v&&(d=v.getElementById(o))&&b(t,d)&&d.id===o)return r.push(d),r}else{if(h[2])return B.apply(r,t.getElementsByTagName(e)),r;if((o=h[3])&&n.getElementsByClassName&&t.getElementsByClassName)return B.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!E[e+" "]&&(!_||!_.test(e))&&(1!==y||"object"!==t.nodeName.toLowerCase())){if(m=e,v=t,1===y&&(K.test(e)||V.test(e))){for((v=ee.test(e)&&me(t.parentNode)||t)===t&&n.scope||((c=t.getAttribute("id"))?c=c.replace(re,ie):t.setAttribute("id",c=x)),a=(f=s(e)).length;a--;)f[a]=(c?"#"+c:":scope")+" "+be(f[a]);m=f.join(",")}try{return B.apply(r,v.querySelectorAll(m)),r}catch(t){E(e,!0)}finally{c===x&&t.removeAttribute("id")}}}return l(e.replace(q,"$1"),t,r,i)}function le(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function de(e){return e[x]=!0,e}function ce(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function he(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function ue(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ge(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&se(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function _e(e){return de((function(t){return t=+t,de((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},o=ae.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!X.test(t||n&&n.nodeName||"HTML")},u=ae.setDocument=function(e){var t,i,s=e?e.ownerDocument||e:y;return s!=p&&9===s.nodeType&&s.documentElement&&(f=(p=s).documentElement,g=!o(p),y!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=ce((function(e){return f.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ce((function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(p.getElementsByClassName),n.getById=ce((function(e){return f.appendChild(e).id=x,!p.getElementsByName||!p.getElementsByName(x).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},m=[],_=[],(n.qsa=Q.test(p.querySelectorAll))&&(ce((function(e){var t;f.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&_.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||_.push("\\["+F+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+x+"-]").length||_.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||_.push("\\["+F+"*name"+F+"*="+F+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||_.push(":checked"),e.querySelectorAll("a#"+x+"+*").length||_.push(".#.+[+~]"),e.querySelectorAll("\\\f"),_.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&_.push("name"+F+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&_.push(":enabled",":disabled"),f.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&_.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),_.push(",.*:")}))),(n.matchesSelector=Q.test(v=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ce((function(e){n.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),m.push("!=",z)})),_=_.length&&new RegExp(_.join("|")),m=m.length&&new RegExp(m.join("|")),t=Q.test(f.compareDocumentPosition),b=t||Q.test(f.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},S=t?function(e,t){if(e===t)return h=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==p||e.ownerDocument==y&&b(y,e)?-1:t==p||t.ownerDocument==y&&b(y,t)?1:c?D(c,e)-D(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return h=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e==p?-1:t==p?1:i?-1:o?1:c?D(c,e)-D(c,t):0;if(i===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?ue(s[r],a[r]):s[r]==y?-1:a[r]==y?1:0}),p},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if(u(e),n.matchesSelector&&g&&!E[t+" "]&&(!m||!m.test(t))&&(!_||!_.test(t)))try{var r=v.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){E(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=s(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=w[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&w(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=ae.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function L(e,t,n){return m(t)?w.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?w.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?w.grep(e,(function(e){return-1)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||B,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:P.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:b,!0)),N.test(r[1])&&w.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=b.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,B=w(b);var D=/^(?:parents|prev(?:Until|All))/,R={children:!0,contents:!0,next:!0,prev:!0};function F(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter((function(){for(var e=0;e\x20\t\r\n\f]*)/i,me=/^$|^module$|\/(?:java|ecma)script/i;pe=b.createDocumentFragment().appendChild(b.createElement("div")),(fe=b.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),pe.appendChild(fe),_.checkClone=pe.cloneNode(!0).cloneNode(!0).lastChild.checked,pe.innerHTML="",_.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue,pe.innerHTML="",_.option=!!pe.lastChild;var ve={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function be(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&O(e,t)?w.merge([e],n):n}function xe(e,t){for(var n=0,r=e.length;n",""]);var ye=/<|&#?\w+;/;function je(e,t,n,r,i){for(var o,s,a,l,d,c,h=t.createDocumentFragment(),u=[],p=0,f=e.length;p\s*$/g;function Pe(e,t){return O(e,"table")&&O(11!==t.nodeType?t:t.firstChild,"tr")&&w(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,s,a;if(1===t.nodeType){if(Q.hasData(e)&&(a=Q.get(e).events))for(i in Q.remove(t,"handle events"),a)for(n=0,r=a[i].length;n").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),b.head.appendChild(t[0])},abort:function(){n&&n()}}}));var Wt,Xt=[],Jt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||w.expando+"_"+Ct.guid++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",(function(e,t,r){var i,o,s,a=!1!==e.jsonp&&(Jt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Jt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Jt,"$1"+i):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return s||w.error(i+" was not called"),s[0]},e.dataTypes[0]="json",o=n[i],n[i]=function(){s=arguments},r.always((function(){void 0===o?w(n).removeProp(i):n[i]=o,e[i]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(i)),s&&m(o)&&o(s[0]),s=o=void 0})),"script"})),_.createHTMLDocument=((Wt=b.implementation.createHTMLDocument("").body).innerHTML="
",2===Wt.childNodes.length),w.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(_.createHTMLDocument?((r=(t=b.implementation.createHTMLDocument("")).createElement("base")).href=b.location.href,t.head.appendChild(r)):t=b),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=je([e],t,o),o&&o.length&&w(o).remove(),w.merge([],i.childNodes)));var r,i,o},w.fn.load=function(e,t,n){var r,i,o,s=this,a=e.indexOf(" ");return-1").append(w.parseHTML(e)).find(r):e)})).always(n&&function(e,t){s.each((function(){n.apply(this,o||[e.responseText,t,e])}))}),this},w.expr.pseudos.animated=function(e){return w.grep(w.timers,(function(t){return e===t.elem})).length},w.offset={setOffset:function(e,t,n){var r,i,o,s,a,l,d=w.css(e,"position"),c=w(e),h={};"static"===d&&(e.style.position="relative"),a=c.offset(),o=w.css(e,"top"),l=w.css(e,"left"),("absolute"===d||"fixed"===d)&&-1<(o+l).indexOf("auto")?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(l)||0),m(t)&&(t=t.call(e,n,w.extend({},a))),null!=t.top&&(h.top=t.top-a.top+s),null!=t.left&&(h.left=t.left-a.left+i),"using"in t?t.using.call(e,h):("number"==typeof h.top&&(h.top+="px"),"number"==typeof h.left&&(h.left+="px"),c.css(h))}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){w.offset.setOffset(this,e,t)}));var t,n,r=this[0];return r?r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===w.css(e,"position");)e=e.offsetParent;return e||se}))}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return K(this,(function(e,r,i){var o;if(v(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i}),e,r,arguments.length)}})),w.each(["top","left"],(function(e,t){w.cssHooks[t]=Ke(_.pixelPosition,(function(e,n){if(n)return n=Ve(e,t),ze.test(n)?w(e).position()[t]+"px":n}))})),w.each({Height:"height",Width:"width"},(function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,r){w.fn[r]=function(i,o){var s=arguments.length&&(n||"boolean"!=typeof i),a=n||(!0===i||!0===o?"margin":"border");return K(this,(function(t,n,i){var o;return v(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,a):w.style(t,n,i,a)}),t,s?i:void 0,s)}}))})),w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){w.fn[t]=function(e){return this.on(t,e)}})),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){w.fn[t]=function(e,n){return 0-1?t.length-t.indexOf(".")-1:0}function s(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}function a(e,t,n,r,i){return r+(e-t)/(n-t)*(i-r)}function l(e,t,n,r){e.style.background="",E.each(ee,(function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+r+" 100%); "}))}function d(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}function c(e,t,n){var r=document.createElement("li");return t&&r.appendChild(t),n?e.__ul.insertBefore(r,n):e.__ul.appendChild(r),e.onResize(),r}function h(e){K.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&K.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function u(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function p(e,t,n){if(n.__li=t,n.__gui=e,E.extend(n,{options:function(t){if(arguments.length>1){var r=n.__li.nextElementSibling;return n.remove(),g(e,n.object,n.property,{before:r,factoryArgs:[E.toArray(arguments)]})}if(E.isArray(t)||E.isObject(t)){var i=n.__li.nextElementSibling;return n.remove(),g(e,n.object,n.property,{before:i,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof Y){var r=new J(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});E.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],i=r[e];n[e]=r[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(r,e),t.apply(n,e)}})),K.addClass(t,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof J){var i=function(t){if(E.isNumber(n.__min)&&E.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,i=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=g(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(r),i&&o.listen(),o}return t};n.min=E.compose(i,n.min),n.max=E.compose(i,n.max)}else n instanceof $?(K.bind(t,"click",(function(){K.fakeEvent(n.__checkbox,"click")})),K.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof Q?(K.bind(t,"click",(function(){K.fakeEvent(n.__button,"click")})),K.bind(t,"mouseover",(function(){K.addClass(n.__button,"hover")})),K.bind(t,"mouseout",(function(){K.removeClass(n.__button,"hover")}))):n instanceof Z&&(K.addClass(t,"color"),n.updateDisplay=E.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=E.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&u(e.getRoot(),!0),t}),n.setValue)}function f(e,t){var n=e.getRoot(),r=n.__rememberedObjects.indexOf(t.object);if(-1!==r){var i=n.__rememberedObjectIndecesToControllers[r];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[r]=i),i[t.property]=t,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[e.preset])s=o[e.preset];else{if(!o[se])return;s=o[se]}if(s[r]&&void 0!==s[r][t.property]){var a=s[r][t.property];t.initialValue=a,t.setValue(a)}}}}function g(e,t,n,r){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(r.color)i=new Z(t,n);else{var o=[t,n].concat(r.factoryArgs);i=ne.apply(e,o)}r.before instanceof I&&(r.before=r.before.__li),f(e,i),K.addClass(i.domElement,"c");var s=document.createElement("span");K.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=c(e,a,r.before);return K.addClass(l,pe.CLASS_CONTROLLER_ROW),i instanceof Z?K.addClass(l,"color"):K.addClass(l,P(i.getValue())),p(e,l,i),e.__controllers.push(i),i}function _(e,t){return document.location.href+"."+t}function m(e,t,n){var r=document.createElement("option");r.innerHTML=t,r.value=t,e.__preset_select.appendChild(r),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function v(e,t){t.style.display=e.useLocalStorage?"block":"none"}function b(e){var t=e.__save_row=document.createElement("li");K.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),K.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",K.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",K.addClass(r,"button"),K.addClass(r,"save");var i=document.createElement("span");i.innerHTML="New",K.addClass(i,"button"),K.addClass(i,"save-as");var o=document.createElement("span");o.innerHTML="Revert",K.addClass(o,"button"),K.addClass(o,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?E.each(e.load.remembered,(function(t,n){m(e,n,n===e.preset)})):m(e,se,!1),K.bind(s,"change",(function(){for(var t=0;t=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(A&&e.forEach&&e.forEach===A)e.forEach(t,n);else if(e.length===e.length+0){var r=void 0,i=void 0;for(r=0,i=e.length;r1?E.toArray(arguments):arguments[0];return E.each(S,(function(t){if(t.litmus(e))return E.each(t.conversions,(function(t,n){if(T=t.read(e),!1===O&&!1!==T)return O=T,T.conversionName=n,T.conversion=t,E.BREAK})),E.BREAK})),O},L=void 0,B={hsv_to_rgb:function(e,t,n){var r=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),o=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][r];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var r=Math.min(e,t,n),i=Math.max(e,t,n),o=i-r,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/o:t===i?2+(n-e)/o:4+(e-t)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/i,v:i/255})},rgb_to_hex:function(e,t,n){var r=this.hex_with_component(0,2,e);return r=this.hex_with_component(r,1,t),this.hex_with_component(r,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(L=8*t)|e&~(255<this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=o(e),this}}]),t}(),J=function(e){function t(e,n,r){function i(){l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}function o(e){var t=d-e.clientY;l.setValue(l.getValue()+t*l.__impliedStep),d=e.clientY}function s(){K.unbind(window,"mousemove",o),K.unbind(window,"mouseup",s),i()}D(this,t);var a=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));a.__truncationSuspended=!1;var l=a,d=void 0;return a.__input=document.createElement("input"),a.__input.setAttribute("type","text"),K.bind(a.__input,"change",(function(){var e=parseFloat(l.__input.value);E.isNaN(e)||l.setValue(e)})),K.bind(a.__input,"blur",(function(){i()})),K.bind(a.__input,"mousedown",(function(e){K.bind(window,"mousemove",o),K.bind(window,"mouseup",s),d=e.clientY})),K.bind(a.__input,"keydown",(function(e){13===e.keyCode&&(l.__truncationSuspended=!0,this.blur(),l.__truncationSuspended=!1,i())})),a.updateDisplay(),a.domElement.appendChild(a.__input),a}return H(t,X),R(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():s(this.getValue(),this.__precision),F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),Y=function(e){function t(e,n,r,i,o){function s(e){e.preventDefault();var t=u.__background.getBoundingClientRect();return u.setValue(a(e.clientX,t.left,t.right,u.__min,u.__max)),!1}function l(){K.unbind(window,"mousemove",s),K.unbind(window,"mouseup",l),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}function d(e){var t=e.touches[0].clientX,n=u.__background.getBoundingClientRect();u.setValue(a(t,n.left,n.right,u.__min,u.__max))}function c(){K.unbind(window,"touchmove",d),K.unbind(window,"touchend",c),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}D(this,t);var h=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:r,max:i,step:o})),u=h;return h.__background=document.createElement("div"),h.__foreground=document.createElement("div"),K.bind(h.__background,"mousedown",(function(e){document.activeElement.blur(),K.bind(window,"mousemove",s),K.bind(window,"mouseup",l),s(e)})),K.bind(h.__background,"touchstart",(function(e){1===e.touches.length&&(K.bind(window,"touchmove",d),K.bind(window,"touchend",c),d(e))})),K.addClass(h.__background,"slider"),K.addClass(h.__foreground,"slider-fg"),h.updateDisplay(),h.__background.appendChild(h.__foreground),h.domElement.appendChild(h.__background),h}return H(t,X),R(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),Q=function(e){function t(e,n,r){D(this,t);var i=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===r?"Fire":r,K.bind(i.__button,"click",(function(e){return e.preventDefault(),o.fire(),!1})),K.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return H(t,I),R(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),Z=function(e){function t(e,n){function r(e){h(e),K.bind(window,"mousemove",h),K.bind(window,"touchmove",h),K.bind(window,"mouseup",o),K.bind(window,"touchend",o)}function i(e){u(e),K.bind(window,"mousemove",u),K.bind(window,"touchmove",u),K.bind(window,"mouseup",s),K.bind(window,"touchend",s)}function o(){K.unbind(window,"mousemove",h),K.unbind(window,"touchmove",h),K.unbind(window,"mouseup",o),K.unbind(window,"touchend",o),c()}function s(){K.unbind(window,"mousemove",u),K.unbind(window,"touchmove",u),K.unbind(window,"mouseup",s),K.unbind(window,"touchend",s),c()}function a(){var e=N(this.value);!1!==e?(f.__color.__state=e,f.setValue(f.__color.toOriginal())):this.value=f.__color.toString()}function c(){f.__onFinishChange&&f.__onFinishChange.call(f,f.__color.toOriginal())}function h(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=f.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,r=n.clientX,i=n.clientY,o=(r-t.left)/(t.right-t.left),s=1-(i-t.top)/(t.bottom-t.top);return s>1?s=1:s<0&&(s=0),o>1?o=1:o<0&&(o=0),f.__color.v=s,f.__color.s=o,f.setValue(f.__color.toOriginal()),!1}function u(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=f.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),f.__color.h=360*n,f.setValue(f.__color.toOriginal()),!1}D(this,t);var p=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));p.__color=new z(p.getValue()),p.__temp=new z(0);var f=p;p.domElement=document.createElement("div"),K.makeSelectable(p.domElement,!1),p.__selector=document.createElement("div"),p.__selector.className="selector",p.__saturation_field=document.createElement("div"),p.__saturation_field.className="saturation-field",p.__field_knob=document.createElement("div"),p.__field_knob.className="field-knob",p.__field_knob_border="2px solid ",p.__hue_knob=document.createElement("div"),p.__hue_knob.className="hue-knob",p.__hue_field=document.createElement("div"),p.__hue_field.className="hue-field",p.__input=document.createElement("input"),p.__input.type="text",p.__input_textShadow="0 1px 1px ",K.bind(p.__input,"keydown",(function(e){13===e.keyCode&&a.call(this)})),K.bind(p.__input,"blur",a),K.bind(p.__selector,"mousedown",(function(){K.addClass(this,"drag").bind(window,"mouseup",(function(){K.removeClass(f.__selector,"drag")}))})),K.bind(p.__selector,"touchstart",(function(){K.addClass(this,"drag").bind(window,"touchend",(function(){K.removeClass(f.__selector,"drag")}))}));var g=document.createElement("div");return E.extend(p.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),E.extend(p.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:p.__field_knob_border+(p.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),E.extend(p.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),E.extend(p.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),E.extend(g.style,{width:"100%",height:"100%",background:"none"}),l(g,"top","rgba(0,0,0,0)","#000"),E.extend(p.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),d(p.__hue_field),E.extend(p.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:p.__input_textShadow+"rgba(0,0,0,0.7)"}),K.bind(p.__saturation_field,"mousedown",r),K.bind(p.__saturation_field,"touchstart",r),K.bind(p.__field_knob,"mousedown",r),K.bind(p.__field_knob,"touchstart",r),K.bind(p.__hue_field,"mousedown",i),K.bind(p.__hue_field,"touchstart",i),p.__saturation_field.appendChild(g),p.__selector.appendChild(p.__field_knob),p.__selector.appendChild(p.__saturation_field),p.__selector.appendChild(p.__hue_field),p.__hue_field.appendChild(p.__hue_knob),p.domElement.appendChild(p.__input),p.domElement.appendChild(p.__selector),p.updateDisplay(),p}return H(t,I),R(t,[{key:"updateDisplay",value:function(){var e=N(this.getValue());if(!1!==e){var t=!1;E.each(z.COMPONENTS,(function(n){if(!E.isUndefined(e[n])&&!E.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&E.extend(this.__color.__state,e)}E.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;E.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,l(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),E.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),t}(),ee=["-moz-","-o-","-webkit-","-ms-",""],te={load:function(e,t){var n=t||document,r=n.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,n.getElementsByTagName("head")[0].appendChild(r)},inject:function(e,t){var n=t||document,r=document.createElement("style");r.type="text/css",r.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(r)}catch(e){}}},ne=function(e,t){var n=e[t];return E.isArray(arguments[2])||E.isObject(arguments[2])?new G(e,t,arguments[2]):E.isNumber(n)?E.isNumber(arguments[2])&&E.isNumber(arguments[3])?E.isNumber(arguments[4])?new Y(e,t,arguments[2],arguments[3],arguments[4]):new Y(e,t,arguments[2],arguments[3]):E.isNumber(arguments[4])?new J(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new J(e,t,{min:arguments[2],max:arguments[3]}):E.isString(n)?new W(e,t):E.isFunction(n)?new Q(e,t,""):E.isBoolean(n)?new $(e,t):null},re=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},ie=function(){function e(){D(this,e),this.backgroundElement=document.createElement("div"),E.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),K.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),E.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;K.bind(this.backgroundElement,"click",(function(){t.hide()}))}return R(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),E.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",K.unbind(e.domElement,"webkitTransitionEnd",t),K.unbind(e.domElement,"transitionend",t),K.unbind(e.domElement,"oTransitionEnd",t)};K.bind(this.domElement,"webkitTransitionEnd",t),K.bind(this.domElement,"transitionend",t),K.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-K.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-K.getHeight(this.domElement)/2+"px"}}]),e}(),oe=function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");te.inject(oe);var se="Default",ae=function(){try{return!!window.localStorage}catch(e){return!1}}(),le=void 0,de=!0,ce=void 0,he=!1,ue=[],pe=function e(t){var n=this,r=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),K.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=E.defaults(r,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),r=E.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),E.isUndefined(r.load)?r.load={preset:se}:r.preset&&(r.load.preset=r.preset),E.isUndefined(r.parent)&&r.hideable&&ue.push(this),r.resizable=E.isUndefined(r.parent)&&r.resizable,r.autoPlace&&E.isUndefined(r.scrollable)&&(r.scrollable=!0);var i=ae&&"true"===localStorage.getItem(_(this,"isLocal")),o=void 0,s=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(e){n.parent?n.getRoot().preset=e:r.load.preset=e,k(this),n.revert()}},width:{get:function(){return r.width},set:function(e){r.width=e,y(n,e)}},name:{get:function(){return r.name},set:function(e){r.name=e,s&&(s.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(t){r.closed=t,r.closed?K.addClass(n.__ul,e.CLASS_CLOSED):K.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return i},set:function(e){ae&&(i=e,e?K.bind(window,"unload",o):K.unbind(window,"unload",o),localStorage.setItem(_(n,"isLocal"),e))}}}),E.isUndefined(r.parent)){if(this.closed=r.closed||!1,K.addClass(this.domElement,e.CLASS_MAIN),K.makeSelectable(this.domElement,!1),ae&&i){n.useLocalStorage=!0;var a=localStorage.getItem(_(this,"gui"));a&&(r.load=JSON.parse(a))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,K.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),r.closeOnTop?(K.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(K.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),K.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===r.closed&&(r.closed=!0);var l=document.createTextNode(r.name);K.addClass(l,"controller-name"),s=c(n,l),K.addClass(this.__ul,e.CLASS_CLOSED),K.addClass(s,"title"),K.bind(s,"click",(function(e){return e.preventDefault(),n.closed=!n.closed,!1})),r.closed||(this.closed=!1)}r.autoPlace&&(E.isUndefined(r.parent)&&(de&&(ce=document.createElement("div"),K.addClass(ce,"dg"),K.addClass(ce,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ce),de=!1),ce.appendChild(this.domElement),K.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||y(n,r.width)),this.__resizeHandler=function(){n.onResizeDebounced()},K.bind(window,"resize",this.__resizeHandler),K.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),K.bind(this.__ul,"transitionend",this.__resizeHandler),K.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&x(this),o=function(){ae&&"true"===localStorage.getItem(_(n,"isLocal"))&&localStorage.setItem(_(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=o,r.parent||function(){var e=n.getRoot();e.width+=1,E.defer((function(){e.width-=1}))}()};pe.toggleHide=function(){he=!he,E.each(ue,(function(e){e.domElement.style.display=he?"none":""}))},pe.CLASS_AUTO_PLACE="a",pe.CLASS_AUTO_PLACE_CONTAINER="ac",pe.CLASS_MAIN="main",pe.CLASS_CONTROLLER_ROW="cr",pe.CLASS_TOO_TALL="taller-than-window",pe.CLASS_CLOSED="closed",pe.CLASS_CLOSE_BUTTON="close-button",pe.CLASS_CLOSE_TOP="close-top",pe.CLASS_CLOSE_BOTTOM="close-bottom",pe.CLASS_DRAG="drag",pe.DEFAULT_WIDTH=245,pe.TEXT_CLOSED="Close Controls",pe.TEXT_OPEN="Open Controls",pe._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||pe.toggleHide()},K.bind(window,"keydown",pe._keydownHandler,!1),E.extend(pe.prototype,{add:function(e,t){return g(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return g(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;E.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&ce.removeChild(this.domElement);var e=this;E.each(this.__folders,(function(t){e.removeFolder(t)})),K.unbind(window,"keydown",pe._keydownHandler,!1),h(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new pe(t);this.__folders[e]=n;var r=c(this,n.domElement);return K.addClass(r,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],h(e);var t=this;E.each(e.__folders,(function(t){e.removeFolder(t)})),E.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=K.getOffset(e.__ul).top,n=0;E.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=K.getHeight(t))})),window.innerHeight-t-20GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
'),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;E.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&b(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)})),this.autoPlace&&y(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=j(this)),e.folders={},E.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=j(this),u(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[se]=j(this,!0)),this.load.remembered[e]=j(this),this.preset=e,m(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){E.each(this.__controllers,(function(t){this.getRoot().load.remembered?f(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),E.each(this.__folders,(function(e){e.revert(e)})),e||u(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&w(this.__listening)},updateDisplay:function(){E.each(this.__controllers,(function(e){e.updateDisplay()})),E.each(this.__folders,(function(e){e.updateDisplay()}))}});var fe={Color:z,math:B,interpret:N},ge={Controller:I,BooleanController:$,OptionController:G,StringController:W,NumberController:X,NumberControllerBox:J,NumberControllerSlider:Y,FunctionController:Q,ColorController:Z},_e={dom:K},me={GUI:pe},ve=pe,be={color:fe,controllers:ge,dom:_e,gui:me,GUI:ve};e.color=fe,e.controllers=ge,e.dom=_e,e.gui=me,e.GUI=ve,e.default=be,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t){ +/** + * # ResurrectJS + * @version 1.0.3 + * @license Public Domain + * + * ResurrectJS preserves object behavior (prototypes) and reference + * circularity with a special JSON encoding. Unlike regular JSON, + * Date, RegExp, DOM objects, and `undefined` are also properly + * preserved. + * + * ## Examples + * + * function Foo() {} + * Foo.prototype.greet = function() { return "hello"; }; + * + * // Behavior is preserved: + * var necromancer = new Resurrect(); + * var json = necromancer.stringify(new Foo()); + * var foo = necromancer.resurrect(json); + * foo.greet(); // => "hello" + * + * // References to the same object are preserved: + * json = necromancer.stringify([foo, foo]); + * var array = necromancer.resurrect(json); + * array[0] === array[1]; // => true + * array[1].greet(); // => "hello" + * + * // Dates are restored properly + * json = necromancer.stringify(new Date()); + * var date = necromancer.resurrect(json); + * Object.prototype.toString.call(date); // => "[object Date]" + * + * ## Options + * + * Options are provided to the constructor as an object with these + * properties: + * + * prefix ('#'): A prefix string used for temporary properties added + * to objects during serialization and deserialization. It is + * important that you don't use any properties beginning with this + * string. This option must be consistent between both + * serialization and deserialization. + * + * cleanup (false): Perform full property cleanup after both + * serialization and deserialization using the `delete` + * operator. This may cause performance penalties (breaking hidden + * classes in V8) on objects that ResurrectJS touches, so enable + * with care. + * + * revive (true): Restore behavior (__proto__) to objects that have + * been resurrected. If this is set to false during serialization, + * resurrection information will not be encoded. You still get + * circularity and Date support. + * + * resolver (Resurrect.NamespaceResolver(window)): Converts between + * a name and a prototype. Create a custom resolver if your + * constructors are not stored in global variables. The resolver + * has two methods: getName(object) and getPrototype(string). + * + * For example, + * + * var necromancer = new Resurrect({ + * prefix: '__#', + * cleanup: true + * }); + * + * ## Caveats + * + * * With the default resolver, all constructors must be named and + * stored in the global variable under that name. This is required + * so that the prototypes can be looked up and reconnected at + * resurrection time. + * + * * The wrapper objects Boolean, String, and Number will be + * unwrapped. This means extra properties added to these objects + * will not be preserved. + * + * * Functions cannot ever be serialized. Resurrect will throw an + * error if a function is found when traversing a data structure. + * + * @see http://nullprogram.com/blog/2013/03/28/ + */ +function n(e){for(var t in this.table=null,this.prefix="#",this.cleanup=!1,this.revive=!0,e)e.hasOwnProperty(t)&&(this[t]=e[t]);this.refcode=this.prefix+"id",this.origcode=this.prefix+"original",this.buildcode=this.prefix+".",this.valuecode=this.prefix+"v"}e.exports=n,n.GLOBAL=(0,eval)("this"),n.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},n.prototype.Error=function(e){this.message=e||"",this.stack=(new Error).stack},n.prototype.Error.prototype=Object.create(Error.prototype),n.prototype.Error.prototype.name="ResurrectError",n.NamespaceResolver=function(e){this.scope=e},n.NamespaceResolver.prototype.getPrototype=function(e){var t=this.scope[e];if(t)return t.prototype;throw new n.prototype.Error("Unknown constructor: "+e)},n.NamespaceResolver.prototype.getName=function(e){var t=e.constructor.name;if(null==t&&(t=/^\s*function\s*([A-Za-z0-9_$]*)/.exec(e.constructor)[1]),""===t)throw new n.prototype.Error("Can't serialize objects with anonymous constructors.");return"Object"===t||"Array"===t?null:t},n.prototype.resolver=new n.NamespaceResolver(n.GLOBAL),n.Node=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},n.is=function(e){var t="[object "+e+"]";return function(e){return Object.prototype.toString.call(e)===t}},n.isArray=n.is("Array"),n.isString=n.is("String"),n.isBoolean=n.is("Boolean"),n.isNumber=n.is("Number"),n.isFunction=n.is("Function"),n.isDate=n.is("Date"),n.isRegExp=n.is("RegExp"),n.isObject=n.is("Object"),n.isAtom=function(e){return!n.isObject(e)&&!n.isArray(e)},n.isPrimitive=function(e){return null==e||n.isNumber(e)||n.isString(e)||n.isBoolean(e)},n.prototype.ref=function(e){var t={};return t[this.prefix]=void 0===e?-1:e[this.refcode],t},n.prototype.deref=function(e){return this.table[e[this.prefix]]},n.prototype.tag=function(e){if(this.revive){var t=this.resolver.getName(e);if(t){var n=Object.getPrototypeOf(e);if(this.resolver.getPrototype(t)!==n)throw new this.Error("Constructor mismatch!");e[this.prefix]=t}}return e[this.refcode]=this.table.length,this.table.push(e),e[this.refcode]},n.prototype.builder=function(e,t){var n={};return n[this.buildcode]=e,n[this.valuecode]=t,n},n.prototype.build=function(e){var t=e[this.buildcode].split(/\./).reduce((function(e,t){return e[t]}),n.GLOBAL),r=[null].concat(e[this.valuecode]),i=new(t.bind.apply(t,r));return n.isPrimitive(i)?i.valueOf():i},n.prototype.decode=function(e){if(this.prefix in e)return this.deref(e);if(this.buildcode in e)return this.build(e);throw new this.Error("Unknown encoding.")},n.prototype.isTagged=function(e){return this.refcode in e&&null!=e[this.refcode]},n.prototype.visit=function(e,t,r){if(n.isAtom(e))return t(e);if(this.isTagged(e))return this.ref(e);var i=null;if(n.isArray(e)){i=[],e[this.refcode]=this.tag(i);for(var o=0;o=0?t:void 0}}if(n.isAtom(e))return JSON.stringify(this.handleAtom(e),t,r);this.table=[],this.visit(e,this.handleAtom.bind(this),t);for(var o=0;o ul {\n height: 100%;\n background: #191921;\n overflow-y: auto;\n scrollbar-color: #0d0f1b #0d0f1b;\n scrollbar-width: thin;\n}\n\nbody .dg.main > ul:hover {\n scrollbar-color: #44444e #0d0f1b;\n scrollbar-width: thin;\n}\n\nbody .dg.main > ul::-webkit-scrollbar {\n background: #0d0f1b;\n width: 6px;\n height: 6px;\n}\n\nbody .dg.main > ul::-webkit-scrollbar-track,\nbody .dg.main > ul::-webkit-scrollbar-corner {\n background: #0d0f1b;\n}\n\nbody .dg.main > ul::-webkit-scrollbar-thumb {\n background: #0d0f1b;\n border-radius: 3px;\n}\n\nbody .dg.main > ul:hover::-webkit-scrollbar-thumb {\n background: #44444e;\n}\n\nbody .dg {\n color: #6d6d7d;\n text-shadow: none !important;\n font-size: 12px;\n}\n\nbody .dg .closed .cr {\n display: none;\n}\n\nbody .dg li:not(.folder) {\n height: 29px;\n background: #1c1c25;\n border-bottom: 0px;\n padding: 0 8px 0 12px;\n}\n\nbody .dg li.save-row .button {\n text-shadow: none !important;\n}\n\nbody .dg li.title {\n padding: 2px 0 0 24px;\n color: #6a6977;\n background: #0d0f1b\n url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==)\n no-repeat;\n background-position: 12px;\n}\n\nbody .dg li.title:hover {\n color: #9494a2;\n}\n\nbody .dg .cr.boolean:hover {\n background: #20212b;\n}\n\nbody .dg .cr.function {\n background: #262731;\n color: #636371;\n border-top: 1px solid #30313c;\n}\n\nbody .dg .cr.function:hover {\n background: #30313e;\n}\n\nbody .dg .cr.function:active {\n background: #2d2e3a;\n}\n\nbody .dg .cr.function:active .property-name {\n transform: translateY(1px);\n}\n\nbody .dg .c,\nbody .dg .property-name {\n width: 50%;\n}\n\nbody .dg .c select {\n margin-top: 2px;\n margin-left: -5px;\n padding: 3px 5px;\n}\n\nbody .dg .c select,\nbody .dg .c input[type="text"],\nbody .dg .cr.number input[type="text"] {\n text-align: right;\n background: transparent;\n color: #686c7b;\n border: 0;\n border-radius: 2px;\n overflow: hidden;\n font-size: 11px;\n}\n\nbody .dg .cr.number,\nbody .dg .cr.boolean,\nbody .dg .cr.function {\n border-left: 0;\n}\n\nbody .dg .c select,\nbody .dg .c select:focus {\n width: 88px;\n}\n\nbody .dg .c input[type="text"]:hover {\n background: #2b2c3a;\n}\n\nbody .dg .c input[type="text"]:focus {\n background: #2b2c3a;\n color: #fff;\n outline: none;\n}\n\nbody .dg .c input[type="checkbox"] {\n margin-top: 10px;\n border: none;\n border-radius: 50%;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background: #35363e;\n display: block;\n width: 7px;\n height: 7px;\n float: right;\n}\n\nbody .dg .c input[type="checkbox"]:checked {\n background: #747784;\n}\n\nbody .dg .c .slider {\n background: #23232d;\n border-radius: 2px;\n box-shadow: none;\n padding: 0;\n overflow: hidden;\n}\n\nbody .dg .c .slider:hover {\n background: #282b3a;\n}\n\nbody .dg .c .slider-fg {\n background: #3f4354;\n border-radius: 0;\n margin-left: 0;\n padding-right: 0;\n}\n\nbody .dg .c .slider-fg:after {\n display: none;\n}\n\nbody .dg .c .slider:hover .slider-fg {\n background: #4d526b;\n}\n\nbody .dg li.folder {\n border-left: 0;\n}\n\nbody .dg.a {\n margin-right: 0;\n}\n'},function(e,t,n){!function(t){var n,r={},i={16:!1,18:!1,17:!1,91:!1},o="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},a={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},l=function(e){return a[e]||e.toUpperCase().charCodeAt(0)},d=[];for(n=1;n<20;n++)a["f"+n]=111+n;function c(e,t){for(var n=e.length;n--;)if(e[n]===t)return n;return-1}function h(e,t){if(e.length!=t.length)return!1;for(var n=0;n1&&(o=m(e),e=[e[e.length-1]]),e=e[0],(e=l(e))in r||(r[e]=[]),r[e].push({shortcut:i[s],scope:t,method:n,key:i[s],mods:o})}for(n in s)f[n]=!1;function g(){return o||"all"}function _(e){var t;return""==(t=(e=e.replace(/\s/g,"")).split(","))[t.length-1]&&(t[t.length-2]+=","),t}function m(e){for(var t=e.slice(0,e.length-1),n=0;n0,i)(!i[o]&&c(n.mods,+o)>-1||i[o]&&-1==c(n.mods,+o))&&(l=!1);(0!=n.mods.length||i[16]||i[18]||i[17]||i[91])&&!l||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}(e)})),v(document,"keyup",(function(e){var t,n=e.keyCode,r=c(d,n);if(r>=0&&d.splice(r,1),93!=n&&224!=n||(n=91),n in i)for(t in i[n]=!1,s)s[t]==n&&(f[t]=!1)})),v(window,"focus",(function(){for(n in i)i[n]=!1;for(n in s)f[n]=!1}));var b=t.key;t.key=f,t.key.setScope=function(e){o=e||"all"},t.key.getScope=g,t.key.deleteScope=function(e){var t,n,i;for(t in r)for(n=r[t],i=0;i1&&(d=m(i),e=i[i.length-1]),e=l(e),void 0===t&&(t=g()),!r[e])return;for(o=0;o@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,r){var i=new e.jstree.core(++n),o=r;return r=e.extend(!0,{},e.jstree.defaults,r),o&&o.plugins&&(r.plugins=o.plugins),e.each(r.plugins,(function(e,t){"core"!==e&&(i=i.plugin(t,r[t]))})),e(t).data("jstree",i),i.init(t,r),i},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(l).off(".jstree")},e.jstree.core=function(e){this._id=e,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}}},e.jstree.reference=function(t){var n=null,r=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!r||!r.length)try{r=e(t)}catch(e){}if(!r||!r.length)try{r=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return r&&r.length&&(r=r.closest(".jstree")).length&&(r=r.data("jstree"))?n=r:e(".jstree").each((function(){var r=e(this).data("jstree");return r&&r._model.data[t]?(n=r,!1):void 0})),n},e.fn.jstree=function(n){var r="string"==typeof n,i=Array.prototype.slice.call(arguments,1),o=null;return!(!0===n&&!this.length)&&(this.each((function(){var s=e.jstree.reference(this),a=r&&s?s[n]:null;return o=r&&a?a.apply(s,i):null,s||r||n!==t&&!e.isPlainObject(n)||e.jstree.create(this,n),(s&&!r||!0===n)&&(o=s||!1),(null===o||o===t)&&void 0})),null!==o&&o!==t?o:this)},e.expr.pseudos.jstree=e.expr.createPseudo((function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}})),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.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(t){t.type="click",e(t.currentTarget).trigger(t)},enter:function(t){t.type="click",e(t.currentTarget).trigger(t)},left:function(t){if(t.preventDefault(),this.is_open(t.currentTarget))this.close_node(t.currentTarget);else{var n=this.get_parent(t.currentTarget);n&&n.id!==e.jstree.root&&this.get_node(n,!0).children(".jstree-anchor").focus()}},up:function(e){e.preventDefault();var t=this.get_prev_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},right:function(t){if(t.preventDefault(),this.is_closed(t.currentTarget))this.open_node(t.currentTarget,(function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}));else if(this.is_open(t.currentTarget)){var n=this.get_node(t.currentTarget,!0).children(".jstree-children")[0];n&&e(this._firstChild(n)).children(".jstree-anchor").focus()}},down:function(e){e.preventDefault();var t=this.get_next_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},"*":function(e){this.open_all()},home:function(t){t.preventDefault();var n=this._firstChild(this.get_container_ul()[0]);n&&e(n).children(".jstree-anchor").filter(":visible").focus()},end:function(e){e.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(e){e.preventDefault(),this.edit(e.currentTarget)}}},e.jstree.core.prototype={plugin:function(t,n){var r=e.jstree.plugins[t];return r?(this._data[t]={},r.prototype=this,new r(n,this)):this},init:function(t,n){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,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(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(e.jstree.root)},destroy:function(e){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,n=l.createElement("LI");return n.setAttribute("role","none"),(e=l.createElement("I")).className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),n.appendChild(e),(e=l.createElement("A")).className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),e.setAttribute("role","treeitem"),(t=l.createElement("I")).className="jstree-icon jstree-themeicon",t.setAttribute("role","presentation"),e.appendChild(t),n.appendChild(e),e=t=null,n},_kbevent_to_func:function(e){var t={8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},n=[];if(e.ctrlKey&&n.push("ctrl"),e.altKey&&n.push("alt"),e.shiftKey&&n.push("shift"),n.push(t[e.which]||e.which),"shift-shift"===(n=n.sort().join("-").toLowerCase())||"ctrl-ctrl"===n||"alt-alt"===n)return null;var r,i,o=this.settings.core.keyboard;for(r in o)if(o.hasOwnProperty(r)&&("-"!==(i=r)&&"+"!==i&&(i=(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),i===n))return o[r];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",(function(){return this.className.replace(/jstree[^ ]*|$/gi,"")})),this.element=null},bind:function(){var t="",n=null,r=0;this.element.on("dblclick.jstree",(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(l.selection&&l.selection.empty)l.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}})).on("mousedown.jstree",e.proxy((function(e){e.target===this.element[0]&&(e.preventDefault(),r=+new Date)}),this)).on("mousedown.jstree",".jstree-ocl",(function(e){e.preventDefault()})).on("click.jstree",".jstree-ocl",e.proxy((function(e){this.toggle_node(e.target)}),this)).on("dblclick.jstree",".jstree-anchor",e.proxy((function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(t){t.preventDefault(),t.currentTarget!==l.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)}),this)).on("keydown.jstree",".jstree-anchor",e.proxy((function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===e.which?e.which=39:39===e.which&&(e.which=37));var t=this._kbevent_to_func(e);if(t){var n=t.call(this,e);if(!1===n||!0===n)return n}}),this)).on("load_node.jstree",e.proxy((function(t,n){n.status&&(n.node.id!==e.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(e.proxy((function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var t,n,r=[];for(t=0,n=this._data.core.selected.length;n>t;t++)r=r.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,n=(r=e.vakata.array_unique(r)).length;n>t;t++)this.open_node(r[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}}),this),0))}),this)).on("keypress.jstree",e.proxy((function(r){if(r.target.tagName&&"input"===r.target.tagName.toLowerCase())return!0;n&&clearTimeout(n),n=setTimeout((function(){t=""}),500);var i=String.fromCharCode(r.which).toLowerCase(),o=this.element.find(".jstree-anchor").filter(":visible"),s=o.index(l.activeElement)||0,a=!1;if((t+=i).length>1){if(o.slice(s).each(e.proxy((function(n,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),a=!0,!1):void 0}),this)),a)return;if(o.slice(0,s).each(e.proxy((function(n,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),a=!0,!1):void 0}),this)),a)return}if(new RegExp("^"+i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(o.slice(s+1).each(e.proxy((function(t,n){return e(n).text().toLowerCase().charAt(0)===i?(e(n).focus(),a=!0,!1):void 0}),this)),a)return;if(o.slice(0,s+1).each(e.proxy((function(t,n){return e(n).text().toLowerCase().charAt(0)===i?(e(n).focus(),a=!0,!1):void 0}),this)),a)return}}),this)).on("init.jstree",e.proxy((function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)}),this)).on("loading.jstree",e.proxy((function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()}),this)).on("blur.jstree",".jstree-anchor",e.proxy((function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")}),this)).on("focus.jstree",".jstree-anchor",e.proxy((function(t){var n=this.get_node(t.currentTarget);n&&n.id&&(this._data.core.focused=n.id),this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave"),e(t.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")}),this)).on("focus.jstree",e.proxy((function(){if(+new Date-r>500&&!this._data.core.focused&&this.settings.core.restore_focus){r=0;var e=this.get_node(this.element.attr("aria-activedescendant"),!0);e&&e.find("> .jstree-anchor").focus()}}),this)).on("mouseenter.jstree",".jstree-anchor",e.proxy((function(e){this.hover_node(e.currentTarget)}),this)).on("mouseleave.jstree",".jstree-anchor",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},unbind:function(){this.element.off(".jstree"),e(l).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(t,n){var r;t&&t.id&&(t=t.id),t instanceof e&&t.length&&t[0].id&&(t=t[0].id);try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(r=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=this.element.find(t)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=this.element.find(t)).length||!r.hasClass("jstree"))return!1;t=this._model.data[e.jstree.root]}return n&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(e){return!1}},get_path:function(t,n,r){if(!(t=t.parents?t:this.get_node(t))||t.id===e.jstree.root||!t.parents)return!1;var i,o,s=[];for(s.push(r?t.id:t.text),i=0,o=t.parents.length;o>i;i++)s.push(r?t.parents[i]:this.get_text(t.parents[i]));return s=s.reverse().slice(1),n?s.join(n):s},get_next_dom:function(t,n){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(n){r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}if(t.hasClass("jstree-open")){for(r=this._firstChild(t.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return e(r)}r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return null!==r?e(r):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,n){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(n){r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);if(null!==r){for(t=e(r);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return!(!(r=t[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&e(r)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||e.children.length>0)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var r,i,o,s,a;if(e.isArray(t))return this._load_nodes(t.slice(),n),!0;if(!(t=this.get_node(t)))return n&&n.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,o=0,s=t.parents.length;s>o;o++)this._model.data[t.parents[o]].children_d=e.vakata.array_filter(this._model.data[t.parents[o]].children_d,(function(n){return-1===e.inArray(n,t.children_d)}));for(r=0,i=t.children_d.length;i>r;r++)this._model.data[t.children_d[r]].state.selected&&(a=!0),delete this._model.data[t.children_d[r]];a&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(n){return-1===e.inArray(n,t.children_d)}))),t.children=[],t.children_d=[],a&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy((function(e){(t=this._model.data[t.id]).state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var r=this.get_node(t,!0),i=0,o=0,s=this._model.data,a=!1;for(i=0,o=t.children.length;o>i;i++)if(s[t.children[i]]&&!s[t.children[i]].state.hidden){a=!0;break}t.state.loaded&&r&&r.length&&(r.removeClass("jstree-closed jstree-open jstree-leaf"),a?"#"!==t.id&&r.addClass(t.state.opened?"jstree-open":"jstree-closed"):r.addClass("jstree-leaf")),r.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)}),this)),!0},_load_nodes:function(e,t,n,r){var i,o,s=!0,a=function(){this._load_nodes(e,t,!0)},l=this._model.data,d=[];for(i=0,o=e.length;o>i;i++)l[e[i]]&&(!l[e[i]].state.loaded&&!l[e[i]].state.failed||!n&&r)&&(this.is_loading(e[i])||this.load_node(e[i],a),s=!1);if(s){for(i=0,o=e.length;o>i;i++)l[e[i]]&&l[e[i]].state.loaded&&d.push(e[i]);t&&!t.done&&(t.call(this,d),t.done=!0)}},load_all:function(t,n){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,i,o=[],s=this._model.data,a=s[t.id].children_d;for(t.state&&!t.state.loaded&&o.push(t.id),r=0,i=a.length;i>r;r++)s[a[r]]&&s[a[r]].state&&!s[a[r]].state.loaded&&o.push(a[r]);o.length?this._load_nodes(o,(function(){this.load_all(t,n)})):(n&&n.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,n){var r,i=this.settings.core.data,o=function(){return 3!==this.nodeType&&8!==this.nodeType};return i?e.isFunction(i)?i.call(this,t,e.proxy((function(r){!1===r?n.call(this,!1):this["string"==typeof r?"_append_html_data":"_append_json_data"](t,"string"==typeof r?e(e.parseHTML(r)).filter(o):r,(function(e){n.call(this,e)}))}),this)):"object"==typeof i?i.url?(i=e.extend(!0,{},i),e.isFunction(i.url)&&(i.url=i.url.call(this,t)),e.isFunction(i.data)&&(i.data=i.data.call(this,t)),e.ajax(i).done(e.proxy((function(r,i,s){var a=s.getResponseHeader("Content-Type");return a&&-1!==a.indexOf("json")||"object"==typeof r?this._append_json_data(t,r,(function(e){n.call(this,e)})):a&&-1!==a.indexOf("html")||"string"==typeof r?this._append_html_data(t,e(e.parseHTML(r)).filter(o),(function(e){n.call(this,e)})):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:s})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1))}),this)).fail(e.proxy((function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},n.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)}),this))):(r=e.isArray(i)?e.extend(!0,[],i):e.isPlainObject(i)?e.extend(!0,{},i):i,t.id===e.jstree.root?this._append_json_data(t,r,(function(e){n.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1))):"string"==typeof i?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(i)).filter(o),(function(e){n.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1)):n.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),(function(e){n.call(this,e)})):n.call(this,!1)},_node_changed:function(t){(t=this.get_node(t))&&-1===e.inArray(t.id,this._model.changed)&&this._model.changed.push(t.id)},_append_html_data:function(t,n,r){(t=this.get_node(t)).children=[],t.children_d=[];var i,o,s,a=n.is("ul")?n.children():n,l=t.id,d=[],c=[],h=this._model.data,u=h[l],p=this._data.core.selected.length;for(a.each(e.proxy((function(t,n){(i=this._parse_model_from_html(e(n),l,u.parents.concat()))&&(d.push(i),c.push(i),h[i].children_d.length&&(c=c.concat(h[i].children_d)))}),this)),u.children=d,u.children_d=c,o=0,s=u.parents.length;s>o;o++)h[u.parents[o]].children_d=h[u.parents[o]].children_d.concat(c);this.trigger("model",{nodes:c,parent:l}),l!==e.jstree.root?(this._node_changed(l),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==p&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.call(this,!0)},_append_json_data:function(t,n,r,i){if(null!==this.element){(t=this.get_node(t)).children=[],t.children_d=[],n.d&&"string"==typeof(n=n.d)&&(n=JSON.parse(n)),e.isArray(n)||(n=[n]);var o=null,s={df:this._model.default_state,dat:n,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},a=this,l=function(e,t){e.data&&(e=e.data);var n,r,i,o,s=e.dat,l=e.par,d=[],c=[],h=[],u=e.df,p=e.t_id,f=e.t_cnt,g=e.m,_=g[l],m=e.sel,v=function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l=e.id.toString(),d={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:n,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in u)u.hasOwnProperty(i)&&(d.state[i]=u[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),(d.icon===t||null===d.icon||""===d.icon)&&(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(d.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(d.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(d.li_attr[i]=e.li_attr[i]);if(d.li_attr.id||(d.li_attr.id=l),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(d.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),g[d.id]=d,i=0,o=d.children.length;o>i;i++)s=v(g[d.children[i]],d.id,r),a=g[s],d.children_d.push(s),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d));return delete e.data,delete e.children,g[d.id].original=e,d.state.selected&&h.push(d.id),d.id},b=function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l,d=!1;do{d="j"+p+"_"+ ++f}while(g[d]);for(i in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},u)u.hasOwnProperty(i)&&(l.state[i]=u[i]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,o=e.children.length;o>i;i++)s=b(e.children[i],l.id,r),a=g[s],l.children.push(s),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,g[l.id]=l,l.state.selected&&h.push(l.id),l.id};if(s.length&&s[0].id!==t&&s[0].parent!==t){for(r=0,i=s.length;i>r;r++)s[r].children||(s[r].children=[]),s[r].state||(s[r].state={}),g[s[r].id.toString()]=s[r];for(r=0,i=s.length;i>r;r++)g[s[r].parent.toString()]?(g[s[r].parent.toString()].children.push(s[r].id.toString()),_.children_d.push(s[r].id.toString())):void 0!==a&&(a._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:s[r].id.toString(),parent:s[r].parent.toString()})},a.settings.core.error.call(a,a._data.core.last_error));for(r=0,i=_.children.length;i>r;r++)n=v(g[_.children[r]],l,_.parents.concat()),c.push(n),g[n].children_d.length&&(c=c.concat(g[n].children_d));for(r=0,i=_.parents.length;i>r;r++)g[_.parents[r]].children_d=g[_.parents[r]].children_d.concat(c);o={cnt:f,mod:g,sel:m,par:l,dpc:c,add:h}}else{for(r=0,i=s.length;i>r;r++)(n=b(s[r],l,_.parents.concat()))&&(d.push(n),c.push(n),g[n].children_d.length&&(c=c.concat(g[n].children_d)));for(_.children=d,_.children_d=c,r=0,i=_.parents.length;i>r;r++)g[_.parents[r]].children_d=g[_.parents[r]].children_d.concat(c);o={cnt:f,mod:g,sel:m,par:l,dpc:c,add:h}}return"undefined"!=typeof window&&void 0!==window.document?o:void postMessage(o)},c=function(t,n){if(null!==this.element){this._cnt=t.cnt;var i,o=this._model.data;for(i in o)o.hasOwnProperty(i)&&o[i].state&&o[i].state.loading&&t.mod[i]&&(t.mod[i].state.loading=!0);if(this._model.data=t.mod,n){var s,l=t.add,c=t.sel,h=this._data.core.selected.slice();if(o=this._model.data,c.length!==h.length||e.vakata.array_unique(c.concat(h)).length!==c.length){for(i=0,s=c.length;s>i;i++)-1===e.inArray(c[i],l)&&-1===e.inArray(c[i],h)&&(o[c[i]].state.selected=!1);for(i=0,s=h.length;s>i;i++)-1===e.inArray(h[i],c)&&(o[h[i]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!n&&d?d((function(){r.call(a,!0)})):r.call(a,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+l.toString()],{type:"text/javascript"}))),!this._data.core.working||i?(this._data.core.working=!0,(o=new window.Worker(this._wrk)).onmessage=e.proxy((function(e){c.call(this,e.data,!0);try{o.terminate(),o=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}),this),s.par?o.postMessage(s):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,n,r,!0])}catch(e){c.call(this,l(s),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else c.call(this,l(s),!1)}},_parse_model_from_html:function(n,r,i){i=i?[].concat(i):[],r&&i.unshift(r);var o,s,a,l,d,c=this._model.data,h={id:!1,text:!1,icon:!0,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in this._model.default_state)this._model.default_state.hasOwnProperty(a)&&(h.state[a]=this._model.default_state[a]);if(l=e.vakata.attributes(n,!0),e.each(l,(function(t,n){return!(n=e.vakata.trim(n)).length||(h.li_attr[t]=n,void("id"===t&&(h.id=n.toString())))})),(l=n.children("a").first()).length&&(l=e.vakata.attributes(l,!0),e.each(l,(function(t,n){(n=e.vakata.trim(n)).length&&(h.a_attr[t]=n)}))),(l=n.children("a").first().length?n.children("a").first().clone():n.clone()).children("ins, i, ul").remove(),l=l.html(),l=e("
").html(l),h.text=this.settings.core.force_text?l.text():l.html(),l=n.data(),h.data=l?e.extend(!0,{},l):null,h.state.opened=n.hasClass("jstree-open"),h.state.selected=n.children("a").hasClass("jstree-clicked"),h.state.disabled=n.children("a").hasClass("jstree-disabled"),h.data&&h.data.jstree)for(a in h.data.jstree)h.data.jstree.hasOwnProperty(a)&&(h.state[a]=h.data.jstree[a]);(l=n.children("a").children(".jstree-themeicon")).length&&(h.icon=!l.hasClass("jstree-themeicon-hidden")&&l.attr("rel")),h.state.icon!==t&&(h.icon=h.state.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),l=n.children("ul").children("li");do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);return h.id=h.li_attr.id?h.li_attr.id.toString():d,l.length?(l.each(e.proxy((function(t,n){o=this._parse_model_from_html(e(n),h.id,i),s=this._model.data[o],h.children.push(o),s.children_d.length&&(h.children_d=h.children_d.concat(s.children_d))}),this)),h.children_d=h.children_d.concat(h.children)):n.hasClass("jstree-closed")&&(h.state.loaded=!1),h.li_attr.class&&(h.li_attr.class=h.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),h.a_attr.class&&(h.a_attr.class=h.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),c[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_flat_json:function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l=e.id.toString(),d=this._model.data,c=this._model.default_state,h={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:n,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in c)c.hasOwnProperty(i)&&(h.state[i]=c[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(h.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(h.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(h.li_attr[i]=e.li_attr[i]);if(h.li_attr.id||(h.li_attr.id=l),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(h.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),d[h.id]=h,i=0,o=h.children.length;o>i;i++)a=d[s=this._parse_model_from_flat_json(d[h.children[i]],h.id,r)],h.children_d.push(s),a.children_d.length&&(h.children_d=h.children_d.concat(a.children_d));return delete e.data,delete e.children,d[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l,d=!1,c=this._model.data,h=this._model.default_state;do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);for(i in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},h)h.hasOwnProperty(i)&&(l.state[i]=h[i]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,o=e.children.length;o>i;i++)a=c[s=this._parse_model_from_json(e.children[i],l.id,r)],l.children.push(s),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children.concat(l.children_d)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,c[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var t,n,r,i=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),o=l.createElement("UL"),s=this._data.core.focused;for(n=0,r=i.length;r>n;n++)(t=this.redraw_node(i[n],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&o.appendChild(t);this._model.force_full_redraw&&(o.className=this.get_container_ul()[0].className,o.setAttribute("role","group"),this.element.empty().append(o)),null!==s&&this.settings.core.restore_focus&&((t=this.get_node(s,!0))&&t.length&&t.children(".jstree-anchor")[0]!==l.activeElement?t.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:i})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(t){var n=this.get_node(t),r=!1,i=!1,o=!1,s=l;if(!n)return!1;if(n.id===e.jstree.root)return this.redraw(!0);if(!(t=this.get_node(t,!0))||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],n.children.length&&n.state.loaded){for((o=s.createElement("UL")).setAttribute("role","group"),o.className="jstree-children",r=0,i=n.children.length;i>r;r++)o.appendChild(this.redraw_node(n.children[r],!0,!0));t.appendChild(o)}},redraw_node:function(t,n,r,i){var o=this.get_node(t),s=!1,a=!1,d=!1,c=!1,h=!1,u=!1,p="",f=l,g=this._model.data,_=!1,m=null,v=0,b=0,x=!1,y=!1;if(!o)return!1;if(o.id===e.jstree.root)return this.redraw(!0);if(n=n||0===o.children.length,t=l.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(o.id[0])?"\\3"+o.id[0]+" "+o.id.substr(1).replace(e.jstree.idregex,"\\$&"):o.id.replace(e.jstree.idregex,"\\$&"))):l.getElementById(o.id))t=e(t),r||((s=t.parent().parent()[0])===this.element[0]&&(s=null),a=t.index()),n||!o.children.length||t.children(".jstree-children").length||(n=!0),n||(d=t.children(".jstree-children")[0]),_=t.children(".jstree-anchor")[0]===l.activeElement,t.remove();else if(n=!0,!r){if(!(null===(s=o.parent!==e.jstree.root?e("#"+o.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||s&&g[o.parent].state.opened))return!1;a=e.inArray(o.id,null===s?g[e.jstree.root].children:g[o.parent].children)}for(c in t=this._data.core.node.cloneNode(!0),p="jstree-node ",o.li_attr)if(o.li_attr.hasOwnProperty(c)){if("id"===c)continue;"class"!==c?t.setAttribute(c,o.li_attr[c]):p+=o.li_attr[c]}for(o.a_attr.id||(o.a_attr.id=o.id+"_anchor"),t.childNodes[1].setAttribute("aria-selected",!!o.state.selected),t.childNodes[1].setAttribute("aria-level",o.parents.length),this.settings.core.compute_elements_positions&&(t.childNodes[1].setAttribute("aria-setsize",g[o.parent].children.length),t.childNodes[1].setAttribute("aria-posinset",g[o.parent].children.indexOf(o.id)+1)),o.state.disabled&&t.childNodes[1].setAttribute("aria-disabled",!0),c=0,h=o.children.length;h>c;c++)if(!g[o.children[c]].state.hidden){x=!0;break}if(null!==o.parent&&g[o.parent]&&!o.state.hidden&&(c=e.inArray(o.id,g[o.parent].children),y=o.id,-1!==c))for(c++,h=g[o.parent].children.length;h>c&&(g[g[o.parent].children[c]].state.hidden||(y=g[o.parent].children[c]),y===o.id);c++);for(h in o.state.hidden&&(p+=" jstree-hidden"),o.state.loading&&(p+=" jstree-loading"),o.state.loaded&&!x?p+=" jstree-leaf":(p+=o.state.opened&&o.state.loaded?" jstree-open":" jstree-closed",t.childNodes[1].setAttribute("aria-expanded",o.state.opened&&o.state.loaded)),y===o.id&&(p+=" jstree-last"),t.id=o.id,t.className=p,p=(o.state.selected?" jstree-clicked":"")+(o.state.disabled?" jstree-disabled":""),o.a_attr)if(o.a_attr.hasOwnProperty(h)){if("href"===h&&"#"===o.a_attr[h])continue;"class"!==h?t.childNodes[1].setAttribute(h,o.a_attr[h]):p+=" "+o.a_attr[h]}if(p.length&&(t.childNodes[1].className="jstree-anchor "+p),(o.icon&&!0!==o.icon||!1===o.icon)&&(!1===o.icon?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===o.icon.indexOf("/")&&-1===o.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+o.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+o.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(f.createTextNode(o.text)):t.childNodes[1].innerHTML+=o.text,n&&o.children.length&&(o.state.opened||i)&&o.state.loaded){for((u=f.createElement("UL")).setAttribute("role","group"),u.className="jstree-children",c=0,h=o.children.length;h>c;c++)u.appendChild(this.redraw_node(o.children[c],n,!0));t.appendChild(u)}if(d&&t.appendChild(d),!r){for(s||(s=this.element[0]),c=0,h=s.childNodes.length;h>c;c++)if(s.childNodes[c]&&s.childNodes[c].className&&-1!==s.childNodes[c].className.indexOf("jstree-children")){m=s.childNodes[c];break}m||((m=f.createElement("UL")).setAttribute("role","group"),m.className="jstree-children",s.appendChild(m)),a<(s=m).childNodes.length?s.insertBefore(t,s.childNodes[a]):s.appendChild(t),_&&(v=this.element[0].scrollTop,b=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=v,this.element[0].scrollLeft=b)}return o.state.opened&&!o.state.loaded&&(o.state.opened=!1,setTimeout(e.proxy((function(){this.open_node(o.id,!1,0)}),this),0)),t},open_node:function(n,r,i){var o,s,a,l;if(e.isArray(n)){for(o=0,s=(n=n.slice()).length;s>o;o++)this.open_node(n[o],r,i);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root)&&(i=i===t?this.settings.core.animation:i,this.is_closed(n)?this.is_loaded(n)?(a=this.get_node(n,!0),l=this,a.length&&(i&&a.children(".jstree-children").length&&a.children(".jstree-children").stop(!0,!0),n.children.length&&!this._firstChild(a.children(".jstree-children")[0])&&this.draw_children(n),i?(this.trigger("before_open",{node:n}),a.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").children(".jstree-anchor").attr("aria-expanded",!0).end().children(".jstree-children").stop(!0,!0).slideDown(i,(function(){this.style.display="",l.element&&l.trigger("after_open",{node:n})}))):(this.trigger("before_open",{node:n}),a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].childNodes[1].setAttribute("aria-expanded",!0))),n.state.opened=!0,r&&r.call(this,n,!0),a.length||this.trigger("before_open",{node:n}),this.trigger("open_node",{node:n}),i&&a.length||this.trigger("after_open",{node:n}),!0):this.is_loading(n)?setTimeout(e.proxy((function(){this.open_node(n,r,i)}),this),500):void this.load_node(n,(function(e,t){return t?this.open_node(e,r,i):!!r&&r.call(this,e,!1)})):(r&&r.call(this,n,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var n,r,i=t.parents;for(n=0,r=i.length;r>n;n+=1)n!==e.jstree.root&&this.open_node(i[n],!1,0);return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(n,r){var i,o,s,a;if(e.isArray(n)){for(i=0,o=(n=n.slice()).length;o>i;i++)this.close_node(n[i],r);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root)&&!this.is_closed(n)&&(r=r===t?this.settings.core.animation:r,s=this,a=this.get_node(n,!0),n.state.opened=!1,this.trigger("close_node",{node:n}),void(a.length?r?a.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").children(".jstree-anchor").attr("aria-expanded",!1).end().children(".jstree-children").stop(!0,!0).slideUp(r,(function(){this.style.display="",a.children(".jstree-children").remove(),s.element&&s.trigger("after_close",{node:n})})):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.children(".jstree-anchor").attr("aria-expanded",!1),a.children(".jstree-children").remove(),this.trigger("after_close",{node:n})):this.trigger("after_close",{node:n})))},toggle_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.toggle_node(t[n]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,n,r){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var i,o,s,a=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0);if(!a.length){for(i=0,o=t.children_d.length;o>i;i++)this.is_closed(this._model.data[t.children_d[i]])&&(this._model.data[t.children_d[i]].state.opened=!0);return this.trigger("open_all",{node:t})}r=r||a,s=this,(a=this.is_closed(t)?a.find(".jstree-closed").addBack():a.find(".jstree-closed")).each((function(){s.open_node(this,(function(e,t){t&&this.is_parent(e)&&this.open_all(e,n,r)}),n||0)})),0===r.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(r)})},close_all:function(t,n){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,i,o=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),s=this;for(o.length&&(o=this.is_open(t)?o.find(".jstree-open").addBack():o.find(".jstree-open"),e(o.get().reverse()).each((function(){s.close_node(this,n||0)}))),r=0,i=t.children_d.length;i>r;r++)this._model.data[t.children_d[r]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.enable_node(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:t}))},disable_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.disable_node(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:t}))},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.hide_node(t[r],!0);return n||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),n||this.redraw(),this.trigger("hide_node",{node:t})))},show_node:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.show_node(t[r],!0);return n||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),n||this.redraw(),this.trigger("show_node",{node:t})))},hide_all:function(t){var n,r=this._model.data,i=[];for(n in r)r.hasOwnProperty(n)&&n!==e.jstree.root&&!r[n].state.hidden&&(r[n].state.hidden=!0,i.push(n));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:i}),i},show_all:function(t){var n,r=this._model.data,i=[];for(n in r)r.hasOwnProperty(n)&&n!==e.jstree.root&&r[n].state.hidden&&(r[n].state.hidden=!1,i.push(n));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:i}),i},activate_node:function(e,n){if(this.is_disabled(e))return!1;if(n&&"object"==typeof n||(n={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(n.metaKey||n.ctrlKey||n.shiftKey)&&(!n.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(n.shiftKey){var r,i,o=this.get_node(e).id,s=this._data.core.last_clicked.id,a=this.get_node(this._data.core.last_clicked.parent).children,l=!1;for(r=0,i=a.length;i>r;r+=1)a[r]===o&&(l=!l),a[r]===s&&(l=!l),this.is_disabled(a[r])||!l&&a[r]!==o&&a[r]!==s?this.deselect_node(a[r],!0,n):this.is_hidden(a[r])||this.select_node(a[r],!0,!1,n);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:n})}else this.is_selected(e)?this.deselect_node(e,!1,n):this.select_node(e,!1,!1,n);else!this.settings.core.multiple&&(n.metaKey||n.ctrlKey||n.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,n):(this.deselect_all(!0),this.select_node(e,!1,!1,n),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:n})},hover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),n=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout((function(){n.attr("aria-activedescendant",e[0].id)}),0)},dehover_node:function(e){return!!((e=this.get_node(e,!0))&&e.length&&e.children(".jstree-hovered").length)&&(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)}))},select_node:function(t,n,r,i){var o,s,a;if(e.isArray(t)){for(s=0,a=(t=t.slice()).length;a>s;s++)this.select_node(t[s],n,r,i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(o=this.get_node(t,!0),void(t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),r||(o=this._open_to(t)),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked").attr("aria-selected",!0),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:i}),n||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:i}))))},deselect_node:function(t,n,r){var i,o,s;if(e.isArray(t)){for(i=0,o=(t=t.slice()).length;o>i;i++)this.deselect_node(t[i],n,r);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:r}),n||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:r}))))},select_all:function(t){var n,r,i=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),n=0,r=this._data.core.selected.length;r>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:i})},deselect_all:function(e){var t,n,r=this._data.core.selected.concat([]);for(t=0,n=this._data.core.selected.length;n>t;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:r}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:r})},is_selected:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.selected},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.core.selected.slice()},get_top_selected:function(t){var n,r,i,o,s=this.get_selected(!0),a={};for(n=0,r=s.length;r>n;n++)a[s[n].id]=s[n];for(n=0,r=s.length;r>n;n++)for(i=0,o=s[n].children_d.length;o>i;i++)a[s[n].children_d[i]]&&delete a[s[n].children_d[i]];for(n in s=[],a)a.hasOwnProperty(n)&&s.push(n);return t?e.map(s,e.proxy((function(e){return this.get_node(e)}),this)):s},get_bottom_selected:function(t){var n,r,i=this.get_selected(!0),o=[];for(n=0,r=i.length;r>n;n++)i[n].children.length||o.push(i[n].id);return t?e.map(o,e.proxy((function(e){return this.get_node(e)}),this)):o},get_state:function(){var t,n={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==e.jstree.root&&(this._model.data[t].state.loaded&&this.settings.core.loaded_state&&n.core.loaded.push(t),this._model.data[t].state.opened&&n.core.open.push(t),this._model.data[t].state.selected&&n.core.selected.push(t));return n},set_state:function(n,r){if(n){if(n.core&&n.core.selected&&n.core.initial_selection===t&&(n.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),n.core){var i,o;if(n.core.loaded)return this.settings.core.loaded_state&&e.isArray(n.core.loaded)&&n.core.loaded.length?this._load_nodes(n.core.loaded,(function(e){delete n.core.loaded,this.set_state(n,r)})):(delete n.core.loaded,this.set_state(n,r)),!1;if(n.core.open)return e.isArray(n.core.open)&&n.core.open.length?this._load_nodes(n.core.open,(function(e){this.open_node(e,!1,0),delete n.core.open,this.set_state(n,r)})):(delete n.core.open,this.set_state(n,r)),!1;if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,r),!1;if(n.core.selected)return i=this,(n.core.initial_selection===t||n.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),e.each(n.core.selected,(function(e,t){i.select_node(t,!1,!0)}))),delete n.core.initial_selection,delete n.core.selected,this.set_state(n,r),!1;for(o in n)n.hasOwnProperty(o)&&"core"!==o&&-1===e.inArray(o,this.settings.plugins)&&delete n[o];if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,r),!1}return!e.isEmptyObject(n)||(n=null,r&&r.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(t,n){this._data.core.state=!0===n?{}:this.get_state(),n&&e.isFunction(n)&&(this._data.core.state=n.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var r=this.get_container_ul()[0].className;t||(this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(e.jstree.root,(function(t,n){n&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.extend(!0,{},this._data.core.state),(function(){this.trigger("refresh")}))),this._data.core.state=null}))},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var n=[],r=[],i=this._data.core.selected.concat([]);r.push(t.id),!0===t.state.opened&&n.push(t.id),this.get_node(t,!0).find(".jstree-open").each((function(){r.push(this.id),n.push(this.id)})),this._load_nodes(r,e.proxy((function(e){this.open_node(n,!1,0),this.select_node(i),this.trigger("refresh_node",{node:t,nodes:e})}),this),!1,!0)},set_id:function(t,n){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var r,i,o=this._model.data,s=t.id;for(n=n.toString(),o[t.parent].children[e.inArray(t.id,o[t.parent].children)]=n,r=0,i=t.parents.length;i>r;r++)o[t.parents[r]].children_d[e.inArray(t.id,o[t.parents[r]].children_d)]=n;for(r=0,i=t.children.length;i>r;r++)o[t.children[r]].parent=n;for(r=0,i=t.children_d.length;i>r;r++)o[t.children_d[r]].parents[e.inArray(t.id,o[t.children_d[r]].parents)]=n;return-1!==(r=e.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[r]=n),(r=this.get_node(t.id,!0))&&(r.attr("id",n),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",n)),delete o[t.id],t.id=n,t.li_attr.id=n,o[n]=t,this.trigger("set_id",{node:t,new:t.id,old:s}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.text},set_text:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.set_text(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root||(t.text=n,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:n}),0))},get_json:function(t,n,r){if(!(t=this.get_node(t||e.jstree.root)))return!1;n&&n.flat&&!r&&(r=[]);var i,o,s={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:(!n||!n.no_data)&&e.extend(!0,e.isArray(t.data)?[]:{},t.data)};if(n&&n.flat?s.parent=t.parent:s.children=[],n&&n.no_state)delete s.state;else for(i in t.state)t.state.hasOwnProperty(i)&&(s.state[i]=t.state[i]);if(n&&n.no_li_attr&&delete s.li_attr,n&&n.no_a_attr&&delete s.a_attr,n&&n.no_id&&(delete s.id,s.li_attr&&s.li_attr.id&&delete s.li_attr.id,s.a_attr&&s.a_attr.id&&delete s.a_attr.id),n&&n.flat&&t.id!==e.jstree.root&&r.push(s),!n||!n.no_children)for(i=0,o=t.children.length;o>i;i++)n&&n.flat?this.get_json(t.children[i],n,r):s.children.push(this.get_json(t.children[i],n));return n&&n.flat?r:t.id===e.jstree.root?s.children:s},create_node:function(n,r,i,o,s){if(null===n&&(n=e.jstree.root),!(n=this.get_node(n)))return!1;if(!(i=i===t?"last":i).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(n))return this.load_node(n,(function(){this.create_node(n,r,i,o,!0)}));var a,l,d,c;switch(r||(r={text:this.get_string("New node")}),(r="string"==typeof r?{text:r}:e.extend(!0,{},r)).text===t&&(r.text=this.get_string("New node")),n.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":a=this.get_node(n.parent),i=e.inArray(n.id,a.children),n=a;break;case"after":a=this.get_node(n.parent),i=e.inArray(n.id,a.children)+1,n=a;break;case"inside":case"first":i=0;break;case"last":i=n.children.length;break;default:i||(i=0)}if(i>n.children.length&&(i=n.children.length),r.id||(r.id=!0),!this.check("create_node",r,n,i))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===r.id&&delete r.id,!(r=this._parse_model_from_json(r,n.id,n.parents.concat())))return!1;for(a=this.get_node(r),(l=[]).push(r),l=l.concat(a.children_d),this.trigger("model",{nodes:l,parent:n.id}),n.children_d=n.children_d.concat(l),d=0,c=n.parents.length;c>d;d++)this._model.data[n.parents[d]].children_d=this._model.data[n.parents[d]].children_d.concat(l);for(r=a,a=[],d=0,c=n.children.length;c>d;d++)a[d>=i?d+1:d]=n.children[d];return a[i]=r.id,n.children=a,this.redraw_node(n,!0),this.trigger("create_node",{node:this.get_node(r),parent:n.id,position:i}),o&&o.call(this,this.get_node(r)),r.id},rename_node:function(t,n){var r,i,o;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.rename_node(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root||(o=t.text,this.check("rename_node",t,this.get_parent(t),n)?(this.set_text(t,n),this.trigger("rename_node",{node:t,text:n,old:o}),0):(this.settings.core.error.call(this,this._data.core.last_error),1)))},delete_node:function(t){var n,r,i,o,s,a,l,d,c,h,u,p;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.delete_node(t[n]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;if(i=this.get_node(t.parent),o=e.inArray(t.id,i.children),h=!1,!this.check("delete_node",t,i,o))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==o&&(i.children=e.vakata.array_remove(i.children,o)),(s=t.children_d.concat([])).push(t.id),a=0,l=t.parents.length;l>a;a++)this._model.data[t.parents[a]].children_d=e.vakata.array_filter(this._model.data[t.parents[a]].children_d,(function(t){return-1===e.inArray(t,s)}));for(d=0,c=s.length;c>d;d++)if(this._model.data[s[d]].state.selected){h=!0;break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(t){return-1===e.inArray(t,s)}))),this.trigger("delete_node",{node:t,parent:i.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:i.id}),d=0,c=s.length;c>d;d++)delete this._model.data[s[d]];return-1!==e.inArray(this._data.core.focused,s)&&(this._data.core.focused=null,u=this.element[0].scrollTop,p=this.element[0].scrollLeft,i.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(i,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=u,this.element[0].scrollLeft=p),this.redraw_node(i,!0),!0},check:function(t,n,r,i,o){n=n&&n.id?n:this.get_node(n),r=r&&r.id?r:this.get_node(r);var s=t.match(/^move_node|copy_node|create_node$/i)?r:n,a=this.settings.core.check_callback;if("move_node"===t||"copy_node"===t){if(!(o&&o.is_multi||"move_node"!==t||e.inArray(n.id,r.children)!==i))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1;if(!(o&&o.is_multi||n.id!==r.id&&("move_node"!==t||e.inArray(n.id,r.children)!==i)&&-1===e.inArray(r.id,n.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1}return s&&s.data&&(s=s.data),s&&s.functions&&(!1===s.functions[t]||!0===s.functions[t])?(!1===s.functions[t]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})}),s.functions[t]):!(!1===a||e.isFunction(a)&&!1===a.call(this,t,n,r,i,o)||a&&!1===a[t])||(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(n,r,i,o,s,a,l){var d,c,h,u,p,f,g,_,m,v,b,x,y,j;if(r=this.get_node(r),i=i===t?0:i,!r)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,(function(){this.move_node(n,r,i,o,!0,!1,l)}));if(e.isArray(n)){if(1!==n.length){for(d=0,c=n.length;c>d;d++)(m=this.move_node(n[d],r,i,o,s,!1,l))&&(r=m,i="after");return this.redraw(),!0}n=n[0]}if(!(n=n&&n.id?n:this.get_node(n))||n.id===e.jstree.root)return!1;if(h=(n.parent||e.jstree.root).toString(),p=i.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,g=!(f=l||(this._model.data[n.id]?this:e.jstree.reference(n.id)))||!f._id||this._id!==f._id,u=f&&f._id&&h&&f._model.data[h]&&f._model.data[h].children?e.inArray(n.id,f._model.data[h].children):-1,f&&f._id&&(n=f._model.data[n.id]),g)return!!(m=this.copy_node(n,r,i,o,s,!1,l))&&(f&&f.delete_node(n),m);switch(r.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=e.inArray(r.id,p.children);break;case"after":i=e.inArray(r.id,p.children)+1;break;case"inside":case"first":i=0;break;case"last":i=p.children.length;break;default:i||(i=0)}if(i>p.children.length&&(i=p.children.length),!this.check("move_node",n,p,i,{core:!0,origin:l,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(n.parent===p.id){for(_=p.children.concat(),-1!==(m=e.inArray(n.id,_))&&(_=e.vakata.array_remove(_,m),i>m&&i--),m=[],v=0,b=_.length;b>v;v++)m[v>=i?v+1:v]=_[v];m[i]=n.id,p.children=m,this._node_changed(p.id),this.redraw(p.id===e.jstree.root)}else{for((m=n.children_d.concat()).push(n.id),v=0,b=n.parents.length;b>v;v++){for(_=[],x=0,y=(j=f._model.data[n.parents[v]].children_d).length;y>x;x++)-1===e.inArray(j[x],m)&&_.push(j[x]);f._model.data[n.parents[v]].children_d=_}for(f._model.data[h].children=e.vakata.array_remove_item(f._model.data[h].children,n.id),v=0,b=p.parents.length;b>v;v++)this._model.data[p.parents[v]].children_d=this._model.data[p.parents[v]].children_d.concat(m);for(_=[],v=0,b=p.children.length;b>v;v++)_[v>=i?v+1:v]=p.children[v];for(_[i]=n.id,p.children=_,p.children_d.push(n.id),p.children_d=p.children_d.concat(n.children_d),n.parent=p.id,(m=p.parents.concat()).unshift(p.id),j=n.parents.length,n.parents=m,m=m.concat(),v=0,b=n.children_d.length;b>v;v++)this._model.data[n.children_d[v]].parents=this._model.data[n.children_d[v]].parents.slice(0,-1*j),Array.prototype.push.apply(this._model.data[n.children_d[v]].parents,m);(h===e.jstree.root||p.id===e.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(p.id)),a||this.redraw()}return o&&o.call(this,n,p,i),this.trigger("move_node",{node:n,parent:p.id,position:i,old_parent:h,old_position:u,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id,old_instance:f,new_instance:this}),n.id},copy_node:function(n,r,i,o,s,a,l){var d,c,h,u,p,f,g,_,m,v;if(r=this.get_node(r),i=i===t?0:i,!r)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,(function(){this.copy_node(n,r,i,o,!0,!1,l)}));if(e.isArray(n)){if(1!==n.length){for(d=0,c=n.length;c>d;d++)(u=this.copy_node(n[d],r,i,o,s,!0,l))&&(r=u,i="after");return this.redraw(),!0}n=n[0]}if(!(n=n&&n.id?n:this.get_node(n))||n.id===e.jstree.root)return!1;switch(_=(n.parent||e.jstree.root).toString(),m=i.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,!(v=l||(this._model.data[n.id]?this:e.jstree.reference(n.id)))||!v._id||(this._id,v._id),v&&v._id&&(n=v._model.data[n.id]),r.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=e.inArray(r.id,m.children);break;case"after":i=e.inArray(r.id,m.children)+1;break;case"inside":case"first":i=0;break;case"last":i=m.children.length;break;default:i||(i=0)}if(i>m.children.length&&(i=m.children.length),!this.check("copy_node",n,m,i,{core:!0,origin:l,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(g=v?v.get_json(n,{no_id:!0,no_data:!0,no_state:!0}):n))return!1;if(!0===g.id&&delete g.id,!(g=this._parse_model_from_json(g,m.id,m.parents.concat())))return!1;for(u=this.get_node(g),n&&n.state&&!1===n.state.loaded&&(u.state.loaded=!1),(h=[]).push(g),h=h.concat(u.children_d),this.trigger("model",{nodes:h,parent:m.id}),p=0,f=m.parents.length;f>p;p++)this._model.data[m.parents[p]].children_d=this._model.data[m.parents[p]].children_d.concat(h);for(h=[],p=0,f=m.children.length;f>p;p++)h[p>=i?p+1:p]=m.children[p];return h[i]=u.id,m.children=h,m.children_d.push(u.id),m.children_d=m.children_d.concat(u.children_d),m.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(m.id),a||this.redraw(m.id===e.jstree.root),o&&o.call(this,u,m,i),this.trigger("copy_node",{node:u,original:n,parent:m.id,position:i,old_parent:_,old_position:v&&v._id&&_&&v._model.data[_]&&v._model.data[_].children?e.inArray(n.id,v._model.data[_].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),u.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var n,s,a,l=[];for(s=0,a=t.length;a>s;s++)(n=this.get_node(t[s]))&&n.id&&n.id!==e.jstree.root&&l.push(n);return!!l.length&&(r=l,o=this,i="move_node",void this.trigger("cut",{node:t}))},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var n,s,a,l=[];for(s=0,a=t.length;a>s;s++)(n=this.get_node(t[s]))&&n.id&&n.id!==e.jstree.root&&l.push(n);return!!l.length&&(r=l,o=this,i="copy_node",void this.trigger("copy",{node:t}))},get_buffer:function(){return{mode:i,node:r,inst:o}},can_paste:function(){return!1!==i&&!1!==r},paste:function(e,t){return!!((e=this.get_node(e))&&i&&i.match(/^(copy_node|move_node)$/)&&r)&&(this[i](r,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:r,mode:i}),r=!1,i=!1,void(o=!1))},clear_buffer:function(){r=!1,i=!1,o=!1,this.trigger("clear_buffer")},edit:function(t,n,r){var i,o,s,a,d,c,h,u,p,f=!1;return!!(t=this.get_node(t))&&(this.check("edit",t,this.get_parent(t))?(p=t,n="string"==typeof n?n:t.text,this.set_text(t,""),t=this._open_to(t),p.text=n,i=this._data.core.rtl,o=this.element.width(),this._data.core.focused=p.id,s=t.children(".jstree-anchor").focus(),a=e(""),d=n,c=e("
",{css:{position:"absolute",top:"-200px",left:i?"0px":"-1000px",visibility:"hidden"}}).appendTo(l.body),h=e("",{value:d,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:e.proxy((function(n){n.stopImmediatePropagation(),n.preventDefault();var i,o=a.children(".jstree-rename-input").val(),l=this.settings.core.force_text;""===o&&(o=d),c.remove(),a.replaceWith(s),a.remove(),d=l?d:e("
").append(e.parseHTML(d)).html(),t=this.get_node(t),this.set_text(t,d),(i=!!this.rename_node(t,l?e("
").text(o).text():e("
").append(e.parseHTML(o)).html()))||this.set_text(t,d),this._data.core.focused=p.id,setTimeout(e.proxy((function(){var e=this.get_node(p.id,!0);e.length&&(this._data.core.focused=p.id,e.children(".jstree-anchor").focus())}),this),0),r&&r.call(this,p,i,f,o),h=null}),this),keydown:function(e){var t=e.which;27===t&&(f=!0,this.value=d),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(c.text("pW"+this.value).width(),o))},keypress:function(e){return 13!==e.which&&void 0}}),u={fontFamily:s.css("fontFamily")||"",fontSize:s.css("fontSize")||"",fontWeight:s.css("fontWeight")||"",fontStyle:s.css("fontStyle")||"",fontStretch:s.css("fontStretch")||"",fontVariant:s.css("fontVariant")||"",letterSpacing:s.css("letterSpacing")||"",wordSpacing:s.css("wordSpacing")||""},a.attr("class",s.attr("class")).append(s.contents().clone()).append(h),s.replaceWith(a),c.css(u),h.css(u).width(Math.min(c.text("pW"+h[0].value).width(),o))[0].select(),void e(l).one("mousedown.jstree touchstart.jstree dnd_start.vakata",(function(t){h&&t.target!==h&&e(h).blur()}))):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(t,n){if(!t)return!1;if(!0===n){var r=this.settings.core.themes.dir;r||(r=e.jstree.path+"/themes"),n=r+"/"+t+"/style.css"}n&&-1===e.inArray(n,s)&&(e("head").append(''),s.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&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(n,r){var i,o,s,a;if(e.isArray(n)){for(i=0,o=(n=n.slice()).length;o>i;i++)this.set_icon(n[i],r);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root||(a=n.icon,n.icon=!0===r||null===r||r===t||""===r||r,s=this.get_node(n,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===r?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),this.hide_icon(n)):!0===r||null===r||r===t||""===r?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),!1===a&&this.show_icon(n)):-1===r.indexOf("/")&&-1===r.indexOf(".")?(s.removeClass(a).css("background",""),s.addClass(r+" jstree-themeicon-custom").attr("rel",r),!1===a&&this.show_icon(n)):(s.removeClass(a).css("background",""),s.addClass("jstree-themeicon-custom").css("background","url('"+r+"') center center no-repeat").attr("rel",r),!1===a&&this.show_icon(n)),0))},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.hide_icon(t[n]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root||(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),0))},show_icon:function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.show_icon(t[n]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root||(i=this.get_node(t,!0),t.icon=!i.length||i.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),i.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),0))}},e.vakata={},e.vakata.attributes=function(t,n){t=e(t)[0];var r=n?{}:[];return t&&t.attributes&&e.each(t.attributes,(function(t,i){-1===e.inArray(i.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==i.value&&""!==e.vakata.trim(i.value)&&(n?r[i.name]=i.value:r.push(i.name))})),r},e.vakata.array_unique=function(e){var n,r,i=[],o={};for(n=0,r=e.length;r>n;n++)o[e[n]]===t&&(i.push(e[n]),o[e[n]]=!0);return i},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,n){var r=e.inArray(n,t);return-1!==r?e.vakata.array_remove(t,r):t},e.vakata.array_filter=function(e,t,n,r,i){if(e.filter)return e.filter(t,n);for(i in r=[],e)~~i+""==i+""&&i>=0&&t.call(n,e[i],+i,e)&&r.push(e[i]);return r},e.vakata.trim=function(e){return String.prototype.trim?String.prototype.trim.call(e.toString()):e.toString().replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},e.jstree.plugins.changed=function(e,t){var n=[];this.trigger=function(e,r){var i,o;if(r||(r={}),"changed"===e.replace(".jstree","")){r.changed={selected:[],deselected:[]};var s={};for(i=0,o=n.length;o>i;i++)s[n[i]]=1;for(i=0,o=r.selected.length;o>i;i++)s[r.selected[i]]?s[r.selected[i]]=2:r.changed.selected.push(r.selected[i]);for(i=0,o=n.length;o>i;i++)1===s[n[i]]&&r.changed.deselected.push(n[i]);n=r.selected.slice()}t.trigger.call(this,e,r)},this.refresh=function(e,r){return n=[],t.refresh.apply(this,arguments)}};var h,u,p=l.createElement("I");p.className="jstree-icon jstree-checkbox",p.setAttribute("role","presentation"),e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},e.jstree.plugins.checkbox=function(n,r){this.bind=function(){r.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",e.proxy((function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")}),this)).on("loading.jstree",e.proxy((function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()}),this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy((function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)}),this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy((function(e,t){var n,r,i=this._model.data,o=(i[t.parent],t.nodes);for(n=0,r=o.length;r>n;n++)i[o[n]].state.checked=i[o[n]].state.checked||i[o[n]].original&&i[o[n]].original.state&&i[o[n]].original.state.checked,i[o[n]].state.checked&&this._data.checkbox.selected.push(o[n])}),this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",e.proxy((function(t,n){var r,i,o,s,a,l,d=this._model.data,c=d[n.parent],h=n.nodes,u=[],p=this.settings.checkbox.cascade,f=this.settings.checkbox.tie_selection;if(-1!==p.indexOf("down"))if(c.state[f?"selected":"checked"]){for(i=0,o=h.length;o>i;i++)d[h[i]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(h)}else for(i=0,o=h.length;o>i;i++)if(d[h[i]].state[f?"selected":"checked"]){for(s=0,a=d[h[i]].children_d.length;a>s;s++)d[d[h[i]].children_d[s]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(d[h[i]].children_d)}if(-1!==p.indexOf("up")){for(i=0,o=c.children_d.length;o>i;i++)d[c.children_d[i]].children.length||u.push(d[c.children_d[i]].parent);for(s=0,a=(u=e.vakata.array_unique(u)).length;a>s;s++)for(c=d[u[s]];c&&c.id!==e.jstree.root;){for(r=0,i=0,o=c.children.length;o>i;i++)r+=d[c.children[i]].state[f?"selected":"checked"];if(r!==o)break;c.state[f?"selected":"checked"]=!0,this._data[f?"core":"checkbox"].selected.push(c.id),(l=this.get_node(c,!0))&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(f?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[f?"core":"checkbox"].selected=e.vakata.array_unique(this._data[f?"core":"checkbox"].selected)}),this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy((function(t,n){var r,i,o,s,a=n.node,l=this._model.data,d=this.get_node(a.parent),c=this.settings.checkbox.cascade,h=this.settings.checkbox.tie_selection,u={},p=this._data[h?"core":"checkbox"].selected;for(r=0,i=p.length;i>r;r++)u[p[r]]=!0;if(-1!==c.indexOf("down")){var f=this._cascade_new_checked_state(a.id,!0),g=a.children_d.concat(a.id);for(r=0,i=g.length;i>r;r++)f.indexOf(g[r])>-1?u[g[r]]=!0:delete u[g[r]]}if(-1!==c.indexOf("up"))for(;d&&d.id!==e.jstree.root;){for(o=0,r=0,i=d.children.length;i>r;r++)o+=l[d.children[r]].state[h?"selected":"checked"];if(o!==i)break;d.state[h?"selected":"checked"]=!0,u[d.id]=!0,(s=this.get_node(d,!0))&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}for(r in p=[],u)u.hasOwnProperty(r)&&p.push(r);this._data[h?"core":"checkbox"].selected=p}),this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy((function(t,n){var r,i,o,s=this.get_node(e.jstree.root),a=this._model.data;for(r=0,i=s.children_d.length;i>r;r++)(o=a[s.children_d[r]])&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1)}),this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy((function(t,n){var r,i,o,s=n.node,a=(this.get_node(s,!0),this.settings.checkbox.cascade),l=this.settings.checkbox.tie_selection,d=this._data[l?"core":"checkbox"].selected,c=s.children_d.concat(s.id);if(-1!==a.indexOf("down")){var h=this._cascade_new_checked_state(s.id,!1);d=e.vakata.array_filter(d,(function(e){return-1===c.indexOf(e)||h.indexOf(e)>-1}))}if(-1!==a.indexOf("up")&&-1===d.indexOf(s.id)){for(r=0,i=s.parents.length;i>r;r++)(o=this._model.data[s.parents[r]]).state[l?"selected":"checked"]=!1,o&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1),(o=this.get_node(s.parents[r],!0))&&o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass(l?"jstree-clicked":"jstree-checked");d=e.vakata.array_filter(d,(function(e){return-1===s.parents.indexOf(e)}))}this._data[l?"core":"checkbox"].selected=d}),this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy((function(t,n){for(var r,i,o,s,a=this.get_node(n.parent),l=this._model.data,d=this.settings.checkbox.tie_selection;a&&a.id!==e.jstree.root&&!a.state[d?"selected":"checked"];){for(o=0,r=0,i=a.children.length;i>r;r++)o+=l[a.children[r]].state[d?"selected":"checked"];if(!(i>0&&o===i))break;a.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(a.id),(s=this.get_node(a,!0))&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),a=this.get_node(a.parent)}}),this)).on("move_node.jstree",e.proxy((function(t,n){var r,i,o,s,a,l=n.is_multi,d=n.old_parent,c=this.get_node(n.parent),h=this._model.data,u=this.settings.checkbox.tie_selection;if(!l)for(r=this.get_node(d);r&&r.id!==e.jstree.root&&!r.state[u?"selected":"checked"];){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state[u?"selected":"checked"];if(!(s>0&&i===s))break;r.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),r=this.get_node(r.parent)}for(r=c;r&&r.id!==e.jstree.root;){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state[u?"selected":"checked"];if(i===s)r.state[u?"selected":"checked"]||(r.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"));else{if(!r.state[u?"selected":"checked"])break;r.state[u?"selected":"checked"]=!1,this._data[u?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[u?"core":"checkbox"].selected,r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass(u?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}}),this))},this.get_undetermined=function(n){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var r,i,o,s,a={},l=this._model.data,d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,h=[],u=this,p=[];for(r=0,i=c.length;i>r;r++)if(l[c[r]]&&l[c[r]].parents)for(o=0,s=l[c[r]].parents.length;s>o&&a[l[c[r]].parents[o]]===t;o++)l[c[r]].parents[o]!==e.jstree.root&&(a[l[c[r]].parents[o]]=!0,h.push(l[c[r]].parents[o]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each((function(){var n,d=u.get_node(this);if(d)if(d.state.loaded){for(r=0,i=d.children_d.length;i>r;r++)if(!(n=l[d.children_d[r]]).state.loaded&&n.original&&n.original.state&&n.original.state.undetermined&&!0===n.original.state.undetermined)for(a[n.id]===t&&n.id!==e.jstree.root&&(a[n.id]=!0,h.push(n.id)),o=0,s=n.parents.length;s>o;o++)a[n.parents[o]]===t&&n.parents[o]!==e.jstree.root&&(a[n.parents[o]]=!0,h.push(n.parents[o]))}else if(d.original&&d.original.state&&d.original.state.undetermined&&!0===d.original.state.undetermined)for(a[d.id]===t&&d.id!==e.jstree.root&&(a[d.id]=!0,h.push(d.id)),o=0,s=d.parents.length;s>o;o++)a[d.parents[o]]===t&&d.parents[o]!==e.jstree.root&&(a[d.parents[o]]=!0,h.push(d.parents[o]))})),r=0,i=h.length;i>r;r++)l[h[r]].state[d?"selected":"checked"]||p.push(n?l[h[r]]:h[r]);return p},this._undetermined=function(){if(null!==this.element){var e,t,n,r=this.get_undetermined(!1);for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,t=r.length;t>e;e++)(n=this.get_node(r[e],!0))&&n.length&&n.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,n,i,o){if(t=r.redraw_node.apply(this,arguments)){var s,a,l=null,d=null;for(s=0,a=t.childNodes.length;a>s;s++)if(t.childNodes[s]&&t.childNodes[s].className&&-1!==t.childNodes[s].className.indexOf("jstree-anchor")){l=t.childNodes[s];break}l&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(l.className+=" jstree-checked"),d=p.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(d.className+=" jstree-checkbox-disabled"),l.insertBefore(d,l.childNodes[0]))}return i||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(t){t=this.get_node(t);var n,r,i=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection,s=this._data[o?"core":"checkbox"].selected,a=this._model.data;if(!t||!0===t.state[o?"selected":"checked"]||-1===i.indexOf("undetermined")||-1===i.indexOf("down")&&-1===i.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(n=0,r=t.children_d.length;r>n;n++)if(-1!==e.inArray(t.children_d[n],s)||!a[t.children_d[n]].state.loaded&&a[t.children_d[n]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.disable_checkbox(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(i=this.get_node(t,!0),void(t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))))},this.enable_checkbox=function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.enable_checkbox(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(i=this.get_node(t,!0),void(t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))))},this.activate_node=function(t,n){return!e(n.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(n.target).hasClass("jstree-checkbox"))&&(n.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(n.target).hasClass("jstree-checkbox")?r.activate_node.call(this,t,n):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,n):this.check_node(t,n),void this.trigger("activate_node",{node:this.get_node(t)})))},this._cascade_new_checked_state=function(e,t){var n,r,i,o=this,s=this.settings.checkbox.tie_selection,a=this._model.data[e],l=[],d=[];if(!this.settings.checkbox.cascade_to_disabled&&a.state.disabled||!this.settings.checkbox.cascade_to_hidden&&a.state.hidden)i=this.get_checked_descendants(e),a.state[s?"selected":"checked"]&&i.push(a.id),l=l.concat(i);else{if(a.children)for(n=0,r=a.children.length;r>n;n++){var c=a.children[n];i=o._cascade_new_checked_state(c,t),l=l.concat(i),i.indexOf(c)>-1&&d.push(c)}var h=o.get_node(a,!0),u=d.length>0&&d.lengthi;i++)this.check_node(t[i],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(r=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:n}))))},this.uncheck_node=function(t,n){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,n);var r,i,o;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.uncheck_node(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(o=this.get_node(t,!0),void(t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:n}))))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var t,n;for(this._data.checkbox.selected.concat([]),this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),t=0,n=this._data.checkbox.selected.length;n>t;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var e,t,n=this._data.checkbox.selected.concat([]);for(e=0,t=this._data.checkbox.selected.length;t>e;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:n})},this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.checked},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.checkbox.selected.slice()},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);var n,r,i,o,s=this.get_checked(!0),a={};for(n=0,r=s.length;r>n;n++)a[s[n].id]=s[n];for(n=0,r=s.length;r>n;n++)for(i=0,o=s[n].children_d.length;o>i;i++)a[s[n].children_d[i]]&&delete a[s[n].children_d[i]];for(n in s=[],a)a.hasOwnProperty(n)&&s.push(n);return t?e.map(s,e.proxy((function(e){return this.get_node(e)}),this)):s},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var n,r,i=this.get_checked(!0),o=[];for(n=0,r=i.length;r>n;n++)i[n].children.length||o.push(i[n].id);return t?e.map(o,e.proxy((function(e){return this.get_node(e)}),this)):o},this.load_node=function(t,n){var i,o,s;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(s=this.get_node(t))&&s.state.loaded)for(i=0,o=s.children_d.length;o>i;i++)this._model.data[s.children_d[i]].state.checked&&(this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,s.children_d[i]));return r.load_node.apply(this,arguments)},this.get_state=function(){var e=r.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(e.checkbox=this._data.checkbox.selected.slice()),e},this.set_state=function(t,n){var i=r.set_state.apply(this,arguments);if(i&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var o=this;e.each(t.checkbox,(function(e,t){o.check_node(t)}))}return delete t.checkbox,this.set_state(t,n),!1}return i},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),r.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,n){return this.settings.conditionalselect.call(this,this.get_node(e),n)?t.activate_node.call(this,e,n):void 0}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,n){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.create_node(r,{},"last",(function(e){try{n.edit(e)}catch(t){setTimeout((function(){n.edit(e)}),0)}}))}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.delete_node(n.get_selected()):n.delete_node(r)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.cut(n.get_top_selected()):n.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.copy(n.get_top_selected()):n.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.paste(r)}}}}}}},e.jstree.plugins.contextmenu=function(n,r){this.bind=function(){r.bind.call(this);var t,n,i=0,o=null;this.element.on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-contextmenu")}),this)).on("contextmenu.jstree",".jstree-anchor",e.proxy((function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),i=e.ctrlKey?+new Date:0,(t||o)&&(i=+new Date+1e4),o&&clearTimeout(o),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(t){this._data.contextmenu.visible&&(!i||+new Date-i>250)&&e.vakata.context.hide(),i=0}),this)).on("touchstart.jstree",".jstree-anchor",(function(r){r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(t=r.originalEvent.changedTouches[0].clientX,n=r.originalEvent.changedTouches[0].clientY,o=setTimeout((function(){e(r.currentTarget).trigger("contextmenu",!0)}),750))})).on("touchmove.vakata.jstree",(function(r){o&&r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(Math.abs(t-r.originalEvent.changedTouches[0].clientX)>10||Math.abs(n-r.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(o),e.vakata.context.hide())})).on("touchend.vakata.jstree",(function(e){o&&clearTimeout(o)})),e(l).on("context_hide.vakata.jstree",e.proxy((function(t,n){this._data.contextmenu.visible=!1,e(n.reference).removeClass("jstree-context")}),this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),r.teardown.call(this)},this.show_contextmenu=function(n,r,i,o){if(!(n=this.get_node(n))||n.id===e.jstree.root)return!1;var s=this.settings.contextmenu,a=this.get_node(n,!0).children(".jstree-anchor"),l=!1,d=!1;(s.show_at_node||r===t||i===t)&&(l=a.offset(),r=l.left,i=l.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&this.activate_node(n,o),d=s.items,e.isFunction(d)&&(d=d.call(this,n,e.proxy((function(e){this._show_contextmenu(n,r,i,e)}),this))),e.isPlainObject(d)&&this._show_contextmenu(n,r,i,d)},this._show_contextmenu=function(t,n,r,i){var o=this.get_node(t,!0).children(".jstree-anchor");e(l).one("context_show.vakata.jstree",e.proxy((function(t,n){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(r),o.addClass("jstree-context")}),this)),this._data.contextmenu.visible=!0,e.vakata.context.show(o,{x:n,y:r},i),this.trigger("show_contextmenu",{node:t,x:n,y:r})}},function(e){var t=!1,n={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(l).triggerHandler("context_"+t+".vakata",{reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_execute:function(t){return!(!(t=n.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:n.reference,element:n.element}))||!t.action)&&t.action.call(null,{item:t,reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_parse:function(t,r){if(!t)return!1;r||(n.html="",n.items=[]);var i,o="",s=!1;return r&&(o+=""),r||(n.html=o,e.vakata.context._trigger("parse")),o.length>10&&o},_show_submenu:function(n){if((n=e(n)).length&&n.children("ul").length){var r=n.children("ul"),i=n.offset().left,o=i+n.outerWidth(),s=n.offset().top,a=r.width(),l=r.height(),d=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?n[o-(a+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[o+a>d&&i>d-o?"addClass":"removeClass"]("vakata-context-right"),s+l+10>c&&r.css("bottom","-1px"),n.hasClass("vakata-context-right")?a>i&&r.css("margin-right",i-a):a>d-o&&r.css("margin-left",d-o-a),r.show()}},show:function(r,i,o){var s,a,d,c,h,u,p,f,g=!0;switch(n.element&&n.element.length&&n.element.width(""),g){case!i&&!r:return!1;case!!i&&!!r:n.reference=r,n.position_x=i.x,n.position_y=i.y;break;case!i&&!!r:n.reference=r,s=r.offset(),n.position_x=s.left+r.outerHeight(),n.position_y=s.top;break;case!!i&&!r:n.position_x=i.x,n.position_y=i.y}r&&!o&&e(r).data("vakata_contextmenu")&&(o=e(r).data("vakata_contextmenu")),e.vakata.context._parse(o)&&n.element.html(n.html),n.items.length&&(n.element.appendTo(l.body),a=n.element,d=n.position_x,c=n.position_y,h=a.width(),u=a.height(),p=e(window).width()+e(window).scrollLeft(),f=e(window).height()+e(window).scrollTop(),t&&(d-=a.outerWidth()-e(r).outerWidth())p&&(d=p-(h+20)),c+u+20>f&&(c=f-(u+20)),n.element.css({left:d,top:c}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),n.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){n.is_visible&&(n.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),n.is_visible=!1,e.vakata.context._trigger("hide"))}},e((function(){t="rtl"===e(l.body).css("direction");var r=!1;n.element=e("
    "),n.element.on("mouseenter","li",(function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(r&&clearTimeout(r),n.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))})).on("mouseleave","li",(function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")})).on("mouseleave",(function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(r=setTimeout((function(){e.vakata.context.hide()}),e.vakata.context.settings.hide_onmouseleave))})).on("click","a",(function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()})).on("keydown","a",(function(t){var r=null;switch(t.which){case 13:case 32:t.type="click",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:n.is_visible&&(n.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:n.is_visible&&((r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:n.is_visible&&(n.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(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:n.is_visible&&((r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}})).on("keydown",(function(e){e.preventDefault();var t=n.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()})),e(l).on("mousedown.vakata.jstree",(function(t){n.is_visible&&n.element[0]!==t.target&&!e.contains(n.element[0],t.target)&&e.vakata.context.hide()})).on("context_show.vakata.jstree",(function(e,r){n.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&n.element.addClass("vakata-context-rtl").css("direction","rtl"),n.element.find("ul").hide().end()}))}))}(e),e.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},e.jstree.plugins.dnd=function(t,n){this.init=function(e,t){n.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in l.createElement("span")},this.bind=function(){n.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",e.proxy((function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0;if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var n=this.get_node(t.target),r=this.is_selected(n)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,i=r>1?r+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(i=e.vakata.html.escape(i)),n&&n.id&&n.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,r>1?this.get_top_selected(!0):[n],t))){if(h={jstree:!0,origin:this,obj:this.get_node(n,!0),nodes:r>1?this.get_top_selected():[n.id]},u=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,h,'
    '+i+'
    ');e.vakata.dnd._trigger("start",t,{helper:e(),element:u,data:h})}}),this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",(function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:h}),!1})).on("drop.jstree",e.proxy((function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:h}),!1}),this))},this.redraw_node=function(e,t,r,i){if((e=n.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{var o,s,a=null;for(o=0,s=e.childNodes.length;s>o;o++)if(e.childNodes[o]&&e.childNodes[o].className&&-1!==e.childNodes[o].className.indexOf("jstree-anchor")){a=e.childNodes[o];break}a&&a.setAttribute("draggable",!0)}return e}},e((function(){var n=!1,r=!1,i=!1,o=!1,s=e('
     
    ').hide();e(l).on("dragover.vakata.jstree",(function(t){u&&e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:h})})).on("drop.vakata.jstree",(function(t){u&&(e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:h}),u=null,h=null)})).on("dnd_start.vakata.jstree",(function(e,t){n=!1,i=!1,t&&t.data&&t.data.jstree&&s.appendTo(l.body)})).on("dnd_move.vakata.jstree",(function(a,l){var d=l.event.target!==i.target;if(o&&(!l.event||"dragover"!==l.event.type||d)&&clearTimeout(o),l&&l.data&&l.data.jstree&&(!l.event.target.id||"jstree-marker"!==l.event.target.id)){i=l.event;var c,h,u,p,f,g,_,m,v,b,x,y,j,k,w,A,C,E=e.jstree.reference(l.event.target),S=!1,T=!1,O=!1;if(E&&E._data&&E._data.dnd)if(s.attr("class","jstree-"+E.get_theme()+(E.settings.core.themes.responsive?" jstree-dnd-responsive":"")),w=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey)),l.helper.children().attr("class","jstree-"+E.get_theme()+" jstree-"+E.get_theme()+"-"+E.get_theme_variant()+" "+(E.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[w?"show":"hide"](),l.event.target!==E.element[0]&&l.event.target!==E.get_container_ul()[0]||0!==E.get_container_ul().children().length){if((S=E.settings.dnd.large_drop_target?e(l.event.target).closest(".jstree-node").children(".jstree-anchor"):e(l.event.target).closest(".jstree-anchor"))&&S.length&&S.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(T=S.offset(),O=(l.event.pageY!==t?l.event.pageY:l.event.originalEvent.pageY)-T.top,u=S.outerHeight(),g=u/3>O?["b","i","a"]:O>u-u/3?["a","i","b"]:O>u/2?["i","a","b"]:["i","b","a"],e.each(g,(function(t,i){switch(i){case"b":c=T.left-6,h=T.top,p=E.get_parent(S),f=S.parent().index(),C="jstree-below";break;case"i":j=E.settings.dnd.inside_pos,k=E.get_node(S.parent()),c=T.left-2,h=T.top+u/2+1,p=k.id,f="first"===j?0:"last"===j?k.children.length:Math.min(j,k.children.length),C="jstree-inside";break;case"a":c=T.left-6,h=T.top+u,p=E.get_parent(S),f=S.parent().index()+1,C="jstree-above"}for(_=!0,m=0,v=l.data.nodes.length;v>m;m++)if(b=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",x=f,"move_node"===b&&"a"===i&&l.data.origin&&l.data.origin===E&&p===E.get_parent(l.data.nodes[m])&&(y=E.get_node(p),x>e.inArray(l.data.nodes[m],y.children)&&(x-=1)),!(_=_&&(E&&E.settings&&E.settings.dnd&&!1===E.settings.dnd.check_while_dragging||E.check(b,l.data.origin&&l.data.origin!==E?l.data.origin.get_node(l.data.nodes[m]):l.data.nodes[m],p,x,{dnd:!0,ref:E.get_node(S.parent()),pos:i,origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==E,is_foreign:!l.data.origin})))){E&&E.last_error&&(r=E.last_error());break}return"i"===i&&S.parent().is(".jstree-closed")&&E.settings.dnd.open_timeout&&(!l.event||"dragover"!==l.event.type||d)&&(o&&clearTimeout(o),o=setTimeout(function(e,t){return function(){e.open_node(t)}}(E,S),E.settings.dnd.open_timeout)),_?((A=E.get_node(p,!0)).hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),A.addClass("jstree-dnd-parent")),n={ins:E,par:p,pos:"i"!==i||"last"!==j||0!==f||E.is_loaded(k)?f:"last"},s.css({left:c+"px",top:h+"px"}).show(),s.removeClass("jstree-above jstree-inside jstree-below").addClass(C),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"),r={},g=!0,!1):void 0})),!0===g))return}else{for(_=!0,m=0,v=l.data.nodes.length;v>m&&(_=_&&E.check(l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",l.data.origin&&l.data.origin!==E?l.data.origin.get_node(l.data.nodes[m]):l.data.nodes[m],e.jstree.root,"last",{dnd:!0,ref:E.get_node(e.jstree.root),pos:"i",origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==E,is_foreign:!l.data.origin}));m++);if(_)return n={ins:E,par:e.jstree.root,pos:"last"},s.hide(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),n=!1,l.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),l.event.originalEvent&&l.event.originalEvent.dataTransfer,s.hide()}})).on("dnd_scroll.vakata.jstree",(function(e,t){t&&t.data&&t.data.jstree&&(s.hide(),n=!1,i=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))})).on("dnd_stop.vakata.jstree",(function(t,a){if(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),o&&clearTimeout(o),a&&a.data&&a.data.jstree){s.hide().detach();var l,d,c=[];if(n){for(l=0,d=a.data.nodes.length;d>l;l++)c[l]=a.data.origin?a.data.origin.get_node(a.data.nodes[l]):a.data.nodes[l];n.ins[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey))?"copy_node":"move_node"](c,n.par,n.pos,!1,!1,!1,a.data.origin)}else(l=e(a.event.target).closest(".jstree")).length&&r&&r.error&&"check"===r.error&&(l=l.jstree(!0))&&l.settings.core.error.call(this,r);i=!1,n=!1}})).on("keyup.jstree keydown.jstree",(function(t,a){(a=e.vakata.dnd._get())&&a.data&&a.data.jstree&&("keyup"===t.type&&27===t.which?(o&&clearTimeout(o),n=!1,r=!1,i=!1,o=!1,s.hide().detach(),e.vakata.dnd._clean()):(a.helper.find(".jstree-copy").first()[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),i&&(i.metaKey=t.metaKey,i.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",i))))}))})),function(e){e.vakata.html={div:e("
    "),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}};var n={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(n,r,i){i===t&&(i=e.vakata.dnd._get()),i.event=r,e(l).triggerHandler("dnd_"+n+".vakata",i)},_get:function(){return{data:n.data,element:n.element,helper:n.helper}},_clean:function(){n.helper&&n.helper.remove(),n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),n={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},u=null,e(l).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!n.scroll_e||!n.scroll_l&&!n.scroll_t)return n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),!1;if(!n.scroll_i)return n.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(!0===t)return!1;var r=n.scroll_e.scrollTop(),i=n.scroll_e.scrollLeft();n.scroll_e.scrollTop(r+n.scroll_t*e.vakata.dnd.settings.scroll_speed),n.scroll_e.scrollLeft(i+n.scroll_l*e.vakata.dnd.settings.scroll_speed),(r!==n.scroll_e.scrollTop()||i!==n.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",n.scroll_e)},start:function(t,r,i){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(e){}return n.init_x=t.pageX,n.init_y=t.pageY,n.data=r,n.is_down=!0,n.element=t.currentTarget,n.target=t.target,n.is_touch="touchstart"===t.type,!1!==i&&(n.helper=e("
    ").html(i).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(l).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_down){if(!n.is_drag){if(!(Math.abs(t.pageX-n.init_x)>(n.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-n.init_y)>(n.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;n.helper&&(n.helper.appendTo(l.body),n.helper_w=n.helper.outerWidth()),n.is_drag=!0,e(n.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var r=!1,i=!1,o=!1,s=!1,a=!1,d=!1,c=!1,h=!1,u=!1,p=!1;return n.scroll_t=0,n.scroll_l=0,n.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter((function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)})).each((function(){var r=e(this),i=r.offset();return this.scrollHeight>this.offsetHeight&&(i.top+r.height()-t.pageYthis.offsetWidth&&(i.left+r.width()-t.pageXs&&t.pageY-cs&&s-(t.pageY-c)d&&t.pageX-hd&&d-(t.pageX-h)o&&(u=o-50),a&&p+n.helper_w>a&&(p=a-(n.helper_w+2)),n.helper.css({left:p+"px",top:u+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_drag)t.target!==n.target&&e(n.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===n.target){var r=setTimeout((function(){e(t.target).click()}),100);e(t.target).one("click",(function(){r&&clearTimeout(r)}))}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,n){this.init=function(e,t){this._data.massload={},n.init.call(this,e,t)},this._load_nodes=function(t,r,i,o){var s,a,l,d=this.settings.massload,c=[],h=this._model.data;if(!i){for(s=0,a=t.length;a>s;s++)(!h[t[s]]||!h[t[s]].state.loaded&&!h[t[s]].state.failed||o)&&(c.push(t[s]),(l=this.get_node(t[s],!0))&&l.length&&l.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},c.length){if(e.isFunction(d))return d.call(this,c,e.proxy((function(e){var s,a;if(e)for(s in e)e.hasOwnProperty(s)&&(this._data.massload[s]=e[s]);for(s=0,a=t.length;a>s;s++)(l=this.get_node(t[s],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);n._load_nodes.call(this,t,r,i,o)}),this));if("object"==typeof d&&d&&d.url)return d=e.extend(!0,{},d),e.isFunction(d.url)&&(d.url=d.url.call(this,c)),e.isFunction(d.data)&&(d.data=d.data.call(this,c)),e.ajax(d).done(e.proxy((function(e,s,a){var d,c;if(e)for(d in e)e.hasOwnProperty(d)&&(this._data.massload[d]=e[d]);for(d=0,c=t.length;c>d;d++)(l=this.get_node(t[d],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);n._load_nodes.call(this,t,r,i,o)}),this)).fail(e.proxy((function(e){n._load_nodes.call(this,t,r,i,o)}),this))}}return n._load_nodes.call(this,t,r,i,o)},this._load_node=function(t,r){var i,o=this._data.massload[t.id],s=null;return o?(s=this["string"==typeof o?"_append_html_data":"_append_json_data"](t,"string"==typeof o?e(e.parseHTML(o)).filter((function(){return 3!==this.nodeType})):o,(function(e){r.call(this,e)})),(i=this.get_node(t.id,!0))&&i.length&&i.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],s):n._load_node.call(this,t,r)}},e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(n,r){this.bind=function(){r.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",e.proxy((function(t,n){if(this._data.search.som&&n.res.length){var r,i,o,s,a=this._model.data,l=[];for(r=0,i=n.res.length;i>r;r++)if(a[n.res[r]]&&!a[n.res[r]].state.hidden&&(l.push(n.res[r]),l=l.concat(a[n.res[r]].parents),this._data.search.smc))for(o=0,s=a[n.res[r]].children_d.length;s>o;o++)a[a[n.res[r]].children_d[o]]&&!a[a[n.res[r]].children_d[o]].state.hidden&&l.push(a[n.res[r]].children_d[o]);l=e.vakata.array_remove_item(e.vakata.array_unique(l),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(l,!0),this.redraw(!0)}}),this)).on("clear_search.jstree",e.proxy((function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))}),this))},this.search=function(n,r,i,o,s,a){if(!1===n||""===e.vakata.trim(n.toString()))return this.clear_search();o=(o=this.get_node(o))&&o.id?o.id:null,n=n.toString();var l,d,c=this.settings.search,h=!!c.ajax&&c.ajax,u=this._model.data,p=null,f=[],g=[];if(this._data.search.res.length&&!s&&this.clear_search(),i===t&&(i=c.show_only_matches),a===t&&(a=c.show_only_matches_children),!r&&!1!==h)return e.isFunction(h)?h.call(this,n,e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(n,!0,i,o,s,a)}))}),this),o):((h=e.extend({},h)).data||(h.data={}),h.data.str=n,o&&(h.data.inside=o),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=e.ajax(h).fail(e.proxy((function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(h)},this.settings.core.error.call(this,this._data.core.last_error)}),this)).done(e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(n,!0,i,o,s,a)}))}),this)),this._data.search.lastRequest);if(s||(this._data.search.str=n,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=i,this._data.search.smc=a),p=new e.vakata.search(n,!0,{caseSensitive:c.case_sensitive,fuzzy:c.fuzzy}),e.each(u[o||e.jstree.root].children_d,(function(e,t){var r=u[t];r.text&&!r.state.hidden&&(!c.search_leaves_only||r.state.loaded&&0===r.children.length)&&(c.search_callback&&c.search_callback.call(this,n,r)||!c.search_callback&&p.search(r.text).isMatch)&&(f.push(t),g=g.concat(r.parents))})),f.length){for(l=0,d=(g=e.vakata.array_unique(g)).length;d>l;l++)g[l]!==e.jstree.root&&u[g[l]]&&!0===this.open_node(g[l],null,0)&&this._data.search.opn.push(g[l]);s?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(f,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(f))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(f,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #"))),this._data.search.res=f),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:n,res:this._data.search.res,show_only_matches:i})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this.redraw_node=function(t,n,i,o){if((t=r.redraw_node.apply(this,arguments))&&-1!==e.inArray(t.id,this._data.search.res)){var s,a,l=null;for(s=0,a=t.childNodes.length;a>s;s++)if(t.childNodes[s]&&t.childNodes[s].className&&-1!==t.childNodes[s].className.indexOf("jstree-anchor")){l=t.childNodes[s];break}l&&(l.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,n,r){r=r||{},!1!==(r=e.extend({},e.vakata.search.defaults,r)).fuzzy&&(r.fuzzy=!0),t=r.caseSensitive?t:t.toLowerCase();var i,o,s,a,l=r.location,d=r.distance,c=r.threshold,h=t.length;return h>32&&(r.fuzzy=!1),r.fuzzy&&(i=1<n;n++)e[t.charAt(n)]=0;for(n=0;h>n;n++)e[t.charAt(n)]|=1<n;n++){for(d=0,u=y;u>d;)s(n,l+u)<=b?d=u:y=u,u=Math.floor((y-d)/2+d);for(y=u,f=Math.max(1,l-u+1),g=Math.min(l+u,v)+h,(_=new Array(g+2))[g+1]=(1<=f;a--)if(m=o[e.charAt(a-1)],_[a]=0===n?(_[a+1]<<1|1)&m:(_[a+1]<<1|1)&m|(p[a+1]|p[a])<<1|1|p[a+1],_[a]&i&&b>=(j=s(n,a-1))){if(b=j,x=a-1,k.push(x),!(x>l))break;f=Math.max(1,2*l-x)}if(s(n+1,l)>b)break;p=_}return{isMatch:x>=0,score:j}},!0===n?{search:a}:a(n)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy((function(e,t){this.sort(t.parent,!0)}),this)).on("rename_node.jstree create_node.jstree",e.proxy((function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)}),this)).on("move_node.jstree copy_node.jstree",e.proxy((function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)}),this))},this.sort=function(t,n){var r,i;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(r=0,i=t.children_d.length;i>r;r++)this.sort(t.children_d[r],!1)}};var f=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},e.jstree.plugins.state=function(t,n){this.bind=function(){n.bind.call(this);var t=e.proxy((function(){this.element.on(this.settings.state.events,e.proxy((function(){f&&clearTimeout(f),f=setTimeout(e.proxy((function(){this.save_state()}),this),100)}),this)),this.trigger("state_ready")}),this);this.element.on("ready.jstree",e.proxy((function(e,n){this.element.one("restore_state.jstree",t),this.restore_state()||t()}),this))},this.save_state=function(){var t=this.get_state();this.settings.state.preserve_loaded||delete t.core.loaded;var n={state:t,ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,JSON.stringify(n))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl||(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!t||(this.settings.state.preserve_loaded||delete t.core.loaded,this.element.one("set_state.jstree",(function(n,r){r.instance.trigger("restore_state",{state:e.extend(!0,{},t)})})),this.set_state(t),0)))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={default:{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(n,r){this.init=function(n,i){var o,s;if(i&&i.types&&i.types.default)for(o in i.types)if("default"!==o&&o!==e.jstree.root&&i.types.hasOwnProperty(o))for(s in i.types.default)i.types.default.hasOwnProperty(s)&&i.types[o][s]===t&&(i.types[o][s]=i.types.default[s]);r.init.call(this,n,i),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,n){r.refresh.call(this,t,n),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy((function(n,r){var i,o,s,a=this._model.data,l=r.nodes,d=this.settings.types,c="default";for(i=0,o=l.length;o>i;i++){if(c="default",a[l[i]].original&&a[l[i]].original.type&&d[a[l[i]].original.type]&&(c=a[l[i]].original.type),a[l[i]].data&&a[l[i]].data.jstree&&a[l[i]].data.jstree.type&&d[a[l[i]].data.jstree.type]&&(c=a[l[i]].data.jstree.type),a[l[i]].type=c,!0===a[l[i]].icon&&d[c].icon!==t&&(a[l[i]].icon=d[c].icon),d[c].li_attr!==t&&"object"==typeof d[c].li_attr)for(s in d[c].li_attr)if(d[c].li_attr.hasOwnProperty(s)){if("id"===s)continue;a[l[i]].li_attr[s]===t?a[l[i]].li_attr[s]=d[c].li_attr[s]:"class"===s&&(a[l[i]].li_attr.class=d[c].li_attr.class+" "+a[l[i]].li_attr.class)}if(d[c].a_attr!==t&&"object"==typeof d[c].a_attr)for(s in d[c].a_attr)if(d[c].a_attr.hasOwnProperty(s)){if("id"===s)continue;a[l[i]].a_attr[s]===t?a[l[i]].a_attr[s]=d[c].a_attr[s]:"href"===s&&"#"===a[l[i]].a_attr[s]?a[l[i]].a_attr.href=d[c].a_attr.href:"class"===s&&(a[l[i]].a_attr.class=d[c].a_attr.class+" "+a[l[i]].a_attr.class)}}a[e.jstree.root].type=e.jstree.root}),this)),r.bind.call(this)},this.get_json=function(t,n,i){var o,s,a=this._model.data,l=n?e.extend(!0,{},n,{no_id:!1}):{},d=r.get_json.call(this,t,l,i);if(!1===d)return!1;if(e.isArray(d))for(o=0,s=d.length;s>o;o++)d[o].type=d[o].id&&a[d[o].id]&&a[d[o].id].type?a[d[o].id].type:"default",n&&n.no_id&&(delete d[o].id,d[o].li_attr&&d[o].li_attr.id&&delete d[o].li_attr.id,d[o].a_attr&&d[o].a_attr.id&&delete d[o].a_attr.id);else d.type=d.id&&a[d.id]&&a[d.id].type?a[d.id].type:"default",n&&n.no_id&&(d=this._delete_ids(d));return d},this._delete_ids=function(t){if(e.isArray(t)){for(var n=0,r=t.length;r>n;n++)t[n]=this._delete_ids(t[n]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(n,i,o,s,a){if(!1===r.check.call(this,n,i,o,s,a))return!1;i=i&&i.id?i:this.get_node(i),o=o&&o.id?o:this.get_node(o);var l,d,c,h,u=i&&i.id?a&&a.origin?a.origin:e.jstree.reference(i.id):null;switch(u=u&&u._model&&u._model.data?u._model.data:null,n){case"create_node":case"move_node":case"copy_node":if("move_node"!==n||-1===e.inArray(i.id,o.children)){if((l=this.get_rules(o)).max_children!==t&&-1!==l.max_children&&l.max_children===o.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!o||!o.id)&&o.id})},!1;if(l.valid_children!==t&&-1!==l.valid_children&&-1===e.inArray(i.type||"default",l.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!o||!o.id)&&o.id})},!1;if(u&&i.children_d&&i.parents){for(d=0,c=0,h=i.children_d.length;h>c;c++)d=Math.max(d,u[i.children_d[c]].parents.length);d=d-i.parents.length+1}(0>=d||d===t)&&(d=1);do{if(l.max_depth!==t&&-1!==l.max_depth&&l.max_deptho;o++)this.set_type(n[o],r);return!0}if(i=this.settings.types,n=this.get_node(n),!i[r]||!n)return!1;if((c=this.get_node(n,!0))&&c.length&&(h=c.children(".jstree-anchor")),a=n.type,l=this.get_icon(n),n.type=r,(!0===l||!i[a]||i[a].icon!==t&&l===i[a].icon)&&this.set_icon(n,i[r].icon===t||i[r].icon),i[a]&&i[a].li_attr!==t&&"object"==typeof i[a].li_attr)for(d in i[a].li_attr)if(i[a].li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[n.id].li_attr.class=(u[n.id].li_attr.class||"").replace(i[a].li_attr[d],""),c&&c.removeClass(i[a].li_attr[d])):u[n.id].li_attr[d]===i[a].li_attr[d]&&(u[n.id].li_attr[d]=null,c&&c.removeAttr(d))}if(i[a]&&i[a].a_attr!==t&&"object"==typeof i[a].a_attr)for(d in i[a].a_attr)if(i[a].a_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[n.id].a_attr.class=(u[n.id].a_attr.class||"").replace(i[a].a_attr[d],""),h&&h.removeClass(i[a].a_attr[d])):u[n.id].a_attr[d]===i[a].a_attr[d]&&("href"===d?(u[n.id].a_attr[d]="#",h&&h.attr("href","#")):(delete u[n.id].a_attr[d],h&&h.removeAttr(d)))}if(i[r].li_attr!==t&&"object"==typeof i[r].li_attr)for(d in i[r].li_attr)if(i[r].li_attr.hasOwnProperty(d)){if("id"===d)continue;u[n.id].li_attr[d]===t?(u[n.id].li_attr[d]=i[r].li_attr[d],c&&("class"===d?c.addClass(i[r].li_attr[d]):c.attr(d,i[r].li_attr[d]))):"class"===d&&(u[n.id].li_attr.class=i[r].li_attr[d]+" "+u[n.id].li_attr.class,c&&c.addClass(i[r].li_attr[d]))}if(i[r].a_attr!==t&&"object"==typeof i[r].a_attr)for(d in i[r].a_attr)if(i[r].a_attr.hasOwnProperty(d)){if("id"===d)continue;u[n.id].a_attr[d]===t?(u[n.id].a_attr[d]=i[r].a_attr[d],h&&("class"===d?h.addClass(i[r].a_attr[d]):h.attr(d,i[r].a_attr[d]))):"href"===d&&"#"===u[n.id].a_attr[d]?(u[n.id].a_attr.href=i[r].a_attr.href,h&&h.attr("href",i[r].a_attr.href)):"class"===d&&(u[n.id].a_attr.class=i[r].a_attr.class+" "+u[n.id].a_attr.class,h&&h.addClass(i[r].a_attr[d]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(n,r){this.check=function(t,n,i,o,s){if(!1===r.check.call(this,t,n,i,o,s))return!1;if(n=n&&n.id?n:this.get_node(n),!(i=i&&i.id?i:this.get_node(i))||!i.children)return!0;var a,l,d,c="rename_node"===t?o:n.text,h=[],u=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,f=this._model.data;for(a=0,l=i.children.length;l>a;a++)d=f[i.children[a]].text,u||(d=d.toLowerCase()),p&&(d=d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),h.push(d);switch(u||(c=c.toLowerCase()),p&&(c=c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),t){case"delete_node":return!0;case"rename_node":return d=n.text||"",u||(d=d.toLowerCase()),p&&(d=d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(a=-1===e.inArray(c,h)||n.text&&d===c)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"create_node":return(a=-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"copy_node":return(a=-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"move_node":return(a=n.parent===i.id&&(!s||!s.is_multi)||-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a}return!0},this.create_node=function(n,i,o,s,a){if(!i||i.text===t){if(null===n&&(n=e.jstree.root),!(n=this.get_node(n)))return r.create_node.call(this,n,i,o,s,a);if(!(o=o===t?"last":o).toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(n))return r.create_node.call(this,n,i,o,s,a);i||(i={});var l,d,c,h,u,p,f=this._model.data,g=this.settings.unique.case_sensitive,_=this.settings.unique.trim_whitespace,m=this.settings.unique.duplicate;for(d=l=this.get_string("New node"),c=[],h=0,u=n.children.length;u>h;h++)p=f[n.children[h]].text,g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),c.push(p);for(h=1,p=d,g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==e.inArray(p,c);)p=d=m.call(this,l,++h).toString(),g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));i.text=d}return r.create_node.call(this,n,i,o,s,a)}};var g=l.createElement("DIV");if(g.setAttribute("unselectable","on"),g.setAttribute("role","presentation"),g.className="jstree-wholerow",g.innerHTML=" ",e.jstree.plugins.wholerow=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy((function(){this.hide_dots()}),this)).on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-wholerow-ul")}),this)).on("deselect_all.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")}),this)).on("changed.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var n,r,i=!1;for(n=0,r=t.selected.length;r>n;n++)(i=this.get_node(t.selected[n],!0))&&i.length&&i.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}),this)).on("open_node.jstree",e.proxy((function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}),this)).on("hover_node.jstree dehover_node.jstree",e.proxy((function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")}),this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy((function(t){if(this._data.contextmenu){t.preventDefault();var n=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n)}}),this)).on("click.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()})).on("dblclick.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var n=e.Event("dblclick",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()})).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy((function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()}),this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy((function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1}),this)).on("mouseleave.jstree",".jstree-node",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,r,i,o){if(t=n.redraw_node.apply(this,arguments)){var s=g.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(s.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(s.className+=" jstree-wholerow-hovered"),t.insertBefore(s,t.childNodes[0])}return t}},window.customElements&&Object&&Object.create){var _=Object.create(HTMLElement.prototype);_.createdCallback=function(){var t,n={core:{},plugins:[]};for(t in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(n.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(n[t]=JSON.parse(this.getAttribute(t))));for(t in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(n.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t));e(this).jstree(n)};try{window.customElements.define("vakata-jstree",(function(){}),{prototype:_})}catch(e){}}}},void 0===(o="function"==typeof r?r.apply(t,i):r)||(e.exports=o)}()},function(e,t){e.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-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 .vakata-contextmenu-disabled > a > i {\n filter: grayscale(100%);\n}\n.vakata-context li > a > i {\n text-decoration: none;\n display: inline-block;\n width: 2.4em;\n height: 2.4em;\n background: transparent;\n margin: 0 0 0 -2em;\n vertical-align: top;\n text-align: center;\n line-height: 2.4em;\n}\n.vakata-context li > a > i:empty {\n width: 2.4em;\n line-height: 2.4em;\n}\n.vakata-context li > a .vakata-contextmenu-sep {\n display: inline-block;\n width: 1px;\n height: 2.4em;\n background: white;\n margin: 0 0.5em 0 0;\n border-left: 1px solid #e2e3e3;\n}\n.vakata-context .vakata-contextmenu-shortcut {\n font-size: 0.8em;\n color: silver;\n opacity: 0.5;\n display: none;\n}\n.vakata-context-rtl ul {\n left: auto;\n right: 100%;\n margin-left: auto;\n margin-right: -4px;\n}\n.vakata-context-rtl li > a.vakata-context-parent {\n background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");\n background-position: left center;\n background-repeat: no-repeat;\n}\n.vakata-context-rtl .vakata-context-separator > a {\n margin: 0 2.4em 0 0;\n border-left: 0;\n border-right: 1px solid #e2e3e3;\n}\n.vakata-context-rtl .vakata-context-left ul {\n right: auto;\n left: 100%;\n margin-left: -4px;\n margin-right: auto;\n}\n.vakata-context-rtl li > a > i {\n margin: 0 -2em 0 0;\n}\n.vakata-context-rtl li > a .vakata-contextmenu-sep {\n margin: 0 0 0 0.5em;\n border-left-color: white;\n background: #e2e3e3;\n}\n#jstree-marker {\n position: absolute;\n top: 0;\n left: 0;\n margin: -5px 0 0 0;\n padding: 0;\n border-right: 0;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 5px solid;\n width: 0;\n height: 0;\n font-size: 0;\n line-height: 0;\n}\n#jstree-dnd {\n line-height: 16px;\n margin: 0;\n padding: 4px;\n}\n#jstree-dnd .jstree-icon,\n#jstree-dnd .jstree-copy {\n display: inline-block;\n text-decoration: none;\n margin: 0 2px 0 0;\n padding: 0;\n width: 16px;\n height: 16px;\n}\n#jstree-dnd .jstree-ok {\n background: green;\n}\n#jstree-dnd .jstree-er {\n background: red;\n}\n#jstree-dnd .jstree-copy {\n margin: 0 2px 0 2px;\n}\n.jstree-default .jstree-node,\n.jstree-default .jstree-icon {\n background-repeat: no-repeat;\n background-color: transparent;\n}\n.jstree-default .jstree-anchor,\n.jstree-default .jstree-animated,\n.jstree-default .jstree-wholerow {\n transition: background-color 0.15s, box-shadow 0.15s;\n}\n.jstree-default .jstree-hovered {\n background: #e7f4f9;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #cccccc;\n}\n.jstree-default .jstree-context {\n background: #e7f4f9;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #cccccc;\n}\n.jstree-default .jstree-clicked {\n background: #beebff;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #999999;\n}\n.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {\n display: none;\n}\n.jstree-default .jstree-disabled {\n background: transparent;\n color: #666666;\n}\n.jstree-default .jstree-disabled.jstree-hovered {\n background: transparent;\n box-shadow: none;\n}\n.jstree-default .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default .jstree-disabled > .jstree-icon {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default .jstree-search {\n font-style: italic;\n color: #8b0000;\n font-weight: bold;\n}\n.jstree-default .jstree-no-checkboxes .jstree-checkbox {\n display: none !important;\n}\n.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {\n background: transparent;\n box-shadow: none;\n}\n.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {\n background: #e7f4f9;\n}\n.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {\n background: transparent;\n}\n.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {\n background: #e7f4f9;\n}\n.jstree-default > .jstree-striped {\n min-width: 100%;\n display: inline-block;\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;\n}\n.jstree-default > .jstree-wholerow-ul .jstree-hovered,\n.jstree-default > .jstree-wholerow-ul .jstree-clicked {\n background: transparent;\n box-shadow: none;\n border-radius: 0;\n}\n.jstree-default .jstree-wholerow {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.jstree-default .jstree-wholerow-hovered {\n background: #e7f4f9;\n}\n.jstree-default .jstree-wholerow-clicked {\n background: #beebff;\n background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);\n background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);\n}\n.jstree-default .jstree-node {\n min-height: 24px;\n line-height: 24px;\n margin-left: 24px;\n min-width: 24px;\n}\n.jstree-default .jstree-anchor {\n line-height: 24px;\n height: 24px;\n}\n.jstree-default .jstree-icon {\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n.jstree-default .jstree-icon:empty {\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n.jstree-default.jstree-rtl .jstree-node {\n margin-right: 24px;\n}\n.jstree-default .jstree-wholerow {\n height: 24px;\n}\n.jstree-default .jstree-node,\n.jstree-default .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default .jstree-node {\n background-position: -292px -4px;\n background-repeat: repeat-y;\n}\n.jstree-default .jstree-last {\n background: transparent;\n}\n.jstree-default .jstree-open > .jstree-ocl {\n background-position: -132px -4px;\n}\n.jstree-default .jstree-closed > .jstree-ocl {\n background-position: -100px -4px;\n}\n.jstree-default .jstree-leaf > .jstree-ocl {\n background-position: -68px -4px;\n}\n.jstree-default .jstree-themeicon {\n background-position: -260px -4px;\n}\n.jstree-default > .jstree-no-dots .jstree-node,\n.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -36px -4px;\n}\n.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -4px -4px;\n}\n.jstree-default .jstree-disabled {\n background: transparent;\n}\n.jstree-default .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default .jstree-checkbox {\n background-position: -164px -4px;\n}\n.jstree-default .jstree-checkbox:hover {\n background-position: -164px -36px;\n}\n.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default .jstree-checked > .jstree-checkbox {\n background-position: -228px -4px;\n}\n.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default .jstree-checked > .jstree-checkbox:hover {\n background-position: -228px -36px;\n}\n.jstree-default .jstree-anchor > .jstree-undetermined {\n background-position: -196px -4px;\n}\n.jstree-default .jstree-anchor > .jstree-undetermined:hover {\n background-position: -196px -36px;\n}\n.jstree-default .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default > .jstree-striped {\n background-size: auto 48px;\n}\n.jstree-default.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -132px -36px;\n}\n.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -100px -36px;\n}\n.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -68px -36px;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -36px -36px;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -4px -36px;\n}\n.jstree-default .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default .jstree-file {\n background: url("32px.png") -100px -68px no-repeat;\n}\n.jstree-default .jstree-folder {\n background: url("32px.png") -260px -4px no-repeat;\n}\n.jstree-default > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default {\n line-height: 24px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default .jstree-ok,\n#jstree-dnd.jstree-default .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default i {\n background: transparent;\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n#jstree-dnd.jstree-default .jstree-ok {\n background-position: -4px -68px;\n}\n#jstree-dnd.jstree-default .jstree-er {\n background-position: -36px -68px;\n}\n.jstree-default .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 29px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n}\n.jstree-default.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-small .jstree-node {\n min-height: 18px;\n line-height: 18px;\n margin-left: 18px;\n min-width: 18px;\n}\n.jstree-default-small .jstree-anchor {\n line-height: 18px;\n height: 18px;\n}\n.jstree-default-small .jstree-icon {\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n.jstree-default-small .jstree-icon:empty {\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n margin-right: 18px;\n}\n.jstree-default-small .jstree-wholerow {\n height: 18px;\n}\n.jstree-default-small .jstree-node,\n.jstree-default-small .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default-small .jstree-node {\n background-position: -295px -7px;\n background-repeat: repeat-y;\n}\n.jstree-default-small .jstree-last {\n background: transparent;\n}\n.jstree-default-small .jstree-open > .jstree-ocl {\n background-position: -135px -7px;\n}\n.jstree-default-small .jstree-closed > .jstree-ocl {\n background-position: -103px -7px;\n}\n.jstree-default-small .jstree-leaf > .jstree-ocl {\n background-position: -71px -7px;\n}\n.jstree-default-small .jstree-themeicon {\n background-position: -263px -7px;\n}\n.jstree-default-small > .jstree-no-dots .jstree-node,\n.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -39px -7px;\n}\n.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -7px -7px;\n}\n.jstree-default-small .jstree-disabled {\n background: transparent;\n}\n.jstree-default-small .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default-small .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default-small .jstree-checkbox {\n background-position: -167px -7px;\n}\n.jstree-default-small .jstree-checkbox:hover {\n background-position: -167px -39px;\n}\n.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default-small .jstree-checked > .jstree-checkbox {\n background-position: -231px -7px;\n}\n.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default-small .jstree-checked > .jstree-checkbox:hover {\n background-position: -231px -39px;\n}\n.jstree-default-small .jstree-anchor > .jstree-undetermined {\n background-position: -199px -7px;\n}\n.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {\n background-position: -199px -39px;\n}\n.jstree-default-small .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default-small > .jstree-striped {\n background-size: auto 36px;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default-small.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -135px -39px;\n}\n.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -103px -39px;\n}\n.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -71px -39px;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -39px -39px;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -7px -39px;\n}\n.jstree-default-small .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default-small .jstree-file {\n background: url("32px.png") -103px -71px no-repeat;\n}\n.jstree-default-small .jstree-folder {\n background: url("32px.png") -263px -7px no-repeat;\n}\n.jstree-default-small > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default-small {\n line-height: 18px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default-small .jstree-ok,\n#jstree-dnd.jstree-default-small .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default-small i {\n background: transparent;\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n#jstree-dnd.jstree-default-small .jstree-ok {\n background-position: -7px -71px;\n}\n#jstree-dnd.jstree-default-small .jstree-er {\n background-position: -39px -71px;\n}\n.jstree-default-small .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default-small .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 23px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");\n}\n.jstree-default-small.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-large .jstree-node {\n min-height: 32px;\n line-height: 32px;\n margin-left: 32px;\n min-width: 32px;\n}\n.jstree-default-large .jstree-anchor {\n line-height: 32px;\n height: 32px;\n}\n.jstree-default-large .jstree-icon {\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n.jstree-default-large .jstree-icon:empty {\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n margin-right: 32px;\n}\n.jstree-default-large .jstree-wholerow {\n height: 32px;\n}\n.jstree-default-large .jstree-node,\n.jstree-default-large .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default-large .jstree-node {\n background-position: -288px 0px;\n background-repeat: repeat-y;\n}\n.jstree-default-large .jstree-last {\n background: transparent;\n}\n.jstree-default-large .jstree-open > .jstree-ocl {\n background-position: -128px 0px;\n}\n.jstree-default-large .jstree-closed > .jstree-ocl {\n background-position: -96px 0px;\n}\n.jstree-default-large .jstree-leaf > .jstree-ocl {\n background-position: -64px 0px;\n}\n.jstree-default-large .jstree-themeicon {\n background-position: -256px 0px;\n}\n.jstree-default-large > .jstree-no-dots .jstree-node,\n.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -32px 0px;\n}\n.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: 0px 0px;\n}\n.jstree-default-large .jstree-disabled {\n background: transparent;\n}\n.jstree-default-large .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default-large .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default-large .jstree-checkbox {\n background-position: -160px 0px;\n}\n.jstree-default-large .jstree-checkbox:hover {\n background-position: -160px -32px;\n}\n.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default-large .jstree-checked > .jstree-checkbox {\n background-position: -224px 0px;\n}\n.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default-large .jstree-checked > .jstree-checkbox:hover {\n background-position: -224px -32px;\n}\n.jstree-default-large .jstree-anchor > .jstree-undetermined {\n background-position: -192px 0px;\n}\n.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {\n background-position: -192px -32px;\n}\n.jstree-default-large .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default-large > .jstree-striped {\n background-size: auto 64px;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default-large.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -128px -32px;\n}\n.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -96px -32px;\n}\n.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -64px -32px;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -32px -32px;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: 0px -32px;\n}\n.jstree-default-large .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default-large .jstree-file {\n background: url("32px.png") -96px -64px no-repeat;\n}\n.jstree-default-large .jstree-folder {\n background: url("32px.png") -256px 0px no-repeat;\n}\n.jstree-default-large > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default-large {\n line-height: 32px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default-large .jstree-ok,\n#jstree-dnd.jstree-default-large .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default-large i {\n background: transparent;\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n#jstree-dnd.jstree-default-large .jstree-ok {\n background-position: 0px -64px;\n}\n#jstree-dnd.jstree-default-large .jstree-er {\n background-position: -32px -64px;\n}\n.jstree-default-large .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default-large .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 37px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");\n}\n.jstree-default-large.jstree-rtl .jstree-last {\n background: transparent;\n}\n@media (max-width: 768px) {\n #jstree-dnd.jstree-dnd-responsive {\n line-height: 40px;\n font-weight: bold;\n font-size: 1.1em;\n text-shadow: 1px 1px white;\n }\n #jstree-dnd.jstree-dnd-responsive > i {\n background: transparent;\n width: 40px;\n height: 40px;\n }\n #jstree-dnd.jstree-dnd-responsive > .jstree-ok {\n background-image: url("40px.png");\n background-position: 0 -200px;\n background-size: 120px 240px;\n }\n #jstree-dnd.jstree-dnd-responsive > .jstree-er {\n background-image: url("40px.png");\n background-position: -40px -200px;\n background-size: 120px 240px;\n }\n #jstree-marker.jstree-dnd-responsive {\n border-left-width: 10px;\n border-top-width: 10px;\n border-bottom-width: 10px;\n margin-top: -10px;\n }\n}\n@media (max-width: 768px) {\n .jstree-default-responsive {\n /*\n\t.jstree-open > .jstree-ocl,\n\t.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }\n\t*/\n }\n .jstree-default-responsive .jstree-icon {\n background-image: url("40px.png");\n }\n .jstree-default-responsive .jstree-node,\n .jstree-default-responsive .jstree-leaf > .jstree-ocl {\n background: transparent;\n }\n .jstree-default-responsive .jstree-node {\n min-height: 40px;\n line-height: 40px;\n margin-left: 40px;\n min-width: 40px;\n white-space: nowrap;\n }\n .jstree-default-responsive .jstree-anchor {\n line-height: 40px;\n height: 40px;\n }\n .jstree-default-responsive .jstree-icon,\n .jstree-default-responsive .jstree-icon:empty {\n width: 40px;\n height: 40px;\n line-height: 40px;\n }\n .jstree-default-responsive > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n }\n .jstree-default-responsive.jstree-rtl .jstree-node {\n margin-left: 0;\n margin-right: 40px;\n background: transparent;\n }\n .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node {\n margin-right: 0;\n }\n .jstree-default-responsive .jstree-ocl,\n .jstree-default-responsive .jstree-themeicon,\n .jstree-default-responsive .jstree-checkbox {\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-leaf > .jstree-ocl,\n .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl {\n background: transparent;\n }\n .jstree-default-responsive .jstree-open > .jstree-ocl {\n background-position: 0 0 !important;\n }\n .jstree-default-responsive .jstree-closed > .jstree-ocl {\n background-position: 0 -40px !important;\n }\n .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -40px 0 !important;\n }\n .jstree-default-responsive .jstree-themeicon {\n background-position: -40px -40px;\n }\n .jstree-default-responsive .jstree-checkbox,\n .jstree-default-responsive .jstree-checkbox:hover {\n background-position: -40px -80px;\n }\n .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n .jstree-default-responsive .jstree-checked > .jstree-checkbox,\n .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover {\n background-position: 0 -80px;\n }\n .jstree-default-responsive .jstree-anchor > .jstree-undetermined,\n .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover {\n background-position: 0 -120px;\n }\n .jstree-default-responsive .jstree-anchor {\n font-weight: bold;\n font-size: 1.1em;\n text-shadow: 1px 1px white;\n }\n .jstree-default-responsive > .jstree-striped {\n background: transparent;\n }\n .jstree-default-responsive .jstree-wholerow {\n border-top: 1px solid rgba(255, 255, 255, 0.7);\n border-bottom: 1px solid rgba(64, 64, 64, 0.2);\n background: #ebebeb;\n height: 40px;\n }\n .jstree-default-responsive .jstree-wholerow-hovered {\n background: #e7f4f9;\n }\n .jstree-default-responsive .jstree-wholerow-clicked {\n background: #beebff;\n }\n .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow {\n box-shadow: inset 0 -6px 3px -5px #666666;\n }\n .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow {\n box-shadow: inset 0 6px 3px -5px #666666;\n border-top: 0;\n }\n .jstree-default-responsive .jstree-children .jstree-open + .jstree-open {\n box-shadow: none;\n }\n .jstree-default-responsive .jstree-node,\n .jstree-default-responsive .jstree-icon,\n .jstree-default-responsive .jstree-node > .jstree-ocl,\n .jstree-default-responsive .jstree-themeicon,\n .jstree-default-responsive .jstree-checkbox {\n background-image: url("40px.png");\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-node {\n background-position: -80px 0;\n background-repeat: repeat-y;\n }\n .jstree-default-responsive .jstree-last {\n background: transparent;\n }\n .jstree-default-responsive .jstree-leaf > .jstree-ocl {\n background-position: -40px -120px;\n }\n .jstree-default-responsive .jstree-last > .jstree-ocl {\n background-position: -40px -160px;\n }\n .jstree-default-responsive .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n }\n .jstree-default-responsive .jstree-file {\n background: url("40px.png") 0 -160px no-repeat;\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-folder {\n background: url("40px.png") -40px -40px no-repeat;\n background-size: 120px 240px;\n }\n .jstree-default-responsive > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n }\n}\n'},function(e,t){e.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: #191921;\n padding: 0;\n font-size: 13px;\n color: #7c7c85;\n box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);\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 *:focus,\n.ins-container *:active {\n outline: 0;\n}\n\n.ins-container *:-moz-focusring {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.ins-container *:focus-visible {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\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: #191921 #191921;\n scrollbar-width: thin;\n}\n\n.ins-world-tree:hover {\n scrollbar-color: #32323a #191921;\n scrollbar-width: thin;\n}\n\n.ins-world-tree::-webkit-scrollbar {\n background: #191921;\n width: 6px;\n height: 6px;\n}\n\n.ins-world-tree::-webkit-scrollbar-track,\n.ins-world-tree::-webkit-scrollbar-corner {\n background: #191921;\n}\n\n.ins-world-tree::-webkit-scrollbar-thumb {\n background: #191921;\n border-radius: 3px;\n}\n\n.ins-world-tree:hover::-webkit-scrollbar-thumb {\n background: #32323a;\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: #191921;\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 transform: translateY(1px);\n background: #000;\n}\n\n.jstree-default .jstree-search {\n font-style: italic;\n color: #aaa;\n font-weight: normal;\n}\n\n.jstree-default .jstree-wholerow-hovered,\n.jstree-default .jstree-hovered {\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n}\n\n.jstree-default .jstree-wholerow {\n height: 28px;\n}\n\n.jstree-default .jstree-wholerow-clicked,\n.jstree-default .jstree-clicked {\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n transition: none;\n}\n\n.jstree-default .jstree-leaf .jstree-clicked {\n color: #bbb !important;\n}\n\n.jstree-default .jstree-anchor {\n line-height: 27px;\n outline: none;\n}\n\n.jstree-default .jstree-container-ul {\n margin-bottom: 12px;\n}\n\n.jstree-default .jstree-container-ul > .jstree-node > .jstree-anchor:before,\n.jstree-default\n .jstree-open\n > .jstree-children\n > .jstree-node\n > .jstree-anchor:before {\n content: "";\n display: block;\n position: absolute;\n left: 0;\n right: 1px;\n height: 28px;\n border-radius: 0;\n box-shadow: none;\n border-right: none;\n pointer-events: none;\n background: rgb(44, 47, 62, 0.5);\n opacity: 0;\n}\n\n.jstree-default .jstree-anchor.jstree-clicked:before {\n opacity: 1 !important;\n pointer-events: none;\n}\n\n.jstree-default .jstree-node,\n.jstree-default .jstree-leaf .jstree-ocl,\n.jstree-default .jstree-icon {\n background: transparent;\n}\n\n.jstree-default .jstree-node {\n min-height: 28px;\n line-height: 28px;\n margin-left: 12px;\n min-width: 26px;\n}\n\n.jstree-default .jstree-icon {\n position: relative;\n}\n\n.jstree-default .jstree-icon:before {\n display: block;\n pointer-events: none;\n color: #d6d6d6;\n font-style: normal;\n font-size: 11px;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 24px;\n line-height: 24px;\n transform-origin: 12px 12px;\n transform: translate(0px, -0px);\n}\n\n.jstree-default .jstree-open > .jstree-icon:before {\n content: "▾";\n top: 2px;\n}\n\n.jstree-default .jstree-closed > .jstree-icon:before {\n content: "▾";\n transform: rotate(-90deg) translate(-2px, 0px);\n}\n\n.jstree-leaf .jstree-icon:before {\n display: none;\n}\n\n.jstree-default .jstree-open .jstree-ocl {\n background-position: -38px -1px;\n}\n\n.jstree-default .jstree-closed .jstree-ocl {\n background-position: -4px -2px;\n}\n\n.jstree-anchor {\n padding: 1px 0;\n transition: none;\n}\n\n.jstree-anchor .jstree-icon {\n display: none;\n}\n\n.jstree-node-type-bodies > .jstree-anchor,\n.jstree-node-type-constraints > .jstree-anchor,\n.jstree-node-type-composites > .jstree-anchor {\n color: #51515d;\n}\n\n#vakata-dnd {\n font-size: 12px;\n color: #aaa;\n}\n'},function(e,t,n){"use strict";const r=e.exports={},i=n(3),o=n(4),s=n(1),a=n(0).Common;r._isIOS=window.navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,r._matterLink="https://brm.io/matter-js/",r.create=function(e){let t=Object.assign({example:{instance:null},examples:[],resetOnOrientation:!1,preventZoom:!1,fullPage:!1,startExample:!0,appendTo:document.body,toolbar:{title:null,url:null,reset:!0,source:!1,inspector:!1,tools:!1,fullscreen:!0,exampleSelect:!1},tools:{inspector:null,gui:null},dom:{}},e||{});return(!e.toolbar||t.examples.length>1&&e.toolbar&&!1!==e.toolbar.exampleSelect)&&(t.toolbar.exampleSelect=!0),r._isIOS&&(t.toolbar.fullscreen=!1),i||(t.toolbar.tools=!1,t.tools.gui=!1),o||(t.toolbar.inspector=!1,t.tools.inspector=!1),t.dom=r._createDom(t),r._bindDom(t),t.fullPage||!1===t.inline||t.dom.root.classList.add("matter-demo-inline"),t.appendTo&&t.appendTo.appendChild(t.dom.root),t.startExample&&r.start(t,t.startExample),t},r.start=function(e,t){t="string"==typeof t?t:e.examples[0].id,window.location.hash.length>0&&(t=window.location.hash.slice(1)),r.setExampleById(e,t)},r.stop=function(e){e.example&&e.example.instance&&e.example.instance.stop()},r.reset=function(e){a._nextId=0,a._seed=0,r.setExample(e,e.example)},r.setExampleById=function(e,t){let n=e.examples.filter((e=>e.id===t))[0];r.setExample(e,n)},r.setExample=function(e,t){if(t){let n=e.example.instance;n&&(n.stop(),n.canvas&&n.canvas.parentElement.removeChild(n.canvas)),window.location.hash=t.id,e.example.instance=null,e.example=t,e.example.instance=n=t.init(e),!n.canvas&&n.render&&(n.canvas=n.render.canvas),n.canvas&&e.dom.root.appendChild(n.canvas),e.dom.exampleSelect.value=t.id,e.dom.buttonSource.href=t.sourceLink||e.url||"#",setTimeout((function(){e.tools.inspector&&r.setInspector(e,!0),e.tools.gui&&r.setGui(e,!0)}),500)}else r.setExample(e,e.examples[0])},r.setInspector=function(e,t){if(!t)return r._destroyTools(e,!0,!1),void e.dom.root.classList.toggle("matter-inspect-active",!1);let n=e.example.instance;r._destroyTools(e,!0,!1),e.dom.root.classList.toggle("matter-inspect-active",!0),e.tools.inspector=o.create(n.engine,n.render)},r.setGui=function(e,t){if(!t)return r._destroyTools(e,!1,!0),void e.dom.root.classList.toggle("matter-gui-active",!1);let n=e.example.instance;r._destroyTools(e,!1,!0),e.dom.root.classList.toggle("matter-gui-active",!0),e.tools.gui=i.create(n.engine,n.runner,n.render)},r._destroyTools=function(e,t,n){let r=e.tools.inspector,s=e.tools.gui;t&&r&&!0!==r&&(o.destroy(r),e.tools.inspector=null),n&&s&&!0!==s&&(i.destroy(s),e.tools.gui=null)},r._toggleFullscreen=function(e){let t=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;t?document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t=e.dom.root,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT))},r._bindDom=function(e){var t=e.dom;if(window.addEventListener("orientationchange",(function(){setTimeout((()=>{e.resetOnOrientation&&r.reset(e)}),300)})),e.preventZoom){document.body.addEventListener("gesturestart",(function(e){e.preventDefault()}));var n,i=!0;document.body.addEventListener("touchstart",(function(e){i||e.preventDefault(),i=!1,clearTimeout(n),n=setTimeout((function(){i=!0}),500)}))}if(t.exampleSelect&&t.exampleSelect.addEventListener("change",(function(){let t=this.options[this.selectedIndex].value;r.setExampleById(e,t)})),t.buttonReset&&t.buttonReset.addEventListener("click",(function(){r.reset(e)})),t.buttonInspect&&t.buttonInspect.addEventListener("click",(function(){var t=!e.tools.inspector;r.setInspector(e,t)})),t.buttonTools&&t.buttonTools.addEventListener("click",(function(){var t=!e.tools.gui;r.setGui(e,t)})),t.buttonFullscreen){t.buttonFullscreen.addEventListener("click",(function(){r._toggleFullscreen(e)}));var o=function(){var e=document.fullscreen||document.webkitIsFullScreen||document.mozFullScreen;document.body.classList.toggle("matter-is-fullscreen",e)};document.addEventListener("webkitfullscreenchange",o),document.addEventListener("mozfullscreenchange",o),document.addEventListener("fullscreenchange",o)}},r._createDom=function(e){let t=n(15);s.injectStyles(t,"matter-demo-style");let i=document.createElement("div"),o=e.examples.map((e=>``)).join(" ");var a=e.preventZoom&&r._isIOS?"prevent-zoom-ios":"";i.innerHTML=`\n
    \n
    \n
    \n
    \n

    \n \n ${e.toolbar.title}\n \n \n \n \n \n

    \n
    \n
    \n \n \n \n \n \n
    \n \n { }\n \n \n \n
    \n \n \n \n
    \n
    \n
    \n
    \n `;let l={root:i.firstElementChild,title:i.querySelector(".matter-demo-title"),header:i.querySelector(".matter-header"),exampleSelect:i.querySelector(".matter-example-select"),buttonReset:i.querySelector(".matter-btn-reset"),buttonSource:i.querySelector(".matter-btn-source"),buttonTools:i.querySelector(".matter-btn-tools"),buttonInspect:i.querySelector(".matter-btn-inspect"),buttonFullscreen:i.querySelector(".matter-btn-fullscreen")};return e.toolbar.title||s.domRemove(l.title),e.toolbar.exampleSelect||s.domRemove(l.exampleSelect.parentElement),e.toolbar.reset||s.domRemove(l.buttonReset),e.toolbar.source||s.domRemove(l.buttonSource),e.toolbar.inspector||s.domRemove(l.buttonInspect),e.toolbar.tools||s.domRemove(l.buttonTools),e.toolbar.fullscreen||s.domRemove(l.buttonFullscreen),l}},function(e,t){e.exports='/*\n*\tMatterTools.Demo\n*/\n\n.matter-demo {\n display: flex;\n background: #14151f;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n height: 100vh;\n padding: 50px 0 0 0;\n}\n\n.matter-demo,\n.matter-demo * {\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.matter-demo *:focus,\n.matter-demo *:active {\n outline: 0;\n}\n\n.matter-demo *:-moz-focusring {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.matter-demo *:focus-visible {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.matter-demo.matter-demo-inline {\n padding: 0;\n height: inherit;\n}\n\n.matter-demo canvas {\n border-radius: 8px;\n border: 1px solid rgba(255, 255, 255, 0.07);\n max-width: 100%;\n max-height: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-demo.matter-demo-inline canvas {\n max-height: calc(100% - 49px);\n}\n\n.matter-is-fullscreen .matter-demo {\n width: 100%;\n}\n\n.matter-is-fullscreen .dg.ac,\n.matter-is-fullscreen .ins-container {\n display: none;\n}\n\n.matter-header-outer {\n position: fixed;\n z-index: 100;\n top: 0;\n left: 0;\n right: 0;\n background: #0e0f19;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.matter-demo-inline .matter-header-outer {\n position: static;\n background: transparent;\n z-index: 0;\n width: 100%;\n}\n\n.matter-header {\n width: 100%;\n padding: 7px 20px 8px 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.matter-header-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n\n.matter-header h1 {\n display: none;\n margin: 0 12px 0 0;\n width: 18px;\n overflow: hidden;\n flex-shrink: 0;\n}\n\n.matter-header h1 a {\n color: #c5c5cc;\n font-size: 14px;\n font-weight: 400;\n display: block;\n text-decoration: none;\n padding: 3px 0 2px 0;\n border-bottom: 1px solid transparent;\n white-space: nowrap;\n float: right;\n}\n\n.matter-header h1 a:hover,\n.matter-header h1 a:focus {\n border-bottom: 1px solid #f5b862;\n color: #fff;\n outline: 0;\n}\n\n@media screen and (min-width: 300px) {\n .matter-header h1 {\n display: inline;\n }\n}\n\n@media screen and (min-width: 600px) {\n .matter-header h1 {\n width: auto;\n overflow: visible;\n }\n}\n\n.btn-home {\n display: none;\n}\n\n.matter-demo-title svg {\n fill: #fff;\n width: 14px;\n height: 14px;\n margin: 0px 0 -2px 2px;\n}\n\n.matter-link {\n text-decoration: none;\n line-height: 13px;\n margin: 0 -10px 0 0;\n flex-shrink: 0;\n}\n\n.matter-link:focus {\n outline: none;\n}\n\n.matter-logo {\n height: 33px;\n width: 46px;\n}\n\n@media screen and (min-width: 1024px) {\n .matter-logo {\n width: 50px;\n }\n}\n\n.matter-logo #m-triangle {\n transform-origin: 14px 856px;\n transition: transform 400ms ease;\n}\n\n.matter-link:focus #m-triangle,\n.matter-logo:hover #m-triangle {\n transform: rotate(-30deg) translate(-98px, -25px);\n}\n\n.matter-logo #m-circle {\n transition: transform 200ms ease;\n transition-delay: 300ms;\n}\n\n.matter-link:focus #m-circle,\n.matter-logo:hover #m-circle {\n transform: translate(18px, -33px);\n}\n\n.matter-logo #m-square {\n transition: transform 150ms ease;\n transition-delay: 400ms;\n}\n\n.matter-link:focus #m-square,\n.matter-logo:hover #m-square {\n transform: translate(47px, -2px);\n}\n\n.matter-toolbar {\n flex-grow: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 18px 0 0;\n}\n\n.matter-select {\n background: transparent;\n color: #c5c5cc;\n font-size: 14px;\n line-height: 33px;\n width: 100%;\n outline: none;\n padding: 0 25px 0 7px;\n margin: 0;\n border: 0;\n border-radius: 0;\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-select option {\n background: #fff;\n color: #000;\n}\n\n.matter-select-wrapper {\n height: 33px;\n width: 100%;\n min-width: 100px;\n max-width: 175px;\n position: relative;\n display: inline-block;\n margin-right: 4%;\n}\n\n.matter-select-wrapper:after {\n content: " ";\n display: block;\n position: absolute;\n pointer-events: none;\n width: 28px;\n height: 100%;\n background: linear-gradient(-90deg, rgb(14 15 25), rgb(14 15 25 / 0));\n right: 23px;\n top: 0;\n}\n\n.matter-demo-inline .matter-select-wrapper:after {\n display: none;\n}\n\n.matter-select:hover,\n.matter-select-wrapper:hover .matter-select {\n color: #fff;\n}\n\n.matter-select:focus-visible {\n color: #fff;\n}\n\n.matter-select:-moz-focusring {\n color: #fff;\n}\n\n.matter-select:focus {\n outline: 0;\n}\n\n.matter-select-wrapper svg:hover,\n.matter-select-wrapper:hover svg {\n background: #232635;\n}\n\n.matter-select-wrapper:hover:after svg {\n fill: #fff;\n}\n\n.matter-select-wrapper svg {\n display: block;\n pointer-events: none;\n fill: #cecece;\n width: 20px;\n height: 20px;\n position: absolute;\n z-index: 2;\n top: 6px;\n right: 0;\n border-radius: 5px;\n background: #101119;\n}\n\n.matter-btn {\n border: 0;\n background: #0b0c15;\n width: 40px;\n height: 33px;\n border-radius: 2px;\n display: inline-block;\n font-size: 16px;\n line-height: 1;\n color: #c2cad4;\n text-decoration: none;\n text-align: center;\n cursor: default;\n flex-shrink: 0;\n flex-grow: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-btn svg {\n fill: #fff;\n width: 15px;\n height: 15px;\n margin: 2px 0 0 0;\n}\n\n.matter-demo-inline .matter-btn {\n background: #0f0f13;\n}\n\n.matter-btn:hover {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn:active {\n transform: translate(0px, 1px);\n}\n\n.matter-btn:focus-visible {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn:-moz-focusring {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn-tools {\n position: relative;\n display: none;\n font-size: 15px;\n}\n\n.matter-btn-tools svg {\n margin-left: -3px;\n}\n\n.matter-btn-inspect {\n position: relative;\n display: none;\n}\n\n.matter-btn-inspect svg {\n margin-left: -3px;\n}\n\n.matter-btn-source {\n display: none;\n font-size: 12px;\n text-align: center;\n line-height: 31px;\n}\n\n.matter-btn-fullscreen {\n position: relative;\n font-size: 18px;\n}\n\n.matter-btn-fullscreen svg {\n margin-left: -3px;\n}\n\n.matter-is-fullscreen .matter-btn-tools,\n.matter-is-fullscreen .matter-btn-inspect {\n display: none;\n}\n\n.matter-btn-fullscreen:after,\n.matter-btn-tools:after,\n.matter-btn-inspect:after {\n content: " ";\n position: absolute;\n bottom: 10px;\n width: 3px;\n height: 3px;\n background: #f5df75;\n border-radius: 1px;\n opacity: 0;\n transform: scale(0);\n transition: opacity 100ms ease, transform 100ms ease;\n}\n\n.matter-btn-inspect:after {\n left: 31px;\n}\n\n.matter-btn-tools:after {\n background: #f45f5f;\n left: 28px;\n}\n\n.matter-btn-fullscreen:after {\n background: #76f09b;\n left: 32px;\n}\n\n.matter-is-fullscreen .matter-btn-fullscreen:after,\n.matter-gui-active .matter-btn-tools:after,\n.matter-inspect-active .matter-btn-inspect:after {\n opacity: 1;\n transform: scale(1);\n}\n\n.ins-container,\nbody .dg {\n display: none;\n}\n\n@media screen and (min-width: 500px) {\n .ins-container,\n body .dg,\n .matter-btn-tools,\n .matter-btn-inspect,\n .matter-btn-source {\n display: block;\n }\n}\n'}])},e.exports=r(n("lniP"))}}]); \ No newline at end of file diff --git a/demo/js/matter-demo.matter-tools.97f38a.min.js b/demo/js/matter-demo.matter-tools.97f38a.min.js deleted file mode 100644 index 5e582849..00000000 --- a/demo/js/matter-demo.matter-tools.97f38a.min.js +++ /dev/null @@ -1,117 +0,0 @@ -/*! - * matter-demo bundle 0.19.0 by @liabru - * http://brm.io/matter-js/ - * License MIT - */ -(this.webpackJsonpMatterDemo=this.webpackJsonpMatterDemo||[]).push([[2],{akk5:function(e,t,n){ -/*! - * matter-tools 0.14.0 by @liabru - * https://github.com/liabru/matter-tools - * License MIT - * - * 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. - */ -var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/demo/lib/",n(n.s=6)}([function(t,n){t.exports=e},function(e,t,n){"use strict";const r=e.exports={};r.injectStyles=function(e,t){if(document.getElementById(t))return;let n=document.createElement("div");n.innerHTML=``;let i=document.head.querySelector("style:last-of-type");i?r.domInsertBefore(n.firstElementChild,i):document.head.appendChild(n.firstElementChild)},r.injectScript=function(e,t,n){if(document.getElementById(t))return;let r=document.createElement("script");r.id=t,r.src=e,r.onload=n,document.body.appendChild(r)},r.domRemove=function(e){return e.parentElement.removeChild(e)},r.domInsertBefore=function(e,t){return t.parentNode.insertBefore(e,t.previousElementSibling)}},function(e,t,n){"use strict";const r=e.exports={},i=n(8),o=n(0),s=o.Common,a=o.Engine;r.create=function(){let e=new i({prefix:"$",cleanup:!0});return e.parse=e.resurrect,e},r.clone=function(e,t){var n=e.parse(r.serialise(e,t));return n.id=s.nextId(),n},r.saveState=function(e,t,n){localStorage.setItem(n,r.serialise(e,t.world))},r.loadState=function(e,t,n){var r=e.parse(localStorage.getItem(n));r&&a.merge(t,{world:r})},r.serialise=function(e,t,n){return n=n||0,e.stringify(t,(function(e,t){if(!/^#/.exec(e)&&"number"==typeof t){var n=parseFloat(t.toFixed(3));return 0===n&&0!==t?t:n}return t}),n)}},function(e,t,n){"use strict";const r=e.exports={},i=n(7),o=n(1),s=n(2),a=n(0),l=a.Engine,d=a.Detector,c=a.Grid,h=a.World,u=a.Bodies,p=a.Events,f=a.Composite;r.create=function(e,t,r){i.GUI.TEXT_CLOSED="▲",i.GUI.TEXT_OPEN="▼";var a={engine:e,runner:t,render:r,datGui:new i.GUI({autoPlace:!1}),broadphase:"grid",broadphaseCache:{grid:e.broadphase.controller===c?e.broadphase:c.create(),bruteForce:{detector:d.bruteForce}},amount:1,size:40,sides:4,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,offset:{x:0,y:0},renderer:"canvas",chamfer:0,isRecording:!1};s&&(a.serializer=s.create());let l=n(9);return o.injectStyles(l,"matter-gui-style"),g(a),a},r.update=function(e){var t,n=e.datGui;for(t in n.__folders)r.update(e,n.__folders[t]);for(t in n.__controllers){var i=n.__controllers[t];i.updateDisplay&&i.updateDisplay()}},r.closeAll=function(e){var t=e.datGui;for(var n in t.__folders)t.__folders[n].close()},r.destroy=function(e){e.datGui.domElement.parentElement.removeChild(e.datGui.domElement),e.datGui.destroy()};var g=function(e){var t=e.engine,n=e.runner,r=e.datGui,i={addBody:function(){_(e)},clear:function(){m(e)},save:function(){s.saveState(e.serializer,t,"guiState"),p.trigger(e,"save")},load:function(){s.loadState(e.serializer,t,"guiState"),p.trigger(e,"load")}},o=r.addFolder("Metrics");if(n&&o.add(n,"fps").listen(),t.metrics.extended&&(n&&(o.add(n,"delta").listen(),o.add(n,"correction").listen()),t&&(o.add(t.metrics,"bodies").listen(),o.add(t.metrics,"collisions").listen(),o.add(t.metrics,"pairs").listen(),o.add(t.metrics,"broadEff").listen(),o.add(t.metrics,"midEff").listen(),o.add(t.metrics,"narrowEff").listen(),o.add(t.metrics,"narrowReuse").listen()),o.open()),t){var a=r.addFolder("Add Body");a.add(e,"amount",1,5).step(1),a.add(e,"size",5,150).step(1),a.add(e,"sides",1,8).step(1),a.add(e,"density",1e-4,.01).step(.001),a.add(e,"friction",0,1).step(.05),a.add(e,"frictionStatic",0,10).step(.1),a.add(e,"frictionAir",0,10*e.frictionAir).step(e.frictionAir/10),a.add(e,"restitution",0,1).step(.1),a.add(e,"chamfer",0,30).step(2),a.add(i,"addBody"),a.open();var l=r.addFolder("World");e.serializer&&(l.add(i,"load"),l.add(i,"save")),l.add(i,"clear"),l.open();var d=r.addFolder("Gravity");d.add(t.world.gravity,"scale",0,.001).step(1e-4),d.add(t.world.gravity,"x",-1,1).step(.01),d.add(t.world.gravity,"y",-1,1).step(.01);var c=r.addFolder("Engine");c.add(t,"enableSleeping"),c.add(t.timing,"timeScale",0,1.2).step(.05).listen(),c.add(t,"velocityIterations",1,10).step(1),c.add(t,"positionIterations",1,10).step(1),c.add(t,"constraintIterations",1,10).step(1),n&&c.add(n,"enabled")}if(e.render){var h=r.addFolder("Render");h.add(e.render.options,"wireframes").onFinishChange((function(e){e||(f.setValue(!1),u.setValue(!1))})),h.add(e.render.options,"showDebug"),h.add(e.render.options,"showPositions"),h.add(e.render.options,"showBroadphase"),h.add(e.render.options,"showBounds"),h.add(e.render.options,"showVelocity"),h.add(e.render.options,"showCollisions"),h.add(e.render.options,"showSeparations");var u=h.add(e.render.options,"showAxes"),f=h.add(e.render.options,"showAngleIndicator");h.add(e.render.options,"showSleeping"),h.add(e.render.options,"showIds"),h.add(e.render.options,"showVertexNumbers"),h.add(e.render.options,"showConvexHulls"),h.add(e.render.options,"showInternalEdges"),h.add(e.render.options,"enabled"),h.open()}document.body.appendChild(e.datGui.domElement)},_=function(e){var t=e.engine,n={density:e.density,friction:e.friction,frictionStatic:e.frictionStatic,frictionAir:e.frictionAir,restitution:e.restitution};e.chamfer&&e.sides>2&&(n.chamfer={radius:e.chamfer});for(var r=0;r{d.keyBindings.push(e)})),x(d),E(d),k(d),j(d),d},r.destroy=function(e){e.controls.worldTree.data("jstree").destroy(),[].slice.call(document.body.querySelectorAll(".ins-container",".vakata-context",".jstree-marker")).forEach(s.domRemove),e.keyBindings.forEach((e=>{i.unbind(e)})),p.off(e.engine,"beforeUpdate",e.beforeEngineUpdate),e.render&&(p.off(e.render,"afterRender",e.afterRender),p.off(e.mouseConstraint))};var x=function(e){var t,n=e.controls,r=o('
    '),i=o('
    '),s=o('
    '),l=o(''),d=o(''),c=o(''),h=o(''),u=o(''),p=o('');a?s.append(h,d,c,u):s.append(h,u),r.prepend(i,l,p),b.prepend(r),n.pauseButton=h,n.importButton=d,n.exportButton=c,n.helpButton=u,n.searchBox=l,n.container=r,n.addCompositeButton=p,n.pauseButton.click((function(){D(e,!e.isPaused)})),n.exportButton.click((function(){V(e)})),n.importButton.click((function(){K(e)})),n.helpButton.click((function(){y(e)})),n.addCompositeButton.click((function(){U(e)})),n.searchBox.keyup((function(){clearTimeout(t),t=setTimeout((function(){var e=n.searchBox.val();n.worldTree.data("jstree").search(e)}),250)}))},y=function(){alert("Matter Tools\n\nDrag nodes in the tree to move them between composites.\nUse browser's developer console to inspect selected objects.\nNote: selections only render if renderer supports it.\n\n[shift + space] pause or play simulation.\n[right click] and drag on empty space to select a region.\n[right click] and drag on an object to move it.\n[right click + shift] and drag to move whole selection.\n\n[ctrl-c] to copy selected world objects.\n[ctrl-v] to paste copied world objects to mouse position.\n[del] or [backspace] delete selected objects.\n\n[shift + s] scale-xy selected objects with mouse or arrows.\n[shift + s + d] scale-x selected objects with mouse or arrows.\n[shift + s + f] scale-y selected objects with mouse or arrows.\n[shift + r] rotate selected objects with mouse or arrows.\n\n[shift + q] set selected objects as static (can't be undone).\n[shift + i] import objects.\n[shift + o] export selected objects.\n[shift + h] toggle Matter.Gui.\n[shift + y] toggle auto-hide.\n[shift + r] toggle auto-rewind on play/pause.\n\n[shift + j] show this help message.")},j=function(e){e.keyBind("shift+space",(function(){D(e,!e.isPaused)})),e.serializer&&(e.keyBind("shift+o",(function(){V(e)})),e.keyBind("shift+i",(function(){K(e)}))),e.keyBind("shift+j",(function(){y(e)})),e.keyBind("shift+y",(function(){e.autoHide=!e.autoHide,b.toggleClass("ins-auto-hide gui-auto-hide",e.autoHide)})),e.keyBind("shift+r",(function(){e.autoRewind=!e.autoRewind,e.autoRewind||localStorage.removeItem("pauseState")})),e.keyBind("shift+q",(function(){for(var t=0;t').jstree({core:{check_callback:!0,animation:!1},dnd:{copy:!1},search:{show_only_matches:!0,fuzzy:!1},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"]}),r.container.append(r.worldTree),e.hasExpanded=!1,r.worldTree.on("refresh.jstree",(function(){e.autoExpand&&!e.hasExpanded&&(e.hasExpanded=!0,r.worldTree.jstree("open_all"))})),r.worldTree.on("changed.jstree",(function(i,o){var s=[],a=r.worldTree.data("jstree");"select_node"===o.action&&(clearTimeout(t),t=setTimeout((function(){o.selected=a.get_selected();for(var t=0;t0&&(w(e,"ins-cursor-move"),N(e))}))),e.render&&(e.afterRender=function(){var t=e.render.controller,n=e.render.context;t.inspector&&t.inspector(e,n)},p.on(e.render,"afterRender",e.afterRender))},S=function(e){var t,n,r=[],i=e.controls.worldTree.data("jstree");for(n=0;n0&&console.clear(),r=0;r',(t=n.firstChild).addEventListener("change",(function(){var n=t.files[0];if(n.name.match(/\.(txt|json)$/)){var r=new FileReader;r.onload=function(){var t=e.serializer.parse(r.result);if(t){t.label="Imported Objects",h.rebase(t),h.add(e.root,t),e.root.composites.splice(e.root.composites.length-1,1),e.root.composites.unshift(t);var n=e.controls.worldTree.data("jstree"),i=M(e.root,null,!0);H(n,i)}},r.readAsText(n)}else alert("File not supported, .json or .txt JSON files only")})),t.click()}else alert("No serializer.")}},function(e,t,n){var r;/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,(function(n,i){"use strict";var o=[],s=Object.getPrototypeOf,a=o.slice,l=o.flat?function(e){return o.flat.call(e)}:function(e){return o.concat.apply([],e)},d=o.push,c=o.indexOf,h={},u=h.toString,p=h.hasOwnProperty,f=p.toString,g=f.call(Object),_={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},v=function(e){return null!=e&&e===e.window},b=n.document,x={type:!0,src:!0,nonce:!0,noModule:!0};function y(e,t,n){var r,i,o=(n=n||b).createElement("script");if(o.text=e,t)for(r in x)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function j(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?h[u.call(e)]||"object":typeof e}var k="3.5.1",w=function(e,t){return new w.fn.init(e,t)};function A(e){var t=!!e&&"length"in e&&e.length,n=j(e);return!m(e)&&!v(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+F+")"+F+"*"),K=new RegExp(F+"|>"),$=new RegExp(z),G=new RegExp("^"+H+"$"),W={ID:new RegExp("^#("+H+")"),CLASS:new RegExp("^\\.("+H+")"),TAG:new RegExp("^("+H+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},X=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+F+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){u()},se=xe((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{B.apply(O=P.call(y.childNodes),y.childNodes),O[y.childNodes.length].nodeType}catch(t){B={apply:O.length?function(e,t){L.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ae(e,t,r,i){var o,a,d,c,h,f,m,v=t&&t.ownerDocument,y=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==y&&9!==y&&11!==y)return r;if(!i&&(u(t),t=t||p,g)){if(11!==y&&(h=Z.exec(e)))if(o=h[1]){if(9===y){if(!(d=t.getElementById(o)))return r;if(d.id===o)return r.push(d),r}else if(v&&(d=v.getElementById(o))&&b(t,d)&&d.id===o)return r.push(d),r}else{if(h[2])return B.apply(r,t.getElementsByTagName(e)),r;if((o=h[3])&&n.getElementsByClassName&&t.getElementsByClassName)return B.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!E[e+" "]&&(!_||!_.test(e))&&(1!==y||"object"!==t.nodeName.toLowerCase())){if(m=e,v=t,1===y&&(K.test(e)||V.test(e))){for((v=ee.test(e)&&me(t.parentNode)||t)===t&&n.scope||((c=t.getAttribute("id"))?c=c.replace(re,ie):t.setAttribute("id",c=x)),a=(f=s(e)).length;a--;)f[a]=(c?"#"+c:":scope")+" "+be(f[a]);m=f.join(",")}try{return B.apply(r,v.querySelectorAll(m)),r}catch(t){E(e,!0)}finally{c===x&&t.removeAttribute("id")}}}return l(e.replace(q,"$1"),t,r,i)}function le(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function de(e){return e[x]=!0,e}function ce(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function he(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function ue(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ge(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&se(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function _e(e){return de((function(t){return t=+t,de((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},o=ae.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!X.test(t||n&&n.nodeName||"HTML")},u=ae.setDocument=function(e){var t,i,s=e?e.ownerDocument||e:y;return s!=p&&9===s.nodeType&&s.documentElement&&(f=(p=s).documentElement,g=!o(p),y!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=ce((function(e){return f.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ce((function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(p.getElementsByClassName),n.getById=ce((function(e){return f.appendChild(e).id=x,!p.getElementsByName||!p.getElementsByName(x).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},m=[],_=[],(n.qsa=Q.test(p.querySelectorAll))&&(ce((function(e){var t;f.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&_.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||_.push("\\["+F+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+x+"-]").length||_.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||_.push("\\["+F+"*name"+F+"*="+F+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||_.push(":checked"),e.querySelectorAll("a#"+x+"+*").length||_.push(".#.+[+~]"),e.querySelectorAll("\\\f"),_.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&_.push("name"+F+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&_.push(":enabled",":disabled"),f.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&_.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),_.push(",.*:")}))),(n.matchesSelector=Q.test(v=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ce((function(e){n.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),m.push("!=",z)})),_=_.length&&new RegExp(_.join("|")),m=m.length&&new RegExp(m.join("|")),t=Q.test(f.compareDocumentPosition),b=t||Q.test(f.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},S=t?function(e,t){if(e===t)return h=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==p||e.ownerDocument==y&&b(y,e)?-1:t==p||t.ownerDocument==y&&b(y,t)?1:c?D(c,e)-D(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return h=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e==p?-1:t==p?1:i?-1:o?1:c?D(c,e)-D(c,t):0;if(i===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?ue(s[r],a[r]):s[r]==y?-1:a[r]==y?1:0}),p},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if(u(e),n.matchesSelector&&g&&!E[t+" "]&&(!m||!m.test(t))&&(!_||!_.test(t)))try{var r=v.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){E(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=s(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=w[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&w(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=ae.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function L(e,t,n){return m(t)?w.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?w.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?w.grep(e,(function(e){return-1)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||B,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:P.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:b,!0)),N.test(r[1])&&w.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=b.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,B=w(b);var D=/^(?:parents|prev(?:Until|All))/,R={children:!0,contents:!0,next:!0,prev:!0};function F(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter((function(){for(var e=0;e\x20\t\r\n\f]*)/i,me=/^$|^module$|\/(?:java|ecma)script/i;pe=b.createDocumentFragment().appendChild(b.createElement("div")),(fe=b.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),pe.appendChild(fe),_.checkClone=pe.cloneNode(!0).cloneNode(!0).lastChild.checked,pe.innerHTML="",_.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue,pe.innerHTML="",_.option=!!pe.lastChild;var ve={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function be(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&O(e,t)?w.merge([e],n):n}function xe(e,t){for(var n=0,r=e.length;n",""]);var ye=/<|&#?\w+;/;function je(e,t,n,r,i){for(var o,s,a,l,d,c,h=t.createDocumentFragment(),u=[],p=0,f=e.length;p\s*$/g;function Pe(e,t){return O(e,"table")&&O(11!==t.nodeType?t:t.firstChild,"tr")&&w(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,s,a;if(1===t.nodeType){if(Q.hasData(e)&&(a=Q.get(e).events))for(i in Q.remove(t,"handle events"),a)for(n=0,r=a[i].length;n").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),b.head.appendChild(t[0])},abort:function(){n&&n()}}}));var Wt,Xt=[],Jt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||w.expando+"_"+Ct.guid++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",(function(e,t,r){var i,o,s,a=!1!==e.jsonp&&(Jt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Jt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Jt,"$1"+i):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return s||w.error(i+" was not called"),s[0]},e.dataTypes[0]="json",o=n[i],n[i]=function(){s=arguments},r.always((function(){void 0===o?w(n).removeProp(i):n[i]=o,e[i]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(i)),s&&m(o)&&o(s[0]),s=o=void 0})),"script"})),_.createHTMLDocument=((Wt=b.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Wt.childNodes.length),w.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(_.createHTMLDocument?((r=(t=b.implementation.createHTMLDocument("")).createElement("base")).href=b.location.href,t.head.appendChild(r)):t=b),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=je([e],t,o),o&&o.length&&w(o).remove(),w.merge([],i.childNodes)));var r,i,o},w.fn.load=function(e,t,n){var r,i,o,s=this,a=e.indexOf(" ");return-1").append(w.parseHTML(e)).find(r):e)})).always(n&&function(e,t){s.each((function(){n.apply(this,o||[e.responseText,t,e])}))}),this},w.expr.pseudos.animated=function(e){return w.grep(w.timers,(function(t){return e===t.elem})).length},w.offset={setOffset:function(e,t,n){var r,i,o,s,a,l,d=w.css(e,"position"),c=w(e),h={};"static"===d&&(e.style.position="relative"),a=c.offset(),o=w.css(e,"top"),l=w.css(e,"left"),("absolute"===d||"fixed"===d)&&-1<(o+l).indexOf("auto")?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(l)||0),m(t)&&(t=t.call(e,n,w.extend({},a))),null!=t.top&&(h.top=t.top-a.top+s),null!=t.left&&(h.left=t.left-a.left+i),"using"in t?t.using.call(e,h):("number"==typeof h.top&&(h.top+="px"),"number"==typeof h.left&&(h.left+="px"),c.css(h))}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){w.offset.setOffset(this,e,t)}));var t,n,r=this[0];return r?r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===w.css(e,"position");)e=e.offsetParent;return e||se}))}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return K(this,(function(e,r,i){var o;if(v(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i}),e,r,arguments.length)}})),w.each(["top","left"],(function(e,t){w.cssHooks[t]=Ke(_.pixelPosition,(function(e,n){if(n)return n=Ve(e,t),ze.test(n)?w(e).position()[t]+"px":n}))})),w.each({Height:"height",Width:"width"},(function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,r){w.fn[r]=function(i,o){var s=arguments.length&&(n||"boolean"!=typeof i),a=n||(!0===i||!0===o?"margin":"border");return K(this,(function(t,n,i){var o;return v(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,a):w.style(t,n,i,a)}),t,s?i:void 0,s)}}))})),w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){w.fn[t]=function(e){return this.on(t,e)}})),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){w.fn[t]=function(e,n){return 0-1?t.length-t.indexOf(".")-1:0}function s(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}function a(e,t,n,r,i){return r+(e-t)/(n-t)*(i-r)}function l(e,t,n,r){e.style.background="",E.each(ee,(function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+r+" 100%); "}))}function d(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}function c(e,t,n){var r=document.createElement("li");return t&&r.appendChild(t),n?e.__ul.insertBefore(r,n):e.__ul.appendChild(r),e.onResize(),r}function h(e){K.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&K.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function u(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function p(e,t,n){if(n.__li=t,n.__gui=e,E.extend(n,{options:function(t){if(arguments.length>1){var r=n.__li.nextElementSibling;return n.remove(),g(e,n.object,n.property,{before:r,factoryArgs:[E.toArray(arguments)]})}if(E.isArray(t)||E.isObject(t)){var i=n.__li.nextElementSibling;return n.remove(),g(e,n.object,n.property,{before:i,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof Y){var r=new J(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});E.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],i=r[e];n[e]=r[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(r,e),t.apply(n,e)}})),K.addClass(t,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof J){var i=function(t){if(E.isNumber(n.__min)&&E.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,i=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=g(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(r),i&&o.listen(),o}return t};n.min=E.compose(i,n.min),n.max=E.compose(i,n.max)}else n instanceof $?(K.bind(t,"click",(function(){K.fakeEvent(n.__checkbox,"click")})),K.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof Q?(K.bind(t,"click",(function(){K.fakeEvent(n.__button,"click")})),K.bind(t,"mouseover",(function(){K.addClass(n.__button,"hover")})),K.bind(t,"mouseout",(function(){K.removeClass(n.__button,"hover")}))):n instanceof Z&&(K.addClass(t,"color"),n.updateDisplay=E.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=E.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&u(e.getRoot(),!0),t}),n.setValue)}function f(e,t){var n=e.getRoot(),r=n.__rememberedObjects.indexOf(t.object);if(-1!==r){var i=n.__rememberedObjectIndecesToControllers[r];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[r]=i),i[t.property]=t,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[e.preset])s=o[e.preset];else{if(!o[se])return;s=o[se]}if(s[r]&&void 0!==s[r][t.property]){var a=s[r][t.property];t.initialValue=a,t.setValue(a)}}}}function g(e,t,n,r){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(r.color)i=new Z(t,n);else{var o=[t,n].concat(r.factoryArgs);i=ne.apply(e,o)}r.before instanceof I&&(r.before=r.before.__li),f(e,i),K.addClass(i.domElement,"c");var s=document.createElement("span");K.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=c(e,a,r.before);return K.addClass(l,pe.CLASS_CONTROLLER_ROW),i instanceof Z?K.addClass(l,"color"):K.addClass(l,P(i.getValue())),p(e,l,i),e.__controllers.push(i),i}function _(e,t){return document.location.href+"."+t}function m(e,t,n){var r=document.createElement("option");r.innerHTML=t,r.value=t,e.__preset_select.appendChild(r),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function v(e,t){t.style.display=e.useLocalStorage?"block":"none"}function b(e){var t=e.__save_row=document.createElement("li");K.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),K.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",K.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",K.addClass(r,"button"),K.addClass(r,"save");var i=document.createElement("span");i.innerHTML="New",K.addClass(i,"button"),K.addClass(i,"save-as");var o=document.createElement("span");o.innerHTML="Revert",K.addClass(o,"button"),K.addClass(o,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?E.each(e.load.remembered,(function(t,n){m(e,n,n===e.preset)})):m(e,se,!1),K.bind(s,"change",(function(){for(var t=0;t=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(A&&e.forEach&&e.forEach===A)e.forEach(t,n);else if(e.length===e.length+0){var r=void 0,i=void 0;for(r=0,i=e.length;r1?E.toArray(arguments):arguments[0];return E.each(S,(function(t){if(t.litmus(e))return E.each(t.conversions,(function(t,n){if(T=t.read(e),!1===O&&!1!==T)return O=T,T.conversionName=n,T.conversion=t,E.BREAK})),E.BREAK})),O},L=void 0,B={hsv_to_rgb:function(e,t,n){var r=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),o=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][r];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var r=Math.min(e,t,n),i=Math.max(e,t,n),o=i-r,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/o:t===i?2+(n-e)/o:4+(e-t)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/i,v:i/255})},rgb_to_hex:function(e,t,n){var r=this.hex_with_component(0,2,e);return r=this.hex_with_component(r,1,t),this.hex_with_component(r,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(L=8*t)|e&~(255<this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=o(e),this}}]),t}(),J=function(e){function t(e,n,r){function i(){l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}function o(e){var t=d-e.clientY;l.setValue(l.getValue()+t*l.__impliedStep),d=e.clientY}function s(){K.unbind(window,"mousemove",o),K.unbind(window,"mouseup",s),i()}D(this,t);var a=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));a.__truncationSuspended=!1;var l=a,d=void 0;return a.__input=document.createElement("input"),a.__input.setAttribute("type","text"),K.bind(a.__input,"change",(function(){var e=parseFloat(l.__input.value);E.isNaN(e)||l.setValue(e)})),K.bind(a.__input,"blur",(function(){i()})),K.bind(a.__input,"mousedown",(function(e){K.bind(window,"mousemove",o),K.bind(window,"mouseup",s),d=e.clientY})),K.bind(a.__input,"keydown",(function(e){13===e.keyCode&&(l.__truncationSuspended=!0,this.blur(),l.__truncationSuspended=!1,i())})),a.updateDisplay(),a.domElement.appendChild(a.__input),a}return H(t,X),R(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():s(this.getValue(),this.__precision),F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),Y=function(e){function t(e,n,r,i,o){function s(e){e.preventDefault();var t=u.__background.getBoundingClientRect();return u.setValue(a(e.clientX,t.left,t.right,u.__min,u.__max)),!1}function l(){K.unbind(window,"mousemove",s),K.unbind(window,"mouseup",l),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}function d(e){var t=e.touches[0].clientX,n=u.__background.getBoundingClientRect();u.setValue(a(t,n.left,n.right,u.__min,u.__max))}function c(){K.unbind(window,"touchmove",d),K.unbind(window,"touchend",c),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}D(this,t);var h=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:r,max:i,step:o})),u=h;return h.__background=document.createElement("div"),h.__foreground=document.createElement("div"),K.bind(h.__background,"mousedown",(function(e){document.activeElement.blur(),K.bind(window,"mousemove",s),K.bind(window,"mouseup",l),s(e)})),K.bind(h.__background,"touchstart",(function(e){1===e.touches.length&&(K.bind(window,"touchmove",d),K.bind(window,"touchend",c),d(e))})),K.addClass(h.__background,"slider"),K.addClass(h.__foreground,"slider-fg"),h.updateDisplay(),h.__background.appendChild(h.__foreground),h.domElement.appendChild(h.__background),h}return H(t,X),R(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",F(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),Q=function(e){function t(e,n,r){D(this,t);var i=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===r?"Fire":r,K.bind(i.__button,"click",(function(e){return e.preventDefault(),o.fire(),!1})),K.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return H(t,I),R(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),Z=function(e){function t(e,n){function r(e){h(e),K.bind(window,"mousemove",h),K.bind(window,"touchmove",h),K.bind(window,"mouseup",o),K.bind(window,"touchend",o)}function i(e){u(e),K.bind(window,"mousemove",u),K.bind(window,"touchmove",u),K.bind(window,"mouseup",s),K.bind(window,"touchend",s)}function o(){K.unbind(window,"mousemove",h),K.unbind(window,"touchmove",h),K.unbind(window,"mouseup",o),K.unbind(window,"touchend",o),c()}function s(){K.unbind(window,"mousemove",u),K.unbind(window,"touchmove",u),K.unbind(window,"mouseup",s),K.unbind(window,"touchend",s),c()}function a(){var e=N(this.value);!1!==e?(f.__color.__state=e,f.setValue(f.__color.toOriginal())):this.value=f.__color.toString()}function c(){f.__onFinishChange&&f.__onFinishChange.call(f,f.__color.toOriginal())}function h(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=f.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,r=n.clientX,i=n.clientY,o=(r-t.left)/(t.right-t.left),s=1-(i-t.top)/(t.bottom-t.top);return s>1?s=1:s<0&&(s=0),o>1?o=1:o<0&&(o=0),f.__color.v=s,f.__color.s=o,f.setValue(f.__color.toOriginal()),!1}function u(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=f.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),f.__color.h=360*n,f.setValue(f.__color.toOriginal()),!1}D(this,t);var p=M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));p.__color=new z(p.getValue()),p.__temp=new z(0);var f=p;p.domElement=document.createElement("div"),K.makeSelectable(p.domElement,!1),p.__selector=document.createElement("div"),p.__selector.className="selector",p.__saturation_field=document.createElement("div"),p.__saturation_field.className="saturation-field",p.__field_knob=document.createElement("div"),p.__field_knob.className="field-knob",p.__field_knob_border="2px solid ",p.__hue_knob=document.createElement("div"),p.__hue_knob.className="hue-knob",p.__hue_field=document.createElement("div"),p.__hue_field.className="hue-field",p.__input=document.createElement("input"),p.__input.type="text",p.__input_textShadow="0 1px 1px ",K.bind(p.__input,"keydown",(function(e){13===e.keyCode&&a.call(this)})),K.bind(p.__input,"blur",a),K.bind(p.__selector,"mousedown",(function(){K.addClass(this,"drag").bind(window,"mouseup",(function(){K.removeClass(f.__selector,"drag")}))})),K.bind(p.__selector,"touchstart",(function(){K.addClass(this,"drag").bind(window,"touchend",(function(){K.removeClass(f.__selector,"drag")}))}));var g=document.createElement("div");return E.extend(p.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),E.extend(p.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:p.__field_knob_border+(p.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),E.extend(p.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),E.extend(p.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),E.extend(g.style,{width:"100%",height:"100%",background:"none"}),l(g,"top","rgba(0,0,0,0)","#000"),E.extend(p.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),d(p.__hue_field),E.extend(p.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:p.__input_textShadow+"rgba(0,0,0,0.7)"}),K.bind(p.__saturation_field,"mousedown",r),K.bind(p.__saturation_field,"touchstart",r),K.bind(p.__field_knob,"mousedown",r),K.bind(p.__field_knob,"touchstart",r),K.bind(p.__hue_field,"mousedown",i),K.bind(p.__hue_field,"touchstart",i),p.__saturation_field.appendChild(g),p.__selector.appendChild(p.__field_knob),p.__selector.appendChild(p.__saturation_field),p.__selector.appendChild(p.__hue_field),p.__hue_field.appendChild(p.__hue_knob),p.domElement.appendChild(p.__input),p.domElement.appendChild(p.__selector),p.updateDisplay(),p}return H(t,I),R(t,[{key:"updateDisplay",value:function(){var e=N(this.getValue());if(!1!==e){var t=!1;E.each(z.COMPONENTS,(function(n){if(!E.isUndefined(e[n])&&!E.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&E.extend(this.__color.__state,e)}E.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;E.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,l(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),E.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),t}(),ee=["-moz-","-o-","-webkit-","-ms-",""],te={load:function(e,t){var n=t||document,r=n.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,n.getElementsByTagName("head")[0].appendChild(r)},inject:function(e,t){var n=t||document,r=document.createElement("style");r.type="text/css",r.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(r)}catch(e){}}},ne=function(e,t){var n=e[t];return E.isArray(arguments[2])||E.isObject(arguments[2])?new G(e,t,arguments[2]):E.isNumber(n)?E.isNumber(arguments[2])&&E.isNumber(arguments[3])?E.isNumber(arguments[4])?new Y(e,t,arguments[2],arguments[3],arguments[4]):new Y(e,t,arguments[2],arguments[3]):E.isNumber(arguments[4])?new J(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new J(e,t,{min:arguments[2],max:arguments[3]}):E.isString(n)?new W(e,t):E.isFunction(n)?new Q(e,t,""):E.isBoolean(n)?new $(e,t):null},re=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},ie=function(){function e(){D(this,e),this.backgroundElement=document.createElement("div"),E.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),K.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),E.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;K.bind(this.backgroundElement,"click",(function(){t.hide()}))}return R(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),E.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",K.unbind(e.domElement,"webkitTransitionEnd",t),K.unbind(e.domElement,"transitionend",t),K.unbind(e.domElement,"oTransitionEnd",t)};K.bind(this.domElement,"webkitTransitionEnd",t),K.bind(this.domElement,"transitionend",t),K.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-K.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-K.getHeight(this.domElement)/2+"px"}}]),e}(),oe=function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");te.inject(oe);var se="Default",ae=function(){try{return!!window.localStorage}catch(e){return!1}}(),le=void 0,de=!0,ce=void 0,he=!1,ue=[],pe=function e(t){var n=this,r=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),K.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=E.defaults(r,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),r=E.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),E.isUndefined(r.load)?r.load={preset:se}:r.preset&&(r.load.preset=r.preset),E.isUndefined(r.parent)&&r.hideable&&ue.push(this),r.resizable=E.isUndefined(r.parent)&&r.resizable,r.autoPlace&&E.isUndefined(r.scrollable)&&(r.scrollable=!0);var i=ae&&"true"===localStorage.getItem(_(this,"isLocal")),o=void 0,s=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(e){n.parent?n.getRoot().preset=e:r.load.preset=e,k(this),n.revert()}},width:{get:function(){return r.width},set:function(e){r.width=e,y(n,e)}},name:{get:function(){return r.name},set:function(e){r.name=e,s&&(s.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(t){r.closed=t,r.closed?K.addClass(n.__ul,e.CLASS_CLOSED):K.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return i},set:function(e){ae&&(i=e,e?K.bind(window,"unload",o):K.unbind(window,"unload",o),localStorage.setItem(_(n,"isLocal"),e))}}}),E.isUndefined(r.parent)){if(this.closed=r.closed||!1,K.addClass(this.domElement,e.CLASS_MAIN),K.makeSelectable(this.domElement,!1),ae&&i){n.useLocalStorage=!0;var a=localStorage.getItem(_(this,"gui"));a&&(r.load=JSON.parse(a))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,K.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),r.closeOnTop?(K.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(K.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),K.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===r.closed&&(r.closed=!0);var l=document.createTextNode(r.name);K.addClass(l,"controller-name"),s=c(n,l),K.addClass(this.__ul,e.CLASS_CLOSED),K.addClass(s,"title"),K.bind(s,"click",(function(e){return e.preventDefault(),n.closed=!n.closed,!1})),r.closed||(this.closed=!1)}r.autoPlace&&(E.isUndefined(r.parent)&&(de&&(ce=document.createElement("div"),K.addClass(ce,"dg"),K.addClass(ce,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ce),de=!1),ce.appendChild(this.domElement),K.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||y(n,r.width)),this.__resizeHandler=function(){n.onResizeDebounced()},K.bind(window,"resize",this.__resizeHandler),K.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),K.bind(this.__ul,"transitionend",this.__resizeHandler),K.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&x(this),o=function(){ae&&"true"===localStorage.getItem(_(n,"isLocal"))&&localStorage.setItem(_(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=o,r.parent||function(){var e=n.getRoot();e.width+=1,E.defer((function(){e.width-=1}))}()};pe.toggleHide=function(){he=!he,E.each(ue,(function(e){e.domElement.style.display=he?"none":""}))},pe.CLASS_AUTO_PLACE="a",pe.CLASS_AUTO_PLACE_CONTAINER="ac",pe.CLASS_MAIN="main",pe.CLASS_CONTROLLER_ROW="cr",pe.CLASS_TOO_TALL="taller-than-window",pe.CLASS_CLOSED="closed",pe.CLASS_CLOSE_BUTTON="close-button",pe.CLASS_CLOSE_TOP="close-top",pe.CLASS_CLOSE_BOTTOM="close-bottom",pe.CLASS_DRAG="drag",pe.DEFAULT_WIDTH=245,pe.TEXT_CLOSED="Close Controls",pe.TEXT_OPEN="Open Controls",pe._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||pe.toggleHide()},K.bind(window,"keydown",pe._keydownHandler,!1),E.extend(pe.prototype,{add:function(e,t){return g(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return g(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;E.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&ce.removeChild(this.domElement);var e=this;E.each(this.__folders,(function(t){e.removeFolder(t)})),K.unbind(window,"keydown",pe._keydownHandler,!1),h(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new pe(t);this.__folders[e]=n;var r=c(this,n.domElement);return K.addClass(r,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],h(e);var t=this;E.each(e.__folders,(function(t){e.removeFolder(t)})),E.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=K.getOffset(e.__ul).top,n=0;E.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=K.getHeight(t))})),window.innerHeight-t-20GUI\'s constructor:\n\n \n\n
    \n\n Automatically save\n values to localStorage on exit.\n\n
    The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
    \n\n
    \n\n
    '),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;E.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&b(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)})),this.autoPlace&&y(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=j(this)),e.folders={},E.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=j(this),u(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[se]=j(this,!0)),this.load.remembered[e]=j(this),this.preset=e,m(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){E.each(this.__controllers,(function(t){this.getRoot().load.remembered?f(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),E.each(this.__folders,(function(e){e.revert(e)})),e||u(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&w(this.__listening)},updateDisplay:function(){E.each(this.__controllers,(function(e){e.updateDisplay()})),E.each(this.__folders,(function(e){e.updateDisplay()}))}});var fe={Color:z,math:B,interpret:N},ge={Controller:I,BooleanController:$,OptionController:G,StringController:W,NumberController:X,NumberControllerBox:J,NumberControllerSlider:Y,FunctionController:Q,ColorController:Z},_e={dom:K},me={GUI:pe},ve=pe,be={color:fe,controllers:ge,dom:_e,gui:me,GUI:ve};e.color=fe,e.controllers=ge,e.dom=_e,e.gui=me,e.GUI=ve,e.default=be,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t){ -/** - * # ResurrectJS - * @version 1.0.3 - * @license Public Domain - * - * ResurrectJS preserves object behavior (prototypes) and reference - * circularity with a special JSON encoding. Unlike regular JSON, - * Date, RegExp, DOM objects, and `undefined` are also properly - * preserved. - * - * ## Examples - * - * function Foo() {} - * Foo.prototype.greet = function() { return "hello"; }; - * - * // Behavior is preserved: - * var necromancer = new Resurrect(); - * var json = necromancer.stringify(new Foo()); - * var foo = necromancer.resurrect(json); - * foo.greet(); // => "hello" - * - * // References to the same object are preserved: - * json = necromancer.stringify([foo, foo]); - * var array = necromancer.resurrect(json); - * array[0] === array[1]; // => true - * array[1].greet(); // => "hello" - * - * // Dates are restored properly - * json = necromancer.stringify(new Date()); - * var date = necromancer.resurrect(json); - * Object.prototype.toString.call(date); // => "[object Date]" - * - * ## Options - * - * Options are provided to the constructor as an object with these - * properties: - * - * prefix ('#'): A prefix string used for temporary properties added - * to objects during serialization and deserialization. It is - * important that you don't use any properties beginning with this - * string. This option must be consistent between both - * serialization and deserialization. - * - * cleanup (false): Perform full property cleanup after both - * serialization and deserialization using the `delete` - * operator. This may cause performance penalties (breaking hidden - * classes in V8) on objects that ResurrectJS touches, so enable - * with care. - * - * revive (true): Restore behavior (__proto__) to objects that have - * been resurrected. If this is set to false during serialization, - * resurrection information will not be encoded. You still get - * circularity and Date support. - * - * resolver (Resurrect.NamespaceResolver(window)): Converts between - * a name and a prototype. Create a custom resolver if your - * constructors are not stored in global variables. The resolver - * has two methods: getName(object) and getPrototype(string). - * - * For example, - * - * var necromancer = new Resurrect({ - * prefix: '__#', - * cleanup: true - * }); - * - * ## Caveats - * - * * With the default resolver, all constructors must be named and - * stored in the global variable under that name. This is required - * so that the prototypes can be looked up and reconnected at - * resurrection time. - * - * * The wrapper objects Boolean, String, and Number will be - * unwrapped. This means extra properties added to these objects - * will not be preserved. - * - * * Functions cannot ever be serialized. Resurrect will throw an - * error if a function is found when traversing a data structure. - * - * @see http://nullprogram.com/blog/2013/03/28/ - */ -function n(e){for(var t in this.table=null,this.prefix="#",this.cleanup=!1,this.revive=!0,e)e.hasOwnProperty(t)&&(this[t]=e[t]);this.refcode=this.prefix+"id",this.origcode=this.prefix+"original",this.buildcode=this.prefix+".",this.valuecode=this.prefix+"v"}e.exports=n,n.GLOBAL=(0,eval)("this"),n.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},n.prototype.Error=function(e){this.message=e||"",this.stack=(new Error).stack},n.prototype.Error.prototype=Object.create(Error.prototype),n.prototype.Error.prototype.name="ResurrectError",n.NamespaceResolver=function(e){this.scope=e},n.NamespaceResolver.prototype.getPrototype=function(e){var t=this.scope[e];if(t)return t.prototype;throw new n.prototype.Error("Unknown constructor: "+e)},n.NamespaceResolver.prototype.getName=function(e){var t=e.constructor.name;if(null==t&&(t=/^\s*function\s*([A-Za-z0-9_$]*)/.exec(e.constructor)[1]),""===t)throw new n.prototype.Error("Can't serialize objects with anonymous constructors.");return"Object"===t||"Array"===t?null:t},n.prototype.resolver=new n.NamespaceResolver(n.GLOBAL),n.Node=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},n.is=function(e){var t="[object "+e+"]";return function(e){return Object.prototype.toString.call(e)===t}},n.isArray=n.is("Array"),n.isString=n.is("String"),n.isBoolean=n.is("Boolean"),n.isNumber=n.is("Number"),n.isFunction=n.is("Function"),n.isDate=n.is("Date"),n.isRegExp=n.is("RegExp"),n.isObject=n.is("Object"),n.isAtom=function(e){return!n.isObject(e)&&!n.isArray(e)},n.isPrimitive=function(e){return null==e||n.isNumber(e)||n.isString(e)||n.isBoolean(e)},n.prototype.ref=function(e){var t={};return t[this.prefix]=void 0===e?-1:e[this.refcode],t},n.prototype.deref=function(e){return this.table[e[this.prefix]]},n.prototype.tag=function(e){if(this.revive){var t=this.resolver.getName(e);if(t){var n=Object.getPrototypeOf(e);if(this.resolver.getPrototype(t)!==n)throw new this.Error("Constructor mismatch!");e[this.prefix]=t}}return e[this.refcode]=this.table.length,this.table.push(e),e[this.refcode]},n.prototype.builder=function(e,t){var n={};return n[this.buildcode]=e,n[this.valuecode]=t,n},n.prototype.build=function(e){var t=e[this.buildcode].split(/\./).reduce((function(e,t){return e[t]}),n.GLOBAL),r=[null].concat(e[this.valuecode]),i=new(t.bind.apply(t,r));return n.isPrimitive(i)?i.valueOf():i},n.prototype.decode=function(e){if(this.prefix in e)return this.deref(e);if(this.buildcode in e)return this.build(e);throw new this.Error("Unknown encoding.")},n.prototype.isTagged=function(e){return this.refcode in e&&null!=e[this.refcode]},n.prototype.visit=function(e,t,r){if(n.isAtom(e))return t(e);if(this.isTagged(e))return this.ref(e);var i=null;if(n.isArray(e)){i=[],e[this.refcode]=this.tag(i);for(var o=0;o=0?t:void 0}}if(n.isAtom(e))return JSON.stringify(this.handleAtom(e),t,r);this.table=[],this.visit(e,this.handleAtom.bind(this),t);for(var o=0;o ul {\n height: 100%;\n background: #191921;\n overflow-y: auto;\n scrollbar-color: #0d0f1b #0d0f1b;\n scrollbar-width: thin;\n}\n\nbody .dg.main > ul:hover {\n scrollbar-color: #44444e #0d0f1b;\n scrollbar-width: thin;\n}\n\nbody .dg.main > ul::-webkit-scrollbar {\n background: #0d0f1b;\n width: 6px;\n height: 6px;\n}\n\nbody .dg.main > ul::-webkit-scrollbar-track,\nbody .dg.main > ul::-webkit-scrollbar-corner {\n background: #0d0f1b;\n}\n\nbody .dg.main > ul::-webkit-scrollbar-thumb {\n background: #0d0f1b;\n border-radius: 3px;\n}\n\nbody .dg.main > ul:hover::-webkit-scrollbar-thumb {\n background: #44444e;\n}\n\nbody .dg {\n color: #6d6d7d;\n text-shadow: none !important;\n font-size: 12px;\n}\n\nbody .dg .closed .cr {\n display: none;\n}\n\nbody .dg li:not(.folder) {\n height: 29px;\n background: #1c1c25;\n border-bottom: 0px;\n padding: 0 8px 0 12px;\n}\n\nbody .dg li.save-row .button {\n text-shadow: none !important;\n}\n\nbody .dg li.title {\n padding: 2px 0 0 24px;\n color: #6a6977;\n background: #0d0f1b\n url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==)\n no-repeat;\n background-position: 12px;\n}\n\nbody .dg li.title:hover {\n color: #9494a2;\n}\n\nbody .dg .cr.boolean:hover {\n background: #20212b;\n}\n\nbody .dg .cr.function {\n background: #262731;\n color: #636371;\n border-top: 1px solid #30313c;\n}\n\nbody .dg .cr.function:hover {\n background: #30313e;\n}\n\nbody .dg .cr.function:active {\n background: #2d2e3a;\n}\n\nbody .dg .cr.function:active .property-name {\n transform: translateY(1px);\n}\n\nbody .dg .c,\nbody .dg .property-name {\n width: 50%;\n}\n\nbody .dg .c select {\n margin-top: 2px;\n margin-left: -5px;\n padding: 3px 5px;\n}\n\nbody .dg .c select,\nbody .dg .c input[type="text"],\nbody .dg .cr.number input[type="text"] {\n text-align: right;\n background: transparent;\n color: #686c7b;\n border: 0;\n border-radius: 2px;\n overflow: hidden;\n font-size: 11px;\n}\n\nbody .dg .cr.number,\nbody .dg .cr.boolean,\nbody .dg .cr.function {\n border-left: 0;\n}\n\nbody .dg .c select,\nbody .dg .c select:focus {\n width: 88px;\n}\n\nbody .dg .c input[type="text"]:hover {\n background: #2b2c3a;\n}\n\nbody .dg .c input[type="text"]:focus {\n background: #2b2c3a;\n color: #fff;\n outline: none;\n}\n\nbody .dg .c input[type="checkbox"] {\n margin-top: 10px;\n border: none;\n border-radius: 50%;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background: #35363e;\n display: block;\n width: 7px;\n height: 7px;\n float: right;\n}\n\nbody .dg .c input[type="checkbox"]:checked {\n background: #747784;\n}\n\nbody .dg .c .slider {\n background: #23232d;\n border-radius: 2px;\n box-shadow: none;\n padding: 0;\n overflow: hidden;\n}\n\nbody .dg .c .slider:hover {\n background: #282b3a;\n}\n\nbody .dg .c .slider-fg {\n background: #3f4354;\n border-radius: 0;\n margin-left: 0;\n padding-right: 0;\n}\n\nbody .dg .c .slider-fg:after {\n display: none;\n}\n\nbody .dg .c .slider:hover .slider-fg {\n background: #4d526b;\n}\n\nbody .dg li.folder {\n border-left: 0;\n}\n\nbody .dg.a {\n margin-right: 0;\n}\n'},function(e,t,n){!function(t){var n,r={},i={16:!1,18:!1,17:!1,91:!1},o="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},a={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},l=function(e){return a[e]||e.toUpperCase().charCodeAt(0)},d=[];for(n=1;n<20;n++)a["f"+n]=111+n;function c(e,t){for(var n=e.length;n--;)if(e[n]===t)return n;return-1}function h(e,t){if(e.length!=t.length)return!1;for(var n=0;n1&&(o=m(e),e=[e[e.length-1]]),e=e[0],(e=l(e))in r||(r[e]=[]),r[e].push({shortcut:i[s],scope:t,method:n,key:i[s],mods:o})}for(n in s)f[n]=!1;function g(){return o||"all"}function _(e){var t;return""==(t=(e=e.replace(/\s/g,"")).split(","))[t.length-1]&&(t[t.length-2]+=","),t}function m(e){for(var t=e.slice(0,e.length-1),n=0;n0,i)(!i[o]&&c(n.mods,+o)>-1||i[o]&&-1==c(n.mods,+o))&&(l=!1);(0!=n.mods.length||i[16]||i[18]||i[17]||i[91])&&!l||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}(e)})),v(document,"keyup",(function(e){var t,n=e.keyCode,r=c(d,n);if(r>=0&&d.splice(r,1),93!=n&&224!=n||(n=91),n in i)for(t in i[n]=!1,s)s[t]==n&&(f[t]=!1)})),v(window,"focus",(function(){for(n in i)i[n]=!1;for(n in s)f[n]=!1}));var b=t.key;t.key=f,t.key.setScope=function(e){o=e||"all"},t.key.getScope=g,t.key.deleteScope=function(e){var t,n,i;for(t in r)for(n=r[t],i=0;i1&&(d=m(i),e=i[i.length-1]),e=l(e),void 0===t&&(t=g()),!r[e])return;for(o=0;o@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,r){var i=new e.jstree.core(++n),o=r;return r=e.extend(!0,{},e.jstree.defaults,r),o&&o.plugins&&(r.plugins=o.plugins),e.each(r.plugins,(function(e,t){"core"!==e&&(i=i.plugin(t,r[t]))})),e(t).data("jstree",i),i.init(t,r),i},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(l).off(".jstree")},e.jstree.core=function(e){this._id=e,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}}},e.jstree.reference=function(t){var n=null,r=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!r||!r.length)try{r=e(t)}catch(e){}if(!r||!r.length)try{r=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return r&&r.length&&(r=r.closest(".jstree")).length&&(r=r.data("jstree"))?n=r:e(".jstree").each((function(){var r=e(this).data("jstree");return r&&r._model.data[t]?(n=r,!1):void 0})),n},e.fn.jstree=function(n){var r="string"==typeof n,i=Array.prototype.slice.call(arguments,1),o=null;return!(!0===n&&!this.length)&&(this.each((function(){var s=e.jstree.reference(this),a=r&&s?s[n]:null;return o=r&&a?a.apply(s,i):null,s||r||n!==t&&!e.isPlainObject(n)||e.jstree.create(this,n),(s&&!r||!0===n)&&(o=s||!1),(null===o||o===t)&&void 0})),null!==o&&o!==t?o:this)},e.expr.pseudos.jstree=e.expr.createPseudo((function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}})),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.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(t){t.type="click",e(t.currentTarget).trigger(t)},enter:function(t){t.type="click",e(t.currentTarget).trigger(t)},left:function(t){if(t.preventDefault(),this.is_open(t.currentTarget))this.close_node(t.currentTarget);else{var n=this.get_parent(t.currentTarget);n&&n.id!==e.jstree.root&&this.get_node(n,!0).children(".jstree-anchor").focus()}},up:function(e){e.preventDefault();var t=this.get_prev_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},right:function(t){if(t.preventDefault(),this.is_closed(t.currentTarget))this.open_node(t.currentTarget,(function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}));else if(this.is_open(t.currentTarget)){var n=this.get_node(t.currentTarget,!0).children(".jstree-children")[0];n&&e(this._firstChild(n)).children(".jstree-anchor").focus()}},down:function(e){e.preventDefault();var t=this.get_next_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},"*":function(e){this.open_all()},home:function(t){t.preventDefault();var n=this._firstChild(this.get_container_ul()[0]);n&&e(n).children(".jstree-anchor").filter(":visible").focus()},end:function(e){e.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(e){e.preventDefault(),this.edit(e.currentTarget)}}},e.jstree.core.prototype={plugin:function(t,n){var r=e.jstree.plugins[t];return r?(this._data[t]={},r.prototype=this,new r(n,this)):this},init:function(t,n){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,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(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(e.jstree.root)},destroy:function(e){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,n=l.createElement("LI");return n.setAttribute("role","none"),(e=l.createElement("I")).className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),n.appendChild(e),(e=l.createElement("A")).className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),e.setAttribute("role","treeitem"),(t=l.createElement("I")).className="jstree-icon jstree-themeicon",t.setAttribute("role","presentation"),e.appendChild(t),n.appendChild(e),e=t=null,n},_kbevent_to_func:function(e){var t={8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},n=[];if(e.ctrlKey&&n.push("ctrl"),e.altKey&&n.push("alt"),e.shiftKey&&n.push("shift"),n.push(t[e.which]||e.which),"shift-shift"===(n=n.sort().join("-").toLowerCase())||"ctrl-ctrl"===n||"alt-alt"===n)return null;var r,i,o=this.settings.core.keyboard;for(r in o)if(o.hasOwnProperty(r)&&("-"!==(i=r)&&"+"!==i&&(i=(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),i===n))return o[r];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",(function(){return this.className.replace(/jstree[^ ]*|$/gi,"")})),this.element=null},bind:function(){var t="",n=null,r=0;this.element.on("dblclick.jstree",(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(l.selection&&l.selection.empty)l.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}})).on("mousedown.jstree",e.proxy((function(e){e.target===this.element[0]&&(e.preventDefault(),r=+new Date)}),this)).on("mousedown.jstree",".jstree-ocl",(function(e){e.preventDefault()})).on("click.jstree",".jstree-ocl",e.proxy((function(e){this.toggle_node(e.target)}),this)).on("dblclick.jstree",".jstree-anchor",e.proxy((function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(t){t.preventDefault(),t.currentTarget!==l.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)}),this)).on("keydown.jstree",".jstree-anchor",e.proxy((function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===e.which?e.which=39:39===e.which&&(e.which=37));var t=this._kbevent_to_func(e);if(t){var n=t.call(this,e);if(!1===n||!0===n)return n}}),this)).on("load_node.jstree",e.proxy((function(t,n){n.status&&(n.node.id!==e.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(e.proxy((function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var t,n,r=[];for(t=0,n=this._data.core.selected.length;n>t;t++)r=r.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,n=(r=e.vakata.array_unique(r)).length;n>t;t++)this.open_node(r[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}}),this),0))}),this)).on("keypress.jstree",e.proxy((function(r){if(r.target.tagName&&"input"===r.target.tagName.toLowerCase())return!0;n&&clearTimeout(n),n=setTimeout((function(){t=""}),500);var i=String.fromCharCode(r.which).toLowerCase(),o=this.element.find(".jstree-anchor").filter(":visible"),s=o.index(l.activeElement)||0,a=!1;if((t+=i).length>1){if(o.slice(s).each(e.proxy((function(n,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),a=!0,!1):void 0}),this)),a)return;if(o.slice(0,s).each(e.proxy((function(n,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),a=!0,!1):void 0}),this)),a)return}if(new RegExp("^"+i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(o.slice(s+1).each(e.proxy((function(t,n){return e(n).text().toLowerCase().charAt(0)===i?(e(n).focus(),a=!0,!1):void 0}),this)),a)return;if(o.slice(0,s+1).each(e.proxy((function(t,n){return e(n).text().toLowerCase().charAt(0)===i?(e(n).focus(),a=!0,!1):void 0}),this)),a)return}}),this)).on("init.jstree",e.proxy((function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)}),this)).on("loading.jstree",e.proxy((function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()}),this)).on("blur.jstree",".jstree-anchor",e.proxy((function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")}),this)).on("focus.jstree",".jstree-anchor",e.proxy((function(t){var n=this.get_node(t.currentTarget);n&&n.id&&(this._data.core.focused=n.id),this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave"),e(t.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")}),this)).on("focus.jstree",e.proxy((function(){if(+new Date-r>500&&!this._data.core.focused&&this.settings.core.restore_focus){r=0;var e=this.get_node(this.element.attr("aria-activedescendant"),!0);e&&e.find("> .jstree-anchor").focus()}}),this)).on("mouseenter.jstree",".jstree-anchor",e.proxy((function(e){this.hover_node(e.currentTarget)}),this)).on("mouseleave.jstree",".jstree-anchor",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},unbind:function(){this.element.off(".jstree"),e(l).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(t,n){var r;t&&t.id&&(t=t.id),t instanceof e&&t.length&&t[0].id&&(t=t[0].id);try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(r=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=this.element.find(t)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=this.element.find(t)).length||!r.hasClass("jstree"))return!1;t=this._model.data[e.jstree.root]}return n&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(e){return!1}},get_path:function(t,n,r){if(!(t=t.parents?t:this.get_node(t))||t.id===e.jstree.root||!t.parents)return!1;var i,o,s=[];for(s.push(r?t.id:t.text),i=0,o=t.parents.length;o>i;i++)s.push(r?t.parents[i]:this.get_text(t.parents[i]));return s=s.reverse().slice(1),n?s.join(n):s},get_next_dom:function(t,n){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(n){r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}if(t.hasClass("jstree-open")){for(r=this._firstChild(t.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return e(r)}r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return null!==r?e(r):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,n){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(n){r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);if(null!==r){for(t=e(r);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return!(!(r=t[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&e(r)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||e.children.length>0)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var r,i,o,s,a;if(e.isArray(t))return this._load_nodes(t.slice(),n),!0;if(!(t=this.get_node(t)))return n&&n.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,o=0,s=t.parents.length;s>o;o++)this._model.data[t.parents[o]].children_d=e.vakata.array_filter(this._model.data[t.parents[o]].children_d,(function(n){return-1===e.inArray(n,t.children_d)}));for(r=0,i=t.children_d.length;i>r;r++)this._model.data[t.children_d[r]].state.selected&&(a=!0),delete this._model.data[t.children_d[r]];a&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(n){return-1===e.inArray(n,t.children_d)}))),t.children=[],t.children_d=[],a&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy((function(e){(t=this._model.data[t.id]).state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var r=this.get_node(t,!0),i=0,o=0,s=this._model.data,a=!1;for(i=0,o=t.children.length;o>i;i++)if(s[t.children[i]]&&!s[t.children[i]].state.hidden){a=!0;break}t.state.loaded&&r&&r.length&&(r.removeClass("jstree-closed jstree-open jstree-leaf"),a?"#"!==t.id&&r.addClass(t.state.opened?"jstree-open":"jstree-closed"):r.addClass("jstree-leaf")),r.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)}),this)),!0},_load_nodes:function(e,t,n,r){var i,o,s=!0,a=function(){this._load_nodes(e,t,!0)},l=this._model.data,d=[];for(i=0,o=e.length;o>i;i++)l[e[i]]&&(!l[e[i]].state.loaded&&!l[e[i]].state.failed||!n&&r)&&(this.is_loading(e[i])||this.load_node(e[i],a),s=!1);if(s){for(i=0,o=e.length;o>i;i++)l[e[i]]&&l[e[i]].state.loaded&&d.push(e[i]);t&&!t.done&&(t.call(this,d),t.done=!0)}},load_all:function(t,n){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,i,o=[],s=this._model.data,a=s[t.id].children_d;for(t.state&&!t.state.loaded&&o.push(t.id),r=0,i=a.length;i>r;r++)s[a[r]]&&s[a[r]].state&&!s[a[r]].state.loaded&&o.push(a[r]);o.length?this._load_nodes(o,(function(){this.load_all(t,n)})):(n&&n.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,n){var r,i=this.settings.core.data,o=function(){return 3!==this.nodeType&&8!==this.nodeType};return i?e.isFunction(i)?i.call(this,t,e.proxy((function(r){!1===r?n.call(this,!1):this["string"==typeof r?"_append_html_data":"_append_json_data"](t,"string"==typeof r?e(e.parseHTML(r)).filter(o):r,(function(e){n.call(this,e)}))}),this)):"object"==typeof i?i.url?(i=e.extend(!0,{},i),e.isFunction(i.url)&&(i.url=i.url.call(this,t)),e.isFunction(i.data)&&(i.data=i.data.call(this,t)),e.ajax(i).done(e.proxy((function(r,i,s){var a=s.getResponseHeader("Content-Type");return a&&-1!==a.indexOf("json")||"object"==typeof r?this._append_json_data(t,r,(function(e){n.call(this,e)})):a&&-1!==a.indexOf("html")||"string"==typeof r?this._append_html_data(t,e(e.parseHTML(r)).filter(o),(function(e){n.call(this,e)})):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:s})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1))}),this)).fail(e.proxy((function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},n.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)}),this))):(r=e.isArray(i)?e.extend(!0,[],i):e.isPlainObject(i)?e.extend(!0,{},i):i,t.id===e.jstree.root?this._append_json_data(t,r,(function(e){n.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1))):"string"==typeof i?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(i)).filter(o),(function(e){n.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),n.call(this,!1)):n.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),(function(e){n.call(this,e)})):n.call(this,!1)},_node_changed:function(t){(t=this.get_node(t))&&-1===e.inArray(t.id,this._model.changed)&&this._model.changed.push(t.id)},_append_html_data:function(t,n,r){(t=this.get_node(t)).children=[],t.children_d=[];var i,o,s,a=n.is("ul")?n.children():n,l=t.id,d=[],c=[],h=this._model.data,u=h[l],p=this._data.core.selected.length;for(a.each(e.proxy((function(t,n){(i=this._parse_model_from_html(e(n),l,u.parents.concat()))&&(d.push(i),c.push(i),h[i].children_d.length&&(c=c.concat(h[i].children_d)))}),this)),u.children=d,u.children_d=c,o=0,s=u.parents.length;s>o;o++)h[u.parents[o]].children_d=h[u.parents[o]].children_d.concat(c);this.trigger("model",{nodes:c,parent:l}),l!==e.jstree.root?(this._node_changed(l),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==p&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.call(this,!0)},_append_json_data:function(t,n,r,i){if(null!==this.element){(t=this.get_node(t)).children=[],t.children_d=[],n.d&&"string"==typeof(n=n.d)&&(n=JSON.parse(n)),e.isArray(n)||(n=[n]);var o=null,s={df:this._model.default_state,dat:n,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},a=this,l=function(e,t){e.data&&(e=e.data);var n,r,i,o,s=e.dat,l=e.par,d=[],c=[],h=[],u=e.df,p=e.t_id,f=e.t_cnt,g=e.m,_=g[l],m=e.sel,v=function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l=e.id.toString(),d={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:n,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in u)u.hasOwnProperty(i)&&(d.state[i]=u[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),(d.icon===t||null===d.icon||""===d.icon)&&(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(d.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(d.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(d.li_attr[i]=e.li_attr[i]);if(d.li_attr.id||(d.li_attr.id=l),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(d.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),g[d.id]=d,i=0,o=d.children.length;o>i;i++)s=v(g[d.children[i]],d.id,r),a=g[s],d.children_d.push(s),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d));return delete e.data,delete e.children,g[d.id].original=e,d.state.selected&&h.push(d.id),d.id},b=function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l,d=!1;do{d="j"+p+"_"+ ++f}while(g[d]);for(i in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},u)u.hasOwnProperty(i)&&(l.state[i]=u[i]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,o=e.children.length;o>i;i++)s=b(e.children[i],l.id,r),a=g[s],l.children.push(s),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,g[l.id]=l,l.state.selected&&h.push(l.id),l.id};if(s.length&&s[0].id!==t&&s[0].parent!==t){for(r=0,i=s.length;i>r;r++)s[r].children||(s[r].children=[]),s[r].state||(s[r].state={}),g[s[r].id.toString()]=s[r];for(r=0,i=s.length;i>r;r++)g[s[r].parent.toString()]?(g[s[r].parent.toString()].children.push(s[r].id.toString()),_.children_d.push(s[r].id.toString())):void 0!==a&&(a._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:s[r].id.toString(),parent:s[r].parent.toString()})},a.settings.core.error.call(a,a._data.core.last_error));for(r=0,i=_.children.length;i>r;r++)n=v(g[_.children[r]],l,_.parents.concat()),c.push(n),g[n].children_d.length&&(c=c.concat(g[n].children_d));for(r=0,i=_.parents.length;i>r;r++)g[_.parents[r]].children_d=g[_.parents[r]].children_d.concat(c);o={cnt:f,mod:g,sel:m,par:l,dpc:c,add:h}}else{for(r=0,i=s.length;i>r;r++)(n=b(s[r],l,_.parents.concat()))&&(d.push(n),c.push(n),g[n].children_d.length&&(c=c.concat(g[n].children_d)));for(_.children=d,_.children_d=c,r=0,i=_.parents.length;i>r;r++)g[_.parents[r]].children_d=g[_.parents[r]].children_d.concat(c);o={cnt:f,mod:g,sel:m,par:l,dpc:c,add:h}}return"undefined"!=typeof window&&void 0!==window.document?o:void postMessage(o)},c=function(t,n){if(null!==this.element){this._cnt=t.cnt;var i,o=this._model.data;for(i in o)o.hasOwnProperty(i)&&o[i].state&&o[i].state.loading&&t.mod[i]&&(t.mod[i].state.loading=!0);if(this._model.data=t.mod,n){var s,l=t.add,c=t.sel,h=this._data.core.selected.slice();if(o=this._model.data,c.length!==h.length||e.vakata.array_unique(c.concat(h)).length!==c.length){for(i=0,s=c.length;s>i;i++)-1===e.inArray(c[i],l)&&-1===e.inArray(c[i],h)&&(o[c[i]].state.selected=!1);for(i=0,s=h.length;s>i;i++)-1===e.inArray(h[i],c)&&(o[h[i]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!n&&d?d((function(){r.call(a,!0)})):r.call(a,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+l.toString()],{type:"text/javascript"}))),!this._data.core.working||i?(this._data.core.working=!0,(o=new window.Worker(this._wrk)).onmessage=e.proxy((function(e){c.call(this,e.data,!0);try{o.terminate(),o=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}),this),s.par?o.postMessage(s):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,n,r,!0])}catch(e){c.call(this,l(s),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else c.call(this,l(s),!1)}},_parse_model_from_html:function(n,r,i){i=i?[].concat(i):[],r&&i.unshift(r);var o,s,a,l,d,c=this._model.data,h={id:!1,text:!1,icon:!0,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in this._model.default_state)this._model.default_state.hasOwnProperty(a)&&(h.state[a]=this._model.default_state[a]);if(l=e.vakata.attributes(n,!0),e.each(l,(function(t,n){return!(n=e.vakata.trim(n)).length||(h.li_attr[t]=n,void("id"===t&&(h.id=n.toString())))})),(l=n.children("a").first()).length&&(l=e.vakata.attributes(l,!0),e.each(l,(function(t,n){(n=e.vakata.trim(n)).length&&(h.a_attr[t]=n)}))),(l=n.children("a").first().length?n.children("a").first().clone():n.clone()).children("ins, i, ul").remove(),l=l.html(),l=e("
    ").html(l),h.text=this.settings.core.force_text?l.text():l.html(),l=n.data(),h.data=l?e.extend(!0,{},l):null,h.state.opened=n.hasClass("jstree-open"),h.state.selected=n.children("a").hasClass("jstree-clicked"),h.state.disabled=n.children("a").hasClass("jstree-disabled"),h.data&&h.data.jstree)for(a in h.data.jstree)h.data.jstree.hasOwnProperty(a)&&(h.state[a]=h.data.jstree[a]);(l=n.children("a").children(".jstree-themeicon")).length&&(h.icon=!l.hasClass("jstree-themeicon-hidden")&&l.attr("rel")),h.state.icon!==t&&(h.icon=h.state.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),l=n.children("ul").children("li");do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);return h.id=h.li_attr.id?h.li_attr.id.toString():d,l.length?(l.each(e.proxy((function(t,n){o=this._parse_model_from_html(e(n),h.id,i),s=this._model.data[o],h.children.push(o),s.children_d.length&&(h.children_d=h.children_d.concat(s.children_d))}),this)),h.children_d=h.children_d.concat(h.children)):n.hasClass("jstree-closed")&&(h.state.loaded=!1),h.li_attr.class&&(h.li_attr.class=h.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),h.a_attr.class&&(h.a_attr.class=h.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),c[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_flat_json:function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l=e.id.toString(),d=this._model.data,c=this._model.default_state,h={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:n,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in c)c.hasOwnProperty(i)&&(h.state[i]=c[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(h.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(h.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(h.li_attr[i]=e.li_attr[i]);if(h.li_attr.id||(h.li_attr.id=l),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(h.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),d[h.id]=h,i=0,o=h.children.length;o>i;i++)a=d[s=this._parse_model_from_flat_json(d[h.children[i]],h.id,r)],h.children_d.push(s),a.children_d.length&&(h.children_d=h.children_d.concat(a.children_d));return delete e.data,delete e.children,d[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l,d=!1,c=this._model.data,h=this._model.default_state;do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);for(i in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},h)h.hasOwnProperty(i)&&(l.state[i]=h[i]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,o=e.children.length;o>i;i++)a=c[s=this._parse_model_from_json(e.children[i],l.id,r)],l.children.push(s),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children.concat(l.children_d)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,c[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var t,n,r,i=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),o=l.createElement("UL"),s=this._data.core.focused;for(n=0,r=i.length;r>n;n++)(t=this.redraw_node(i[n],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&o.appendChild(t);this._model.force_full_redraw&&(o.className=this.get_container_ul()[0].className,o.setAttribute("role","group"),this.element.empty().append(o)),null!==s&&this.settings.core.restore_focus&&((t=this.get_node(s,!0))&&t.length&&t.children(".jstree-anchor")[0]!==l.activeElement?t.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:i})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(t){var n=this.get_node(t),r=!1,i=!1,o=!1,s=l;if(!n)return!1;if(n.id===e.jstree.root)return this.redraw(!0);if(!(t=this.get_node(t,!0))||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],n.children.length&&n.state.loaded){for((o=s.createElement("UL")).setAttribute("role","group"),o.className="jstree-children",r=0,i=n.children.length;i>r;r++)o.appendChild(this.redraw_node(n.children[r],!0,!0));t.appendChild(o)}},redraw_node:function(t,n,r,i){var o=this.get_node(t),s=!1,a=!1,d=!1,c=!1,h=!1,u=!1,p="",f=l,g=this._model.data,_=!1,m=null,v=0,b=0,x=!1,y=!1;if(!o)return!1;if(o.id===e.jstree.root)return this.redraw(!0);if(n=n||0===o.children.length,t=l.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(o.id[0])?"\\3"+o.id[0]+" "+o.id.substr(1).replace(e.jstree.idregex,"\\$&"):o.id.replace(e.jstree.idregex,"\\$&"))):l.getElementById(o.id))t=e(t),r||((s=t.parent().parent()[0])===this.element[0]&&(s=null),a=t.index()),n||!o.children.length||t.children(".jstree-children").length||(n=!0),n||(d=t.children(".jstree-children")[0]),_=t.children(".jstree-anchor")[0]===l.activeElement,t.remove();else if(n=!0,!r){if(!(null===(s=o.parent!==e.jstree.root?e("#"+o.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||s&&g[o.parent].state.opened))return!1;a=e.inArray(o.id,null===s?g[e.jstree.root].children:g[o.parent].children)}for(c in t=this._data.core.node.cloneNode(!0),p="jstree-node ",o.li_attr)if(o.li_attr.hasOwnProperty(c)){if("id"===c)continue;"class"!==c?t.setAttribute(c,o.li_attr[c]):p+=o.li_attr[c]}for(o.a_attr.id||(o.a_attr.id=o.id+"_anchor"),t.childNodes[1].setAttribute("aria-selected",!!o.state.selected),t.childNodes[1].setAttribute("aria-level",o.parents.length),this.settings.core.compute_elements_positions&&(t.childNodes[1].setAttribute("aria-setsize",g[o.parent].children.length),t.childNodes[1].setAttribute("aria-posinset",g[o.parent].children.indexOf(o.id)+1)),o.state.disabled&&t.childNodes[1].setAttribute("aria-disabled",!0),c=0,h=o.children.length;h>c;c++)if(!g[o.children[c]].state.hidden){x=!0;break}if(null!==o.parent&&g[o.parent]&&!o.state.hidden&&(c=e.inArray(o.id,g[o.parent].children),y=o.id,-1!==c))for(c++,h=g[o.parent].children.length;h>c&&(g[g[o.parent].children[c]].state.hidden||(y=g[o.parent].children[c]),y===o.id);c++);for(h in o.state.hidden&&(p+=" jstree-hidden"),o.state.loading&&(p+=" jstree-loading"),o.state.loaded&&!x?p+=" jstree-leaf":(p+=o.state.opened&&o.state.loaded?" jstree-open":" jstree-closed",t.childNodes[1].setAttribute("aria-expanded",o.state.opened&&o.state.loaded)),y===o.id&&(p+=" jstree-last"),t.id=o.id,t.className=p,p=(o.state.selected?" jstree-clicked":"")+(o.state.disabled?" jstree-disabled":""),o.a_attr)if(o.a_attr.hasOwnProperty(h)){if("href"===h&&"#"===o.a_attr[h])continue;"class"!==h?t.childNodes[1].setAttribute(h,o.a_attr[h]):p+=" "+o.a_attr[h]}if(p.length&&(t.childNodes[1].className="jstree-anchor "+p),(o.icon&&!0!==o.icon||!1===o.icon)&&(!1===o.icon?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===o.icon.indexOf("/")&&-1===o.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+o.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+o.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(f.createTextNode(o.text)):t.childNodes[1].innerHTML+=o.text,n&&o.children.length&&(o.state.opened||i)&&o.state.loaded){for((u=f.createElement("UL")).setAttribute("role","group"),u.className="jstree-children",c=0,h=o.children.length;h>c;c++)u.appendChild(this.redraw_node(o.children[c],n,!0));t.appendChild(u)}if(d&&t.appendChild(d),!r){for(s||(s=this.element[0]),c=0,h=s.childNodes.length;h>c;c++)if(s.childNodes[c]&&s.childNodes[c].className&&-1!==s.childNodes[c].className.indexOf("jstree-children")){m=s.childNodes[c];break}m||((m=f.createElement("UL")).setAttribute("role","group"),m.className="jstree-children",s.appendChild(m)),a<(s=m).childNodes.length?s.insertBefore(t,s.childNodes[a]):s.appendChild(t),_&&(v=this.element[0].scrollTop,b=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=v,this.element[0].scrollLeft=b)}return o.state.opened&&!o.state.loaded&&(o.state.opened=!1,setTimeout(e.proxy((function(){this.open_node(o.id,!1,0)}),this),0)),t},open_node:function(n,r,i){var o,s,a,l;if(e.isArray(n)){for(o=0,s=(n=n.slice()).length;s>o;o++)this.open_node(n[o],r,i);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root)&&(i=i===t?this.settings.core.animation:i,this.is_closed(n)?this.is_loaded(n)?(a=this.get_node(n,!0),l=this,a.length&&(i&&a.children(".jstree-children").length&&a.children(".jstree-children").stop(!0,!0),n.children.length&&!this._firstChild(a.children(".jstree-children")[0])&&this.draw_children(n),i?(this.trigger("before_open",{node:n}),a.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").children(".jstree-anchor").attr("aria-expanded",!0).end().children(".jstree-children").stop(!0,!0).slideDown(i,(function(){this.style.display="",l.element&&l.trigger("after_open",{node:n})}))):(this.trigger("before_open",{node:n}),a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].childNodes[1].setAttribute("aria-expanded",!0))),n.state.opened=!0,r&&r.call(this,n,!0),a.length||this.trigger("before_open",{node:n}),this.trigger("open_node",{node:n}),i&&a.length||this.trigger("after_open",{node:n}),!0):this.is_loading(n)?setTimeout(e.proxy((function(){this.open_node(n,r,i)}),this),500):void this.load_node(n,(function(e,t){return t?this.open_node(e,r,i):!!r&&r.call(this,e,!1)})):(r&&r.call(this,n,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var n,r,i=t.parents;for(n=0,r=i.length;r>n;n+=1)n!==e.jstree.root&&this.open_node(i[n],!1,0);return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(n,r){var i,o,s,a;if(e.isArray(n)){for(i=0,o=(n=n.slice()).length;o>i;i++)this.close_node(n[i],r);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root)&&!this.is_closed(n)&&(r=r===t?this.settings.core.animation:r,s=this,a=this.get_node(n,!0),n.state.opened=!1,this.trigger("close_node",{node:n}),void(a.length?r?a.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").children(".jstree-anchor").attr("aria-expanded",!1).end().children(".jstree-children").stop(!0,!0).slideUp(r,(function(){this.style.display="",a.children(".jstree-children").remove(),s.element&&s.trigger("after_close",{node:n})})):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.children(".jstree-anchor").attr("aria-expanded",!1),a.children(".jstree-children").remove(),this.trigger("after_close",{node:n})):this.trigger("after_close",{node:n})))},toggle_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.toggle_node(t[n]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,n,r){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var i,o,s,a=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0);if(!a.length){for(i=0,o=t.children_d.length;o>i;i++)this.is_closed(this._model.data[t.children_d[i]])&&(this._model.data[t.children_d[i]].state.opened=!0);return this.trigger("open_all",{node:t})}r=r||a,s=this,(a=this.is_closed(t)?a.find(".jstree-closed").addBack():a.find(".jstree-closed")).each((function(){s.open_node(this,(function(e,t){t&&this.is_parent(e)&&this.open_all(e,n,r)}),n||0)})),0===r.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(r)})},close_all:function(t,n){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,i,o=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),s=this;for(o.length&&(o=this.is_open(t)?o.find(".jstree-open").addBack():o.find(".jstree-open"),e(o.get().reverse()).each((function(){s.close_node(this,n||0)}))),r=0,i=t.children_d.length;i>r;r++)this._model.data[t.children_d[r]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.enable_node(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:t}))},disable_node:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.disable_node(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:t}))},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.hide_node(t[r],!0);return n||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),n||this.redraw(),this.trigger("hide_node",{node:t})))},show_node:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.show_node(t[r],!0);return n||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),n||this.redraw(),this.trigger("show_node",{node:t})))},hide_all:function(t){var n,r=this._model.data,i=[];for(n in r)r.hasOwnProperty(n)&&n!==e.jstree.root&&!r[n].state.hidden&&(r[n].state.hidden=!0,i.push(n));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:i}),i},show_all:function(t){var n,r=this._model.data,i=[];for(n in r)r.hasOwnProperty(n)&&n!==e.jstree.root&&r[n].state.hidden&&(r[n].state.hidden=!1,i.push(n));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:i}),i},activate_node:function(e,n){if(this.is_disabled(e))return!1;if(n&&"object"==typeof n||(n={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(n.metaKey||n.ctrlKey||n.shiftKey)&&(!n.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(n.shiftKey){var r,i,o=this.get_node(e).id,s=this._data.core.last_clicked.id,a=this.get_node(this._data.core.last_clicked.parent).children,l=!1;for(r=0,i=a.length;i>r;r+=1)a[r]===o&&(l=!l),a[r]===s&&(l=!l),this.is_disabled(a[r])||!l&&a[r]!==o&&a[r]!==s?this.deselect_node(a[r],!0,n):this.is_hidden(a[r])||this.select_node(a[r],!0,!1,n);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:n})}else this.is_selected(e)?this.deselect_node(e,!1,n):this.select_node(e,!1,!1,n);else!this.settings.core.multiple&&(n.metaKey||n.ctrlKey||n.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,n):(this.deselect_all(!0),this.select_node(e,!1,!1,n),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:n})},hover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),n=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout((function(){n.attr("aria-activedescendant",e[0].id)}),0)},dehover_node:function(e){return!!((e=this.get_node(e,!0))&&e.length&&e.children(".jstree-hovered").length)&&(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)}))},select_node:function(t,n,r,i){var o,s,a;if(e.isArray(t)){for(s=0,a=(t=t.slice()).length;a>s;s++)this.select_node(t[s],n,r,i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(o=this.get_node(t,!0),void(t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),r||(o=this._open_to(t)),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked").attr("aria-selected",!0),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:i}),n||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:i}))))},deselect_node:function(t,n,r){var i,o,s;if(e.isArray(t)){for(i=0,o=(t=t.slice()).length;o>i;i++)this.deselect_node(t[i],n,r);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:r}),n||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:r}))))},select_all:function(t){var n,r,i=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),n=0,r=this._data.core.selected.length;r>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:i})},deselect_all:function(e){var t,n,r=this._data.core.selected.concat([]);for(t=0,n=this._data.core.selected.length;n>t;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:r}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:r})},is_selected:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.selected},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.core.selected.slice()},get_top_selected:function(t){var n,r,i,o,s=this.get_selected(!0),a={};for(n=0,r=s.length;r>n;n++)a[s[n].id]=s[n];for(n=0,r=s.length;r>n;n++)for(i=0,o=s[n].children_d.length;o>i;i++)a[s[n].children_d[i]]&&delete a[s[n].children_d[i]];for(n in s=[],a)a.hasOwnProperty(n)&&s.push(n);return t?e.map(s,e.proxy((function(e){return this.get_node(e)}),this)):s},get_bottom_selected:function(t){var n,r,i=this.get_selected(!0),o=[];for(n=0,r=i.length;r>n;n++)i[n].children.length||o.push(i[n].id);return t?e.map(o,e.proxy((function(e){return this.get_node(e)}),this)):o},get_state:function(){var t,n={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==e.jstree.root&&(this._model.data[t].state.loaded&&this.settings.core.loaded_state&&n.core.loaded.push(t),this._model.data[t].state.opened&&n.core.open.push(t),this._model.data[t].state.selected&&n.core.selected.push(t));return n},set_state:function(n,r){if(n){if(n.core&&n.core.selected&&n.core.initial_selection===t&&(n.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),n.core){var i,o;if(n.core.loaded)return this.settings.core.loaded_state&&e.isArray(n.core.loaded)&&n.core.loaded.length?this._load_nodes(n.core.loaded,(function(e){delete n.core.loaded,this.set_state(n,r)})):(delete n.core.loaded,this.set_state(n,r)),!1;if(n.core.open)return e.isArray(n.core.open)&&n.core.open.length?this._load_nodes(n.core.open,(function(e){this.open_node(e,!1,0),delete n.core.open,this.set_state(n,r)})):(delete n.core.open,this.set_state(n,r)),!1;if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,r),!1;if(n.core.selected)return i=this,(n.core.initial_selection===t||n.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),e.each(n.core.selected,(function(e,t){i.select_node(t,!1,!0)}))),delete n.core.initial_selection,delete n.core.selected,this.set_state(n,r),!1;for(o in n)n.hasOwnProperty(o)&&"core"!==o&&-1===e.inArray(o,this.settings.plugins)&&delete n[o];if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,r),!1}return!e.isEmptyObject(n)||(n=null,r&&r.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(t,n){this._data.core.state=!0===n?{}:this.get_state(),n&&e.isFunction(n)&&(this._data.core.state=n.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var r=this.get_container_ul()[0].className;t||(this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(e.jstree.root,(function(t,n){n&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.extend(!0,{},this._data.core.state),(function(){this.trigger("refresh")}))),this._data.core.state=null}))},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var n=[],r=[],i=this._data.core.selected.concat([]);r.push(t.id),!0===t.state.opened&&n.push(t.id),this.get_node(t,!0).find(".jstree-open").each((function(){r.push(this.id),n.push(this.id)})),this._load_nodes(r,e.proxy((function(e){this.open_node(n,!1,0),this.select_node(i),this.trigger("refresh_node",{node:t,nodes:e})}),this),!1,!0)},set_id:function(t,n){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var r,i,o=this._model.data,s=t.id;for(n=n.toString(),o[t.parent].children[e.inArray(t.id,o[t.parent].children)]=n,r=0,i=t.parents.length;i>r;r++)o[t.parents[r]].children_d[e.inArray(t.id,o[t.parents[r]].children_d)]=n;for(r=0,i=t.children.length;i>r;r++)o[t.children[r]].parent=n;for(r=0,i=t.children_d.length;i>r;r++)o[t.children_d[r]].parents[e.inArray(t.id,o[t.children_d[r]].parents)]=n;return-1!==(r=e.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[r]=n),(r=this.get_node(t.id,!0))&&(r.attr("id",n),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",n)),delete o[t.id],t.id=n,t.li_attr.id=n,o[n]=t,this.trigger("set_id",{node:t,new:t.id,old:s}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.text},set_text:function(t,n){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.set_text(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root||(t.text=n,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:n}),0))},get_json:function(t,n,r){if(!(t=this.get_node(t||e.jstree.root)))return!1;n&&n.flat&&!r&&(r=[]);var i,o,s={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:(!n||!n.no_data)&&e.extend(!0,e.isArray(t.data)?[]:{},t.data)};if(n&&n.flat?s.parent=t.parent:s.children=[],n&&n.no_state)delete s.state;else for(i in t.state)t.state.hasOwnProperty(i)&&(s.state[i]=t.state[i]);if(n&&n.no_li_attr&&delete s.li_attr,n&&n.no_a_attr&&delete s.a_attr,n&&n.no_id&&(delete s.id,s.li_attr&&s.li_attr.id&&delete s.li_attr.id,s.a_attr&&s.a_attr.id&&delete s.a_attr.id),n&&n.flat&&t.id!==e.jstree.root&&r.push(s),!n||!n.no_children)for(i=0,o=t.children.length;o>i;i++)n&&n.flat?this.get_json(t.children[i],n,r):s.children.push(this.get_json(t.children[i],n));return n&&n.flat?r:t.id===e.jstree.root?s.children:s},create_node:function(n,r,i,o,s){if(null===n&&(n=e.jstree.root),!(n=this.get_node(n)))return!1;if(!(i=i===t?"last":i).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(n))return this.load_node(n,(function(){this.create_node(n,r,i,o,!0)}));var a,l,d,c;switch(r||(r={text:this.get_string("New node")}),(r="string"==typeof r?{text:r}:e.extend(!0,{},r)).text===t&&(r.text=this.get_string("New node")),n.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":a=this.get_node(n.parent),i=e.inArray(n.id,a.children),n=a;break;case"after":a=this.get_node(n.parent),i=e.inArray(n.id,a.children)+1,n=a;break;case"inside":case"first":i=0;break;case"last":i=n.children.length;break;default:i||(i=0)}if(i>n.children.length&&(i=n.children.length),r.id||(r.id=!0),!this.check("create_node",r,n,i))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===r.id&&delete r.id,!(r=this._parse_model_from_json(r,n.id,n.parents.concat())))return!1;for(a=this.get_node(r),(l=[]).push(r),l=l.concat(a.children_d),this.trigger("model",{nodes:l,parent:n.id}),n.children_d=n.children_d.concat(l),d=0,c=n.parents.length;c>d;d++)this._model.data[n.parents[d]].children_d=this._model.data[n.parents[d]].children_d.concat(l);for(r=a,a=[],d=0,c=n.children.length;c>d;d++)a[d>=i?d+1:d]=n.children[d];return a[i]=r.id,n.children=a,this.redraw_node(n,!0),this.trigger("create_node",{node:this.get_node(r),parent:n.id,position:i}),o&&o.call(this,this.get_node(r)),r.id},rename_node:function(t,n){var r,i,o;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.rename_node(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root||(o=t.text,this.check("rename_node",t,this.get_parent(t),n)?(this.set_text(t,n),this.trigger("rename_node",{node:t,text:n,old:o}),0):(this.settings.core.error.call(this,this._data.core.last_error),1)))},delete_node:function(t){var n,r,i,o,s,a,l,d,c,h,u,p;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.delete_node(t[n]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;if(i=this.get_node(t.parent),o=e.inArray(t.id,i.children),h=!1,!this.check("delete_node",t,i,o))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==o&&(i.children=e.vakata.array_remove(i.children,o)),(s=t.children_d.concat([])).push(t.id),a=0,l=t.parents.length;l>a;a++)this._model.data[t.parents[a]].children_d=e.vakata.array_filter(this._model.data[t.parents[a]].children_d,(function(t){return-1===e.inArray(t,s)}));for(d=0,c=s.length;c>d;d++)if(this._model.data[s[d]].state.selected){h=!0;break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(t){return-1===e.inArray(t,s)}))),this.trigger("delete_node",{node:t,parent:i.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:i.id}),d=0,c=s.length;c>d;d++)delete this._model.data[s[d]];return-1!==e.inArray(this._data.core.focused,s)&&(this._data.core.focused=null,u=this.element[0].scrollTop,p=this.element[0].scrollLeft,i.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(i,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=u,this.element[0].scrollLeft=p),this.redraw_node(i,!0),!0},check:function(t,n,r,i,o){n=n&&n.id?n:this.get_node(n),r=r&&r.id?r:this.get_node(r);var s=t.match(/^move_node|copy_node|create_node$/i)?r:n,a=this.settings.core.check_callback;if("move_node"===t||"copy_node"===t){if(!(o&&o.is_multi||"move_node"!==t||e.inArray(n.id,r.children)!==i))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1;if(!(o&&o.is_multi||n.id!==r.id&&("move_node"!==t||e.inArray(n.id,r.children)!==i)&&-1===e.inArray(r.id,n.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1}return s&&s.data&&(s=s.data),s&&s.functions&&(!1===s.functions[t]||!0===s.functions[t])?(!1===s.functions[t]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})}),s.functions[t]):!(!1===a||e.isFunction(a)&&!1===a.call(this,t,n,r,i,o)||a&&!1===a[t])||(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:i,obj:!(!n||!n.id)&&n.id,par:!(!r||!r.id)&&r.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(n,r,i,o,s,a,l){var d,c,h,u,p,f,g,_,m,v,b,x,y,j;if(r=this.get_node(r),i=i===t?0:i,!r)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,(function(){this.move_node(n,r,i,o,!0,!1,l)}));if(e.isArray(n)){if(1!==n.length){for(d=0,c=n.length;c>d;d++)(m=this.move_node(n[d],r,i,o,s,!1,l))&&(r=m,i="after");return this.redraw(),!0}n=n[0]}if(!(n=n&&n.id?n:this.get_node(n))||n.id===e.jstree.root)return!1;if(h=(n.parent||e.jstree.root).toString(),p=i.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,g=!(f=l||(this._model.data[n.id]?this:e.jstree.reference(n.id)))||!f._id||this._id!==f._id,u=f&&f._id&&h&&f._model.data[h]&&f._model.data[h].children?e.inArray(n.id,f._model.data[h].children):-1,f&&f._id&&(n=f._model.data[n.id]),g)return!!(m=this.copy_node(n,r,i,o,s,!1,l))&&(f&&f.delete_node(n),m);switch(r.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=e.inArray(r.id,p.children);break;case"after":i=e.inArray(r.id,p.children)+1;break;case"inside":case"first":i=0;break;case"last":i=p.children.length;break;default:i||(i=0)}if(i>p.children.length&&(i=p.children.length),!this.check("move_node",n,p,i,{core:!0,origin:l,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(n.parent===p.id){for(_=p.children.concat(),-1!==(m=e.inArray(n.id,_))&&(_=e.vakata.array_remove(_,m),i>m&&i--),m=[],v=0,b=_.length;b>v;v++)m[v>=i?v+1:v]=_[v];m[i]=n.id,p.children=m,this._node_changed(p.id),this.redraw(p.id===e.jstree.root)}else{for((m=n.children_d.concat()).push(n.id),v=0,b=n.parents.length;b>v;v++){for(_=[],x=0,y=(j=f._model.data[n.parents[v]].children_d).length;y>x;x++)-1===e.inArray(j[x],m)&&_.push(j[x]);f._model.data[n.parents[v]].children_d=_}for(f._model.data[h].children=e.vakata.array_remove_item(f._model.data[h].children,n.id),v=0,b=p.parents.length;b>v;v++)this._model.data[p.parents[v]].children_d=this._model.data[p.parents[v]].children_d.concat(m);for(_=[],v=0,b=p.children.length;b>v;v++)_[v>=i?v+1:v]=p.children[v];for(_[i]=n.id,p.children=_,p.children_d.push(n.id),p.children_d=p.children_d.concat(n.children_d),n.parent=p.id,(m=p.parents.concat()).unshift(p.id),j=n.parents.length,n.parents=m,m=m.concat(),v=0,b=n.children_d.length;b>v;v++)this._model.data[n.children_d[v]].parents=this._model.data[n.children_d[v]].parents.slice(0,-1*j),Array.prototype.push.apply(this._model.data[n.children_d[v]].parents,m);(h===e.jstree.root||p.id===e.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(p.id)),a||this.redraw()}return o&&o.call(this,n,p,i),this.trigger("move_node",{node:n,parent:p.id,position:i,old_parent:h,old_position:u,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id,old_instance:f,new_instance:this}),n.id},copy_node:function(n,r,i,o,s,a,l){var d,c,h,u,p,f,g,_,m,v;if(r=this.get_node(r),i=i===t?0:i,!r)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,(function(){this.copy_node(n,r,i,o,!0,!1,l)}));if(e.isArray(n)){if(1!==n.length){for(d=0,c=n.length;c>d;d++)(u=this.copy_node(n[d],r,i,o,s,!0,l))&&(r=u,i="after");return this.redraw(),!0}n=n[0]}if(!(n=n&&n.id?n:this.get_node(n))||n.id===e.jstree.root)return!1;switch(_=(n.parent||e.jstree.root).toString(),m=i.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,!(v=l||(this._model.data[n.id]?this:e.jstree.reference(n.id)))||!v._id||(this._id,v._id),v&&v._id&&(n=v._model.data[n.id]),r.id===e.jstree.root&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=e.inArray(r.id,m.children);break;case"after":i=e.inArray(r.id,m.children)+1;break;case"inside":case"first":i=0;break;case"last":i=m.children.length;break;default:i||(i=0)}if(i>m.children.length&&(i=m.children.length),!this.check("copy_node",n,m,i,{core:!0,origin:l,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(g=v?v.get_json(n,{no_id:!0,no_data:!0,no_state:!0}):n))return!1;if(!0===g.id&&delete g.id,!(g=this._parse_model_from_json(g,m.id,m.parents.concat())))return!1;for(u=this.get_node(g),n&&n.state&&!1===n.state.loaded&&(u.state.loaded=!1),(h=[]).push(g),h=h.concat(u.children_d),this.trigger("model",{nodes:h,parent:m.id}),p=0,f=m.parents.length;f>p;p++)this._model.data[m.parents[p]].children_d=this._model.data[m.parents[p]].children_d.concat(h);for(h=[],p=0,f=m.children.length;f>p;p++)h[p>=i?p+1:p]=m.children[p];return h[i]=u.id,m.children=h,m.children_d.push(u.id),m.children_d=m.children_d.concat(u.children_d),m.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(m.id),a||this.redraw(m.id===e.jstree.root),o&&o.call(this,u,m,i),this.trigger("copy_node",{node:u,original:n,parent:m.id,position:i,old_parent:_,old_position:v&&v._id&&_&&v._model.data[_]&&v._model.data[_].children?e.inArray(n.id,v._model.data[_].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),u.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var n,s,a,l=[];for(s=0,a=t.length;a>s;s++)(n=this.get_node(t[s]))&&n.id&&n.id!==e.jstree.root&&l.push(n);return!!l.length&&(r=l,o=this,i="move_node",void this.trigger("cut",{node:t}))},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var n,s,a,l=[];for(s=0,a=t.length;a>s;s++)(n=this.get_node(t[s]))&&n.id&&n.id!==e.jstree.root&&l.push(n);return!!l.length&&(r=l,o=this,i="copy_node",void this.trigger("copy",{node:t}))},get_buffer:function(){return{mode:i,node:r,inst:o}},can_paste:function(){return!1!==i&&!1!==r},paste:function(e,t){return!!((e=this.get_node(e))&&i&&i.match(/^(copy_node|move_node)$/)&&r)&&(this[i](r,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:r,mode:i}),r=!1,i=!1,void(o=!1))},clear_buffer:function(){r=!1,i=!1,o=!1,this.trigger("clear_buffer")},edit:function(t,n,r){var i,o,s,a,d,c,h,u,p,f=!1;return!!(t=this.get_node(t))&&(this.check("edit",t,this.get_parent(t))?(p=t,n="string"==typeof n?n:t.text,this.set_text(t,""),t=this._open_to(t),p.text=n,i=this._data.core.rtl,o=this.element.width(),this._data.core.focused=p.id,s=t.children(".jstree-anchor").focus(),a=e(""),d=n,c=e("
    ",{css:{position:"absolute",top:"-200px",left:i?"0px":"-1000px",visibility:"hidden"}}).appendTo(l.body),h=e("",{value:d,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:e.proxy((function(n){n.stopImmediatePropagation(),n.preventDefault();var i,o=a.children(".jstree-rename-input").val(),l=this.settings.core.force_text;""===o&&(o=d),c.remove(),a.replaceWith(s),a.remove(),d=l?d:e("
    ").append(e.parseHTML(d)).html(),t=this.get_node(t),this.set_text(t,d),(i=!!this.rename_node(t,l?e("
    ").text(o).text():e("
    ").append(e.parseHTML(o)).html()))||this.set_text(t,d),this._data.core.focused=p.id,setTimeout(e.proxy((function(){var e=this.get_node(p.id,!0);e.length&&(this._data.core.focused=p.id,e.children(".jstree-anchor").focus())}),this),0),r&&r.call(this,p,i,f,o),h=null}),this),keydown:function(e){var t=e.which;27===t&&(f=!0,this.value=d),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(c.text("pW"+this.value).width(),o))},keypress:function(e){return 13!==e.which&&void 0}}),u={fontFamily:s.css("fontFamily")||"",fontSize:s.css("fontSize")||"",fontWeight:s.css("fontWeight")||"",fontStyle:s.css("fontStyle")||"",fontStretch:s.css("fontStretch")||"",fontVariant:s.css("fontVariant")||"",letterSpacing:s.css("letterSpacing")||"",wordSpacing:s.css("wordSpacing")||""},a.attr("class",s.attr("class")).append(s.contents().clone()).append(h),s.replaceWith(a),c.css(u),h.css(u).width(Math.min(c.text("pW"+h[0].value).width(),o))[0].select(),void e(l).one("mousedown.jstree touchstart.jstree dnd_start.vakata",(function(t){h&&t.target!==h&&e(h).blur()}))):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(t,n){if(!t)return!1;if(!0===n){var r=this.settings.core.themes.dir;r||(r=e.jstree.path+"/themes"),n=r+"/"+t+"/style.css"}n&&-1===e.inArray(n,s)&&(e("head").append(''),s.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&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(n,r){var i,o,s,a;if(e.isArray(n)){for(i=0,o=(n=n.slice()).length;o>i;i++)this.set_icon(n[i],r);return!0}return!(!(n=this.get_node(n))||n.id===e.jstree.root||(a=n.icon,n.icon=!0===r||null===r||r===t||""===r||r,s=this.get_node(n,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===r?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),this.hide_icon(n)):!0===r||null===r||r===t||""===r?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),!1===a&&this.show_icon(n)):-1===r.indexOf("/")&&-1===r.indexOf(".")?(s.removeClass(a).css("background",""),s.addClass(r+" jstree-themeicon-custom").attr("rel",r),!1===a&&this.show_icon(n)):(s.removeClass(a).css("background",""),s.addClass("jstree-themeicon-custom").css("background","url('"+r+"') center center no-repeat").attr("rel",r),!1===a&&this.show_icon(n)),0))},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var n,r;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.hide_icon(t[n]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root||(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),0))},show_icon:function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.show_icon(t[n]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root||(i=this.get_node(t,!0),t.icon=!i.length||i.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),i.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),0))}},e.vakata={},e.vakata.attributes=function(t,n){t=e(t)[0];var r=n?{}:[];return t&&t.attributes&&e.each(t.attributes,(function(t,i){-1===e.inArray(i.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==i.value&&""!==e.vakata.trim(i.value)&&(n?r[i.name]=i.value:r.push(i.name))})),r},e.vakata.array_unique=function(e){var n,r,i=[],o={};for(n=0,r=e.length;r>n;n++)o[e[n]]===t&&(i.push(e[n]),o[e[n]]=!0);return i},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,n){var r=e.inArray(n,t);return-1!==r?e.vakata.array_remove(t,r):t},e.vakata.array_filter=function(e,t,n,r,i){if(e.filter)return e.filter(t,n);for(i in r=[],e)~~i+""==i+""&&i>=0&&t.call(n,e[i],+i,e)&&r.push(e[i]);return r},e.vakata.trim=function(e){return String.prototype.trim?String.prototype.trim.call(e.toString()):e.toString().replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},e.jstree.plugins.changed=function(e,t){var n=[];this.trigger=function(e,r){var i,o;if(r||(r={}),"changed"===e.replace(".jstree","")){r.changed={selected:[],deselected:[]};var s={};for(i=0,o=n.length;o>i;i++)s[n[i]]=1;for(i=0,o=r.selected.length;o>i;i++)s[r.selected[i]]?s[r.selected[i]]=2:r.changed.selected.push(r.selected[i]);for(i=0,o=n.length;o>i;i++)1===s[n[i]]&&r.changed.deselected.push(n[i]);n=r.selected.slice()}t.trigger.call(this,e,r)},this.refresh=function(e,r){return n=[],t.refresh.apply(this,arguments)}};var h,u,p=l.createElement("I");p.className="jstree-icon jstree-checkbox",p.setAttribute("role","presentation"),e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},e.jstree.plugins.checkbox=function(n,r){this.bind=function(){r.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",e.proxy((function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")}),this)).on("loading.jstree",e.proxy((function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()}),this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy((function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)}),this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy((function(e,t){var n,r,i=this._model.data,o=(i[t.parent],t.nodes);for(n=0,r=o.length;r>n;n++)i[o[n]].state.checked=i[o[n]].state.checked||i[o[n]].original&&i[o[n]].original.state&&i[o[n]].original.state.checked,i[o[n]].state.checked&&this._data.checkbox.selected.push(o[n])}),this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",e.proxy((function(t,n){var r,i,o,s,a,l,d=this._model.data,c=d[n.parent],h=n.nodes,u=[],p=this.settings.checkbox.cascade,f=this.settings.checkbox.tie_selection;if(-1!==p.indexOf("down"))if(c.state[f?"selected":"checked"]){for(i=0,o=h.length;o>i;i++)d[h[i]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(h)}else for(i=0,o=h.length;o>i;i++)if(d[h[i]].state[f?"selected":"checked"]){for(s=0,a=d[h[i]].children_d.length;a>s;s++)d[d[h[i]].children_d[s]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(d[h[i]].children_d)}if(-1!==p.indexOf("up")){for(i=0,o=c.children_d.length;o>i;i++)d[c.children_d[i]].children.length||u.push(d[c.children_d[i]].parent);for(s=0,a=(u=e.vakata.array_unique(u)).length;a>s;s++)for(c=d[u[s]];c&&c.id!==e.jstree.root;){for(r=0,i=0,o=c.children.length;o>i;i++)r+=d[c.children[i]].state[f?"selected":"checked"];if(r!==o)break;c.state[f?"selected":"checked"]=!0,this._data[f?"core":"checkbox"].selected.push(c.id),(l=this.get_node(c,!0))&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(f?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[f?"core":"checkbox"].selected=e.vakata.array_unique(this._data[f?"core":"checkbox"].selected)}),this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy((function(t,n){var r,i,o,s,a=n.node,l=this._model.data,d=this.get_node(a.parent),c=this.settings.checkbox.cascade,h=this.settings.checkbox.tie_selection,u={},p=this._data[h?"core":"checkbox"].selected;for(r=0,i=p.length;i>r;r++)u[p[r]]=!0;if(-1!==c.indexOf("down")){var f=this._cascade_new_checked_state(a.id,!0),g=a.children_d.concat(a.id);for(r=0,i=g.length;i>r;r++)f.indexOf(g[r])>-1?u[g[r]]=!0:delete u[g[r]]}if(-1!==c.indexOf("up"))for(;d&&d.id!==e.jstree.root;){for(o=0,r=0,i=d.children.length;i>r;r++)o+=l[d.children[r]].state[h?"selected":"checked"];if(o!==i)break;d.state[h?"selected":"checked"]=!0,u[d.id]=!0,(s=this.get_node(d,!0))&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}for(r in p=[],u)u.hasOwnProperty(r)&&p.push(r);this._data[h?"core":"checkbox"].selected=p}),this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy((function(t,n){var r,i,o,s=this.get_node(e.jstree.root),a=this._model.data;for(r=0,i=s.children_d.length;i>r;r++)(o=a[s.children_d[r]])&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1)}),this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy((function(t,n){var r,i,o,s=n.node,a=(this.get_node(s,!0),this.settings.checkbox.cascade),l=this.settings.checkbox.tie_selection,d=this._data[l?"core":"checkbox"].selected,c=s.children_d.concat(s.id);if(-1!==a.indexOf("down")){var h=this._cascade_new_checked_state(s.id,!1);d=e.vakata.array_filter(d,(function(e){return-1===c.indexOf(e)||h.indexOf(e)>-1}))}if(-1!==a.indexOf("up")&&-1===d.indexOf(s.id)){for(r=0,i=s.parents.length;i>r;r++)(o=this._model.data[s.parents[r]]).state[l?"selected":"checked"]=!1,o&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1),(o=this.get_node(s.parents[r],!0))&&o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass(l?"jstree-clicked":"jstree-checked");d=e.vakata.array_filter(d,(function(e){return-1===s.parents.indexOf(e)}))}this._data[l?"core":"checkbox"].selected=d}),this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy((function(t,n){for(var r,i,o,s,a=this.get_node(n.parent),l=this._model.data,d=this.settings.checkbox.tie_selection;a&&a.id!==e.jstree.root&&!a.state[d?"selected":"checked"];){for(o=0,r=0,i=a.children.length;i>r;r++)o+=l[a.children[r]].state[d?"selected":"checked"];if(!(i>0&&o===i))break;a.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(a.id),(s=this.get_node(a,!0))&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),a=this.get_node(a.parent)}}),this)).on("move_node.jstree",e.proxy((function(t,n){var r,i,o,s,a,l=n.is_multi,d=n.old_parent,c=this.get_node(n.parent),h=this._model.data,u=this.settings.checkbox.tie_selection;if(!l)for(r=this.get_node(d);r&&r.id!==e.jstree.root&&!r.state[u?"selected":"checked"];){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state[u?"selected":"checked"];if(!(s>0&&i===s))break;r.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),r=this.get_node(r.parent)}for(r=c;r&&r.id!==e.jstree.root;){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state[u?"selected":"checked"];if(i===s)r.state[u?"selected":"checked"]||(r.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"));else{if(!r.state[u?"selected":"checked"])break;r.state[u?"selected":"checked"]=!1,this._data[u?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[u?"core":"checkbox"].selected,r.id),(a=this.get_node(r,!0))&&a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass(u?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}}),this))},this.get_undetermined=function(n){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var r,i,o,s,a={},l=this._model.data,d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,h=[],u=this,p=[];for(r=0,i=c.length;i>r;r++)if(l[c[r]]&&l[c[r]].parents)for(o=0,s=l[c[r]].parents.length;s>o&&a[l[c[r]].parents[o]]===t;o++)l[c[r]].parents[o]!==e.jstree.root&&(a[l[c[r]].parents[o]]=!0,h.push(l[c[r]].parents[o]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each((function(){var n,d=u.get_node(this);if(d)if(d.state.loaded){for(r=0,i=d.children_d.length;i>r;r++)if(!(n=l[d.children_d[r]]).state.loaded&&n.original&&n.original.state&&n.original.state.undetermined&&!0===n.original.state.undetermined)for(a[n.id]===t&&n.id!==e.jstree.root&&(a[n.id]=!0,h.push(n.id)),o=0,s=n.parents.length;s>o;o++)a[n.parents[o]]===t&&n.parents[o]!==e.jstree.root&&(a[n.parents[o]]=!0,h.push(n.parents[o]))}else if(d.original&&d.original.state&&d.original.state.undetermined&&!0===d.original.state.undetermined)for(a[d.id]===t&&d.id!==e.jstree.root&&(a[d.id]=!0,h.push(d.id)),o=0,s=d.parents.length;s>o;o++)a[d.parents[o]]===t&&d.parents[o]!==e.jstree.root&&(a[d.parents[o]]=!0,h.push(d.parents[o]))})),r=0,i=h.length;i>r;r++)l[h[r]].state[d?"selected":"checked"]||p.push(n?l[h[r]]:h[r]);return p},this._undetermined=function(){if(null!==this.element){var e,t,n,r=this.get_undetermined(!1);for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,t=r.length;t>e;e++)(n=this.get_node(r[e],!0))&&n.length&&n.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,n,i,o){if(t=r.redraw_node.apply(this,arguments)){var s,a,l=null,d=null;for(s=0,a=t.childNodes.length;a>s;s++)if(t.childNodes[s]&&t.childNodes[s].className&&-1!==t.childNodes[s].className.indexOf("jstree-anchor")){l=t.childNodes[s];break}l&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(l.className+=" jstree-checked"),d=p.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(d.className+=" jstree-checkbox-disabled"),l.insertBefore(d,l.childNodes[0]))}return i||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(t){t=this.get_node(t);var n,r,i=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection,s=this._data[o?"core":"checkbox"].selected,a=this._model.data;if(!t||!0===t.state[o?"selected":"checked"]||-1===i.indexOf("undetermined")||-1===i.indexOf("down")&&-1===i.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(n=0,r=t.children_d.length;r>n;n++)if(-1!==e.inArray(t.children_d[n],s)||!a[t.children_d[n]].state.loaded&&a[t.children_d[n]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.disable_checkbox(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(i=this.get_node(t,!0),void(t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))))},this.enable_checkbox=function(t){var n,r,i;if(e.isArray(t)){for(n=0,r=(t=t.slice()).length;r>n;n++)this.enable_checkbox(t[n]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(i=this.get_node(t,!0),void(t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))))},this.activate_node=function(t,n){return!e(n.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(n.target).hasClass("jstree-checkbox"))&&(n.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(n.target).hasClass("jstree-checkbox")?r.activate_node.call(this,t,n):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,n):this.check_node(t,n),void this.trigger("activate_node",{node:this.get_node(t)})))},this._cascade_new_checked_state=function(e,t){var n,r,i,o=this,s=this.settings.checkbox.tie_selection,a=this._model.data[e],l=[],d=[];if(!this.settings.checkbox.cascade_to_disabled&&a.state.disabled||!this.settings.checkbox.cascade_to_hidden&&a.state.hidden)i=this.get_checked_descendants(e),a.state[s?"selected":"checked"]&&i.push(a.id),l=l.concat(i);else{if(a.children)for(n=0,r=a.children.length;r>n;n++){var c=a.children[n];i=o._cascade_new_checked_state(c,t),l=l.concat(i),i.indexOf(c)>-1&&d.push(c)}var h=o.get_node(a,!0),u=d.length>0&&d.lengthi;i++)this.check_node(t[i],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(r=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:n}))))},this.uncheck_node=function(t,n){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,n);var r,i,o;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;i>r;r++)this.uncheck_node(t[r],n);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(o=this.get_node(t,!0),void(t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:n}))))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var t,n;for(this._data.checkbox.selected.concat([]),this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),t=0,n=this._data.checkbox.selected.length;n>t;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var e,t,n=this._data.checkbox.selected.concat([]);for(e=0,t=this._data.checkbox.selected.length;t>e;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:n})},this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.checked},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.checkbox.selected.slice()},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);var n,r,i,o,s=this.get_checked(!0),a={};for(n=0,r=s.length;r>n;n++)a[s[n].id]=s[n];for(n=0,r=s.length;r>n;n++)for(i=0,o=s[n].children_d.length;o>i;i++)a[s[n].children_d[i]]&&delete a[s[n].children_d[i]];for(n in s=[],a)a.hasOwnProperty(n)&&s.push(n);return t?e.map(s,e.proxy((function(e){return this.get_node(e)}),this)):s},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var n,r,i=this.get_checked(!0),o=[];for(n=0,r=i.length;r>n;n++)i[n].children.length||o.push(i[n].id);return t?e.map(o,e.proxy((function(e){return this.get_node(e)}),this)):o},this.load_node=function(t,n){var i,o,s;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(s=this.get_node(t))&&s.state.loaded)for(i=0,o=s.children_d.length;o>i;i++)this._model.data[s.children_d[i]].state.checked&&(this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,s.children_d[i]));return r.load_node.apply(this,arguments)},this.get_state=function(){var e=r.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(e.checkbox=this._data.checkbox.selected.slice()),e},this.set_state=function(t,n){var i=r.set_state.apply(this,arguments);if(i&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var o=this;e.each(t.checkbox,(function(e,t){o.check_node(t)}))}return delete t.checkbox,this.set_state(t,n),!1}return i},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),r.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,n){return this.settings.conditionalselect.call(this,this.get_node(e),n)?t.activate_node.call(this,e,n):void 0}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,n){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.create_node(r,{},"last",(function(e){try{n.edit(e)}catch(t){setTimeout((function(){n.edit(e)}),0)}}))}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.delete_node(n.get_selected()):n.delete_node(r)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.cut(n.get_top_selected()):n.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.is_selected(r)?n.copy(n.get_top_selected()):n.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var n=e.jstree.reference(t.reference),r=n.get_node(t.reference);n.paste(r)}}}}}}},e.jstree.plugins.contextmenu=function(n,r){this.bind=function(){r.bind.call(this);var t,n,i=0,o=null;this.element.on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-contextmenu")}),this)).on("contextmenu.jstree",".jstree-anchor",e.proxy((function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),i=e.ctrlKey?+new Date:0,(t||o)&&(i=+new Date+1e4),o&&clearTimeout(o),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(t){this._data.contextmenu.visible&&(!i||+new Date-i>250)&&e.vakata.context.hide(),i=0}),this)).on("touchstart.jstree",".jstree-anchor",(function(r){r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(t=r.originalEvent.changedTouches[0].clientX,n=r.originalEvent.changedTouches[0].clientY,o=setTimeout((function(){e(r.currentTarget).trigger("contextmenu",!0)}),750))})).on("touchmove.vakata.jstree",(function(r){o&&r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(Math.abs(t-r.originalEvent.changedTouches[0].clientX)>10||Math.abs(n-r.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(o),e.vakata.context.hide())})).on("touchend.vakata.jstree",(function(e){o&&clearTimeout(o)})),e(l).on("context_hide.vakata.jstree",e.proxy((function(t,n){this._data.contextmenu.visible=!1,e(n.reference).removeClass("jstree-context")}),this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),r.teardown.call(this)},this.show_contextmenu=function(n,r,i,o){if(!(n=this.get_node(n))||n.id===e.jstree.root)return!1;var s=this.settings.contextmenu,a=this.get_node(n,!0).children(".jstree-anchor"),l=!1,d=!1;(s.show_at_node||r===t||i===t)&&(l=a.offset(),r=l.left,i=l.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&this.activate_node(n,o),d=s.items,e.isFunction(d)&&(d=d.call(this,n,e.proxy((function(e){this._show_contextmenu(n,r,i,e)}),this))),e.isPlainObject(d)&&this._show_contextmenu(n,r,i,d)},this._show_contextmenu=function(t,n,r,i){var o=this.get_node(t,!0).children(".jstree-anchor");e(l).one("context_show.vakata.jstree",e.proxy((function(t,n){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(r),o.addClass("jstree-context")}),this)),this._data.contextmenu.visible=!0,e.vakata.context.show(o,{x:n,y:r},i),this.trigger("show_contextmenu",{node:t,x:n,y:r})}},function(e){var t=!1,n={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(l).triggerHandler("context_"+t+".vakata",{reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_execute:function(t){return!(!(t=n.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:n.reference,element:n.element}))||!t.action)&&t.action.call(null,{item:t,reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_parse:function(t,r){if(!t)return!1;r||(n.html="",n.items=[]);var i,o="",s=!1;return r&&(o+=""),r||(n.html=o,e.vakata.context._trigger("parse")),o.length>10&&o},_show_submenu:function(n){if((n=e(n)).length&&n.children("ul").length){var r=n.children("ul"),i=n.offset().left,o=i+n.outerWidth(),s=n.offset().top,a=r.width(),l=r.height(),d=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?n[o-(a+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[o+a>d&&i>d-o?"addClass":"removeClass"]("vakata-context-right"),s+l+10>c&&r.css("bottom","-1px"),n.hasClass("vakata-context-right")?a>i&&r.css("margin-right",i-a):a>d-o&&r.css("margin-left",d-o-a),r.show()}},show:function(r,i,o){var s,a,d,c,h,u,p,f,g=!0;switch(n.element&&n.element.length&&n.element.width(""),g){case!i&&!r:return!1;case!!i&&!!r:n.reference=r,n.position_x=i.x,n.position_y=i.y;break;case!i&&!!r:n.reference=r,s=r.offset(),n.position_x=s.left+r.outerHeight(),n.position_y=s.top;break;case!!i&&!r:n.position_x=i.x,n.position_y=i.y}r&&!o&&e(r).data("vakata_contextmenu")&&(o=e(r).data("vakata_contextmenu")),e.vakata.context._parse(o)&&n.element.html(n.html),n.items.length&&(n.element.appendTo(l.body),a=n.element,d=n.position_x,c=n.position_y,h=a.width(),u=a.height(),p=e(window).width()+e(window).scrollLeft(),f=e(window).height()+e(window).scrollTop(),t&&(d-=a.outerWidth()-e(r).outerWidth())p&&(d=p-(h+20)),c+u+20>f&&(c=f-(u+20)),n.element.css({left:d,top:c}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),n.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){n.is_visible&&(n.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),n.is_visible=!1,e.vakata.context._trigger("hide"))}},e((function(){t="rtl"===e(l.body).css("direction");var r=!1;n.element=e("
      "),n.element.on("mouseenter","li",(function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(r&&clearTimeout(r),n.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))})).on("mouseleave","li",(function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")})).on("mouseleave",(function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(r=setTimeout((function(){e.vakata.context.hide()}),e.vakata.context.settings.hide_onmouseleave))})).on("click","a",(function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()})).on("keydown","a",(function(t){var r=null;switch(t.which){case 13:case 32:t.type="click",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:n.is_visible&&(n.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:n.is_visible&&((r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:n.is_visible&&(n.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(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:n.is_visible&&((r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}})).on("keydown",(function(e){e.preventDefault();var t=n.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()})),e(l).on("mousedown.vakata.jstree",(function(t){n.is_visible&&n.element[0]!==t.target&&!e.contains(n.element[0],t.target)&&e.vakata.context.hide()})).on("context_show.vakata.jstree",(function(e,r){n.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&n.element.addClass("vakata-context-rtl").css("direction","rtl"),n.element.find("ul").hide().end()}))}))}(e),e.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},e.jstree.plugins.dnd=function(t,n){this.init=function(e,t){n.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in l.createElement("span")},this.bind=function(){n.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",e.proxy((function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0;if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var n=this.get_node(t.target),r=this.is_selected(n)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,i=r>1?r+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(i=e.vakata.html.escape(i)),n&&n.id&&n.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,r>1?this.get_top_selected(!0):[n],t))){if(h={jstree:!0,origin:this,obj:this.get_node(n,!0),nodes:r>1?this.get_top_selected():[n.id]},u=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,h,'
      '+i+'
      ');e.vakata.dnd._trigger("start",t,{helper:e(),element:u,data:h})}}),this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",(function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:h}),!1})).on("drop.jstree",e.proxy((function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:h}),!1}),this))},this.redraw_node=function(e,t,r,i){if((e=n.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{var o,s,a=null;for(o=0,s=e.childNodes.length;s>o;o++)if(e.childNodes[o]&&e.childNodes[o].className&&-1!==e.childNodes[o].className.indexOf("jstree-anchor")){a=e.childNodes[o];break}a&&a.setAttribute("draggable",!0)}return e}},e((function(){var n=!1,r=!1,i=!1,o=!1,s=e('
       
      ').hide();e(l).on("dragover.vakata.jstree",(function(t){u&&e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:h})})).on("drop.vakata.jstree",(function(t){u&&(e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:h}),u=null,h=null)})).on("dnd_start.vakata.jstree",(function(e,t){n=!1,i=!1,t&&t.data&&t.data.jstree&&s.appendTo(l.body)})).on("dnd_move.vakata.jstree",(function(a,l){var d=l.event.target!==i.target;if(o&&(!l.event||"dragover"!==l.event.type||d)&&clearTimeout(o),l&&l.data&&l.data.jstree&&(!l.event.target.id||"jstree-marker"!==l.event.target.id)){i=l.event;var c,h,u,p,f,g,_,m,v,b,x,y,j,k,w,A,C,E=e.jstree.reference(l.event.target),S=!1,T=!1,O=!1;if(E&&E._data&&E._data.dnd)if(s.attr("class","jstree-"+E.get_theme()+(E.settings.core.themes.responsive?" jstree-dnd-responsive":"")),w=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey)),l.helper.children().attr("class","jstree-"+E.get_theme()+" jstree-"+E.get_theme()+"-"+E.get_theme_variant()+" "+(E.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[w?"show":"hide"](),l.event.target!==E.element[0]&&l.event.target!==E.get_container_ul()[0]||0!==E.get_container_ul().children().length){if((S=E.settings.dnd.large_drop_target?e(l.event.target).closest(".jstree-node").children(".jstree-anchor"):e(l.event.target).closest(".jstree-anchor"))&&S.length&&S.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(T=S.offset(),O=(l.event.pageY!==t?l.event.pageY:l.event.originalEvent.pageY)-T.top,u=S.outerHeight(),g=u/3>O?["b","i","a"]:O>u-u/3?["a","i","b"]:O>u/2?["i","a","b"]:["i","b","a"],e.each(g,(function(t,i){switch(i){case"b":c=T.left-6,h=T.top,p=E.get_parent(S),f=S.parent().index(),C="jstree-below";break;case"i":j=E.settings.dnd.inside_pos,k=E.get_node(S.parent()),c=T.left-2,h=T.top+u/2+1,p=k.id,f="first"===j?0:"last"===j?k.children.length:Math.min(j,k.children.length),C="jstree-inside";break;case"a":c=T.left-6,h=T.top+u,p=E.get_parent(S),f=S.parent().index()+1,C="jstree-above"}for(_=!0,m=0,v=l.data.nodes.length;v>m;m++)if(b=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",x=f,"move_node"===b&&"a"===i&&l.data.origin&&l.data.origin===E&&p===E.get_parent(l.data.nodes[m])&&(y=E.get_node(p),x>e.inArray(l.data.nodes[m],y.children)&&(x-=1)),!(_=_&&(E&&E.settings&&E.settings.dnd&&!1===E.settings.dnd.check_while_dragging||E.check(b,l.data.origin&&l.data.origin!==E?l.data.origin.get_node(l.data.nodes[m]):l.data.nodes[m],p,x,{dnd:!0,ref:E.get_node(S.parent()),pos:i,origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==E,is_foreign:!l.data.origin})))){E&&E.last_error&&(r=E.last_error());break}return"i"===i&&S.parent().is(".jstree-closed")&&E.settings.dnd.open_timeout&&(!l.event||"dragover"!==l.event.type||d)&&(o&&clearTimeout(o),o=setTimeout(function(e,t){return function(){e.open_node(t)}}(E,S),E.settings.dnd.open_timeout)),_?((A=E.get_node(p,!0)).hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),A.addClass("jstree-dnd-parent")),n={ins:E,par:p,pos:"i"!==i||"last"!==j||0!==f||E.is_loaded(k)?f:"last"},s.css({left:c+"px",top:h+"px"}).show(),s.removeClass("jstree-above jstree-inside jstree-below").addClass(C),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"),r={},g=!0,!1):void 0})),!0===g))return}else{for(_=!0,m=0,v=l.data.nodes.length;v>m&&(_=_&&E.check(l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",l.data.origin&&l.data.origin!==E?l.data.origin.get_node(l.data.nodes[m]):l.data.nodes[m],e.jstree.root,"last",{dnd:!0,ref:E.get_node(e.jstree.root),pos:"i",origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==E,is_foreign:!l.data.origin}));m++);if(_)return n={ins:E,par:e.jstree.root,pos:"last"},s.hide(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),n=!1,l.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),l.event.originalEvent&&l.event.originalEvent.dataTransfer,s.hide()}})).on("dnd_scroll.vakata.jstree",(function(e,t){t&&t.data&&t.data.jstree&&(s.hide(),n=!1,i=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))})).on("dnd_stop.vakata.jstree",(function(t,a){if(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),o&&clearTimeout(o),a&&a.data&&a.data.jstree){s.hide().detach();var l,d,c=[];if(n){for(l=0,d=a.data.nodes.length;d>l;l++)c[l]=a.data.origin?a.data.origin.get_node(a.data.nodes[l]):a.data.nodes[l];n.ins[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey))?"copy_node":"move_node"](c,n.par,n.pos,!1,!1,!1,a.data.origin)}else(l=e(a.event.target).closest(".jstree")).length&&r&&r.error&&"check"===r.error&&(l=l.jstree(!0))&&l.settings.core.error.call(this,r);i=!1,n=!1}})).on("keyup.jstree keydown.jstree",(function(t,a){(a=e.vakata.dnd._get())&&a.data&&a.data.jstree&&("keyup"===t.type&&27===t.which?(o&&clearTimeout(o),n=!1,r=!1,i=!1,o=!1,s.hide().detach(),e.vakata.dnd._clean()):(a.helper.find(".jstree-copy").first()[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),i&&(i.metaKey=t.metaKey,i.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",i))))}))})),function(e){e.vakata.html={div:e("
      "),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}};var n={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(n,r,i){i===t&&(i=e.vakata.dnd._get()),i.event=r,e(l).triggerHandler("dnd_"+n+".vakata",i)},_get:function(){return{data:n.data,element:n.element,helper:n.helper}},_clean:function(){n.helper&&n.helper.remove(),n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),n={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},u=null,e(l).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!n.scroll_e||!n.scroll_l&&!n.scroll_t)return n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),!1;if(!n.scroll_i)return n.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(!0===t)return!1;var r=n.scroll_e.scrollTop(),i=n.scroll_e.scrollLeft();n.scroll_e.scrollTop(r+n.scroll_t*e.vakata.dnd.settings.scroll_speed),n.scroll_e.scrollLeft(i+n.scroll_l*e.vakata.dnd.settings.scroll_speed),(r!==n.scroll_e.scrollTop()||i!==n.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",n.scroll_e)},start:function(t,r,i){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(e){}return n.init_x=t.pageX,n.init_y=t.pageY,n.data=r,n.is_down=!0,n.element=t.currentTarget,n.target=t.target,n.is_touch="touchstart"===t.type,!1!==i&&(n.helper=e("
      ").html(i).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(l).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_down){if(!n.is_drag){if(!(Math.abs(t.pageX-n.init_x)>(n.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-n.init_y)>(n.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;n.helper&&(n.helper.appendTo(l.body),n.helper_w=n.helper.outerWidth()),n.is_drag=!0,e(n.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var r=!1,i=!1,o=!1,s=!1,a=!1,d=!1,c=!1,h=!1,u=!1,p=!1;return n.scroll_t=0,n.scroll_l=0,n.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter((function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)})).each((function(){var r=e(this),i=r.offset();return this.scrollHeight>this.offsetHeight&&(i.top+r.height()-t.pageYthis.offsetWidth&&(i.left+r.width()-t.pageXs&&t.pageY-cs&&s-(t.pageY-c)d&&t.pageX-hd&&d-(t.pageX-h)o&&(u=o-50),a&&p+n.helper_w>a&&(p=a-(n.helper_w+2)),n.helper.css({left:p+"px",top:u+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),n.is_drag)t.target!==n.target&&e(n.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===n.target){var r=setTimeout((function(){e(t.target).click()}),100);e(t.target).one("click",(function(){r&&clearTimeout(r)}))}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,n){this.init=function(e,t){this._data.massload={},n.init.call(this,e,t)},this._load_nodes=function(t,r,i,o){var s,a,l,d=this.settings.massload,c=[],h=this._model.data;if(!i){for(s=0,a=t.length;a>s;s++)(!h[t[s]]||!h[t[s]].state.loaded&&!h[t[s]].state.failed||o)&&(c.push(t[s]),(l=this.get_node(t[s],!0))&&l.length&&l.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},c.length){if(e.isFunction(d))return d.call(this,c,e.proxy((function(e){var s,a;if(e)for(s in e)e.hasOwnProperty(s)&&(this._data.massload[s]=e[s]);for(s=0,a=t.length;a>s;s++)(l=this.get_node(t[s],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);n._load_nodes.call(this,t,r,i,o)}),this));if("object"==typeof d&&d&&d.url)return d=e.extend(!0,{},d),e.isFunction(d.url)&&(d.url=d.url.call(this,c)),e.isFunction(d.data)&&(d.data=d.data.call(this,c)),e.ajax(d).done(e.proxy((function(e,s,a){var d,c;if(e)for(d in e)e.hasOwnProperty(d)&&(this._data.massload[d]=e[d]);for(d=0,c=t.length;c>d;d++)(l=this.get_node(t[d],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);n._load_nodes.call(this,t,r,i,o)}),this)).fail(e.proxy((function(e){n._load_nodes.call(this,t,r,i,o)}),this))}}return n._load_nodes.call(this,t,r,i,o)},this._load_node=function(t,r){var i,o=this._data.massload[t.id],s=null;return o?(s=this["string"==typeof o?"_append_html_data":"_append_json_data"](t,"string"==typeof o?e(e.parseHTML(o)).filter((function(){return 3!==this.nodeType})):o,(function(e){r.call(this,e)})),(i=this.get_node(t.id,!0))&&i.length&&i.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],s):n._load_node.call(this,t,r)}},e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(n,r){this.bind=function(){r.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",e.proxy((function(t,n){if(this._data.search.som&&n.res.length){var r,i,o,s,a=this._model.data,l=[];for(r=0,i=n.res.length;i>r;r++)if(a[n.res[r]]&&!a[n.res[r]].state.hidden&&(l.push(n.res[r]),l=l.concat(a[n.res[r]].parents),this._data.search.smc))for(o=0,s=a[n.res[r]].children_d.length;s>o;o++)a[a[n.res[r]].children_d[o]]&&!a[a[n.res[r]].children_d[o]].state.hidden&&l.push(a[n.res[r]].children_d[o]);l=e.vakata.array_remove_item(e.vakata.array_unique(l),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(l,!0),this.redraw(!0)}}),this)).on("clear_search.jstree",e.proxy((function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))}),this))},this.search=function(n,r,i,o,s,a){if(!1===n||""===e.vakata.trim(n.toString()))return this.clear_search();o=(o=this.get_node(o))&&o.id?o.id:null,n=n.toString();var l,d,c=this.settings.search,h=!!c.ajax&&c.ajax,u=this._model.data,p=null,f=[],g=[];if(this._data.search.res.length&&!s&&this.clear_search(),i===t&&(i=c.show_only_matches),a===t&&(a=c.show_only_matches_children),!r&&!1!==h)return e.isFunction(h)?h.call(this,n,e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(n,!0,i,o,s,a)}))}),this),o):((h=e.extend({},h)).data||(h.data={}),h.data.str=n,o&&(h.data.inside=o),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=e.ajax(h).fail(e.proxy((function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(h)},this.settings.core.error.call(this,this._data.core.last_error)}),this)).done(e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(n,!0,i,o,s,a)}))}),this)),this._data.search.lastRequest);if(s||(this._data.search.str=n,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=i,this._data.search.smc=a),p=new e.vakata.search(n,!0,{caseSensitive:c.case_sensitive,fuzzy:c.fuzzy}),e.each(u[o||e.jstree.root].children_d,(function(e,t){var r=u[t];r.text&&!r.state.hidden&&(!c.search_leaves_only||r.state.loaded&&0===r.children.length)&&(c.search_callback&&c.search_callback.call(this,n,r)||!c.search_callback&&p.search(r.text).isMatch)&&(f.push(t),g=g.concat(r.parents))})),f.length){for(l=0,d=(g=e.vakata.array_unique(g)).length;d>l;l++)g[l]!==e.jstree.root&&u[g[l]]&&!0===this.open_node(g[l],null,0)&&this._data.search.opn.push(g[l]);s?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(f,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(f))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(f,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #"))),this._data.search.res=f),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:n,res:this._data.search.res,show_only_matches:i})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this.redraw_node=function(t,n,i,o){if((t=r.redraw_node.apply(this,arguments))&&-1!==e.inArray(t.id,this._data.search.res)){var s,a,l=null;for(s=0,a=t.childNodes.length;a>s;s++)if(t.childNodes[s]&&t.childNodes[s].className&&-1!==t.childNodes[s].className.indexOf("jstree-anchor")){l=t.childNodes[s];break}l&&(l.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,n,r){r=r||{},!1!==(r=e.extend({},e.vakata.search.defaults,r)).fuzzy&&(r.fuzzy=!0),t=r.caseSensitive?t:t.toLowerCase();var i,o,s,a,l=r.location,d=r.distance,c=r.threshold,h=t.length;return h>32&&(r.fuzzy=!1),r.fuzzy&&(i=1<n;n++)e[t.charAt(n)]=0;for(n=0;h>n;n++)e[t.charAt(n)]|=1<n;n++){for(d=0,u=y;u>d;)s(n,l+u)<=b?d=u:y=u,u=Math.floor((y-d)/2+d);for(y=u,f=Math.max(1,l-u+1),g=Math.min(l+u,v)+h,(_=new Array(g+2))[g+1]=(1<=f;a--)if(m=o[e.charAt(a-1)],_[a]=0===n?(_[a+1]<<1|1)&m:(_[a+1]<<1|1)&m|(p[a+1]|p[a])<<1|1|p[a+1],_[a]&i&&b>=(j=s(n,a-1))){if(b=j,x=a-1,k.push(x),!(x>l))break;f=Math.max(1,2*l-x)}if(s(n+1,l)>b)break;p=_}return{isMatch:x>=0,score:j}},!0===n?{search:a}:a(n)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy((function(e,t){this.sort(t.parent,!0)}),this)).on("rename_node.jstree create_node.jstree",e.proxy((function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)}),this)).on("move_node.jstree copy_node.jstree",e.proxy((function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)}),this))},this.sort=function(t,n){var r,i;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(r=0,i=t.children_d.length;i>r;r++)this.sort(t.children_d[r],!1)}};var f=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},e.jstree.plugins.state=function(t,n){this.bind=function(){n.bind.call(this);var t=e.proxy((function(){this.element.on(this.settings.state.events,e.proxy((function(){f&&clearTimeout(f),f=setTimeout(e.proxy((function(){this.save_state()}),this),100)}),this)),this.trigger("state_ready")}),this);this.element.on("ready.jstree",e.proxy((function(e,n){this.element.one("restore_state.jstree",t),this.restore_state()||t()}),this))},this.save_state=function(){var t=this.get_state();this.settings.state.preserve_loaded||delete t.core.loaded;var n={state:t,ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,JSON.stringify(n))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl||(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!t||(this.settings.state.preserve_loaded||delete t.core.loaded,this.element.one("set_state.jstree",(function(n,r){r.instance.trigger("restore_state",{state:e.extend(!0,{},t)})})),this.set_state(t),0)))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={default:{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(n,r){this.init=function(n,i){var o,s;if(i&&i.types&&i.types.default)for(o in i.types)if("default"!==o&&o!==e.jstree.root&&i.types.hasOwnProperty(o))for(s in i.types.default)i.types.default.hasOwnProperty(s)&&i.types[o][s]===t&&(i.types[o][s]=i.types.default[s]);r.init.call(this,n,i),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,n){r.refresh.call(this,t,n),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy((function(n,r){var i,o,s,a=this._model.data,l=r.nodes,d=this.settings.types,c="default";for(i=0,o=l.length;o>i;i++){if(c="default",a[l[i]].original&&a[l[i]].original.type&&d[a[l[i]].original.type]&&(c=a[l[i]].original.type),a[l[i]].data&&a[l[i]].data.jstree&&a[l[i]].data.jstree.type&&d[a[l[i]].data.jstree.type]&&(c=a[l[i]].data.jstree.type),a[l[i]].type=c,!0===a[l[i]].icon&&d[c].icon!==t&&(a[l[i]].icon=d[c].icon),d[c].li_attr!==t&&"object"==typeof d[c].li_attr)for(s in d[c].li_attr)if(d[c].li_attr.hasOwnProperty(s)){if("id"===s)continue;a[l[i]].li_attr[s]===t?a[l[i]].li_attr[s]=d[c].li_attr[s]:"class"===s&&(a[l[i]].li_attr.class=d[c].li_attr.class+" "+a[l[i]].li_attr.class)}if(d[c].a_attr!==t&&"object"==typeof d[c].a_attr)for(s in d[c].a_attr)if(d[c].a_attr.hasOwnProperty(s)){if("id"===s)continue;a[l[i]].a_attr[s]===t?a[l[i]].a_attr[s]=d[c].a_attr[s]:"href"===s&&"#"===a[l[i]].a_attr[s]?a[l[i]].a_attr.href=d[c].a_attr.href:"class"===s&&(a[l[i]].a_attr.class=d[c].a_attr.class+" "+a[l[i]].a_attr.class)}}a[e.jstree.root].type=e.jstree.root}),this)),r.bind.call(this)},this.get_json=function(t,n,i){var o,s,a=this._model.data,l=n?e.extend(!0,{},n,{no_id:!1}):{},d=r.get_json.call(this,t,l,i);if(!1===d)return!1;if(e.isArray(d))for(o=0,s=d.length;s>o;o++)d[o].type=d[o].id&&a[d[o].id]&&a[d[o].id].type?a[d[o].id].type:"default",n&&n.no_id&&(delete d[o].id,d[o].li_attr&&d[o].li_attr.id&&delete d[o].li_attr.id,d[o].a_attr&&d[o].a_attr.id&&delete d[o].a_attr.id);else d.type=d.id&&a[d.id]&&a[d.id].type?a[d.id].type:"default",n&&n.no_id&&(d=this._delete_ids(d));return d},this._delete_ids=function(t){if(e.isArray(t)){for(var n=0,r=t.length;r>n;n++)t[n]=this._delete_ids(t[n]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(n,i,o,s,a){if(!1===r.check.call(this,n,i,o,s,a))return!1;i=i&&i.id?i:this.get_node(i),o=o&&o.id?o:this.get_node(o);var l,d,c,h,u=i&&i.id?a&&a.origin?a.origin:e.jstree.reference(i.id):null;switch(u=u&&u._model&&u._model.data?u._model.data:null,n){case"create_node":case"move_node":case"copy_node":if("move_node"!==n||-1===e.inArray(i.id,o.children)){if((l=this.get_rules(o)).max_children!==t&&-1!==l.max_children&&l.max_children===o.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!o||!o.id)&&o.id})},!1;if(l.valid_children!==t&&-1!==l.valid_children&&-1===e.inArray(i.type||"default",l.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!o||!o.id)&&o.id})},!1;if(u&&i.children_d&&i.parents){for(d=0,c=0,h=i.children_d.length;h>c;c++)d=Math.max(d,u[i.children_d[c]].parents.length);d=d-i.parents.length+1}(0>=d||d===t)&&(d=1);do{if(l.max_depth!==t&&-1!==l.max_depth&&l.max_deptho;o++)this.set_type(n[o],r);return!0}if(i=this.settings.types,n=this.get_node(n),!i[r]||!n)return!1;if((c=this.get_node(n,!0))&&c.length&&(h=c.children(".jstree-anchor")),a=n.type,l=this.get_icon(n),n.type=r,(!0===l||!i[a]||i[a].icon!==t&&l===i[a].icon)&&this.set_icon(n,i[r].icon===t||i[r].icon),i[a]&&i[a].li_attr!==t&&"object"==typeof i[a].li_attr)for(d in i[a].li_attr)if(i[a].li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[n.id].li_attr.class=(u[n.id].li_attr.class||"").replace(i[a].li_attr[d],""),c&&c.removeClass(i[a].li_attr[d])):u[n.id].li_attr[d]===i[a].li_attr[d]&&(u[n.id].li_attr[d]=null,c&&c.removeAttr(d))}if(i[a]&&i[a].a_attr!==t&&"object"==typeof i[a].a_attr)for(d in i[a].a_attr)if(i[a].a_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[n.id].a_attr.class=(u[n.id].a_attr.class||"").replace(i[a].a_attr[d],""),h&&h.removeClass(i[a].a_attr[d])):u[n.id].a_attr[d]===i[a].a_attr[d]&&("href"===d?(u[n.id].a_attr[d]="#",h&&h.attr("href","#")):(delete u[n.id].a_attr[d],h&&h.removeAttr(d)))}if(i[r].li_attr!==t&&"object"==typeof i[r].li_attr)for(d in i[r].li_attr)if(i[r].li_attr.hasOwnProperty(d)){if("id"===d)continue;u[n.id].li_attr[d]===t?(u[n.id].li_attr[d]=i[r].li_attr[d],c&&("class"===d?c.addClass(i[r].li_attr[d]):c.attr(d,i[r].li_attr[d]))):"class"===d&&(u[n.id].li_attr.class=i[r].li_attr[d]+" "+u[n.id].li_attr.class,c&&c.addClass(i[r].li_attr[d]))}if(i[r].a_attr!==t&&"object"==typeof i[r].a_attr)for(d in i[r].a_attr)if(i[r].a_attr.hasOwnProperty(d)){if("id"===d)continue;u[n.id].a_attr[d]===t?(u[n.id].a_attr[d]=i[r].a_attr[d],h&&("class"===d?h.addClass(i[r].a_attr[d]):h.attr(d,i[r].a_attr[d]))):"href"===d&&"#"===u[n.id].a_attr[d]?(u[n.id].a_attr.href=i[r].a_attr.href,h&&h.attr("href",i[r].a_attr.href)):"class"===d&&(u[n.id].a_attr.class=i[r].a_attr.class+" "+u[n.id].a_attr.class,h&&h.addClass(i[r].a_attr[d]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(n,r){this.check=function(t,n,i,o,s){if(!1===r.check.call(this,t,n,i,o,s))return!1;if(n=n&&n.id?n:this.get_node(n),!(i=i&&i.id?i:this.get_node(i))||!i.children)return!0;var a,l,d,c="rename_node"===t?o:n.text,h=[],u=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,f=this._model.data;for(a=0,l=i.children.length;l>a;a++)d=f[i.children[a]].text,u||(d=d.toLowerCase()),p&&(d=d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),h.push(d);switch(u||(c=c.toLowerCase()),p&&(c=c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),t){case"delete_node":return!0;case"rename_node":return d=n.text||"",u||(d=d.toLowerCase()),p&&(d=d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(a=-1===e.inArray(c,h)||n.text&&d===c)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"create_node":return(a=-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"copy_node":return(a=-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a;case"move_node":return(a=n.parent===i.id&&(!s||!s.is_multi)||-1===e.inArray(c,h))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:o,obj:!(!n||!n.id)&&n.id,par:!(!i||!i.id)&&i.id})}),a}return!0},this.create_node=function(n,i,o,s,a){if(!i||i.text===t){if(null===n&&(n=e.jstree.root),!(n=this.get_node(n)))return r.create_node.call(this,n,i,o,s,a);if(!(o=o===t?"last":o).toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(n))return r.create_node.call(this,n,i,o,s,a);i||(i={});var l,d,c,h,u,p,f=this._model.data,g=this.settings.unique.case_sensitive,_=this.settings.unique.trim_whitespace,m=this.settings.unique.duplicate;for(d=l=this.get_string("New node"),c=[],h=0,u=n.children.length;u>h;h++)p=f[n.children[h]].text,g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),c.push(p);for(h=1,p=d,g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==e.inArray(p,c);)p=d=m.call(this,l,++h).toString(),g||(p=p.toLowerCase()),_&&(p=p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));i.text=d}return r.create_node.call(this,n,i,o,s,a)}};var g=l.createElement("DIV");if(g.setAttribute("unselectable","on"),g.setAttribute("role","presentation"),g.className="jstree-wholerow",g.innerHTML=" ",e.jstree.plugins.wholerow=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy((function(){this.hide_dots()}),this)).on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-wholerow-ul")}),this)).on("deselect_all.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")}),this)).on("changed.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var n,r,i=!1;for(n=0,r=t.selected.length;r>n;n++)(i=this.get_node(t.selected[n],!0))&&i.length&&i.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}),this)).on("open_node.jstree",e.proxy((function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}),this)).on("hover_node.jstree dehover_node.jstree",e.proxy((function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")}),this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy((function(t){if(this._data.contextmenu){t.preventDefault();var n=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n)}}),this)).on("click.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()})).on("dblclick.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var n=e.Event("dblclick",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()})).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy((function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(n).focus()}),this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy((function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1}),this)).on("mouseleave.jstree",".jstree-node",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,r,i,o){if(t=n.redraw_node.apply(this,arguments)){var s=g.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(s.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(s.className+=" jstree-wholerow-hovered"),t.insertBefore(s,t.childNodes[0])}return t}},window.customElements&&Object&&Object.create){var _=Object.create(HTMLElement.prototype);_.createdCallback=function(){var t,n={core:{},plugins:[]};for(t in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(n.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(n[t]=JSON.parse(this.getAttribute(t))));for(t in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(n.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t));e(this).jstree(n)};try{window.customElements.define("vakata-jstree",(function(){}),{prototype:_})}catch(e){}}}})?r.apply(t,i):r)||(e.exports=o)}()},function(e,t){e.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-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 .vakata-contextmenu-disabled > a > i {\n filter: grayscale(100%);\n}\n.vakata-context li > a > i {\n text-decoration: none;\n display: inline-block;\n width: 2.4em;\n height: 2.4em;\n background: transparent;\n margin: 0 0 0 -2em;\n vertical-align: top;\n text-align: center;\n line-height: 2.4em;\n}\n.vakata-context li > a > i:empty {\n width: 2.4em;\n line-height: 2.4em;\n}\n.vakata-context li > a .vakata-contextmenu-sep {\n display: inline-block;\n width: 1px;\n height: 2.4em;\n background: white;\n margin: 0 0.5em 0 0;\n border-left: 1px solid #e2e3e3;\n}\n.vakata-context .vakata-contextmenu-shortcut {\n font-size: 0.8em;\n color: silver;\n opacity: 0.5;\n display: none;\n}\n.vakata-context-rtl ul {\n left: auto;\n right: 100%;\n margin-left: auto;\n margin-right: -4px;\n}\n.vakata-context-rtl li > a.vakata-context-parent {\n background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");\n background-position: left center;\n background-repeat: no-repeat;\n}\n.vakata-context-rtl .vakata-context-separator > a {\n margin: 0 2.4em 0 0;\n border-left: 0;\n border-right: 1px solid #e2e3e3;\n}\n.vakata-context-rtl .vakata-context-left ul {\n right: auto;\n left: 100%;\n margin-left: -4px;\n margin-right: auto;\n}\n.vakata-context-rtl li > a > i {\n margin: 0 -2em 0 0;\n}\n.vakata-context-rtl li > a .vakata-contextmenu-sep {\n margin: 0 0 0 0.5em;\n border-left-color: white;\n background: #e2e3e3;\n}\n#jstree-marker {\n position: absolute;\n top: 0;\n left: 0;\n margin: -5px 0 0 0;\n padding: 0;\n border-right: 0;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 5px solid;\n width: 0;\n height: 0;\n font-size: 0;\n line-height: 0;\n}\n#jstree-dnd {\n line-height: 16px;\n margin: 0;\n padding: 4px;\n}\n#jstree-dnd .jstree-icon,\n#jstree-dnd .jstree-copy {\n display: inline-block;\n text-decoration: none;\n margin: 0 2px 0 0;\n padding: 0;\n width: 16px;\n height: 16px;\n}\n#jstree-dnd .jstree-ok {\n background: green;\n}\n#jstree-dnd .jstree-er {\n background: red;\n}\n#jstree-dnd .jstree-copy {\n margin: 0 2px 0 2px;\n}\n.jstree-default .jstree-node,\n.jstree-default .jstree-icon {\n background-repeat: no-repeat;\n background-color: transparent;\n}\n.jstree-default .jstree-anchor,\n.jstree-default .jstree-animated,\n.jstree-default .jstree-wholerow {\n transition: background-color 0.15s, box-shadow 0.15s;\n}\n.jstree-default .jstree-hovered {\n background: #e7f4f9;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #cccccc;\n}\n.jstree-default .jstree-context {\n background: #e7f4f9;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #cccccc;\n}\n.jstree-default .jstree-clicked {\n background: #beebff;\n border-radius: 2px;\n box-shadow: inset 0 0 1px #999999;\n}\n.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {\n display: none;\n}\n.jstree-default .jstree-disabled {\n background: transparent;\n color: #666666;\n}\n.jstree-default .jstree-disabled.jstree-hovered {\n background: transparent;\n box-shadow: none;\n}\n.jstree-default .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default .jstree-disabled > .jstree-icon {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default .jstree-search {\n font-style: italic;\n color: #8b0000;\n font-weight: bold;\n}\n.jstree-default .jstree-no-checkboxes .jstree-checkbox {\n display: none !important;\n}\n.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {\n background: transparent;\n box-shadow: none;\n}\n.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {\n background: #e7f4f9;\n}\n.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {\n background: transparent;\n}\n.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {\n background: #e7f4f9;\n}\n.jstree-default > .jstree-striped {\n min-width: 100%;\n display: inline-block;\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;\n}\n.jstree-default > .jstree-wholerow-ul .jstree-hovered,\n.jstree-default > .jstree-wholerow-ul .jstree-clicked {\n background: transparent;\n box-shadow: none;\n border-radius: 0;\n}\n.jstree-default .jstree-wholerow {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.jstree-default .jstree-wholerow-hovered {\n background: #e7f4f9;\n}\n.jstree-default .jstree-wholerow-clicked {\n background: #beebff;\n background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);\n background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);\n}\n.jstree-default .jstree-node {\n min-height: 24px;\n line-height: 24px;\n margin-left: 24px;\n min-width: 24px;\n}\n.jstree-default .jstree-anchor {\n line-height: 24px;\n height: 24px;\n}\n.jstree-default .jstree-icon {\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n.jstree-default .jstree-icon:empty {\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n.jstree-default.jstree-rtl .jstree-node {\n margin-right: 24px;\n}\n.jstree-default .jstree-wholerow {\n height: 24px;\n}\n.jstree-default .jstree-node,\n.jstree-default .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default .jstree-node {\n background-position: -292px -4px;\n background-repeat: repeat-y;\n}\n.jstree-default .jstree-last {\n background: transparent;\n}\n.jstree-default .jstree-open > .jstree-ocl {\n background-position: -132px -4px;\n}\n.jstree-default .jstree-closed > .jstree-ocl {\n background-position: -100px -4px;\n}\n.jstree-default .jstree-leaf > .jstree-ocl {\n background-position: -68px -4px;\n}\n.jstree-default .jstree-themeicon {\n background-position: -260px -4px;\n}\n.jstree-default > .jstree-no-dots .jstree-node,\n.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -36px -4px;\n}\n.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -4px -4px;\n}\n.jstree-default .jstree-disabled {\n background: transparent;\n}\n.jstree-default .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default .jstree-checkbox {\n background-position: -164px -4px;\n}\n.jstree-default .jstree-checkbox:hover {\n background-position: -164px -36px;\n}\n.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default .jstree-checked > .jstree-checkbox {\n background-position: -228px -4px;\n}\n.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default .jstree-checked > .jstree-checkbox:hover {\n background-position: -228px -36px;\n}\n.jstree-default .jstree-anchor > .jstree-undetermined {\n background-position: -196px -4px;\n}\n.jstree-default .jstree-anchor > .jstree-undetermined:hover {\n background-position: -196px -36px;\n}\n.jstree-default .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default > .jstree-striped {\n background-size: auto 48px;\n}\n.jstree-default.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -132px -36px;\n}\n.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -100px -36px;\n}\n.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -68px -36px;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -36px -36px;\n}\n.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -4px -36px;\n}\n.jstree-default .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default .jstree-file {\n background: url("32px.png") -100px -68px no-repeat;\n}\n.jstree-default .jstree-folder {\n background: url("32px.png") -260px -4px no-repeat;\n}\n.jstree-default > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default {\n line-height: 24px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default .jstree-ok,\n#jstree-dnd.jstree-default .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default i {\n background: transparent;\n width: 24px;\n height: 24px;\n line-height: 24px;\n}\n#jstree-dnd.jstree-default .jstree-ok {\n background-position: -4px -68px;\n}\n#jstree-dnd.jstree-default .jstree-er {\n background-position: -36px -68px;\n}\n.jstree-default .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 29px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n}\n.jstree-default.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-small .jstree-node {\n min-height: 18px;\n line-height: 18px;\n margin-left: 18px;\n min-width: 18px;\n}\n.jstree-default-small .jstree-anchor {\n line-height: 18px;\n height: 18px;\n}\n.jstree-default-small .jstree-icon {\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n.jstree-default-small .jstree-icon:empty {\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n margin-right: 18px;\n}\n.jstree-default-small .jstree-wholerow {\n height: 18px;\n}\n.jstree-default-small .jstree-node,\n.jstree-default-small .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default-small .jstree-node {\n background-position: -295px -7px;\n background-repeat: repeat-y;\n}\n.jstree-default-small .jstree-last {\n background: transparent;\n}\n.jstree-default-small .jstree-open > .jstree-ocl {\n background-position: -135px -7px;\n}\n.jstree-default-small .jstree-closed > .jstree-ocl {\n background-position: -103px -7px;\n}\n.jstree-default-small .jstree-leaf > .jstree-ocl {\n background-position: -71px -7px;\n}\n.jstree-default-small .jstree-themeicon {\n background-position: -263px -7px;\n}\n.jstree-default-small > .jstree-no-dots .jstree-node,\n.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -39px -7px;\n}\n.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -7px -7px;\n}\n.jstree-default-small .jstree-disabled {\n background: transparent;\n}\n.jstree-default-small .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default-small .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default-small .jstree-checkbox {\n background-position: -167px -7px;\n}\n.jstree-default-small .jstree-checkbox:hover {\n background-position: -167px -39px;\n}\n.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default-small .jstree-checked > .jstree-checkbox {\n background-position: -231px -7px;\n}\n.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default-small .jstree-checked > .jstree-checkbox:hover {\n background-position: -231px -39px;\n}\n.jstree-default-small .jstree-anchor > .jstree-undetermined {\n background-position: -199px -7px;\n}\n.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {\n background-position: -199px -39px;\n}\n.jstree-default-small .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default-small > .jstree-striped {\n background-size: auto 36px;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default-small.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -135px -39px;\n}\n.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -103px -39px;\n}\n.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -71px -39px;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -39px -39px;\n}\n.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: -7px -39px;\n}\n.jstree-default-small .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default-small .jstree-file {\n background: url("32px.png") -103px -71px no-repeat;\n}\n.jstree-default-small .jstree-folder {\n background: url("32px.png") -263px -7px no-repeat;\n}\n.jstree-default-small > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default-small {\n line-height: 18px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default-small .jstree-ok,\n#jstree-dnd.jstree-default-small .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default-small i {\n background: transparent;\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n#jstree-dnd.jstree-default-small .jstree-ok {\n background-position: -7px -71px;\n}\n#jstree-dnd.jstree-default-small .jstree-er {\n background-position: -39px -71px;\n}\n.jstree-default-small .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default-small .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 23px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default-small.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");\n}\n.jstree-default-small.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-large .jstree-node {\n min-height: 32px;\n line-height: 32px;\n margin-left: 32px;\n min-width: 32px;\n}\n.jstree-default-large .jstree-anchor {\n line-height: 32px;\n height: 32px;\n}\n.jstree-default-large .jstree-icon {\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n.jstree-default-large .jstree-icon:empty {\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n margin-right: 32px;\n}\n.jstree-default-large .jstree-wholerow {\n height: 32px;\n}\n.jstree-default-large .jstree-node,\n.jstree-default-large .jstree-icon {\n background-image: url("32px.png");\n}\n.jstree-default-large .jstree-node {\n background-position: -288px 0px;\n background-repeat: repeat-y;\n}\n.jstree-default-large .jstree-last {\n background: transparent;\n}\n.jstree-default-large .jstree-open > .jstree-ocl {\n background-position: -128px 0px;\n}\n.jstree-default-large .jstree-closed > .jstree-ocl {\n background-position: -96px 0px;\n}\n.jstree-default-large .jstree-leaf > .jstree-ocl {\n background-position: -64px 0px;\n}\n.jstree-default-large .jstree-themeicon {\n background-position: -256px 0px;\n}\n.jstree-default-large > .jstree-no-dots .jstree-node,\n.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -32px 0px;\n}\n.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: 0px 0px;\n}\n.jstree-default-large .jstree-disabled {\n background: transparent;\n}\n.jstree-default-large .jstree-disabled.jstree-hovered {\n background: transparent;\n}\n.jstree-default-large .jstree-disabled.jstree-clicked {\n background: #efefef;\n}\n.jstree-default-large .jstree-checkbox {\n background-position: -160px 0px;\n}\n.jstree-default-large .jstree-checkbox:hover {\n background-position: -160px -32px;\n}\n.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n.jstree-default-large .jstree-checked > .jstree-checkbox {\n background-position: -224px 0px;\n}\n.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n.jstree-default-large .jstree-checked > .jstree-checkbox:hover {\n background-position: -224px -32px;\n}\n.jstree-default-large .jstree-anchor > .jstree-undetermined {\n background-position: -192px 0px;\n}\n.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {\n background-position: -192px -32px;\n}\n.jstree-default-large .jstree-checkbox-disabled {\n opacity: 0.8;\n filter: url("data:image/svg+xml;utf8,#jstree-grayscale");\n /* Firefox 10+ */\n filter: gray;\n /* IE6-9 */\n -webkit-filter: grayscale(100%);\n /* Chrome 19+ & Safari 6+ */\n}\n.jstree-default-large > .jstree-striped {\n background-size: auto 64px;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");\n background-position: 100% 1px;\n background-repeat: repeat-y;\n}\n.jstree-default-large.jstree-rtl .jstree-last {\n background: transparent;\n}\n.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {\n background-position: -128px -32px;\n}\n.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -96px -32px;\n}\n.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {\n background-position: -64px -32px;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {\n background: transparent;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {\n background-position: -32px -32px;\n}\n.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {\n background-position: 0px -32px;\n}\n.jstree-default-large .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n}\n.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {\n background: url("throbber.gif") center center no-repeat;\n}\n.jstree-default-large .jstree-file {\n background: url("32px.png") -96px -64px no-repeat;\n}\n.jstree-default-large .jstree-folder {\n background: url("32px.png") -256px 0px no-repeat;\n}\n.jstree-default-large > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n}\n#jstree-dnd.jstree-default-large {\n line-height: 32px;\n padding: 0 4px;\n}\n#jstree-dnd.jstree-default-large .jstree-ok,\n#jstree-dnd.jstree-default-large .jstree-er {\n background-image: url("32px.png");\n background-repeat: no-repeat;\n background-color: transparent;\n}\n#jstree-dnd.jstree-default-large i {\n background: transparent;\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n#jstree-dnd.jstree-default-large .jstree-ok {\n background-position: 0px -64px;\n}\n#jstree-dnd.jstree-default-large .jstree-er {\n background-position: -32px -64px;\n}\n.jstree-default-large .jstree-ellipsis {\n overflow: hidden;\n}\n.jstree-default-large .jstree-ellipsis .jstree-anchor {\n width: calc(100% - 37px);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.jstree-default-large.jstree-rtl .jstree-node {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");\n}\n.jstree-default-large.jstree-rtl .jstree-last {\n background: transparent;\n}\n@media (max-width: 768px) {\n #jstree-dnd.jstree-dnd-responsive {\n line-height: 40px;\n font-weight: bold;\n font-size: 1.1em;\n text-shadow: 1px 1px white;\n }\n #jstree-dnd.jstree-dnd-responsive > i {\n background: transparent;\n width: 40px;\n height: 40px;\n }\n #jstree-dnd.jstree-dnd-responsive > .jstree-ok {\n background-image: url("40px.png");\n background-position: 0 -200px;\n background-size: 120px 240px;\n }\n #jstree-dnd.jstree-dnd-responsive > .jstree-er {\n background-image: url("40px.png");\n background-position: -40px -200px;\n background-size: 120px 240px;\n }\n #jstree-marker.jstree-dnd-responsive {\n border-left-width: 10px;\n border-top-width: 10px;\n border-bottom-width: 10px;\n margin-top: -10px;\n }\n}\n@media (max-width: 768px) {\n .jstree-default-responsive {\n /*\n\t.jstree-open > .jstree-ocl,\n\t.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }\n\t*/\n }\n .jstree-default-responsive .jstree-icon {\n background-image: url("40px.png");\n }\n .jstree-default-responsive .jstree-node,\n .jstree-default-responsive .jstree-leaf > .jstree-ocl {\n background: transparent;\n }\n .jstree-default-responsive .jstree-node {\n min-height: 40px;\n line-height: 40px;\n margin-left: 40px;\n min-width: 40px;\n white-space: nowrap;\n }\n .jstree-default-responsive .jstree-anchor {\n line-height: 40px;\n height: 40px;\n }\n .jstree-default-responsive .jstree-icon,\n .jstree-default-responsive .jstree-icon:empty {\n width: 40px;\n height: 40px;\n line-height: 40px;\n }\n .jstree-default-responsive > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n }\n .jstree-default-responsive.jstree-rtl .jstree-node {\n margin-left: 0;\n margin-right: 40px;\n background: transparent;\n }\n .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node {\n margin-right: 0;\n }\n .jstree-default-responsive .jstree-ocl,\n .jstree-default-responsive .jstree-themeicon,\n .jstree-default-responsive .jstree-checkbox {\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-leaf > .jstree-ocl,\n .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl {\n background: transparent;\n }\n .jstree-default-responsive .jstree-open > .jstree-ocl {\n background-position: 0 0 !important;\n }\n .jstree-default-responsive .jstree-closed > .jstree-ocl {\n background-position: 0 -40px !important;\n }\n .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl {\n background-position: -40px 0 !important;\n }\n .jstree-default-responsive .jstree-themeicon {\n background-position: -40px -40px;\n }\n .jstree-default-responsive .jstree-checkbox,\n .jstree-default-responsive .jstree-checkbox:hover {\n background-position: -40px -80px;\n }\n .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,\n .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,\n .jstree-default-responsive .jstree-checked > .jstree-checkbox,\n .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover {\n background-position: 0 -80px;\n }\n .jstree-default-responsive .jstree-anchor > .jstree-undetermined,\n .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover {\n background-position: 0 -120px;\n }\n .jstree-default-responsive .jstree-anchor {\n font-weight: bold;\n font-size: 1.1em;\n text-shadow: 1px 1px white;\n }\n .jstree-default-responsive > .jstree-striped {\n background: transparent;\n }\n .jstree-default-responsive .jstree-wholerow {\n border-top: 1px solid rgba(255, 255, 255, 0.7);\n border-bottom: 1px solid rgba(64, 64, 64, 0.2);\n background: #ebebeb;\n height: 40px;\n }\n .jstree-default-responsive .jstree-wholerow-hovered {\n background: #e7f4f9;\n }\n .jstree-default-responsive .jstree-wholerow-clicked {\n background: #beebff;\n }\n .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow {\n box-shadow: inset 0 -6px 3px -5px #666666;\n }\n .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow {\n box-shadow: inset 0 6px 3px -5px #666666;\n border-top: 0;\n }\n .jstree-default-responsive .jstree-children .jstree-open + .jstree-open {\n box-shadow: none;\n }\n .jstree-default-responsive .jstree-node,\n .jstree-default-responsive .jstree-icon,\n .jstree-default-responsive .jstree-node > .jstree-ocl,\n .jstree-default-responsive .jstree-themeicon,\n .jstree-default-responsive .jstree-checkbox {\n background-image: url("40px.png");\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-node {\n background-position: -80px 0;\n background-repeat: repeat-y;\n }\n .jstree-default-responsive .jstree-last {\n background: transparent;\n }\n .jstree-default-responsive .jstree-leaf > .jstree-ocl {\n background-position: -40px -120px;\n }\n .jstree-default-responsive .jstree-last > .jstree-ocl {\n background-position: -40px -160px;\n }\n .jstree-default-responsive .jstree-themeicon-custom {\n background-color: transparent;\n background-image: none;\n background-position: 0 0;\n }\n .jstree-default-responsive .jstree-file {\n background: url("40px.png") 0 -160px no-repeat;\n background-size: 120px 240px;\n }\n .jstree-default-responsive .jstree-folder {\n background: url("40px.png") -40px -40px no-repeat;\n background-size: 120px 240px;\n }\n .jstree-default-responsive > .jstree-container-ul > .jstree-node {\n margin-left: 0;\n margin-right: 0;\n }\n}\n'},function(e,t){e.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: #191921;\n padding: 0;\n font-size: 13px;\n color: #7c7c85;\n box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);\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 *:focus,\n.ins-container *:active {\n outline: 0;\n}\n\n.ins-container *:-moz-focusring {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.ins-container *:focus-visible {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\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: #191921 #191921;\n scrollbar-width: thin;\n}\n\n.ins-world-tree:hover {\n scrollbar-color: #32323a #191921;\n scrollbar-width: thin;\n}\n\n.ins-world-tree::-webkit-scrollbar {\n background: #191921;\n width: 6px;\n height: 6px;\n}\n\n.ins-world-tree::-webkit-scrollbar-track,\n.ins-world-tree::-webkit-scrollbar-corner {\n background: #191921;\n}\n\n.ins-world-tree::-webkit-scrollbar-thumb {\n background: #191921;\n border-radius: 3px;\n}\n\n.ins-world-tree:hover::-webkit-scrollbar-thumb {\n background: #32323a;\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: #191921;\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 transform: translateY(1px);\n background: #000;\n}\n\n.jstree-default .jstree-search {\n font-style: italic;\n color: #aaa;\n font-weight: normal;\n}\n\n.jstree-default .jstree-wholerow-hovered,\n.jstree-default .jstree-hovered {\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n}\n\n.jstree-default .jstree-wholerow {\n height: 28px;\n}\n\n.jstree-default .jstree-wholerow-clicked,\n.jstree-default .jstree-clicked {\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n transition: none;\n}\n\n.jstree-default .jstree-leaf .jstree-clicked {\n color: #bbb !important;\n}\n\n.jstree-default .jstree-anchor {\n line-height: 27px;\n outline: none;\n}\n\n.jstree-default .jstree-container-ul {\n margin-bottom: 12px;\n}\n\n.jstree-default .jstree-container-ul > .jstree-node > .jstree-anchor:before,\n.jstree-default\n .jstree-open\n > .jstree-children\n > .jstree-node\n > .jstree-anchor:before {\n content: "";\n display: block;\n position: absolute;\n left: 0;\n right: 1px;\n height: 28px;\n border-radius: 0;\n box-shadow: none;\n border-right: none;\n pointer-events: none;\n background: rgb(44, 47, 62, 0.5);\n opacity: 0;\n}\n\n.jstree-default .jstree-anchor.jstree-clicked:before {\n opacity: 1 !important;\n pointer-events: none;\n}\n\n.jstree-default .jstree-node,\n.jstree-default .jstree-leaf .jstree-ocl,\n.jstree-default .jstree-icon {\n background: transparent;\n}\n\n.jstree-default .jstree-node {\n min-height: 28px;\n line-height: 28px;\n margin-left: 12px;\n min-width: 26px;\n}\n\n.jstree-default .jstree-icon {\n position: relative;\n}\n\n.jstree-default .jstree-icon:before {\n display: block;\n pointer-events: none;\n color: #d6d6d6;\n font-style: normal;\n font-size: 11px;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 24px;\n line-height: 24px;\n transform-origin: 12px 12px;\n transform: translate(0px, -0px);\n}\n\n.jstree-default .jstree-open > .jstree-icon:before {\n content: "▾";\n top: 2px;\n}\n\n.jstree-default .jstree-closed > .jstree-icon:before {\n content: "▾";\n transform: rotate(-90deg) translate(-2px, 0px);\n}\n\n.jstree-leaf .jstree-icon:before {\n display: none;\n}\n\n.jstree-default .jstree-open .jstree-ocl {\n background-position: -38px -1px;\n}\n\n.jstree-default .jstree-closed .jstree-ocl {\n background-position: -4px -2px;\n}\n\n.jstree-anchor {\n padding: 1px 0;\n transition: none;\n}\n\n.jstree-anchor .jstree-icon {\n display: none;\n}\n\n.jstree-node-type-bodies > .jstree-anchor,\n.jstree-node-type-constraints > .jstree-anchor,\n.jstree-node-type-composites > .jstree-anchor {\n color: #51515d;\n}\n\n#vakata-dnd {\n font-size: 12px;\n color: #aaa;\n}\n'},function(e,t,n){"use strict";const r=e.exports={},i=n(3),o=n(4),s=n(1),a=n(0).Common;r._isIOS=window.navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,r._matterLink="https://brm.io/matter-js/",r.create=function(e){let t=Object.assign({example:{instance:null},examples:[],resetOnOrientation:!1,preventZoom:!1,fullPage:!1,startExample:!0,appendTo:document.body,toolbar:{title:null,url:null,reset:!0,source:!1,inspector:!1,tools:!1,fullscreen:!0,exampleSelect:!1},tools:{inspector:null,gui:null},dom:{}},e||{});return(!e.toolbar||t.examples.length>1&&e.toolbar&&!1!==e.toolbar.exampleSelect)&&(t.toolbar.exampleSelect=!0),r._isIOS&&(t.toolbar.fullscreen=!1),i||(t.toolbar.tools=!1,t.tools.gui=!1),o||(t.toolbar.inspector=!1,t.tools.inspector=!1),t.dom=r._createDom(t),r._bindDom(t),t.fullPage||!1===t.inline||t.dom.root.classList.add("matter-demo-inline"),t.appendTo&&t.appendTo.appendChild(t.dom.root),t.startExample&&r.start(t,t.startExample),t},r.start=function(e,t){t="string"==typeof t?t:e.examples[0].id,window.location.hash.length>0&&(t=window.location.hash.slice(1)),r.setExampleById(e,t)},r.stop=function(e){e.example&&e.example.instance&&e.example.instance.stop()},r.reset=function(e){a._nextId=0,a._seed=0,r.setExample(e,e.example)},r.setExampleById=function(e,t){let n=e.examples.filter((e=>e.id===t))[0];r.setExample(e,n)},r.setExample=function(e,t){if(t){let n=e.example.instance;n&&(n.stop(),n.canvas&&n.canvas.parentElement.removeChild(n.canvas)),window.location.hash=t.id,e.example.instance=null,e.example=t,e.example.instance=n=t.init(e),!n.canvas&&n.render&&(n.canvas=n.render.canvas),n.canvas&&e.dom.root.appendChild(n.canvas),e.dom.exampleSelect.value=t.id,e.dom.buttonSource.href=t.sourceLink||e.url||"#",setTimeout((function(){e.tools.inspector&&r.setInspector(e,!0),e.tools.gui&&r.setGui(e,!0)}),500)}else r.setExample(e,e.examples[0])},r.setInspector=function(e,t){if(!t)return r._destroyTools(e,!0,!1),void e.dom.root.classList.toggle("matter-inspect-active",!1);let n=e.example.instance;r._destroyTools(e,!0,!1),e.dom.root.classList.toggle("matter-inspect-active",!0),e.tools.inspector=o.create(n.engine,n.render)},r.setGui=function(e,t){if(!t)return r._destroyTools(e,!1,!0),void e.dom.root.classList.toggle("matter-gui-active",!1);let n=e.example.instance;r._destroyTools(e,!1,!0),e.dom.root.classList.toggle("matter-gui-active",!0),e.tools.gui=i.create(n.engine,n.runner,n.render)},r._destroyTools=function(e,t,n){let r=e.tools.inspector,s=e.tools.gui;t&&r&&!0!==r&&(o.destroy(r),e.tools.inspector=null),n&&s&&!0!==s&&(i.destroy(s),e.tools.gui=null)},r._toggleFullscreen=function(e){let t=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;t?document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t=e.dom.root,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT))},r._bindDom=function(e){var t=e.dom;if(window.addEventListener("orientationchange",(function(){setTimeout((()=>{e.resetOnOrientation&&r.reset(e)}),300)})),e.preventZoom){document.body.addEventListener("gesturestart",(function(e){e.preventDefault()}));var n,i=!0;document.body.addEventListener("touchstart",(function(e){i||e.preventDefault(),i=!1,clearTimeout(n),n=setTimeout((function(){i=!0}),500)}))}if(t.exampleSelect&&t.exampleSelect.addEventListener("change",(function(){let t=this.options[this.selectedIndex].value;r.setExampleById(e,t)})),t.buttonReset&&t.buttonReset.addEventListener("click",(function(){r.reset(e)})),t.buttonInspect&&t.buttonInspect.addEventListener("click",(function(){var t=!e.tools.inspector;r.setInspector(e,t)})),t.buttonTools&&t.buttonTools.addEventListener("click",(function(){var t=!e.tools.gui;r.setGui(e,t)})),t.buttonFullscreen){t.buttonFullscreen.addEventListener("click",(function(){r._toggleFullscreen(e)}));var o=function(){var e=document.fullscreen||document.webkitIsFullScreen||document.mozFullScreen;document.body.classList.toggle("matter-is-fullscreen",e)};document.addEventListener("webkitfullscreenchange",o),document.addEventListener("mozfullscreenchange",o),document.addEventListener("fullscreenchange",o)}},r._createDom=function(e){let t=n(15);s.injectStyles(t,"matter-demo-style");let i=document.createElement("div"),o=e.examples.map((e=>``)).join(" ");var a=e.preventZoom&&r._isIOS?"prevent-zoom-ios":"";i.innerHTML=`\n
      \n
      \n
      \n
      \n

      \n \n ${e.toolbar.title}\n \n \n \n \n \n

      \n
      \n
      \n \n \n \n \n \n
      \n \n { }\n \n \n \n
      \n \n \n \n
      \n
      \n
      \n
      \n `;let l={root:i.firstElementChild,title:i.querySelector(".matter-demo-title"),header:i.querySelector(".matter-header"),exampleSelect:i.querySelector(".matter-example-select"),buttonReset:i.querySelector(".matter-btn-reset"),buttonSource:i.querySelector(".matter-btn-source"),buttonTools:i.querySelector(".matter-btn-tools"),buttonInspect:i.querySelector(".matter-btn-inspect"),buttonFullscreen:i.querySelector(".matter-btn-fullscreen")};return e.toolbar.title||s.domRemove(l.title),e.toolbar.exampleSelect||s.domRemove(l.exampleSelect.parentElement),e.toolbar.reset||s.domRemove(l.buttonReset),e.toolbar.source||s.domRemove(l.buttonSource),e.toolbar.inspector||s.domRemove(l.buttonInspect),e.toolbar.tools||s.domRemove(l.buttonTools),e.toolbar.fullscreen||s.domRemove(l.buttonFullscreen),l}},function(e,t){e.exports='/*\n*\tMatterTools.Demo\n*/\n\n.matter-demo {\n display: flex;\n background: #14151f;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n height: 100vh;\n padding: 50px 0 0 0;\n}\n\n.matter-demo,\n.matter-demo * {\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.matter-demo *:focus,\n.matter-demo *:active {\n outline: 0;\n}\n\n.matter-demo *:-moz-focusring {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.matter-demo *:focus-visible {\n outline: 3px solid #4da4e4;\n outline-offset: -1px;\n z-index: 5;\n}\n\n.matter-demo.matter-demo-inline {\n padding: 0;\n height: inherit;\n}\n\n.matter-demo canvas {\n border-radius: 8px;\n border: 1px solid rgba(255, 255, 255, 0.07);\n max-width: 100%;\n max-height: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-demo.matter-demo-inline canvas {\n max-height: calc(100% - 49px);\n}\n\n.matter-is-fullscreen .matter-demo {\n width: 100%;\n}\n\n.matter-is-fullscreen .dg.ac,\n.matter-is-fullscreen .ins-container {\n display: none;\n}\n\n.matter-header-outer {\n position: fixed;\n z-index: 100;\n top: 0;\n left: 0;\n right: 0;\n background: #0e0f19;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.matter-demo-inline .matter-header-outer {\n position: static;\n background: transparent;\n z-index: 0;\n width: 100%;\n}\n\n.matter-header {\n width: 100%;\n padding: 7px 20px 8px 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.matter-header-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n\n.matter-header h1 {\n display: none;\n margin: 0 12px 0 0;\n width: 18px;\n overflow: hidden;\n flex-shrink: 0;\n}\n\n.matter-header h1 a {\n color: #c5c5cc;\n font-size: 14px;\n font-weight: 400;\n display: block;\n text-decoration: none;\n padding: 3px 0 2px 0;\n border-bottom: 1px solid transparent;\n white-space: nowrap;\n float: right;\n}\n\n.matter-header h1 a:hover,\n.matter-header h1 a:focus {\n border-bottom: 1px solid #f5b862;\n color: #fff;\n outline: 0;\n}\n\n@media screen and (min-width: 300px) {\n .matter-header h1 {\n display: inline;\n }\n}\n\n@media screen and (min-width: 600px) {\n .matter-header h1 {\n width: auto;\n overflow: visible;\n }\n}\n\n.btn-home {\n display: none;\n}\n\n.matter-demo-title svg {\n fill: #fff;\n width: 14px;\n height: 14px;\n margin: 0px 0 -2px 2px;\n}\n\n.matter-link {\n text-decoration: none;\n line-height: 13px;\n margin: 0 -10px 0 0;\n flex-shrink: 0;\n}\n\n.matter-link:focus {\n outline: none;\n}\n\n.matter-logo {\n height: 33px;\n width: 46px;\n}\n\n@media screen and (min-width: 1024px) {\n .matter-logo {\n width: 50px;\n }\n}\n\n.matter-logo #m-triangle {\n transform-origin: 14px 856px;\n transition: transform 400ms ease;\n}\n\n.matter-link:focus #m-triangle,\n.matter-logo:hover #m-triangle {\n transform: rotate(-30deg) translate(-98px, -25px);\n}\n\n.matter-logo #m-circle {\n transition: transform 200ms ease;\n transition-delay: 300ms;\n}\n\n.matter-link:focus #m-circle,\n.matter-logo:hover #m-circle {\n transform: translate(18px, -33px);\n}\n\n.matter-logo #m-square {\n transition: transform 150ms ease;\n transition-delay: 400ms;\n}\n\n.matter-link:focus #m-square,\n.matter-logo:hover #m-square {\n transform: translate(47px, -2px);\n}\n\n.matter-toolbar {\n flex-grow: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 18px 0 0;\n}\n\n.matter-select {\n background: transparent;\n color: #c5c5cc;\n font-size: 14px;\n line-height: 33px;\n width: 100%;\n outline: none;\n padding: 0 25px 0 7px;\n margin: 0;\n border: 0;\n border-radius: 0;\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-select option {\n background: #fff;\n color: #000;\n}\n\n.matter-select-wrapper {\n height: 33px;\n width: 100%;\n min-width: 100px;\n max-width: 175px;\n position: relative;\n display: inline-block;\n margin-right: 4%;\n}\n\n.matter-select-wrapper:after {\n content: " ";\n display: block;\n position: absolute;\n pointer-events: none;\n width: 28px;\n height: 100%;\n background: linear-gradient(-90deg, rgb(14 15 25), rgb(14 15 25 / 0));\n right: 23px;\n top: 0;\n}\n\n.matter-demo-inline .matter-select-wrapper:after {\n display: none;\n}\n\n.matter-select:hover,\n.matter-select-wrapper:hover .matter-select {\n color: #fff;\n}\n\n.matter-select:focus-visible {\n color: #fff;\n}\n\n.matter-select:-moz-focusring {\n color: #fff;\n}\n\n.matter-select:focus {\n outline: 0;\n}\n\n.matter-select-wrapper svg:hover,\n.matter-select-wrapper:hover svg {\n background: #232635;\n}\n\n.matter-select-wrapper:hover:after svg {\n fill: #fff;\n}\n\n.matter-select-wrapper svg {\n display: block;\n pointer-events: none;\n fill: #cecece;\n width: 20px;\n height: 20px;\n position: absolute;\n z-index: 2;\n top: 6px;\n right: 0;\n border-radius: 5px;\n background: #101119;\n}\n\n.matter-btn {\n border: 0;\n background: #0b0c15;\n width: 40px;\n height: 33px;\n border-radius: 2px;\n display: inline-block;\n font-size: 16px;\n line-height: 1;\n color: #c2cad4;\n text-decoration: none;\n text-align: center;\n cursor: default;\n flex-shrink: 0;\n flex-grow: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.matter-btn svg {\n fill: #fff;\n width: 15px;\n height: 15px;\n margin: 2px 0 0 0;\n}\n\n.matter-demo-inline .matter-btn {\n background: #0f0f13;\n}\n\n.matter-btn:hover {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn:active {\n transform: translate(0px, 1px);\n}\n\n.matter-btn:focus-visible {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn:-moz-focusring {\n background: #1c1f2d;\n outline: none;\n}\n\n.matter-btn-tools {\n position: relative;\n display: none;\n font-size: 15px;\n}\n\n.matter-btn-tools svg {\n margin-left: -3px;\n}\n\n.matter-btn-inspect {\n position: relative;\n display: none;\n}\n\n.matter-btn-inspect svg {\n margin-left: -3px;\n}\n\n.matter-btn-source {\n display: none;\n font-size: 12px;\n text-align: center;\n line-height: 31px;\n}\n\n.matter-btn-fullscreen {\n position: relative;\n font-size: 18px;\n}\n\n.matter-btn-fullscreen svg {\n margin-left: -3px;\n}\n\n.matter-is-fullscreen .matter-btn-tools,\n.matter-is-fullscreen .matter-btn-inspect {\n display: none;\n}\n\n.matter-btn-fullscreen:after,\n.matter-btn-tools:after,\n.matter-btn-inspect:after {\n content: " ";\n position: absolute;\n bottom: 10px;\n width: 3px;\n height: 3px;\n background: #f5df75;\n border-radius: 1px;\n opacity: 0;\n transform: scale(0);\n transition: opacity 100ms ease, transform 100ms ease;\n}\n\n.matter-btn-inspect:after {\n left: 31px;\n}\n\n.matter-btn-tools:after {\n background: #f45f5f;\n left: 28px;\n}\n\n.matter-btn-fullscreen:after {\n background: #76f09b;\n left: 32px;\n}\n\n.matter-is-fullscreen .matter-btn-fullscreen:after,\n.matter-gui-active .matter-btn-tools:after,\n.matter-inspect-active .matter-btn-inspect:after {\n opacity: 1;\n transform: scale(1);\n}\n\n.ins-container,\nbody .dg {\n display: none;\n}\n\n@media screen and (min-width: 500px) {\n .ins-container,\n body .dg,\n .matter-btn-tools,\n .matter-btn-inspect,\n .matter-btn-source {\n display: block;\n }\n}\n'}])},e.exports=r(n("lniP"))}}]); \ No newline at end of file diff --git a/demo/js/matter-demo.matter-wrap.dbda1f.min.js b/demo/js/matter-demo.matter-wrap.f14474.min.js similarity index 98% rename from demo/js/matter-demo.matter-wrap.dbda1f.min.js rename to demo/js/matter-demo.matter-wrap.f14474.min.js index ca167f41..9452efb1 100644 --- a/demo/js/matter-demo.matter-wrap.dbda1f.min.js +++ b/demo/js/matter-demo.matter-wrap.f14474.min.js @@ -1,5 +1,5 @@ /*! - * matter-demo bundle 0.19.0 by @liabru + * matter-demo bundle 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT */ diff --git a/demo/js/matter-demo.pathseg.cf21c2.min.js b/demo/js/matter-demo.pathseg.f137cc.min.js similarity index 99% rename from demo/js/matter-demo.pathseg.cf21c2.min.js rename to demo/js/matter-demo.pathseg.f137cc.min.js index 8116de13..7902cd51 100644 --- a/demo/js/matter-demo.pathseg.cf21c2.min.js +++ b/demo/js/matter-demo.pathseg.f137cc.min.js @@ -1,5 +1,5 @@ /*! - * matter-demo bundle 0.19.0 by @liabru + * matter-demo bundle 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT */ diff --git a/demo/js/matter-demo.poly-decomp.c3d015.min.js b/demo/js/matter-demo.poly-decomp.6b3373.min.js similarity index 99% rename from demo/js/matter-demo.poly-decomp.c3d015.min.js rename to demo/js/matter-demo.poly-decomp.6b3373.min.js index 4be6d4f4..8ae19dfa 100644 --- a/demo/js/matter-demo.poly-decomp.c3d015.min.js +++ b/demo/js/matter-demo.poly-decomp.6b3373.min.js @@ -1,5 +1,5 @@ /*! - * matter-demo bundle 0.19.0 by @liabru + * matter-demo bundle 0.20.0 by @liabru * http://brm.io/matter-js/ * License MIT */ diff --git a/package-lock.json b/package-lock.json index ac2c85d5..85683398 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "matter-js", - "version": "0.19.0", + "version": "0.20.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "matter-js", - "version": "0.19.0", + "version": "0.20.0", "license": "MIT", "devDependencies": { "conventional-changelog-cli": "^2.1.1", diff --git a/package.json b/package.json index bb9a0eea..41464f25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matter-js", - "version": "0.19.0", + "version": "0.20.0", "license": "MIT", "homepage": "http://brm.io/matter-js/", "author": "Liam Brummitt (http://brm.io/)", From acb99b6f8784c809b940f1d2cf745427e088e088 Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 23 Jun 2024 23:22:06 +0100 Subject: [PATCH 2/2] update tests --- test/ExampleWorker.js | 1 + test/TestTools.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/ExampleWorker.js b/test/ExampleWorker.js index 30c9ea1a..11aeb157 100644 --- a/test/ExampleWorker.js +++ b/test/ExampleWorker.js @@ -185,6 +185,7 @@ const prepareEnvironment = options => { height: 600, style: {}, addEventListener: () => {}, + setAttribute: () => {}, getAttribute: name => ({ 'data-pixel-ratio': '1' }[name]), diff --git a/test/TestTools.js b/test/TestTools.js index 6e7108bc..cfff50b6 100644 --- a/test/TestTools.js +++ b/test/TestTools.js @@ -238,7 +238,7 @@ const extrinsicSimilarity = (currentCaptures, referenceCaptures, key='extrinsic' } } - result[name] = 1 - (totalSimilarity / totalCount); + result[name] = 1 - (totalSimilarity / (totalCount || 1)); } return result;