diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index bc487890..00000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -app -sessions \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1f9fff30..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "env": { - "es2021": true, - "browser": true, - "node": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "no-prototype-builtins": "off", - "no-console": "off", - "no-useless-escape": "off", - "no-self-assign": "off", - "no-empty": [ - "error", - { - "allowEmptyCatch": true - } - ], - "no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "space-before-function-paren": [ - "error", - "never" - ], - "indent": [ - "error", - 4, - { - "SwitchCase": 1, - "ObjectExpression": 1, - "ArrayExpression": 1, - "MemberExpression": "off", - "ignoredNodes": ["ConditionalExpression", "TemplateElement"] - } - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single", - { "allowTemplateLiterals": true } - ], - "semi": [ - "error", - "never" - ] - } -} diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml deleted file mode 100644 index 68eaa5f3..00000000 --- a/.forgejo/workflows/build.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build -on: [workflow_dispatch] - -jobs: - Deploy: - runs-on: docker - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - lfs: 'true' - - - name: Docker Login - run: | - docker login -u riksolo -p ${{secrets.CONTAINER_REGISTRY_TOKEN}} git.riksolo.com - - - name: Build and push - run: | - docker build -t git.riksolo.com/riksolo/open-stage-control:latest -t git.riksolo.com/riksolo/open-stage-control:${{github.sha}} . - docker push git.riksolo.com/riksolo/open-stage-control:latest - docker push git.riksolo.com/riksolo/open-stage-control:${{github.sha}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 71086d11..1687d79e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,2 @@ -# npmg node_modules/ - -# build -/app/ - -# python/midi build -src/server/python/* -!src/server/python/*.py - -# docs build -src/docs/widgets-reference.js -properties-reference.md - -# packaging -dist/ -sessions/ \ No newline at end of file +config.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..f9672bfe --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +sudo: required +dist: trusty +language: node_js +node_js: + - "4.1" +before_install: + - sudo dpkg --add-architecture i386 + - sudo apt-get update -qq + - sudo apt-get install -qq wine +install: npm install --save-optional --production +deploy: + provider: releases + api-key: + secure: Nb4qJlmLEE2/ETHEYe8V8eGI08d4GuE5kdQef5ZnB4PrstppLlAjShv5E4DNTsyalMOMDjpw9v+9aQNzxGiGv+lCVVL5oFvqvDpcYusRuF9Qua7oJtFh+5FvjgC1DDjauk5Z7WQWMvzWwfNmqbY/lxPbA4zVy4kdYkGV/8WnzA9AL5fU0ZU8gDsFjcr9Pz81XDsDXtPH/+iMuclMsEl8V/ZuswWlZaFn1Jnb1tcGC5WUCsuNQo/+gGfSK6Qcf9AKsIrOjdzi55s4jqH1N7P/kKi4a2tWUTwmSLrOxdUmSYjXVOxMu0cAEnHSeYREv/5o6J0MbfQrDoxh2y5roPZzqE+FAuFLl+b/+bYlW0mrfYfSuP/VX9LYh5JSvrhN7rZuUfMqS1iM7c9Dx8sZadMnvYEAAJhH8IV/9SkuRa/8QoIpXf7YB9v1jERxs4gk5CPT5Aml6nY/CvMWiEQ/wJhC7iZd/QRHshgfNLfAGlbbNU2KP6ZsVAGD601fyST/8neoQqLqS9mteOr1QME3c5EFw+XaauIQNYZSl+wJr8Y1YMcKY+fbJqqR0TXkbsoxFgV9PRf/4ZCjIJYtmelQVlM7j20XavOHM/Ko6/y7a3pohFz+ql3YR9jGF5XW2foXb4+e6DwTGL91/f75hYcsvXxoKbeaBjWpaSK8532UTeVkhPM= + file: + - "./dist/open-stage-control-i386.deb" + - "./dist/open-stage-control-amd64.deb" + - "./dist/open-stage-control-armv7l.deb" + - "./dist/open-stage-control-linux-ia32.zip" + - "./dist/open-stage-control-linux-x64.zip" + - "./dist/open-stage-control-linux-armv7l.zip" + - "./dist/open-stage-control-osx.zip" + - "./dist/open-stage-control-win32.zip" + - "./dist/open-stage-control-win64.zip" + skip_cleanup: true + on: + tags: true +before_deploy: + - cd dist + - zip -q -r --symlinks open-stage-control-osx open-stage-control-darwin-x64/open-stage-control.app + - zip -q -r open-stage-control-win32 open-stage-control-win32-ia32 + - zip -q -r open-stage-control-win64 open-stage-control-win32-x64 + - zip -q -r open-stage-control-linux-ia32 open-stage-control-linux-ia32 + - zip -q -r open-stage-control-linux-x64 open-stage-control-linux-x64 + - zip -q -r open-stage-control-linux-armv7l open-stage-control-linux-armv7l + - cd .. + - npm run deb32 + - npm run deb64 + - npm run debarm + - mv dist/open-stage-control-linux-ia32/*.deb dist/open-stage-control-i386.deb + - mv dist/open-stage-control-linux-x64/*.deb dist/open-stage-control-amd64.deb + - mv dist/open-stage-control-linux-armv7l/*.deb dist/open-stage-control-armv7l.deb diff --git a/AI_POLICY.md b/AI_POLICY.md deleted file mode 100644 index 20067a2d..00000000 --- a/AI_POLICY.md +++ /dev/null @@ -1,7 +0,0 @@ -Anything AI-related is strictly prohibited from this project. - -If you think this project could benefit from a smart use of AI, think harder. - -Think harder about the (hundreds of) millions of data workers that make your AI "smart", not to mention the monumental ecological waste it represents. - -If you still think this way, don't tell me. diff --git a/CHANGELOG.md b/CHANGELOG.md index ff189256..deb7d0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1778 +1,197 @@ # Changelog -## 1.31.2 +## 0.6.2 + +- cool stuff + - armv7l prebuilt binaries ! (raspberry 2, etc) +- engine + - electron 1.3.5 + +## 0.6.1 - bug fixes - - editor: fix regression (1.30.0) causing errors when editing the value property + - editor: widgets/tabs can be accessed through their parent's children list (#27) +- engine + - electron 1.3.1 -- widgets - - canvas: allow `onResize` to send and trigger widget synchronization and scripts - -## 1.31.1 +## 0.6.0 - bug fixes - - clone: regression causing error when some widgets have a non-string id - -## 1.31.0 - -- widgets - - clone, fragment: add `scoped` property. This allows making the widget self-contained (independent from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) - -- bug fixes - - midi: unrecognized `no_auto_note_off` option - - MacOs: the app now quits when all windows are closed - - launcher: if the Tray icon is enabled, closing the launcher window won't quit the app if the server is running - - scrollbar widget: fix initial value in vertical mode - - console: fix copying using CmdOrCtrl+C when the editor is enabled - -- custom module - - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) - -## 1.30.4 - -- bug fixes - - remote control: add support for icon transform suffixes - - editor: fix moving/resing widgets inside folders when using percent units - - clone: `@{parent.propertyName}` blocks in target widget now update when clone's parent property updates - -- widgets - - encoder: add `horizontal` mode - - knob: add `encoder` design - -## 1.30.3 - -- bug fixes - - scrollbar: missing update upon target container resize - - server: regression breaking reception of osc message over tcp - -- widgets - - file: remember last visited directy per widget if `directory` property is not set - - knob: add `horizontal` mode - - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. - - plot, eq: unclip line drawing on y-axis - -- scripting - - add `uploadFile` function for reading client-side files - - add `scrollIntoView` function - -## 1.30.2 - -- bug fixes - - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts - - rgb: fix rendering issue - - patchbay: interaction and rendering issues - - `event.preventDefault` in `onTouch` now affect modal buttons - - menu: use click event instead of tap in `toggle` and `doubleTap-toggle` modes - - button: missing `move` events in `onTouch` - - error when logging `event` object in `onTouch` - -- widgets - - modal/button/file: add `click` property - -- editor - - preserve code editor undo history between consecutive edits of a same widget's property - - preserve fullscreen code editor focus when saving / submitting - -- client - - add `noWarning` client option - -## 1.30.1 - -- bug fixes - - regression breaking user asset loading from a root directory named "assets" - - regression breaking custom module's `nativeRequire()` for locally installed modules - -## 1.30.0 - -- bug fixes - - server: fix resolving absolute file urls containing the remote-root path - - prevent editor zoom level from affecting drag events when the editor is disabled - - prevent changing editor zoom level when it's disabled - - fader: fix touchZone == knob for compact design - - separator labels missing in inspector - - make the client app more robust to restrictive browser settings (cookie must still be enabled for the app to fully work) - -- widgets - - the html property is no longer restricted / sanitized - - input/textarea/select no longer have their appearance property reset in custom html - - canvas: added `contextType` property - - file: honor server's `remote-root` option (remove root path from displayed path and returned value) - - menu: changed default `layout` to `vertical` - - root/panel/modal/tab: support setting `scroll` to `hidden` (hides scrollbars and allows scrolling) - - add new `scrollbar` widget that connects to a scrolling container widget and acts as it scrollbar - - input: add `noCanvas` option to avoid blurry text under some circumstances - - xy: add `clipX` and `clipY` proprties (allows multixy to set per-pads anges limits) - - button: add `onTouch` script - - switch: make `values` property dynamic - -- editor - - selecting a widget automatically shows it in the widget tree if it's not minimized - - submitting an unchanged value for the `value` property will now affect the value state of the widget even if the property content itself did not change - -- scripting - - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) - - `toolbar()` can now target menu actions by id instead of index - - `getToolbar()` function added (returns the state of a menu entry toggle) - - calling `setFocus()` without argument now unfocuses current active element - -- midi - - add `no_auto_note_off` option - - add `Restart backend` action to the launcher's menu - - add `restartMidiBackend()` function to custom module context - -- breaking change - - dropped support for iOS 10.3 - - minimum chromium version requirement raised to 70 - - macOS 11 (Big Sur) or above is now required (the node package will work on older system) - - scrollbars are no longer emulated on iOS - - scrollbar styling is now done using only the standard css scrollbar-* properties) to be more in line with system scrollbars in general - - panels no longer use their value to set/get their scrolling state, nor do they sync scrolling automatically. Instead there's now a dedicated scrollbar widget that can be used for this. - -- misc - - now using electron v36.9.5 - -## 1.29.9 - -- build - - fix building from sources now that open stage control is not hosted on github - -- scripting - - user scripts are longer protected against infinite loop - -## 1.29.8 - -- bug fixes - - firefox: `onTouch` error when the cursor goes outside the page - - dropdown: label not initialized until a value is set - - editor: regression (1.29.0) preventing color changes made with the color to be undoable unless validaed with the enter key - - editor: color picker interaction issue in near #000000 - - rgb: incoming values were not queued when during user interaction - -- client - - add `title` client option - -## 1.29.7 - -- launcher - - add tray icon and menu (landed in 1.29.6 accidentally), disabled by default (can be enabled from the launcher's menu) - - -## 1.29.6 - -- bug fixes - - matrix: prevent error when `quantity` is invalid - - multixy/xy: send value when setting `spring` to `true` (only if current value is different than spring value) - - switch/menu/fader: more consistent rendering when `borderRadius` is set - -- widgets - - multixy/xy: add `stepsX` and `stepsY` properties - -- misc - - native silicon buids (osx-arm64) - -## 1.29.5 - -- bug fixes - - keyboard: regression (1.27.5) breaking `velocity` property - - editor: retain scroll position in code editors - - cli: regression (1.28) preventing from setting options from a terminal on windows - - -## 1.29.4 - -- bug fixes - - regression (1.29.3) breaking some widget recreation routines - -## 1.29.3 - -- widgets - - frame: add `allow` property - - matrix: make `quantity` a dynamic property to avoid losing widget state when it changes - - patchbay: missing `preArgs` implementation - -## 1.29.1 / 1.29.2 - -- bug fixes - - scripting: `setFocus` not working on iOS - - fader/range: drawing error with `pips` enabled - -## 1.29.0 - -- bug fixes - - file browser: drive listing failing on recent windows - - root: `hideMenu` not working when `--read-only` is set - - combining `--read-only` and `--fullscreen` now disables `F11` on built-in client - - regression breaking `pips` for range widget - -- widgets - - add `onTouch` to all container widgets - - allow starting a traversing gesture outside a touchable widget - - fader: make `knobSize` dynamic - -## 1.28.5 - -- bug fixes - - multixy: error when `points` is `0` (or empty array) (again) - -## 1.28.4 - -- bug fixes - - multixy: error when `points` is `0` (or empty array) - -## 1.28.3 - -- bug fixes - - multixy: correclty handle incoming feedback values and simultaneous touch releases - -## 1.28.2 - -- bug fixes - - regression in feedback handling (unfixes multixy simultaneous spring issue temporarily) - -## 1.28.1 - -- bug fixes - - eq: `highpass` filter not working as expected with `poles` set - - fader: `touchZone` not applied to `doubleTap` events - - fader: `touchZone` not affecting mousewheel interactions - - fader: regression causing issues with `onTouch` scripts - -## 1.28.0 - -- bug fixes - - ui: global zoom (CmdOrCtrl + scroll / + / - / 0) issues and conflits with native browser zoom; - - ui: limit ctrl + scroll zoom speed - - broken cli when `ELECTRON_RUN_AS_NODE` is set - - inspector: input bug when a code editor was focused using the tab key - - inspector: prevent editing non-editable widgets (e.g matrix items) when clicking on their ids in error logs - - multixy: simultaneous touch releases not working correctly when `spring` is set and feedback values are received shortly after being sent - -- widgets - - fader: add `touchZone` property to allow restricting interaction to a part of the widget - - eq: add support for n-poles lowpass and highpass filters with the filter's `poles` property - - eq: adapt sampling frequency to the x-axis range - - xy/multixy: add `auto` choice to `axisLock` (locks on the first moved axis) - - file: `extension` can now be an array of strings - - plot/eq: smoother curves - - sliders/pads: `doubleTap` can now be `"script"`, in which case `onTouch` will be called with `event.type` set to `doubleTap` - - xy: add `label` property - - multixy: add `padsAttr` property for per-pad customization - - panel: `tabsPosition` can now be `hidden` - - pads: support percents in `pointSize` - -- scripting - - `console.log` now always print the id of the widget that called it - -- editor - - inspector: tab key navigation now works, property categories can be fold/unfold with enter/space when focused - - inspector: `F2` now focuses the `html` property in the inpector if `label` is not present - - tree: add `mod + f` to focus the search input - - - -## 1.27.5 - -- bug fixes - - patchbay: layout issue - - widget: regression causing error when emptying the css property and leaving only class declarations - - modal: incorrect position in scrolled containers when `relative` is `true` - - menu: incorrect position in scrlled containers depending on menu's alignment - - button: `locals.touchCoords` not updated upon release and incorrect when `doubleTap` is set - -## 1.27.4 - -- bug fixes - - fader: pips drawing issue causing small a position offset or errors with some browsers - - script: setFocus not working with textarea widgets - -## 1.27.3 - -- bug fixes - - regression causing circular loop errors upon certain editions - - fader: glitch with large `lineWidth` values in default design mode - -## 1.27.2 - -- bug fixes - - multixy: `default` not applied when points are named - - clone: avoid some unnecessary property checks - - clone: prevent missing editions in target properties (e.g. VAR{} renamed with the same return value) - -- client - - show 3-dots menu in read-only mode with access to allowed items (e.g fullscreen) - - hide console in read-only mode - -- widgets - - matrix: don't implicitely override children's `label`, do it explicitely in `props`' default - -- custom module - - `receive()` and `send()` now accept `host` and `port` to be provided as a single string argument joined by a colon - -## 1.27.1 - -- bug fixes - - server: `fullscreen` option not working when `read-only` is set - - led and text widgets not client-syncing - - patchbay: `address` not working properly when set to `auto` - - patchbay: `ignoreDefaults` not working properly - - editor: missing position indicator in color picker pad - - file browser: fallback to home directory when last visited directory is not accessible - -- mobile - - apply root's (or themes) background color the the browser's topbar when possible - - -## 1.27.0 - -- bug fixes - - app address / qr code not updating when network changes - - issue after theme auto reload (broken grid, colors not updated) - -- widgets - - pads: expose css variable `--point-size` - -- custom module - - provide error backtraces in module.exports functions - - add `reload()` callback to provide finer control over the module's lifecycle - - add `stop()` callback (runs when the server stops) - -- remote control - - add /SESSION/CREATE command - -- client - - file browser now remembers the last displayed directory - - allow dismissing notifications by clicking on them - - allow toggling notifications globally from main menu - - add `notifications` client option - -## 1.26.2 - -- bug fixes - - user resources not loading when using an external browser - - advanced syntaxes resolution order issue - -- advanced syntaxes - - display an error in the console in some unsupported advanced syntaxes use cases - -## 1.26.1 - -- bug fixes - - mac: unable to show launcher windows when starting minimized - -## 1.26.0 - -- bug fixes - - scripting: `getProp()` now correctly returns a copy of the property if it is an object - - prevent infinite loop when loading widgets with complex inter-dependencies - - modal: layout issue on iOS 15+ - -- widgets - - dropdown: allow resubmitting the same value - - switch: allow resubmitting the same value - - plot: missing `logScaleX` and `logScaleY` properties - - xy/multixy: add `axisLock` property; allow locking one the axis by holding `Shift` while dragging if `axisLock` is not set, bypasses it otherwise. - - knob/fader/range: add `colorKnob` property - -- launcher - - on Mac, start hidden if `Start minimized` is set - - allow dropping files into file fields - -- custom module - - expose `tcpServer` to allow monitoring the state of tcp connections - -## 1.25.7 - -- bug fixes - - rare issue that made the last widget(s) in a container disappear when other widgets in the same container had a specific property dependency pattern - -- remote control - - `/EDIT*` commands sent by a custom module are not affected by the server's `read-only` option anymore - -- widgets - - input: allow using a number in `numeric` to specify stepping value for mousewheel interaction - - root: add `onPreload` scripting property - -## 1.25.6 - -- bug fixes - - sliders: error when `steps` is an array - -- scripting - - `stateSet`: add optional `{send: false}` flag - -## 1.25.5 - -- bug fixes - - code editor: issue when middle clicking in the editor on linux - - code editor: modern js operators such as `**` not recognized - - sliders: prevent error when `steps` is not a number, add `auto` mode for using ranges values as steps (it did not work before) - - pads, range: value not initialized as an array, causing errors in some cases - - modal: popup not closing when `doubleTap` is true - -## 1.25.4 - -- bug fixes - - custom module: `receive()` not passing boolean arguments properly - - fix `--authentication` on iOS clients - -- editor - - display current widget value in the `value` property's help modal - -## 1.25.3 - -- bug fixes - - input: rendering issues with big font sizes - - panel: tab rendering issue when initialized with a non-numeric value - - panel: minor style issue in tab navigation bar - - scripting: scripting functions not working inside `browseFile()` callback - - scripting: using `external: true` in `set()` should prevent affected widget from sending any message - - button: inconsistent value in `push` mode with `decoupled` enabled when setting value from script - -## 1.25.2 - -- bug fixes - - textarea: escape key not restoring previous value - - scripting: `setFocus(id)` not affecting textarea widgets - - led, text, variable: value not synchronized between different clients - - error when running from sources on Mac - -## 1.25.1 - -- bug fixes - - regression in inter-widget sync mechanism - - regression breaking `set()` function in scripts - - textarea: display nothing instead of "null" when receing no value, null or an empty string - -## 1.25.0 - -- bug fixes - - multixy: doubleTap not working on touch devices - - button: `x` and `y` variables not passed to `onValue` when `doubleTap` is true on touch devices - - advanced syntax: update issue with clones using their own value in their properties - - client: minor keyboard shortcut issues - - panel: mitigate client synchronization issue with scrollbars - -- widgets - - menu: add a background to menu items to help distinguish them - - menu: merge different interaction modes into a single `mode` property - - menu: add `swipe` mode - -- remote control - - `/STATE/SET`: add optional argument to prevent widgets from sending their value - -## 1.24.2 - -- bug fixes - - editor: regression breaking widget context menu actions under "Position" submenu - - touch devices: touchend event not fired on elements removed/detached during touchstart/touchmove callbacks (caused issues when switching tabs using a button inside a tab) - - -## 1.24.1 - -- bug fixes - - launcher: `Ctrl+M` keyboard shortcut not working - - widgets: regression incurring a small delay before resolving a property that depends on a widget's own value - - server: `--client-size` and `--client-position` options not parsed correctly - -- advanced syntaxes - - support `@{}` inside `IMPORT{}` - -## 1.24.0 - -- bug fixes - - widgets: circular value feedback issues - - editor: `ctrl + e` not working when hit multiple times without releasing `ctrl` - - mobile: "prevent sleep" feature not working - -- widgets - - patchbay: add `in`, `out` and `both` modes to `exclusive` property - - panel: replace `verticalTabs` property with `tabsPosition` (supports 4 directions) - -- custom module - - add optional `errorCallback` argument to`loadJSON` and `saveJSON` - -- server - - print multiple qrcodes if multiple network interfaces are available and prevent printing a qrcode for the localhost address - -- misc - - add linux rpm packages - -## 1.23.0 - -- bug fixes - - linkId not working between two encoder widgets - - fader: `gradient` breakpoints not positioned correctly - - canvas: `onDraw()` called twice when calling `updateCanvas()` - -- midi - - optional rpn/nrpn parsing as single messages - -- widgets - - keyboard: incoming values different than the `off` property are now interpreted as `on` - -- editor - - when focusing the label property with `F2`, select all text in the text area - - preserve scroll position in code editor when validating - - display the id of selected widget in the inspector's header - -- scripting - - expose file browser (from the file widget) as a scripting function - -- custom module - - don't restrict file extension in `loadJSON()` and `saveJSON` functions - -- misc - - add polish locales (@ Manz4rk) - - add css classes to some notification popups to allow targetting them with css themes - -## 1.22.0 - -- bug fixes - - keyboard widget: `linkId` not working (unable to link 2 keyboard widgets) - - slides: issues with ranges containing decimal keys - -- launcher - - add menu options to show the qr code again - - mac: change "List MIDI devices" keyboard shortcut to `Ctrl+m` - -- widgets - - image: add support for special value "qrcode" - -- misc - - add german locales (@ Magnus Reichel) - - package file names changed to follow debian's convention - - add a cli option to disable the qr code (`--no-qrcode`) - -## 1.21.0 - -- bug fixes - - custom module: fix autoreload on nested submodules - -- launcher - - print a qrcode when the server starts to help connecting mobile devices - -- editor - - horizontal scrolling issues with maximized code editor - -- widgets - - switch/menu/dropdown: add a syntax that supports duplicate labels in `values` property - -- custom module - - expose `global` object that persists accross module reloads. - -- scripting - - onCreate: expose `value` - -## 1.20.0 - -- bug fixes - - scripting: prevent some functions to be marked as undefined - - advanced syntaxes: ignores quotes around file path in `IMPORT{}` - -- launcher - - add `Start minimized` menu option - -- misc - - change noFocus client option behavior: the default client window now doesn't take the focus at all, even when a text input is clicked. - - colorize debug messages for sent and received osc/midi messages - -- scripting - - add `setFocusable()` function to change the focusability of the window on the fly (allows reenabling focus temporarily to interact with a text widget using a dedicated toggle button for example) - - add `reload()` function - - expose Navigator object with `getNavigator()` - -- widgets - - fragment: add `fallback` property - -## 1.19.2 - -- bug fixes - - regression breaking touch move events on desktop touchscreens - -## 1.19.1 - -- bug fixes - - editor zoom: adjust root widget size when zooming out - -## 1.19.0 - -- editor - - add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed - - inspector: add some shortcut buttons in the header - -- widgets - - add folder widget (flat container that doesn't affect layout) - - input: add `maxLength` property - - multixy: allow setting its own value from onValue script while touched - + - pasted widget properly use the pointer's position + - traversing gestures are effective from the first touch, not after the first move + - out-of-range values are properly clipped by faders/knob - ui - - add a virtual onscreen keyboard for desktop clients (can be enabled from the clients main menu) - - change local zoom (alt+scroll) behavior so that it only affect widgets and add scrollbars to navigate while zooming instead of following the mouse - -- server - - client-options: add `virtualKeyboard` option to enable virtual keyboard by default (desktop clients only) - -## 1.18.3 - -- bug fixes - - button: regression in push mode (`on` value not passed to `onValue` script when triggered from another widget) - - button: decoupled push mode returning wrong value when activated from a widget script - -## 1.18.2 - -- bug fixes - - canvas: `onTouch` not triggered on iOS when when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` changes - - switch: interaction issue when value labels contain icons - - ios: attempt to fix rendering glitch when waking up after sleep - -## 1.18.1 - -- widgets - - button: add `decoupled` property, compatible with all button modes - - button: remove `decoupled` mode - -## 1.18.0 - -- bug fixes - - client script source map not loading (helps providing useful error messages) - -- widgets - - button: add `decoupled` mode (toggle mode that only updates its state when it receives a value from osc/midi messages) - - button: add client option `altTraversing` to allow one-way response to traversing gestures for toggle buttons - - canvas: iOS: trigger `onTouch` when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` updates - - knob: add `snap-alt` mode (snap mode that allows jumping between range.min and range.max) - - all: add `borderRadius` property - -- scripting - - add `updateCanvas()` function (forces a canvas widget to redraw) - -- remote control - - `/NOTIFY`: if multiple arguments are provided, interpret the first one as the icon's name for the client notification - -- midi - - on Mac, name virtual ports after the device name to avoid confusion - -- server - - client-options: add `clientSync` option to allow disabling client synchronization - - client-options: add `altTraversing` option - -- editor - - add `F2` keyboard shortcut to bring label property input into view if selected widget has one - -## 1.17.0 - -- bug fixes - - editor: error when ctrl+clicking on a root's child - - range: multitouch interaction issue - -- widget - - knob / encoder: `sensitivity` and ctrl+drag gesture preserve `circular` mode behavior - - knob / encoder: `snap` mode now works like `circular` mode except for the touch start event (value can't jump from start to end anymore) - - patchbay: add `exclusive` option - -- editor - - allow interacting with a widget without selecting it by using the middle mouse button or by holding shift+win (shift+cmd on mac). - -## 1.16.6 - -- bug fixes - - visibility property update issues - -## 1.16.4 - -- bug fixes - - modal: display issue when a modal receives the same value multiple times - - patchbay: `outputs` property not handling object value properly - - server: resolution conflict between app files and user files - -- widgets - - patchbay: trigger `onValue` script when a connection changes - + - Faders & Meters design improved + - The main font (droid sans) is now loaded... + - Knob's sizing got smarter + - Widgets don't blink not jump when they appear for the first time or when they resize - misc - - windows: allow accessing other drives than the default one (list drives when the file browser reaches the filesystem's root) + - Fader's `align` option replaced with boolean option `alignRight` + - Widget's `label` now accepts special directive `icon: fontawesome-class` to display icons from [FontAwesome](http://fontawesome.io/icons/) + - Text widget `defaultText` option added +- engine + - electron 1.2.2 -## 1.16.3 +## 0.5.4 - bug fixes - - custom module: submodules not loading their own submodules with relative paths properly - - custom module: issue with circular submodule requires - - server: harmless error message when importing css files from the main theme file - - server: allow using folder names "client" and "assets" for user files (eg for images used in a session) - -- widgets - - canvas: add `onResize` script property - - scripting: expose javascript's `Image` constructor - -## 1.16.2 - -- bug fixes - - widget visibility not updated properly when set as a non-boolean value - -- widgets - - tabs: detach hidden tabs from the DOM (reduces lag caused by heavy tabs) - -## 1.16.1 - -- bug fixes - - eq widgets not properly converted when importing v0 sessions - - image paths with url queries not loaded properly - - @{} syntax not returning truncated value according to the widget's precision property (fixed for primitive values only, object values are still returned as is) - -## 1.16.0 - -- advanced syntaxes - - `@{}` and `VAR{}` that return objects / arrays do not return a copy of their value anymore as it may introduce a significant overhead when used extensively. Mutating these objects in `#{}` and `JS{}` scripts will now affect the actual values and should be avoided at all cost. -- widgets - - `comments` property flagged as dynamic - - multixy: add `doubleTap` property - -## 1.15.8 - -- bug fixes - - range: value update issue (internal touch state not updated properly) - - scripting: send(): ignore `ignoreDefaults` property - - script: onKeyboard script not cleaned upon edition / removal - - editor: some variables not appearing as defined in `onKeyboard` - -## 1.15.7 - -- bug fixes - - matrix: property resolution issue with object/array items in `props` - - bypass client option `nofocus=1` when the editor is enabled - - menu/dropdown: display label when value is undefined - -- misc - - updated midi bridge: provide more information when loading fails; may fix some compatibility issue on windows - -## 1.15.6 - -- bug fixes - - ios: prevent server error related to the use of cookies - - scripting: `getVar()` now returns a copy of the variable to prevent mutations on saved object - -## 1.15.5 - -- bug fixes - - matrix: advanced property issue in `props` property (bis) - -- editor - - inspector: add solo mode with `alt+click` for category panels - -## 1.15.4 - -- bug fixes - - matrix: advanced property issue in `props` property - -## 1.15.3 - -- bug fixes - - interaction issue ("deadzone") on touch screens - - main menu not hidden when `read-only` is set - - osc messages containing unicode characters not encoded correctly - -## 1.15.2 - -- bug fixes - - modal: scroll state not restored when the modal container is recreated - - server: allow spaces and accentuated characters in client id - -## 1.15.1 - -- bug fixes - - prevent flickering on canvas based widgets when they are recreated - -- editor - - added code editor for `html` and `css` properties - -- remote control - - add `/RELOAD` command - -## 1.15.0 - -- bug fixes - - editor: prevent accessing non-editable widgets with right arrow - - multixy: regression causing interaction issue - -- widgets - - add `lock` property to all widgets - -- launcher - - add `Autostart` menu option - -- misc - - update FontAwesome icon font to version 6 - -## 1.14.6 - -- bug fixes - - inspector: script editor: cursor alignment issue in indented lines - - clone: prevent freeze and print an error when attempting to create a circular clone - - modal: regression on android that prevents focusing input widgets in modals - -## 1.14.5 - -- bug fixes - - session loading error with some malformed property cases - -## 1.14.4 - -- bug fixes - - broken console interpreter since v1.14.0 - -- widgets - - button: add `momentary` mode for sending messages with no value; prevent button from getting stuck when `on` and `off` are equal in `momentary` and `tap` modes - -- inspector - - color picker: inline picker widget (no longer in a modal); show color changes on the fly - - code editor: validate input with `cmd+enter` instead of `ctrl+enter` on Mac - -- scripting - - `screen.height` and `screen.width` always returns the current screen dimensions - - added `screen.orientation` global variable - -- misc - - some performance improvements - -## 1.14.3 - -- bug fixes - - osc receivers (`OSC{}` syntax) now apply the same rule as widgets regarding midi messages (only receive if the message's origin matches one of the host widget's midi targets) - - modal: rendering issue on iOS - - button: `locals.touchCoords` not updated since v1.14.0 - -- widgets - - clone/fragment: remove scripting properties as they are supposed to be overridden in `props` - -## 1.14.2 - -- bug fixes - - context-menu: double click issue in submenus on small touch screens - - clone/fragment: broken onDraw / onTouch scripts if cloned widget is a canvas - -## 1.14.0, 1.14.1 - -- bug fixes - - misc: sending typed arguments (`{type, value}` objects) should override the widget's `typeTags` definition - - multixy: errors when `ephemeral` is `true` - - scripting: `setVar` not affecting all widgets when multiple widgets match provided id - -- widgets - - renamed `script` property to `onValue`, `draw` to `onDraw`, `touch` to `onTouch` - - added `onCreate` script property to all widgets - - added `onTouch` script to widgets that supported the touch state variable in scripts (now deprecated) - - script: added `onKeyboard` property, removed `event` property - - canvas: expose additional touch event informations (`radiusX`, `radiusY`, `rotationAngle` and iOS-only `altitudeAngle`, `azimuthAngle` and `touchType`) - -- scripting - - special keyword `this` now returns the string `"this"` - -- advanced syntaxes - - added `IMPORT{file}` syntax to allow loading external files in properties - -- editor - - add fullscreen mode for properties with code editor enabled - -## 1.13.2 - -- bug fixes - - editor: keep relative sizes and positions when resizing multiple widgets at a time - -- widgets - - canvas: expose touch pressure (as `event.force`) in the `touch` script. - - canvas: expose touch events for extra elements added with the `html` property - -## 1.13.1 - -- bug fixes - - editor: data loss when leaving the editor's focus with no modifications - -## 1.13.0 - -- bug fixes - - scripting: `storage.getItem()` not returning anything - -- editor - - new code editor for `script`, `touch`, `draw` and `props` properties with syntax highlighting, line numbers, etc - -- scripting - - `set()`: add an option to prevent target widget's script - -- widgets - - root: add `hideMenu` property - -- misc - - minor cosmetic changes - -## 1.12.0 - -- widgets - - new **canvas** widget (under `pads`): allows creating custom widgets - - button: expose normalized touch coordinates in scripts as `locals.touchCoords` - - print a warning in the console when using advanced syntaxes in the script property - -## 1.11.1 - -- bug fixes - - client options specified in server config not working unless lowercased - - make disconnection detection less aggressive (don't display notification if reconnection succeeds quickly) - - panel: initial scroll state issue - -## 1.11.0 - -- bug fixes - - menu: interaction issue on iOS - - script: prevent script functions from being called in the wrong scope (ie when leaked using the `globals` object) and print an explicit error - - containers: prevent errors with some color formats in colorWidget - - theme: relative url not resolved correctly - -- widgets - - when a panel contains widgets and has `scroll` set to `true`, its value will be used to represent the scroll position for x-axis and y-axis between 0 and 1. - -## 1.10.3 - -- bug fixes - - config not persistent on windows - -- misc - - read-only mode now hides and disables the main menu - -## 1.10.2 - -- bug fixes - - certificate expiration issue - - regression breaking colors in canvas-based widgets - -## 1.10.0 - -- bug fixes - - sliders: ignore key order in `range` - - sliders: handle mousewheel increment when starting from a value between two steps with `steps` property defined - - inspector: allow scrolling in the help modal - - console: fix command history behavior and increase history size - -- widgets - - encoder: expose angle in script (as `locals.angle`) - - new textarea widget (multi line input) - - expose the computed dimensions of canvas-based widgets in `css` (as `--widget-width` and `--widget-height`) and `script` (as `locals.width` and `locals.height`) - -- client - - add `Save backup` menu action (saves a backup copy of current session with an incremented suffix appended to the file name) - -## 1.9.14 - -- bug fixes - - modal: remove `html` property - - matrix: nested property inheritance (eg. `@{id_@{id_x}}`) not working in `props` - -## 1.9.13 - -- bug fixes - - nested property inheritance (eg. `@{id_@{id_x}}`) not updating properly - - canvas based widgets not updating when hidden - -## 1.9.12 - -- bug fixes - - client options: options ignored if not lowercased - - sliders: prevent errors for some edge-case `range` values - -## 1.9.11 - -- bug fixes - - range: value not properly updated with set() - -- misc - - (built-in client only) add `nofocus` client option to prevent the client window from taking focus unless a text input or a dropdown is clicked. - - -## 1.9.10 - -- bug fixes - - matrix: regression from 1.9.8 (broken nested @{} syntax in props property) - -- misc - - midi: detect missing binary (eg when deleted by antivirus) and print a message - -## 1.9.9 - -- bug fixes - - matrix: regression from 1.9.8 - -## 1.9.8 - -- bug fixes - - matrix: update children when `props` is modified even when the result for `$ = 0` doesn't change - - fragments: fragment widgets empty when reloading - - panel: scrollbar issue on iOS 13+ - -- scripting - - expose `console.clear()` - -## 1.9.7 - -- bug fixes - - issue when resizing widget using keyboard shortcuts - - advanced syntaxes (VAR{}): avoid storing default value as string if it can be parsed as a javascript primitive (boolean, number, etc) - - advanced syntaxes (VAR{}): ignore quotes around variable name - -- editor - - change keyboard shortcuts for moving widgets (now `mod + arrows`) and navigating in widgets (now `arrows`) to feel more natural with the project tree view. - -- widgets - - script: bypass keyboard shortcuts already used by the editor if it is enabled - - matrix: removed ambiguous `start` property - - matrix: advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket - - text: add `soft` mode for the `wrap` property - - input: improve `numeric` mode on iOS - -## 1.9.6 - -- bug fixes - - advanced syntaxes: `VAR{}` not updating when the default value is edited - - editor: fix "Bring to front" and "Send to back" context menu actions - + - [desktop] menu bar auto-hide + - [headless] multitouch support - ui - - add keyboard shortcuts `mod + "+"` and `mod + "-"` to control zoom level + - [mobile] better faders pips rendering + - fixed horizontal fader knob centering + - [mobile] better numeric inputs rendering (not blurred anymore) +- engine + - [desktop] electron 1.2.0 (chrome 51) -- widgets - - input: add `numeric` property (allows numeric values only and displays numeric keyboard on mobile devices) - - button: add `soft` mode for the `wrap` property - - switch: add `wrap` property - -- editor - - display dropdown and checkbox for boolean properties with extra choices - -## 1.9.5 +## 0.5.3 - bug fixes - - advanced syntaxes: various issues and regressions - - editor: preserve advanced syntaxes in `left` and `top` when pasting a widget - -- editor - - tree: update widget visibility when it changes dynamically - -## 1.9.4 - -- bug fixes - - prevent error with empty `OSC{}` blocks - - regression breaking advanced syntax blocks containing nested brackets - -- advanced syntaxes - - new syntax for creating and using custom variables in properties: `VAR{name, default}` - - `JS{}` blocks don't require 2 brackets anymore (`JS\{\{}}` still works) - -- scripting - - add `getVar()` and `setVar()` for reading and modifying custom variables. This allows modifying properties directly from scripts (if they contain `VAR{}` blocks). - - expose session path as `globals.session` - -- editor - - make tree item blink when hitting "Show in tree" - -- remote control - - add `/SCRIPT` command to run scripts remotely - -## 1.9.3 - -- bug fixes - - scripting: set() not working from a slider to a pad - - tabs not sending messages / triggering scripts when clicked in editing mode - - prevent hang with some syntax errors in advanced syntaxes - - don't show project tree if minimized when creating a new widget (1.9.2 regression) - - fix "ID + 1" paste for widgets with numeric ids - - dropdown: reset the underlying dropdown when the widget's value is undefined - -- editor - - tree: allow specifying multiple type filters - - tree: add "Show in session" context menu action - -## 1.9.2 - -- bug fixes - - visualizer: remove `bars` and `dots` option - - plot: fix `bars` option - - project tree: clear filter input when loading a session - - server: fix serving files from paths containing accents - - editor: keep editor open when loading a session - - menu: prevent clipping in container on iOS - -- widgets - - image: add pre defined values for `size`, `position` and `repeat` properties - - text: add vertical alignment choices to `align` - -- editor - - tree: add icons before widget ids depending on the category - - tree: activate tab when selecting it in the project tree - - tree: allow dragging widgets from a container to another - - tree: expand container when a new widget is created inside it - - tree: add support for filtering widgets by type (by typing `type:fader` for example) - - smarter shift+drag selection: allow selecting widgets in the area when the event started on the parent container - - select newly created widgets/tab except when copy-pasting - -- remote control - - add `/STATE/SEND` command - -## 1.9.1 - -- bug fixes - - button: allow writing strings like `"1.0"` in `label` without removing the decimals - - editor: use css variable `--grid-width` at startup and after disabling & enabling the grid - - launcher: regression preventing server halt when built-in client is closed manually beforehand - - scripting: prevent crash (built-in client only) when using the variable `navigator` - -- widgets - - menu/switch/dropdown: reset value to `undefined` when receiving a value that's not defined in `values` - -- scripting - - expose instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) as `globals.clipboard` - -- midi - - allow sending note off with velocity - - add option for receiving note off with velocity - + - [again] touch fake-right-click only fires on long touch, not after every tap + - traversing gestures bug with touch - misc - - v0->v1 session conversion: remove `JS\{\{}}` in script property + - better mouse/touch drag events handlers +- engine + - electron 1.1.1 -## 1.9.0 - -**Warning** Sessions saved with this version will not open in older versions (sessions saved with older version will open in this version). +## 0.5.2 - bug fixes - - remote-root option not applied on resources loaded by the client app (css images, etc) - - input: display issue when resizing the window - - launcher: cancel stopping the server when there are unsaved changes in the built-in client + - touch fake-right-click only fires on long touch, not after every tap -- editor - - context menu: add `export` action to export a widget as a fragment file - - show project tree if minimized when clicking on "Show in tree" - -- widget - - **new** `fragment` widgets (under `containers`): embedded session or fragment file with overridable properties. - - add `comments` property to all widgets - -- launcher - - add `Always on top` menu toggle - -## 1.8.15 +## 0.5.1 - bug fixes - - editor: error when duplicating widget while if the clipboard is empty - - ui: local zoom move issue when not in fullscreen - - custom module: `clearInterval()` not working - - regression breaking style attribute in html property + - feedback is now handled precisely by widets (ie not rounded according to the `precision` option, see issue #21) +- engine + - electron 1.1.0 +## 0.5.0 + +- bug fixes + - touch/mouse events are both handled simultaneously, module rewritten for better performances (see issue #18) +- engine + - electron 1.0.2 + + +## 0.4.8 + +- bug fixes + - regression preventing newly created widgets from using the pointer's coordinates as position + - add 0.4.7's fix to headless mode + +## 0.4.7 + +- bug fixes + - regression causing widgets with `preArgs` to not receive osc correctly + +## 0.4.6 + +- engine + - electron 0.37.6 + - node-osc 2.0.3 +- features + - `compact` option added to knob and fader + - if an osc input port is specified, osc messages will be sent from it. This enhances compatibility with apps that send their feedback messages directly to the sender. - misc - - faster local zoom + - mouse/touch dragging handler rewritten, now using event delegation and direct handler calls instead of DOM event bubbling whenever it's possible -## 1.8.14 - -- bug fixes - - `alt+shift+c` not working when pressed before dragging - - incremental pasting issue with address property - - generate scrollbars for panels on iOS 13+ - - fix scrolling on chrome for iOS 13+ - -- editor - - add `mod+d` and `mod+shift+d` for duplicating widgets - - use a temporary clipboard when duplicating widgets - -- misc - - inspector: move `script` property to `scripting` category - - ui: minor style tweaks - - -## 1.8.13 - -- widgets - - file: show save icon when mode is set to save - - file: center icon when hidePath is set to true - - sliders/pads: apply `spring` property dynamically +## 0.4.5 +- engine + - electron 0.37.3 - ui - - add `alt`+`wheel` for local zoom centered on cursor - -- editor - - add `alt+c+drag` and `alt+shift+c+drag` for duplicating dragged widgets - -## 1.8.12 - -- bug fixes: - - project tree: filter input position issue when scrolling - - sliders/pads: apply `spring` property dynamically - -- project tree - - select range of contiguous widgets with shift + click - + - new logo + - better lobby design - misc - - plot: remove unused `filters` property; fix description for `rangeX` and `rangeY` - - console: focus input when the console opens + - renamed sliders/pads' `absolute` property to `snap` -## 1.8.11 +## 0.4.4 - bug fixes - - switch: widget not reacting at first touch when traversing is enabled on parent - - sliders: disable mousewheel when `spring` is enabled - -- widgets - - script: add `once` event mode - - encoder: remove `spring` property - -- custom module - - expose `process` global - -- scripting - - add `openUrl` function - -## 1.8.10 - -- bug fixes - - modal: issues with children's visibility - - console: allow multiple arguments in console.log() - + - [headless] scripts are no longer bundled on the fly, it didn't work on some systems + - touching widgets without changing their value doesn't make them send the same value again anymore - ui - - launcher: add many keyboard shortcuts - - client: add keyboard shortcuts for clearing the console - -- scripting - - add `setFocus` function to focus an input widget programmatically - + - slightly tightened layout +- features + - `noPip` option added to knob and fader + - `preArgs` accepts object if the arg's type needs to be specified + - knob supports breakpoints scale, same as fader's + - fader and knob pip scales now support custom label + - a push/toggle's value can be set to `null` if only the path needs to be sent in the osc messages + - push buttons do not update their own leds and return their value (for state save and widgets sync) based on their last changed property (led state or touch on/off) - misc - - add `usePercents` client option + - refining the fader's pip scale that looked choppy on mobile devices. All pips are now evenly spaced, not relatively to the fader's height. + - [desktop mode] saved sessions are added to history -## 1.8.9 +## 0.4.3 +- features + - text widget can be `vertical` + - panel widget `scroll` option - bug fixes - - script: issue when using the `options` argument in `set()` (options leaked to subsequent set() calls in the script) - - multixy: `decimals` property not applied - - multixy: spring behavior not working until all points are released - - custom module: prevent require() from reading submodules files each time and instead return the object in memory + - smart pasting now works when the clipboard contains several widgets whose unsuffixed ids are the identical + - osc received array that contain only one item are correctly unpacked (fixes cross-app sync for widgets that don't accept array, broken since the introduction of `preArgs`) + - memory leak when loading a new session (cached tabs were not properly purged) +- misc + - push widget doesn't fire its 'on' value if pressed while stuck in 'on' position + - panel widgets don't have inner margins anymore + - fader widget optimization : the pip scale is generated from a single gradient plus some elements for each breakpoint (instead of one element per percent), thus reducing the number of elements to draw. -## 1.8.8 - -- launcher - - add file browser button for the `theme` option and fix parsing path containing spaces if only one theme is set - -- windows - - remove `ctrl+w` shortcut for closing a window (use `alt+f4` instead) - - -## 1.8.7 - -- midi - - add active sensing messages support (received as sysex) - -- remote control - - restore `/TABS` command (for opening tabs by ids) - -- widgets - - encoder: expose rotation speed in script (as `locals.speed`) - -## 1.8.6 +## 0.4.2 +- features + - new widget : text (just displays received values) - bug fixes - - range: per-fader touch event not emitted properly - - rgb: fix `spring` property - - rgb: touch event not emitted + - widget linking doesn't cause multiple unwanted osc sends anymore -## 1.8.5 +## 0.4.1 -- bug fixes - - midi: debug messages displayed as errors - - launcher: broken context menu +- features + - `preArgs` option for widgets (prepends constants to osc messages args) -## 1.8.4 - -- bug fixes - - input: prevent focus when selecting the widget for edition - - input: submit content when leaving focus, not only when hitting `enter` or `tab` (`esc` still cancels) - - midi: prevent midi bridge from stopping when an error occurs; provide meaningful errors when connection fails - -- editor - - inspector: hitting ctrl+s while editing a property will submit the change before saving +## 0.4.0 +- engine + - electron 0.37.2 (chrome 49) - ui - - hide the console toggle button when the bottom panel is minimized and the editor is disabled - -- widgets - - file: add `mode` property, for choosing between `open` and `save` modes - - switch: add `flip` mode - -## 1.8.3 - -- bug fixes - - keyboard: allow note numbers up to 127 - - server: return http 404 error when a user-requested resource is not found instead of keeping a pending request - - modal: `visible` property not applied correctly - - -- project tree - - add an input for filtering displayed widget by id - -## 1.8.2 - -- bug fixes - - menu: allow manual line breaks ("`\n`") in labels / values - - custom module: parsing issue when sending widget data using `receive()` (`type` attribute erroneously parsed as an osc typetag) - -- widgets - - html property: allow "href" attribute on "a" elements - - -## 1.8.1 - -- bug fixes - - script: stops triggering osc messages under some circumstances - -## 1.8.0 - -- bug fixes - - project tree: layout issue with deeply nested widgets - - ios 10.3 regression - - file browser: layout issue with long paths - -- custom module - - add `nativeRequire` function (allows loading native node modules or locally installed modules) - -## 1.7.8 - -- bug fixes - - canvas-based widgets not drawn when placed in a modal while having a conditional visibility set - - text: missing `decimals` property - - clone: fix usage of osc listener syntax (acts as if clone has an `address` property set to `auto`) - -- widgets - - clone: make `props` property dynamic (avoid full widget rebuild when possible) - + - new flat ui + - tab system rewritten : inactive tabs are detached from the DOM tree, thus improving performances while slowing down tab switching. + - widget categories in editor's context menu +- features + - logarithmic scaling (log10) support added to knob, fader & xy + - mousewheel support added to knob and fader (ctrlKey for fine control) + - new widgets : plot, visualizer & meter. Fader built-in feedback meter option + - traversing gestures switch in sidepanel + - custom color property for all widgets with inheritance (containers) + - editor pasting function now smartly increments widget's id and path while keeping label if different from default + - true theming support - misc - - increase client console history size and allow changing it with client url options + - sync/link event handling improved + - stylesheets cannot be recompiled on the fly anymore (`--c` switch removed) + - **new state save file format, no backward compatibility** -## 1.7.7 +## 0.3.1 -- bug fixes - - startup regression +- electron updated to 0.36.11 +- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID` (resets id, label, linkId, and path) +- minor style updates -## 1.7.6 +## 0.3.0 -- bug fixes - - (harmless) error raised when starting the server from the launcher with `debug` set to `true` +- 3 new widgets + - multifader + - multitoggle + - multipush -- editor - - display/save color picked values with css rgba notation instead of hexadecimal -- widgets - - modal: add `ignoreTabs` option (allows overflowing tab ancestors) - - menu: add `ignoreTabs` option +## 0.2.1 -## 1.7.5 +- style update (push/toggle widgets, widgets' dragging handle) +- widget dragging/resizing doesn't get broken when editing the root +- sidepanel toggle doesn't select root for edition anymore -- bug fixes - - ios: cloned menu not displayed correctly - - engine: downgrade to fix startup issue on windows +## 0.2.0 -## 1.7.4 - -- bug fixes - - editor: cloned `dropdown` and `input` widgets not opening when selected - - widgets: prevent value-stateless widgets (tap buttons, clone, scripts, html and svg) from sending a value for cross-client synchronization (leads to unexpected script execution) and exclude them from state saves - - input: apply `decimals` number before checking the value against the `validation` expression - - range: `steps` and `dashed` property not working; remove `origin` property - - config conflicts between launcher and server (affecting at least session history) - -## 1.7.3 - -- bug fixes - - custom module / theme: prevent reloading the module while the file is being written to - - server: if a theme is used, attempt to resolve image urls against the theme file's location - - modal/button: prevent error when `label` is updated - -- widgets - - encoder: add `ticks` property back - -## 1.7.2 - -- bug fixes - - midi: mtc parsing error - - custom module: hot reload cache issue on windows - - -## 1.7.1 - -- bug fixes - - regression causing server errors - -## 1.7.0 - -**Important change** - -Prebuilt binaries are now supplied only for 64bit Linux/MacOs/Windows. Other platforms should use the `node` package or build it from sources. - -**MIDI support** - -As of this version, packages except the `node` package are bundled with a midi binary that will be used whenever midi's `path` option is not set. It is no longer necessary to install `python` and `python-rtmidi`. - -**Changelog** - - -- bug fixes - - editor: missing context menu (copy, paste) in inspector inputs - - widgets: osc listeners not resolving "auto" address - - cli: `ELECTRON_RUN_AS_NODE` headless mode not working without `--no-gui` option - - ios: clone widget not laid out properly in horizontal panels - - ui: missing vertical scrollbar when root's height overflows the workspace - - server: provide readable error when a file requested by the client file is not found - - tab: content not drawn when changing visible property - - matrix: addresses not generated property when matrix' address is `auto` - -- ui - - add console bottom panel with a simple script interpreter - -- widgets - - keyboard: add `velocity` property (allows mapping the touch coordinates between `off` (top) and `on` (bottom)) - - input: add `validation` property (allows defining a regular expression that the value must match) - - modal: add `relative` position property - -- midi - - accept sending sysex strings without spaces between the bytes - - load prebuilt midi binary on 64bit linux/windows/osx - - add support for midi time code messages - -- misc - - sessions converted from v0 will use the widget's html property to display the former label property - -## 1.6.2 - -- bug fixes - - matrix: issues when changing non-dynamic properties (content not properly removed) - - input: apply default value when receiving an empty value or no value at all - -## 1.6.1 - -- bug fixes - - keyboard: prevent `script` property from being copied to each key - -- widgets - - keyboard: make `on` and `off` properties dynamic - - script: add `getIndex` function - - matrix/keyboard: `id` variable in script is now the `id` of the child widget that triggered the event - -## 1.6.0 - -- bug fixes - - range: error when setting `default` property - - range: fix `doubleTap` property - -- widgets - - all: add `html` property to allow inserting custom content in widgets (label, value, etc) and style it with the `css` property. - -- scripting: - - `send()`: ignore the widget's `bypass` property (allows bypassing default messages and define custom ones) - - `set()`: add supports for wildcards in the id parameter - - `set()`: add a 3rd optional parameter for preventing further script executions and/or osc messages from being sent - -- custom module - - automatically reload custom module when the file is modified - - add support for loading submodules with `require()` - -- theme - - automatically reload theme when the file is modified - -## 1.5.4 - -- bug fixes - - ssl: generate unique certificates (with random serial numbers) to avoid reuse errors. Certificates generated with older versions of o-s-c will be updated automatically. - - `~/` path prefix not recognized when using remote control commands like `/SESSION/SAVE` - - `~/` path prefix not recognized in `remote-root` option - - editor: paste ID+1: midi-related addresses should not be incremented - -- remote control - - add `/STATE/OPEN` and `/STATE/SAVE` commands - - ignore unsaved changes when loading a session with `/SESSION/OPEN` - - resolve relative file paths against `remote-root` setting - -## 1.5.3 - -- bug fixes - - editor: error when `preArgs` and `address` are modified at the same time (affects `/EDIT` command and matrix/clone widgets) - -## 1.5.2 - -- bug fixes - - launcher: midi device names containing multiple spaces not parsed correctly - - fullscreen: lack of support not detected on some ios devices - - multixy: labels not hidden when `ephemeral` is `true` - -- remote control - - add `/SESSION/OPEN` and `/SESSION/SAVE` commands - -## 1.5.1 - -- bug fixes - - widgets: touch state scripts not triggering some synchronization mechanism - -- widgets - - encoder: remove `steps`, `ticks` and `origin` properties - - encoder: make `sensitivity` work with values below 1 - -## 1.5.0 - -- bug fixes - - image: broken value validation - - menu/dropdown: use correct z-index - - dropdown: prevent dropdown from opening when selecting the widget for edition - -- editor - - holding `alt` extends the north-west handle to the widget's size to ease dragging - - widget properties reordered (e.g. style-related properties, even widget-specific, are now under the "style" category) - -- widgets - - remove `colorBg` for all widgets except containers - - widgets background color is now transparent by default (can be overridden with css) - - keyboard: added `colorBlack` and `colorWhite` properties to customize key colors - - dropdown/menu: add `label` property (with support easy key/value display) - - dropdown/menu: add `icon` toggle property - - modal: add `popupPadding` property to control the button's and the container's padding independently - -## 1.4.1 - -- bug fixes - - multixy/range: prevent some extra touch state events;` - -## 1.4.0 - -- bug fixes - - project tree: error when dropping a widget at its initial position - -- editor - - validate property change when clicking on a widget - - cancel property change when hitting escape - - add menu and keyboard shortcuts to reorder widgets - - add keyboard shortcut to show widget in project tree - - selected widget is not showed on top of the others anymore - -- widgets - - expose widgets unique identifiers with property name "uuid" - - xy/multixy: add `ephemeral` property - - fader/knob/xy/range/multixy: remove `touchAddress` property - - fader/knob/xy/range/multixy: expose touch state in `script` property (`touchAddress` usages will be converted automatically) - -## 1.3.0 - -- bug fixes - - editor: hide impossible actions from context-menu (eg adding widgets in tab containers) - - editor: error when selecting a tab/root widget while a property field contains unsubmitted changes - - panel: layout issue with tabs & lineWidth property - - input: extend focusable area - -- midi - - remove variable args in sysex messages (dynamic properties and scripting can be used to this effect) - - add support for sending sysex bytes as integers - - allow sending any system message (eg MIDI time code) - - add support for receiving MIDI time code messages (as raw sysex) (requires adding the `mtc` flag to the midi configuration) - - -## 1.2.1 - -- scripting - - expose toolbar menu actions - -- remote control - - optimise small changes made with /EDIT - -- widgets - - button: add `wrap` and `vertical` properties - - root: add `width` and `height` properties (helps building mobile layouts) - -## 1.2.0 - -- bug fixes - - editor: id not incremented when pasting multiple widgets with id+1 - -- main - - remove support for extra args in the `custom-module` option (fixes some path issues) - -- widgets - - all: add `lineWidth` style property - - knob: add `solid` & `line` designs - - fader: add `knobSize` property - -- editor - - preserve percentages in position/size - - add 'Relative units (%)' option to use percents automatically on new widgets - -## 1.1.0 - -- bug fixes - - iOS 14+ scrolling issue - -- midi - - add support for channel pressure and key pressure messages - -- widgets - - svg: remove support for non-standard `%x` and `%y` units; fixed layout update when resized; - - knob: add support for custom dash/gap size in `dashed` property - -## 1.0.4 - -- bug fixes - - script: broken `storage.getItem` and `storage.removeItem` - - regression breaking `remote-root` option when starting with the launcher - - -## 1.0.3 - -- bug fixes - - modal: layout issue on iOS - -- widgets - - panels: added `contain` property to allow scrolling in vertical/horizontal layouts - -- midi - - add support for named ports in midi configuration - - -## 1.0.2 - -- bug fixes - - broken scrolling on iPhone iOS 13 - - window geometry issue - -## 1.0.1 - -- UI - - windows' dimensions and position are now saved upon closing and restored at startup - -## 1.0.0 - -*This list is not exhaustive* - -- compatibility - - dropped support for iOS 9 - - firefox (75+) support - -- UI - - overhaul design reworked - - foldable sidepanels - - removed lobby - - added toolbar menu - - display loading (spinner) in a notification instead of a modal - - mod + w to close window - - context-menu now use click event to trigger actions, not mousedown/touchstart - - no more uppercase text by default - -- themes - - built-in themes removed except `orange` - -- translations - - incomplete russian translation removed - -- editor - - project tree - - dropdown for properties with multiple choices - - color picker - - preview numeric values for style-related properties set to auto - - context menu: added "show in tree" action - - context menu: removed "edit parent" action - - allow copying tabs (to tab containers only) - - shared clipboard across all clients - - prevent interaction with widgets when `shift` or `ctrl` is held - - ensure @{} bindings are always updated upon edition - - -- widget changes - - all: removed `label` option except for buttons, tabs and modals (one should use `text` widgets if needed) - - all: removed support for `null` and `"self"` targets - - all: added `ignoreDefaults` property (allows ignoring the server's default targets) - - all: `precision` property to `decimals`, don't set osc integer typetag when 0 - - all: added `typeTags` property - - all: multiple style properties to control visibility, colors, alphas and padding - - all: added `interaction` (=> css `pointer-events: none;`) - - all: added `expand` (=> css `flex: 1;`) - - all: prevent html tags in label - - pads: removed `split` property -> use custom-module or script instead - - root: can contain widgets or tabs - - panels: added `layout`, `justify` and `gridTemplate` to help managing layouts (especially responsive ones) - - panels: added `verticalTabs` property - - panels: added `traversing` property, allow restricting `traversing` to a specific widget type - - fader: removed `input` - - fader: removed `meter` - - fader: added `gradient` - - fader: added `round` design style - - fader: support setting dash size and gap size in `dashed` property - - switch: added `layout` (including grid) - - switch: added `click` mode - - plot/eq: removed `smooth` - - plots/sliders/pads: reversed `logScale` behavior to match standard implementations; can be either `false` (disabled), `true` (logarithmic scale) or `number` (manual log scale, negative for exponential scale) - - visualizer: added `framerate` property - - visualizer: added `freeze` property - - menu: always centered menu - - modal: modals can't overflow parent tab boundaries - - input: removed `vertical` - - pads, range: when `touchAddress` is set, one message per touched point is sent, in addition to the former touch state message - - eq: removed `logScaleX` property, always draw logarithmic frequency response - - eq: logarithmic x-axis scale fixed - - eq: filters are now defined with the `filters` property, leaving the `value` to its default purpose - - eq: added `rangeX` - - html: allow `class`, `title` and `style` attributes - - dropdown: close menu when receiving a value - - dropdown: removed empty 1st option - - switch: removed `showValues` (inconsistent with menu/dropdown, feature covered by `values` property) - - frame: allow loading non local urls - -- widget removals - - `push`, `toggle`: merged into `button` - - `strip`: features now covered by `panel` - - `meter`: duplicate of `fader` with `design` to `compact` and `interaction` to `false` - - `switcher`, `state`, `crossfader`: removed => state management functions added to the `script` widget - - `keys`: merged with `script` - - `gyroscope`: not compatible since chrome 74 unless o-s-c goes HTTPS - - -- remote control - - removed /TABS - - added /NOTIFY - -- scripting (general) - - removed MathJS language - - reuse #{} syntax as as shorthand for JS\{\{}} (one liner, implicit return) - - added `locals` variable, a variable store scoped to the widget - - renamed `global` to `globals` - - expose environment variables in `globals`: `url`, `env` (query parameters), `platform`, `screen` (width/height) - -- script widget - - always hidden except in project tree - - `script` property must not be wrapped in a JS\{\{}} block anymore - - added `stateGet` and `stateSet` functions - - added `storage` object, proxy to the document's localStorage object (allows storing data that persist after refresh/close (cleared with the browser's cache) - - added `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` function proxies with an extra `id` argument (they clear automatically when called multiple times and upon widget removal. `id` is scoped to the widget) - - -- state - - quickstate (store/recall from menu) is now stored in the clients cache and persists after refresh/close (cleared with the browser's cache) - -- custom module - - `settings.read(name)`: `name` is now the long name of command-line options (not a camelCased one) - - `receive()`: optional last argument to pass extra options such as `clientId` - - client id persist upon page refresh and can be set manually with the client url option `id` - - -- launcher - - config save/load - - allow starting/stopping server without rebooting - - syntax check on `--midi` option - -- server - - renamed `--url-options` to `--client-options` and make them apply even in remote browsers (can be overridden with url queries) - - removed `--blank`, `--gui-only`, `--examples` - - hide `--disable-gpu` (cli-only) - - added cli-only `--cache-dir` and `--config-file` - - added `--authentication` option - - added `--use-ssl` option - - -- misc - - canvas: better visibility checks to avoid unnecessary draw calls - - visualizer: perf improvement (avoid data processing when not visible), all visualizers hook on the same loop to avoid concurrent timeouts - - button: in 'tap' mode (formerly push with `noRelease`), never send/sync `off` value, automatically reset to `off` when receiving `on` - - more detached DOM for lighter nested canvas widgets (ie multixy) - - unified (kind of) dom html structure for widgets, known css tricks will require adjustments. - - cache and config files are now stored in a folder named `open-stage-control` (located in the system's default location for config file). The `.open-stage-control` is no longer used. - - added support for icons rotate/flip transform suffixes (example: `^cog.spin`, `^play.rotate-horizontal`) +- editor code rewriting + - right-click context-menu quick editing (widget copy/cut/paste, add & delete tabs/widgets) diff --git a/CHANGELOG.v0.md b/CHANGELOG.v0.md deleted file mode 100644 index 32d3b1a5..00000000 --- a/CHANGELOG.v0.md +++ /dev/null @@ -1,1843 +0,0 @@ -# Changelog (v0) - -## 0.49.12 - - -**This is the last release of the v0 branch** - -- bug fixes - - dropdown: value update issue on iOS 13 -- widgets - - html: allow `class`, `title` and `style` attributes - -## 0.49.11 - -- bug fixes - - regression (0.49.10) breaking icon with short names (minimum valid length set to 2 characters) - - html widget: content not initialized properly - -## 0.49.10 - -- bug fixes - - svg files not loading - - canvas glitches when hardware acceleration is disabled (--disable-gpu) (built-in gui only) - -- misc - - prevent `--disable-gpu` from bypassing the launcher window - - prevent converting `"^icon-name"` to an icon (in text widgets and labels) when `icon-name` is too short to be a valid icon name (minimum 4 characters) - -## 0.49.9 - -- bug fixes - - downgrade electron engine to fix regression (v0.49.8) on some systems - -## 0.49.8 - -- bug fixes - - rgb: range not applied when receiving value - -## 0.49.7 - -- bug fixes - - sync issues when widgets have a single target set - -## 0.49.6 - -- bug fixes - - windows users launching the app from a terminal now need to add a double dash (--) before their options - - launcher: disabled unstable `Relaunch` action - -## 0.49.5 - -- bug fixes - - launcher: file/folder browsing not working - -## 0.49.4 - -- bug fixes - - image: fixed absolute paths - - image: reset to 'default' instead of 'value' when receiving an empty value - - launcher: use current midi config for "List devices" action - - fader built-in meter: use fader's target (allows midi sync) - -## 0.49.3 - -- bug fixes - - windows: process not terminated properly when exiting the app - -## 0.49.2 - - - bug fixes - - plots: prevent `plot/*` widgets from sending messages when using the sidepanel's "send all" function - - editor: assign correct `address` when emptying the field - - sidepanel: shadow color issue -- misc - - alt-buttons & flat theme tweaks - -## 0.49.1 - -- bug fixes - - modal: error when `label` depends on a child's property - - custom module: `send()` function casting numbers to integers instead of floats by default - - menu: push mode not working on touch devices - -## 0.49.0 - -**Deprecation** -MathJS syntax is now deprecated and will be removed in the future, sessions using it will be working for a few more versions but users are strongly encouraged to migrate to the javascript syntax. - - -- bug fixes: - - multiclient sync not working when `targets` is empty - - widgets: missing `target` property for `plots/*` widgets, required for MIDI bindings - - editor: set `label` to `auto` instead of `true` when using the toggle button - - editor: errors when hitting `mod + a` and unselecting widgets - - modal: correct popup title color - - options: allow `midi:port_name` pairs in `--send` option - - sidepanel/state: opening a state file now properly sets it as the next default save location -- widgets: - - **new** `menu` widget, circular alternative to the dropdown & switch widgets - - file: allow selecting folders - - text: optimize value update when there's no icon to draw -- editor: - - convert invalid quote characters automatically to avoid errors - - tab: added `detached` property (set to false to prevent iframes from reloading when the tab opens) - -## 0.48.8 - -- bug fixes - - strip: layout issues when moving widget in a strip (min width/height still active) - - tcp: prevent sending osc messages on udp port when the same port number is set as a tcp target - - midi: take server default targets into account to determine widget matching - - save dialog: prevent keys widgets from capturing keystrokes when typing the filename - -## 0.48.7 - -- bug fixes - - xy: broken `spring` property - - macOs: add support for emulated right click via `ctrl+click` - - midi: messages received from a midi port now only affect widgets that send to this port - -## 0.48.6 - -- bug fixes - - ios: prevent color issues with sliders - - editor: prevent all keyboard shortcuts from triggering default browser actions -- main - - detect http server silent setup failure - -## 0.48.5 - -- bug fixes - - regression breaking support for utf-8 strings in received osc messages - -## 0.48.4 - -- bug fixes - - launcher: limit terminal history size to prevent slowdown/freeze -- widgets - - knob: text pips support - - fader: add css variable `--gauge-width` - -## 0.48.3 - -- bug fixes - - widgets: prevent update errors when widgets are not fully initialized - - prevent pinch-zoom on touch screen - -## 0.48.2 - -- bug fixes - - editor: checkbox position in multiline fields - - patchbay: widget not responding to osc after being edited -- widgets - - script: added `httpGet` function for simple local http requests - - -## 0.48.1 - -- bug fixes - - modal: `popupLabel` update issues - - modal: `popupTop` not correctly interpreting percents - - editor: scrollbar issue in editor's input fields on recent chromium - -## 0.48.0 - -- bug fixes - - midi: listing devices from context menu not working when the midi options is empty - - package: broken build from sources on Windows - - editor: incorrect position when moving a widget from an edge with the keyboard - - modal: prevent touchend event from reaching the inner widgets when opening the container - - matrix: clone matrices not properly storing their children's values - - multipad/range: errors when dragging over when the gesture was initiated on a traversing widget (ie matrix) - -- widgets - - **new** html widget - - frames: allow loading local html files without requiring a web server to serve them - - text: escape html tags characters (`<` & `>`) - - input: added `asYouType` property - - sliders/pads: added `sensitivity` property - - -## 0.47.4 - -- bug fixes - - keys: prevent default browser actions when a combo is bound to a widget (for example print dialog with ctrl+p) - - xy: broken `doubleTap` - - widget: error when two sibling widgets have a non-dynamic property depending on each others and on another widget at the same time - - cli: broken `--version` option - -## 0.47.3 - -- bug fixes - - regression causing errors with the `value` property - -## 0.47.2 - -- bug fixes - - midi: `path` option not applied to launcher's `list` contextual action - - midi: pitchbend messages not received correctly - - style: layout issues in recent chromium - - encoder: `0` value in `back` property not working - - editor: state not completely restored under some conditions - - push: force release when the widget is removed/recreated while pressed - -## 0.47.1 - -- bug fixes - - css font faces not loading from absolute/relative paths -- midi - - added `path` option for setting python binary path manually - -## 0.47.0 - -- bug fixes - - launcher: spaces not properly escaped in quoted strings -- widgets - - sliders: `default` and `spring` properties are now dynamic -- server - - images urls are now resolved relatively to the session path directory by default (fallback to absolute path resolution if not found) -- custom module - - added `loadJSON` and `saveJSON` functions - -## 0.46.2 - -- improved canvas rendering speed on chrome v69 and above -- widgets - - modal: `scroll` option - - script: `get(id)` function added in `script`execution context - - script: `getProp(id, property)` function added in `script`execution context - - script: `id` variable added in `script`execution context (id of the widget that triggered the script) - -## 0.46.1 - -- bug fixes - - windows: midi debug strings not printed - -## 0.46.0 - -- bug fixes: - - modal: `css` not properly applied if the property was previously empty and the modal had been opened at least once - - image: allow overriding css background-image when value is empty -- widgets - - switchers: new `state` widget -- remote control - - added `/STATE/[GET|SET|STORE|RECALL]` methods -- midi - - print port name in debug messages - - added `pc_offset` option to act as if program change numbers where between 1 and 128 - -## 0.45.7 - -- bug fixes - - image: `cache` option inverted - - image: allow whitespaces in url -- widgets - - keyboard: `toggles` options - -## 0.45.6 - -- bug fixes - - bottom horizontal scrollbar not responding on small screens - - remote file browser: hitting a letter to select a file based on its name was looping on the first two matches only - - editor: preserve backslashes in enquoted strings (not in objects/arrays) - - editor: clear the editor when selected widget is removed by an undo/redo action -- widgets - - `logScale` can be set to a number to use a logarithm base different from the default - - knob: `compact` mode is back - -## 0.45.5 - -- bug fixes - - absolute file paths not resolved under windows - - nested `@{}` calls issue ([#516](https://github.com/jean-emmanuel/open-stage-control/issues/516)) - -## 0.45.4 - -- bug fixes - - handle network drops correctly (notify immediately and fix reconnection mechanism) - - formulas breaking the property update mechanism when not resolved - - modal: title layout issue - -## 0.45.3 - -- bug fixes - - broken client sync for widgets with `split` set - - custom module: `receive` function not working when omitting host/port and sending only one argument - - file browser: prevent error when files/folders cannot be read - -## 0.45.2 - -- bug fixes - - potential security issue in `JS{{}}` parser - -## 0.45.1 - -- bug fixes - - broken session local export - - potential security issue in custom module parser - -## 0.45.0 - -- bug fixes - - regression (v0.41.4) breaking sync between clients - - sessions not added to history when opened - - switch: traversing mode issue - - remote file browser reactivity issue - - encoder: broken because `ticks` default was `auto` instead of `360` -- main - - state files can be saved remotely -- widgets - - **removed** deprecated widgets `multifader`, `multitoggle`, `multipush` and `formula` - - new `JS{{}}` property syntax, allows writing formulas using javascript - - errors encountered in `#{}` blocks are now printed to the client console (F12) - - keys: renamed formula context variable `super` to `meta` - -## 0.44.0 - -- bug fixes - - ios: clone widget not displaying properly - - keys: error when leaving the window with the cursor while holding a key-combbo pressed - - session: disable saving when `--read-only` is set -- main - - sessions can be opened and saved from/to the server's filesystem directly -- widgets - - new `file` input widget (allows selecting a file on the the serve and sending its absolute filename) -- midi - - :warning: **breaking changes** :warning: - - replaced python dependency `rtmidi` with `python-rtmidi` (provides pre-compiled binaries for all major platforms) - - sysex messages are now discarded by default, they can be enabled by adding `sysex` to the midi options - -## 0.43.0 - -- bug fixes - - sidepanel: resize handle overflow issue -- ui - - sidepanel: hidden resize handle; show edge resize handle on hover -- launcher - - added context menu action to display midi device list without starting the server -- widgets - - switch: add `traversing` option (`true` by default) - - knob: act as a relative encoder when traversing gestures are enabled and `snap` is `false` - - keys: `key` variable in `keydown` and `keyup` is now always lowercased when referencing a single character - - keys; expose `code` variable from the keyboard event object (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#Code_values) -- custom module - - expose shorthand functions `send` and `receives` - - expose a client object instead of just an id in `app` event handlers to allow retrieving the client's ip address as well - - custom modules can now be written like standard nodejs modules (using `module.exports` assignement instead of a self-invoking function pattern) - -## 0.42.0 - -- widgets - - `OSC{}` syntax accepts an optional third argument (`false`) to bypass the host widget's `preArgs` -- editor - - sticky header to remind selected widget's id - - sidepanel can now be resized by dragging its edge - -## 0.41.7 - -- bug fixes - - matrix: `$` variable not starting at `start` - - matrix: properties not reset to default when removed from `props` - -## 0.41.6 - -- bug fixes - - keys: binding conflict with editor - - xy: drawing performance issue - -## 0.41.5 - -- bug fixes - - editor: changes applied to wrong widget when clicking on a widget while editing another widget's property - - push: allow setting `value` property - - allow whitespaces in path for `--custom-module` - - error when changing a property that's inherited by a widget to define its address and at least one non-dynamic property -- widgets - - sliders: when `steps` is set, scrolling on the widget makes it go directly from one step to another - -## 0.41.4 - -- bug fixes - - broken `--remote-saving` option* - - `fader`: built-in `meter` not updating its `address`, `preArgs` & `color` properties - - incorrect osc messsages when widget's `split` and `preArgs` are set - -## 0.41.3 - -- bug fixes - - `rgb`: values were rounded even with `precision` different from `0` -- osc - - add support for utf8 string argments (encoded/decoded as per standard https://encoding.spec.whatwg.org/#utf-8) - -## 0.41.2 - -- bug fixes - - geometry properties not properly applied when reset to `auto` - - `strip` layout not properly applied when changing the widget's `horizontal` property - - `modal` glitch on chromium v70 - -## 0.41.1 - -- bug fixes - - error when loading session file - - prevent sidepanel issue when toggling quickly - -## 0.41.0 - -- main - - `--send` accepts `ip:port` and `domain:port` targets - - removed previously deprecated `--sync` option - - `--custom-module` now accepts extra options that can be consumed from the custom module's code - - sessions located on the server can now be saved remotely, this becomes the default behavior for keyboard shortcut `mod + s`, local export is still available via `mod + shift + s` - - added `--remote-saving` options to limit remote session saving feature to hosts that match the provided regular expression -- ui - - added notifications -- widgets - - `matrices`: **new** `patchbay` widget -- bug fixes - - layout break when hitting tab with sidepanel closed and editor enabled - - crash when running the server in an environnement without user home folder - -## 0.40.5 - -- bug fixes - - clone: editor's selection rectangle appearing after editing the clone's target widget - - windows: midi issue (python path not found) -- widgets - - input: hitting `tab` now validates the value before focusing the next input (hitting `esc` or clicking outside the widget still cancels); when focusing an input widget, its whole value is selected by default; focused/selected text color hint changes. - - matrix: widgets inherit from the matrix' `id` and osc properties by default - -## 0.40.4 - -- bug fixes - - editor: widgets/tabs not properly reordered when changing a widget or tab's index by more than 1 - - main: `--no-gui` switch not working when running the app from a different directory - - regression causing osc receivers (`OSC{}`) to conflict with property listeners (`@{}`) -- widgets - - push: add `doubleTap` option - - osc listeners (`OSC{}`) now accept relative addresses (without leading '/'), automatically prefixed with the widget's address - -## 0.40.3 - -- bug fixes - - editor: sidepanel & dragging handles not always updated after edition - - widgets: parsing error when a property contains more than 10 variables - -## 0.40.2 - -- bug fixes - - regression reversing tabs order - -## 0.40.1 - -- bug fixes - - editor: issue with tabs selection / edition - - regression breaking `svg` - -## 0.40.0 - -- bug fixes - - `--read-only` option not properly working - - `keyboard`: dynamic properties `target`, `precision` & `preArgs` not being updated dynamically -- widgets - - formulas: added `indexOf` function - - **deprecated** `multifader` / `multipush` / `multitoggle` in favor of the generic `matrix` widget - - meter: `gradient` can be set as an object to define uneven color breakpoints - -## 0.39.8 - -- bug fixes - - meter's properties not accessible (overridden with fader's properties) -- mobile - - button for preventing device sleep - -## 0.39.7 - -- bug fixes - - iOS 9.3 compatibility -- widgets - - sliders: `steps` property is now dynamic - -## 0.39.6 - -- bug fixes - - `modal` widgets not working since chrome v70 - -## 0.39.5 - -- bug fixes - - sliders: `steps` option not working when `range.min` is not `0` - - regression breaking the app for iOS 9.3 - -## 0.39.4 - -- widgets - - multiXy: added `.pad-N` class to inner xy pads to help with css customization - - xy/multiXy: added css variables `--background`, `--color-pips`, `--pips-opacity` and `--point-opacity` - - rgb: added `alpha` option - - xy/multiXy/rgb: design impovements; - - sliders: new `steps` option - -## 0.39.3 - -- bug fixes - - broken tabs color property - - broken `/TABS` command; this command doesn't makes panels send osc messages anymore - -## 0.39.2 - -- bug fixes - - regresssion: broken --theme option - - regression: missing 'edit parent' action in editor's context menu - -## 0.39.1 - -- bug fixes - - regression breaking icons in switches' labels - -## 0.39.0 - -- performance - - rendering speed improved (session loading time reduced by about 30%) -- widgets - - remove support for deprecated properties `path`, `noPip` and `noSync` - - sliders/pads: `precision` is no longer a dynamic property - -## 0.38.7 - -- bug fixes - - launcher compatibility issues with electron v3 - -## 0.38.6 - -- bug fixes - - regression with dynamic property `color` in panels and matrices -- packaging - - node-only package can be run with electron too - -## 0.38.5 - -- packaging - - regression causing the client js bundle to be much bigger than needed - - added node-only package built without electron for unsupported platforms (armv6, etc) - -## 0.38.4 - -- bug fixes - - `@{parent}` calls not working consistently in clone widgets - - `slider/pads`: inteverted ranges not working - - fix `doubleTap` for sliders with `snap` set to `true` - - undo/redo errors -- widgets - - 1-level nested property inheritance calls (`@{id_@{id_2}}`) are now updated dynamically - - support special css property `class` for adding custom classes to widgets - - added "smart" traversing gestures mode that limits affected widgets by the type of the first touched widget - - root: added `traversing` property -- editor - - major performance improvements (containers' children are reused whenever possible instead of being recreated) - - removed widget deletion confirmation popup - - properties categories can now be folded - - added keyboard shortcut `F2` for editing the label quickly - - added keyboard shortcut `mod + s` for saving the session - - added keyboard shortcut `mod + o` for opening a session - - use `backspace` instead of `delete` for deleting widgets on MacOs - - added keyboard shortcut `mod + e` for enabling / disabling the editor - - added keyboard shortcuts `mod + arrows` for selecting widgets - - added keyboard shortcut `mod + a` for selecting a widget's siblings and itself - - added keyboard shortcut `mod + shift + a` for cancelling selection - - added multi widget selection with mouse when `shift` is pressed - - right-click doesn't modify current selection when `mod` or `shift` is pressed -- formulas - - added `extend(x, y)` function for merging two objects - - objects' closing brackets (`}`) don't need to be escaped with a backslash anymore - - show property's computed value in the help popup - -## 0.37.4 - -- bug fixes - - osc receivers (`OSC{}`) not working in non-dynamic properties -- remote control - - added `/GET/#` to get a widget's value without using `/GET` as reply address - -## 0.37.3 - -- bug fixes - - gyroscope: osc sendings not properly triggered on value updates - - -## 0.37.2 - -- bug fixes - - osc: regression making empty `preArgs` count as one empty string argument - -## 0.37.1 - -- bug fixes - - closing popups when clicking precisely on the "x" -- translations - - fr: corrections - - ru: added russian translation - -## 0.37.0 - -- bug fixes - - editor: opening the sidepanel doesn't select the root widget anymore - - ios: fix `doubleTap` -- widgets - - **new** `gyroscope` widget - - **new** `frame` widget - - **breaking change** in `panel`: dropped Visual Format Language support (`layout` and `spacing` properties) - - maths: added `timestamp()` function -- editor - - widget property names can be clicked to show documentation -- misc - - the client app can be translated (https://github.com/jean-emmanuel/open-stage-control/issues/302) - -## 0.36.0 - -- bug fixes - - `linkId` synchronizations now correctly trigger property updates - - widgets with multiple `linkId` are now properly handled - - synchronization issue between `visualizer` widgets -- widgets - - `keys` (**breaking changes**): formulas in `keydown` and `keyup` must be explicitely written using the `#{}` syntax; variable `value` got removed from these formulas context (use `@{this}` instead); removed `widgetId` property, the value emitted by the widget on keypress events can be linked with other widgets via the `linkId` property or the property inheritance syntax; - - `visualizer`: update rate set to default canvas framerate -- editor - - **new** keyboard shortcuts (undo, redo, copy, paste, etc) - -## 0.35.0 - -- main - - added `--state` option for loading a state file with a session file -- state - - loading a state file doesn't replace the quick save slot anymore -- widgets - - **new** `script` widget -- misc - - reduced session file size (indentation set to 2 instead of 4) - -## 0.34.4 - -- bug fixes - - widgets: dynamic `address` when `split` is `true` - - strip: missing osc properties (`address` and `preArgs`) for remote control - - switcher: update linked widgets' osc properties before sending if they depend on the switcher's value - -## 0.34.3 - -- bug fixes - - launcher: regression breaking the `port` option - -## 0.34.2 - -- bug fixes - - matrices: spacing issue when wrapped in strips - - launcher: regression preventing options to be applied - -## 0.34.1 - -- bug fixes - - switch: display object-values properly when `showValues` is set to `true` - - prevent non-dynamic properties updates from breaking an osc sending event chain -- deprecations - - `formula` has been removed from the editor's context menu -- custom module - - expose `app` to the custom module's scope: an event emitter for monitoring the events sent by the different clients -- misc - - fixed rpi build - -## 0.33.3 - -- bug fixes - - matrix: recreation loop issue with matrices of clones - - multixy: glitch when some letters are used in the points' labels - -## 0.33.2 - -- bug fixes - - matrix: set initial value at widget's creation; missing border under widget's label -- widgets - - property math syntax: add `values()` and `keys()` functions - -## 0.33.1 - -- bug fixes - - widgets: remove unnused properties to avoid having hidden properties laying around when the type changes (especially dangerous when those properties where linked to other widgets) - -## 0.33.0 - -- bug fixes - - osc receivers: unregister properly when widgets are recreated (memory leak); allow non-string values (eg. objects) - - circular property update issues -- widgets - - **new** generic `matrix` widget - - fader: restore right-click focusing the input in compact mode (mouse only) - -## 0.32.6 - -- bug fixes - - css border-radius not applying correctly for some widgets -- themes - - multiple adjustments - -## 0.32.5 - -- bug fixes - - missing feedback support for widgets with typed preArgs -- themes - - improved `dark` theme - - added `flat` - -## 0.32.4 - -- bug fixes - - regression breaking typed osc args - - -## 0.32.3 - -- bug fixes - - regression in editor/resize function - -## 0.32.2 - -- bug fixes - - sliders colors not displayed correctly on iOS -- widgets - - xy: tiny knob style change -- editor - - reallow editing disabled properties - -## 0.32.1 - -- bug fixes - - error in osc receivers - -## 0.32.0 - -- main - - add tcp support - -## 0.31.0 - -- bug fixes - - regression breaking multitouch widgets -- widgets - - fader/knob/pad: right-click / long tap doesn't give focus to the input anymore - -## 0.30.4 - -- bug fixes - - regression breaking touch traversing gestures - - clone widgets becoming unselectable for edition - - `preArgs` property still being coerced to an array - -## 0.30.3 - -- bug fixes - - big regression breaking many touch gestures - -## 0.30.2 - -- bug fixes - - broken remote-control /TABS command - - disabled `spacing` property in strips - - disabled properties in modals - - broken arm build - - -## 0.30.1 - -- midi - - prevent the main process from exiting when MIDI setup fails - -## 0.30.0 - -- widgets - - `target` and `preArgs` properties are no longer coerced to arrays and can be written as single string values - - `linkId` supports master and slave modes with `>>` and `<<` prefixes - - the special `target` token `null` can now be used in conjunction with regular targets, it disables the default global targets set via the `--send` option -- editor - - disabled widget properties are now greyed out - -## 0.29.2 - -- bug fixes - - launcher: parsing errors are not fatal anymore - - css parsing error on iOS - -## 0.29.1 - -- bug fixes - - editor: "wrap" deleting the widget just before the one being wrapped - - regression breaking traversing gestures and high precision gestures (0.29.0) -- server - - allow sending osc to broadcast ip addresses -- widgets - - limited support for property inheritance nesting (`@{id_@{id_2}}`) - - support using property inheritance syntax in osc listeners' addresses - -## 0.29.0 - -- beaking changes - - dropped supported for `.js` sessions (deprecated in 0.20.0) -- bug fixes - - zeroconf: unpublish when shutting down - - ios 9.3 compatibility issue - - function mispelling in rgb widget -- widgets - - modal: added `popupLeft` and `popupTop` properties - - faders/meter: add css variable `--gauge-opacity` to allow setting a fixed gauge opacity for meters and compact faders -- custom module - - messages converted from midi inputs can be filtered - - -## 0.28.3 - -- bug fixes - - widgets not correctly drawn when hidden/shown with dynamic css - - iOS: file upload failing sometimes -- widgets - - knob: small design improvements (pips don't take extra space anymore) - -## 0.28.2 - -- bug fixes - - session list: fix "remove from history" always removing the first item in the list -- custom module - - expose `setInterval` - - expose `clearTimeout` and `clearInterval` - - prevent errors when failing to run the module - - -## 0.28.1 - -- bug fixes - - regression in nested clones structures handling - - -## 0.28.0 - -- widgets - - matrices: support setting `split` property as a string to allow using children's indexes in their address (`$` is replaced with the index number) - - text: `wrap` property doesn't break words by default anymore - - rgb: added `range` property -- launcher - - right-click context menu (copy, paste, clear console, toggle console autoscoll, relaunch app) - - better font for the console - -## 0.27.2 - -- bug fixes - - session/state file upload sometimes failing silently - - regression breaking the app for iOS - -## 0.27.1 - -- bug fixes - - error when resizing a widget and its clone(s) at the same time - - error with non string css property - - session list not reappearing when failing to load - - broken state file loading -- misc - - added a loading indicator when uploading a session file or a state file - -## 0.27.0 - -- bug fixes - - strip: nested strips were inheriting their parent's `spacing` - - modal: prevent error when retrieving a child's property - - modal: prevent touch event from affecting elements behind the popup when closing it - - clone: some properies in target widget were not applied to the clone - - clone: prevent clone from resetting its target value when created - - text: vertical centering issues in narrow widgets - - dynamic properties: when using a widget's own value to determine its osc settings, these are checked and updated if needed before sending the message - - prevent error when loading a session containing invalid property inheritance calls - - broken build for iOS 9.3 -- editor - - wrap in: insert wrapper at selected widget's index - - wrap in: set label to false by default when wrapping in a strip or a panel - - css property `pointer-events:none;` is now ignored when the editor is enabled - - preverve pecentages when dragging/resizing a widget that has its position/size written in percents -- widgets - - **new** `OSC{/address, default_value}` syntax -- ui - - sidepanel is now resizable -- themes - - `responsive-fonts`: increase size for big screens -- build - - dropped support for node < 4.8 - -## 0.26.3 - -- bug fixes - - ios: broken default accent color in clone Widgets - - ios/android: closing the sidepanel opened the tab next to the menu button -- editor - - mac: use `shift` instead of `command` for multi widget selection to match native behaviour and prevent unwanted zoom with trackpads -- widgets - - strip: `spacing` now accepts percents - -## 0.26.2 - -- bug fixes - - regression preventing glass effect from using the widget's color - - missing last key in keyboard widget - - editor: select parent widget after deleting a widget - - regression letting user to scroll the main document - - editor: wrap/cut/delete multiple widget not working properly -- widgets - - text: set line-height relative to font size - - meter: added `gradient` feature - -## 0.26.1 - -- bug fixes - - ios: text input fields not editable -- editor - - mac: use `command` instead of `ctrl` for multi widget selection - -## 0.26.0 - -- bug fixes - - editor: when selecting another widget while editing a property, changes where applied to the newly selected widget - - widgets: css: @media queries parsing - - prevent some errors when synchronizing clients - - use command key instead of ctrl for zooming on mac - - clone: memory leak / freeze -- default client - - mac: disabled unsupported pinch zoom -- themes - - alt-buttons: modal font-weight & color fix; push button active state colored border - - added "responsive-fonts" theme -- editor - - allow multi widget resizing/dragging - - tweaked ctrl+click/right-click selection behaviors - - **new** "Wrap in" context menu - - -## 0.25.0 - -- bug fixes - - launcher: parse array options correctly when an item contains spaces, - - launcher: the terminal now grows and scrolls to bottom automatically - - editor: broken children reordering; children - list display bug with long `id`s -- main - - add `--fullscreen` switch (default gui only, bypasses the sidepanel fullscreen button) - - added/updated some themes: `orange`, `light`, `dark`, `alt-buttons` (the latter can be combined with other themes) -- widgets - - knob: big knobs design tweaks - - **new** `default` property that sets a widgets initial/doubleTap/spring value. The `value` property does no longer serve this purpose. - - **new** `bypass` property that disable osc messages (except when requested via `/GET` and `/EDIT/GET`) - - panel: **removed** `noSync` property (backward compatible fallback to `bypass`) - - property inheritance: `@{widget_id.value}`, `@{widget_id}` and `@{widget_id._value}` now all refer to the widget's current value (the latter being kept for backward compatibility); If a property update triggers an osc message, it will now be sent after the other dynamic properties changes are resolved (such as osc `address`, `target`, etc) - - text: added `align` and `wrap` properties - - input: added `align` property - - sliders/xy: `doubleTap` can be an osc address to send a special message instead of resetting the widget's value -- editor - - allow selecting multiple widgets (`ctrl + click`) if they share the same parent. Context-menu and sidepanel editing actions apply to all selected widgets - -## 0.24.3 - -- bug fixes - - property maths: variables names declared in a formula were replaced by their associated value if found in the formula's result - - missing console logs on windows -- ui - - add iOS fullscreen support via add-to-home feature -- editor - - ask for confirmation when closing or refreshing the page if the editor has been enabled at least once - - prevent default widget interaction when selecting a widget for edition -- widgets - - knob: small design tweaks -- misc - - remove proprietary ffmepg codec from package - -## 0.24.2 - -- bug fixes - - macOs app menu & shortcuts - -## 0.24.1 - -- bug fixes - - server/client communication errors - - prevent error windows from spawning -- main - - added some menu items on macOs (including "Quit" !) - -## 0.24.0 - -:warning: **BREAKING CHANGES** :warning: - -Read the changelog carefully, old sessions files are likely to need some adjustements to work as they used to. Plots and input widgets had their `widgetId` option removed because it was redundant with the generic `linkId` property. - -- bug fixes - - regression preventing dropdown to display no option selected - - crossfaders display issue on iOS - - restored compatibility options for server-client communications - - xy: `doubleTap` option - - range: `spring` option - - plot: crash when drawing only one point - - widget css: fixed @media queries @keyframes parsings -- main - - theme files changes are automatically applied - - server-client communication system rewritten -> HUGE latency reduction and stability improvement especially under stress conditions - - engine update (electron@1.8.2) -- widgets - - **new** svg plot widget - - switch: wrap non-array `values` property in an array - - dropdown: wrap non-array `values` property in an array; always add a default empty value - - property inheritance: added shorthand default to `_value` when no property is specified (`@{widgetId}`); some properties can now be dynamically changed without recreating the widget entirely - - property maths: added support for math expressions everywhere via `#{}` - - input: add glass effect when `editable` is `false` - - `linkId` can now be set as an array of linkIds - - plot: added `dots` options; **removed** `points` options (use `value` and property inheritance instead) - - eq: **removed** `filters` options (use `value` and property inheritance instead) - - plot/meter/led/rgbled/text: **removed** `widgetId` option - - input: **removed** `widgetId` option - - math: **deprecated** `formula` widget - -## 0.23.1 - -- bug fixes - - regression breaking modal's position in scrolled tab containers - - widget with a `touchAddress` set now send their touch-off message when removed or recreated while being interacted with - - broken windows builds (long path issue) - -## 0.23.0 - -- bug fixes - - plots now send their value to other widget for synchronization as expected - - text widgets now apply their target widget's precision - - property inheritance accepts targetting a parent widget by its id - - multiple icons not displayed correctly - - broken `--blank` option -- main - - added `--disable-gpu` option for disabling hardware acceleration (fixes rendering glitches and reduces input lag on some systems) -- widgets - - inputs: **new** `keys` widget, for keyboard bindings - - property inheritance: new special property name `_value` (retrieve the widget's value, and update when it changes) - - switch: added `showValues` to display both values and labels in the buttons; array values can now be selected via osc - - range: both handles can be moved by holding `shift` while dragging - - rgb: **removed** `touchAddress` option - - labels/texts: multiple white spaces are no longer merged - - plot: can receive stringified arrays of coordinates or stringified objects for merging coordinates sets; added `bars` option for drawing barcharts; - - widgets' `precision` option allows setting a specific data type for numbers (sliders can send doubles !) -- misc - - event system rewritten - - js build size reduced - -## 0.22.0 - -- bug fixes - - sessions opened from command line with relative paths are now added to the history with their absolute path - - sending an empty message to a `text` widget resets it to its initial value and without ignoring its `value` property - - sending no value to a widget with `preArgs` is now possible : all the arguments found in incoming osc messages are now taken into account to match the widgets in the session - - regression breaking state quicksave from sidepanel -- engine - - downgraded to the latest *stable* electron release -- main - - added `zeroconf` / `bonjour` publishing for the app's http and osc input ports - - added `--instance-name` option to differenciate mulitple instances in zeroconf networks -- widgets - - sliders/pads: holding `Ctrl` now enables high precision dragging with the mouse and bypasses the `snap` option - - inputs: renamed `input`'s property `horizontal` to `vertical` to match how the widget actually displays - - sliders: **new** `range` widget - - plots: **new** `image` widget -- remote control - - **removed** deprecated `/EXEC` - - renamed `/EDIT_SOFT` to `/EDIT/MERGE` - - added `/EDIT/GET` (get a widget's data) - - added `/GET` (get a widget's value) - - added `/SET` (set a widget's value as if it was interacted with from the interface) - - -## 0.21.3 - -- bug fixes - - session/state: regression (0.21.2) breaking save-to-file function -- ui - - FontAwesome 5 (icon font) ! - -## 0.21.2 - -- bug fixes - - cli: broken long flag `--no-gui` - - headless: when running with `node`, errors don't stop the server; when running with `electron` (default), errors are logged in the console instead of being showed in a dialog window - - switcher widgets regression (broken) -- midi - - float values are now allowed and automatically rounded -- misc - - some code refactoring - -## 0.21.1 - -- bug fixes - - visualizer: fix memory leak when editing; fix ignored `smooth` option - - plots: regression preventing widgets with no `target` option from receiving messages sent by other clients - -## 0.21.0 - -- main - - renamed `--sync` option to `--send` (deprecation, backward-compatible) -- widgets - - sliders/pads: when receiving feedback while touched, the widget waits to be released before updating to the latest received value. - - input: the widget's value is no longer validated when leaving focus by clicking somewhere else or hitting the `Tab` key (it must be submitted by hitting the `Enter` key); when submitting a value to another widget, the feedback from this widget doesn't trigger a second osc message anymore; non-editable inputs can't steal focus anymore - - added support for `null` value in `target` option to disable osc sending -- misc - - property fields are now parsed using [JSON5](https://github.com/json5/json5), a more flexible notation. Session files are still written in standard JSON format, this is just a way to avoid typing mistakes when using the editor. - - remote editing also accepts JSON5 notation - -## 0.20.3 - -- bug fixes - - allow loading `.json` session files from the launcher -- launcher - - new log/error console (shows once the app is started) - -## 0.20.2 - -- bug fixes - - pads: regression breaking the built-in input - - multifader: inverted order in horizontal mode -- widgets - - plots: add `smooth` option (thanks to [cardinal-spline-js](https://github.com/epistemex/cardinal-spline-js)); draw thicker lines - - pads: draw thicker inner circle - - mobile - - prevent devices from entering sleep mode - - -## 0.20.1 - -- bug fixes - - error popups not created -- misc - - rename sessions files to `.json` - -## 0.20.0 - -- **breaking changes** - - sessions are now saved as `.json`files by default (the deprecated `.js` extension can still be opened). - - states are now saved as `.state` files (the old `.preset` files can be renamed without any problem) -- bug fixes - - touch release event is properly dispatched in traversing containers (ie keyboards and matrices) (#94) -- widgets - - css `border-radius` support enhanced - - css `color` applies locally while `--color-text` applies to children too - - plot/text: new lines are properly printed -- packaging - - added `arm64` binaries -- iOS - - compatibility improved (version 9.3 and above) -- engine - - electron 1.8.0 (chrome 59) - -## 0.19.6 - -- hot fix - - broken formula widget - -## 0.19.5 - -- launcher - - fixed typo in new version message -- misc - - client-side javascript's size reduced, now for real !! - -## 0.19.4 - -- bug fixes - - buttons: changing `css` background works as expected - - widgets: changing `css` (text) color works as expected - - fader: fix hidden input in horizontal + compact mode - - pads: pips scaling bug -- widgets - - `css` font-sizes apply correctly to all children (better use percents) - - formula: add `unit` option -- misc - - client-side javascript's size reduced ! - -## 0.19.3 - -- bug fixes - - midi: noteOff messages not being sent; - -## 0.19.2 - -- bug fixes - - lobby: regression breaking the lobby for touch devices - - -## 0.19.1 - -- bug fixes - - launcher: load correct font - - midi: python3 compatibility fix - -## 0.19.0 - -- ui - - general design improved, heavily inspired by [budislavTVP](http://budislavtvp.deviantart.com/) works; color schemes are much simpler and easier to customize (try `--theme light` !); Font changed to Roboto; Texts are slightly thicker and uppercased in most cases for better readability (use css `text-transform:none` to disable the latter). -- widgets - - fader: added `dashed` option; added `input` option; - - meter: added `alignRight` option; added `dashed` option; - - knob: removed `compact` option; added `dashed` option; added `input` option; - - xy/rgb: added `input` option; added `pips` option: - - panel/strip: removed inner widgets dark borders; added `border` option; - - buttons: new `dropdown` widget; - - toggle: added `led` option to choose between the old appearance and the new one; added `douleTap` option - - new `input` widget - - containers: new `clone` widgets - - added support for `"self"` value in `target` option (sends the message back to the clients, useful for sending `/EDIT` messages...) -- editor - - option fields are now multiline (`ctrl + enter` to add a new line), and pretty printed - - added checkboxes for boolean options - - added `Edit Parent` context menu option -- midi - - replaced `pyo` dependency with [`pyrtmidi`](https://github.com/patrickkidd/pyrtmidi): lighter, dedicated to midi only, and handling virtual ports (no `mididings` dependency anymore) - - pitchbend value is now a single integer between 0 and 16383 -- bug fixes - - fixed VisualFormat errors in iOS -- main - - added `--url-options` command line option - - fixed `--disable-vsync` not working when starting from the launcher -- documentation - - new style, better organization - -## 0.18.0 - -:warning: **Breaking changes** :warning: - -Sessions saved with this version will not be readable with older versions (old sessions a can be opened but wont be backward-compatible once saved). - - -- widgets - - add property inheritance between widgets with statements `@{parent.propertyName}`, `@{this.propertyName}` and `@{widgetID.propertyName}` - - containers: added `variables` options (arbitrary varibles to pass to children) - - panel: added full osc support (for sending/receiving tab changes) - - modal: changed style to fit popups' appearance; added `popupWidth` and `popupHeight` options; :warning: removed `tabs` option; added full osc support; added `doubleTap` option (makes it openable with double taps instead of single taps) - - strip: refactored widget using `panel` as base; added `stretch` and `spacing` option; now it's really cool - - sliders: added `doubleTap` option (double taps reset the widget to its initial value when enabled) - - knob/fader: renamed `noPip` option to `pips` (inverted behaviour; backward compatible) - - encoder: mousewheel support - - knob: compact design remake -- bug fixes - - sliders: fixed `spring` when `value` equals `0` - - modal: fixed osc values (was `True`/`False` instead of `1`/`0`) -- session - - the root panel is now saved as a special `panel` widget (which means it has savable options) -- custom module - - add access to the app's `settings` object - -## 0.17.8 - -- bug fixes - - regression breaking widgets' `split` option (0.17.6) - - regression breaking the state export button (0.17.7) - - regression breaking editor's `cut` action (0.17.7) -- osc - - javascript object are now stringifyied before beeing sent -- widgets - - maths: add `condition` option to [`formula`](http://osc.ammd.net/user-guide/widgets-specifics/maths/#formula) - - sliders/pads: add `touchAddress` option - - fader: add `meterAddress` - -## 0.17.7 - -- engine - - socket.io v2 -- client - - scripts are now transpiled to ES5 javascript code, thus increasing compatibility with some browser (iOS9's chrome, firefox, etc) - - scripts size reduced from 2.4M to 1M thanks to minification -- bug fixes - - elements duplications in sidepanel when loading another session - -## 0.17.6 - -- main - - osc sending speed optimization: all static infos (target, address, preArgs) are cached server side to reduce network overhead -- widgets - - **new** encoder widget -- mobile - - `hdpi` support (add `?hdpi=1` to the server's url) -- bug fixes - - launcher: link to the app's address is now clickable - - sidepanel: layout glitches with iOS - - midi: `program` now works with the correct number of arguments -- misc - - some little style fixes - -## 0.17.5 - -- bug fixes - - `multixy` snap mode position offset -- widgets - - **new** [`rgbled`](http://osc.ammd.net/user-guide/widgets-specifics/plots/#rgbled) - - -## 0.17.4 - -- bug fixes - - broken `--blank` option fixed (false-positive detection of concurrency with `--read-only`) - - remove debug message in console when closing windows - -## 0.17.3 - -Hot fix for `--read-only` switch. -Dependencies updates. - -## 0.17.2 (deleted) - -- bug fixes - - `editor`: correctly remove editing state when disabling the editor right after going to another tab -- main - - **new** `--read-only` switch for disabling the editor and preventing change to the session history -- widgets - - `panel/modal`: add `layout` option ([Visual Format Language](https://github.com/IjzerenHein/autolayout.js)) - - `css` option now interprets `&` as a selector for the widget's element itself (useful for targetting pseudo-elements such as `&:after`) - - `plots`: add `widgetId` option to `text`, `meter` and `led` - -## 0.17.1 - -- bug fixes - - `midi`: missing dependency - - `headless`: terminate `midi` correctly when process exits - -## 0.17.0 - -- main - - **new** `midi` support ([documentation](http://osc.ammd.net/user-guide/midi/)) -- ui - - **new** `/TABS id1 id2 etc` osc address to remotely enable tabs - - remote editing through `/EXEC` command is now deprecated, use `/EDIT` and `/EDIT_SOFT` instead -- bug fixes - - `push` widgets (and `keyboards`) not correctly synchronizing each other (with shared widget ids or between different clients) -- widgets - - `css` option now supports css selectors, scoped to the widgets element - - `matrices` don't pass `css` option to their children anymore; subwidgets' indexes are now append to `preArgs` instead of being prepended. -- misc - - app's title uppercased - - tabs titles' letter-spacing increased - -## 0.16.5 - -- bug fixes - - `modal`: correct z-stacking with absolutely positionned widgets; proper rendering for inner widgets; disable parent tab's scrolling when opened; fix various style glitches; - - `strip`: resize glitch when containing compact horizontal sliders - -## 0.16.4 - -- bug fixes - - tab links broken after activating traversing gestures - - `push` release is now handled per touch point (releasing one finger used to release all pressed buttons) -- misc - - destroy default client window when the app process exits - -## 0.16.3 - -- bug fixes - - crash when remote-editing widgets in disabled tabs - - desktop client touch screen support restored - -## 0.16.1 - -- bug fixes - - string arguments overquoted in sent osc messages -- custom module - - added support for initialization script - - unified expected formatting in sendOsc and receiveOsc methods -- ui - - reduced scrollbars width - - -## 0.16.0 - -- new logo :) -- bug fixes - - editor: new widgets are correctly positionned in scrolled areas -- widgets - - **new** `formula` widget, a [mathjs](http://mathjs.org/) expression evaluator that can process other widgets' values - - `multixy` supports named points; fixed drag-dead zone in the border - -## 0.15.1 - -- widgets - - multifader: add `snap` option -- misc - - minor css-related performance fix - - some titles in the editor had the first-letter uppercased - -## 0.15.0 - -- style - - improved coherence, no more pure greys, better differenciation between clickable and static elements. Went back from "pure flat" to "flatty" to help with that (ie a few shadows to make layout more self-explanatory). Some widgets were slightly repimped. -- bug fixes - - `push`: options separators not hidden in the editor - - error when touching a non-interractive object while touching a widget with the other fingers -- widgets - - `multixy` now behaves smarter: points are assigned to the closest touch points -- main - - modifying a session file will automatically update clients that have loaded the same file - -## 0.14.0 - -- bug fixes - - some layout regressions in chrome v49 -- main - - osc input port (`-o`) is now set to the http port (`-p`) by default -- widgets - - **new** `crossfader` and `switcher` widgets that store and recall the state of other widgets - - `matrices` now accept multiple color values (that will be sequencially passed to their children) - - `switches` accept icons in their values' labels -- engine - - electron v1.4.13 -- misc - - all widgets classes were rewritten using ES6 class expressions - - firefox's minimal version is now 46 because of a ES6 related bug (*note that it's still not officially supported*) - -## 0.13.1 - -- bug fixes - - regression preventing received osc messages to be properly routed to widgets with `preArgs` -- debug - - errors occuring in the browser process are now piped to the main process' console with the source file name and the line number. - -## 0.13.0 - -- main - - **new** `-b / --blank` option to start editing a new session directly - - **new** `--disable-vsync` option that improves performance (reduce input lag) on some systems - - some inconsistent parameter combinations are now prevented - - firefox compatibility improved (yet not perfect) - - launcher window is no longer of the `splash` type, as it was difficult to close with some window managers -- widgets - - **new** `modal` container : a button that turns into a fullscreen panel when clicked. - - sliders/xy: add `spring` option that makes that widget jump back to its initial value when released - - fader: horizontal mode default height fixed - - keyboard: black keys pressed state is more noticeable - - matrices: added `start` option to choose the first subwidget's `id` - - labels' height reduced -- editor - - **new** snap-to-grid feature - - widgets' min-width set to grid's width -- misc - - building with node 4 is fixed - -## 0.12.0 - -- bug fixes - - error popups raised by the main process can be closed - - sliders don't send same value over network when the value change is below the widget's precision -- widgets - - **new** (piano) keyboard widget - - matrices: fixed `preArgs` option; added `split` option (default to `false`), *this changes the default osc messages formatting for these widgets* - - icons in labels are inserted using the `^` prefix - - text: icons support in value -- tabs - - icons support in label -- misc - - fontawesome update (4.7.0) - -## 0.11.6 - -- widgets - - meter: rewritten using fader as base - - strip: center widget horizontally if width is set - - fader/knob: compact gauge's alpha varies slightly as the distance to the origin grows -- misc - - one example session added - -## 0.11.5 - -- bug fixes - - [regression] broken horizontal fader and pads - -## 0.11.4 - -- bug fixes - - fader: default `height/width` not set when `top/left` is `auto` - -## 0.11.3 - -- widgets - - knob: gesture's precision is proportionnal to the widget's size - - fader: `height:auto` (or `width` for `horizontal` mode) makes the fader expand automatically -- ui - - cleaner forms in editor and launcher - -## 0.11.2 - -- touch - - using multiple fingers to control a widget increases the precision (reduces the gesture's computed speed) -- widgets - - fader: display pips in `compact` mode when `range` has multiple breakpoints - - pads: display pips when `range` has multiple breakpoints - - multixy: style update (stroked dots, bold number font); `snap` option added; points are automatically assigned to touches as they come; fix `logScale(X|Y)` options - -## 0.11.1 - -- bug fixes - - meters in faders were not always properly positionned -- widgets - - knob: gauge's width is proportionnal to the knob's size in `compact` mode; widget's content centering fixed; `compact` style update; - -## 0.11.0 - -- bug fixes - - `-g / --no-gui` not preventing the launcher from spawning - - `-e / --examples` not correctly parsed -- main - - launcher displays options descriptions for booleans too -- widgets - - added generic `value` option for setting a widget's initial value (does not sync linked widgets nor send osc message) - - **text** widget's `defaultText` replaced with `value` - - multixy dots are drawn with filled background instead of stroke - -## 0.10.4 - -- main - - launcher displays new version if available - - launcher stays opened after starting the server and/or the gui except if `--gui-only` is set - -## 0.10.3 - -- main - - launcher: resetting boolean option properly sets it to false - - launcher: display package's version - - guis: adjust window's background to match the app's -- ui - - launcher and session lobby appear more smoothly - -## 0.10.2 - -- main - - when executing the app with no CLI argument, a launcher window is created allowing user to adjust settings before starting the server (config is saved in the user's directory) - -## 0.10.1 - -- bug fixes - - rgb: minor visual glitch on extreme value, drawing performance improved - - main: examples sessions path are properly stored as absolute paths (fixes `-e / --examples` mode) -- ui - - lobby: session file names are diplayed first, then shortened paths -- misc - - widgets `precision` doesn't affect their visual interraction accuracy since values are now rounded only before osc sending - -## 0.10.0-alpha-2 - -- bug fixes - - [windows] fix long path issue (#35) returns - -## 0.10.0-alpha - -- main - - **new** `-c / --custom-module` switch allowing user to define custom osc filtering fonctions - - `address` is now used everywhere instead of `path` to describe osc address to avoid confusion. Session files using the old `path` option for widgets are still supported. - - **osc bundles** are properly received (subsequent messages are processed separately with a delay if the timetag is set) - - widgets can be edited via osc messages using the special `/EXEC` address - -## 0.9.2 - -- bug fixes - - [windows] fix long path issue (#35) - -## 0.9.1 - -- widgets - - multiXy: added `pointSize` option; made default size bigger; points don't overflow the pad anymore - -## 0.9.0 - -- widgets - - **new** `multixy` pad -- misc - - rewritten `pads` with prototype inheritance and using faders under the hood to handle events (this adds *fader*'s `range` capabilities to *xy*) -- engine - - electron 1.4.4 - -## 0.8.3 - -- bug fixes - - scrollbar arrows not showing - - `fader` pips position when `noPip` is `true` -- widgets - - matrices : all `fader`, `push` and `toggle` options are now available to `multifader`, `multipush` and `multitoggle` - -## 0.8.2 - -- bug - - avoid crash when sending osc with incorrect typetags - - fixed fallback typetag ('s') - - fixed broken `null` value for `push` & `toggle` - -## 0.8.1 - -- bug - - broken `fader` with `horizontal` set to `true` and `compact` set to `false` -- widgets - - remove margins from `plots` - - added `origin` options to `plots` - -## 0.8.0 - -- main - - the headless server/clients model is now the only one beeing used : the GUI mode is nothing more than an embedded chromium (electron) client - - when a new client opens a session on the server, it is synchronized with the other clients - - **new switches** : `--no-gui`, `--gui-only`, `--port`, `--osc-port`, `--version` (see docs) -- ui - - explicit loadings -- widgets - - make push's backlight only respond to external osc messages (not to synchronization messages from other widgets or clients) - - removed special `false` value case for push/toggles (which used to disable osc sending) - - add `norelease` option to `push` for disabling osc messages when releasing the button - - `true` and `false` values are now properly sent as boolean - - **args type definition** in `preArgs` option now uses the osc typetags only ('f', 'i', 'T', 'F', etc) -- engine - - electron 1.4.3 -- misc - - rewritten matrices with prototypes inheritance - -## 0.7.0 - -- bug fixes - - osc messages with 0-item and 1-item args are correctly unpacked and routed - - buttons can handle messages with 0 arg if one of their state has the value "null" -- ui - - nice and bigger scrollbar - - right-click no longer starts a dragging gesture -- editor - - copy/paste data auto-incrementation fix -- widgets - - new equalizer plotter - - push/toggles made more obvious - - knob's new options: angle and origin - - fader's new option: origin -- engine - - electron 1.4.1 (chrome 53, node 6.5.0) -- misc - - added `--examples` switch for showing the availabe example sessions instead of the history - - rewritten sliders and plots using canvas and prototypes inheritance - - reorganized package using the two-package.json structure: js and css assets are now create at build time, and only necessary dependencies are shipped with the app - -## 0.6.3 - -- bug fixes - - regression (since 498ba4a06adf63d76fe7181691299c1cc55e8240) breaking the editor on touch devices - -## 0.6.2 - -- cool stuff - - armv7l prebuilt binaries ! (raspberry 2, etc) -- engine - - electron 1.3.5 - -## 0.6.1 - -- bug fixes - - editor: widgets/tabs can be accessed through their parent's children list (#27) -- engine - - electron 1.3.1 - -## 0.6.0 - -- bug fixes - - pasted widget properly use the pointer's position - - traversing gestures are effective from the first touch, not after the first move - - out-of-range values are properly clipped by faders/knob -- ui - - Faders & Meters design improved - - The main font (droid sans) is now loaded... - - Knob's sizing got smarter - - Widgets don't blink not jump when they appear for the first time or when they resize -- misc - - Fader's `align` option replaced with boolean option `alignRight` - - Widget's `label` now accepts special directive `icon: fontawesome-class` to display icons from [FontAwesome](http://fontawesome.io/icons/) - - Text widget `defaultText` option added -- engine - - electron 1.2.2 - -## 0.5.4 - -- bug fixes - - [desktop] menu bar auto-hide - - [headless] multitouch support -- ui - - [mobile] better faders pips rendering - - fixed horizontal fader knob centering - - [mobile] better numeric inputs rendering (not blurred anymore) -- engine - - [desktop] electron 1.2.0 (chrome 51) - -## 0.5.3 - -- bug fixes - - [again] touch fake-right-click only fires on long touch, not after every tap - - traversing gestures bug with touch -- misc - - better mouse/touch drag events handlers -- engine - - electron 1.1.1 - -## 0.5.2 - -- bug fixes - - touch fake-right-click only fires on long touch, not after every tap - -## 0.5.1 - -- bug fixes - - feedback is now handled precisely by widets (ie not rounded according to the `precision` option, see issue #21) -- engine - - electron 1.1.0 - -## 0.5.0 - -- bug fixes - - touch/mouse events are both handled simultaneously, module rewritten for better performances (see issue #18) -- engine - - electron 1.0.2 - - -## 0.4.8 - -- bug fixes - - regression preventing newly created widgets from using the pointer's coordinates as position - - add 0.4.7's fix to headless mode - -## 0.4.7 - -- bug fixes - - regression causing widgets with `preArgs` to not receive osc correctly - -## 0.4.6 - -- engine - - electron 0.37.6 - - node-osc 2.0.3 -- features - - `compact` option added to knob and fader - - if an osc input port is specified, osc messages will be sent from it. This enhances compatibility with apps that send their feedback messages directly to the sender. -- misc - - mouse/touch dragging handler rewritten, now using event delegation and direct handler calls instead of DOM event bubbling whenever it's possible - -## 0.4.5 - -- engine - - electron 0.37.3 -- ui - - new logo - - better lobby design -- misc - - renamed sliders/pads' `absolute` property to `snap` - -## 0.4.4 - -- bug fixes - - [headless] scripts are no longer bundled on the fly, it didn't work on some systems - - touching widgets without changing their value doesn't make them send the same value again anymore -- ui - - slightly tightened layout -- features - - `noPip` option added to knob and fader - - `preArgs` accepts object if the arg's type needs to be specified - - knob supports breakpoints scale, same as fader's - - fader and knob pip scales now support custom label - - a push/toggle's value can be set to `null` if only the path needs to be sent in the osc messages - - push buttons do not update their own leds and return their value (for state save and widgets sync) based on their last changed property (led state or touch on/off) -- misc - - refining the fader's pip scale that looked choppy on mobile devices. All pips are now evenly spaced, not relatively to the fader's height. - - [desktop mode] saved sessions are added to history - -## 0.4.3 - -- features - - text widget can be `vertical` - - panel widget `scroll` option -- bug fixes - - smart pasting now works when the clipboard contains several widgets whose unsuffixed ids are the identical - - osc received array that contain only one item are correctly unpacked (fixes cross-app sync for widgets that don't accept array, broken since the introduction of `preArgs`) - - memory leak when loading a new session (cached tabs were not properly purged) -- misc - - push widget doesn't fire its 'on' value if pressed while stuck in 'on' position - - panel widgets don't have inner margins anymore - - fader widget optimization : the pip scale is generated from a single gradient plus some elements for each breakpoint (instead of one element per percent), thus reducing the number of elements to draw. - -## 0.4.2 - -- features - - new widget : text (just displays received values) -- bug fixes - - widget linking doesn't cause multiple unwanted osc sends anymore - -## 0.4.1 - -- features - - `preArgs` option for widgets (prepends constants to osc messages args) - -## 0.4.0 - -- engine - - electron 0.37.2 (chrome 49) -- ui - - new flat ui - - tab system rewritten : inactive tabs are detached from the DOM tree, thus improving performances while slowing down tab switching. - - widget categories in editor's context menu -- features - - logarithmic scaling (log10) support added to knob, fader & xy - - mousewheel support added to knob and fader (ctrlKey for fine control) - - new widgets : plot, visualizer & meter. Fader built-in feedback meter option - - traversing gestures switch in sidepanel - - custom color property for all widgets with inheritance (containers) - - editor pasting function now smartly increments widget's id and path while keeping label if different from default - - true theming support -- misc - - sync/link event handling improved - - stylesheets cannot be recompiled on the fly anymore (`--c` switch removed) - - **new state save file format, no backward compatibility** - -## 0.3.1 - -- electron updated to 0.36.11 -- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID` (resets id, label, linkId, and path) -- minor style updates - -## 0.3.0 - -- 3 new widgets - - multifader - - multitoggle - - multipush - - -## 0.2.1 - -- style update (push/toggle widgets, widgets' dragging handle) -- widget dragging/resizing doesn't get broken when editing the root -- sidepanel toggle doesn't select root for edition anymore - -## 0.2.0 - -- editor code rewriting - - right-click context-menu quick editing (widget copy/cut/paste, add & delete tabs/widgets) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 921666c8..00000000 --- a/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM node:24-alpine - -RUN apk --no-cache add git - -WORKDIR /usr/src/app - -COPY package*.json ./ - -RUN npm install - -COPY . . - -RUN npm run build - -RUN mkdir /sessions -RUN touch /sessions/session.json - -EXPOSE 8080 - -ENV ELECTRON_RUN_AS_NODE=1 - -ENV SEND="127.0.0.1:8080" -ENV LOAD="/sessions/main.json" -ENV PORT=8080 -ENV OSC_PORT=8080 -ENV READ_ONLY=false - -RUN chmod +x entrypoint.sh -ENTRYPOINT ["./entrypoint.sh"] diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..ca8f8479 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node index.js -n $PORT diff --git a/README.md b/README.md index 89da9bd5..cc05cfef 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,56 @@ -Open Stage Control +# Open Stage Control -Open Stage Control +Open Stage Control is a libre desktop OSC bi-directionnal control surface application. It's built with HTML, JavaScript & CSS on top of [Electron](http://electron.atom.io/) framework. -*Libre and modular OSC / MIDI controller* +## Documentation + +[Read the documentation](http://jean-emmanuel.github.io/open-stage-control/) + +*The docs' sources are located in [resources/](resources/)* + +## Download + +Prebuilt binaries for Linux, Windows and OS X can be found on the [release](https://github.com/jean-emmanuel/open-stage-control/releases) page. + +## Demo + +You can try the app here [http://openstagecontrol.herokuapp.com/](http://openstagecontrol.herokuapp.com/) + +Please note that : + +- Chrome/Chromium **49** at least is required +- Since there is only one instance running, all connected guests are synchronized (widgets using the same osc paths update each other's states) : you might experience some unwanted synchronization with other users unless you specify custom parameters for your widgets. +- You might want to download the examples sessions files under *examples/* and load them in the app to get started. -- Website: https://openstagecontrol.ammd.net/ -- Forum: https://openstagecontrol.discourse.group/ -- IRC: Libera.chat #openstagecontrol +## Features ----- +- mouse & multi-touch sensitive widgets +- modular & responsive layout +- built-in live editor +- bi-directionnal osc bindings +- headless server mode with any number of clients using chromium +- app state store / recall & import / export +- themes ! -Docker additions by Rik Berkelder. +## Supported platforms -mount `/sessions` directory. default session file is created and loaded there. +Same as [Electron's supported platforms](https://github.com/electron/electron/blob/master/docs/tutorial/supported-platforms.md) ---- -Copyleft © Jean-Emmanuel Doucet 2014-2025. -This program is a free software released under the [GNU/GPL3](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE) license. +## License & credits + +Copyleft © Jean-Emmanuel @ [AMMD](http://ammd.net). This program is released under the GNU/GPL3 license. + +It relies on the use of several libraries : + +- [Node.js](https://nodejs.org/) +- [Electron](http://electron.atom.io/) +- [node-osc](https://github.com/TheAlphaNerd/node-osc) +- [socket.io](http://socket.io) +- [browserify](http://browserify.org) +- [express](http://expressjs.com) +- [node-sass](https://github.com/sass/node-sass) +- [jQuery](http://jquery.com/) +- [jQuery-UI](http://jqueryui.com/) (draggable, resizable & sortable) +- [Font Awesome](http://fontawesome.io/) diff --git a/basesession.json b/basesession.json deleted file mode 100644 index 9ddad0bb..00000000 --- a/basesession.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "createdWith": "Open Stage Control", - "version": "1.31.2", - "type": "session", - "content": { - "type": "root", - "lock": false, - "id": "root", - "visible": true, - "interaction": true, - "comments": "", - "width": "auto", - "height": "auto", - "colorText": "auto", - "colorWidget": "auto", - "alphaFillOn": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "hideMenu": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "onTouch": "", - "onPreload": "", - "widgets": [], - "tabs": [] - } -} \ No newline at end of file diff --git a/browser/css/style.css b/browser/css/style.css new file mode 100644 index 00000000..c27e90a1 --- /dev/null +++ b/browser/css/style.css @@ -0,0 +1 @@ +:root{--color-text:rgba(255,255,255,0.8);--color-text-fade:rgba(255,255,255,0.5);--color-bg:#202329;--color-fg:#2d313a;--color-raised:#363b45;--color-faded:#292d34;--color-track:#1c1f25;--color-accent:#528bff;--nav-height:40rem;--sidepanel-size:300rem;--pixel-scale:1}*{margin:0;padding:0;border:0;box-sizing:border-box;text-decoration:none;outline:0;font:inherit;color:inherit;cursor:inherit;-webkit-tap-highlight-color:transparent;-webkit-user-select:none}::-webkit-scrollbar{width:20rem;height:20rem;opacity:1}::-webkit-scrollbar-track-piece{background:var(--color-bg)}::-webkit-scrollbar-track-piece:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-track-piece:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-corner{background:transparent}::-webkit-scrollbar-thumb{background:var(--color-raised)}::-webkit-scrollbar-thumb:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb:horizontal{border-top:2rem solid var(--color-bg)}body{background:var(--color-bg)}#container{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;flex-direction:column;background:var(--color-bg);padding:2rem}#container.sidepanel-open{right:var(--sidepanel-size)}.content{height:100%;overflow:hidden;position:relative;background:var(--color-fg);padding:2rem}.tab{position:absolute;overflow:auto;left:0;right:0;top:0;bottom:0;background:var(--color-bg);transform:rotateZ(0)}.tab.has-tabs{display:flex;flex-direction:column}.tab.has-tabs>.navigation{background:var(--color-bg)}.tab.has-tabs>.content{background:none}.navigation{height:var(--nav-height);margin-bottom:2rem;flex-shrink:0;font-weight:bold;text-transform:uppercase}.navigation.main li:last-child{width:var(--nav-height);max-width:var(--nav-height);min-width:var(--nav-height)}.navigation.main li:last-child i{margin:0 auto}.navigation ul{list-style:none;display:flex;overflow:hidden;height:100%}.navigation ul li{display:block;min-width:0;flex:1;cursor:pointer;height:100%;margin-right:1rem}.navigation ul li:last-child{margin-right:0}.navigation ul li a{background:var(--color-fg);pointer-events:none;padding:5rem;height:100%;display:flex;align-items:center;overflow:hidden;text-align:center;position:relative}.navigation ul li a span{display:block;width:100%;-webkit-mask:linear-gradient(to left, transparent, #000 10rem) no-repeat}.navigation ul li a:after{content:"";background:var(--color-accent);position:absolute;bottom:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.navigation ul li.on a,.navigation ul li .sidepanel-open{position:relative;background:var(--color-raised)}.navigation ul li.on a:after,.navigation ul li .sidepanel-open:after{opacity:1;transform:scale(1)}.navigation ul .parent+li a{padding-left:calc(5rem + 0.5 * var(--nav-height))}.form .input-wrapper{display:flex;margin-bottom:4rem;background:var(--color-bg);align-items:center}.form .input-wrapper:last-child{margin-bottom:0}.form .input-wrapper label{background:var(--color-fg);flex-shrink:0;padding:5rem;border:1rem solid var(--color-bg)}.form .input-wrapper .input,.form .input-wrapper input{background:var(--color-bg);width:100%;padding:5rem}.form .input-wrapper.column{flex-direction:column}.form .input-wrapper.column label{width:100%;padding:7rem;margin-bottom:0}.form label{display:block;font-size:10rem;background:var(--color-faded)}.form .info{color:var(--color-text-fade);margin-bottom:10rem}.form input,.form .input{display:block;border:0;font:inherit;color:var(--color-text);width:100%}.form input:focus,.form .input:focus{border-color:var(--color-accent)}.form input .btn,.form .input .btn{background:var(--color-raised);box-shadow:0 0 0 1rem var(--color-bg)}.form .checkbox{background:var(--color-raised);cursor:pointer}.form .select-wrapper{position:relative;width:100%}.form .select-wrapper:after{content:"\f107";font-family:FontAwesome;position:absolute;padding:5rem;right:0;top:0;font-size:20rem}.form select{-webkit-appearance:none}.form .submit{margin-top:30rem}.form .separator{line-height:30rem;height:30rem;margin-bottom:5rem;position:relative;display:flex;align-items:center}.form .separator:before,.form .separator:after{content:"";top:14rem;width:100%;height:1rem;background:var(--color-text-fade)}.form .separator span{font-variant:small-caps;position:relative;display:block;width:100%;text-align:center}.widget.editing{z-index:11 !important;overflow:visible}.widget.editing:after,li.editing a:before,a.editing:before,.content.editing:before,#container.editing:before{content:"";z-index:999;position:absolute;top:0;left:0;right:0;bottom:0;border:1rem dashed var(--color-accent);pointer-events:none}.context-menu{position:fixed;z-index:999999999;background:var(--color-raised);box-shadow:0 0 4rem 0;color:var(--color-track)}.context-menu .item{color:var(--color-text)}.context-menu .context-menu{position:absolute;left:100%;top:0;opacity:0;pointer-events:none;margin-left:2rem}.context-menu .context-menu:before{content:"";position:absolute;top:0;bottom:0;left:-2rem;width:2rem}.context-menu>.item{padding:10rem 15rem 10rem 10rem;position:relative;cursor:pointer}.context-menu>.item i{margin-right:5rem;width:15rem;text-align:center}.context-menu>.item:hover,.context-menu>.item:focus{background:var(--color-accent)}.context-menu>.item:hover>.context-menu,.context-menu>.item:focus>.context-menu{pointer-events:auto;opacity:1}.context-menu>.item.has-sub:before{content:"\f105";display:block;font-family:FontAwesome;float:right;margin-right:-10rem;padding-left:10rem}.ui-resizable-handle{position:absolute;z-index:1000000;display:flex;justify-content:center;align-items:center;background:var(--color-accent);width:20rem;height:20rem;border-radius:100%;box-shadow:0 0 4rem 0 var(--color-bg)}.ui-resizable-handle:after{content:"";position:absolute;top:-5rem;right:-5rem;left:-5rem;bottom:-5rem}.ui-resizable-handle.ui-resizable-se{content:"";bottom:5rem;right:5rem;cursor:se-resize}.ui-resizable-handle.ui-resizable-se:before{content:"\f065";font-family:FontAwesome;transform:rotate(90deg)}.ui-resizable-handle.ui-resizable-e{top:50%;margin-top:-10rem;right:5rem;cursor:e-resize}.ui-resizable-handle.ui-resizable-e:before{content:"\f051";font-family:FontAwesome}.ui-resizable-handle.ui-resizable-s{bottom:5rem;left:50%;margin-left:-10rem;cursor:s-resize}.ui-resizable-handle.ui-resizable-s:before{content:"\f051";font-family:FontAwesome;transform:rotate(90deg)}.ui-helper{border:1rem dashed var(--color-accent);min-width:30rem !important;min-height:30rem !important;z-index:12 !important;opacity:1 !important}.ui-helper:after{content:"";display:block;width:100%;height:100%;background:var(--color-accent);opacity:.25}.ui-draggable-handle:not(.label){position:absolute;top:5rem;left:5rem;z-index:100000;height:20rem;width:20rem;display:flex;justify-content:center;align-items:center;border-radius:100%;background:var(--color-accent);box-shadow:0 0 4rem 0 var(--color-bg)}.ui-draggable-handle:not(.label):before{content:"\f0b2";font-family:FontAwesome;transform:rotate(45deg)}.ui-draggable-handle{cursor:-webkit-grab}.ui-draggable-handle:active{cursor:-webkit-grabbing}#sidepanel{position:absolute;z-index:999999;width:var(--sidepanel-size);border:8rem solid var(--color-fg);top:0;right:0;bottom:0;margin-right:calc(-1 * var(--sidepanel-size));background:var(--color-fg);transition:transform .25s, opacity .25s;transform:translate3d(0, 0, 0);opacity:0;overflow-y:auto;overflow-x:visible}#sidepanel.sidepanel-open{transform:translate3d(calc(-1 * var(--sidepanel-size)), 0, 0);opacity:1}#sidepanel #options{position:absolute;left:0;top:0;right:0;bottom:0;list-style:none}#sidepanel #options li{display:block;margin-bottom:8rem;position:relative}#sidepanel #options li:last-child{margin:0}#sidepanel #options li .btn+span{position:absolute;right:0rem;top:0rem;padding:8rem;color:var(--color-text-fade)}#sidepanel #options li .btn+span:hover{color:var(--color-text)}#sidepanel #options li ul{padding:4rem}#sidepanel #options li ul li{margin-bottom:4rem}#sidepanel #options .editor .form{margin-top:10rem}#sidepanel #options .help{margin-top:10rem;font-size:.75em;text-align:center;font-style:italic}#sidepanel::-webkit-scrollbar-track-piece{background:var(--color-bg)}#sidepanel::-webkit-scrollbar-track-piece:vertical{border-left:8rem solid var(--color-fg)}#sidepanel::-webkit-scrollbar-thumb{background:var(--color-raised)}#sidepanel::-webkit-scrollbar-thumb:vertical{border-left:8rem solid var(--color-fg)}.actions{padding:1rem;background:var(--color-bg);display:flex;align-items:stretch;flex-wrap:wrap}.actions .title{background:var(--color-faded);min-width:100%;flex-grow:2;padding:10rem;position:relative}.actions .title:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a{min-width:33%;flex-grow:4;padding:10rem;display:block;text-align:center;position:relative;color:var(--color-text);overflow:visible}.actions a.on{pointer-events:none}.actions a.on:after{opacity:1;transform:scale(1)}.actions a:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a:after{content:"";background:var(--color-accent);position:absolute;top:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.widget{display:inline-block;height:auto;overflow:hidden;position:relative;vertical-align:top;box-shadow:-0.5rem -0.5rem 0 0.5rem;color:var(--color-bg);border-right:1rem solid var(--color-bg);border-bottom:1rem solid var(--color-bg);background:var(--color-fg);-webkit-tap-highlight-color:transparent;min-height:30rem;min-width:30rem;display:inline-flex;flex-direction:column}.widget>*{color:var(--color-text)}.widget.absolute-position{position:absolute}.widget.nolabel>.label{display:none}.widget .label{padding:10rem 10rem;text-overflow:ellipsis;overflow:hidden;text-align:center;height:35rem;max-height:35rem;width:100%;background:var(--color-faded);border-bottom:1rem solid var(--color-bg)}.widget .label.accent{color:var(--color-accent)}.widget .input{width:100%;height:30rem;border:0;background:transparent;color:var(--color-text-fade);display:block;padding:7rem 5rem;position:relative;display:var(--display-input)}.widget .input input{position:absolute;top:0;left:0;right:0;bottom:0;padding:7rem 5rem;width:100%;font:inherit;text-align:center;border:0;background:transparent;color:var(--color-accent)}.widget .input canvas{width:100%;height:100%;opacity:0.8}.widget .input input+canvas{visibility:hidden}.widget .input:focus{color:var(--color-accent)}.widget .input[disabled]{color:var(--color-text-fade)}.fader-container{--color-custom:var(--color-accent);--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);width:100rem;min-height:200rem;height:100%}.fader-container.align-right .fader-wrapper .fader{margin-left:calc(50% + 10rem)}.fader-container.align-right .fader-wrapper .meter-container{right:auto;left:-13rem !important}.fader-container.align-right .fader-wrapper .pips{margin-left:-20rem}.fader-container.align-right .fader-wrapper .pips .pip{right:0;left:auto}.fader-container.align-right .fader-wrapper .pips .pip span{right:3rem;left:auto}.fader-container.align-right.compact .fader-wrapper-outer .fader-wrapper .fader .meter-container{left:0 !important;right:auto !important}.fader-container.align-right.compact .has-meter .input{left:calc(50% + 2rem)}.fader-container.compact .fader-wrapper-outer .input{position:absolute;top:50%;transform:rotate(-90deg);pointer-events:none;width:100rem;margin-left:-50rem;left:50%;z-index:3}.fader-container.compact .fader-wrapper-outer .fader-wrapper{padding:1rem 0 0 !important;background:var(--color-track)}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader{width:100%;margin:0}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader:before{content:none}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .gauge{opacity:.25}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .knob{width:100%;height:1rem;background:var(--color-knob)}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .knob:before,.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .knob:after{display:none}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .pips{display:none}.fader-container.compact .fader-wrapper-outer .fader-wrapper .fader .meter-container{right:-1rem !important;left:auto !important;width:4rem;top:-2rem}.fader-container.compact .has-meter .input{left:calc(50% - 2rem)}.fader-container .input{margin-top:-5rem}.fader-container .fader-wrapper-outer{display:flex;flex-direction:column;flex:1}.fader-container .fader-wrapper{padding:20rem;flex:1;overflow:hidden;position:relative;display:flex;flex-direction:column;cursor:-webkit-grab}.fader-container .fader-wrapper:active{cursor:-webkit-grabbing}.fader-container .fader-wrapper .fader{width:2rem;position:relative;margin:0 auto;margin-right:calc(50% + 15rem);pointer-events:none;flex:1}.fader-container .fader-wrapper .fader:before{content:"";width:100%;height:100%;background:var(--color-track);z-index:1;display:block;box-shadow:0 0 0 15rem;color:var(--color-fg);position:absolute}.fader-container .fader-wrapper .fader .gauge{position:absolute;bottom:0 !important;top:0 !important;width:100%;height:100%;transform-origin:bottom;max-height:100%;max-width:100%;background:var(--color-gauge);z-index:1}.fader-container .fader-wrapper .fader .knob{position:absolute;bottom:0;width:0;height:0;z-index:2}.fader-container .fader-wrapper .fader .knob:before{content:"";position:absolute;top:-4rem;left:-3rem;height:8rem;width:8rem;background:var(--color-knob);border:none !important;border-radius:100% !important}.fader-container .fader-wrapper .fader .knob:after{content:"";position:absolute;top:-10rem;left:-9rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-knob);opacity:.2}.fader-container .fader-wrapper .fader .meter-container{position:absolute;z-index:2;left:auto;right:-15rem;bottom:0;top:0;min-width:0;min-height:0;width:4rem;background:var(--color-bg);height:auto}.fader-container .fader-wrapper .fader .meter-container .meter{margin:0}.fader-container .fader-wrapper .pips{position:absolute;top:0;bottom:0;left:50%;z-index:0;width:4rem;margin-left:17rem;background:linear-gradient(to bottom, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:100% 5px;background-repeat:repeat-y}.fader-container .fader-wrapper .pips .pip{height:1px;background:var(--color-pips);color:var(--color-fg);position:absolute;width:8rem;left:0}.fader-container .fader-wrapper .pips .pip:before{content:"";position:absolute;top:-4px;left:0;right:0;bottom:-4px;background:var(--color-fg);z-index:-1}.fader-container .fader-wrapper .pips .pip span{position:absolute;width:30rem;display:block;text-align:center;font-size:10rem;line-height:12rem;left:3rem;top:-5.5rem;color:var(--color-pips)}.fader-container .fader-wrapper.no-pip .pips{display:none !important}.fader-container .fader-wrapper.no-pip .fader{margin:0 auto}.fader-container.horizontal{min-height:80rem;height:auto;width:300rem;flex-shrink:0}.fader-container.horizontal.compact .fader-wrapper-outer .input{transform:none;top:50%;margin-top:-15rem}.fader-container.horizontal.compact .fader-wrapper-outer .fader-wrapper{display:flex;flex:1;padding:0 1rem 0 0 !important}.fader-container.horizontal.compact .fader-wrapper-outer .fader{height:100%;top:0}.fader-container.horizontal.compact .fader-wrapper-outer .fader .knob{width:1rem;height:100%;margin-bottom:0;bottom:0}.fader-container.horizontal.compact .fader-wrapper-outer .fader .meter-container{top:0;left:0 !important;right:-1px !important;width:auto;height:4rem}.fader-container.horizontal .fader-wrapper-outer{position:relative;top:auto;justify-content:center;overflow:hidden}.fader-container.horizontal .fader-wrapper-outer .fader-wrapper{padding:20rem 20rem 40rem;display:block;flex:0;flex-shrink:0}.fader-container.horizontal .fader-wrapper-outer .fader-wrapper.no-pip{padding:20rem}.fader-container.horizontal .fader-wrapper-outer .fader{width:100%;left:auto;top:50%;height:2rem}.fader-container.horizontal .fader-wrapper-outer .fader:before{box-shadow:none}.fader-container.horizontal .fader-wrapper-outer .fader .gauge{transform-origin:left}.fader-container.horizontal .fader-wrapper-outer .fader .meter-container{top:-15rem;left:0;right:0;bottom:auto;height:1rem;min-width:0;min-height:0;width:auto;height:4rem}.fader-container.horizontal .fader-wrapper-outer .fader .knob{bottom:1px}.fader-container.horizontal .fader-wrapper-outer .pips{top:15rem;left:0;right:0;font-size:0;height:4rem;width:100%;margin:0;background:linear-gradient(to right, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:5px 100%;background-repeat:repeat-x}.fader-container.horizontal .fader-wrapper-outer .pip{width:1px;height:6rem;margin:0}.fader-container.horizontal .fader-wrapper-outer .pip:before{top:0;bottom:0;left:-4px;right:-4px}.fader-container.horizontal .fader-wrapper-outer .pip span{top:15rem;left:-15rem !important;right:auto}.fader-container.horizontal.compact .has-meter .input{top:calc(50% + 2rem)}.knob-container{--color-custom:var(--color-accent);--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);width:100rem;height:150rem;align-items:center;flex-shrink:0}.knob-container.compact .pips{display:none}.knob-container.compact .input{position:absolute;top:50%;margin-top:-15rem;left:22%;right:22%;width:auto;pointer-events:none}.knob-container.compact .knob-wrapper-outer{position:relative}.knob-container.compact .knob-wrapper{padding:10% 0 !important}.knob-container.compact .knob:before{display:none}.knob-container .knob-wrapper-outer{width:100%;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}.knob-container .knob-wrapper-outer .input{flex-shrink:0}.knob-container .knob-wrapper-outer .knob-wrapper{padding:15rem 0 15rem;margin:0 auto;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:0;position:relative;cursor:-webkit-grab}.knob-container .knob-wrapper-outer .knob-wrapper:active{cursor:-webkit-grabbing}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip{padding-bottom:0}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip .pips{display:none}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask{width:58%;padding-bottom:58%;flex-shrink:0;border-radius:100%;pointer-events:none;position:relative}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:before{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);transform:rotate(45deg);z-index:4}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:after{content:"";position:absolute;top:0rem;left:-3rem;right:-3rem;bottom:-2rem;border-radius:100%;border:12rem solid transparent;border-bottom-color:var(--color-fg);z-index:4}.knob-container .knob-wrapper-outer .knob-wrapper .knob{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(0deg);backface-visibility:hidden;z-index:2}.knob-container .knob-wrapper-outer .knob-wrapper .knob:before{content:"";position:absolute;top:17rem;left:17rem;right:17rem;bottom:17rem;border-radius:100%;background-color:var(--color-raised)}.knob-container .knob-wrapper-outer .knob-wrapper .knob:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);border-bottom-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d2:after{border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d3:after{border-top-color:var(--color-gauge);border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .handle{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(-45deg);backface-visibility:hidden;z-index:5}.knob-container .knob-wrapper-outer .knob-wrapper .handle:before{content:"";position:absolute;top:50%;left:-3rem;margin-top:-4rem;height:8rem;width:8rem;background:var(--color-knob);border:none !important;border-radius:100% !important}.knob-container .knob-wrapper-outer .knob-wrapper .handle:after{content:"";position:absolute;top:50%;margin-top:-10rem;left:-9rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-knob);opacity:.2}.knob-container .knob-wrapper-outer .knob-wrapper .pips{width:100%;pointer-events:none;height:0}.knob-container .knob-wrapper-outer .knob-wrapper .pip{font-size:11rem;color:var(--color-pips);display:inline-block}.knob-container .knob-wrapper-outer .knob-wrapper .pip.min{width:50%;text-align:center}.knob-container .knob-wrapper-outer .knob-wrapper .pip.max{width:50%;text-align:center}.multitoggle-container,.multipush-container,.multifader-container{height:200rem;width:200rem}.multitoggle-container.nolabel .matrix,.multipush-container.nolabel .matrix,.multifader-container.nolabel .matrix{top:0}.matrix{flex:1;overflow:auto;background:var(--color-bg);display:flex;flex-wrap:wrap;flex-direction:row;margin-right:-1rem;margin-bottom:-1rem}.matrix>.widget{min-height:0;min-width:0;margin:0 !important}.matrix>.widget .label{background:none;border:0}.multifader-container .matrix{padding:0 !important;align-items:stretch}.multifader-container .widget{height:auto}.multifader-container .fader-wrapper{padding:10rem 0 20rem !important}.multifader-container .fader-wrapper .fader{left:0 !important}.xy-container,.rgb-container{--color-custom:var(--color-accent);width:200rem;height:250rem;flex-shrink:0;display:flex}.xy-wrapper{height:100%;overflow:hidden;display:flex;flex-direction:column}.xy-wrapper .value{width:100%;display:var(--display-input)}.xy-wrapper .input{width:50%;float:left;height:30rem;text-align:center;position:relative}.xy{position:relative;width:auto;height:100%;overflow:hidden;cursor:-webkit-grab;background:var(--color-faded)}.xy:active{cursor:-webkit-grabbing}.xy .handle{position:absolute;bottom:0;left:0;z-index:2;pointer-events:none;backface-visibility:hidden;transform-origin:center;transform:translate3d(0, 0, 0)}.xy .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-custom);border:none !important;border-radius:100% !important}.xy .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-custom);opacity:.2}.rgb-wrapper .input,.rgb-wrapper input{width:33.33%}.rgb .bg{position:absolute;top:0;left:0;right:0;bottom:0;background-color:red;opacity:.75;pointer-events:none}.rgb .bg:before,.rgb .bg:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%}.rgb .bg:before{background:linear-gradient(to right, #fff 0%, rgba(255,255,255,0) 100%)}.rgb .bg:after{background:linear-gradient(to bottom, transparent 0%, #000 100%)}.rgb .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-text);border:none !important;border-radius:100% !important}.rgb .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-text)}.hue{width:auto;min-height:30rem;overflow:hidden;cursor:-webkit-grab;position:relative;flex-shrink:0}.hue .bg{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0.5;background:transparent linear-gradient(to left, red, #FF0080, #f0f, #8000FF, blue, #0080FF, cyan, #00FF80, lime, #80FF00, #ff0, #FF8000, red) repeat scroll 0% 0%;pointer-events:none}.hue:active{cursor:-webkit-grabbing}.hue .handle{position:absolute;z-index:2;left:0;top:50%;pointer-events:none;transform:translate3d(0, 0, 0)}.hue .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;border:none !important;border-radius:100% !important;box-shadow:none;background:var(--color-text)}.led-container{--color-custom:var(--color-accent);width:100rem;flex-shrink:0}.led-container .led{display:flex;align-items:center;height:100%;padding:10rem 0;overflow:hidden}.led-container .led div{border-radius:100%;width:calc(100% - 20rem);padding-bottom:calc(100% - 20rem);margin:0 auto;background:var(--color-track);position:relative}.led-container .led div span{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;display:block;background-color:var(--color-custom)}.led-container .led div span:after{content:"";border-radius:100%;position:absolute;top:-1rem;left:-1rem;right:-1rem;bottom:-1rem;display:block;border:6rem solid var(--color-fg);opacity:0.8}.plot-container,.visualizer-container{--color-custom:var(--color-accent);height:200rem;width:200rem}.plot-container .plot,.visualizer-container .plot{display:flex;flex-direction:row;flex:1;position:relative}.plot-container canvas,.visualizer-container canvas{position:absolute;top:0;left:0;width:100%;height:100%}.meter-container{--color-custom:var(--color-accent);--color-gauge:var(--color-custom);height:100rem}.meter-container .meter{display:flex;flex-direction:row;flex:1;position:relative;background:var(--color-track)}.meter-container .meter .level{width:100%;flex:1;transform-origin:bottom;background:var(--color-custom)}.meter-container .meter::after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:linear-gradient(transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:100% 2px;background-repeat:repeat}.meter-container .meter.horizontal::after{background-image:linear-gradient(to left, transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:2px 100%}.meter-container .meter.horizontal .level{transform-origin:left}.text-container{--color-custom:var(--color-accent)}.text-container .text{flex:1;height:35rem;padding:10rem;justify-content:center;display:flex;align-items:center;background:var(--color-faded);color:var(--color-custom)}.text-container .text.vertical{transform:rotate(180deg);text-overflow:ellipsis;overflow:hidden;-webkit-writing-mode:vertical-lr}.toggle-container{--color-custom:var(--color-accent);width:100rem;min-height:65rem;flex-shrink:0;padding:0 !important;background:var(--color-raised);cursor:pointer}.toggle-container .label{position:absolute;top:1rem;left:0;right:0;bottom:0;height:auto;max-height:initial;border:0;background:none !important;text-align:center;pointer-events:none;display:flex;justify-content:center;align-items:center}.toggle{position:absolute;top:0;left:0;right:0;bottom:0}.toggle .light{position:absolute;left:2rem;right:2rem;top:2rem;height:2rem;pointer-events:none;background:var(--color-custom)}.toggle .light:after{content:"";width:100%;height:100%;display:block;background:var(--color-track)}.toggle.on .light:after{display:none}.push-container{--color-custom:var(--color-accent);width:100rem;min-height:65rem;flex-shrink:0;padding:0 !important;background:var(--color-raised);cursor:pointer}.push-container .label{position:absolute;top:0;left:0;right:0;bottom:0;height:auto;max-height:initial;border:0;background:none !important;text-align:center;pointer-events:none;display:flex;justify-content:center;align-items:center;z-index:1}.push-container .push.active{background:var(--color-fg)}.push-container .push .light{position:absolute;left:auto;background:var(--color-custom);height:4rem;width:4rem;border-radius:4rem;overflow:hidden}.switch-container{--color-custom:var(--color-accent);width:100rem;flex-shrink:0}.switch-container .switch{height:100%;width:100%;cursor:pointer;display:flex;flex-direction:column;align-items:stretch;flex:1}.switch-container .switch.horizontal{flex-direction:row}.switch-container .switch.horizontal .value{padding:28rem 6rem 6rem 6rem;text-align:center;display:flex;justify-content:center;flex-direction:column;border-top:0;border-right:1rem solid var(--color-bg);flex:1;height:auto}.switch-container .switch.horizontal .value:last-child{border-right:0}.switch-container .switch.horizontal .value:before{left:50%;top:8rem;width:8rem;height:8rem;margin-left:-4rem;margin-top:0}.switch-container .switch .value{background:var(--color-raised);color:var(--color-text);width:100%;height:100%;position:relative;border-top:1rem solid var(--color-bg);padding:12rem 12rem 12rem 24rem;white-space:normal;text-align:left;word-break:break-all;overflow:hidden;display:flex;flex-direction:column;justify-content:center}.switch-container .switch .value:first-child{border-top:0}.switch-container .switch .value:last-child{margin-bottom:0}.switch-container .switch .value:before{content:"";position:absolute;left:8rem;top:50%;width:8rem;height:8rem;margin-top:-4rem;background:var(--color-track);border-radius:8rem}.switch-container .switch .value.on:before{background:var(--color-custom)}.strip-container{width:100rem;height:100%;overflow:visible;border:0}.strip-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;pointer-events:none;z-index:2}.strip-container>.strip{height:100%;display:flex;flex-direction:column}.strip-container>.strip>.widget{width:auto;margin:0;box-shadow:none}.strip-container.vertical>.strip>.widget{max-width:100%}.strip-container.vertical::before{border-right:1rem solid var(--color-bg)}.strip-container.horizontal{width:100%;height:200rem;display:flex;flex-direction:row}.strip-container.horizontal::before{border-bottom:1rem solid var(--color-bg)}.strip-container.horizontal>.strip{flex-direction:row;flex:1}.strip-container.horizontal>.strip>.widget{flex-shrink:initial;width:100%;min-height:100%;max-height:100%;height:100%}.strip-container.horizontal>.label{width:35rem;height:100%;border-bottom:0;border-right:1rem solid var(--color-bg);max-height:initial}.strip-container.horizontal>.label span{transform:rotate(180deg);display:block;position:relative;overflow:hidden;text-overflow:ellipsis;-webkit-writing-mode:vertical-lr;text-align:center;height:100%}.panel-container{width:200rem;height:200rem;border:0;background:var(--color-faded)}.panel-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;border-bottom:1rem solid var(--color-bg);border-right:1rem solid var(--color-bg);pointer-events:none;z-index:2}.panel-container ::-webkit-scrollbar-thumb,.panel-container ::-webkit-scrollbar-track-piece{border-top:1rem solid var(--color-bg)}.panel-container.nolabel .panel{top:0}.panel-container .panel{overflow:auto;position:absolute;top:35rem;left:0;right:0;bottom:0}.panel-container .panel.has-tabs{display:flex;flex-direction:column;background:var(--color-bg)}.panel-container .panel.noscroll{overflow:hidden}.panel-container .panel.noscroll>.widget{max-width:100%;max-height:100%}.panel-container .navigation{border-top:0;background:transparent}.panel-container .navigation:after{background:var(--color-bg)}.panel-container .navigation a.on{border-color:var(--color-bg)}.panel-container .content{background:transparent}input:focus::selection{background:var(--color-accent);color:var(--color-text)}input{cursor:text}html,body{height:100%;overflow:hidden;position:relative}html{font-size:calc(var(--pixel-scale) * 1px);max-height:999999px}body{font-size:13rem;line-height:16rem;font-family:Droid Sans;color:var(--color-text);white-space:nowrap;opacity:1;cursor:default}i{font-size:14rem !important}.btn{background:var(--color-raised);display:block;padding:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;cursor:pointer}.btn.small{padding:8rem;padding-right:15rem}.btn.warning{background:firebrick}.btn.disabled{pointer-events:none;color:var(--color-text-fade)}.btn.align-center{text-align:center}#lobby{background:var(--color-bg);position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;display:flex;align-items:center;justify-content:center;overflow-y:auto;padding:20rem}#lobby .main{width:600rem;max-width:100%;max-height:100%;display:flex;flex-direction:column}#lobby .list{flex:1;overflow:auto;background:var(--color-fg);border-top:2rem solid var(--color-bg)}#lobby .header{padding:20rem;white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background-color:var(--color-faded);color:var(--color-accent);font-size:16rem;line-height:24rem}#lobby .footer{background:var(--color-raised);white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background:var(--color-faded);border-top:2rem solid var(--color-bg)}#lobby a{display:block;padding-right:35rem;overflow:hidden;padding-top:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;background:none;border-bottom:1rem solid var(--color-bg)}#lobby a:hover{background:var(--color-raised)}#lobby a:last-child{border-bottom:0}#lobby a span{position:absolute;right:0rem;top:0rem;padding:15rem;color:var(--color-text-fade)}#loading{position:absolute;top:50%;left:50%;margin-top:-15rem;text-align:center}#loading .spinner{display:block;margin:0 auto;height:30rem;width:30rem;border-radius:50%;border:2rem solid var(--color-track);border-top-color:var(--color-accent);animation:spin .5s linear infinite}#loading #status{margin-top:10rem;display:inline-block}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.popup{position:fixed;top:0;left:0;right:0;bottom:0;padding:10%;display:flex;align-items:center;z-index:1000000}.popup:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--color-bg);opacity:.5}.popup .popup-title{position:relative;padding:15rem;background:var(--color-raised)}.popup .popup-title .closer{position:absolute;right:0rem;top:0;padding:15rem;color:var(--color-text-fade);cursor:pointer}.popup .popup-wrapper{display:flex;flex-direction:column;align-items:stretch;background:var(--color-fg);width:auto;max-width:600rem;margin:0 auto;position:relative;overflow:hidden;border:1rem solid var(--color-track)}.popup .popup-wrapper .popup-content{height:100%;width:100%;padding:10rem;overflow-y:auto;white-space:normal} diff --git a/browser/favicon.ico b/browser/favicon.ico new file mode 120000 index 00000000..4057c25b --- /dev/null +++ b/browser/favicon.ico @@ -0,0 +1 @@ +../resources/images/logo.ico \ No newline at end of file diff --git a/browser/fonts/droid-sans.css b/browser/fonts/droid-sans.css new file mode 100644 index 00000000..c35e4b1a --- /dev/null +++ b/browser/fonts/droid-sans.css @@ -0,0 +1,6 @@ +@font-face { + font-family: 'Droid Sans'; + font-style: normal; + font-weight: 400; + src: local('Droid Sans'), local('DroidSans'), url('droid-sans.woff2') format('woff2'); +} diff --git a/browser/fonts/droid-sans.woff2 b/browser/fonts/droid-sans.woff2 new file mode 100644 index 00000000..79b4b8d3 Binary files /dev/null and b/browser/fonts/droid-sans.woff2 differ diff --git a/browser/fonts/font-awesome.min.css b/browser/fonts/font-awesome.min.css new file mode 100644 index 00000000..79af8f65 --- /dev/null +++ b/browser/fonts/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/browser/fonts/fontawesome-webfont.woff2 b/browser/fonts/fontawesome-webfont.woff2 new file mode 100644 index 00000000..7eb74fd1 Binary files /dev/null and b/browser/fonts/fontawesome-webfont.woff2 differ diff --git a/browser/index-headless.html b/browser/index-headless.html new file mode 100644 index 00000000..0abeffbe --- /dev/null +++ b/browser/index-headless.html @@ -0,0 +1,17 @@ + + + + + + + + + + + +
+
+
+ + + diff --git a/browser/index.html b/browser/index.html new file mode 100644 index 00000000..b4f3437a --- /dev/null +++ b/browser/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + + +
+
+
+ + + diff --git a/browser/js/app.js b/browser/js/app.js new file mode 100644 index 00000000..81ac09bf --- /dev/null +++ b/browser/js/app.js @@ -0,0 +1,54 @@ +/////////////////////// + +WIDGETS = {} +WIDGETS_LINKED = {} +WIDGETS_BY_PATH = {} +SESSION = [] +STATE = [] + +CLIPBOARD = null +EDITING = false + +TRAVERSING = false + +TABS = {} + + +MISC = { + iterators: { + widget:{}, + tab:{} + } +} + + +PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale") +INITIALZOOM = PXSCALE + + +/////////////////////// + +$ = jQuery = require('./jquery/jquery.min') +require('./jquery/jquery.ui') +require('./jquery/jquery.drag') +require('./jquery/jquery.resize') +require('./jquery/jquery.fake-input') + +/////////////////////// + +var callbacks = require('./app/callbacks') + +var bindCallback = function(i) { + IPC.on(i,function(event,data){ + callbacks[i](event,data) + }) +} + +for (i in callbacks) { + bindCallback(i) +} + +/////////////////////// + + +IPC.send('ready') diff --git a/browser/js/app/actions.js b/browser/js/app/actions.js new file mode 100644 index 00000000..9c1d2c13 --- /dev/null +++ b/browser/js/app/actions.js @@ -0,0 +1,156 @@ +module.exports = { + + stateQuickSave: function(preset){ + if (preset) { + STATE = preset + } else { + STATE = module.exports.stateGet() + } + $('.quickload').removeClass('disabled') + }, + + stateQuickLoad: function(){ + module.exports.stateSet(STATE,true) + }, + + stateSave: function() { + state = JSON.stringify(module.exports.stateGet(),null,' ') + if (WEBFRAME) { + IPC.send('stateSave',state) + } else { + var down = $('') + var blob = new Blob([state],{type : 'text/plain'}); + down.attr('href', window.URL.createObjectURL(blob)) + down[0].click() + } + + }, + + stateGet: function (){ + var data = [] + for (i in WIDGETS) { + var widget = WIDGETS[i] + for (var j=widget.length-1;j>=0;j--) { + if (widget[j].setValue && widget[j].getValue) { + var v = widget[j].getValue() + if (v!=undefined) data.push([i,v]) + break + } + } + } + return data + }, + + stateLoad: function() { + if (WEBFRAME) { + IPC.send('stateLoad') + } else { + var prompt = $('') + prompt.click() + prompt.on('change',function(e){ + var reader = new FileReader(); + reader.onloadend = function(e) { + var preset = e.target.result + module.exports.stateSet(JSON.parse(preset),true) + STATE = preset + } + reader.readAsText(e.target.files[0],'utf-8'); + }) + } + }, + + stateSend: function(){ + var data = module.exports.stateGet() + module.exports.stateSet(data,true) + + }, + + stateSet: function(preset,send){ + + for (i in preset) { + var data = preset[i] + if (WIDGETS[data[0]]!=undefined) { + for (var i=WIDGETS[data[0]].length-1;i>=0;i--) { + if (WIDGETS[data[0]][i].setValue) { + WIDGETS[data[0]][i].setValue(data[1],send,false) + } + } + } + } + }, + + toggleFullscreen: function(){ + + if (WEBFRAME) { + IPC.send('fullscreen') + } else { + var isInFullScreen = document.webkitIsFullScreen + + if (isInFullScreen) { + document.webkitExitFullscreen() + } else { + document.documentElement.webkitRequestFullScreen() + } + } + }, + + sessionBrowse: function(){ + + if (WEBFRAME) { + IPC.send('sessionBrowse') + } else { + var prompt = $('') + prompt.click() + prompt.on('change',function(e){ + var reader = new FileReader(); + reader.onloadend = function(e) { + var session = e.target.result + IPC.send('sessionOpen',{file:session}) + } + reader.readAsText(e.target.files[0],'utf-8'); + }) + } + }, + + sessionSave: function() { + var sessionfile = JSON.stringify(SESSION,null,' ') + if (WEBFRAME) { + IPC.send('sessionSave',sessionfile) + } else { + var down = $('') + var blob = new Blob([sessionfile],{type : 'text/plain'}); + down.attr('href', window.URL.createObjectURL(blob)) + down[0].click() + } + + }, + + editorEnable: function(){ + $('.editor-root').attr('data-tab','#container').removeClass('disabled') + $('.enable-editor').addClass('on') + $('.disable-editor').removeClass('on') + + EDITING = true + }, + editorDisable: function(){ + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + $('.editing').removeClass('editing') + $('.editor-root').addClass('disabled') + $('.editor-container').remove() + $('.disable-editor').addClass('on') + $('.enable-editor').removeClass('on') + + EDITING = false + }, + + traversingDisable: function(){ + $('.traversingEnable, .traversingDisable').toggleClass('on') + $(document).trigger('disableTraversingGestures') + }, + traversingEnable: function(){ + $('.traversingEnable, .traversingDisable').toggleClass('on') + $(document).enableTraversingGestures() + } + +} diff --git a/browser/js/app/callbacks.js b/browser/js/app/callbacks.js new file mode 100644 index 00000000..549722cc --- /dev/null +++ b/browser/js/app/callbacks.js @@ -0,0 +1,102 @@ +var init = require('./init'), + actions = require('./actions'), + utils = require('./utils'), + icon = utils.icon + +module.exports = { + + receiveOsc: function(event,data){ + var data = data || event + + // fetch ids corresponding to the osc path + var path = data.path, + pathref = path, + args = data.args + + if (typeof data.args == 'object') { + for (var i=data.args.length-1;i>=0;i--) { + var ref = path+'||||'+data.args.slice(0,i).join('||||') + if (WIDGETS_BY_PATH[ref]) { + pathref = ref + args = data.args.slice(i,data.args.length) + args = args.length==1?args[0]:args + continue + } + } + } else { + args = data.args + } + for (i in WIDGETS_BY_PATH[pathref]) { + if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,false,true) + } + + + }, + + stateLoad: function(event,data){ + var data = data || event + data = JSON.parse(data) + actions.stateSet(data,true) + actions.stateQuickSave(data) + }, + + sessionList: function(event,data){ + var data = data || event + $('#lobby').append(` +
+
+ Open Stage Control +
+
+ +
`) + + for (i in data) { + $('#lobby .list').append(''+data[i]+''+icon('remove')+'') + } + $('#lobby .footer').append(''+icon('folder-open')+' Browse') + $('#lobby .footer').append(''+icon('file-o')+' New') + $('#lobby .load').click(function(e){ + e.stopPropagation() + IPC.send('sessionOpen',{path:$(this).data('session')}) + }) + $('#lobby a span').click(function(e){ + e.stopPropagation() + IPC.send('sessionRemoveFromHistory',$(this).parent().data('session')) + $(this).parents('a').remove() + }) + $('#lobby .browse').click(function(e){ + e.stopPropagation() + actions.sessionBrowse() + }) + $('#lobby .new').click(function(e){ + e.stopPropagation() + init([{}],function(){$('#open-toggle, .enable-editor').click();$('.editor-root').trigger('mousedown.editor')}) + }) + }, + + sessionOpen: function(event,data){ + var data = data || event + var session = JSON.parse(data) + init(session) + + }, + + error: function(event,data){ + var data = data || event + + utils.createPopup(icon('warning')+' '+data.title,data.text) + }, + + applyStyle: function(event,data){ + var data = data || event + var style = document.createElement('style'); + style.innerHTML = data.join(''); + document.body.appendChild(style); + if (data.indexOf('--pixel-scale')!=-1) { + PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1] + INITIALZOOM = PXSCALE + } + } + +} diff --git a/browser/js/app/editor/context-menu.js b/browser/js/app/editor/context-menu.js new file mode 100644 index 00000000..fac69ec0 --- /dev/null +++ b/browser/js/app/editor/context-menu.js @@ -0,0 +1,59 @@ +var correctPosition = function (m, parent){ + var pos = m.offset(), + width = m.outerWidth(), + height = m.outerHeight(), + totalWidth = $('body').outerWidth(), + totalHeight = $('body').outerHeight(), + leftAdjust = parent=='body'?0:parent.outerWidth()-2 + + if (width + pos.left > totalWidth) { + m.css({'margin-left':totalWidth-(width + pos.left + leftAdjust)}) + } + if (height + pos.top > totalHeight) { + m.css({'margin-top':totalHeight-(height + pos.top)}) + } +} + +var ev = 'fake-click' + + +var menu = function(e,actions,parent){ + + var m = $('
') + if (parent=='body') { + m.css({top:e.pageY+'px',left:e.pageX+'px'}) + } + + for (label in actions) { + + if (typeof actions[label] == 'object') { + + var item = $(`
${label}
`).appendTo(m).on(ev,function(e){e.stopPropagation()}) + menu(e,actions[label],item) + + + } else { + + $(`
${label}
`).on(ev + '.editor',function(){ + var callback = actions[label] + return function(e){ + callback() + $('.context-menu').remove() + } + }()).appendTo(m) + } + } + + m.appendTo(parent) + + + + if (parent=='body') { + correctPosition(m,parent) + } else { + parent.hover(function(){correctPosition(m,parent)}) + } + +} + +module.exports = menu diff --git a/browser/js/app/editor/data-workers.js b/browser/js/app/editor/data-workers.js new file mode 100644 index 00000000..73e9d13d --- /dev/null +++ b/browser/js/app/editor/data-workers.js @@ -0,0 +1,170 @@ +var widgets = require('../widgets'), + widgetOptions = widgets.widgetOptions, + sync = widgets.sync, + parser = require('../parser') + parsewidgets = parser.widgets, + parsetabs = parser.tabs, + ui = require('../ui'), + actions = require('../actions'), + sidepanelCreateToggle = require('../sidepanel').createToggle, + editObject = function(a,b){require('./edit-objects').editObject(a,b,true)}, + editSession = function(a,b){require('./edit-objects').editSession(a,b,true)}, + purgeStores = require('./purge') + + +var getObjectData = function(obj){ + var path = [] + + if (obj.hasClass('tab')) { + return TABS['#'+obj.attr('id')].data + } + + if (obj.is('#container')) { + return SESSION + } + + while(true) { + if (obj.hasClass('widget')) { + path.unshift(obj.index()) + path.unshift('widgets') + } else if (obj.hasClass('tab')){ + path.unshift(obj.data('index')) + path.unshift('tabs') + } else if (obj.is('#container')) { + break + } + + obj = obj.parent() + } + + path.splice(0,1) + + for (var i=0,data=SESSION, path=path, len=path.length; i${data.label}`) + + editObject(newContainer,data) + + } else if (container.attr('id')=='container') { + // session + var newContainer = $('#container') + container.empty() + parsetabs(data,container,true) + + editSession(newContainer,data) + sidepanelCreateToggle() + + } + + newContainer.find('[data-tab]:first-child').click() + + $(window).resize() + + purgeStores(purgetabs) + + // restore state + actions.stateSet(state,false) + sync() + ui.scrolls() + $('#sidepanel').scrollTop(scroll) + + + // return updated node + return newContainer + +} + + +var incrementWidget = function(data){ + + if (!data) return + + delete data.linkId + + var id = data.id, + label = data.label, + path = data.path + + if (id && id==label) { + data.label = 'auto' + } + if (id && path == '/'+id) { + + data.path = 'auto' + + } else if (path){ + var pathref + while (WIDGETS_BY_PATH[pathref]) { + path = path.replace(/([0-9]*)$/,function(m){ + var n = parseInt(m)+1 + n = isNaN(n)?1:n + return n + }) + pathref = data.preArgs&&data.preArgs.length?data.path+'||||'+data.preArgs.join('||||'):data.path + } + WIDGETS_BY_PATH[pathref] = [] + data.path = path + + } + + if (id) { + while (WIDGETS[id]) { + id = id.replace(/([0-9]*)$/,function(m){ + var n = parseInt(m)+1 + n = isNaN(n)?1:n + return n + }) + } + WIDGETS[id] = [] + data.id = id + + } + + + for (i in data) { + if (typeof data[i] == 'object') data[i] = incrementWidget(data[i]) + } + + return data + +} + +module.exports = { + updateDom:updateDom, + getObjectData:getObjectData, + incrementWidget:incrementWidget +} diff --git a/browser/js/app/editor/edit-objects.js b/browser/js/app/editor/edit-objects.js new file mode 100644 index 00000000..8bffcaad --- /dev/null +++ b/browser/js/app/editor/edit-objects.js @@ -0,0 +1,310 @@ +var updateDom = require('./data-workers').updateDom, + widgetOptions = require('../widgets').widgetOptions + +var ev = 'fake-click' + + +var editObject = function(container, data, refresh){ + + if (!refresh && (container.hasClass('editing') || $(`a[data-tab="#${container.attr('id')}"]`).hasClass('editing'))) return + + var isWidget = container.hasClass('widget') + + $('.editing').removeClass('editing') + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + + + if (isWidget) { + $(container).addClass('editing') + } else { + $(`[data-tab="#${container.attr('id')}"]`).addClass('editing').click() + $(container).parent().addClass('editing') + } + + + + $('.editor-container').remove() + $('.editor').append('
') + var form = $('
').appendTo('.editor-container') + + + var params = isWidget?widgetOptions[data.type]:{label:''} + + for (i in params) { + + if (i.indexOf('separator')!=-1) { + $(`
${params[i]}
`).appendTo(form) + continue + } else if (data[i]===undefined) { + continue + } + + // Common options edit + if (i!='widgets' && i!='tabs') { + + var type = typeof data[i], + value = type == 'object'?JSON.stringify(data[i]):data[i], + wrapper = $('
').appendTo(form), + label = $(``).appendTo(wrapper), + input + + if (i=='type') { + + input = $(``) + input.click(function(){ + $(this).val(!eval($(this).val())).trigger('change') + }) + input.appendTo(wrapper) + + } else { + + input = $(``) + input.appendTo(wrapper) + + } + + + input.on('change',function(){ + // var v = $(this).val()!= '' && $(this).data('type') == 'object'?JSON.parse($(this).val()):$(this).val() + var v + try { + eval(`v=${$(this).val()}`) + } catch(err) { + v = $(this).val() + } + + data[$(this).attr('title')] = v + if (v==='') delete data[$(this).attr('title')] + updateDom(container,data) + }) + + } + + } + + // widget list edit + if (((isWidget&&widgetOptions[data.type].widgets) || (container.hasClass('tab'))) && (!data.tabs||!data.tabs.length)) { + + var list = $(''), + wrapper = $('
').appendTo(form) + + var editItem = function(i) { + return function(){ + container.find('.widget').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data.widgets) { + + + var item = $(`
  • ${data.widgets[i].id||data.widgets[i].label}
  • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.widgets.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + list.sortable({ + forcePlaceholderSize: true, + items: '.sortables', + start:function(){$(this).sortable( "refreshPositions" )}, + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.widgets.splice(newIndex, 0, data.widgets.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
  • +
  • `).appendTo(list).click(function(){ + data.widgets = data.widgets || [] + data.widgets.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + + } + + // tab list edit + if (((isWidget&&widgetOptions[data.type].tabs) || (container.hasClass('tab'))) && (!data.widgets||!data.widgets.length)) { + //tabs + var list = $(''), + wrapper = $('
    ').appendTo(form) + + + var editItem = function(i) { + return function(){ + container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data.tabs) { + var item = $(`
  • ${data.tabs[i].label}
  • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.tabs.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + list.sortable({ + start:function(){$(this).sortable( "refreshPositions" )}, + forcePlaceholderSize: true, + items: '.sortables', + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.tabs.splice(newIndex, 0, data.tabs.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
  • +
  • `).appendTo(list).click(function(){ + data.tabs = data.tabs || [] + data.tabs.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + } + + if (data.hasOwnProperty('width')) { + var handleTarget + container.resizable({ + handles:'s, e, se', + helper: "ui-helper", + start: function(event, ui){ + handleTarget = $(event.originalEvent.target) + }, + stop: function( event, ui ) { + if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)/PXSCALE + if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)/PXSCALE + updateDom(container,data) + } + }) + } + + if (data.hasOwnProperty('top')) { + container.draggable({ + cursor:'-webkit-grabbing', + stop: function( event, ui ) { + event.preventDefault() + data.top = (ui.helper.position().top + container.parent().scrollTop())/PXSCALE + data.left = (ui.helper.position().left + container.parent().scrollLeft())/PXSCALE + ui.helper.remove() + updateDom(container,data) + }, + handle:'.ui-draggable-handle, > .label', + snap:'.widget', + snapTolerance:5, + helper:function(){return $('
    ').css({height:container.outerHeight(),width:container.outerWidth()})} + }).append('
    ') + } + +} + +var editSession = function(container,data,refresh){ + + if (!refresh && $('.editor-root').hasClass('editing')) return + + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + + + $('.editing').removeClass('editing') + $('.editor-root, #container').addClass('editing') + + $('.editor-container').remove() + $('.editor').append('
    ') + + + var form = $('
    ').appendTo('.editor-container'), + list = $(''), + wrapper = $('
    ').appendTo(form) + + + var editItem = function(i) { + return function(){ + container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data) { + var item = $(`
  • ${data[i].label}
  • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + + list.sortable({ + start:function(){$(this).sortable( "refreshPositions" )}, + forcePlaceholderSize: true, + items: '.sortables', + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.splice(newIndex, 0, data.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
  • +
  • `).appendTo(list).click(function(){ + data = data || [] + data.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + + + $('.editor-container').append(form) + +} + +module.exports = { + editObject:editObject, + editSession:editSession +} diff --git a/browser/js/app/editor/init.js b/browser/js/app/editor/init.js new file mode 100644 index 00000000..8103c259 --- /dev/null +++ b/browser/js/app/editor/init.js @@ -0,0 +1,182 @@ +var data = require('./data-workers'), + getObjectData = data.getObjectData, + updateDom = data.updateDom, + incrementWidget = data.incrementWidget, + edit = require('./edit-objects'), + editObject = edit.editObject, + editSession = edit.editSession, + createPopup = require('../utils').createPopup, + widgetOptions = require('../widgets').widgetOptions, + widgetCategories = require('../widgets').categories, + menu = require('./context-menu') + + + +var init = function(){ + + $('body').off('.editor').on('fake-click fake-right-click',function(e,d){ + + if (!EDITING) return + + // ignore mouse event when fired by a simulated touch event + if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return + + $('.context-menu').remove() + + var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')? + $(e.target): + $(e.target).closest('.widget:not(.not-editable), .tab, [data-tab], #container') + + if (!target.length) return + + var container = target.attr('data-tab')?TABS[target.attr('data-tab')].tab:target, + type = target.hasClass('widget')?'widget':'tab', + parent = container.parent(), + index = container.index(), + data = getObjectData(container) + + if (container.attr('id')=='container') { + editSession(container,SESSION) + } else { + editObject(container,data) + } + + + if (e.type!='fake-right-click') return + + if (container.attr('id')=='container') { + menu(d,{ + ' Add tab': function(){ + data.push({}) + updateDom(container,data) + } + },'body') + + return + } + + + var actions = {} + + // actions[' Edit'] = function(){editObject(container,data)} + + if (type=='widget') actions[' Copy'] = function(){CLIPBOARD=data} + + if (type=='widget') actions[' Cut'] = function(){ + CLIPBOARD=JSON.parse(JSON.stringify(data)) + var parentContainer = container.parents('.widget, .tab, #container').first() + parentData = getObjectData(parentContainer) + + parentData.widgets.splice(container.index(),1) + updateDom(parentContainer,parentData) + } + + if (((type=='widget'&&widgetOptions[data.type].widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) { + + if (CLIPBOARD!=null) { + actions[' Paste'] = { + ' ID + 1':function(){ + data.widgets = data.widgets || [] + var newData = incrementWidget(JSON.parse(JSON.stringify(CLIPBOARD))) + + + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } else { + delete newData.top + delete newData.left + } + + data.widgets.push(newData) + updateDom(container,data) + }, + ' Clone':function(){ + data.widgets = data.widgets || [] + var newData = JSON.parse(JSON.stringify(CLIPBOARD)) + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } else { + delete newData.top + delete newData.left + } + data.widgets.push(newData) + updateDom(container,data) + } + } + } + + actions[' Add widget'] = {} + var createFunction = function(widgetType,container,data){ + return function() { + data.widgets = data.widgets || [] + var newData = {type:widgetType} + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } + data.widgets.push(newData) + updateDom(container,data) + } + } + for (category in widgetCategories) { + actions[' Add widget'][category] = {} + for (t in widgetCategories[category]) { + var wtype = widgetCategories[category][t] + actions[' Add widget'][category][wtype] = createFunction(wtype,container,data) + + } + } + + } + if (((type=='widget'&&widgetOptions[data.type].tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) { + + actions[' Add tab'] = function(){ + data.tabs = data.tabs || [] + data.tabs.push({}) + updateDom(container,data) + } + + } + + actions[' Delete'] = function(){ + var popup = createPopup('Are you sure ?',` +
    +
    DELETE
    +
    CANCEL
    +
    + `) + $('.confirm-delete').click(function(){ + popup.close() + var parentContainer = container.parents('.widget, .tab, #container').first() + parentData = getObjectData(parentContainer) + + + if (type=='widget') { + parentData.widgets.splice(container.index(),1) + } else if (type=='tab' && parentContainer.attr('id')!='container') { + parentData.tabs.splice(container.data('index'),1) + } else { + parentData.splice(container.data('index'),1) + } + + updateDom(parentContainer,parentData) + }) + $('.cancel-delete').click(function(){ + popup.close() + }) + $(document).on('keydown.popup', function(e){ + if (e.keyCode==13) $('.confirm-delete').click() + }) + + + } + + menu(d,actions,'body') + + }) + +} + +module.exports = init diff --git a/browser/js/app/editor/purge.js b/browser/js/app/editor/purge.js new file mode 100644 index 00000000..ab37f3d0 --- /dev/null +++ b/browser/js/app/editor/purge.js @@ -0,0 +1,70 @@ +module.exports = function(purgetabs) { + + // prune tabs store + var count, newcount, formerBuffuredTabs, bufferedTabs + + if (purgetabs) { + while (true) { + // we need to do that several times since tabs are referenced in each of their parents + + // get all buffered tabs + formerBuffuredTabs = [] + for (i in TABS) { + formerBuffuredTabs.push(TABS[i].tab[0]) + } + + // remove deleted tabs that are not referenced (have no navigation link pointing to them) + var $f = $(formerBuffuredTabs) + for (i in TABS) { + if (!($f.find(`[data-tab="${i}"]`).length || i== '#container')) { + delete TABS[i] + } + } + + newcount = Object.keys(TABS).length + if (count == newcount) break + count = newcount + + } + } + + + bufferedTabs = [] + for (i in TABS) { + bufferedTabs.push(TABS[i].tab[0]) + } + + // prune widget stores + // if widgets cannot be found in buffered tabs, it must be unreferenced + var $b = $(bufferedTabs) + for (i in WIDGETS) { + for (var j=WIDGETS[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS[i][j]).length) { + WIDGETS[i].splice(j,1) + } + } + if (!WIDGETS[i].length) { + delete WIDGETS[i] + } + } + for (i in WIDGETS_LINKED) { + for (var j=WIDGETS_LINKED[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS_LINKED[i][j]).length) { + WIDGETS_LINKED[i].splice(j,1) + } + } + if (!WIDGETS_LINKED[i].length) { + delete WIDGETS_LINKED[i] + } + } + for (i in WIDGETS_BY_PATH) { + for (var j=WIDGETS_BY_PATH[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS_BY_PATH[i][j]).length) { + WIDGETS_BY_PATH[i].splice(j,1) + } + } + if (!WIDGETS_BY_PATH[i].length) { + delete WIDGETS_BY_PATH[i] + } + } +} diff --git a/browser/js/app/init.js b/browser/js/app/init.js new file mode 100644 index 00000000..60497957 --- /dev/null +++ b/browser/js/app/init.js @@ -0,0 +1,42 @@ +var parsetabs = require('./parser').tabs, + ui = require('./ui'), + sync = require('./widgets').sync, + editorDisable = require('./actions').editorDisable, + editorInit = require('./editor/init') + +module.exports = function(session,callback) { + + $('#lobby').remove() + $('#container').empty() + var spinner = $('
    ').appendTo('#container') + + setTimeout(function(){ + parsetabs(session,$('#container'),true) + + // var t = $('
    ').appendTo('body') + // for (id in TABS) { + // if (id!='#container') { + // t[0].appendChild(TABS[id].tab[0]) + // } + // } + // setTimeout(function(){ + // t.detach() + // },250) + + + ui.init() + editorDisable() + editorInit() + sync() + + + setTimeout(function(){ + spinner.remove() + if (!callback) return + setTimeout(function(){ + callback() + },25) + },25) + },25) + +} diff --git a/browser/js/app/parser.js b/browser/js/app/parser.js new file mode 100644 index 00000000..9331a1ed --- /dev/null +++ b/browser/js/app/parser.js @@ -0,0 +1,184 @@ +var widgets = require('./widgets'), + widgetOptions = widgets.widgetOptions, + createWidget = widgets.createWidget, + icon = require('./utils').icon + +var getIterator = function(id,type){ + var iterator = MISC.iterators[type] + if (iterator[id]==undefined) iterator[id] = 0 + iterator[id] += 1 + return iterator[id] +} + +var hashCode = function(s){ + return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); +} + +module.exports.tabs = function(data,parent,main,parentLabel){ + + if (main) { + // Reset Globals + WIDGETS = {} + WIDGETS_LINKED = {} + WIDGETS_BY_PATH = {} + SESSION = data + for (i in TABS) { + if (i!='#container') { + TABS[i].parent.remove() + TABS[i].tab.remove() + } + } + TABS['#container'] = { + tab:$('#container') + } + + MISC.iterators.tab = {} + } + + var main = main?'main ':'', + nav = $(document.createElement('div')).addClass(main + 'navigation'), + navtabs = $(document.createElement('ul')).addClass('tablist'), + content = $(document.createElement('div')).addClass('content') + + + for (i in data) { + var tabData = data[i] + + + var label = tabData.label||tabData.id||'Unnamed', + hash = hashCode(label), + id = 'tab_'+hash+'_'+getIterator('tab'+hash,'tab') + + tabData.label = label + delete tabData.id + + navtabs.append(`
  • ${label}
  • `) + + var tabContent = $(`
    `) + tabContent.data(tabData) + + + if (tabData.tabs && tabData.tabs.length) { + module.exports.tabs(tabData.tabs,tabContent,false,label) + } else if (tabData.widgets && tabData.widgets.length) { + module.exports.widgets(tabData.widgets,tabContent) + } + + // content.append(tabContent) + TABS['#'+id]= { + parent:content, + tab:tabContent, + data:tabData + } + + } + + nav[0].appendChild(navtabs[0]) + parent[0].appendChild(nav[0]) + parent[0].appendChild(content[0]) +} + + + +module.exports.widgets = function(data,parent) { + + for (i in data) { + var widgetData = data[i] + + widgetData.type = widgetData.type || 'fader' + + var tmpWidgetOptions = JSON.parse(JSON.stringify(widgetOptions)) + + for (i in tmpWidgetOptions[widgetData.type]) { + if (i.indexOf('separator')==-1 && widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i] + } + + if (widgetData.id=='auto') { + var id + while (!id || WIDGETS[id]) { + id=widgetData.type+'_'+getIterator(widgetData.type,'widget') + } + widgetData.id = id + } + + widgetData.path = widgetData.path=='auto'?'/' + widgetData.id:widgetData.path + widgetData.target = widgetData.target?(Array.isArray(widgetData.target)?widgetData.target:[widgetData.target]):false + + for (i in widgetData) { + if (widgetOptions[widgetData.type][i]===undefined && i!='type') {delete widgetData[i]} + } + + + for (t in {width:'',height:'',top:'',left:''}) { + widgetData[t] = `${widgetData[t]}`.indexOf('-')!=-1?0:widgetData[t] + } + + if (parent.hasClass('strip')) { + delete widgetData.top + delete widgetData.left + } + + if (widgetData.preArgs!=undefined) { + widgetData.preArgs = Array.isArray(widgetData.preArgs)?widgetData.preArgs:[widgetData.preArgs] + } + if (widgetData.target!=undefined) { + widgetData.target = Array.isArray(widgetData.target)?widgetData.target:[widgetData.target] + } + + var width = parseFloat(widgetData.width)==widgetData.width?parseFloat(widgetData.width)+'rem' : widgetData.width, + height = parseFloat(widgetData.height)==widgetData.height?parseFloat(widgetData.height)+'rem' : widgetData.height, + left = parseFloat(widgetData.left)==widgetData.left?parseFloat(widgetData.left)+'rem' : widgetData.left, + top = parseFloat(widgetData.top)==widgetData.top?parseFloat(widgetData.top)+'rem' : widgetData.top + + + var styleW = widgetData.width&&widgetData.width!='auto'?`width:${width};min-width:auto;`:'', + styleH = widgetData.height&&widgetData.height!='auto'?`height:${height};min-height:auto;`:'', + styleL = widgetData.left&&widgetData.left!='auto'||widgetData.left==0?`left:${left};`:'', + styleT = widgetData.top&&widgetData.top!='auto'||widgetData.top==0?`top:${top};`:'' + + var label = widgetData.label == 'auto'? + widgetData.id: + typeof widgetData.label == 'string' && widgetData.label.indexOf('icon:')!=-1? + icon(widgetData.label.split(':')[1].trim().replace('fa-','')): + widgetData.label + + var widgetContainer = $(` +
    +
    ${label}
    +
    + `) + + if (widgetData.color && widgetData.color!='auto') widgetContainer[0].style.setProperty('--color-custom',widgetData.color) + + if (widgetData.label===false) widgetContainer.addClass('nolabel') + + // create widget + var widgetInner = createWidget[widgetData.type](widgetData,widgetContainer) + + + widgetContainer[0].appendChild(widgetInner[0]) + + // store widget reference for cross widget sync + if (WIDGETS[widgetData.id]==undefined) WIDGETS[widgetData.id] = [] + WIDGETS[widgetData.id].push(widgetInner) + + // store widget with linkId for widgte linking + if (widgetData.linkId && widgetData.linkId.length) { + if (WIDGETS_LINKED[widgetData.linkId]==undefined) WIDGETS_LINKED[widgetData.linkId] = [] + WIDGETS_LINKED[widgetData.linkId].push(widgetInner) + } + + // store widget by path and encode preArgs for perfect cross-app sync + if (widgetData.path)  { + var pathref = widgetData.preArgs&&widgetData.preArgs.length?widgetData.path+'||||'+widgetData.preArgs.join('||||'):widgetData.path + if (WIDGETS_BY_PATH[pathref]==undefined) WIDGETS_BY_PATH[pathref] = [] + WIDGETS_BY_PATH[pathref].push(widgetInner) + } + + parent[0].appendChild(widgetContainer[0]) + } + + // Editor needs to get the container object + if (data && data.length==1) return widgetContainer + +} diff --git a/browser/js/app/sidepanel.js b/browser/js/app/sidepanel.js new file mode 100644 index 00000000..b164a5a1 --- /dev/null +++ b/browser/js/app/sidepanel.js @@ -0,0 +1,143 @@ +var actions = require('./actions'), + icon = require('./utils').icon + +var data = [ + { + actions: [ + { + title:'Fullscreen (F11)', + action:actions.toggleFullscreen + } + + ] + }, + { + title: icon('sliders') + '  State', + actions: [ + { + title:'Store', + action:actions.stateQuickSave + }, + { + title:'Recall', + action:actions.stateQuickLoad, + class:'disabled quickload' + }, + { + title:'Send All', + action:actions.stateSend + }, + { + title:'Import', + action:actions.stateLoad + }, + { + title:'Export', + action:actions.stateSave + } + ] + }, + { + title: icon('magic') + '  Traversing gestures', + actions: [ + { + title:'On', + action:actions.traversingEnable, + class:'traversingEnable' + }, + { + title:'Off', + action:actions.traversingDisable, + class:'traversingDisable on' + } + ] + }, + { + title: icon('edit') + '  Editor', + class:'editor', + actions: [ + { + title:'On', + action:actions.editorEnable, + class:'enable-editor' + }, + { + title:'Off', + action:actions.editorDisable, + class:'on disable-editor' + }, + { + title:'Root', + class:'editor-root disabled' + }, + { + title:'Load', + action:actions.sessionBrowse + }, + { + title:'Save', + action:actions.sessionSave + } + ] + }, +] + +var sidepanel = function(data){ + + var bindAction = function(el,callback) { + el.click(function(){callback()}) + } + + var html = $('') + + for (i in data) { + var itemData = data[i] + + var item = $('
  • '), + inner = $('
    ').appendTo(item) + wrapper = $('
    ').appendTo(inner) + + if (itemData.title) $('
    '+itemData.title+'
    ').prependTo(wrapper) + if (itemData.class) inner.attr('class',itemData.class) + + for (j in itemData.actions) { + var actionData = itemData.actions[j] + var el = $(''+actionData.title+'').appendTo(wrapper) + if (actionData.action) bindAction(el, actionData.action) + + if (actionData.class) el.addClass(actionData.class) + + } + item.appendTo(html) + + } + + return html + +}(data) + +var toggle = function(){ + $(`
  • ${icon('navicon')}
  • `).appendTo('.navigation.main ul').click(function(e){ + var t = 0 + if (!$('#sidepanel').hasClass('sidepanel-open')) t = 250 + + $('#open-toggle, #sidepanel').toggleClass('sidepanel-open') + setTimeout(function(){ + $('#container').toggleClass('sidepanel-open') + $(window).resize() + },t) + }).on('mousedown touchstart',function(e){e.stopPropagation()}) + + // in case where are hot loading a session + if ($('#sidepanel').hasClass('sidepanel-open')) { + $('#open-toggle, #container').addClass('sidepanel-open') + } +} + +module.exports = { + init:function(){ + $('#sidepanel').append(sidepanel) + toggle() + }, + createToggle:toggle +} diff --git a/browser/js/app/ui.js b/browser/js/app/ui.js new file mode 100644 index 00000000..2fe1bca7 --- /dev/null +++ b/browser/js/app/ui.js @@ -0,0 +1,71 @@ +var actions = require('./actions'), + icon = require('./utils').icon + +var sidepanel = require('./sidepanel').init + +// Tabs... +var tabs = function() { + $('#container').click(function(e){ + var link = e.target + + if (!link.hasAttribute('data-tab') || link.classList.contains('on')) return + + var id = link.getAttribute('data-tab') + + link.classList.add('on') + + var previous = $(link).siblings('.on').removeClass('on').data('tab') + + // TABS[id].tab.appendTo(TABS[id].parent) + TABS[id].parent[0].appendChild(TABS[id].tab[0]) + $(previous).detach() + + + $(id).find('li[data-tab]:first-child, li.parent + li[data-tab]').each(function(){ + if (!$(this).siblings('.on').length) $(this).click() + }) + + $(window).resize() + + }) + $('li[data-tab]').first().click() +} + +// horizontal scrolling & zoom with mousewheel +// if shift is pressed (native), or if there is no vertical scrollbar, +// or if mouse is on h-scrollbar +var scrollbarHeight = 20 +var scrolls = function(){ + $('html').on('mousewheel.zoom',function(e) { + // console.log(e) + if (e.ctrlKey) { + e.preventDefault() + if (e.originalEvent.deltaY==0) return + var d = -e.originalEvent.deltaY/(10*Math.abs(e.originalEvent.deltaY)) + + PXSCALE = parseFloat(d)+parseFloat(PXSCALE) + document.documentElement.style.setProperty("--pixel-scale",'') + document.documentElement.style.setProperty("--pixel-scale",PXSCALE) + + } + }) + $(document).on('keydown.resetzoom', function(e){ + if (e.keyCode==96||e.keyCode==48) { + PXSCALE = INITIALZOOM + document.documentElement.style.setProperty("--pixel-scale",'') + document.documentElement.style.setProperty("--pixel-scale",PXSCALE) + } + }) + +} + + +module.exports = { + init: function(){ + sidepanel() + tabs() + scrolls() + }, + tabs:tabs, + scrolls:scrolls +} diff --git a/browser/js/app/utils.js b/browser/js/app/utils.js new file mode 100644 index 00000000..04d7504a --- /dev/null +++ b/browser/js/app/utils.js @@ -0,0 +1,39 @@ +module.exports = { + + createPopup: function(title,content) { + + var popup = $(` + `), + closer = popup.find('.popup-title .closer') + + closer.click(function(){ + popup.close() + }) + + + popup.close = function(){ + $(document).off('.popup') + popup.remove() + } + + popup.find('.popup-content').append(content) + $('body').append(popup) + + $(document).on('keydown.popup', function(e){ + if (e.keyCode==27) popup.close() + }) + + + + return popup + }, + icon: function(i) { + return `` + } + +} diff --git a/browser/js/app/widgets.js b/browser/js/app/widgets.js new file mode 100644 index 00000000..a8d05ad7 --- /dev/null +++ b/browser/js/app/widgets.js @@ -0,0 +1,80 @@ +var widgets = { + // sliders + fader: require('./widgets/fader'), + knob: require('./widgets/knob'), + + // buttons + toggle: require('./widgets/toggle'), + switch: require('./widgets/switch'), + push: require('./widgets/push'), + + // pads + xy: require('./widgets/xy'), + rgb: require('./widgets/rgb'), + + // matrices + multitoggle: require('./widgets/multitoggle'), + multipush: require('./widgets/multipush'), + multifader: require('./widgets/multifader'), + + // plots + led: require('./widgets/led'), + plot: require('./widgets/plot'), + visualizer: require('./widgets/visualizer'), + meter: require('./widgets/meter'), + text: require('./widgets/text'), + + // containers + strip: require('./widgets/strip'), + panel: require('./widgets/panel'), +} + +module.exports.categories = { + 'Sliders':['fader','knob'], + 'Buttons':['toggle','push','switch'], + 'Pads':['xy','rgb'], + 'Matrices':['multifader','multitoggle','multipush'], + 'Plots':['plot','visualizer','led','meter','text'], + 'Containers':['panel','strip'] +} + +module.exports.widgetOptions = function(){ + var r = {} + for (i in widgets) { + r[i] = widgets[i].options + } + return r +}() + +module.exports.createWidget = function(){ + var r = {} + for (i in widgets) { + r[i] = widgets[i].create + } + return r +}() + +module.exports.sync = function() { + $('body').off('sync.global').on('sync.global',function(e,id,widget,linkId){ + // Widget that share the same id will update each other + // without sending any extra osc message + if (WIDGETS[id] && WIDGETS[id].length>1) { + var v = widget.getValue() + for (i in WIDGETS[id]) { + if (!WIDGETS[id][i].is(widget) && WIDGETS[id][i].setValue) { + WIDGETS[id][i].setValue(v,false,false) + } + } + } + // widgets that share the same linkId will update each other. + // Updated widgets will send osc messages normally + if (WIDGETS_LINKED[linkId] && WIDGETS_LINKED[linkId].length>1) { + var v = widget.getValue() + for (i in WIDGETS_LINKED[linkId]) { + if (!WIDGETS_LINKED[linkId][i].is(widget) && WIDGETS_LINKED[linkId][i].setValue) { + WIDGETS_LINKED[linkId][i].setValue(v,true,false) + } + } + } + }) +} diff --git a/browser/js/app/widgets/fader.js b/browser/js/app/widgets/fader.js new file mode 100644 index 00000000..896309af --- /dev/null +++ b/browser/js/app/widgets/fader.js @@ -0,0 +1,299 @@ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'fader', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + alignRight:false, + horizontal:false, + noPip:false, + compact:false, + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + meter:false, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + `), + gauge = widget.find('.gauge'), + knob = widget.find('.knob'), + wrapper = widget.find('.fader-wrapper'), + fader = widget.find('.fader'), + pips = widget.find('.pips'), + input = widget.find('.input').fakeInput({align:'center'}), + unit = widgetData.unit?' '+widgetData.unit.trim(): '', + dimension = widgetData.horizontal?'width':'height', + snap = widgetData.snap, + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + + + if (widgetData.horizontal) { + container.addClass('horizontal') + } else { + if (widgetData.alignRight) container.addClass('align-right') + } + + if (widgetData.compact) container.addClass('compact') + if (widgetData.noPip) wrapper.addClass('no-pip') + + gauge.size = 0 + fader.size = 0 + wrapper.size = 0 + widget.value = undefined + + if (widgetData.meter) { + var parsewidgets = require('../parser').widgets + var data = { + type:'meter', + id: widgetData.id + '/meter', + label:false, + horizontal:widgetData.horizontal, + range:widgetData.range, + logScale:widgetData.logScale, + path:widgetData.path + '/meter', + preArgs:widgetData.preArgs, + color:widgetData.color + } + var element = parsewidgets([data],fader) + element[0].classList.add('not-editable') + widget[0].classList.add('has-meter') + } + + + var rangeKeys = [], + rangeVals = [], + rangeLabels = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k], + label = typeof widgetData.range[k] == 'object'? + Object.keys(widgetData.range[k])[0]: + val + + rangeKeys.push(key) + rangeVals.push(val) + rangeLabels.push(label) + } + + var rangeValsMax = Math.max.apply(Math, rangeVals), + rangeValsMin = Math.min.apply(Math, rangeVals) + + if (!widgetData.noPip&&!widgetData.compact) { + var pipTexts = {} + for (k in rangeKeys) { + pipTexts[rangeKeys[k]]=rangeLabels[k] + } + + var pipsInner = '' + for (var i=0;i<=100;i++) { + if (pipTexts[i]==undefined) continue + + var pos = dimension=='height'?'bottom':'left'; + + var piptext = `${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]}` + + var add = ` +
    ${piptext}
    + ` + pipsInner = pipsInner + add + } + pips[0].innerHTML = pipsInner + } + + + + + + fader.resize(function(){ + fader.size= dimension=='height'?fader.outerHeight():fader.outerWidth() + wrapper.size = dimension=='height'?wrapper.outerHeight():wrapper.outerWidth() + widget.updateUi(gauge.size) + }) + + wrapper.on('fake-right-click',function(e){ + if (!EDITING) { + e.stopPropagation() + e.preventDefault() + input.focus() + } + }) + + wrapper.on('mousewheel',function(e){ + if (e.originalEvent.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var divider = e.ctrlKey?4:.25 + gauge.size = clip(gauge.size+e.originalEvent.wheelDelta/(fader.size*divider),[0,100]) + + widget.updateUi(gauge.size) + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + var off = 0 + wrapper.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var d = (dimension=='height')? + ((fader.size-data.offsetY+(wrapper.size-fader.size)/2) * 100 / fader.size): + (data.offsetX - (wrapper.size-fader.size)/2) * 100 / fader.size + d = clip(d,[0,100]) + + widget.updateUi(d) + gauge.size = d + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + off = gauge.size + + }) + + + wrapper.on('drag',function(e,data){ + + var d = (dimension=='height')?-data.deltaY:data.deltaX + d = clip(d*100/fader.size+off,[0,100]) + + widget.updateUi(d) + + gauge.size = d + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + widget.updateUi = function(v){ + var s = v/100, + t = dimension=='height'? + ['1,'+s+',1','0,'+ Math.round(-s*fader.size) +'px,0'] + :[s+',1,1',Math.round(s*fader.size) +'px,0,0'] + gauge[0].setAttribute('style','transform:scale3d('+t[0]+')') + knob[0].setAttribute('style','transform:translate3d('+t[1]+')') + } + + widget.getValue = function(){ + var h = clip(gauge.size,[0,100]) + for (var i=0;i= rangeKeys[i]) { + return mapToScale(h,[rangeKeys[i],rangeKeys[i+1]],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) + } + } + + } + widget.setValue = function(v,send,sync) { + if (typeof v != 'number') return + + var h, + v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]) + for (var i=0;i= rangeVals[i]) { + h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],false,logScale,true) + break + } + } + + widget.updateUi(h) + + gauge.size = h + + widget.value = v + widget.showValue(v) + + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + + widget.showValue = function(v) { + input.val(v+unit) + } + + input.change(function(){ + widget.setValue(parseFloat(input.val()),true,true) + }) + + widget.setValue(rangeVals[0]) + + return widget +} diff --git a/browser/js/app/widgets/knob.js b/browser/js/app/widgets/knob.js new file mode 100644 index 00000000..6f21a699 --- /dev/null +++ b/browser/js/app/widgets/knob.js @@ -0,0 +1,276 @@ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'knob', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + noPip:false, + compact:false, + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + `), + wrapper = widget.find('.knob-wrapper'), + mask = widget.find('.knob-mask'), + knob = widget.find('.knob'), + handle = widget.find('.handle'), + input = widget.find('.input').fakeInput({align:'center'}), + range = widgetData.range, + unit = widgetData.unit?' '+widgetData.unit.trim(): '', + snap = widgetData.snap, + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + + if (widgetData.noPip) wrapper.addClass('no-pip') + if (widgetData.compact) container.addClass('compact') + + + var rangeKeys = [], + rangeVals = [], + rangeLabels = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k], + label = typeof widgetData.range[k] == 'object'? + Object.keys(widgetData.range[k])[0]: + val + + rangeKeys.push(key) + rangeVals.push(val) + rangeLabels.push(label) + } + + var rangeValsMax = Math.max.apply(Math, rangeVals), + rangeValsMin = Math.min.apply(Math, rangeVals) + + + var pipmin = Math.abs(rangeLabels[0])>=1000?rangeLabels[0]/1000+'k':rangeLabels[0], + pipmax = Math.abs(rangeLabels[rangeLabels.length-1])>=1000?rangeLabels[rangeLabels.length-1]/1000+'k':rangeLabels[rangeLabels.length-1] + + + + widget.find('.pip.min').text(pipmin) + widget.find('.pip.max').text(pipmax) + + mask.size = 0 + widget.value = undefined + + wrapper.resize(function(e,width,height){ + + var w = Math.floor(Math.min(height,width)*.58) + + if (!w || mask.size==w) return + mask.size=w + mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`) + wrapper.size = {width:wrapper[0].clientWidth,height:wrapper[0].clientHeight} + }) + + wrapper.on('fake-right-click',function(e){ + if (!EDITING) { + e.stopPropagation() + e.preventDefault() + input.focus() + } + }) + + wrapper.on('mousewheel',function(e){ + if (e.originalEvent.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var divider = e.ctrlKey?48:8 + knob.rotation = clip(knob.rotation+e.originalEvent.wheelDeltaY/divider,[0,270]) + + widget.updateUi(knob.rotation) + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + + knob.rotation = 0 + + var offR = 0, + offX = 0, + offY = 0 + wrapper.on('draginit',function(e,data,traversing){ + + if (snap || traversing) { + + var w = wrapper.size.width, + h = wrapper.size.height, + x = data.offsetX-w/2, + y = data.offsetY-h/2, + angle = Math.atan2(-y, -x) * 180 / Math.PI +45, + r = angle<-90?angle+360:angle + r = (angle>=-90 && angle<-45)?270:r + r = clip(r,[0,270]) + + offX = x + offY = y + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + offR = knob.rotation + }) + + wrapper.on('drag',function(e,data){ + + var r = clip(-data.deltaY*2+offR,[0,270]) + + if (snap || data.ctrlKey || data.shiftKey) { + var w = data.target.clientWidth, + h = data.target.clientHeight, + x = data.deltaX + offX, + y = data.deltaY + offY, + angle = Math.atan2(-y, -x) * 180 / Math.PI +45, + r = angle<-90?angle+360:angle + r = (angle>=-90 && angle<-45)?270:r + r = clip(r,[0,270]) + } + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + widget.updateUi = function(r) { + knob[0].setAttribute('style','transform:rotateZ('+r+'deg)') + handle[0].setAttribute('style','transform:rotateZ('+(r-45)+'deg)') + + if (r>180) {knob.addClass('d3')} + else if (r>90) {knob.removeClass('d3').addClass('d2')} + else {knob.removeClass('d3 d2')} + } + + widget.getValue = function() { + var h = knob.rotation + for (var i=0;i= rangeKeys[i]*2.7) { + return mapToScale(h,[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) + } + } + } + widget.showValue = function(v) { + input.val(v+unit) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue = function(v,send,sync) { + if (typeof v != 'number') return + + var v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]), + r + + for (var i=0;i= rangeVals[i]) { + r = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],false,logScale,true) + break + } + } + + knob.rotation = r + + widget.updateUi(r) + + var v = widget.getValue() + widget.value = v + + widget.showValue(v) + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + input.change(function(){ + widget.setValue(parseFloat(input.val()),true,true) + }) + + widget.setValue(rangeVals[0]) + return widget +} diff --git a/browser/js/app/widgets/led.js b/browser/js/app/widgets/led.js new file mode 100644 index 00000000..1c72dcf8 --- /dev/null +++ b/browser/js/app/widgets/led.js @@ -0,0 +1,42 @@ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'led', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + range:{min:0,max:1}, + logScale:false, + preArgs:[], + path:'auto' +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    +
    + `), + led = widget.find('span'), + range = widgetData.range + + widget.setValue = function(v,send,sync){ + if (typeof v != 'number') return + led.css('opacity',mapToScale(v,[range.min,range.max],[0,1],widgetData.precision,widgetData.logScale,true)) + } + + widget.setValue(range.min) + + return widget +} diff --git a/browser/js/app/widgets/meter.js b/browser/js/app/widgets/meter.js new file mode 100644 index 00000000..34acb9fa --- /dev/null +++ b/browser/js/app/widgets/meter.js @@ -0,0 +1,87 @@ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale + +module.exports.options = { + type:'fader', + id:'auto', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + path:'auto', + preArgs:[] +} + +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    +
    + `), + level = widget.find('.level'), + logScale = widgetData.logScale, + dimension = widgetData.horizontal?'width':'height', + axe = dimension=='height'?'X':'Y' + + + if (widgetData.horizontal) widget.addClass('horizontal') + + + var rangeKeys = [], + rangeVals = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k] + + rangeKeys.push(key) + rangeVals.push(val) + } + + + + widget.updateUi = function(v){ + var s = v/100, + t = dimension=='height'? + '1,'+s+',1' + :s+',1,1' + level[0].setAttribute('style','transform:scale3d('+t+')') + } + + + widget.setValue = function(v) { + if (typeof v != 'number') return + + var h, + v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]]) + for (var i=0;i= rangeVals[i]) { + h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],2,logScale,true) + break + } + } + + widget.updateUi(h) + + } + + widget.setValue(rangeVals[0]) + + return widget +} diff --git a/browser/js/app/widgets/multifader.js b/browser/js/app/widgets/multifader.js new file mode 100644 index 00000000..213c5a4f --- /dev/null +++ b/browser/js/app/widgets/multifader.js @@ -0,0 +1,85 @@ +module.exports.options = { + type:'multifader', + id:'auto', + + separator0:'Matrix', + + strips:2, + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + compact:false, + css:'', + + + separator2:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + path:'auto', + preArgs:[], + target:[] +} + +module.exports.create = function(widgetData,container) { + + var parsewidgets = require('../parser').widgets + + var widget = $(` +
    +
    \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i + \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i + \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i + + `) + + if (!widgetData.scroll) widget.addClass('noscroll') + + if (widgetData.tabs.length) { + parsetabs(widgetData.tabs,widget) + widget.addClass('has-tabs') + } else { + parsewidgets(widgetData.widgets,widget) + } + return widget +} diff --git a/browser/js/app/widgets/plot.js b/browser/js/app/widgets/plot.js new file mode 100644 index 00000000..5c407ffb --- /dev/null +++ b/browser/js/app/widgets/plot.js @@ -0,0 +1,214 @@ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'plot', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'plot', + + points:[], + rangeX: {min:0,max:1}, + rangeY: {min:0,max:1}, + logScaleX: false, + logScaleY: false, + + separator3:'osc', + + path:'auto', + preArgs:[], + +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
    + +
    + `), + canvas = widget.find('canvas'), + ctx = canvas[0].getContext('2d') + + widget.data = [] + widget.height = undefined + widget.width = undefined + widget.linkedWidgets = [] + widget.visible = false + widget.textColor = getComputedStyle(document.documentElement).getPropertyValue('--color-text-fade') + widget.pips = { + x : { + min: Math.abs(widgetData.rangeX.min)>=1000?widgetData.rangeX.min/1000+'k':widgetData.rangeX.min, + max: Math.abs(widgetData.rangeX.max)>=1000?widgetData.rangeX.max/1000+'k':widgetData.rangeX.max + }, + y : { + min: Math.abs(widgetData.rangeY.min)>=1000?widgetData.rangeY.min/1000+'k':widgetData.rangeY.min, + max: Math.abs(widgetData.rangeY.max)>=1000?widgetData.rangeY.max/1000+'k':widgetData.rangeY.max + } + } + + + + if (typeof widgetData.points=='string') { + + widget.linkedWidgets.push(widgetData.points) + + } else if (typeof widgetData.points=='object') { + + for (i in widgetData.points) { + for (j in widgetData.points[i]) { + if (typeof widgetData.points[i][j] == 'string') { + widget.linkedWidgets.push(widgetData.points[i][j]) + } + } + } + } + + + canvas.resize(function(){ + var width = canvas.width(), + height = canvas.height() + + if (height==100 && width==100) return + + if (!self.visible) { + widget.visible = true + widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent') + } + + + widget.height=height + widget.width=width + + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + + widget.fetchValues() + requestAnimationFrame(widget.draw) + + }) + + + widget.handleSync = function(e,id,w) { + if (widget.linkedWidgets.indexOf(id)==-1 || !WIDGETS[id]) return + widget.fetchValues() + requestAnimationFrame(widget.draw) + } + + $('body').on('sync',widget.handleSync) + + widget.draw = function(){ + + + ctx.clearRect(0,0,widget.width,widget.height) + ctx.beginPath() + + var first = true + var point = [] + + for (i in widget.data) { + var newpoint = widget.data[i].length? + [ + mapToScale(widget.data[i][0],[widgetData.rangeX.min,widgetData.rangeX.max],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true), + mapToScale(widget.data[i][1],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true), + ] + : + [ + mapToScale(i,[0,widget.data.length-1],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true), + mapToScale(widget.data[i],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true), + ] + + + + if (first) { + ctx.moveTo(newpoint[0],newpoint[1]) + first = false + } else { + ctx.moveTo(point[0],point[1]) + if (widgetData.logScaleX&&!widgetData.logScaleY) { + ctx.quadraticCurveTo(point[0], newpoint[1], newpoint[0], newpoint[1]) + } else if (widgetData.logScaleY&&!widgetData.logScaleX) { + ctx.quadraticCurveTo(newpoint[0], point[1], newpoint[0], newpoint[1]) + } else { + ctx.lineTo(newpoint[0],newpoint[1]) + } + + } + ctx.arc(newpoint[0],newpoint[1],1,0,2*Math.PI) + point = newpoint + } + + ctx.lineWidth = 1.5*PXSCALE + ctx.strokeStyle= widget.lineColor + ctx.stroke() + + ctx.font = PXSCALE * 10 + 'px sans-serif' + ctx.fillStyle = widget.textColor + + + ctx.textBaseline = "bottom" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.x.min,12*PXSCALE,widget.height) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.x.max,widget.width-10,widget.height) + + ctx.save() + ctx.translate(0, widget.height) + ctx.rotate(-Math.PI/2) + + ctx.textBaseline = "top" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.y.min,12*PXSCALE,2*PXSCALE) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.y.max,widget.height-10*PXSCALE,2*PXSCALE) + ctx.rotate(Math.PI/2) + ctx.restore() + + } + + + + widget.fetchValues = function(){ + var data = [], + points = widgetData.points + + if (typeof points=='string' && WIDGETS[points]) { + + data = WIDGETS[points][WIDGETS[points].length-1].getValue() + + } else if (typeof points=='object') { + + for (i in points) { + + data[i] = [] + for (k in [0,1]) { + if (typeof points[i][k] == 'string' && WIDGETS[points[i][k]]) { + data[i][k] = WIDGETS[points[i][k]][WIDGETS[points[i][k]].length-1].getValue() + } else { + data[i][k] = points[i][k] + } + } + + } + + } + + if (data.length) widget.data = data + } + + widget.setValue = function(v) { + widget.data = v + requestAnimationFrame(widget.draw) + } + + return widget +} diff --git a/browser/js/app/widgets/push.js b/browser/js/app/widgets/push.js new file mode 100644 index 00000000..a9081899 --- /dev/null +++ b/browser/js/app/widgets/push.js @@ -0,0 +1,109 @@ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'push', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + on:1, + off:0, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + + var widget = $(` +
    +
    +
    \ + `), + $document = $(document), + light = widget.find('.light')[0] + + widget.value = widget.find('span') + widget.state = 0 + widget.active = 0 + widget.lastChanged = 'state' + + widget.on('drag',function(e){e.stopPropagation()}) + widget.on('draginit.push',function(){ + widget.off('draginit.push') + widget.fakeclick() + }) + + widget.fakeclick = function(){ + if (!widget.active) widget.setValuePrivate(widgetData.on,true,true) + $document.on('dragend.push',function(){ + widget.setValuePrivate(widgetData.off,true,true) + $document.off('dragend.push') + widget.on('draginit.push',function(){ + widget.off('draginit.push') + widget.fakeclick() + }) + }) + } + + widget.getValue = function() { + return widget[widget.lastChanged]?widgetData.on:widgetData.off + } + + widget.setValuePrivate = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('active') + widget.active = 1 + if (send) widget.sendValue(v) + widget.lastChanged = 'active' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('active') + widget.active = 0 + if (send) widget.sendValue(v) + widget.lastChanged = 'active' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + } + + widget.setValue = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('on') + widget.state = 1 + if (send) widget.sendValue(v) + widget.lastChanged = 'state' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('on') + widget.state = 0 + if (send) widget.sendValue(v) + widget.lastChanged = 'state' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + } + + widget.sendValue = function(v) { + if (v===false) return + var args = widgetData.preArgs.concat(v) + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue() + return widget +} diff --git a/browser/js/app/widgets/rgb.js b/browser/js/app/widgets/rgb.js new file mode 100644 index 00000000..a28e5c7d --- /dev/null +++ b/browser/js/app/widgets/rgb.js @@ -0,0 +1,292 @@ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + hsbToRgb = utils.hsbToRgb, + rgbToHsb = utils.rgbToHsb, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'rgb', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + precision:0, + path:'auto', + preArgs:[], + split:false, + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    R
    G
    B
    +
    +
    +
    `), + rgbHandle = widget.find('.rgb .handle'), + hueHandle = widget.find('.hue .handle'), + pad = widget.find('.xy'), + huePad = widget.find('.hue'), + rgbBg = pad.find('.bg')[0], + value = {r:widget.find('.r').fakeInput({align:'center'}),g:widget.find('.g').fakeInput({align:'center'}),b:widget.find('.b').fakeInput({align:'center'})}, + snap = widgetData.snap, + split = widgetData.split? + typeof widgetData.split == 'object'? + widgetData.split:{r:widgetData.path+'/r',g:widgetData.path+'/g',b:widgetData.path+'/b'} + :false + + + pad.width = 0 + pad.height = 0 + rgbHandle.height = 0 + rgbHandle.width = 0 + hueHandle.width = 0 + widget.value = undefined + + pad.resize(function(){ + var width = pad.innerWidth(), + height = pad.innerHeight() + if (!width || (pad.height==height && pad.width==width)) return + pad.width = width + pad.height = height + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*rgbHandle.width/100}px, -${pad.height*rgbHandle.height/100}px,0)`) + + }) + + + var rgbOff = {x:0,y:0} + pad.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var h = ((pad.height-data.offsetY) * 100 / pad.height), + w = (data.offsetX * 100 / pad.width) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + rgbHandle.height = h + rgbHandle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + rgbOff = {x:rgbHandle.width,y:rgbHandle.height} + + }) + pad.on('drag',function(e,data){ + + var h = clip((-data.deltaY)*100/pad.height+rgbOff.y,[0,100]), + w = clip(data.deltaX*100/pad.width+rgbOff.x,[0,100]) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + rgbHandle.height = h + rgbHandle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + var hueOff = 0 + huePad.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var d = (data.offsetX * 100 / pad.width) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*d/100}px,0,0)`) + hueHandle.width = d + + + var h = clip(hueHandle.width*3.6,[0,360]), + rgb = hsbToRgb({h:h,s:100,b:100}) + + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + hueOff = hueHandle.width + + }) + + + huePad.on('drag',function(e,data){ + + var w = clip(data.deltaX*100/pad.width+hueOff,[0,100]) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px,0,0)`) + hueHandle.width = w + + var h = clip(hueHandle.width*3.6,[0,360]), + rgb = hsbToRgb({h:h,s:100,b:100}) + + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + + + + widget.getValue = function() { + var s = clip(rgbHandle.width,[0,100]), + l = clip(rgbHandle.height,[0,100]), + h = mapToScale(hueHandle.width,[0,100],[0,360],widgetData.precision), + rgb = hsbToRgb({h:h,s:s,b:l}) + return [rgb.r,rgb.g,rgb.b] + } + widget.setValue = function(v,send,sync) { + if (!v || v.length!=3) return + + for (i in [0,1,2]) { + v[i] = clip(v[i],[0,255]) + } + + + var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]}) + + var w = mapToScale(hsb.s,[0,100],[0,100],false), + h = mapToScale(hsb.b,[0,100],[0,100],false), + hueW = mapToScale(hsb.h,[0,360],[0,100],false) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*hueW/100}px,0,0)`) + + rgbHandle.height = h + rgbHandle.width = w + hueHandle.width = hueW + widget.value = v + + + var rgb = hsbToRgb({h:hsb.h,s:100,b:100}) + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + widget.showValue(v) + + + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:split?false:widgetData.target, + path:widgetData.path, + args:args, + precision:widgetData.precision, + }) + if (split) { + sendOsc({ + target:widgetData.target, + path:split.r, + args:widgetData.preArgs.concat(v[0]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.g, + args:widgetData.preArgs.concat(v[1]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.b, + args:widgetData.preArgs.concat(v[2]), + precision:widgetData.precision, + sync:false + }) + } + } + + + + widget.showValue = function(v) { + value.r.val(v[0]) + value.g.val(v[1]) + value.b.val(v[2]) + } + value.r.change(function(){ + var r = clip(value.r.val(),[0,255]) + var v = widget.getValue() + widget.setValue([r,v[1],v[2]],true,true) + }) + value.g.change(function(){ + var g = clip(value.g.val(),[0,255]) + var v = widget.getValue() + widget.setValue([v[0],g,v[2]],true,true) + }) + value.b.change(function(){ + var b = clip(value.b.val(),[0,255]) + var v = widget.getValue() + widget.setValue([v[0],v[1],b],true,true) + }) + + widget.setValue([0,0,0]) + + return widget +} diff --git a/browser/js/app/widgets/strip.js b/browser/js/app/widgets/strip.js new file mode 100644 index 00000000..35e2eaee --- /dev/null +++ b/browser/js/app/widgets/strip.js @@ -0,0 +1,38 @@ + +module.exports.options = { + type:'strip', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator2:'children', + + widgets:[] +} +module.exports.create = function(widgetData,container) { + + var parsewidgets = require('../parser').widgets + + var widget = $(` +
    +
    + `) + if (widgetData.horizontal) { + container.addClass('horizontal') + } else { + container.addClass('vertical') + } + + parsewidgets(widgetData.widgets,widget) + + return widget +} diff --git a/browser/js/app/widgets/switch.js b/browser/js/app/widgets/switch.js new file mode 100644 index 00000000..c8ad7ddb --- /dev/null +++ b/browser/js/app/widgets/switch.js @@ -0,0 +1,83 @@ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'switch', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator2:'osc', + + values:{"Value 1":1,"Value 2":2}, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
    +
    + `), + $document = $(document) + + if (widgetData.horizontal) { + widget.addClass('horizontal') + } + + widget.values = [] + + for (k in widgetData.values) { + widget.values.push(widgetData.values[k]) + $('
    '+k+'
    ').data({value:widgetData.values[k]}).appendTo(widget) + } + + widget.value = undefined + + widget.find('.value').on('draginit',function(e,dd){ + var data = $(this).data() + if (data.value!=widget.value || widget.value===undefined) widget.setValue(data.value,true,true) + }) + + + + widget.getValue = function() { + return widget.value + } + widget.setValue = function(v,send,sync) { + var i = widget.values.indexOf(v) + if (i!=-1) { + widget.value = widget.values[i] + widget.find('.on').removeClass('on') + widget.find('.value').eq(i).addClass('on').removeClass('ripple').addClass('ripple').delay(250).queue(function(next){ + $(this).removeClass('ripple') + next() + }) + if (send) widget.sendValue(widget.value) + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + return widget +} diff --git a/browser/js/app/widgets/text.js b/browser/js/app/widgets/text.js new file mode 100644 index 00000000..7e8467e9 --- /dev/null +++ b/browser/js/app/widgets/text.js @@ -0,0 +1,54 @@ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'text', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + vertical:false, + color:'auto', + css:'', + + separator2:'osc', + + preArgs:[], + path:'auto', + defaultText:'' +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    + `), + label = widgetData.defaultText!==''? + widgetData.defaultText: + widgetData.label===false? + widgetData.id: + widgetData.label=='auto'? + widgetData.id: + widgetData.label, + text = label + + + if (widgetData.vertical) widget.addClass('vertical') + + widget.setValue = function(v,send,sync){ + text = typeof v=='object' && !v.length?label:v + widget.text(text) + } + + widget.getValue = function(){ + return text + } + + widget.setValue(label) + + return widget +} diff --git a/browser/js/app/widgets/toggle.js b/browser/js/app/widgets/toggle.js new file mode 100644 index 00000000..e8c741e9 --- /dev/null +++ b/browser/js/app/widgets/toggle.js @@ -0,0 +1,89 @@ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'toggle', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + on:1, + off:0, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
    +
    +
    \ + `), + $document = $(document), + light = widget.find('.light')[0] + + widget.value = widget.find('span') + widget.state = 0 + + widget.on('drag',function(e){e.stopPropagation()}) + widget.on('draginit.toggle',function(){ + widget.off('draginit.toggle') + widget.fakeclick() + }) + + widget.fakeclick = function(){ + var newVal = widget.state?widgetData.off:widgetData.on + widget.setValue(newVal,true,true) + $document.on('dragend.toggle',function(){ + $document.off('dragend.toggle') + widget.on('draginit.toggle',function(){ + widget.off('draginit.toggle') + widget.fakeclick() + }) + }) + } + + + widget.getValue = function() { + return widget.state?widgetData.on:widgetData.off + } + widget.setValue = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('on') + widget.state = 1 + if (send) widget.sendValue(widgetData.on) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('on') + widget.state = 0 + if (send) widget.sendValue(widgetData.off) + } + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + + } + widget.sendValue = function(v) { + if (v===false) return + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue() + return widget +} diff --git a/browser/js/app/widgets/utils.js b/browser/js/app/widgets/utils.js new file mode 100644 index 00000000..2f5bf793 --- /dev/null +++ b/browser/js/app/widgets/utils.js @@ -0,0 +1,78 @@ +module.exports = { + + sendOsc: function(data){ + IPC.send('sendOsc', data) + }, + + clip: function(value,range) { + var value = parseFloat(value) + + if (isNaN(value)) value = range[0] + return Math.max(Math.min(range[0],range[1]),Math.min(value,Math.max(range[0],range[1]))) + + }, + + // map a value from a scale to another input and output must be range arrays + mapToScale: function(value,rangeIn,rangeOut,precision,log,revertlog) { + + var value = module.exports.clip(value,[rangeIn[0],rangeIn[1]]), + roundFactor = precision!=undefined?Math.pow(10,precision):100, + + + value = log? + revertlog? + (Math.pow(10,((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])))/9-1/9) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + :Math.log10(((value-rangeIn[0])/(rangeIn[1]-rangeIn[0]))*9+1) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + :((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + + value = Math.max(Math.min(rangeOut[0],rangeOut[1]),Math.min(value,Math.max(rangeOut[0],rangeOut[1]))) + + if (precision!==false) value = Math.round(value*roundFactor)/roundFactor + + + return value + + }, + + hsbToRgb: function (hsb) { + var rgb = {} + var h = hsb.h + var s = hsb.s*255/100 + var v = hsb.b*255/100 + if(s == 0) { + rgb.r = rgb.g = rgb.b = v + } else { + var t1 = v + var t2 = (255-s)*v/255 + var t3 = (t1-t2)*(h%60)/60 + if(h==360) h = 0 + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)} + }, + + rgbToHsb: function (rgb) { + var hsb = {h: 0, s: 0, b: 0} + var min = Math.min(rgb.r, rgb.g, rgb.b) + var max = Math.max(rgb.r, rgb.g, rgb.b) + var delta = max - min + hsb.b = max + hsb.s = max != 0 ? 255 * delta / max : 0 + if (hsb.s != 0) { + if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta + else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta + else hsb.h = 4 + (rgb.r - rgb.g) / delta + } else hsb.h = 0 + hsb.h *= 60 + if (hsb.h < 0) hsb.h += 360 + hsb.s *= 100/255 + hsb.b *= 100/255 + return hsb + } +} diff --git a/browser/js/app/widgets/visualizer.js b/browser/js/app/widgets/visualizer.js new file mode 100644 index 00000000..cd4e06b6 --- /dev/null +++ b/browser/js/app/widgets/visualizer.js @@ -0,0 +1,176 @@ +var utils = require('./utils'), + mapToScale = utils.mapToScale, + clip = utils.clip + +module.exports.options = { + type:'visualizer', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'plot', + + widgetId:'', + duration:1, + range: {min:0,max:1}, + logScale: false, + + separator3:'osc', + + path:'auto', + preArgs:[], +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
    + +
    + `), + canvas = widget.find('canvas'), + ctx = canvas[0].getContext('2d') + + widget.height = 0 + widget.width = 0 + widget.visible = false + widget.textColor = getComputedStyle(document.documentElement).getPropertyValue('--color-text-fade') + widget.pips = { + min: Math.abs(widgetData.range.min)>=1000?widgetData.range.min/1000+'k':widgetData.range.min, + max: Math.abs(widgetData.range.max)>=1000?widgetData.range.max/1000+'k':widgetData.range.max + } + widget.length = Math.round(clip(60*widgetData.duration,[8,4096])) + widget.data = new Array(widget.length) + widget.value = widgetData.range.min + + canvas.resize(function(){ + var width = canvas.width(), + height = canvas.height() + + if (height==100 && width==100) return + + if (!self.visible) { + widget.visible = true + widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent') + } + + widget.height=height + widget.width=width + + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + + requestAnimationFrame(widget.draw) + + }) + + + widget.handleSync = function(e,id,w) { + if (widgetData.widgetId!=id || !WIDGETS[id]) return + widget.startLoop() + } + + $('body').on('sync',widget.handleSync) + + + widget.cancel = false + widget.loop = false + + widget.startLoop = function(){ + + if (widget.cancel) clearTimeout(widget.cancel) + + widget.cancel = setTimeout(function(){ + clearInterval(widget.loop) + widget.loop = false + widget.cancel = false + },1000*widgetData.duration) + + if (widget.loop) return + + widget.loop = setInterval(function(){ + widget.fetchValue() + widget.draw() + },1000*widgetData.duration/widget.length) + } + + + widget.draw = function(){ + ctx.clearRect(0,0,widget.width,widget.height) + ctx.beginPath() + + var first = true + var point = [] + + for (var i=widget.length-1;i>=0;i=i-1) { + var newpoint = [ + mapToScale(i,[0,widget.length-1],[15*PXSCALE,widget.width-15*PXSCALE],1), + mapToScale(widget.data[i],[widgetData.range.min,widgetData.range.max],[widget.height-15*PXSCALE,15*PXSCALE],1,widgetData.logScale,true), + ] + if (first) { + ctx.moveTo(newpoint[0],newpoint[1]) + first = false + } else { + if (widgetData.logScale) { + ctx.quadraticCurveTo(newpoint[0], point[1], newpoint[0], newpoint[1]) + } else { + ctx.lineTo(newpoint[0],newpoint[1]) + } + + } + point = newpoint + } + + ctx.lineWidth = 1.5*PXSCALE + ctx.strokeStyle= widget.lineColor + ctx.stroke() + + ctx.font = PXSCALE * 10 + 'px sans-serif' + ctx.fillStyle = widget.textColor + + + ctx.save() + ctx.translate(0, widget.height) + ctx.rotate(-Math.PI/2) + + ctx.textBaseline = "top" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.min,12*PXSCALE,2*PXSCALE) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.max,widget.height-10*PXSCALE,2*PXSCALE) + ctx.rotate(Math.PI/2) + ctx.restore() + + } + + + + widget.fetchValue = function(){ + var id = widgetData.widgetId + + if (typeof id == 'string' && WIDGETS[id]) { + var v = WIDGETS[id][WIDGETS[id].length-1].getValue() + widget.data.push(v) + widget.value = v + } else { + widget.data.push(widget.value) + } + + widget.data.splice(0,1) + + } + + widget.setValue = function(v) { + widget.value = v + widget.startLoop() + } + + return widget +} diff --git a/browser/js/app/widgets/xy.js b/browser/js/app/widgets/xy.js new file mode 100644 index 00000000..4bb760d0 --- /dev/null +++ b/browser/js/app/widgets/xy.js @@ -0,0 +1,209 @@ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'xy', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + rangeX:{min:0,max:1}, + rangeY:{min:0,max:1}, + logScaleX:false, + logScaleY:false, + precision:2, + path:'auto', + preArgs:[], + split:false, + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
    +
    +
    +
    +
    +
    X
    Y
    +
    +
    +
    + `), + handle = widget.find('.handle'), + pad = widget.find('.xy'), + value = {x:widget.find('.x').fakeInput({align:'center'}),y:widget.find('.y').fakeInput({align:'center'})}, + range = {x:widgetData.rangeX,y:widgetData.rangeY}, + snap = widgetData.snap, + split = widgetData.split? + typeof widgetData.split == 'object'? + widgetData.split:{x:widgetData.path+'/x',y:widgetData.path+'/y'} + :false; + logScaleX = widgetData.logScaleX, + logScaleY = widgetData.logScaleY, + roundFactor = Math.pow(10,widgetData.precision) + + + if (widgetData.height!='auto') widget.addClass('manual-height') + + pad.width = 0 + pad.height = 0 + handle.height = 0 + handle.width = 0 + widget.value = undefined + + pad.resize(function(){ + var width = pad.innerWidth(), + height = pad.innerHeight() + if (!width || (pad.height==height && pad.width==width)) return + pad.width = width + pad.height = height + + widget.updateUi(handle.width,handle.height) + }) + + var off = {x:0,y:0} + pad.on('draginit',function(e,data,traversing){ + + if (snap || traversing) { + var h = ((pad.height-data.offsetY) * 100 / pad.height), + w = (data.offsetX * 100 / pad.width) + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + off = {x:handle.width,y:handle.height} + + }) + pad.on('drag',function(e,data){ + + var h = clip((-data.deltaY)*100/pad.height+off.y,[0,100]), + w = clip((data.deltaX)*100/pad.width+off.x,[0,100]) + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + widget.updateUi = function(w,h) { + handle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + } + + widget.getValue = function() { + var x = mapToScale(handle.width,[0,100],[range.x.min,range.x.max],widgetData.precision,logScaleX), + y = mapToScale(handle.height,[0,100],[range.y.min,range.y.max],widgetData.precision,logScaleY) + + return [x,y] + } + widget.setValue = function(v,send,sync) { + if (!v || v.length!=2) return + + for (i in [0,1]) { + v[i] = clip(Math.round(v[i]*roundFactor)/roundFactor,[range[['x','y'][i]].min,range[['x','y'][i]].max]) + } + + var w = mapToScale(v[0],[range.x.min,range.x.max],[0,100],false,logScaleX,true) + h = mapToScale(v[1],[range.y.min,range.y.max],[0,100],false,logScaleY,true), + + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + widget.value = v + + widget.showValue(v) + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:split?false:widgetData.target, + path:widgetData.path, + args:args, + precision:widgetData.precision, + }) + if (split) { + sendOsc({ + target:widgetData.target, + path:split.x, + args:widgetData.preArgs.concat(v[0]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.y, + args:widgetData.preArgs.concat(v[1]), + precision:widgetData.precision, + sync:false + }) + } + } + + widget.showValue = function(v) { + value.x.val(v[0]) + value.y.val(v[1]) + } + + value.x.change(function(){ + var v = widget.getValue() + v[0] = clip(value.x.val(),[range.x.min,range.x.max]) + widget.setValue(v,true,true) + }) + value.y.change(function(){ + var v = widget.getValue() + v[1] = clip(value.y.val(),[range.y.min,range.y.max]) + widget.setValue(v,true,true) + }) + + widget.setValue([range.x.min,range.y.min]) + return widget +} diff --git a/browser/js/browser-headless.bundle.js b/browser/js/browser-headless.bundle.js new file mode 100644 index 00000000..551c5a49 --- /dev/null +++ b/browser/js/browser-headless.bundle.js @@ -0,0 +1,11861 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o') + var blob = new Blob([state],{type : 'text/plain'}); + down.attr('href', window.URL.createObjectURL(blob)) + down[0].click() + } + + }, + + stateGet: function (){ + var data = [] + for (i in WIDGETS) { + var widget = WIDGETS[i] + for (var j=widget.length-1;j>=0;j--) { + if (widget[j].setValue && widget[j].getValue) { + var v = widget[j].getValue() + if (v!=undefined) data.push([i,v]) + break + } + } + } + return data + }, + + stateLoad: function() { + if (WEBFRAME) { + IPC.send('stateLoad') + } else { + var prompt = $('') + prompt.click() + prompt.on('change',function(e){ + var reader = new FileReader(); + reader.onloadend = function(e) { + var preset = e.target.result + module.exports.stateSet(JSON.parse(preset),true) + STATE = preset + } + reader.readAsText(e.target.files[0],'utf-8'); + }) + } + }, + + stateSend: function(){ + var data = module.exports.stateGet() + module.exports.stateSet(data,true) + + }, + + stateSet: function(preset,send){ + + for (i in preset) { + var data = preset[i] + if (WIDGETS[data[0]]!=undefined) { + for (var i=WIDGETS[data[0]].length-1;i>=0;i--) { + if (WIDGETS[data[0]][i].setValue) { + WIDGETS[data[0]][i].setValue(data[1],send,false) + } + } + } + } + }, + + toggleFullscreen: function(){ + + if (WEBFRAME) { + IPC.send('fullscreen') + } else { + var isInFullScreen = document.webkitIsFullScreen + + if (isInFullScreen) { + document.webkitExitFullscreen() + } else { + document.documentElement.webkitRequestFullScreen() + } + } + }, + + sessionBrowse: function(){ + + if (WEBFRAME) { + IPC.send('sessionBrowse') + } else { + var prompt = $('') + prompt.click() + prompt.on('change',function(e){ + var reader = new FileReader(); + reader.onloadend = function(e) { + var session = e.target.result + IPC.send('sessionOpen',{file:session}) + } + reader.readAsText(e.target.files[0],'utf-8'); + }) + } + }, + + sessionSave: function() { + var sessionfile = JSON.stringify(SESSION,null,' ') + if (WEBFRAME) { + IPC.send('sessionSave',sessionfile) + } else { + var down = $('') + var blob = new Blob([sessionfile],{type : 'text/plain'}); + down.attr('href', window.URL.createObjectURL(blob)) + down[0].click() + } + + }, + + editorEnable: function(){ + $('.editor-root').attr('data-tab','#container').removeClass('disabled') + $('.enable-editor').addClass('on') + $('.disable-editor').removeClass('on') + + EDITING = true + }, + editorDisable: function(){ + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + $('.editing').removeClass('editing') + $('.editor-root').addClass('disabled') + $('.editor-container').remove() + $('.disable-editor').addClass('on') + $('.enable-editor').removeClass('on') + + EDITING = false + }, + + traversingDisable: function(){ + $('.traversingEnable, .traversingDisable').toggleClass('on') + $(document).trigger('disableTraversingGestures') + }, + traversingEnable: function(){ + $('.traversingEnable, .traversingDisable').toggleClass('on') + $(document).enableTraversingGestures() + } + +} + +},{}],3:[function(require,module,exports){ +var init = require('./init'), + actions = require('./actions'), + utils = require('./utils'), + icon = utils.icon + +module.exports = { + + receiveOsc: function(event,data){ + var data = data || event + + // fetch ids corresponding to the osc path + var path = data.path, + pathref = path, + args = data.args + + if (typeof data.args == 'object') { + for (var i=data.args.length-1;i>=0;i--) { + var ref = path+'||||'+data.args.slice(0,i).join('||||') + if (WIDGETS_BY_PATH[ref]) { + pathref = ref + args = data.args.slice(i,data.args.length) + args = args.length==1?args[0]:args + continue + } + } + } else { + args = data.args + } + for (i in WIDGETS_BY_PATH[pathref]) { + if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,false,true) + } + + + }, + + stateLoad: function(event,data){ + var data = data || event + data = JSON.parse(data) + actions.stateSet(data,true) + actions.stateQuickSave(data) + }, + + sessionList: function(event,data){ + var data = data || event + $('#lobby').append(` +
    +
    + Open Stage Control +
    +
    + +
    `) + + for (i in data) { + $('#lobby .list').append(''+data[i]+''+icon('remove')+'') + } + $('#lobby .footer').append(''+icon('folder-open')+' Browse') + $('#lobby .footer').append(''+icon('file-o')+' New') + $('#lobby .load').click(function(e){ + e.stopPropagation() + IPC.send('sessionOpen',{path:$(this).data('session')}) + }) + $('#lobby a span').click(function(e){ + e.stopPropagation() + IPC.send('sessionRemoveFromHistory',$(this).parent().data('session')) + $(this).parents('a').remove() + }) + $('#lobby .browse').click(function(e){ + e.stopPropagation() + actions.sessionBrowse() + }) + $('#lobby .new').click(function(e){ + e.stopPropagation() + init([{}],function(){$('#open-toggle, .enable-editor').click();$('.editor-root').trigger('mousedown.editor')}) + }) + }, + + sessionOpen: function(event,data){ + var data = data || event + var session = JSON.parse(data) + init(session) + + }, + + error: function(event,data){ + var data = data || event + + utils.createPopup(icon('warning')+' '+data.title,data.text) + }, + + applyStyle: function(event,data){ + var data = data || event + var style = document.createElement('style'); + style.innerHTML = data.join(''); + document.body.appendChild(style); + if (data.indexOf('--pixel-scale')!=-1) { + PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1] + INITIALZOOM = PXSCALE + } + } + +} + +},{"./actions":2,"./init":9,"./utils":13}],4:[function(require,module,exports){ +var correctPosition = function (m, parent){ + var pos = m.offset(), + width = m.outerWidth(), + height = m.outerHeight(), + totalWidth = $('body').outerWidth(), + totalHeight = $('body').outerHeight(), + leftAdjust = parent=='body'?0:parent.outerWidth()-2 + + if (width + pos.left > totalWidth) { + m.css({'margin-left':totalWidth-(width + pos.left + leftAdjust)}) + } + if (height + pos.top > totalHeight) { + m.css({'margin-top':totalHeight-(height + pos.top)}) + } +} + +var ev = 'fake-click' + + +var menu = function(e,actions,parent){ + + var m = $('
    ') + if (parent=='body') { + m.css({top:e.pageY+'px',left:e.pageX+'px'}) + } + + for (label in actions) { + + if (typeof actions[label] == 'object') { + + var item = $(`
    ${label}
    `).appendTo(m).on(ev,function(e){e.stopPropagation()}) + menu(e,actions[label],item) + + + } else { + + $(`
    ${label}
    `).on(ev + '.editor',function(){ + var callback = actions[label] + return function(e){ + callback() + $('.context-menu').remove() + } + }()).appendTo(m) + } + } + + m.appendTo(parent) + + + + if (parent=='body') { + correctPosition(m,parent) + } else { + parent.hover(function(){correctPosition(m,parent)}) + } + +} + +module.exports = menu + +},{}],5:[function(require,module,exports){ +var widgets = require('../widgets'), + widgetOptions = widgets.widgetOptions, + sync = widgets.sync, + parser = require('../parser') + parsewidgets = parser.widgets, + parsetabs = parser.tabs, + ui = require('../ui'), + actions = require('../actions'), + sidepanelCreateToggle = require('../sidepanel').createToggle, + editObject = function(a,b){require('./edit-objects').editObject(a,b,true)}, + editSession = function(a,b){require('./edit-objects').editSession(a,b,true)}, + purgeStores = require('./purge') + + +var getObjectData = function(obj){ + var path = [] + + if (obj.hasClass('tab')) { + return TABS['#'+obj.attr('id')].data + } + + if (obj.is('#container')) { + return SESSION + } + + while(true) { + if (obj.hasClass('widget')) { + path.unshift(obj.index()) + path.unshift('widgets') + } else if (obj.hasClass('tab')){ + path.unshift(obj.data('index')) + path.unshift('tabs') + } else if (obj.is('#container')) { + break + } + + obj = obj.parent() + } + + path.splice(0,1) + + for (var i=0,data=SESSION, path=path, len=path.length; i${data.label}`) + + editObject(newContainer,data) + + } else if (container.attr('id')=='container') { + // session + var newContainer = $('#container') + container.empty() + parsetabs(data,container,true) + + editSession(newContainer,data) + sidepanelCreateToggle() + + } + + newContainer.find('[data-tab]:first-child').click() + + $(window).resize() + + purgeStores(purgetabs) + + // restore state + actions.stateSet(state,false) + sync() + ui.scrolls() + $('#sidepanel').scrollTop(scroll) + + + // return updated node + return newContainer + +} + + +var incrementWidget = function(data){ + + if (!data) return + + delete data.linkId + + var id = data.id, + label = data.label, + path = data.path + + if (id && id==label) { + data.label = 'auto' + } + if (id && path == '/'+id) { + + data.path = 'auto' + + } else if (path){ + var pathref + while (WIDGETS_BY_PATH[pathref]) { + path = path.replace(/([0-9]*)$/,function(m){ + var n = parseInt(m)+1 + n = isNaN(n)?1:n + return n + }) + pathref = data.preArgs&&data.preArgs.length?data.path+'||||'+data.preArgs.join('||||'):data.path + } + WIDGETS_BY_PATH[pathref] = [] + data.path = path + + } + + if (id) { + while (WIDGETS[id]) { + id = id.replace(/([0-9]*)$/,function(m){ + var n = parseInt(m)+1 + n = isNaN(n)?1:n + return n + }) + } + WIDGETS[id] = [] + data.id = id + + } + + + for (i in data) { + if (typeof data[i] == 'object') data[i] = incrementWidget(data[i]) + } + + return data + +} + +module.exports = { + updateDom:updateDom, + getObjectData:getObjectData, + incrementWidget:incrementWidget +} + +},{"../actions":2,"../parser":10,"../sidepanel":11,"../ui":12,"../widgets":14,"./edit-objects":6,"./purge":8}],6:[function(require,module,exports){ +var updateDom = require('./data-workers').updateDom, + widgetOptions = require('../widgets').widgetOptions + +var ev = 'fake-click' + + +var editObject = function(container, data, refresh){ + + if (!refresh && (container.hasClass('editing') || $(`a[data-tab="#${container.attr('id')}"]`).hasClass('editing'))) return + + var isWidget = container.hasClass('widget') + + $('.editing').removeClass('editing') + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + + + if (isWidget) { + $(container).addClass('editing') + } else { + $(`[data-tab="#${container.attr('id')}"]`).addClass('editing').click() + $(container).parent().addClass('editing') + } + + + + $('.editor-container').remove() + $('.editor').append('
    ') + var form = $('
    ').appendTo('.editor-container') + + + var params = isWidget?widgetOptions[data.type]:{label:''} + + for (i in params) { + + if (i.indexOf('separator')!=-1) { + $(`
    ${params[i]}
    `).appendTo(form) + continue + } else if (data[i]===undefined) { + continue + } + + // Common options edit + if (i!='widgets' && i!='tabs') { + + var type = typeof data[i], + value = type == 'object'?JSON.stringify(data[i]):data[i], + wrapper = $('
    ').appendTo(form), + label = $(``).appendTo(wrapper), + input + + if (i=='type') { + + input = $(``) + input.click(function(){ + $(this).val(!eval($(this).val())).trigger('change') + }) + input.appendTo(wrapper) + + } else { + + input = $(``) + input.appendTo(wrapper) + + } + + + input.on('change',function(){ + // var v = $(this).val()!= '' && $(this).data('type') == 'object'?JSON.parse($(this).val()):$(this).val() + var v + try { + eval(`v=${$(this).val()}`) + } catch(err) { + v = $(this).val() + } + + data[$(this).attr('title')] = v + if (v==='') delete data[$(this).attr('title')] + updateDom(container,data) + }) + + } + + } + + // widget list edit + if (((isWidget&&widgetOptions[data.type].widgets) || (container.hasClass('tab'))) && (!data.tabs||!data.tabs.length)) { + + var list = $('
      '), + wrapper = $('
      ').appendTo(form) + + var editItem = function(i) { + return function(){ + container.find('.widget').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data.widgets) { + + + var item = $(`
    • ${data.widgets[i].id||data.widgets[i].label}
    • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.widgets.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + list.sortable({ + forcePlaceholderSize: true, + items: '.sortables', + start:function(){$(this).sortable( "refreshPositions" )}, + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.widgets.splice(newIndex, 0, data.widgets.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
    • +
    • `).appendTo(list).click(function(){ + data.widgets = data.widgets || [] + data.widgets.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + + } + + // tab list edit + if (((isWidget&&widgetOptions[data.type].tabs) || (container.hasClass('tab'))) && (!data.widgets||!data.widgets.length)) { + //tabs + var list = $('
        '), + wrapper = $('
        ').appendTo(form) + + + var editItem = function(i) { + return function(){ + container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data.tabs) { + var item = $(`
      • ${data.tabs[i].label}
      • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.tabs.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + list.sortable({ + start:function(){$(this).sortable( "refreshPositions" )}, + forcePlaceholderSize: true, + items: '.sortables', + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.tabs.splice(newIndex, 0, data.tabs.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
      • +
      • `).appendTo(list).click(function(){ + data.tabs = data.tabs || [] + data.tabs.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + } + + if (data.hasOwnProperty('width')) { + var handleTarget + container.resizable({ + handles:'s, e, se', + helper: "ui-helper", + start: function(event, ui){ + handleTarget = $(event.originalEvent.target) + }, + stop: function( event, ui ) { + if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)/PXSCALE + if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)/PXSCALE + updateDom(container,data) + } + }) + } + + if (data.hasOwnProperty('top')) { + container.draggable({ + cursor:'-webkit-grabbing', + stop: function( event, ui ) { + event.preventDefault() + data.top = (ui.helper.position().top + container.parent().scrollTop())/PXSCALE + data.left = (ui.helper.position().left + container.parent().scrollLeft())/PXSCALE + ui.helper.remove() + updateDom(container,data) + }, + handle:'.ui-draggable-handle, > .label', + snap:'.widget', + snapTolerance:5, + helper:function(){return $('
        ').css({height:container.outerHeight(),width:container.outerWidth()})} + }).append('
        ') + } + +} + +var editSession = function(container,data,refresh){ + + if (!refresh && $('.editor-root').hasClass('editing')) return + + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + + + $('.editing').removeClass('editing') + $('.editor-root, #container').addClass('editing') + + $('.editor-container').remove() + $('.editor').append('
        ') + + + var form = $('
        ').appendTo('.editor-container'), + list = $('
          '), + wrapper = $('
          ').appendTo(form) + + + var editItem = function(i) { + return function(){ + container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) + } + } + + for (i in data) { + var item = $(`
        • ${data[i].label}
        • `) + .appendTo(list) + .click(editItem(i)) + + var remove = $('') + .appendTo(item) + .click(function(e){ + e.stopPropagation() + data.splice($(this).parent().attr('data-index'),1) + updateDom(container,data) + }) + } + + + list.sortable({ + start:function(){$(this).sortable( "refreshPositions" )}, + forcePlaceholderSize: true, + items: '.sortables', + update: function(e,ui){ + var prevIndex = $(ui.item).attr('data-index') + var newIndex = $(ui.item).index() + + data.splice(newIndex, 0, data.splice(prevIndex, 1)[0]) + + updateDom(container,data) + } + }) + + var add = $(`
        • +
        • `).appendTo(list).click(function(){ + data = data || [] + data.push({}) + + updateDom(container,data) + }) + + $('').appendTo(wrapper) + list.appendTo(wrapper) + + + $('.editor-container').append(form) + +} + +module.exports = { + editObject:editObject, + editSession:editSession +} + +},{"../widgets":14,"./data-workers":5}],7:[function(require,module,exports){ +var data = require('./data-workers'), + getObjectData = data.getObjectData, + updateDom = data.updateDom, + incrementWidget = data.incrementWidget, + edit = require('./edit-objects'), + editObject = edit.editObject, + editSession = edit.editSession, + createPopup = require('../utils').createPopup, + widgetOptions = require('../widgets').widgetOptions, + widgetCategories = require('../widgets').categories, + menu = require('./context-menu') + + + +var init = function(){ + + $('body').off('.editor').on('fake-click fake-right-click',function(e,d){ + + if (!EDITING) return + + // ignore mouse event when fired by a simulated touch event + if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return + + $('.context-menu').remove() + + var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')? + $(e.target): + $(e.target).closest('.widget:not(.not-editable), .tab, [data-tab], #container') + + if (!target.length) return + + var container = target.attr('data-tab')?TABS[target.attr('data-tab')].tab:target, + type = target.hasClass('widget')?'widget':'tab', + parent = container.parent(), + index = container.index(), + data = getObjectData(container) + + if (container.attr('id')=='container') { + editSession(container,SESSION) + } else { + editObject(container,data) + } + + + if (e.type!='fake-right-click') return + + if (container.attr('id')=='container') { + menu(d,{ + ' Add tab': function(){ + data.push({}) + updateDom(container,data) + } + },'body') + + return + } + + + var actions = {} + + // actions[' Edit'] = function(){editObject(container,data)} + + if (type=='widget') actions[' Copy'] = function(){CLIPBOARD=data} + + if (type=='widget') actions[' Cut'] = function(){ + CLIPBOARD=JSON.parse(JSON.stringify(data)) + var parentContainer = container.parents('.widget, .tab, #container').first() + parentData = getObjectData(parentContainer) + + parentData.widgets.splice(container.index(),1) + updateDom(parentContainer,parentData) + } + + if (((type=='widget'&&widgetOptions[data.type].widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) { + + if (CLIPBOARD!=null) { + actions[' Paste'] = { + ' ID + 1':function(){ + data.widgets = data.widgets || [] + var newData = incrementWidget(JSON.parse(JSON.stringify(CLIPBOARD))) + + + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } else { + delete newData.top + delete newData.left + } + + data.widgets.push(newData) + updateDom(container,data) + }, + ' Clone':function(){ + data.widgets = data.widgets || [] + var newData = JSON.parse(JSON.stringify(CLIPBOARD)) + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } else { + delete newData.top + delete newData.left + } + data.widgets.push(newData) + updateDom(container,data) + } + } + } + + actions[' Add widget'] = {} + var createFunction = function(widgetType,container,data){ + return function() { + data.widgets = data.widgets || [] + var newData = {type:widgetType} + if (!target.attr('data-tab')) { + newData.top = d.offsetY + newData.left= d.offsetX + } + data.widgets.push(newData) + updateDom(container,data) + } + } + for (category in widgetCategories) { + actions[' Add widget'][category] = {} + for (t in widgetCategories[category]) { + var wtype = widgetCategories[category][t] + actions[' Add widget'][category][wtype] = createFunction(wtype,container,data) + + } + } + + } + if (((type=='widget'&&widgetOptions[data.type].tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) { + + actions[' Add tab'] = function(){ + data.tabs = data.tabs || [] + data.tabs.push({}) + updateDom(container,data) + } + + } + + actions[' Delete'] = function(){ + var popup = createPopup('Are you sure ?',` +
          +
          DELETE
          +
          CANCEL
          +
          + `) + $('.confirm-delete').click(function(){ + popup.close() + var parentContainer = container.parents('.widget, .tab, #container').first() + parentData = getObjectData(parentContainer) + + + if (type=='widget') { + parentData.widgets.splice(container.index(),1) + } else if (type=='tab' && parentContainer.attr('id')!='container') { + parentData.tabs.splice(container.data('index'),1) + } else { + parentData.splice(container.data('index'),1) + } + + updateDom(parentContainer,parentData) + }) + $('.cancel-delete').click(function(){ + popup.close() + }) + $(document).on('keydown.popup', function(e){ + if (e.keyCode==13) $('.confirm-delete').click() + }) + + + } + + menu(d,actions,'body') + + }) + +} + +module.exports = init + +},{"../utils":13,"../widgets":14,"./context-menu":4,"./data-workers":5,"./edit-objects":6}],8:[function(require,module,exports){ +module.exports = function(purgetabs) { + + // prune tabs store + var count, newcount, formerBuffuredTabs, bufferedTabs + + if (purgetabs) { + while (true) { + // we need to do that several times since tabs are referenced in each of their parents + + // get all buffered tabs + formerBuffuredTabs = [] + for (i in TABS) { + formerBuffuredTabs.push(TABS[i].tab[0]) + } + + // remove deleted tabs that are not referenced (have no navigation link pointing to them) + var $f = $(formerBuffuredTabs) + for (i in TABS) { + if (!($f.find(`[data-tab="${i}"]`).length || i== '#container')) { + delete TABS[i] + } + } + + newcount = Object.keys(TABS).length + if (count == newcount) break + count = newcount + + } + } + + + bufferedTabs = [] + for (i in TABS) { + bufferedTabs.push(TABS[i].tab[0]) + } + + // prune widget stores + // if widgets cannot be found in buffered tabs, it must be unreferenced + var $b = $(bufferedTabs) + for (i in WIDGETS) { + for (var j=WIDGETS[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS[i][j]).length) { + WIDGETS[i].splice(j,1) + } + } + if (!WIDGETS[i].length) { + delete WIDGETS[i] + } + } + for (i in WIDGETS_LINKED) { + for (var j=WIDGETS_LINKED[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS_LINKED[i][j]).length) { + WIDGETS_LINKED[i].splice(j,1) + } + } + if (!WIDGETS_LINKED[i].length) { + delete WIDGETS_LINKED[i] + } + } + for (i in WIDGETS_BY_PATH) { + for (var j=WIDGETS_BY_PATH[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS_BY_PATH[i][j]).length) { + WIDGETS_BY_PATH[i].splice(j,1) + } + } + if (!WIDGETS_BY_PATH[i].length) { + delete WIDGETS_BY_PATH[i] + } + } +} + +},{}],9:[function(require,module,exports){ +var parsetabs = require('./parser').tabs, + ui = require('./ui'), + sync = require('./widgets').sync, + editorDisable = require('./actions').editorDisable, + editorInit = require('./editor/init') + +module.exports = function(session,callback) { + + $('#lobby').remove() + $('#container').empty() + var spinner = $('
          ').appendTo('#container') + + setTimeout(function(){ + parsetabs(session,$('#container'),true) + + // var t = $('
          ').appendTo('body') + // for (id in TABS) { + // if (id!='#container') { + // t[0].appendChild(TABS[id].tab[0]) + // } + // } + // setTimeout(function(){ + // t.detach() + // },250) + + + ui.init() + editorDisable() + editorInit() + sync() + + + setTimeout(function(){ + spinner.remove() + if (!callback) return + setTimeout(function(){ + callback() + },25) + },25) + },25) + +} + +},{"./actions":2,"./editor/init":7,"./parser":10,"./ui":12,"./widgets":14}],10:[function(require,module,exports){ +var widgets = require('./widgets'), + widgetOptions = widgets.widgetOptions, + createWidget = widgets.createWidget, + icon = require('./utils').icon + +var getIterator = function(id,type){ + var iterator = MISC.iterators[type] + if (iterator[id]==undefined) iterator[id] = 0 + iterator[id] += 1 + return iterator[id] +} + +var hashCode = function(s){ + return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); +} + +module.exports.tabs = function(data,parent,main,parentLabel){ + + if (main) { + // Reset Globals + WIDGETS = {} + WIDGETS_LINKED = {} + WIDGETS_BY_PATH = {} + SESSION = data + for (i in TABS) { + if (i!='#container') { + TABS[i].parent.remove() + TABS[i].tab.remove() + } + } + TABS['#container'] = { + tab:$('#container') + } + + MISC.iterators.tab = {} + } + + var main = main?'main ':'', + nav = $(document.createElement('div')).addClass(main + 'navigation'), + navtabs = $(document.createElement('ul')).addClass('tablist'), + content = $(document.createElement('div')).addClass('content') + + + for (i in data) { + var tabData = data[i] + + + var label = tabData.label||tabData.id||'Unnamed', + hash = hashCode(label), + id = 'tab_'+hash+'_'+getIterator('tab'+hash,'tab') + + tabData.label = label + delete tabData.id + + navtabs.append(`
        • ${label}
        • `) + + var tabContent = $(`
          `) + tabContent.data(tabData) + + + if (tabData.tabs && tabData.tabs.length) { + module.exports.tabs(tabData.tabs,tabContent,false,label) + } else if (tabData.widgets && tabData.widgets.length) { + module.exports.widgets(tabData.widgets,tabContent) + } + + // content.append(tabContent) + TABS['#'+id]= { + parent:content, + tab:tabContent, + data:tabData + } + + } + + nav[0].appendChild(navtabs[0]) + parent[0].appendChild(nav[0]) + parent[0].appendChild(content[0]) +} + + + +module.exports.widgets = function(data,parent) { + + for (i in data) { + var widgetData = data[i] + + widgetData.type = widgetData.type || 'fader' + + var tmpWidgetOptions = JSON.parse(JSON.stringify(widgetOptions)) + + for (i in tmpWidgetOptions[widgetData.type]) { + if (i.indexOf('separator')==-1 && widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i] + } + + if (widgetData.id=='auto') { + var id + while (!id || WIDGETS[id]) { + id=widgetData.type+'_'+getIterator(widgetData.type,'widget') + } + widgetData.id = id + } + + widgetData.path = widgetData.path=='auto'?'/' + widgetData.id:widgetData.path + widgetData.target = widgetData.target?(Array.isArray(widgetData.target)?widgetData.target:[widgetData.target]):false + + for (i in widgetData) { + if (widgetOptions[widgetData.type][i]===undefined && i!='type') {delete widgetData[i]} + } + + + for (t in {width:'',height:'',top:'',left:''}) { + widgetData[t] = `${widgetData[t]}`.indexOf('-')!=-1?0:widgetData[t] + } + + if (parent.hasClass('strip')) { + delete widgetData.top + delete widgetData.left + } + + if (widgetData.preArgs!=undefined) { + widgetData.preArgs = Array.isArray(widgetData.preArgs)?widgetData.preArgs:[widgetData.preArgs] + } + if (widgetData.target!=undefined) { + widgetData.target = Array.isArray(widgetData.target)?widgetData.target:[widgetData.target] + } + + var width = parseFloat(widgetData.width)==widgetData.width?parseFloat(widgetData.width)+'rem' : widgetData.width, + height = parseFloat(widgetData.height)==widgetData.height?parseFloat(widgetData.height)+'rem' : widgetData.height, + left = parseFloat(widgetData.left)==widgetData.left?parseFloat(widgetData.left)+'rem' : widgetData.left, + top = parseFloat(widgetData.top)==widgetData.top?parseFloat(widgetData.top)+'rem' : widgetData.top + + + var styleW = widgetData.width&&widgetData.width!='auto'?`width:${width};min-width:auto;`:'', + styleH = widgetData.height&&widgetData.height!='auto'?`height:${height};min-height:auto;`:'', + styleL = widgetData.left&&widgetData.left!='auto'||widgetData.left==0?`left:${left};`:'', + styleT = widgetData.top&&widgetData.top!='auto'||widgetData.top==0?`top:${top};`:'' + + var label = widgetData.label == 'auto'? + widgetData.id: + typeof widgetData.label == 'string' && widgetData.label.indexOf('icon:')!=-1? + icon(widgetData.label.split(':')[1].trim().replace('fa-','')): + widgetData.label + + var widgetContainer = $(` +
          +
          ${label}
          +
          + `) + + if (widgetData.color && widgetData.color!='auto') widgetContainer[0].style.setProperty('--color-custom',widgetData.color) + + if (widgetData.label===false) widgetContainer.addClass('nolabel') + + // create widget + var widgetInner = createWidget[widgetData.type](widgetData,widgetContainer) + + + widgetContainer[0].appendChild(widgetInner[0]) + + // store widget reference for cross widget sync + if (WIDGETS[widgetData.id]==undefined) WIDGETS[widgetData.id] = [] + WIDGETS[widgetData.id].push(widgetInner) + + // store widget with linkId for widgte linking + if (widgetData.linkId && widgetData.linkId.length) { + if (WIDGETS_LINKED[widgetData.linkId]==undefined) WIDGETS_LINKED[widgetData.linkId] = [] + WIDGETS_LINKED[widgetData.linkId].push(widgetInner) + } + + // store widget by path and encode preArgs for perfect cross-app sync + if (widgetData.path)  { + var pathref = widgetData.preArgs&&widgetData.preArgs.length?widgetData.path+'||||'+widgetData.preArgs.join('||||'):widgetData.path + if (WIDGETS_BY_PATH[pathref]==undefined) WIDGETS_BY_PATH[pathref] = [] + WIDGETS_BY_PATH[pathref].push(widgetInner) + } + + parent[0].appendChild(widgetContainer[0]) + } + + // Editor needs to get the container object + if (data && data.length==1) return widgetContainer + +} + +},{"./utils":13,"./widgets":14}],11:[function(require,module,exports){ +var actions = require('./actions'), + icon = require('./utils').icon + +var data = [ + { + actions: [ + { + title:'Fullscreen (F11)', + action:actions.toggleFullscreen + } + + ] + }, + { + title: icon('sliders') + '  State', + actions: [ + { + title:'Store', + action:actions.stateQuickSave + }, + { + title:'Recall', + action:actions.stateQuickLoad, + class:'disabled quickload' + }, + { + title:'Send All', + action:actions.stateSend + }, + { + title:'Import', + action:actions.stateLoad + }, + { + title:'Export', + action:actions.stateSave + } + ] + }, + { + title: icon('magic') + '  Traversing gestures', + actions: [ + { + title:'On', + action:actions.traversingEnable, + class:'traversingEnable' + }, + { + title:'Off', + action:actions.traversingDisable, + class:'traversingDisable on' + } + ] + }, + { + title: icon('edit') + '  Editor', + class:'editor', + actions: [ + { + title:'On', + action:actions.editorEnable, + class:'enable-editor' + }, + { + title:'Off', + action:actions.editorDisable, + class:'on disable-editor' + }, + { + title:'Root', + class:'editor-root disabled' + }, + { + title:'Load', + action:actions.sessionBrowse + }, + { + title:'Save', + action:actions.sessionSave + } + ] + }, +] + +var sidepanel = function(data){ + + var bindAction = function(el,callback) { + el.click(function(){callback()}) + } + + var html = $('
            ') + + for (i in data) { + var itemData = data[i] + + var item = $('
          • '), + inner = $('
            ').appendTo(item) + wrapper = $('
            ').appendTo(inner) + + if (itemData.title) $('
            '+itemData.title+'
            ').prependTo(wrapper) + if (itemData.class) inner.attr('class',itemData.class) + + for (j in itemData.actions) { + var actionData = itemData.actions[j] + var el = $(''+actionData.title+'').appendTo(wrapper) + if (actionData.action) bindAction(el, actionData.action) + + if (actionData.class) el.addClass(actionData.class) + + } + item.appendTo(html) + + } + + return html + +}(data) + +var toggle = function(){ + $(`
          • ${icon('navicon')}
          • `).appendTo('.navigation.main ul').click(function(e){ + var t = 0 + if (!$('#sidepanel').hasClass('sidepanel-open')) t = 250 + + $('#open-toggle, #sidepanel').toggleClass('sidepanel-open') + setTimeout(function(){ + $('#container').toggleClass('sidepanel-open') + $(window).resize() + },t) + }).on('mousedown touchstart',function(e){e.stopPropagation()}) + + // in case where are hot loading a session + if ($('#sidepanel').hasClass('sidepanel-open')) { + $('#open-toggle, #container').addClass('sidepanel-open') + } +} + +module.exports = { + init:function(){ + $('#sidepanel').append(sidepanel) + toggle() + }, + createToggle:toggle +} + +},{"./actions":2,"./utils":13}],12:[function(require,module,exports){ +var actions = require('./actions'), + icon = require('./utils').icon + +var sidepanel = require('./sidepanel').init + +// Tabs... +var tabs = function() { + $('#container').click(function(e){ + var link = e.target + + if (!link.hasAttribute('data-tab') || link.classList.contains('on')) return + + var id = link.getAttribute('data-tab') + + link.classList.add('on') + + var previous = $(link).siblings('.on').removeClass('on').data('tab') + + // TABS[id].tab.appendTo(TABS[id].parent) + TABS[id].parent[0].appendChild(TABS[id].tab[0]) + $(previous).detach() + + + $(id).find('li[data-tab]:first-child, li.parent + li[data-tab]').each(function(){ + if (!$(this).siblings('.on').length) $(this).click() + }) + + $(window).resize() + + }) + $('li[data-tab]').first().click() +} + +// horizontal scrolling & zoom with mousewheel +// if shift is pressed (native), or if there is no vertical scrollbar, +// or if mouse is on h-scrollbar +var scrollbarHeight = 20 +var scrolls = function(){ + $('html').on('mousewheel.zoom',function(e) { + // console.log(e) + if (e.ctrlKey) { + e.preventDefault() + if (e.originalEvent.deltaY==0) return + var d = -e.originalEvent.deltaY/(10*Math.abs(e.originalEvent.deltaY)) + + PXSCALE = parseFloat(d)+parseFloat(PXSCALE) + document.documentElement.style.setProperty("--pixel-scale",'') + document.documentElement.style.setProperty("--pixel-scale",PXSCALE) + + } + }) + $(document).on('keydown.resetzoom', function(e){ + if (e.keyCode==96||e.keyCode==48) { + PXSCALE = INITIALZOOM + document.documentElement.style.setProperty("--pixel-scale",'') + document.documentElement.style.setProperty("--pixel-scale",PXSCALE) + } + }) + +} + + +module.exports = { + init: function(){ + sidepanel() + tabs() + scrolls() + }, + tabs:tabs, + scrolls:scrolls +} + +},{"./actions":2,"./sidepanel":11,"./utils":13}],13:[function(require,module,exports){ +module.exports = { + + createPopup: function(title,content) { + + var popup = $(` + `), + closer = popup.find('.popup-title .closer') + + closer.click(function(){ + popup.close() + }) + + + popup.close = function(){ + $(document).off('.popup') + popup.remove() + } + + popup.find('.popup-content').append(content) + $('body').append(popup) + + $(document).on('keydown.popup', function(e){ + if (e.keyCode==27) popup.close() + }) + + + + return popup + }, + icon: function(i) { + return `` + } + +} + +},{}],14:[function(require,module,exports){ +var widgets = { + // sliders + fader: require('./widgets/fader'), + knob: require('./widgets/knob'), + + // buttons + toggle: require('./widgets/toggle'), + switch: require('./widgets/switch'), + push: require('./widgets/push'), + + // pads + xy: require('./widgets/xy'), + rgb: require('./widgets/rgb'), + + // matrices + multitoggle: require('./widgets/multitoggle'), + multipush: require('./widgets/multipush'), + multifader: require('./widgets/multifader'), + + // plots + led: require('./widgets/led'), + plot: require('./widgets/plot'), + visualizer: require('./widgets/visualizer'), + meter: require('./widgets/meter'), + text: require('./widgets/text'), + + // containers + strip: require('./widgets/strip'), + panel: require('./widgets/panel'), +} + +module.exports.categories = { + 'Sliders':['fader','knob'], + 'Buttons':['toggle','push','switch'], + 'Pads':['xy','rgb'], + 'Matrices':['multifader','multitoggle','multipush'], + 'Plots':['plot','visualizer','led','meter','text'], + 'Containers':['panel','strip'] +} + +module.exports.widgetOptions = function(){ + var r = {} + for (i in widgets) { + r[i] = widgets[i].options + } + return r +}() + +module.exports.createWidget = function(){ + var r = {} + for (i in widgets) { + r[i] = widgets[i].create + } + return r +}() + +module.exports.sync = function() { + $('body').off('sync.global').on('sync.global',function(e,id,widget,linkId){ + // Widget that share the same id will update each other + // without sending any extra osc message + if (WIDGETS[id] && WIDGETS[id].length>1) { + var v = widget.getValue() + for (i in WIDGETS[id]) { + if (!WIDGETS[id][i].is(widget) && WIDGETS[id][i].setValue) { + WIDGETS[id][i].setValue(v,false,false) + } + } + } + // widgets that share the same linkId will update each other. + // Updated widgets will send osc messages normally + if (WIDGETS_LINKED[linkId] && WIDGETS_LINKED[linkId].length>1) { + var v = widget.getValue() + for (i in WIDGETS_LINKED[linkId]) { + if (!WIDGETS_LINKED[linkId][i].is(widget) && WIDGETS_LINKED[linkId][i].setValue) { + WIDGETS_LINKED[linkId][i].setValue(v,true,false) + } + } + } + }) +} + +},{"./widgets/fader":15,"./widgets/knob":16,"./widgets/led":17,"./widgets/meter":18,"./widgets/multifader":19,"./widgets/multipush":20,"./widgets/multitoggle":21,"./widgets/panel":22,"./widgets/plot":23,"./widgets/push":24,"./widgets/rgb":25,"./widgets/strip":26,"./widgets/switch":27,"./widgets/text":28,"./widgets/toggle":29,"./widgets/visualizer":31,"./widgets/xy":32}],15:[function(require,module,exports){ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'fader', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + alignRight:false, + horizontal:false, + noPip:false, + compact:false, + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + meter:false, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            + `), + gauge = widget.find('.gauge'), + knob = widget.find('.knob'), + wrapper = widget.find('.fader-wrapper'), + fader = widget.find('.fader'), + pips = widget.find('.pips'), + input = widget.find('.input').fakeInput({align:'center'}), + unit = widgetData.unit?' '+widgetData.unit.trim(): '', + dimension = widgetData.horizontal?'width':'height', + snap = widgetData.snap, + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + + + if (widgetData.horizontal) { + container.addClass('horizontal') + } else { + if (widgetData.alignRight) container.addClass('align-right') + } + + if (widgetData.compact) container.addClass('compact') + if (widgetData.noPip) wrapper.addClass('no-pip') + + gauge.size = 0 + fader.size = 0 + wrapper.size = 0 + widget.value = undefined + + if (widgetData.meter) { + var parsewidgets = require('../parser').widgets + var data = { + type:'meter', + id: widgetData.id + '/meter', + label:false, + horizontal:widgetData.horizontal, + range:widgetData.range, + logScale:widgetData.logScale, + path:widgetData.path + '/meter', + preArgs:widgetData.preArgs, + color:widgetData.color + } + var element = parsewidgets([data],fader) + element[0].classList.add('not-editable') + widget[0].classList.add('has-meter') + } + + + var rangeKeys = [], + rangeVals = [], + rangeLabels = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k], + label = typeof widgetData.range[k] == 'object'? + Object.keys(widgetData.range[k])[0]: + val + + rangeKeys.push(key) + rangeVals.push(val) + rangeLabels.push(label) + } + + var rangeValsMax = Math.max.apply(Math, rangeVals), + rangeValsMin = Math.min.apply(Math, rangeVals) + + if (!widgetData.noPip&&!widgetData.compact) { + var pipTexts = {} + for (k in rangeKeys) { + pipTexts[rangeKeys[k]]=rangeLabels[k] + } + + var pipsInner = '' + for (var i=0;i<=100;i++) { + if (pipTexts[i]==undefined) continue + + var pos = dimension=='height'?'bottom':'left'; + + var piptext = `${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]}` + + var add = ` +
            ${piptext}
            + ` + pipsInner = pipsInner + add + } + pips[0].innerHTML = pipsInner + } + + + + + + fader.resize(function(){ + fader.size= dimension=='height'?fader.outerHeight():fader.outerWidth() + wrapper.size = dimension=='height'?wrapper.outerHeight():wrapper.outerWidth() + widget.updateUi(gauge.size) + }) + + wrapper.on('fake-right-click',function(e){ + if (!EDITING) { + e.stopPropagation() + e.preventDefault() + input.focus() + } + }) + + wrapper.on('mousewheel',function(e){ + if (e.originalEvent.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var divider = e.ctrlKey?4:.25 + gauge.size = clip(gauge.size+e.originalEvent.wheelDelta/(fader.size*divider),[0,100]) + + widget.updateUi(gauge.size) + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + var off = 0 + wrapper.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var d = (dimension=='height')? + ((fader.size-data.offsetY+(wrapper.size-fader.size)/2) * 100 / fader.size): + (data.offsetX - (wrapper.size-fader.size)/2) * 100 / fader.size + d = clip(d,[0,100]) + + widget.updateUi(d) + gauge.size = d + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + off = gauge.size + + }) + + + wrapper.on('drag',function(e,data){ + + var d = (dimension=='height')?-data.deltaY:data.deltaX + d = clip(d*100/fader.size+off,[0,100]) + + widget.updateUi(d) + + gauge.size = d + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + widget.updateUi = function(v){ + var s = v/100, + t = dimension=='height'? + ['1,'+s+',1','0,'+ Math.round(-s*fader.size) +'px,0'] + :[s+',1,1',Math.round(s*fader.size) +'px,0,0'] + gauge[0].setAttribute('style','transform:scale3d('+t[0]+')') + knob[0].setAttribute('style','transform:translate3d('+t[1]+')') + } + + widget.getValue = function(){ + var h = clip(gauge.size,[0,100]) + for (var i=0;i= rangeKeys[i]) { + return mapToScale(h,[rangeKeys[i],rangeKeys[i+1]],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) + } + } + + } + widget.setValue = function(v,send,sync) { + if (typeof v != 'number') return + + var h, + v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]) + for (var i=0;i= rangeVals[i]) { + h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],false,logScale,true) + break + } + } + + widget.updateUi(h) + + gauge.size = h + + widget.value = v + widget.showValue(v) + + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + + widget.showValue = function(v) { + input.val(v+unit) + } + + input.change(function(){ + widget.setValue(parseFloat(input.val()),true,true) + }) + + widget.setValue(rangeVals[0]) + + return widget +} + +},{"../parser":10,"./utils":30}],16:[function(require,module,exports){ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'knob', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + noPip:false, + compact:false, + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            + `), + wrapper = widget.find('.knob-wrapper'), + mask = widget.find('.knob-mask'), + knob = widget.find('.knob'), + handle = widget.find('.handle'), + input = widget.find('.input').fakeInput({align:'center'}), + range = widgetData.range, + unit = widgetData.unit?' '+widgetData.unit.trim(): '', + snap = widgetData.snap, + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + + if (widgetData.noPip) wrapper.addClass('no-pip') + if (widgetData.compact) container.addClass('compact') + + + var rangeKeys = [], + rangeVals = [], + rangeLabels = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k], + label = typeof widgetData.range[k] == 'object'? + Object.keys(widgetData.range[k])[0]: + val + + rangeKeys.push(key) + rangeVals.push(val) + rangeLabels.push(label) + } + + var rangeValsMax = Math.max.apply(Math, rangeVals), + rangeValsMin = Math.min.apply(Math, rangeVals) + + + var pipmin = Math.abs(rangeLabels[0])>=1000?rangeLabels[0]/1000+'k':rangeLabels[0], + pipmax = Math.abs(rangeLabels[rangeLabels.length-1])>=1000?rangeLabels[rangeLabels.length-1]/1000+'k':rangeLabels[rangeLabels.length-1] + + + + widget.find('.pip.min').text(pipmin) + widget.find('.pip.max').text(pipmax) + + mask.size = 0 + widget.value = undefined + + wrapper.resize(function(e,width,height){ + + var w = Math.floor(Math.min(height,width)*.58) + + if (!w || mask.size==w) return + mask.size=w + mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`) + wrapper.size = {width:wrapper[0].clientWidth,height:wrapper[0].clientHeight} + }) + + wrapper.on('fake-right-click',function(e){ + if (!EDITING) { + e.stopPropagation() + e.preventDefault() + input.focus() + } + }) + + wrapper.on('mousewheel',function(e){ + if (e.originalEvent.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var divider = e.ctrlKey?48:8 + knob.rotation = clip(knob.rotation+e.originalEvent.wheelDeltaY/divider,[0,270]) + + widget.updateUi(knob.rotation) + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + + knob.rotation = 0 + + var offR = 0, + offX = 0, + offY = 0 + wrapper.on('draginit',function(e,data,traversing){ + + if (snap || traversing) { + + var w = wrapper.size.width, + h = wrapper.size.height, + x = data.offsetX-w/2, + y = data.offsetY-h/2, + angle = Math.atan2(-y, -x) * 180 / Math.PI +45, + r = angle<-90?angle+360:angle + r = (angle>=-90 && angle<-45)?270:r + r = clip(r,[0,270]) + + offX = x + offY = y + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + offR = knob.rotation + }) + + wrapper.on('drag',function(e,data){ + + var r = clip(-data.deltaY*2+offR,[0,270]) + + if (snap || data.ctrlKey || data.shiftKey) { + var w = data.target.clientWidth, + h = data.target.clientHeight, + x = data.deltaX + offX, + y = data.deltaY + offY, + angle = Math.atan2(-y, -x) * 180 / Math.PI +45, + r = angle<-90?angle+360:angle + r = (angle>=-90 && angle<-45)?270:r + r = clip(r,[0,270]) + } + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + widget.updateUi = function(r) { + knob[0].setAttribute('style','transform:rotateZ('+r+'deg)') + handle[0].setAttribute('style','transform:rotateZ('+(r-45)+'deg)') + + if (r>180) {knob.addClass('d3')} + else if (r>90) {knob.removeClass('d3').addClass('d2')} + else {knob.removeClass('d3 d2')} + } + + widget.getValue = function() { + var h = knob.rotation + for (var i=0;i= rangeKeys[i]*2.7) { + return mapToScale(h,[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) + } + } + } + widget.showValue = function(v) { + input.val(v+unit) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue = function(v,send,sync) { + if (typeof v != 'number') return + + var v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]), + r + + for (var i=0;i= rangeVals[i]) { + r = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],false,logScale,true) + break + } + } + + knob.rotation = r + + widget.updateUi(r) + + var v = widget.getValue() + widget.value = v + + widget.showValue(v) + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + input.change(function(){ + widget.setValue(parseFloat(input.val()),true,true) + }) + + widget.setValue(rangeVals[0]) + return widget +} + +},{"./utils":30}],17:[function(require,module,exports){ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'led', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + range:{min:0,max:1}, + logScale:false, + preArgs:[], + path:'auto' +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            +
            + `), + led = widget.find('span'), + range = widgetData.range + + widget.setValue = function(v,send,sync){ + if (typeof v != 'number') return + led.css('opacity',mapToScale(v,[range.min,range.max],[0,1],widgetData.precision,widgetData.logScale,true)) + } + + widget.setValue(range.min) + + return widget +} + +},{"./utils":30}],18:[function(require,module,exports){ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale + +module.exports.options = { + type:'fader', + id:'auto', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator3:'osc', + + range:{min:0,max:1}, + logScale:false, + path:'auto', + preArgs:[] +} + +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            +
            + `), + level = widget.find('.level'), + logScale = widgetData.logScale, + dimension = widgetData.horizontal?'width':'height', + axe = dimension=='height'?'X':'Y' + + + if (widgetData.horizontal) widget.addClass('horizontal') + + + var rangeKeys = [], + rangeVals = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k] + + rangeKeys.push(key) + rangeVals.push(val) + } + + + + widget.updateUi = function(v){ + var s = v/100, + t = dimension=='height'? + '1,'+s+',1' + :s+',1,1' + level[0].setAttribute('style','transform:scale3d('+t+')') + } + + + widget.setValue = function(v) { + if (typeof v != 'number') return + + var h, + v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]]) + for (var i=0;i= rangeVals[i]) { + h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],2,logScale,true) + break + } + } + + widget.updateUi(h) + + } + + widget.setValue(rangeVals[0]) + + return widget +} + +},{"./utils":30}],19:[function(require,module,exports){ +module.exports.options = { + type:'multifader', + id:'auto', + + separator0:'Matrix', + + strips:2, + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + compact:false, + css:'', + + + separator2:'osc', + + range:{min:0,max:1}, + logScale:false, + precision:2, + path:'auto', + preArgs:[], + target:[] +} + +module.exports.create = function(widgetData,container) { + + var parsewidgets = require('../parser').widgets + + var widget = $(` +
            +
            \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i +
            \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i + \ + `), + $document = $(document) + + widget.value = [] + + for (var i=0;i + + `) + + if (!widgetData.scroll) widget.addClass('noscroll') + + if (widgetData.tabs.length) { + parsetabs(widgetData.tabs,widget) + widget.addClass('has-tabs') + } else { + parsewidgets(widgetData.widgets,widget) + } + return widget +} + +},{"../parser":10}],23:[function(require,module,exports){ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'plot', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'plot', + + points:[], + rangeX: {min:0,max:1}, + rangeY: {min:0,max:1}, + logScaleX: false, + logScaleY: false, + + separator3:'osc', + + path:'auto', + preArgs:[], + +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
            + +
            + `), + canvas = widget.find('canvas'), + ctx = canvas[0].getContext('2d') + + widget.data = [] + widget.height = undefined + widget.width = undefined + widget.linkedWidgets = [] + widget.visible = false + widget.textColor = getComputedStyle(document.documentElement).getPropertyValue('--color-text-fade') + widget.pips = { + x : { + min: Math.abs(widgetData.rangeX.min)>=1000?widgetData.rangeX.min/1000+'k':widgetData.rangeX.min, + max: Math.abs(widgetData.rangeX.max)>=1000?widgetData.rangeX.max/1000+'k':widgetData.rangeX.max + }, + y : { + min: Math.abs(widgetData.rangeY.min)>=1000?widgetData.rangeY.min/1000+'k':widgetData.rangeY.min, + max: Math.abs(widgetData.rangeY.max)>=1000?widgetData.rangeY.max/1000+'k':widgetData.rangeY.max + } + } + + + + if (typeof widgetData.points=='string') { + + widget.linkedWidgets.push(widgetData.points) + + } else if (typeof widgetData.points=='object') { + + for (i in widgetData.points) { + for (j in widgetData.points[i]) { + if (typeof widgetData.points[i][j] == 'string') { + widget.linkedWidgets.push(widgetData.points[i][j]) + } + } + } + } + + + canvas.resize(function(){ + var width = canvas.width(), + height = canvas.height() + + if (height==100 && width==100) return + + if (!self.visible) { + widget.visible = true + widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent') + } + + + widget.height=height + widget.width=width + + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + + widget.fetchValues() + requestAnimationFrame(widget.draw) + + }) + + + widget.handleSync = function(e,id,w) { + if (widget.linkedWidgets.indexOf(id)==-1 || !WIDGETS[id]) return + widget.fetchValues() + requestAnimationFrame(widget.draw) + } + + $('body').on('sync',widget.handleSync) + + widget.draw = function(){ + + + ctx.clearRect(0,0,widget.width,widget.height) + ctx.beginPath() + + var first = true + var point = [] + + for (i in widget.data) { + var newpoint = widget.data[i].length? + [ + mapToScale(widget.data[i][0],[widgetData.rangeX.min,widgetData.rangeX.max],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true), + mapToScale(widget.data[i][1],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true), + ] + : + [ + mapToScale(i,[0,widget.data.length-1],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true), + mapToScale(widget.data[i],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true), + ] + + + + if (first) { + ctx.moveTo(newpoint[0],newpoint[1]) + first = false + } else { + ctx.moveTo(point[0],point[1]) + if (widgetData.logScaleX&&!widgetData.logScaleY) { + ctx.quadraticCurveTo(point[0], newpoint[1], newpoint[0], newpoint[1]) + } else if (widgetData.logScaleY&&!widgetData.logScaleX) { + ctx.quadraticCurveTo(newpoint[0], point[1], newpoint[0], newpoint[1]) + } else { + ctx.lineTo(newpoint[0],newpoint[1]) + } + + } + ctx.arc(newpoint[0],newpoint[1],1,0,2*Math.PI) + point = newpoint + } + + ctx.lineWidth = 1.5*PXSCALE + ctx.strokeStyle= widget.lineColor + ctx.stroke() + + ctx.font = PXSCALE * 10 + 'px sans-serif' + ctx.fillStyle = widget.textColor + + + ctx.textBaseline = "bottom" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.x.min,12*PXSCALE,widget.height) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.x.max,widget.width-10,widget.height) + + ctx.save() + ctx.translate(0, widget.height) + ctx.rotate(-Math.PI/2) + + ctx.textBaseline = "top" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.y.min,12*PXSCALE,2*PXSCALE) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.y.max,widget.height-10*PXSCALE,2*PXSCALE) + ctx.rotate(Math.PI/2) + ctx.restore() + + } + + + + widget.fetchValues = function(){ + var data = [], + points = widgetData.points + + if (typeof points=='string' && WIDGETS[points]) { + + data = WIDGETS[points][WIDGETS[points].length-1].getValue() + + } else if (typeof points=='object') { + + for (i in points) { + + data[i] = [] + for (k in [0,1]) { + if (typeof points[i][k] == 'string' && WIDGETS[points[i][k]]) { + data[i][k] = WIDGETS[points[i][k]][WIDGETS[points[i][k]].length-1].getValue() + } else { + data[i][k] = points[i][k] + } + } + + } + + } + + if (data.length) widget.data = data + } + + widget.setValue = function(v) { + widget.data = v + requestAnimationFrame(widget.draw) + } + + return widget +} + +},{"./utils":30}],24:[function(require,module,exports){ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'push', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + on:1, + off:0, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + + var widget = $(` +
            +
            +
            \ + `), + $document = $(document), + light = widget.find('.light')[0] + + widget.value = widget.find('span') + widget.state = 0 + widget.active = 0 + widget.lastChanged = 'state' + + widget.on('drag',function(e){e.stopPropagation()}) + widget.on('draginit.push',function(){ + widget.off('draginit.push') + widget.fakeclick() + }) + + widget.fakeclick = function(){ + if (!widget.active) widget.setValuePrivate(widgetData.on,true,true) + $document.on('dragend.push',function(){ + widget.setValuePrivate(widgetData.off,true,true) + $document.off('dragend.push') + widget.on('draginit.push',function(){ + widget.off('draginit.push') + widget.fakeclick() + }) + }) + } + + widget.getValue = function() { + return widget[widget.lastChanged]?widgetData.on:widgetData.off + } + + widget.setValuePrivate = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('active') + widget.active = 1 + if (send) widget.sendValue(v) + widget.lastChanged = 'active' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('active') + widget.active = 0 + if (send) widget.sendValue(v) + widget.lastChanged = 'active' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + } + + widget.setValue = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('on') + widget.state = 1 + if (send) widget.sendValue(v) + widget.lastChanged = 'state' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('on') + widget.state = 0 + if (send) widget.sendValue(v) + widget.lastChanged = 'state' + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + } + + widget.sendValue = function(v) { + if (v===false) return + var args = widgetData.preArgs.concat(v) + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue() + return widget +} + +},{"./utils":30}],25:[function(require,module,exports){ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + hsbToRgb = utils.hsbToRgb, + rgbToHsb = utils.rgbToHsb, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'rgb', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + precision:0, + path:'auto', + preArgs:[], + split:false, + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            R
            G
            B
            +
            +
            +
            `), + rgbHandle = widget.find('.rgb .handle'), + hueHandle = widget.find('.hue .handle'), + pad = widget.find('.xy'), + huePad = widget.find('.hue'), + rgbBg = pad.find('.bg')[0], + value = {r:widget.find('.r').fakeInput({align:'center'}),g:widget.find('.g').fakeInput({align:'center'}),b:widget.find('.b').fakeInput({align:'center'})}, + snap = widgetData.snap, + split = widgetData.split? + typeof widgetData.split == 'object'? + widgetData.split:{r:widgetData.path+'/r',g:widgetData.path+'/g',b:widgetData.path+'/b'} + :false + + + pad.width = 0 + pad.height = 0 + rgbHandle.height = 0 + rgbHandle.width = 0 + hueHandle.width = 0 + widget.value = undefined + + pad.resize(function(){ + var width = pad.innerWidth(), + height = pad.innerHeight() + if (!width || (pad.height==height && pad.width==width)) return + pad.width = width + pad.height = height + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*rgbHandle.width/100}px, -${pad.height*rgbHandle.height/100}px,0)`) + + }) + + + var rgbOff = {x:0,y:0} + pad.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var h = ((pad.height-data.offsetY) * 100 / pad.height), + w = (data.offsetX * 100 / pad.width) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + rgbHandle.height = h + rgbHandle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + rgbOff = {x:rgbHandle.width,y:rgbHandle.height} + + }) + pad.on('drag',function(e,data){ + + var h = clip((-data.deltaY)*100/pad.height+rgbOff.y,[0,100]), + w = clip(data.deltaX*100/pad.width+rgbOff.x,[0,100]) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + rgbHandle.height = h + rgbHandle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + var hueOff = 0 + huePad.on('draginit',function(e,data,traversing){ + if (snap || traversing) { + + var d = (data.offsetX * 100 / pad.width) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*d/100}px,0,0)`) + hueHandle.width = d + + + var h = clip(hueHandle.width*3.6,[0,360]), + rgb = hsbToRgb({h:h,s:100,b:100}) + + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + hueOff = hueHandle.width + + }) + + + huePad.on('drag',function(e,data){ + + var w = clip(data.deltaX*100/pad.width+hueOff,[0,100]) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px,0,0)`) + hueHandle.width = w + + var h = clip(hueHandle.width*3.6,[0,360]), + rgb = hsbToRgb({h:h,s:100,b:100}) + + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + + + + widget.getValue = function() { + var s = clip(rgbHandle.width,[0,100]), + l = clip(rgbHandle.height,[0,100]), + h = mapToScale(hueHandle.width,[0,100],[0,360],widgetData.precision), + rgb = hsbToRgb({h:h,s:s,b:l}) + return [rgb.r,rgb.g,rgb.b] + } + widget.setValue = function(v,send,sync) { + if (!v || v.length!=3) return + + for (i in [0,1,2]) { + v[i] = clip(v[i],[0,255]) + } + + + var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]}) + + var w = mapToScale(hsb.s,[0,100],[0,100],false), + h = mapToScale(hsb.b,[0,100],[0,100],false), + hueW = mapToScale(hsb.h,[0,360],[0,100],false) + + rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*hueW/100}px,0,0)`) + + rgbHandle.height = h + rgbHandle.width = w + hueHandle.width = hueW + widget.value = v + + + var rgb = hsbToRgb({h:hsb.h,s:100,b:100}) + rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + widget.showValue(v) + + + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:split?false:widgetData.target, + path:widgetData.path, + args:args, + precision:widgetData.precision, + }) + if (split) { + sendOsc({ + target:widgetData.target, + path:split.r, + args:widgetData.preArgs.concat(v[0]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.g, + args:widgetData.preArgs.concat(v[1]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.b, + args:widgetData.preArgs.concat(v[2]), + precision:widgetData.precision, + sync:false + }) + } + } + + + + widget.showValue = function(v) { + value.r.val(v[0]) + value.g.val(v[1]) + value.b.val(v[2]) + } + value.r.change(function(){ + var r = clip(value.r.val(),[0,255]) + var v = widget.getValue() + widget.setValue([r,v[1],v[2]],true,true) + }) + value.g.change(function(){ + var g = clip(value.g.val(),[0,255]) + var v = widget.getValue() + widget.setValue([v[0],g,v[2]],true,true) + }) + value.b.change(function(){ + var b = clip(value.b.val(),[0,255]) + var v = widget.getValue() + widget.setValue([v[0],v[1],b],true,true) + }) + + widget.setValue([0,0,0]) + + return widget +} + +},{"./utils":30}],26:[function(require,module,exports){ + +module.exports.options = { + type:'strip', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator2:'children', + + widgets:[] +} +module.exports.create = function(widgetData,container) { + + var parsewidgets = require('../parser').widgets + + var widget = $(` +
            +
            + `) + if (widgetData.horizontal) { + container.addClass('horizontal') + } else { + container.addClass('vertical') + } + + parsewidgets(widgetData.widgets,widget) + + return widget +} + +},{"../parser":10}],27:[function(require,module,exports){ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'switch', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + horizontal:false, + color:'auto', + css:'', + + separator2:'osc', + + values:{"Value 1":1,"Value 2":2}, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
            +
            + `), + $document = $(document) + + if (widgetData.horizontal) { + widget.addClass('horizontal') + } + + widget.values = [] + + for (k in widgetData.values) { + widget.values.push(widgetData.values[k]) + $('
            '+k+'
            ').data({value:widgetData.values[k]}).appendTo(widget) + } + + widget.value = undefined + + widget.find('.value').on('draginit',function(e,dd){ + var data = $(this).data() + if (data.value!=widget.value || widget.value===undefined) widget.setValue(data.value,true,true) + }) + + + + widget.getValue = function() { + return widget.value + } + widget.setValue = function(v,send,sync) { + var i = widget.values.indexOf(v) + if (i!=-1) { + widget.value = widget.values[i] + widget.find('.on').removeClass('on') + widget.find('.value').eq(i).addClass('on').removeClass('ripple').addClass('ripple').delay(250).queue(function(next){ + $(this).removeClass('ripple') + next() + }) + if (send) widget.sendValue(widget.value) + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + return widget +} + +},{"./utils":30}],28:[function(require,module,exports){ +var utils = require('./utils'), + mapToScale = utils.mapToScale + +module.exports.options = { + type:'text', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + vertical:false, + color:'auto', + css:'', + + separator2:'osc', + + preArgs:[], + path:'auto', + defaultText:'' +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            + `), + label = widgetData.defaultText!==''? + widgetData.defaultText: + widgetData.label===false? + widgetData.id: + widgetData.label=='auto'? + widgetData.id: + widgetData.label, + text = label + + + if (widgetData.vertical) widget.addClass('vertical') + + widget.setValue = function(v,send,sync){ + text = typeof v=='object' && !v.length?label:v + widget.text(text) + } + + widget.getValue = function(){ + return text + } + + widget.setValue(label) + + return widget +} + +},{"./utils":30}],29:[function(require,module,exports){ +var sendOsc = require('./utils').sendOsc + +module.exports.options = { + type:'toggle', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'osc', + + on:1, + off:0, + precision:2, + path:'auto', + preArgs:[], + target:[] +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
            +
            +
            \ + `), + $document = $(document), + light = widget.find('.light')[0] + + widget.value = widget.find('span') + widget.state = 0 + + widget.on('drag',function(e){e.stopPropagation()}) + widget.on('draginit.toggle',function(){ + widget.off('draginit.toggle') + widget.fakeclick() + }) + + widget.fakeclick = function(){ + var newVal = widget.state?widgetData.off:widgetData.on + widget.setValue(newVal,true,true) + $document.on('dragend.toggle',function(){ + $document.off('dragend.toggle') + widget.on('draginit.toggle',function(){ + widget.off('draginit.toggle') + widget.fakeclick() + }) + }) + } + + + widget.getValue = function() { + return widget.state?widgetData.on:widgetData.off + } + widget.setValue = function(v,send,sync) { + if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { + widget.addClass('on') + widget.state = 1 + if (send) widget.sendValue(widgetData.on) + } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { + widget.removeClass('on') + widget.state = 0 + if (send) widget.sendValue(widgetData.off) + } + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + + } + widget.sendValue = function(v) { + if (v===false) return + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue() + return widget +} + +},{"./utils":30}],30:[function(require,module,exports){ +module.exports = { + + sendOsc: function(data){ + IPC.send('sendOsc', data) + }, + + clip: function(value,range) { + var value = parseFloat(value) + + if (isNaN(value)) value = range[0] + return Math.max(Math.min(range[0],range[1]),Math.min(value,Math.max(range[0],range[1]))) + + }, + + // map a value from a scale to another input and output must be range arrays + mapToScale: function(value,rangeIn,rangeOut,precision,log,revertlog) { + + var value = module.exports.clip(value,[rangeIn[0],rangeIn[1]]), + roundFactor = precision!=undefined?Math.pow(10,precision):100, + + + value = log? + revertlog? + (Math.pow(10,((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])))/9-1/9) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + :Math.log10(((value-rangeIn[0])/(rangeIn[1]-rangeIn[0]))*9+1) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + :((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] + + value = Math.max(Math.min(rangeOut[0],rangeOut[1]),Math.min(value,Math.max(rangeOut[0],rangeOut[1]))) + + if (precision!==false) value = Math.round(value*roundFactor)/roundFactor + + + return value + + }, + + hsbToRgb: function (hsb) { + var rgb = {} + var h = hsb.h + var s = hsb.s*255/100 + var v = hsb.b*255/100 + if(s == 0) { + rgb.r = rgb.g = rgb.b = v + } else { + var t1 = v + var t2 = (255-s)*v/255 + var t3 = (t1-t2)*(h%60)/60 + if(h==360) h = 0 + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)} + }, + + rgbToHsb: function (rgb) { + var hsb = {h: 0, s: 0, b: 0} + var min = Math.min(rgb.r, rgb.g, rgb.b) + var max = Math.max(rgb.r, rgb.g, rgb.b) + var delta = max - min + hsb.b = max + hsb.s = max != 0 ? 255 * delta / max : 0 + if (hsb.s != 0) { + if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta + else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta + else hsb.h = 4 + (rgb.r - rgb.g) / delta + } else hsb.h = 0 + hsb.h *= 60 + if (hsb.h < 0) hsb.h += 360 + hsb.s *= 100/255 + hsb.b *= 100/255 + return hsb + } +} + +},{}],31:[function(require,module,exports){ +var utils = require('./utils'), + mapToScale = utils.mapToScale, + clip = utils.clip + +module.exports.options = { + type:'visualizer', + id:'auto', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'plot', + + widgetId:'', + duration:1, + range: {min:0,max:1}, + logScale: false, + + separator3:'osc', + + path:'auto', + preArgs:[], +} +module.exports.create = function(widgetData,container) { + + var widget = $(` +
            + +
            + `), + canvas = widget.find('canvas'), + ctx = canvas[0].getContext('2d') + + widget.height = 0 + widget.width = 0 + widget.visible = false + widget.textColor = getComputedStyle(document.documentElement).getPropertyValue('--color-text-fade') + widget.pips = { + min: Math.abs(widgetData.range.min)>=1000?widgetData.range.min/1000+'k':widgetData.range.min, + max: Math.abs(widgetData.range.max)>=1000?widgetData.range.max/1000+'k':widgetData.range.max + } + widget.length = Math.round(clip(60*widgetData.duration,[8,4096])) + widget.data = new Array(widget.length) + widget.value = widgetData.range.min + + canvas.resize(function(){ + var width = canvas.width(), + height = canvas.height() + + if (height==100 && width==100) return + + if (!self.visible) { + widget.visible = true + widget.lineColor = getComputedStyle(widget[0]).getPropertyValue('--color-accent') + } + + widget.height=height + widget.width=width + + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + + requestAnimationFrame(widget.draw) + + }) + + + widget.handleSync = function(e,id,w) { + if (widgetData.widgetId!=id || !WIDGETS[id]) return + widget.startLoop() + } + + $('body').on('sync',widget.handleSync) + + + widget.cancel = false + widget.loop = false + + widget.startLoop = function(){ + + if (widget.cancel) clearTimeout(widget.cancel) + + widget.cancel = setTimeout(function(){ + clearInterval(widget.loop) + widget.loop = false + widget.cancel = false + },1000*widgetData.duration) + + if (widget.loop) return + + widget.loop = setInterval(function(){ + widget.fetchValue() + widget.draw() + },1000*widgetData.duration/widget.length) + } + + + widget.draw = function(){ + ctx.clearRect(0,0,widget.width,widget.height) + ctx.beginPath() + + var first = true + var point = [] + + for (var i=widget.length-1;i>=0;i=i-1) { + var newpoint = [ + mapToScale(i,[0,widget.length-1],[15*PXSCALE,widget.width-15*PXSCALE],1), + mapToScale(widget.data[i],[widgetData.range.min,widgetData.range.max],[widget.height-15*PXSCALE,15*PXSCALE],1,widgetData.logScale,true), + ] + if (first) { + ctx.moveTo(newpoint[0],newpoint[1]) + first = false + } else { + if (widgetData.logScale) { + ctx.quadraticCurveTo(newpoint[0], point[1], newpoint[0], newpoint[1]) + } else { + ctx.lineTo(newpoint[0],newpoint[1]) + } + + } + point = newpoint + } + + ctx.lineWidth = 1.5*PXSCALE + ctx.strokeStyle= widget.lineColor + ctx.stroke() + + ctx.font = PXSCALE * 10 + 'px sans-serif' + ctx.fillStyle = widget.textColor + + + ctx.save() + ctx.translate(0, widget.height) + ctx.rotate(-Math.PI/2) + + ctx.textBaseline = "top" + ctx.textAlign = 'left' + ctx.fillText(widget.pips.min,12*PXSCALE,2*PXSCALE) + ctx.textAlign = 'right' + ctx.fillText(widget.pips.max,widget.height-10*PXSCALE,2*PXSCALE) + ctx.rotate(Math.PI/2) + ctx.restore() + + } + + + + widget.fetchValue = function(){ + var id = widgetData.widgetId + + if (typeof id == 'string' && WIDGETS[id]) { + var v = WIDGETS[id][WIDGETS[id].length-1].getValue() + widget.data.push(v) + widget.value = v + } else { + widget.data.push(widget.value) + } + + widget.data.splice(0,1) + + } + + widget.setValue = function(v) { + widget.value = v + widget.startLoop() + } + + return widget +} + +},{"./utils":30}],32:[function(require,module,exports){ +var utils = require('./utils'), + clip = utils.clip, + mapToScale = utils.mapToScale, + sendOsc = utils.sendOsc + +module.exports.options = { + type:'xy', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + rangeX:{min:0,max:1}, + rangeY:{min:0,max:1}, + logScaleX:false, + logScaleY:false, + precision:2, + path:'auto', + preArgs:[], + split:false, + target:[] +} +module.exports.create = function(widgetData,container) { + var widget = $(` +
            +
            +
            +
            +
            +
            X
            Y
            +
            +
            +
            + `), + handle = widget.find('.handle'), + pad = widget.find('.xy'), + value = {x:widget.find('.x').fakeInput({align:'center'}),y:widget.find('.y').fakeInput({align:'center'})}, + range = {x:widgetData.rangeX,y:widgetData.rangeY}, + snap = widgetData.snap, + split = widgetData.split? + typeof widgetData.split == 'object'? + widgetData.split:{x:widgetData.path+'/x',y:widgetData.path+'/y'} + :false; + logScaleX = widgetData.logScaleX, + logScaleY = widgetData.logScaleY, + roundFactor = Math.pow(10,widgetData.precision) + + + if (widgetData.height!='auto') widget.addClass('manual-height') + + pad.width = 0 + pad.height = 0 + handle.height = 0 + handle.width = 0 + widget.value = undefined + + pad.resize(function(){ + var width = pad.innerWidth(), + height = pad.innerHeight() + if (!width || (pad.height==height && pad.width==width)) return + pad.width = width + pad.height = height + + widget.updateUi(handle.width,handle.height) + }) + + var off = {x:0,y:0} + pad.on('draginit',function(e,data,traversing){ + + if (snap || traversing) { + var h = ((pad.height-data.offsetY) * 100 / pad.height), + w = (data.offsetX * 100 / pad.width) + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + off = {x:handle.width,y:handle.height} + + }) + pad.on('drag',function(e,data){ + + var h = clip((-data.deltaY)*100/pad.height+off.y,[0,100]), + w = clip((data.deltaX)*100/pad.width+off.x,[0,100]) + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + + var v = widget.getValue() + + if (vwidget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + }) + + + widget.updateUi = function(w,h) { + handle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) + } + + widget.getValue = function() { + var x = mapToScale(handle.width,[0,100],[range.x.min,range.x.max],widgetData.precision,logScaleX), + y = mapToScale(handle.height,[0,100],[range.y.min,range.y.max],widgetData.precision,logScaleY) + + return [x,y] + } + widget.setValue = function(v,send,sync) { + if (!v || v.length!=2) return + + for (i in [0,1]) { + v[i] = clip(Math.round(v[i]*roundFactor)/roundFactor,[range[['x','y'][i]].min,range[['x','y'][i]].max]) + } + + var w = mapToScale(v[0],[range.x.min,range.x.max],[0,100],false,logScaleX,true) + h = mapToScale(v[1],[range.y.min,range.y.max],[0,100],false,logScaleY,true), + + + widget.updateUi(w,h) + + handle.height = h + handle.width = w + widget.value = v + + widget.showValue(v) + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:split?false:widgetData.target, + path:widgetData.path, + args:args, + precision:widgetData.precision, + }) + if (split) { + sendOsc({ + target:widgetData.target, + path:split.x, + args:widgetData.preArgs.concat(v[0]), + precision:widgetData.precision, + sync:false + }) + sendOsc({ + target:widgetData.target, + path:split.y, + args:widgetData.preArgs.concat(v[1]), + precision:widgetData.precision, + sync:false + }) + } + } + + widget.showValue = function(v) { + value.x.val(v[0]) + value.y.val(v[1]) + } + + value.x.change(function(){ + var v = widget.getValue() + v[0] = clip(value.x.val(),[range.x.min,range.x.max]) + widget.setValue(v,true,true) + }) + value.y.change(function(){ + var v = widget.getValue() + v[1] = clip(value.y.val(),[range.y.min,range.y.max]) + widget.setValue(v,true,true) + }) + + widget.setValue([range.x.min,range.y.min]) + return widget +} + +},{"./utils":30}],33:[function(require,module,exports){ +WEBFRAME = false + +// mainProcess & renderProcess communication engine +// electron's ipc module is not available here, we use socket.io as a replacement +var socket = require('socket.io-client') + +IPC = socket.connect() +IPC.send = IPC.emit + + +require('./app') + +},{"./app":1,"socket.io-client":39}],34:[function(require,module,exports){ +// jQuery drag event handler +// note: triggerHandler() is used instead of trigger() when event bubblig is not +// necessary, this increases performances a lot. +;(function($){ + var events = { + touch:{start:'touchstart',stop:'touchend touchcancel',move:'touchmove',touch:true}, + mouse:{start:'mousedown',stop:'mouseup',move:'mousemove',out:'mouseout',touch:false} + }, + + + $document = $(document), + getOffset = function(obj) { + var offsetLeft = 0 + var offsetTop = 0 + if (obj) { + do { + if (!isNaN(obj.offsetLeft)) { + offsetLeft += obj.offsetLeft - obj.scrollLeft + } + if (!isNaN(obj.offsetTop)) { + offsetTop += obj.offsetTop - obj.scrollTop + } + } while(obj = obj.offsetParent ) + } + + return {left: offsetLeft, top: offsetTop} + } + + + $.event.special.draginit = $.event.special.drag = { + setup:function(){ + + var $this = $(this) + + if ($this.data('dragSetup')) return + $this.data('dragSetup','true') + + + // mouse single touch handler + var previousEvent = null, + target = null, + traversing = false, + mouseStartHandler = function(e){ + + // ignore mouse event when fired by a simulated touch event + if (e.originalEvent.sourceCapabilities.firesTouchEvents) return + + isPointerDown = true + target = $this + previousEvent = e + + e.speedX = 0 + e.speedY = 0 + e.deltaX = 0 + e.deltaY = 0 + + target.triggerHandler('draginit',[e,e.originalEvent.traversing]) + + $document.on(events.mouse.move,mouseMoveHandler) + $document.on(events.mouse.stop,mouseStopHandler) + $document.on(events.mouse.out,mouseOutHandler) + + }, + mouseMoveHandler = function(e){ + e.stopPropagation() + + e.speedX = e.pageX - previousEvent.pageX + e.speedY = e.pageY - previousEvent.pageY + e.deltaX = e.speedX + previousEvent.deltaX + e.deltaY = e.speedY + previousEvent.deltaY + + + if (e.originalEvent.traversing) { + target = $(e.target) + e.preventDefault() + target.triggerHandler('draginit',[e,e.originalEvent.traversing]) + } else { + target.triggerHandler('drag',[e,e.originalEvent.traversing]) + } + + previousEvent = e + }, + mouseStopHandler = function(e){ + e.stopPropagation() + + // ignore mouse event when fired by a simulated touch event + if (e.originalEvent.sourceCapabilities.firesTouchEvents) return + + e.speedX = e.pageX - previousEvent.pageX + e.speedY = e.pageY - previousEvent.pageY + e.deltaX = e.deltaX + previousEvent.deltaX + e.deltaY = e.deltaY + previousEvent.deltaY + + + target.trigger('dragend',[e,e.originalEvent.traversing]) + isPointerDown = false + $document.off(events.mouse.move,mouseMoveHandler) + $document.off(events.mouse.stop,mouseStopHandler) + $document.off(events.mouse.out,mouseOutHandler) + }, + mouseOutHandler = function(e){ + if (e.originalEvent.traversing) { + e.stopPropagation() + + e.speedX = e.pageX - previousEvent.pageX + e.speedY = e.pageY - previousEvent.pageY + e.deltaX = e.deltaX + previousEvent.deltaX + e.deltaY = e.deltaY + previousEvent.deltaY + + target.trigger('dragend',[e,e.originalEvent.traversing]) + + previousEvent = e + + } + } + + + $this.on(events.mouse.start,mouseStartHandler) + + + // multi touch hanlder + window.targets = window.targets || {} + window.previousTouches = window.previousTouches || {} + window.touchActive = window.touchActive || false + + var self = this, + touchStartHandler = function(e){ + e.preventDefault() + + var oE = e.originalEvent + + for (i in oE.changedTouches) { + if (isNaN(i)) continue + + var touch = oE.changedTouches[i], + id = touch.identifier + + targets[id] = $(touch.target) + previousTouches[id] = touch + + touch.speedX = 0 + touch.speedY = 0 + + touch.deltaX = 0 + touch.deltaY = 0 + + var off = getOffset(touch.target) + touch.offsetX = touch.pageX-off.left + touch.offsetY = touch.pageY-off.top + + targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing]) + + } + + if (!touchActive) { + $document.on(events.touch.move,touchMoveHandler) + $document.on(events.touch.stop,touchStopHandler) + touchActive = true + } + + }, + touchMoveHandler = function(e){ + + var oE = e.originalEvent + + for (i in oE.changedTouches) { + if (isNaN(i)) continue + + + var touch = oE.changedTouches[i], + id = touch.identifier + + if (e.originalEvent.traversing) { + targets[id] = $(document.elementFromPoint(touch.clientX, touch.clientY)) + } + + // touched[targets[id]] = touched[targets[id]]?touched[targets[id]]+1:1 + + touch.speedX = touch.pageX - previousTouches[id].pageX + touch.speedY = touch.pageY - previousTouches[id].pageY + + touch.deltaX = touch.speedX + previousTouches[id].deltaX + touch.deltaY = touch.speedY + previousTouches[id].deltaY + + touch.offsetX = previousTouches[id].offsetX+touch.speedX + touch.offsetY = previousTouches[id].offsetY+touch.speedY + + if (e.originalEvent.traversing) { + touch.traversing = true + var previousTarget = document.elementFromPoint(previousTouches[id].clientX, previousTouches[id].clientY) + if (targets[id][0]!=previousTarget) { + var off = getOffset(targets[id][0]) + touch.offsetX = touch.pageX-off.left + touch.offsetY = touch.pageY-off.top + $(previousTarget).trigger('dragend',[touch,e.originalEvent.traversing]) + } + e.preventDefault() + if (oE.traversingContainer.contains(targets[id][0])) targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing]) + + } else { + + targets[id].triggerHandler('drag',[touch,e.originalEvent.traversing]) + + } + + previousTouches[id] = touch + + } + + }, + touchStopHandler = function(e){ + + var oE = e.originalEvent + + for (i in oE.changedTouches) { + + if (isNaN(i)) continue + + var touch = oE.changedTouches[i], + id = touch.identifier + + $(oE.changedTouches[i].target).trigger('dragend',[touch,e.originalEvent.traversing]) + + delete previousTouches[id] + delete targets[id] + + } + + if (oE.touches.length==0) { + $document.off(events.touch.move,touchMoveHandler) + $document.off(events.touch.stop,touchStopHandler) + touchActive = false + } + + } + + $this.on(events.touch.start,touchStartHandler) + + + } + + } + + + + + + + + + var makeEventTraversing = function(e){ + e.traversing=true + if (!e.traversingContainer) e.traversingContainer=this + } + + + $.fn.enableTraversingGestures = function() { + + var self = this[0] + + var down = function(e){ + makeEventTraversing(e) + self.addEventListener("mousemove", makeEventTraversing, true) + self.addEventListener("touchmove", makeEventTraversing, true) + self.addEventListener("mouseout", makeEventTraversing, true) + document.addEventListener("mouseup",up,true) + document.addEventListener("touchend",up,true) + }, + up = function(){ + self.removeEventListener("mousemove", makeEventTraversing, true) + self.removeEventListener("touchmove", makeEventTraversing, true) + self.removeEventListener("mouseout", makeEventTraversing, true) + document.removeEventListener("mouseup",up,true) + document.removeEventListener("touchend",up,true) + } + + self.addEventListener("mousedown", down, true) + self.addEventListener("touchstart", down, true) + + + this.on('disableTraversingGestures',function() { + self.removeEventListener("mousedown", down, true) + self.removeEventListener("touchstart", down, true) + }) + + + return this + + } + + + $document.on('mousedown',function(e){ + + if (e.originalEvent.sourceCapabilities && e.originalEvent.sourceCapabilities.firesTouchEvents) return + + $(e.target).trigger('fake-click') + + if (e.button==2) { + e.preventDefault() + $(e.target).trigger('fake-right-click',e) + } + + }) + + var touchTapTimer = false, + clearTouchTapTimer = function() { + clearTimeout(touchTapTimer) + touchTapTimer = false + } + + $document.on(events.touch.start,function(e){ + $(e.target).trigger('fake-click') + + if (!touchTapTimer&&e.originalEvent.touches.length==1) { + touchTapTimer = setTimeout(function(){ + if (touchTapTimer) { + var touch = e.originalEvent.changedTouches[0], + off = getOffset(touch.target) + + touch.offsetX = touch.pageX-off.left + touch.offsetY = touch.pageY-off.top + $(e.originalEvent.changedTouches[0].target).trigger('fake-right-click',touch) + } + touchTapTimer = false + },600) + } else { + clearTouchTapTimer() + } + }) + + $document.on(events.touch.stop + ' ' + events.touch.move,function(e){ + clearTouchTapTimer() + }) + + $document.on('contextmenu',function(){return false}) + +})(jQuery) + +},{}],35:[function(require,module,exports){ +;(function ($) { + $.fn.fakeInput = function(options) { + + var settings = $.extend({ + align:'left' + }, options ); + + var self= this, + canvas = $('').appendTo(self), + ctx = canvas[0].getContext('2d') + + self.value = undefined + self.height = undefined + self.width = undefined + self.color = undefined + self.center = settings.align == 'center' + + self.attr('tabindex',"0") + + canvas.resize(function(e,width,height){ + e.stopPropagation() + + var width = width*2, + height = height*2 + + if (height==100 && width==100) return + + self.color = getComputedStyle(document.documentElement).getPropertyValue("--color-text") + self.height=height + self.width=width + + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + + self.val(self.value) + }) + + self.val = function(newVal) { + if (newVal==undefined) return self.value + + self.value = newVal + + if (!self.height || !self.width || (self.height==100 && self.width==100)) return + + ctx.clearRect(0,0,self.width,self.height) + ctx.font = PXSCALE * 2 * 13 + 'px Droid Sans' + ctx.textBaseline = "top" + ctx.fillStyle = self.color + + if (self.center) { + ctx.textAlign = settings.align + ctx.fillText(newVal,self.width/2,0) + } else { + ctx.fillText(newVal,0,0) + } + + + } + + self.on('focus',function(){ + self.attr('tabindex','-1') + var i = $('') + .prependTo(self) + .val(self.value) + .focus() + .change(function(){ + self.val($(this).val()) + i.blur() + setTimeout(function(){self.focus()},1) + }) + i.blur(function(){ + self.attr('tabindex','0') + i.remove() + $(document).off('.fakeInput') + }) + $(document).on('touchstart.fakeInput mousedown.fakeInput',function(e){ + if (e.originalEvent.target!=i[0]) { + i.blur() + } + }) + + }) + + return self + + } +})(jQuery) + +},{}],36:[function(require,module,exports){ +/*! jQuery v3.0.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated | (c) jQuery Foundation | jquery.org/license */ +!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.0.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return a&&"[object Object]"===k.call(a)?(b=e(a))?(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n):!0:!1},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;d>f;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a)?(d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e):void 0},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"===c||r.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\x00-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\x00"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[0>c?c+b:c]}),even:pa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,e>i&&ya(a.slice(i,e)),f>e&&ya(a=a.slice(e)),f>e&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;d>b;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;d>b;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(f>b)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(1>=b&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){ +var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthf;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;g>f;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
            "],col:[2,"","
            "],tr:[2,"","
            "],td:[3,"","
            "],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;d>c;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;o>n;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;cc;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;m>l;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;i>l;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;e>d;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;e>d;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),0>=d||null==d){if(d=Ma(a,b,f),(0>d||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){return c?!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)}):void 0},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){return b?(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;e>g;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}}),r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var Xa,Ya=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?Xa:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),Xa={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=Ya[b]||r.find.attr;Ya[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=Ya[g],Ya[g]=e,e=null!=c(a,b,d)?g:null,Ya[g]=f),e}});var Za=/^(?:input|select|textarea|button)$/i,$a=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var _a=/[\t\r\n\f]/g;function ab(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,ab(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=ab(c),d=1===c.nodeType&&(" "+e+" ").replace(_a," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,ab(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=ab(c),d=1===c.nodeType&&(" "+e+" ").replace(_a," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,ab(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=ab(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+ab(c)+" ").replace(_a," ").indexOf(b)>-1)return!0;return!1}});var bb=/\r/g,cb=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(cb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){return r.isArray(b)?a.checked=r.inArray(r(a).val(),b)>-1:void 0}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var db=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!db.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,db.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?r.event.trigger(a,b,c,!0):void 0}}),r.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(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var eb=/\[\]$/,fb=/\r?\n/g,gb=/^(?:submit|button|image|reset|file)$/i,hb=/^(?:input|select|textarea|keygen)/i;function ib(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||eb.test(a)?d(a,e):ib(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)ib(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)ib(c,a[c],b,e); +return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&hb.test(this.nodeName)&&!gb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(fb,"\r\n")}}):{name:b.name,value:c.replace(fb,"\r\n")}}).get()}}),r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="
            ",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=oa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))};function jb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=jb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||pa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=jb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Na(o.pixelPosition,function(a,c){return c?(c=Ma(a,b),Ka.test(c)?r(a).position()[b]+"px":c):void 0})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var kb=a.jQuery,lb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=lb),b&&a.jQuery===r&&(a.jQuery=kb),r},b||(a.jQuery=a.$=r),r}); + +},{}],37:[function(require,module,exports){ +/* jquery.resize + * based on jQuery resize event (@ "Cowboy" Ben Alman http://benalman.com/projects/jquery-resize-plugin/) + * just lighter and faster +*/ +(function($){ + + var elems = [], + pollInterval = 250, + resizeTimeout + + $.event.special.resize = { + setup: function() { + + if (this===window) return false + + var elem = this + + // Add this element to the list of internal elements to monitor. + elems.push( elem ) + + // If this is the first element added, start the polling loop. + if ( elems.length === 1 ) { + resizePollingLoop() + } + }, + teardown: function() { + + if (this===window) return false + + var elem = this + + // Remove this element from the list of internal elements to monitor. + for (var i = elems.length - 1; i >= 0; i--) { + if(elems[i] == this){ + elems.splice(i, 1) + break + } + } + + if ( !elems.length ) { + clearTimeout(resizeTimeout) + } + + }, + add: function(handleObj) { + + if (this===window) return false + + // Save a reference to the bound event handler. + var old_handler = handleObj.handler + + handleObj.handler = function(event,data) { + // Call the originally-bound event handler and return its result. + return old_handler.apply(this, arguments) + } + } + } + + function checkResizes(){ + // Iterate over all elements to which the 'resize' event is bound. + for (var i = elems.length - 1; i >= 0; i--) { + var elem = elems[i], + width = elem.offsetWidth, + height = elem.offsetHeight + + if (!width) continue + + var data = { + w:elem.resizedataw, + h:elem.resizedatah + } + + // If element size has changed since the last time, update the element + // data store and trigger the 'resize' event. + if ( width != data.w || height != data.h ) { + elem.resizedataw = width + elem.resizedatah = height + $(elem).triggerHandler('resize',[width,height]) + } + + } + + // Loop. + resizePollingLoop() + } + + function resizePollingLoop() { + // yep, setTimeout, 'cuz requestAnimation doesn't seem to perform that well + resizeTimeout = window.setTimeout(checkResizes, pollInterval) + + } + + $(window).resize(checkResizes) + +})(jQuery) + +},{}],38:[function(require,module,exports){ +/*! jQuery UI - v1.12.0 - 2016-07-29 +* http://jqueryui.com +* Includes: widget.js, data.js, disable-selection.js, scroll-parent.js, widgets/draggable.js, widgets/resizable.js, widgets/sortable.js, widgets/mouse.js +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.0";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
            ",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var s=!1;t(document).on("mouseup",function(){s=!1}),t.widget("ui.mouse",{version:"1.12.0",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!s){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,n=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,s=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this._blurActiveElement(e),this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
            ").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);this._getHandle(e)&&s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
            ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show()) +}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
            "),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
            "),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.sortable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1 +}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}); + +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); + +},{}],39:[function(require,module,exports){ + +/** + * Module dependencies. + */ + +var url = require('./url'); +var parser = require('socket.io-parser'); +var Manager = require('./manager'); +var debug = require('debug')('socket.io-client'); + +/** + * Module exports. + */ + +module.exports = exports = lookup; + +/** + * Managers cache. + */ + +var cache = exports.managers = {}; + +/** + * Looks up an existing `Manager` for multiplexing. + * If the user summons: + * + * `io('http://localhost/a');` + * `io('http://localhost/b');` + * + * We reuse the existing instance based on same scheme/port/host, + * and we initialize sockets for each namespace. + * + * @api public + */ + +function lookup(uri, opts) { + if (typeof uri == 'object') { + opts = uri; + uri = undefined; + } + + opts = opts || {}; + + var parsed = url(uri); + var source = parsed.source; + var id = parsed.id; + var path = parsed.path; + var sameNamespace = cache[id] && path in cache[id].nsps; + var newConnection = opts.forceNew || opts['force new connection'] || + false === opts.multiplex || sameNamespace; + + var io; + + if (newConnection) { + debug('ignoring socket cache for %s', source); + io = Manager(source, opts); + } else { + if (!cache[id]) { + debug('new io instance for %s', source); + cache[id] = Manager(source, opts); + } + io = cache[id]; + } + + return io.socket(parsed.path); +} + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = parser.protocol; + +/** + * `connect`. + * + * @param {String} uri + * @api public + */ + +exports.connect = lookup; + +/** + * Expose constructors for standalone build. + * + * @api public + */ + +exports.Manager = require('./manager'); +exports.Socket = require('./socket'); + +},{"./manager":40,"./socket":42,"./url":43,"debug":47,"socket.io-parser":80}],40:[function(require,module,exports){ + +/** + * Module dependencies. + */ + +var eio = require('engine.io-client'); +var Socket = require('./socket'); +var Emitter = require('component-emitter'); +var parser = require('socket.io-parser'); +var on = require('./on'); +var bind = require('component-bind'); +var debug = require('debug')('socket.io-client:manager'); +var indexOf = require('indexof'); +var Backoff = require('backo2'); + +/** + * IE6+ hasOwnProperty + */ + +var has = Object.prototype.hasOwnProperty; + +/** + * Module exports + */ + +module.exports = Manager; + +/** + * `Manager` constructor. + * + * @param {String} engine instance or engine uri/opts + * @param {Object} options + * @api public + */ + +function Manager(uri, opts){ + if (!(this instanceof Manager)) return new Manager(uri, opts); + if (uri && ('object' == typeof uri)) { + opts = uri; + uri = undefined; + } + opts = opts || {}; + + opts.path = opts.path || '/socket.io'; + this.nsps = {}; + this.subs = []; + this.opts = opts; + this.reconnection(opts.reconnection !== false); + this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); + this.reconnectionDelay(opts.reconnectionDelay || 1000); + this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); + this.randomizationFactor(opts.randomizationFactor || 0.5); + this.backoff = new Backoff({ + min: this.reconnectionDelay(), + max: this.reconnectionDelayMax(), + jitter: this.randomizationFactor() + }); + this.timeout(null == opts.timeout ? 20000 : opts.timeout); + this.readyState = 'closed'; + this.uri = uri; + this.connecting = []; + this.lastPing = null; + this.encoding = false; + this.packetBuffer = []; + this.encoder = new parser.Encoder(); + this.decoder = new parser.Decoder(); + this.autoConnect = opts.autoConnect !== false; + if (this.autoConnect) this.open(); +} + +/** + * Propagate given event to sockets and emit on `this` + * + * @api private + */ + +Manager.prototype.emitAll = function() { + this.emit.apply(this, arguments); + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); + } + } +}; + +/** + * Update `socket.id` of all sockets + * + * @api private + */ + +Manager.prototype.updateSocketIds = function(){ + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].id = this.engine.id; + } + } +}; + +/** + * Mix in `Emitter`. + */ + +Emitter(Manager.prototype); + +/** + * Sets the `reconnection` config. + * + * @param {Boolean} true/false if it should automatically reconnect + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnection = function(v){ + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + return this; +}; + +/** + * Sets the reconnection attempts config. + * + * @param {Number} max reconnection attempts before giving up + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionAttempts = function(v){ + if (!arguments.length) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; +}; + +/** + * Sets the delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelay = function(v){ + if (!arguments.length) return this._reconnectionDelay; + this._reconnectionDelay = v; + this.backoff && this.backoff.setMin(v); + return this; +}; + +Manager.prototype.randomizationFactor = function(v){ + if (!arguments.length) return this._randomizationFactor; + this._randomizationFactor = v; + this.backoff && this.backoff.setJitter(v); + return this; +}; + +/** + * Sets the maximum delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelayMax = function(v){ + if (!arguments.length) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + this.backoff && this.backoff.setMax(v); + return this; +}; + +/** + * Sets the connection timeout. `false` to disable + * + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.timeout = function(v){ + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; +}; + +/** + * Starts trying to reconnect if reconnection is enabled and we have not + * started reconnecting yet + * + * @api private + */ + +Manager.prototype.maybeReconnectOnOpen = function() { + // Only try to reconnect if it's the first time we're connecting + if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) { + // keeps reconnection from firing twice for the same reconnection loop + this.reconnect(); + } +}; + + +/** + * Sets the current transport `socket`. + * + * @param {Function} optional, callback + * @return {Manager} self + * @api public + */ + +Manager.prototype.open = +Manager.prototype.connect = function(fn){ + debug('readyState %s', this.readyState); + if (~this.readyState.indexOf('open')) return this; + + debug('opening %s', this.uri); + this.engine = eio(this.uri, this.opts); + var socket = this.engine; + var self = this; + this.readyState = 'opening'; + this.skipReconnect = false; + + // emit `open` + var openSub = on(socket, 'open', function() { + self.onopen(); + fn && fn(); + }); + + // emit `connect_error` + var errorSub = on(socket, 'error', function(data){ + debug('connect_error'); + self.cleanup(); + self.readyState = 'closed'; + self.emitAll('connect_error', data); + if (fn) { + var err = new Error('Connection error'); + err.data = data; + fn(err); + } else { + // Only do this if there is no fn to handle the error + self.maybeReconnectOnOpen(); + } + }); + + // emit `connect_timeout` + if (false !== this._timeout) { + var timeout = this._timeout; + debug('connect attempt will timeout after %d', timeout); + + // set timer + var timer = setTimeout(function(){ + debug('connect attempt timed out after %d', timeout); + openSub.destroy(); + socket.close(); + socket.emit('error', 'timeout'); + self.emitAll('connect_timeout', timeout); + }, timeout); + + this.subs.push({ + destroy: function(){ + clearTimeout(timer); + } + }); + } + + this.subs.push(openSub); + this.subs.push(errorSub); + + return this; +}; + +/** + * Called upon transport open. + * + * @api private + */ + +Manager.prototype.onopen = function(){ + debug('open'); + + // clear old subs + this.cleanup(); + + // mark as open + this.readyState = 'open'; + this.emit('open'); + + // add new subs + var socket = this.engine; + this.subs.push(on(socket, 'data', bind(this, 'ondata'))); + this.subs.push(on(socket, 'ping', bind(this, 'onping'))); + this.subs.push(on(socket, 'pong', bind(this, 'onpong'))); + this.subs.push(on(socket, 'error', bind(this, 'onerror'))); + this.subs.push(on(socket, 'close', bind(this, 'onclose'))); + this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); +}; + +/** + * Called upon a ping. + * + * @api private + */ + +Manager.prototype.onping = function(){ + this.lastPing = new Date; + this.emitAll('ping'); +}; + +/** + * Called upon a packet. + * + * @api private + */ + +Manager.prototype.onpong = function(){ + this.emitAll('pong', new Date - this.lastPing); +}; + +/** + * Called with data. + * + * @api private + */ + +Manager.prototype.ondata = function(data){ + this.decoder.add(data); +}; + +/** + * Called when parser fully decodes a packet. + * + * @api private + */ + +Manager.prototype.ondecoded = function(packet) { + this.emit('packet', packet); +}; + +/** + * Called upon socket error. + * + * @api private + */ + +Manager.prototype.onerror = function(err){ + debug('error', err); + this.emitAll('error', err); +}; + +/** + * Creates a new socket for the given `nsp`. + * + * @return {Socket} + * @api public + */ + +Manager.prototype.socket = function(nsp){ + var socket = this.nsps[nsp]; + if (!socket) { + socket = new Socket(this, nsp); + this.nsps[nsp] = socket; + var self = this; + socket.on('connecting', onConnecting); + socket.on('connect', function(){ + socket.id = self.engine.id; + }); + + if (this.autoConnect) { + // manually call here since connecting evnet is fired before listening + onConnecting(); + } + } + + function onConnecting() { + if (!~indexOf(self.connecting, socket)) { + self.connecting.push(socket); + } + } + + return socket; +}; + +/** + * Called upon a socket close. + * + * @param {Socket} socket + */ + +Manager.prototype.destroy = function(socket){ + var index = indexOf(this.connecting, socket); + if (~index) this.connecting.splice(index, 1); + if (this.connecting.length) return; + + this.close(); +}; + +/** + * Writes a packet. + * + * @param {Object} packet + * @api private + */ + +Manager.prototype.packet = function(packet){ + debug('writing packet %j', packet); + var self = this; + + if (!self.encoding) { + // encode, then write to engine with result + self.encoding = true; + this.encoder.encode(packet, function(encodedPackets) { + for (var i = 0; i < encodedPackets.length; i++) { + self.engine.write(encodedPackets[i], packet.options); + } + self.encoding = false; + self.processPacketQueue(); + }); + } else { // add packet to the queue + self.packetBuffer.push(packet); + } +}; + +/** + * If packet buffer is non-empty, begins encoding the + * next packet in line. + * + * @api private + */ + +Manager.prototype.processPacketQueue = function() { + if (this.packetBuffer.length > 0 && !this.encoding) { + var pack = this.packetBuffer.shift(); + this.packet(pack); + } +}; + +/** + * Clean up transport subscriptions and packet buffer. + * + * @api private + */ + +Manager.prototype.cleanup = function(){ + debug('cleanup'); + + var sub; + while (sub = this.subs.shift()) sub.destroy(); + + this.packetBuffer = []; + this.encoding = false; + this.lastPing = null; + + this.decoder.destroy(); +}; + +/** + * Close the current socket. + * + * @api private + */ + +Manager.prototype.close = +Manager.prototype.disconnect = function(){ + debug('disconnect'); + this.skipReconnect = true; + this.reconnecting = false; + if ('opening' == this.readyState) { + // `onclose` will not fire because + // an open event never happened + this.cleanup(); + } + this.backoff.reset(); + this.readyState = 'closed'; + if (this.engine) this.engine.close(); +}; + +/** + * Called upon engine close. + * + * @api private + */ + +Manager.prototype.onclose = function(reason){ + debug('onclose'); + + this.cleanup(); + this.backoff.reset(); + this.readyState = 'closed'; + this.emit('close', reason); + + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); + } +}; + +/** + * Attempt a reconnection. + * + * @api private + */ + +Manager.prototype.reconnect = function(){ + if (this.reconnecting || this.skipReconnect) return this; + + var self = this; + + if (this.backoff.attempts >= this._reconnectionAttempts) { + debug('reconnect failed'); + this.backoff.reset(); + this.emitAll('reconnect_failed'); + this.reconnecting = false; + } else { + var delay = this.backoff.duration(); + debug('will wait %dms before reconnect attempt', delay); + + this.reconnecting = true; + var timer = setTimeout(function(){ + if (self.skipReconnect) return; + + debug('attempting reconnect'); + self.emitAll('reconnect_attempt', self.backoff.attempts); + self.emitAll('reconnecting', self.backoff.attempts); + + // check again for the case socket closed in above events + if (self.skipReconnect) return; + + self.open(function(err){ + if (err) { + debug('reconnect attempt error'); + self.reconnecting = false; + self.reconnect(); + self.emitAll('reconnect_error', err.data); + } else { + debug('reconnect success'); + self.onreconnect(); + } + }); + }, delay); + + this.subs.push({ + destroy: function(){ + clearTimeout(timer); + } + }); + } +}; + +/** + * Called upon successful reconnect. + * + * @api private + */ + +Manager.prototype.onreconnect = function(){ + var attempt = this.backoff.attempts; + this.reconnecting = false; + this.backoff.reset(); + this.updateSocketIds(); + this.emitAll('reconnect', attempt); +}; + +},{"./on":41,"./socket":42,"backo2":44,"component-bind":45,"component-emitter":46,"debug":47,"engine.io-client":50,"indexof":77,"socket.io-parser":80}],41:[function(require,module,exports){ + +/** + * Module exports. + */ + +module.exports = on; + +/** + * Helper for subscriptions. + * + * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` + * @param {String} event name + * @param {Function} callback + * @api public + */ + +function on(obj, ev, fn) { + obj.on(ev, fn); + return { + destroy: function(){ + obj.removeListener(ev, fn); + } + }; +} + +},{}],42:[function(require,module,exports){ + +/** + * Module dependencies. + */ + +var parser = require('socket.io-parser'); +var Emitter = require('component-emitter'); +var toArray = require('to-array'); +var on = require('./on'); +var bind = require('component-bind'); +var debug = require('debug')('socket.io-client:socket'); +var hasBin = require('has-binary'); + +/** + * Module exports. + */ + +module.exports = exports = Socket; + +/** + * Internal events (blacklisted). + * These events can't be emitted by the user. + * + * @api private + */ + +var events = { + connect: 1, + connect_error: 1, + connect_timeout: 1, + connecting: 1, + disconnect: 1, + error: 1, + reconnect: 1, + reconnect_attempt: 1, + reconnect_failed: 1, + reconnect_error: 1, + reconnecting: 1, + ping: 1, + pong: 1 +}; + +/** + * Shortcut to `Emitter#emit`. + */ + +var emit = Emitter.prototype.emit; + +/** + * `Socket` constructor. + * + * @api public + */ + +function Socket(io, nsp){ + this.io = io; + this.nsp = nsp; + this.json = this; // compat + this.ids = 0; + this.acks = {}; + this.receiveBuffer = []; + this.sendBuffer = []; + this.connected = false; + this.disconnected = true; + if (this.io.autoConnect) this.open(); +} + +/** + * Mix in `Emitter`. + */ + +Emitter(Socket.prototype); + +/** + * Subscribe to open, close and packet events + * + * @api private + */ + +Socket.prototype.subEvents = function() { + if (this.subs) return; + + var io = this.io; + this.subs = [ + on(io, 'open', bind(this, 'onopen')), + on(io, 'packet', bind(this, 'onpacket')), + on(io, 'close', bind(this, 'onclose')) + ]; +}; + +/** + * "Opens" the socket. + * + * @api public + */ + +Socket.prototype.open = +Socket.prototype.connect = function(){ + if (this.connected) return this; + + this.subEvents(); + this.io.open(); // ensure open + if ('open' == this.io.readyState) this.onopen(); + this.emit('connecting'); + return this; +}; + +/** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.send = function(){ + var args = toArray(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Override `emit`. + * If the event is in `events`, it's emitted normally. + * + * @param {String} event name + * @return {Socket} self + * @api public + */ + +Socket.prototype.emit = function(ev){ + if (events.hasOwnProperty(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = toArray(arguments); + var parserType = parser.EVENT; // default + if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary + var packet = { type: parserType, data: args }; + + packet.options = {}; + packet.options.compress = !this.flags || false !== this.flags.compress; + + // event ack callback + if ('function' == typeof args[args.length - 1]) { + debug('emitting packet with ack id %d', this.ids); + this.acks[this.ids] = args.pop(); + packet.id = this.ids++; + } + + if (this.connected) { + this.packet(packet); + } else { + this.sendBuffer.push(packet); + } + + delete this.flags; + + return this; +}; + +/** + * Sends a packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.packet = function(packet){ + packet.nsp = this.nsp; + this.io.packet(packet); +}; + +/** + * Called upon engine `open`. + * + * @api private + */ + +Socket.prototype.onopen = function(){ + debug('transport is open - connecting'); + + // write connect packet if necessary + if ('/' != this.nsp) { + this.packet({ type: parser.CONNECT }); + } +}; + +/** + * Called upon engine `close`. + * + * @param {String} reason + * @api private + */ + +Socket.prototype.onclose = function(reason){ + debug('close (%s)', reason); + this.connected = false; + this.disconnected = true; + delete this.id; + this.emit('disconnect', reason); +}; + +/** + * Called with socket packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onpacket = function(packet){ + if (packet.nsp != this.nsp) return; + + switch (packet.type) { + case parser.CONNECT: + this.onconnect(); + break; + + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + break; + } +}; + +/** + * Called upon a server event. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onevent = function(packet){ + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + if (this.connected) { + emit.apply(this, args); + } else { + this.receiveBuffer.push(args); + } +}; + +/** + * Produces an ack callback to emit with an event. + * + * @api private + */ + +Socket.prototype.ack = function(id){ + var self = this; + var sent = false; + return function(){ + // prevent double callbacks + if (sent) return; + sent = true; + var args = toArray(arguments); + debug('sending ack %j', args); + + var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; + self.packet({ + type: type, + id: id, + data: args + }); + }; +}; + +/** + * Called upon a server acknowlegement. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onack = function(packet){ + var ack = this.acks[packet.id]; + if ('function' == typeof ack) { + debug('calling ack %s with %j', packet.id, packet.data); + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else { + debug('bad ack %s', packet.id); + } +}; + +/** + * Called upon server connect. + * + * @api private + */ + +Socket.prototype.onconnect = function(){ + this.connected = true; + this.disconnected = false; + this.emit('connect'); + this.emitBuffered(); +}; + +/** + * Emit buffered events (received and emitted). + * + * @api private + */ + +Socket.prototype.emitBuffered = function(){ + var i; + for (i = 0; i < this.receiveBuffer.length; i++) { + emit.apply(this, this.receiveBuffer[i]); + } + this.receiveBuffer = []; + + for (i = 0; i < this.sendBuffer.length; i++) { + this.packet(this.sendBuffer[i]); + } + this.sendBuffer = []; +}; + +/** + * Called upon server disconnect. + * + * @api private + */ + +Socket.prototype.ondisconnect = function(){ + debug('server disconnect (%s)', this.nsp); + this.destroy(); + this.onclose('io server disconnect'); +}; + +/** + * Called upon forced client/server side disconnections, + * this method ensures the manager stops tracking us and + * that reconnections don't get triggered for this. + * + * @api private. + */ + +Socket.prototype.destroy = function(){ + if (this.subs) { + // clean subscriptions to avoid reconnections + for (var i = 0; i < this.subs.length; i++) { + this.subs[i].destroy(); + } + this.subs = null; + } + + this.io.destroy(this); +}; + +/** + * Disconnects the socket manually. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.close = +Socket.prototype.disconnect = function(){ + if (this.connected) { + debug('performing disconnect (%s)', this.nsp); + this.packet({ type: parser.DISCONNECT }); + } + + // remove socket from pool + this.destroy(); + + if (this.connected) { + // fire events + this.onclose('io client disconnect'); + } + return this; +}; + +/** + * Sets the compress flag. + * + * @param {Boolean} if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + +Socket.prototype.compress = function(compress){ + this.flags = this.flags || {}; + this.flags.compress = compress; + return this; +}; + +},{"./on":41,"component-bind":45,"component-emitter":46,"debug":47,"has-binary":75,"socket.io-parser":80,"to-array":85}],43:[function(require,module,exports){ +(function (global){ + +/** + * Module dependencies. + */ + +var parseuri = require('parseuri'); +var debug = require('debug')('socket.io-client:url'); + +/** + * Module exports. + */ + +module.exports = url; + +/** + * URL parser. + * + * @param {String} url + * @param {Object} An object meant to mimic window.location. + * Defaults to window.location. + * @api public + */ + +function url(uri, loc){ + var obj = uri; + + // default to window.location + var loc = loc || global.location; + if (null == uri) uri = loc.protocol + '//' + loc.host; + + // relative path support + if ('string' == typeof uri) { + if ('/' == uri.charAt(0)) { + if ('/' == uri.charAt(1)) { + uri = loc.protocol + uri; + } else { + uri = loc.host + uri; + } + } + + if (!/^(https?|wss?):\/\//.test(uri)) { + debug('protocol-less url %s', uri); + if ('undefined' != typeof loc) { + uri = loc.protocol + '//' + uri; + } else { + uri = 'https://' + uri; + } + } + + // parse + debug('parse %s', uri); + obj = parseuri(uri); + } + + // make sure we treat `localhost:80` and `localhost` equally + if (!obj.port) { + if (/^(http|ws)$/.test(obj.protocol)) { + obj.port = '80'; + } + else if (/^(http|ws)s$/.test(obj.protocol)) { + obj.port = '443'; + } + } + + obj.path = obj.path || '/'; + + var ipv6 = obj.host.indexOf(':') !== -1; + var host = ipv6 ? '[' + obj.host + ']' : obj.host; + + // define unique id + obj.id = obj.protocol + '://' + host + ':' + obj.port; + // define href + obj.href = obj.protocol + '://' + host + (loc && loc.port == obj.port ? '' : (':' + obj.port)); + + return obj; +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"debug":47,"parseuri":78}],44:[function(require,module,exports){ + +/** + * Expose `Backoff`. + */ + +module.exports = Backoff; + +/** + * Initialize backoff timer with `opts`. + * + * - `min` initial timeout in milliseconds [100] + * - `max` max timeout [10000] + * - `jitter` [0] + * - `factor` [2] + * + * @param {Object} opts + * @api public + */ + +function Backoff(opts) { + opts = opts || {}; + this.ms = opts.min || 100; + this.max = opts.max || 10000; + this.factor = opts.factor || 2; + this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; + this.attempts = 0; +} + +/** + * Return the backoff duration. + * + * @return {Number} + * @api public + */ + +Backoff.prototype.duration = function(){ + var ms = this.ms * Math.pow(this.factor, this.attempts++); + if (this.jitter) { + var rand = Math.random(); + var deviation = Math.floor(rand * this.jitter * ms); + ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; + } + return Math.min(ms, this.max) | 0; +}; + +/** + * Reset the number of attempts. + * + * @api public + */ + +Backoff.prototype.reset = function(){ + this.attempts = 0; +}; + +/** + * Set the minimum duration + * + * @api public + */ + +Backoff.prototype.setMin = function(min){ + this.ms = min; +}; + +/** + * Set the maximum duration + * + * @api public + */ + +Backoff.prototype.setMax = function(max){ + this.max = max; +}; + +/** + * Set the jitter + * + * @api public + */ + +Backoff.prototype.setJitter = function(jitter){ + this.jitter = jitter; +}; + + +},{}],45:[function(require,module,exports){ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; + +},{}],46:[function(require,module,exports){ + +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; + +},{}],47:[function(require,module,exports){ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} + +},{"./debug":48}],48:[function(require,module,exports){ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + +},{"ms":49}],49:[function(require,module,exports){ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} + +},{}],50:[function(require,module,exports){ + +module.exports = require('./lib/'); + +},{"./lib/":51}],51:[function(require,module,exports){ + +module.exports = require('./socket'); + +/** + * Exports parser + * + * @api public + * + */ +module.exports.parser = require('engine.io-parser'); + +},{"./socket":52,"engine.io-parser":62}],52:[function(require,module,exports){ +(function (global){ +/** + * Module dependencies. + */ + +var transports = require('./transports'); +var Emitter = require('component-emitter'); +var debug = require('debug')('engine.io-client:socket'); +var index = require('indexof'); +var parser = require('engine.io-parser'); +var parseuri = require('parseuri'); +var parsejson = require('parsejson'); +var parseqs = require('parseqs'); + +/** + * Module exports. + */ + +module.exports = Socket; + +/** + * Noop function. + * + * @api private + */ + +function noop(){} + +/** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + +function Socket(uri, opts){ + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' == typeof uri) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol == 'https' || uri.protocol == 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure : + (global.location && 'https:' == location.protocol); + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || + (global.location ? location.hostname : 'localhost'); + this.port = opts.port || (global.location && location.port ? + location.port : + (this.secure ? 443 : 80)); + this.query = opts.query || {}; + if ('string' == typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.readyState = ''; + this.writeBuffer = []; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + + // other options for Node.js client + var freeGlobal = typeof global == 'object' && global; + if (freeGlobal.global === freeGlobal) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + } + + this.open(); +} + +Socket.priorWebsocketSuccess = false; + +/** + * Mix in `Emitter`. + */ + +Emitter(Socket.prototype); + +/** + * Protocol version. + * + * @api public + */ + +Socket.protocol = parser.protocol; // this is an int + +/** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + +Socket.Socket = Socket; +Socket.Transport = require('./transport'); +Socket.transports = require('./transports'); +Socket.parser = require('engine.io-parser'); + +/** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + +Socket.prototype.createTransport = function (name) { + debug('creating transport "%s"', name); + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + agent: this.agent, + hostname: this.hostname, + port: this.port, + secure: this.secure, + path: this.path, + query: query, + forceJSONP: this.forceJSONP, + jsonp: this.jsonp, + forceBase64: this.forceBase64, + enablesXDR: this.enablesXDR, + timestampRequests: this.timestampRequests, + timestampParam: this.timestampParam, + policyPort: this.policyPort, + socket: this, + pfx: this.pfx, + key: this.key, + passphrase: this.passphrase, + cert: this.cert, + ca: this.ca, + ciphers: this.ciphers, + rejectUnauthorized: this.rejectUnauthorized, + perMessageDeflate: this.perMessageDeflate, + extraHeaders: this.extraHeaders + }); + + return transport; +}; + +function clone (obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; +} + +/** + * Initializes transport to use and starts probe. + * + * @api private + */ +Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') != -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function() { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); +}; + +/** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + +Socket.prototype.setTransport = function(transport){ + debug('setting transport %s', transport.name); + var self = this; + + if (this.transport) { + debug('clearing existing transport %s', this.transport.name); + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport + .on('drain', function(){ + self.onDrain(); + }) + .on('packet', function(packet){ + self.onPacket(packet); + }) + .on('error', function(e){ + self.onError(e); + }) + .on('close', function(){ + self.onClose('transport close'); + }); +}; + +/** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + +Socket.prototype.probe = function (name) { + debug('probing transport "%s"', name); + var transport = this.createTransport(name, { probe: 1 }) + , failed = false + , self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen(){ + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + debug('probe transport "%s" opened', name); + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' == msg.type && 'probe' == msg.data) { + debug('probe transport "%s" pong', name); + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' == transport.name; + + debug('pausing current transport "%s"', self.transport.name); + self.transport.pause(function () { + if (failed) return; + if ('closed' == self.readyState) return; + debug('changing transport and sending upgrade packet'); + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + debug('probe transport "%s" failed', name); + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport() { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + //Handle any error that happens while probing + function onerror(err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + debug('probe transport "%s" failed because of error: %s', name, err); + + self.emit('upgradeError', error); + } + + function onTransportClose(){ + onerror("transport closed"); + } + + //When the socket is closed while we're probing + function onclose(){ + onerror("socket closed"); + } + + //When the socket is upgraded while we're probing + function onupgrade(to){ + if (transport && to.name != transport.name) { + debug('"%s" works - aborting "%s"', to.name, transport.name); + freezeTransport(); + } + } + + //Remove all listeners on the transport and on self + function cleanup(){ + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); + +}; + +/** + * Called when connection is deemed open. + * + * @api public + */ + +Socket.prototype.onOpen = function () { + debug('socket open'); + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' == this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' == this.readyState && this.upgrade && this.transport.pause) { + debug('starting upgrade probes'); + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } +}; + +/** + * Handles a packet. + * + * @api private + */ + +Socket.prototype.onPacket = function (packet) { + if ('opening' == this.readyState || 'open' == this.readyState) { + debug('socket receive: type "%s", data "%s"', packet.type, packet.data); + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(parsejson(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with socket readyState "%s"', this.readyState); + } +}; + +/** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + +Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' == this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); +}; + +/** + * Resets ping timeout. + * + * @api private + */ + +Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' == self.readyState) return; + self.onClose('ping timeout'); + }, timeout || (self.pingInterval + self.pingTimeout)); +}; + +/** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + +Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + debug('writing ping packet - expecting pong within %sms', self.pingTimeout); + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); +}; + +/** +* Sends a ping packet. +* +* @api private +*/ + +Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function(){ + self.emit('ping'); + }); +}; + +/** + * Called on `drain` event + * + * @api private + */ + +Socket.prototype.onDrain = function() { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } +}; + +/** + * Flush write buffers. + * + * @api private + */ + +Socket.prototype.flush = function () { + if ('closed' != this.readyState && this.transport.writable && + !this.upgrading && this.writeBuffer.length) { + debug('flushing %d packets in socket', this.writeBuffer.length); + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } +}; + +/** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + +Socket.prototype.write = +Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; +}; + +/** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + +Socket.prototype.sendPacket = function (type, data, options, fn) { + if('function' == typeof data) { + fn = data; + data = undefined; + } + + if ('function' == typeof options) { + fn = options; + options = null; + } + + if ('closing' == this.readyState || 'closed' == this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); +}; + +/** + * Closes the connection. + * + * @api private + */ + +Socket.prototype.close = function () { + if ('opening' == this.readyState || 'open' == this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function() { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close() { + self.onClose('forced close'); + debug('socket closing - telling transport to close'); + self.transport.close(); + } + + function cleanupAndClose() { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade() { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; +}; + +/** + * Called upon transport error + * + * @api private + */ + +Socket.prototype.onError = function (err) { + debug('socket error %j', err); + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); +}; + +/** + * Called upon transport close. + * + * @api private + */ + +Socket.prototype.onClose = function (reason, desc) { + if ('opening' == this.readyState || 'open' == this.readyState || 'closing' == this.readyState) { + debug('socket close with reason: "%s"', reason); + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } +}; + +/** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + +Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i