(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Mosaico = f()}})(function(){var define,module,exports;return (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
\x3c!-- ko if: typeof $index != \'undefined\' --\x3e
\x3c!-- ko if: $index() > 0 --\x3e
\x3c!-- /ko --\x3e \x3c!-- ko if: $index() < $parent.blocks().length -1 --\x3e
\x3c!-- /ko --\x3e
\x3c!-- /ko --\x3e \x3c!-- ko if: typeof $data._nextVariant != \'undefined\' --\x3e
\x3c!-- /ko --\x3e
\x3c!-- ko block: $data --\x3e\x3c!-- /ko --\x3e'),templateSystem.addTemplate("blocks-show","\x3c!-- ko template: { name: 'block-show', foreach: blocks } --\x3e\x3c!-- /ko --\x3e"),templateSystem.addTemplate("blocks-wysiwyg","
"),templateSystem.addTemplate("customstyle",'
Customized block.
'),templateSystem.addTemplate("empty",""),templateSystem.addTemplate("error",'[
]'),templateSystem.addTemplate("gallery-images",'
\x3c!-- ko if: items.pageCount() > 1 --\x3e
First Previous X di Y Next Last
\x3c!-- /ko --\x3e'),templateSystem.addTemplate("img-wysiwyg",'
size
\x3c!-- ko if: _src() != \'\' --\x3e
\x3c!-- ko if: typeof $root.editImage !== \'undefined\' --\x3e
\x3c!-- /ko --\x3e \x3c!-- /ko --\x3e \x3c!-- ko if: _src() == \'\' --\x3e
\x3c!-- /ko --\x3e
\x3c!-- ko template: _template --\x3e\x3c!-- /ko --\x3e \x3c!-- ko if: _src() == \'\' --\x3e \x3c!-- Insert an image here --\x3e Drop an image here \x3c!-- /ko --\x3e \x3c!-- ko if: _src() != \'\' --\x3e \x3c!-- --\x3e \x3c!-- /ko --\x3e \x3c!-- pulsante per la cancellazione --\x3e
\x3c!-- ko if: _src.preloaded && _src() != _src.preloaded() --\x3ePRELOADING....\x3c!-- /ko --\x3e \x3c!-- ko if: _src() != \'\' --\x3e \x3c!-- /ko --\x3e
'),templateSystem.addTemplate("main",'\x3c!-- ko if: $root.logoPath --\x3e
mosaico
Oppps... !!
\x3c!-- /ko --\x3e'),templateSystem.addTemplate("toolbox",'
Block __name__
Add
\x3c!-- ko if: $root.selectedBlock() !== null --\x3e
\x3c!-- /ko --\x3e \x3c!-- ko if: $root.selectedBlock() == null --\x3e
By clicking on message parts you will select a block and content options, if any, will show here
\x3c!-- /ko --\x3e \x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e
\x3c!-- ko if: typeof $root.content().theme === \'undefined\' || typeof $root.content().theme().scheme === \'undefined\' || $root.content().theme().scheme() === \'custom\' --\x3e \x3c!-- ko if: $root.selectedBlock() !== null --\x3e
\x3c!-- /ko --\x3e \x3c!-- ko if: $root.selectedBlock() == null --\x3e
By clicking on message parts you will select a block and style options, if available, will show here
\x3c!-- /ko --\x3e
\x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e
\x3c!-- /ko --\x3e
X
Gallery:
Click or drag files here
\x3c!-- ko if: $root.showGallery() --\x3e
\x3c!-- ko if: galleryRecent().length == 0 --\x3e
No images uploaded, yet
\x3c!-- /ko --\x3e \x3c!-- ko template: {name: \'gallery-images\', data: { items: galleryRecent } } --\x3e# recent gallery #\x3c!-- /ko --\x3e
\x3c!-- ko if: $root.galleryLoaded() === false --\x3e# load gally #\x3c!-- /ko --\x3e \x3c!-- ko if: $root.galleryLoaded() === \'loading\' --\x3e
Loading gallery...
\x3c!-- /ko --\x3e \x3c!-- ko if: $root.galleryLoaded() === 0 --\x3e
The gallery is empty
\x3c!-- /ko --\x3e \x3c!-- ko template: {name: \'gallery-images\', data: { items: galleryRemote } } --\x3e# remote gallery #\x3c!-- /ko --\x3e
\x3c!-- /ko --\x3e
X
\x3c!-- ko if: $root.debug --\x3e Content:
  BlockDefs:  
  \x3c!-- /ko --\x3e  Output  Export  Import  
X
\x3c!-- ko withProperties: { templateMode: \'styler\' } --\x3e \x3c!-- ko if: $root.showTheme --\x3e \x3c!-- ko block: $root.content().theme --\x3e\x3c!-- /ko --\x3e \x3c!-- /ko --\x3e \x3c!-- /ko --\x3e
')}); },{"../src/js/bindings/choose-template.js":28}],2:[function(require,module,exports){ (function (global){ 'use strict'; // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ function compare(a, b) { if (a === b) { return 0; } var x = a.length; var y = b.length; for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i]; y = b[i]; break; } } if (x < y) { return -1; } if (y < x) { return 1; } return 0; } function isBuffer(b) { if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { return global.Buffer.isBuffer(b); } return !!(b != null && b._isBuffer); } // based on node assert, original notice: // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 // // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! // // Originally from narwhal.js (http://narwhaljs.org) // Copyright (c) 2009 Thomas Robinson <280north.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the 'Software'), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. var util = require('util/'); var hasOwn = Object.prototype.hasOwnProperty; var pSlice = Array.prototype.slice; var functionsHaveNames = (function () { return function foo() {}.name === 'foo'; }()); function pToString (obj) { return Object.prototype.toString.call(obj); } function isView(arrbuf) { if (isBuffer(arrbuf)) { return false; } if (typeof global.ArrayBuffer !== 'function') { return false; } if (typeof ArrayBuffer.isView === 'function') { return ArrayBuffer.isView(arrbuf); } if (!arrbuf) { return false; } if (arrbuf instanceof DataView) { return true; } if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { return true; } return false; } // 1. The assert module provides functions that throw // AssertionError's when particular conditions are not met. The // assert module must conform to the following interface. var assert = module.exports = ok; // 2. The AssertionError is defined in assert. // new assert.AssertionError({ message: message, // actual: actual, // expected: expected }) var regex = /\s*function\s+([^\(\s]*)\s*/; // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js function getName(func) { if (!util.isFunction(func)) { return; } if (functionsHaveNames) { return func.name; } var str = func.toString(); var match = str.match(regex); return match && match[1]; } assert.AssertionError = function AssertionError(options) { this.name = 'AssertionError'; this.actual = options.actual; this.expected = options.expected; this.operator = options.operator; if (options.message) { this.message = options.message; this.generatedMessage = false; } else { this.message = getMessage(this); this.generatedMessage = true; } var stackStartFunction = options.stackStartFunction || fail; if (Error.captureStackTrace) { Error.captureStackTrace(this, stackStartFunction); } else { // non v8 browsers so we can have a stacktrace var err = new Error(); if (err.stack) { var out = err.stack; // try to strip useless frames var fn_name = getName(stackStartFunction); var idx = out.indexOf('\n' + fn_name); if (idx >= 0) { // once we have located the function frame // we need to strip out everything before it (and its line) var next_line = out.indexOf('\n', idx + 1); out = out.substring(next_line + 1); } this.stack = out; } } }; // assert.AssertionError instanceof Error util.inherits(assert.AssertionError, Error); function truncate(s, n) { if (typeof s === 'string') { return s.length < n ? s : s.slice(0, n); } else { return s; } } function inspect(something) { if (functionsHaveNames || !util.isFunction(something)) { return util.inspect(something); } var rawname = getName(something); var name = rawname ? ': ' + rawname : ''; return '[Function' + name + ']'; } function getMessage(self) { return truncate(inspect(self.actual), 128) + ' ' + self.operator + ' ' + truncate(inspect(self.expected), 128); } // At present only the three keys mentioned above are used and // understood by the spec. Implementations or sub modules can pass // other keys to the AssertionError's constructor - they will be // ignored. // 3. All of the following functions must throw an AssertionError // when a corresponding condition is not met, with a message that // may be undefined if not provided. All assertion methods provide // both the actual and expected values to the assertion error for // display purposes. function fail(actual, expected, message, operator, stackStartFunction) { throw new assert.AssertionError({ message: message, actual: actual, expected: expected, operator: operator, stackStartFunction: stackStartFunction }); } // EXTENSION! allows for well behaved errors defined elsewhere. assert.fail = fail; // 4. Pure assertion tests whether a value is truthy, as determined // by !!guard. // assert.ok(guard, message_opt); // This statement is equivalent to assert.equal(true, !!guard, // message_opt);. To test strictly for the value true, use // assert.strictEqual(true, guard, message_opt);. function ok(value, message) { if (!value) fail(value, true, message, '==', assert.ok); } assert.ok = ok; // 5. The equality assertion tests shallow, coercive equality with // ==. // assert.equal(actual, expected, message_opt); assert.equal = function equal(actual, expected, message) { if (actual != expected) fail(actual, expected, message, '==', assert.equal); }; // 6. The non-equality assertion tests for whether two objects are not equal // with != assert.notEqual(actual, expected, message_opt); assert.notEqual = function notEqual(actual, expected, message) { if (actual == expected) { fail(actual, expected, message, '!=', assert.notEqual); } }; // 7. The equivalence assertion tests a deep equality relation. // assert.deepEqual(actual, expected, message_opt); assert.deepEqual = function deepEqual(actual, expected, message) { if (!_deepEqual(actual, expected, false)) { fail(actual, expected, message, 'deepEqual', assert.deepEqual); } }; assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { if (!_deepEqual(actual, expected, true)) { fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); } }; function _deepEqual(actual, expected, strict, memos) { // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (isBuffer(actual) && isBuffer(expected)) { return compare(actual, expected) === 0; // 7.2. If the expected value is a Date object, the actual value is // equivalent if it is also a Date object that refers to the same time. } else if (util.isDate(actual) && util.isDate(expected)) { return actual.getTime() === expected.getTime(); // 7.3 If the expected value is a RegExp object, the actual value is // equivalent if it is also a RegExp object with the same source and // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). } else if (util.isRegExp(actual) && util.isRegExp(expected)) { return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase; // 7.4. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if ((actual === null || typeof actual !== 'object') && (expected === null || typeof expected !== 'object')) { return strict ? actual === expected : actual == expected; // If both values are instances of typed arrays, wrap their underlying // ArrayBuffers in a Buffer each to increase performance // This optimization requires the arrays to have the same type as checked by // Object.prototype.toString (aka pToString). Never perform binary // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their // bit patterns are not identical. } else if (isView(actual) && isView(expected) && pToString(actual) === pToString(expected) && !(actual instanceof Float32Array || actual instanceof Float64Array)) { return compare(new Uint8Array(actual.buffer), new Uint8Array(expected.buffer)) === 0; // 7.5 For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else if (isBuffer(actual) !== isBuffer(expected)) { return false; } else { memos = memos || {actual: [], expected: []}; var actualIndex = memos.actual.indexOf(actual); if (actualIndex !== -1) { if (actualIndex === memos.expected.indexOf(expected)) { return true; } } memos.actual.push(actual); memos.expected.push(expected); return objEquiv(actual, expected, strict, memos); } } function isArguments(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; } function objEquiv(a, b, strict, actualVisitedObjects) { if (a === null || a === undefined || b === null || b === undefined) return false; // if one is a primitive, the other must be same if (util.isPrimitive(a) || util.isPrimitive(b)) return a === b; if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false; var aIsArgs = isArguments(a); var bIsArgs = isArguments(b); if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false; if (aIsArgs) { a = pSlice.call(a); b = pSlice.call(b); return _deepEqual(a, b, strict); } var ka = objectKeys(a); var kb = objectKeys(b); var key, i; // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length !== kb.length) return false; //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] !== kb[i]) return false; } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) return false; } return true; } // 8. The non-equivalence assertion tests for any deep inequality. // assert.notDeepEqual(actual, expected, message_opt); assert.notDeepEqual = function notDeepEqual(actual, expected, message) { if (_deepEqual(actual, expected, false)) { fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); } }; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) { if (_deepEqual(actual, expected, true)) { fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); } } // 9. The strict equality assertion tests strict equality, as determined by ===. // assert.strictEqual(actual, expected, message_opt); assert.strictEqual = function strictEqual(actual, expected, message) { if (actual !== expected) { fail(actual, expected, message, '===', assert.strictEqual); } }; // 10. The strict non-equality assertion tests for strict inequality, as // determined by !==. assert.notStrictEqual(actual, expected, message_opt); assert.notStrictEqual = function notStrictEqual(actual, expected, message) { if (actual === expected) { fail(actual, expected, message, '!==', assert.notStrictEqual); } }; function expectedException(actual, expected) { if (!actual || !expected) { return false; } if (Object.prototype.toString.call(expected) == '[object RegExp]') { return expected.test(actual); } try { if (actual instanceof expected) { return true; } } catch (e) { // Ignore. The instanceof check doesn't work for arrow functions. } if (Error.isPrototypeOf(expected)) { return false; } return expected.call({}, actual) === true; } function _tryBlock(block) { var error; try { block(); } catch (e) { error = e; } return error; } function _throws(shouldThrow, block, expected, message) { var actual; if (typeof block !== 'function') { throw new TypeError('"block" argument must be a function'); } if (typeof expected === 'string') { message = expected; expected = null; } actual = _tryBlock(block); message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + (message ? ' ' + message : '.'); if (shouldThrow && !actual) { fail(actual, expected, 'Missing expected exception' + message); } var userProvidedMessage = typeof message === 'string'; var isUnwantedException = !shouldThrow && util.isError(actual); var isUnexpectedException = !shouldThrow && actual && !expected; if ((isUnwantedException && userProvidedMessage && expectedException(actual, expected)) || isUnexpectedException) { fail(actual, expected, 'Got unwanted exception' + message); } if ((shouldThrow && actual && expected && !expectedException(actual, expected)) || (!shouldThrow && actual)) { throw actual; } } // 11. Expected to throw an error: // assert.throws(block, Error_opt, message_opt); assert.throws = function(block, /*optional*/error, /*optional*/message) { _throws(true, block, error, message); }; // EXTENSION! This is annoying to write outside this module. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { _throws(false, block, error, message); }; assert.ifError = function(err) { if (err) throw err; }; var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) { if (hasOwn.call(obj, key)) keys.push(key); } return keys; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"util/":24}],3:[function(require,module,exports){ (function (global){ /*global window, global*/ var util = require("util") var assert = require("assert") var now = require("date-now") var slice = Array.prototype.slice var console var times = {} if (typeof global !== "undefined" && global.console) { console = global.console } else if (typeof window !== "undefined" && window.console) { console = window.console } else { console = {} } var functions = [ [log, "log"], [info, "info"], [warn, "warn"], [error, "error"], [time, "time"], [timeEnd, "timeEnd"], [trace, "trace"], [dir, "dir"], [consoleAssert, "assert"] ] for (var i = 0; i < functions.length; i++) { var tuple = functions[i] var f = tuple[0] var name = tuple[1] if (!console[name]) { console[name] = f } } module.exports = console function log() {} function info() { console.log.apply(console, arguments) } function warn() { console.log.apply(console, arguments) } function error() { console.warn.apply(console, arguments) } function time(label) { times[label] = now() } function timeEnd(label) { var time = times[label] if (!time) { throw new Error("No such label: " + label) } var duration = now() - time console.log(label + ": " + duration + "ms") } function trace() { var err = new Error() err.name = "Trace" err.message = util.format.apply(null, arguments) console.error(err.stack) } function dir(object) { console.log(util.inspect(object) + "\n") } function consoleAssert(expression) { if (!expression) { var arr = slice.call(arguments, 1) assert.ok(false, util.format.apply(null, arr)) } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"assert":2,"date-now":4,"util":24}],4:[function(require,module,exports){ module.exports = now function now() { return new Date().getTime() } },{}],5:[function(require,module,exports){ /* evol.colorpicker 3.2.2 (c) 2015 Olivier Giulieri http://evoluteur.github.io/colorpicker/ */ !function(a,b){var c=0,d=window.navigator.userAgent,e=d.indexOf("MSIE ")>0,f=e?"-ie":"",g=e?!1:/mozilla/.test(d.toLowerCase())&&!/webkit/.test(d.toLowerCase()),h=[],i=["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],j=["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],k=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],l=[["003366","336699","3366cc","003399","000099","0000cc","000066"],["006666","006699","0099cc","0066cc","0033cc","0000ff","3333ff","333399"],["669999","009999","33cccc","00ccff","0099ff","0066ff","3366ff","3333cc","666699"],["339966","00cc99","00ffcc","00ffff","33ccff","3399ff","6699ff","6666ff","6600ff","6600cc"],["339933","00cc66","00ff99","66ffcc","66ffff","66ccff","99ccff","9999ff","9966ff","9933ff","9900ff"],["006600","00cc00","00ff00","66ff99","99ffcc","ccffff","ccccff","cc99ff","cc66ff","cc33ff","cc00ff","9900cc"],["003300","009933","33cc33","66ff66","99ff99","ccffcc","ffffff","ffccff","ff99ff","ff66ff","ff00ff","cc00cc","660066"],["333300","009900","66ff33","99ff66","ccff99","ffffcc","ffcccc","ff99cc","ff66cc","ff33cc","cc0099","993399"],["336600","669900","99ff33","ccff66","ffff99","ffcc99","ff9999","ff6699","ff3399","cc3399","990099"],["666633","99cc00","ccff33","ffff66","ffcc66","ff9966","ff6666","ff0066","d60094","993366"],["a58800","cccc00","ffff00","ffcc00","ff9933","ff6600","ff0033","cc0066","660033"],["996633","cc9900","ff9900","cc6600","ff3300","ff0000","cc0000","990033"],["663300","996600","cc3300","993300","990000","800000","993333"]],m="#0000ffff",n=function(a){var b=a.toString(16);return 1==b.length&&(b="0"+b),b},o=function(a){return n(Number(a))},p=function(a){var b=n(a);return b+b+b},q=function(a){if(a.length>10){var b=1+a.indexOf("("),c=a.indexOf(")"),d=a.substring(b,c).split(",");return["#",o(d[0]),o(d[1]),o(d[2])].join("")}return a};a.widget("evol.colorpicker",{version:"3.2.1",options:{color:null,showOn:"both",hideButton:!1,displayIndicator:!0,transparentColor:!1,history:!0,defaultPalette:"theme",strings:"Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet."},_active:!1,_create:function(){var b=this;switch(this._paletteIdx="theme"==this.options.defaultPalette?1:2,this._id="evo-cp"+c++,this._enabled=!0,this.options.showOn=this.options.hideButton?"focus":this.options.showOn,this.element.get(0).tagName){case"INPUT":var d=this.options.color,h=this.element,i=("focus"===this.options.showOn?"":"evo-pointer ")+"evo-colorind"+(g?"-ff":f)+(this.options.hideButton?" evo-hidden-button":""),j="";if(this._isPopup=!0,this._palette=null,null!==d)h.val(d);else{var k=h.val();""!==k&&(d=this.options.color=k)}d===m?i+=" evo-transparent":j=null!==d?"background-color:"+d:"",h.addClass("colorPicker "+this._id).wrap('
').after('
').on("keyup onpaste",function(c){var d=a(this).val();d!=b.options.color&&b._setValue(d,!0)});var l=this.options.showOn;("both"===l||"focus"===l)&&h.on("focus",function(){b.showPalette()}),("both"===l||"button"===l)&&h.next().on("click",function(a){return a.stopPropagation(),b.showPalette(),!1});break;default:this._isPopup=!1,this._palette=this.element.html(this._paletteHTML()).attr("aria-haspopup","true"),this._bindColors()}if(this.options.history&&(d&&this._add2History(d),this.options.initialHistory)){var n=this.options.initialHistory;for(var o in n)this._add2History(n[o])}},_paletteHTML:function(){var a=this._paletteIdx=Math.abs(this._paletteIdx),b=this.options,c=b.strings.split(","),d='
"+this["_paletteHTML"+a]()+'
'+c[1+a]+"";return b.history&&(d+=''+c[5]+""),d+="
",b.displayIndicator&&(d+=this._colorIndHTML(this.options.color)+this._colorIndHTML("")),d+="
"},_colorIndHTML:function(a){var b=e?"evo-colorbox-ie ":"",c="";return a?a===m?b+="evo-transparent":c="background-color:"+a:c="display:none",'
'+(a?a:"")+"
"},_paletteHTML1:function(){for(var a=this.options,b=a.strings.split(","),c='
':'">',g='',h=''+g+b[0]+"",l=0;10>l;l++)h+=c+i[l]+d;for(h+="",e||(h+=''),h+='',l=0;10>l;l++)h+=c+j[l]+d;for(var m=1;4>m;m++)for(h+='',l=0;10>l;l++)h+=c+j[10*m+l]+d;for(h+='',l=40;50>l;l++)h+=c+j[l]+d;for(h+=""+g,a.transparentColor&&(h+='
'),h+=b[1]+"",l=0;10>l;l++)h+=c+k[l]+d;return h+="
"},_paletteHTML2:function(){for(var a,b,c='
':'">',g='',h="
",i='
',j=0,k=l.length;k>j;j++){i+=g;var m=l[j];for(a=0,b=m.length;b>a;a++)i+=c+m[a]+d;i+=h}i+='
';var n="";for(i+=g,a=255;a>10;a-=10)i+=c+p(a)+d,a-=10,n+=c+p(a)+d;return i+=h+g+n+h+"
"},_switchPalette:function(b){if(this._enabled){var c,d,e,f=this.options.strings.split(",");if(a(b).hasClass("evo-hist")){var g=['
',f[5],"
",'
'];if(0===h.length)g.push("

 ",f[6],"

");else for(var i=h.length-1;i>-1;i--)9===h[i].length?g.push('
'):g.push('
');g.push("
"),c=-this._paletteIdx,d=g.join(""),e=f[4]}else this._paletteIdx<0?(c=-this._paletteIdx,this._palette.find(".evo-hist").show()):c=2==this._paletteIdx?1:2,d=this["_paletteHTML"+c](),e=f[c+1],this._paletteIdx=c;this._paletteIdx=c;var j=this._palette.find(".evo-more").prev().html(d).end().children().eq(0).html(e);0>c&&j.next().hide()}},_downOrUpPositioning:function(){for(var a=this.element,b=0;null!==a&&100>b;){if("visible"!=a.css("overflow")){var c=this._palette.offset().top+this._palette.height(),d=a.offset().top+a.height(),e=this._palette.offset().top-this._palette.height()-this.element.outerHeight(),f=a.offset().top,g=c>d&&e>f;g?this._palette.css({bottom:this.element.outerHeight()+"px"}):this._palette.css({bottom:"auto"});break}if("HTML"==a[0].tagName)break;a=a.offsetParent(),b++}},showPalette:function(){if(this._enabled&&(this._active=!0,a(".colorPicker").not("."+this._id).colorpicker("hidePalette"),null===this._palette)){this._palette=this.element.next().after(this._paletteHTML()).next().on("click",function(a){return a.stopPropagation(),!1}),this._bindColors();var b=this;this._isPopup&&(this._downOrUpPositioning(),a(document.body).on("click."+b._id,function(a){a.target!=b.element.get(0)&&b.hidePalette()}).on("keyup."+b._id,function(a){27===a.keyCode&&b.hidePalette()}))}return this},hidePalette:function(){if(this._isPopup&&this._palette){a(document.body).off("click."+this._id);var b=this;this._palette.off("mouseover click","td,.evo-transparent").fadeOut(function(){b._palette.remove(),b._palette=b._cTxt=null}).find(".evo-more a").off("click")}return this},_bindColors:function(){var b=this,c=this.options,d=this._palette.find("div.evo-color"),e=c.history?"td,.evo-cHist>div":"td";c.transparentColor&&(e+=",.evo-transparent"),this._cTxt1=d.eq(0).children().eq(0),this._cTxt2=d.eq(1).children().eq(0),this._palette.on("click",e,function(c){if(b._enabled){var d=a(this);b._setValue(d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17))),b._active=!1}}).on("mouseover",e,function(c){if(b._enabled){var d=a(this),e=d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17));b.options.displayIndicator&&b._setColorInd(e,2),b._active&&b.element.trigger("mouseover.color",e)}}).find(".evo-more a").on("click",function(){b._switchPalette(this)})},val:function(a){return"undefined"==typeof a?this.options.color:(this._setValue(a),this)},_setValue:function(a,b){a=a.replace(/ /g,""),this.options.color=a,this._isPopup?(b||this.hidePalette(),this._setBoxColor(this.element.val(a).next(),a)):this._setColorInd(a,1),this.options.history&&this._paletteIdx>0&&this._add2History(a),this.element.trigger("change.color",a)},_setColorInd:function(a,b){var c=this["_cTxt"+b];this._setBoxColor(c,a),c.next().html(a)},_setBoxColor:function(a,b){b===m?a.addClass("evo-transparent").removeAttr("style"):a.removeClass("evo-transparent").attr("style","background-color:"+b)},_setOption:function(a,b){"color"==a?this._setValue(b,!0):this.options[a]=b},_add2History:function(a){for(var b=h.length,c=0;b>c;c++)if(a==h[c])return;b>27&&h.shift(),h.push(a)},clear:function(){this.hidePalette().val("")},enable:function(){var a=this.element;return this._isPopup?a.removeAttr("disabled"):a.css({opacity:"1","pointer-events":"auto"}),"focus"!==this.options.showOn&&this.element.next().addClass("evo-pointer"),a.removeAttr("aria-disabled"),this._enabled=!0,this},disable:function(){var a=this.element;return this._isPopup?a.attr("disabled","disabled"):(this.hidePalette(),a.css({opacity:"0.3","pointer-events":"none"})),"focus"!==this.options.showOn&&this.element.next().removeClass("evo-pointer"),a.attr("aria-disabled","true"),this._enabled=!1,this},isDisabled:function(){return!this._enabled},destroy:function(){a(document.body).off("click."+this._id),this._palette&&(this._palette.off("mouseover click","td,.evo-cHist>div,.evo-transparent").find(".evo-more a").off("click"),this._isPopup&&this._palette.remove(),this._palette=this._cTxt=null),this._isPopup&&this.element.next().off("click").remove().end().off("focus").unwrap(),this.element.removeClass("colorPicker "+this.id).empty(),a.Widget.prototype.destroy.call(this)}})}(jQuery); },{}],6:[function(require,module,exports){ // JavaScript Expression Parser (JSEP) 0.3.3 // JSEP may be freely distributed under the MIT License // http://jsep.from.so/ /*global module: true, exports: true, console: true */ (function (root) { 'use strict'; // Node Types // ---------- // This is the full set of types that any JSEP node can be. // Store them here to save space when minified var COMPOUND = 'Compound', IDENTIFIER = 'Identifier', MEMBER_EXP = 'MemberExpression', LITERAL = 'Literal', THIS_EXP = 'ThisExpression', CALL_EXP = 'CallExpression', UNARY_EXP = 'UnaryExpression', BINARY_EXP = 'BinaryExpression', LOGICAL_EXP = 'LogicalExpression', CONDITIONAL_EXP = 'ConditionalExpression', ARRAY_EXP = 'ArrayExpression', PERIOD_CODE = 46, // '.' COMMA_CODE = 44, // ',' SQUOTE_CODE = 39, // single quote DQUOTE_CODE = 34, // double quotes OPAREN_CODE = 40, // ( CPAREN_CODE = 41, // ) OBRACK_CODE = 91, // [ CBRACK_CODE = 93, // ] QUMARK_CODE = 63, // ? SEMCOL_CODE = 59, // ; COLON_CODE = 58, // : throwError = function(message, index) { var error = new Error(message + ' at character ' + index); error.index = index; error.description = message; throw error; }, // Operations // ---------- // Set `t` to `true` to save space (when minified, not gzipped) t = true, // Use a quickly-accessible map to store all of the unary operators // Values are set to `true` (it really doesn't matter) unary_ops = {'-': t, '!': t, '~': t, '+': t}, // Also use a map for the binary operations but set their values to their // binary precedence for quick reference: // see [Order of operations](http://en.wikipedia.org/wiki/Order_of_operations#Programming_language) binary_ops = { '||': 1, '&&': 2, '|': 3, '^': 4, '&': 5, '==': 6, '!=': 6, '===': 6, '!==': 6, '<': 7, '>': 7, '<=': 7, '>=': 7, '<<':8, '>>': 8, '>>>': 8, '+': 9, '-': 9, '*': 10, '/': 10, '%': 10 }, // Get return the longest key length of any object getMaxKeyLen = function(obj) { var max_len = 0, len; for(var key in obj) { if((len = key.length) > max_len && obj.hasOwnProperty(key)) { max_len = len; } } return max_len; }, max_unop_len = getMaxKeyLen(unary_ops), max_binop_len = getMaxKeyLen(binary_ops), // Literals // ---------- // Store the values to return for the various literals we may encounter literals = { 'true': true, 'false': false, 'null': null }, // Except for `this`, which is special. This could be changed to something like `'self'` as well this_str = 'this', // Returns the precedence of a binary operator or `0` if it isn't a binary operator binaryPrecedence = function(op_val) { return binary_ops[op_val] || 0; }, // Utility function (gets called from multiple places) // Also note that `a && b` and `a || b` are *logical* expressions, not binary expressions createBinaryExpression = function (operator, left, right) { var type = (operator === '||' || operator === '&&') ? LOGICAL_EXP : BINARY_EXP; return { type: type, operator: operator, left: left, right: right }; }, // `ch` is a character code in the next three functions isDecimalDigit = function(ch) { return (ch >= 48 && ch <= 57); // 0...9 }, isIdentifierStart = function(ch) { return (ch === 36) || (ch === 95) || // `$` and `_` (ch >= 65 && ch <= 90) || // A...Z (ch >= 97 && ch <= 122) || // a...z (ch >= 128 && !binary_ops[String.fromCharCode(ch)]); // any non-ASCII that is not an operator }, isIdentifierPart = function(ch) { return (ch === 36) || (ch === 95) || // `$` and `_` (ch >= 65 && ch <= 90) || // A...Z (ch >= 97 && ch <= 122) || // a...z (ch >= 48 && ch <= 57) || // 0...9 (ch >= 128 && !binary_ops[String.fromCharCode(ch)]); // any non-ASCII that is not an operator }, // Parsing // ------- // `expr` is a string with the passed in expression jsep = function(expr) { // `index` stores the character number we are currently at while `length` is a constant // All of the gobbles below will modify `index` as we move along var index = 0, charAtFunc = expr.charAt, charCodeAtFunc = expr.charCodeAt, exprI = function(i) { return charAtFunc.call(expr, i); }, exprICode = function(i) { return charCodeAtFunc.call(expr, i); }, length = expr.length, // Push `index` up to the next non-space character gobbleSpaces = function() { var ch = exprICode(index); // space or tab while(ch === 32 || ch === 9 || ch === 10 || ch === 13) { ch = exprICode(++index); } }, // The main parsing function. Much of this code is dedicated to ternary expressions gobbleExpression = function() { var test = gobbleBinaryExpression(), consequent, alternate; gobbleSpaces(); if(exprICode(index) === QUMARK_CODE) { // Ternary expression: test ? consequent : alternate index++; consequent = gobbleExpression(); if(!consequent) { throwError('Expected expression', index); } gobbleSpaces(); if(exprICode(index) === COLON_CODE) { index++; alternate = gobbleExpression(); if(!alternate) { throwError('Expected expression', index); } return { type: CONDITIONAL_EXP, test: test, consequent: consequent, alternate: alternate }; } else { throwError('Expected :', index); } } else { return test; } }, // Search for the operation portion of the string (e.g. `+`, `===`) // Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`) // and move down from 3 to 2 to 1 character until a matching binary operation is found // then, return that binary operation gobbleBinaryOp = function() { gobbleSpaces(); var biop, to_check = expr.substr(index, max_binop_len), tc_len = to_check.length; while(tc_len > 0) { if(binary_ops.hasOwnProperty(to_check)) { index += tc_len; return to_check; } to_check = to_check.substr(0, --tc_len); } return false; }, // This function is responsible for gobbling an individual expression, // e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)` gobbleBinaryExpression = function() { var ch_i, node, biop, prec, stack, biop_info, left, right, i; // First, try to get the leftmost thing // Then, check to see if there's a binary operator operating on that leftmost thing left = gobbleToken(); biop = gobbleBinaryOp(); // If there wasn't a binary operator, just return the leftmost node if(!biop) { return left; } // Otherwise, we need to start a stack to properly place the binary operations in their // precedence structure biop_info = { value: biop, prec: binaryPrecedence(biop)}; right = gobbleToken(); if(!right) { throwError("Expected expression after " + biop, index); } stack = [left, biop_info, right]; // Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm) while((biop = gobbleBinaryOp())) { prec = binaryPrecedence(biop); if(prec === 0) { break; } biop_info = { value: biop, prec: prec }; // Reduce: make a binary expression from the three topmost entries. while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { right = stack.pop(); biop = stack.pop().value; left = stack.pop(); node = createBinaryExpression(biop, left, right); stack.push(node); } node = gobbleToken(); if(!node) { throwError("Expected expression after " + biop, index); } stack.push(biop_info, node); } i = stack.length - 1; node = stack[i]; while(i > 1) { node = createBinaryExpression(stack[i - 1].value, stack[i - 2], node); i -= 2; } return node; }, // An individual part of a binary expression: // e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis) gobbleToken = function() { var ch, to_check, tc_len; gobbleSpaces(); ch = exprICode(index); if(isDecimalDigit(ch) || ch === PERIOD_CODE) { // Char code 46 is a dot `.` which can start off a numeric literal return gobbleNumericLiteral(); } else if(ch === SQUOTE_CODE || ch === DQUOTE_CODE) { // Single or double quotes return gobbleStringLiteral(); } else if (ch === OBRACK_CODE) { return gobbleArray(); } else { to_check = expr.substr(index, max_unop_len); tc_len = to_check.length; while(tc_len > 0) { if(unary_ops.hasOwnProperty(to_check)) { index += tc_len; return { type: UNARY_EXP, operator: to_check, argument: gobbleToken(), prefix: true }; } to_check = to_check.substr(0, --tc_len); } if (isIdentifierStart(ch) || ch === OPAREN_CODE) { // open parenthesis // `foo`, `bar.baz` return gobbleVariable(); } } return false; }, // Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to // keep track of everything in the numeric literal and then calling `parseFloat` on that string gobbleNumericLiteral = function() { var number = '', ch, chCode; while(isDecimalDigit(exprICode(index))) { number += exprI(index++); } if(exprICode(index) === PERIOD_CODE) { // can start with a decimal marker number += exprI(index++); while(isDecimalDigit(exprICode(index))) { number += exprI(index++); } } ch = exprI(index); if(ch === 'e' || ch === 'E') { // exponent marker number += exprI(index++); ch = exprI(index); if(ch === '+' || ch === '-') { // exponent sign number += exprI(index++); } while(isDecimalDigit(exprICode(index))) { //exponent itself number += exprI(index++); } if(!isDecimalDigit(exprICode(index-1)) ) { throwError('Expected exponent (' + number + exprI(index) + ')', index); } } chCode = exprICode(index); // Check to make sure this isn't a variable name that start with a number (123abc) if(isIdentifierStart(chCode)) { throwError('Variable names cannot start with a number (' + number + exprI(index) + ')', index); } else if(chCode === PERIOD_CODE) { throwError('Unexpected period', index); } return { type: LITERAL, value: parseFloat(number), raw: number }; }, // Parses a string literal, staring with single or double quotes with basic support for escape codes // e.g. `"hello world"`, `'this is\nJSEP'` gobbleStringLiteral = function() { var str = '', quote = exprI(index++), closed = false, ch; while(index < length) { ch = exprI(index++); if(ch === quote) { closed = true; break; } else if(ch === '\\') { // Check for all of the common escape codes ch = exprI(index++); switch(ch) { case 'n': str += '\n'; break; case 'r': str += '\r'; break; case 't': str += '\t'; break; case 'b': str += '\b'; break; case 'f': str += '\f'; break; case 'v': str += '\x0B'; break; default : str += ch; } } else { str += ch; } } if(!closed) { throwError('Unclosed quote after "'+str+'"', index); } return { type: LITERAL, value: str, raw: quote + str + quote }; }, // Gobbles only identifiers // e.g.: `foo`, `_value`, `$x1` // Also, this function checks if that identifier is a literal: // (e.g. `true`, `false`, `null`) or `this` gobbleIdentifier = function() { var ch = exprICode(index), start = index, identifier; if(isIdentifierStart(ch)) { index++; } else { throwError('Unexpected ' + exprI(index), index); } while(index < length) { ch = exprICode(index); if(isIdentifierPart(ch)) { index++; } else { break; } } identifier = expr.slice(start, index); if(literals.hasOwnProperty(identifier)) { return { type: LITERAL, value: literals[identifier], raw: identifier }; } else if(identifier === this_str) { return { type: THIS_EXP }; } else { return { type: IDENTIFIER, name: identifier }; } }, // Gobbles a list of arguments within the context of a function call // or array literal. This function also assumes that the opening character // `(` or `[` has already been gobbled, and gobbles expressions and commas // until the terminator character `)` or `]` is encountered. // e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]` gobbleArguments = function(termination) { var ch_i, args = [], node, closed = false; while(index < length) { gobbleSpaces(); ch_i = exprICode(index); if(ch_i === termination) { // done parsing closed = true; index++; break; } else if (ch_i === COMMA_CODE) { // between expressions index++; } else { node = gobbleExpression(); if(!node || node.type === COMPOUND) { throwError('Expected comma', index); } args.push(node); } } if (!closed) { throwError('Expected ' + String.fromCharCode(termination), index); } return args; }, // Gobble a non-literal variable name. This variable name may include properties // e.g. `foo`, `bar.baz`, `foo['bar'].baz` // It also gobbles function calls: // e.g. `Math.acos(obj.angle)` gobbleVariable = function() { var ch_i, node; ch_i = exprICode(index); if(ch_i === OPAREN_CODE) { node = gobbleGroup(); } else { node = gobbleIdentifier(); } gobbleSpaces(); ch_i = exprICode(index); while(ch_i === PERIOD_CODE || ch_i === OBRACK_CODE || ch_i === OPAREN_CODE) { index++; if(ch_i === PERIOD_CODE) { gobbleSpaces(); node = { type: MEMBER_EXP, computed: false, object: node, property: gobbleIdentifier() }; } else if(ch_i === OBRACK_CODE) { node = { type: MEMBER_EXP, computed: true, object: node, property: gobbleExpression() }; gobbleSpaces(); ch_i = exprICode(index); if(ch_i !== CBRACK_CODE) { throwError('Unclosed [', index); } index++; } else if(ch_i === OPAREN_CODE) { // A function call is being made; gobble all the arguments node = { type: CALL_EXP, 'arguments': gobbleArguments(CPAREN_CODE), callee: node }; } gobbleSpaces(); ch_i = exprICode(index); } return node; }, // Responsible for parsing a group of things within parentheses `()` // This function assumes that it needs to gobble the opening parenthesis // and then tries to gobble everything within that parenthesis, assuming // that the next thing it should see is the close parenthesis. If not, // then the expression probably doesn't have a `)` gobbleGroup = function() { index++; var node = gobbleExpression(); gobbleSpaces(); if(exprICode(index) === CPAREN_CODE) { index++; return node; } else { throwError('Unclosed (', index); } }, // Responsible for parsing Array literals `[1, 2, 3]` // This function assumes that it needs to gobble the opening bracket // and then tries to gobble the expressions as arguments. gobbleArray = function() { index++; return { type: ARRAY_EXP, elements: gobbleArguments(CBRACK_CODE) }; }, nodes = [], ch_i, node; while(index < length) { ch_i = exprICode(index); // Expressions can be separated by semicolons, commas, or just inferred without any // separators if(ch_i === SEMCOL_CODE || ch_i === COMMA_CODE) { index++; // ignore separators } else { // Try to gobble each expression individually if((node = gobbleExpression())) { nodes.push(node); // If we weren't able to find a binary expression and are out of room, then // the expression passed in probably has too much } else if(index < length) { throwError('Unexpected "' + exprI(index) + '"', index); } } } // If there's only one expression just try returning the expression if(nodes.length === 1) { return nodes[0]; } else { return { type: COMPOUND, body: nodes }; } }; // To be filled in by the template jsep.version = '0.3.3'; jsep.toString = function() { return 'JavaScript Expression Parser (JSEP) v' + jsep.version; }; /** * @method jsep.addUnaryOp * @param {string} op_name The name of the unary op to add * @return jsep */ jsep.addUnaryOp = function(op_name) { max_unop_len = Math.max(op_name.length, max_unop_len); unary_ops[op_name] = t; return this; }; /** * @method jsep.addBinaryOp * @param {string} op_name The name of the binary op to add * @param {number} precedence The precedence of the binary op (can be a float) * @return jsep */ jsep.addBinaryOp = function(op_name, precedence) { max_binop_len = Math.max(op_name.length, max_binop_len); binary_ops[op_name] = precedence; return this; }; /** * @method jsep.addLiteral * @param {string} literal_name The name of the literal to add * @param {*} literal_value The value of the literal * @return jsep */ jsep.addLiteral = function(literal_name, literal_value) { literals[literal_name] = literal_value; return this; }; /** * @method jsep.removeUnaryOp * @param {string} op_name The name of the unary op to remove * @return jsep */ jsep.removeUnaryOp = function(op_name) { delete unary_ops[op_name]; if(op_name.length === max_unop_len) { max_unop_len = getMaxKeyLen(unary_ops); } return this; }; /** * @method jsep.removeAllUnaryOps * @return jsep */ jsep.removeAllUnaryOps = function() { unary_ops = {}; max_unop_len = 0; return this; }; /** * @method jsep.removeBinaryOp * @param {string} op_name The name of the binary op to remove * @return jsep */ jsep.removeBinaryOp = function(op_name) { delete binary_ops[op_name]; if(op_name.length === max_binop_len) { max_binop_len = getMaxKeyLen(binary_ops); } return this; }; /** * @method jsep.removeAllBinaryOps * @return jsep */ jsep.removeAllBinaryOps = function() { binary_ops = {}; max_binop_len = 0; return this; }; /** * @method jsep.removeLiteral * @param {string} literal_name The name of the literal to remove * @return jsep */ jsep.removeLiteral = function(literal_name) { delete literals[literal_name]; return this; }; /** * @method jsep.removeAllLiterals * @return jsep */ jsep.removeAllLiterals = function() { literals = {}; return this; }; // In desktop environments, have a way to restore the old value for `jsep` if (typeof exports === 'undefined') { var old_jsep = root.jsep; // The star of the show! It's a function! root.jsep = jsep; // And a courteous function willing to move out of the way for other similarly-named objects! jsep.noConflict = function() { if(root.jsep === jsep) { root.jsep = old_jsep; } return jsep; }; } else { // In Node.JS environments if (typeof module !== 'undefined' && module.exports) { exports = module.exports = jsep; } else { exports.parse = jsep; } } }(this)); },{}],7:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); module.exports = function makeJuiceClient(juiceClient) { juiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link']; juiceClient.widthElements = ['TABLE', 'TD', 'IMG']; juiceClient.heightElements = ['TABLE', 'TD', 'IMG']; juiceClient.tableElements = ['TABLE', 'TD', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT']; juiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ]; juiceClient.styleToAttribute = { 'background-color': 'bgcolor', 'background-image': 'background', 'text-align': 'align', 'vertical-align': 'valign' }; juiceClient.excludedProperties = []; juiceClient.juiceDocument = juiceDocument; juiceClient.inlineDocument = inlineDocument; function inlineDocument($, css, options) { options = options || {}; var rules = utils.parseCSS(css); var editedElements = []; var styleAttributeName = 'style'; if (options.styleAttributeName) { styleAttributeName = options.styleAttributeName; } rules.forEach(handleRule); editedElements.forEach(setStyleAttrs); if (options.inlinePseudoElements) { editedElements.forEach(inlinePseudoElements); } if (options.applyWidthAttributes) { editedElements.forEach(function(el) { setDimensionAttrs(el, 'width'); }); } if (options.applyHeightAttributes) { editedElements.forEach(function(el) { setDimensionAttrs(el, 'height'); }); } if (options.applyAttributesTableElements) { editedElements.forEach(setAttributesOnTableElements); } if (options.insertPreservedExtraCss && options.extraCss) { var preservedText = utils.getPreservedText(options.extraCss, { mediaQueries: options.preserveMediaQueries, fontFaces: options.preserveFontFaces }); if (preservedText) { var $appendTo = null; if (options.insertPreservedExtraCss !== true) { $appendTo = $(options.insertPreservedExtraCss); } else { $appendTo = $('head'); if (!$appendTo.length) { $appendTo = $('body'); } if (!$appendTo.length) { $appendTo = $.root(); } } $appendTo.first().append(''); } } function handleRule(rule) { var sel = rule[0]; var style = rule[1]; var selector = new utils.Selector(sel); var parsedSelector = selector.parsed(); var pseudoElementType = getPseudoElementType(parsedSelector); // skip rule if the selector has any pseudos which are ignored for (var i = 0; i < parsedSelector.length; ++i) { var subSel = parsedSelector[i]; if (subSel.pseudos) { for (var j = 0; j < subSel.pseudos.length; ++j) { var subSelPseudo = subSel.pseudos[j]; if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) { return; } } } } if (pseudoElementType) { var last = parsedSelector[parsedSelector.length - 1]; var pseudos = last.pseudos; last.pseudos = filterElementPseudos(last.pseudos); sel = parsedSelector.toString(); last.pseudos = pseudos; } var els; try { els = $(sel); } catch (err) { // skip invalid selector return; } els.each(function() { var el = this; if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) { return; } if (pseudoElementType) { var pseudoElPropName = 'pseudo' + pseudoElementType; var pseudoEl = el[pseudoElPropName]; if (!pseudoEl) { pseudoEl = el[pseudoElPropName] = $('').get(0); pseudoEl.pseudoElementType = pseudoElementType; pseudoEl.pseudoElementParent = el; el[pseudoElPropName] = pseudoEl; } el = pseudoEl; } if (!el.styleProps) { el.styleProps = {}; // if the element has inline styles, fake selector with topmost specificity if ($(el).attr(styleAttributeName)) { var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } '; addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('