//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors

//     Underscore may be freely distributed under the MIT license.

/**
 * @license RequireJS text 2.0.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

/*! jQuery UI - v1.11.4 - 2016-05-15
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

/*!
 * jQuery UI Core 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */

/*!
 * jQuery UI Widget 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */

/*!
 * jQuery UI Mouse 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/mouse/
 */

/*!
 * jQuery UI Position 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */

/*!
 * jQuery UI Draggable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/draggable/
 */

/*!
 * jQuery UI Droppable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/droppable/
 */

/*!
 * jQuery UI Resizable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/resizable/
 */

/*!
 * jQuery UI Selectable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectable/
 */

/*!
 * jQuery UI Sortable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/sortable/
 */

/*!
 * jQuery UI Accordion 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/accordion/
 */

/*!
 * jQuery UI Menu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/menu/
 */

/*!
 * jQuery UI Autocomplete 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/autocomplete/
 */

/*!
 * jQuery UI Button 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/button/
 */

/*!
 * jQuery UI Datepicker 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/datepicker/
 */

/*!
 * jQuery UI Dialog 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/dialog/
 */

/*!
 * jQuery UI Progressbar 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/progressbar/
 */

/*!
 * jQuery UI Selectmenu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectmenu
 */

/*!
 * jQuery UI Slider 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/slider/
 */

/*!
 * jQuery UI Spinner 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/spinner/
 */

/*!
 * jQuery UI Tabs 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/tabs/
 */

/*!
 * jQuery UI Tooltip 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/tooltip/
 */

/*!
 * jQuery UI Effects 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/effects-core/
 */

/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */

/*!
 * jQuery UI Effects Blind 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/blind-effect/
 */

/*!
 * jQuery UI Effects Bounce 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/bounce-effect/
 */

/*!
 * jQuery UI Effects Clip 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/clip-effect/
 */

/*!
 * jQuery UI Effects Drop 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/drop-effect/
 */

/*!
 * jQuery UI Effects Explode 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/explode-effect/
 */

/*!
 * jQuery UI Effects Fade 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/fade-effect/
 */

/*!
 * jQuery UI Effects Fold 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/fold-effect/
 */

/*!
 * jQuery UI Effects Highlight 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/highlight-effect/
 */

/*!
 * jQuery UI Effects Size 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/size-effect/
 */

/*!
 * jQuery UI Effects Scale 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/scale-effect/
 */

/*!
 * jQuery UI Effects Puff 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/puff-effect/
 */

/*!
 * jQuery UI Effects Pulsate 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/pulsate-effect/
 */

/*!
 * jQuery UI Effects Shake 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/shake-effect/
 */

/*!
 * jQuery UI Effects Slide 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/slide-effect/
 */

/*!
 * jQuery UI Effects Transfer 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/transfer-effect/
 */

(function(){function e(e){function t(t,n,r,i,s,o){for(;s>=0&&o>s;s+=e){var u=i?i[s]:s;r=n(r,t[u],u,t)}return r}return function(n,r,i,s){r=b(r,s,4);var o=!C(n)&&y.keys(n),u=(o||n).length,a=e>0?0:u-1;return arguments.length<3&&(i=n[o?o[a]:a],a+=e),t(n,r,i,o,a,u)}}function t(e){return function(t,n,r){n=w(n,r);for(var i=N(t),s=e>0?0:i-1;s>=0&&i>s;s+=e)if(n(t[s],s,t))return s;return-1}}function n(e,t,n){return function(r,i,s){var o=0,u=N(r);if("number"==typeof s)e>0?o=s>=0?s:Math.max(s+u,o):u=s>=0?Math.min(s+1,u):s+u+1;else if(n&&s&&u)return s=n(r,i),r[s]===i?s:-1;if(i!==i)return s=t(l.call(r,o,u),y.isNaN),s>=0?s+o:-1;for(s=e>0?o:u-1;s>=0&&u>s;s+=e)if(r[s]===i)return s;return-1}}function r(e,t){var n=M.length,r=e.constructor,i=y.isFunction(r)&&r.prototype||u,s="constructor";for(y.has(e,s)&&!y.contains(t,s)&&t.push(s);n--;)s=M[n],s in e&&e[s]!==i[s]&&!y.contains(t,s)&&t.push(s)}var i=this,s=i._,o=Array.prototype,u=Object.prototype,a=Function.prototype,f=o.push,l=o.slice,c=u.toString,h=u.hasOwnProperty,p=Array.isArray,d=Object.keys,v=a.bind,m=Object.create,g=function(){},y=function(e){return e instanceof y?e:this instanceof y?void (this._wrapped=e):new y(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=y),exports._=y):i._=y,y.VERSION="1.8.3";var b=function(e,t,n){if(t===void 0)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)}}return function(){return e.apply(t,arguments)}},w=function(e,t,n){return null==e?y.identity:y.isFunction(e)?b(e,t,n):y.isObject(e)?y.matcher(e):y.property(e)};y.iteratee=function(e,t){return w(e,t,1/0)};var E=function(e,t){return function(n){var r=arguments.length;if(2>r||null==n)return n;for(var i=1;r>i;i++)for(var s=arguments[i],o=e(s),u=o.length,a=0;u>a;a++){var f=o[a];t&&n[f]!==void 0||(n[f]=s[f])}return n}},S=function(e){if(!y.isObject(e))return{};if(m)return m(e);g.prototype=e;var t=new g;return g.prototype=null,t},x=function(e){return function(t){return null==t?void 0:t[e]}},T=Math.pow(2,53)-1,N=x("length"),C=function(e){var t=N(e);return"number"==typeof t&&t>=0&&T>=t};y.each=y.forEach=function(e,t,n){t=b(t,n);var r,i;if(C(e))for(r=0,i=e.length;i>r;r++)t(e[r],r,e);else{var s=y.keys(e);for(r=0,i=s.length;i>r;r++)t(e[s[r]],s[r],e)}return e},y.map=y.collect=function(e,t,n){t=w(t,n);for(var r=!C(e)&&y.keys(e),i=(r||e).length,s=Array(i),o=0;i>o;o++){var u=r?r[o]:o;s[o]=t(e[u],u,e)}return s},y.reduce=y.foldl=y.inject=e(1),y.reduceRight=y.foldr=e(-1),y.find=y.detect=function(e,t,n){var r;return r=C(e)?y.findIndex(e,t,n):y.findKey(e,t,n),r!==void 0&&r!==-1?e[r]:void 0},y.filter=y.select=function(e,t,n){var r=[];return t=w(t,n),y.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},y.reject=function(e,t,n){return y.filter(e,y.negate(w(t)),n)},y.every=y.all=function(e,t,n){t=w(t,n);for(var r=!C(e)&&y.keys(e),i=(r||e).length,s=0;i>s;s++){var o=r?r[s]:s;if(!t(e[o],o,e))return!1}return!0},y.some=y.any=function(e,t,n){t=w(t,n);for(var r=!C(e)&&y.keys(e),i=(r||e).length,s=0;i>s;s++){var o=r?r[s]:s;if(t(e[o],o,e))return!0}return!1},y.contains=y.includes=y.include=function(e,t,n,r){return C(e)||(e=y.values(e)),("number"!=typeof n||r)&&(n=0),y.indexOf(e,t,n)>=0},y.invoke=function(e,t){var n=l.call(arguments,2),r=y.isFunction(t);return y.map(e,function(e){var i=r?t:e[t];return null==i?i:i.apply(e,n)})},y.pluck=function(e,t){return y.map(e,y.property(t))},y.where=function(e,t){return y.filter(e,y.matcher(t))},y.findWhere=function(e,t){return y.find(e,y.matcher(t))},y.max=function(e,t,n){var r,i,s=-1/0,o=-1/0;if(null==t&&null!=e){e=C(e)?e:y.values(e);for(var u=0,a=e.length;a>u;u++)r=e[u],r>s&&(s=r)}else t=w(t,n),y.each(e,function(e,n,r){i=t(e,n,r),(i>o||i===-1/0&&s===-1/0)&&(s=e,o=i)});return s},y.min=function(e,t,n){var r,i,s=1/0,o=1/0;if(null==t&&null!=e){e=C(e)?e:y.values(e);for(var u=0,a=e.length;a>u;u++)r=e[u],s>r&&(s=r)}else t=w(t,n),y.each(e,function(e,n,r){i=t(e,n,r),(o>i||1/0===i&&1/0===s)&&(s=e,o=i)});return s},y.shuffle=function(e){for(var t,n=C(e)?e:y.values(e),r=n.length,i=Array(r),s=0;r>s;s++)t=y.random(0,s),t!==s&&(i[s]=i[t]),i[t]=n[s];return i},y.sample=function(e,t,n){return null==t||n?(C(e)||(e=y.values(e)),e[y.random(e.length-1)]):y.shuffle(e).slice(0,Math.max(0,t))},y.sortBy=function(e,t,n){return t=w(t,n),y.pluck(y.map(e,function(e,n,r){return{value:e,index:n,criteria:t(e,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(r>n||r===void 0)return-1}return e.index-t.index}),"value")};var k=function(e){return function(t,n,r){var i={};return n=w(n,r),y.each(t,function(r,s){var o=n(r,s,t);e(i,r,o)}),i}};y.groupBy=k(function(e,t,n){y.has(e,n)?e[n].push(t):e[n]=[t]}),y.indexBy=k(function(e,t,n){e[n]=t}),y.countBy=k(function(e,t,n){y.has(e,n)?e[n]++:e[n]=1}),y.toArray=function(e){return e?y.isArray(e)?l.call(e):C(e)?y.map(e,y.identity):y.values(e):[]},y.size=function(e){return null==e?0:C(e)?e.length:y.keys(e).length},y.partition=function(e,t,n){t=w(t,n);var r=[],i=[];return y.each(e,function(e,n,s){(t(e,n,s)?r:i).push(e)}),[r,i]},y.first=y.head=y.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:y.initial(e,e.length-t)},y.initial=function(e,t,n){return l.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},y.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:y.rest(e,Math.max(0,e.length-t))},y.rest=y.tail=y.drop=function(e,t,n){return l.call(e,null==t||n?1:t)},y.compact=function(e){return y.filter(e,y.identity)};var L=function(e,t,n,r){for(var i=[],s=0,o=r||0,u=N(e);u>o;o++){var a=e[o];if(C(a)&&(y.isArray(a)||y.isArguments(a))){t||(a=L(a,t,n));var f=0,l=a.length;for(i.length+=l;l>f;)i[s++]=a[f++]}else n||(i[s++]=a)}return i};y.flatten=function(e,t){return L(e,t,!1)},y.without=function(e){return y.difference(e,l.call(arguments,1))},y.uniq=y.unique=function(e,t,n,r){y.isBoolean(t)||(r=n,n=t,t=!1),null!=n&&(n=w(n,r));for(var i=[],s=[],o=0,u=N(e);u>o;o++){var a=e[o],f=n?n(a,o,e):a;t?(o&&s===f||i.push(a),s=f):n?y.contains(s,f)||(s.push(f),i.push(a)):y.contains(i,a)||i.push(a)}return i},y.union=function(){return y.uniq(L(arguments,!0,!0))},y.intersection=function(e){for(var t=[],n=arguments.length,r=0,i=N(e);i>r;r++){var s=e[r];if(!y.contains(t,s)){for(var o=1;n>o&&y.contains(arguments[o],s);o++);o===n&&t.push(s)}}return t},y.difference=function(e){var t=L(arguments,!0,!0,1);return y.filter(e,function(e){return!y.contains(t,e)})},y.zip=function(){return y.unzip(arguments)},y.unzip=function(e){for(var t=e&&y.max(e,N).length||0,n=Array(t),r=0;t>r;r++)n[r]=y.pluck(e,r);return n},y.object=function(e,t){for(var n={},r=0,i=N(e);i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},y.findIndex=t(1),y.findLastIndex=t(-1),y.sortedIndex=function(e,t,n,r){n=w(n,r,1);for(var i=n(t),s=0,o=N(e);o>s;){var u=Math.floor((s+o)/2);n(e[u])<i?s=u+1:o=u}return s},y.indexOf=n(1,y.findIndex,y.sortedIndex),y.lastIndexOf=n(-1,y.findLastIndex),y.range=function(e,t,n){null==t&&(t=e||0,e=0),n=n||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r),s=0;r>s;s++,e+=n)i[s]=e;return i};var A=function(e,t,n,r,i){if(r instanceof t){var s=S(e.prototype),o=e.apply(s,i);return y.isObject(o)?o:s}return e.apply(n,i)};y.bind=function(e,t){if(v&&e.bind===v)return v.apply(e,l.call(arguments,1));if(!y.isFunction(e))throw new TypeError("Bind must be called on a function");var n=l.call(arguments,2),r=function(){return A(e,r,t,this,n.concat(l.call(arguments)))};return r},y.partial=function(e){var t=l.call(arguments,1),n=function(){for(var r=0,i=t.length,s=Array(i),o=0;i>o;o++)s[o]=t[o]===y?arguments[r++]:t[o];for(;r<arguments.length;)s.push(arguments[r++]);return A(e,n,this,this,s)};return n},y.bindAll=function(e){var t,n,r=arguments.length;if(1>=r)throw new Error("bindAll must be passed function names");for(t=1;r>t;t++)n=arguments[t],e[n]=y.bind(e[n],e);return e},y.memoize=function(e,t){var n=function(r){var i=n.cache,s=""+(t?t.apply(this,arguments):r);return y.has(i,s)||(i[s]=e.apply(this,arguments)),i[s]};return n.cache={},n},y.delay=function(e,t){var n=l.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},y.defer=y.partial(y.delay,y,1),y.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:y.now(),o=null,s=e.apply(r,i),o||(r=i=null)};return function(){var f=y.now();u||n.leading!==!1||(u=f);var l=t-(f-u);return r=this,i=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),u=f,s=e.apply(r,i),o||(r=i=null)):o||n.trailing===!1||(o=setTimeout(a,l)),s}},y.debounce=function(e,t,n){var r,i,s,o,u,a=function(){var f=y.now()-o;t>f&&f>=0?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i),r||(s=i=null)))};return function(){s=this,i=arguments,o=y.now();var f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i),s=i=null),u}},y.wrap=function(e,t){return y.partial(t,e)},y.negate=function(e){return function(){return!e.apply(this,arguments)}},y.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},y.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},y.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),1>=e&&(t=null),n}},y.once=y.partial(y.before,2);var O=!{toString:null}.propertyIsEnumerable("toString"),M=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];y.keys=function(e){if(!y.isObject(e))return[];if(d)return d(e);var t=[];for(var n in e)y.has(e,n)&&t.push(n);return O&&r(e,t),t},y.allKeys=function(e){if(!y.isObject(e))return[];var t=[];for(var n in e)t.push(n);return O&&r(e,t),t},y.values=function(e){for(var t=y.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=e[t[i]];return r},y.mapObject=function(e,t,n){t=w(t,n);for(var r,i=y.keys(e),s=i.length,o={},u=0;s>u;u++)r=i[u],o[r]=t(e[r],r,e);return o},y.pairs=function(e){for(var t=y.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=[t[i],e[t[i]]];return r},y.invert=function(e){for(var t={},n=y.keys(e),r=0,i=n.length;i>r;r++)t[e[n[r]]]=n[r];return t},y.functions=y.methods=function(e){var t=[];for(var n in e)y.isFunction(e[n])&&t.push(n);return t.sort()},y.extend=E(y.allKeys),y.extendOwn=y.assign=E(y.keys),y.findKey=function(e,t,n){t=w(t,n);for(var r,i=y.keys(e),s=0,o=i.length;o>s;s++)if(r=i[s],t(e[r],r,e))return r},y.pick=function(e,t,n){var r,i,s={},o=e;if(null==o)return s;y.isFunction(t)?(i=y.allKeys(o),r=b(t,n)):(i=L(arguments,!1,!1,1),r=function(e,t,n){return t in n},o=Object(o));for(var u=0,a=i.length;a>u;u++){var f=i[u],l=o[f];r(l,f,o)&&(s[f]=l)}return s},y.omit=function(e,t,n){if(y.isFunction(t))t=y.negate(t);else{var r=y.map(L(arguments,!1,!1,1),String);t=function(e,t){return!y.contains(r,t)}}return y.pick(e,t,n)},y.defaults=E(y.allKeys,!0),y.create=function(e,t){var n=S(e);return t&&y.extendOwn(n,t),n},y.clone=function(e){return y.isObject(e)?y.isArray(e)?e.slice():y.extend({},e):e},y.tap=function(e,t){return t(e),e},y.isMatch=function(e,t){var n=y.keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),s=0;r>s;s++){var o=n[s];if(t[o]!==i[o]||!(o in i))return!1}return!0};var _=function(e,t,n,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof y&&(e=e._wrapped),t instanceof y&&(t=t._wrapped);var i=c.call(e);if(i!==c.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var s="[object Array]"===i;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var o=e.constructor,u=t.constructor;if(o!==u&&!(y.isFunction(o)&&o instanceof o&&y.isFunction(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var a=n.length;a--;)if(n[a]===e)return r[a]===t;if(n.push(e),r.push(t),s){if(a=e.length,a!==t.length)return!1;for(;a--;)if(!_(e[a],t[a],n,r))return!1}else{var f,l=y.keys(e);if(a=l.length,y.keys(t).length!==a)return!1;for(;a--;)if(f=l[a],!y.has(t,f)||!_(e[f],t[f],n,r))return!1}return n.pop(),r.pop(),!0};y.isEqual=function(e,t){return _(e,t)},y.isEmpty=function(e){return null==e?!0:C(e)&&(y.isArray(e)||y.isString(e)||y.isArguments(e))?0===e.length:0===y.keys(e).length},y.isElement=function(e){return!!e&&1===e.nodeType},y.isArray=p||function(e){return"[object Array]"===c.call(e)},y.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},y.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){y["is"+e]=function(t){return c.call(t)==="[object "+e+"]"}}),y.isArguments(arguments)||(y.isArguments=function(e){return y.has(e,"callee")}),"function"!=typeof /./&&"object"!=typeof Int8Array&&(y.isFunction=function(e){return"function"==typeof e||!1}),y.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},y.isNaN=function(e){return y.isNumber(e)&&e!==+e},y.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===c.call(e)},y.isNull=function(e){return null===e},y.isUndefined=function(e){return e===void 0},y.has=function(e,t){return null!=e&&h.call(e,t)},y.noConflict=function(){return i._=s,this},y.identity=function(e){return e},y.constant=function(e){return function(){return e}},y.noop=function(){},y.property=x,y.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},y.matcher=y.matches=function(e){return e=y.extendOwn({},e),function(t){return y.isMatch(t,e)}},y.times=function(e,t,n){var r=Array(Math.max(0,e));t=b(t,n,1);for(var i=0;e>i;i++)r[i]=t(i);return r},y.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},y.now=Date.now||function(){return(new Date).getTime()};var D={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},P=y.invert(D),H=function(e){var t=function(t){return e[t]},n="(?:"+y.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};y.escape=H(D),y.unescape=H(P),y.result=function(e,t,n){var r=null==e?void 0:e[t];return r===void 0&&(r=n),y.isFunction(r)?r.call(e):r};var B=0;y.uniqueId=function(e){var t=++B+"";return e?e+t:t},y.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var j=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},I=/\\|'|\r|\n|\u2028|\u2029/g,q=function(e){return"\\"+F[e]};y.template=function(e,t,n){!t&&n&&(t=n),t=y.defaults({},t,y.templateSettings);var r=RegExp([(t.escape||j).source,(t.interpolate||j).source,(t.evaluate||j).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){return s+=e.slice(i,u).replace(I,q),i=u+t.length,n?s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(s+="';\n"+o+"\n__p+='"),t}),s+="';\n",t.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(t.variable||"obj","_",s)}catch(u){throw u.source=s,u}var a=function(e){return o.call(this,e,y)},f=t.variable||"obj";return a.source="function("+f+"){\n"+s+"}",a},y.chain=function(e){var t=y(e);return t._chain=!0,t};var R=function(e,t){return e._chain?y(t).chain():t};y.mixin=function(e){y.each(y.functions(e),function(t){var n=y[t]=e[t];y.prototype[t]=function(){var e=[this._wrapped];return f.apply(e,arguments),R(this,n.apply(y,e))}})},y.mixin(y),y.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=o[e];y.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],R(this,n)}}),y.each(["concat","join","slice"],function(e){var t=o[e];y.prototype[e]=function(){return R(this,t.apply(this._wrapped,arguments))}}),y.prototype.value=function(){return this._wrapped},y.prototype.valueOf=y.prototype.toJSON=y.prototype.value,y.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return y})}).call(this),define("app/lib/cache",["underscore"],function(e){var t=function(){this.init()};return t.prototype={init:function(){this.__data__={}},clear:function(){this.init()},get:function(e,t){if(this.__data__[e])return this.__data__[e][t]},set:function(t,n,r){if(t&&n&&r){this.__data__[t]=this.__data__[t]||{};var i={};i[n]=r,e.extend(this.__data__[t],i)}}},new t}),define("app/lib/promise",[],function(){function e(){}function t(e){setTimeout(e,0)}function i(e){try{return e.then}catch(t){return n=t,r}}function s(e,t){try{return e(t)}catch(i){return n=i,r}}function o(e,t,i){try{e(t,i)}catch(s){return n=s,r}}function u(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");if(typeof t!="function")throw new TypeError("not a function");this._deferredState=0,this._state=0,this._value=null,this._deferreds=null;if(t===e)return;v(t,this)}function a(t,n,r){return new t.constructor(function(i,s){var o=new u(e);o.then(i,s),f(t,new d(n,r,o))})}function f(e,t){while(e._state===3)e=e._value;u._onHandle&&u._onHandle(e);if(e._state===0){if(e._deferredState===0){e._deferredState=1,e._deferreds=t;return}if(e._deferredState===1){e._deferredState=2,e._deferreds=[e._deferreds,t];return}e._deferreds.push(t);return}l(e,t)}function l(e,i){t(function(){var t=e._state===1?i.onFulfilled:i.onRejected;if(t===null){e._state===1?c(i.promise,e._value):h(i.promise,e._value);return}var o=s(t,e._value);o===r?h(i.promise,n):c(i.promise,o)})}function c(e,t){if(t===e)return h(e,new TypeError("A promise cannot be resolved with itself."));if(t&&(typeof t=="object"||typeof t=="function")){var s=i(t);if(s===r)return h(e,n);if(s===e.then&&t instanceof u){e._state=3,e._value=t,p(e);return}if(typeof s=="function"){v(s.bind(t),e);return}}e._state=1,e._value=t,p(e)}function h(e,t){e._state=2,e._value=t,u._onReject&&u._onReject(e,t),p(e)}function p(e){e._deferredState===1&&(f(e,e._deferreds),e._deferreds=null);if(e._deferredState===2){for(var t=0;t<e._deferreds.length;t++)f(e,e._deferreds[t]);e._deferreds=null}}function d(e,t,n){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.promise=n}function v(e,t){var i=!1,s=o(e,function(e){if(i)return;i=!0,c(t,e)},function(e){if(i)return;i=!0,h(t,e)});!i&&s===r&&(i=!0,h(t,n))}var n=null,r={};return u._onHandle=null,u._onReject=null,u._noop=e,u.prototype.then=function(t,n){if(this.constructor!==u)return a(this,t,n);var r=new u(e);return f(this,new d(t,n,r)),r},u.all=function(e){var t=Array.prototype.slice.call(e);return new u(function(e,n){function i(s,o){if(o&&(typeof o=="object"||typeof o=="function")){var a=o.then;if(typeof a=="function"){var f=new u(a.bind(o));f.then(function(e){i(s,e)},n);return}}t[s]=o,--r===0&&e(t)}if(t.length===0)return e([]);var r=t.length;for(var s=0;s<t.length;s++)i(s,t[s])})},u.resolve=function(e){return new u(function(t){t(e)})},u.race=function(e){return new u(function(t,n){e.forEach(function(e){u.resolve(e).then(t,n)})})},u.prototype["catch"]=function(e){return this.then(null,e)},u.prototype.done=function(e,t){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(e){setTimeout(function(){throw e},0)})},u}),define("app/lib/lang",["jquery","underscore","app/lib/cache","app/lib/promise"],function(e,t,n,r){var i="cps-lang",s="cps-lang-org",o="cps-lang-type",u="data-",a=function(){};return a.prototype={__language_data__:{},defaultLang:"ko",currentLang:"ko",load:function(e){},reset:function(e){var t=this;e=e||this.currentLang,t.init({langCode:e}).then(function(){t.apply()})},apply:function(n){n=n||"";var r=this,a=function(n){return function(){e(n+" ["+u+i+"]").css("visibility","hidden"),e(n+" ["+u+i+"]").each(function(n,u){var a=e(this);if(!a.data(s)){var f=a.text();u.nodeName=="INPUT"&&u.type=="button"&&(f=a.attr("value")),a.data(s,f)}var l=a.data(i),c=r.get(l);typeof c!="string"&&(c=""),c=c||a.data(s);var h=a.data(o)||"text",p=h.split(",");c&&t.each(p,function(e){typeof r.applyTypeDefinitions[e]=="function"&&r.applyTypeDefinitions[e](a,c)})}),e(n+" ["+u+i+"]").css("visibility","visible")}}(n);setTimeout(function(){a()},0)},applyTypeDefinitions:{text:function(e,t){return e.text(t)},title:function(e,t){return e.attr("title",t)},alt:function(e,t){return e.attr("alt",t)}},init:function(t,n){e("style[data-cps-style-lang]").remove();var s=e('<style type="text/css" data-cps-style-lang="true"></style>');e("head").append(s),t=t||{};var o=t.langCode||this.defaultLang;this.currentLang=o;var u=this;e(" [data-"+i+"]").css("visibility","hidden");if(!u.__language_data__[o]){var a=NHIE.lib.requirePromise(["resources/lang/lang-"+o+".js"]);return a.then(function(){return NHIE.lib.requirePromise(["text!resources/lang/css/style-"+o+".css"])}).then(function(e){var t=e[0];s.get(0).textContent=t}),a}return r.resolve(!0)},get:function(e){if(!e)return;var t=this.currentLang||this.defaultLang,r=e.split("|")[0],i=this.__language_data__[t];if(i){if(!n.get("lang_"+t,r)){var s=i,o=r.split(".");for(var u=0,a=o.length;u<a;u++){if(!s[o[u]])return null;s=s[o[u]]}if(!s)return null;n.set("lang_"+t,r,s)}return n.get("lang_"+t,r)}},setData:function(e,n){this.__language_data__[e]=this.__language_data__[e]||{},t.extend(this.__language_data__[e],n)}},new a}),define("text",["module"],function(e){var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.14",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.lastIndexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i&&i.isBuild&&!i.inlineText){r();return}d.isBuild=i&&i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i[0]==="﻿"&&(i=i.substring(1)),t(i)}catch(s){r&&r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status||0,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r&&r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("text!app/app.config.json",[],function(){return'{\r\n	"version": "0.4",\r\n	"default-language":"ko",\r\n\r\n	"maxImageWidth": 1600,\r\n	"maxImageHeight": 1600,\r\n	"minImageWidth": 50,\r\n	"minImageHeight": 50,\r\n\r\n	"resources": {\r\n		"font-family": [\r\n			"gulim",\r\n			"gulimche",\r\n			"dotum",\r\n			"dotumche",\r\n			"batang",\r\n			"batangche",\r\n			"gungsuh",\r\n			"gungsuhche",\r\n			"malgun gothic",\r\n			"tahoma",\r\n			"verdana",\r\n			"arial"\r\n		],\r\n		"font-size-unit": "px",\r\n		"font-size": [\r\n			8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,66,72,80,88,96\r\n		]\r\n	},\r\n	"defaultFontConfig": {\r\n		"fontFamily": "",\r\n		"fontSize": "14px"\r\n	},\r\n	"ui": {\r\n		"toolbar": [\r\n			["history-reset"],\r\n			"|",\r\n			["history-undo", "history-redo"],\r\n			"|",\r\n			["resize-workspace"],\r\n			"|",\r\n			["move-layer", "rotate-left", "rotate-right", "inverse-h", "inverse-v"],\r\n			"|",\r\n			["crop-layer", "resize-layer"],\r\n			"|",\r\n			["insert-textbox", "insert-textballoon", "insert-sticker"],\r\n			"|",\r\n			["adjust-color", "apply-filter"]\r\n		],\r\n		"navigator": {\r\n			"zoom_steps": [10,20,30,40,50,100,150,200,300,400,500]\r\n		}\r\n	},\r\n\r\n	"assets": {\r\n		"stickers": [{\r\n			"id": "sticker_01",\r\n			"name": "sticker_01",\r\n			"src": "resources/images/stickers/sticker_01.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_02",\r\n			"name": "sticker_02",\r\n			"src": "resources/images/stickers/sticker_02.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_03",\r\n			"name": "sticker_03",\r\n			"src": "resources/images/stickers/sticker_03.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_04",\r\n			"name": "sticker_04",\r\n			"src": "resources/images/stickers/sticker_04.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_05",\r\n			"name": "sticker_05",\r\n			"src": "resources/images/stickers/sticker_05.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_06",\r\n			"name": "sticker_06",\r\n			"src": "resources/images/stickers/sticker_06.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_07",\r\n			"name": "sticker_07",\r\n			"src": "resources/images/stickers/sticker_07.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_08",\r\n			"name": "sticker_08",\r\n			"src": "resources/images/stickers/sticker_08.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_09",\r\n			"name": "sticker_09",\r\n			"src": "resources/images/stickers/sticker_09.png",\r\n			"width": 400,\r\n			"height": 400\r\n\r\n		},{\r\n			"id": "sticker_10",\r\n			"name": "sticker_10",\r\n			"src": "resources/images/stickers/sticker_10.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_11",\r\n			"name": "sticker_11",\r\n			"src": "resources/images/stickers/sticker_11.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_12",\r\n			"name": "sticker_12",\r\n			"src": "resources/images/stickers/sticker_12.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_13",\r\n			"name": "sticker_13",\r\n			"src": "resources/images/stickers/sticker_13.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_14",\r\n			"name": "sticker_14",\r\n			"src": "resources/images/stickers/sticker_14.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_15",\r\n			"name": "sticker_15",\r\n			"src": "resources/images/stickers/sticker_15.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_16",\r\n			"name": "sticker_16",\r\n			"src": "resources/images/stickers/sticker_16.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_17",\r\n			"name": "sticker_17",\r\n			"src": "resources/images/stickers/sticker_17.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_18",\r\n			"name": "sticker_18",\r\n			"src": "resources/images/stickers/sticker_18.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_19",\r\n			"name": "sticker_19",\r\n			"src": "resources/images/stickers/sticker_19.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_20",\r\n			"name": "sticker_20",\r\n			"src": "resources/images/stickers/sticker_20.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_21",\r\n			"name": "sticker_21",\r\n			"src": "resources/images/stickers/sticker_21.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_22",\r\n			"name": "sticker_22",\r\n			"src": "resources/images/stickers/sticker_22.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_23",\r\n			"name": "sticker_23",\r\n			"src": "resources/images/stickers/sticker_23.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_24",\r\n			"name": "sticker_24",\r\n			"src": "resources/images/stickers/sticker_24.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_25",\r\n			"name": "sticker_25",\r\n			"src": "resources/images/stickers/sticker_25.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_26",\r\n			"name": "sticker_26",\r\n			"src": "resources/images/stickers/sticker_26.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_27",\r\n			"name": "sticker_27",\r\n			"src": "resources/images/stickers/sticker_27.png",\r\n			"width": 400,\r\n			"height": 400\r\n		},{\r\n			"id": "sticker_28",\r\n			"name": "sticker_28",\r\n			"src": "resources/images/stickers/sticker_28.png",\r\n			"width": 400,\r\n			"height": 400\r\n		}],\r\n\r\n\r\n		"textballoons": [{\r\n			"id": "balloon_01",\r\n			"name": "balloon_01",\r\n			"src": "resources/images/balloons/balloon_01.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "58",\r\n          "y": "128",\r\n          "width": "284",\r\n          "height": "110"\r\n        }\r\n		},{\r\n			"id": "balloon_02",\r\n			"name": "balloon_02",\r\n			"src": "resources/images/balloons/balloon_02.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "58",\r\n          "y": "128",\r\n          "width": "284",\r\n          "height": "110"\r\n        }\r\n		},{\r\n			"id": "balloon_03",\r\n			"name": "balloon_03",\r\n			"src": "resources/images/balloons/balloon_03.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "50",\r\n          "y": "94",\r\n          "width": "298",\r\n          "height": "156"\r\n        }\r\n		},{\r\n			"id": "balloon_04",\r\n			"name": "balloon_04",\r\n			"src": "resources/images/balloons/balloon_04.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "50",\r\n          "y": "94",\r\n          "width": "298",\r\n          "height": "156"\r\n        }\r\n		},{\r\n			"id": "balloon_05",\r\n			"name": "balloon_05",\r\n			"src": "resources/images/balloons/balloon_05.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "68",\r\n          "y": "94",\r\n          "width": "276",\r\n          "height": "100"\r\n        }\r\n		},{\r\n			"id": "balloon_06",\r\n			"name": "balloon_06",\r\n			"src": "resources/images/balloons/balloon_06.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "68",\r\n          "y": "94",\r\n          "width": "276",\r\n          "height": "100"\r\n        }\r\n		},{\r\n			"id": "balloon_07",\r\n			"name": "balloon_07",\r\n			"src": "resources/images/balloons/balloon_07.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "34",\r\n          "y": "94",\r\n          "width": "334",\r\n          "height": "128"\r\n        }\r\n		},{\r\n			"id": "balloon_08",\r\n			"name": "balloon_08",\r\n			"src": "resources/images/balloons/balloon_08.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "34",\r\n          "y": "94",\r\n          "width": "334",\r\n          "height": "128"\r\n        }\r\n		},{\r\n			"id": "balloon_09",\r\n			"name": "balloon_09",\r\n			"src": "resources/images/balloons/balloon_09.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "60",\r\n          "y": "79",\r\n          "width": "278",\r\n          "height": "136"\r\n        }\r\n		},{\r\n			"id": "balloon_10",\r\n			"name": "balloon_10",\r\n			"src": "resources/images/balloons/balloon_10.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "60",\r\n          "y": "79",\r\n          "width": "278",\r\n          "height": "136"\r\n        }\r\n		},{\r\n			"id": "balloon_11",\r\n			"name": "balloon_11",\r\n			"src": "resources/images/balloons/balloon_11.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "60",\r\n          "y": "113",\r\n          "width": "284",\r\n          "height": "132"\r\n        }\r\n		},{\r\n			"id": "balloon_12",\r\n			"name": "balloon_12",\r\n			"src": "resources/images/balloons/balloon_12.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "60",\r\n          "y": "113",\r\n          "width": "284",\r\n          "height": "132"\r\n        }\r\n		},{\r\n			"id": "balloon_13",\r\n			"name": "balloon_13",\r\n			"src": "resources/images/balloons/balloon_13.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "49",\r\n          "y": "56",\r\n          "width": "300",\r\n          "height": "224"\r\n        }\r\n		},{\r\n			"id": "balloon_14",\r\n			"name": "balloon_14",\r\n			"src": "resources/images/balloons/balloon_14.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "49",\r\n          "y": "56",\r\n          "width": "300",\r\n          "height": "224"\r\n        }\r\n		},{\r\n			"id": "balloon_15",\r\n			"name": "balloon_15",\r\n			"src": "resources/images/balloons/balloon_15.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "60",\r\n          "y": "113",\r\n          "width": "284",\r\n          "height": "132"\r\n        }\r\n		},{\r\n			"id": "balloon_16",\r\n			"name": "balloon_16",\r\n			"src": "resources/images/balloons/balloon_16.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "95",\r\n          "y": "94",\r\n          "width": "205",\r\n          "height": "130"\r\n        }\r\n		},{\r\n			"id": "balloon_17",\r\n			"name": "balloon_17",\r\n			"src": "resources/images/balloons/balloon_17.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "78",\r\n          "y": "63",\r\n          "width": "254",\r\n          "height": "226"\r\n        }\r\n		},{\r\n			"id": "balloon_18",\r\n			"name": "balloon_18",\r\n			"src": "resources/images/balloons/balloon_18.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "104",\r\n          "y": "115",\r\n          "width": "190",\r\n          "height": "112"\r\n        }\r\n		},{\r\n			"id": "balloon_19",\r\n			"name": "balloon_19",\r\n			"src": "resources/images/balloons/balloon_19.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "86",\r\n          "y": "55",\r\n          "width": "230",\r\n          "height": "172"\r\n        }\r\n		},{\r\n			"id": "balloon_20",\r\n			"name": "balloon_20",\r\n			"src": "resources/images/balloons/balloon_20.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "27",\r\n          "y": "92",\r\n          "width": "342",\r\n          "height": "140"\r\n        }\r\n		},{\r\n			"id": "balloon_21",\r\n			"name": "balloon_21",\r\n			"src": "resources/images/balloons/balloon_21.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "76",\r\n          "y": "149",\r\n          "width": "242",\r\n          "height": "104"\r\n        }\r\n		},{\r\n			"id": "balloon_22",\r\n			"name": "balloon_22",\r\n			"src": "resources/images/balloons/balloon_22.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "94",\r\n          "y": "106",\r\n          "width": "216",\r\n          "height": "90"\r\n        }\r\n		},{\r\n			"id": "balloon_23",\r\n			"name": "balloon_23",\r\n			"src": "resources/images/balloons/balloon_23.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "139",\r\n          "y": "138",\r\n          "width": "158",\r\n          "height": "90"\r\n        }\r\n		},{\r\n			"id": "balloon_24",\r\n			"name": "balloon_24",\r\n			"src": "resources/images/balloons/balloon_24.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "127",\r\n          "y": "147",\r\n          "width": "138",\r\n          "height": "96"\r\n        }\r\n		},{\r\n			"id": "balloon_25",\r\n			"name": "balloon_25",\r\n			"src": "resources/images/balloons/balloon_25.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "30",\r\n          "y": "47",\r\n          "width": "340",\r\n          "height": "232"\r\n        }\r\n		},{\r\n			"id": "balloon_26",\r\n			"name": "balloon_26",\r\n			"src": "resources/images/balloons/balloon_26.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "38",\r\n          "y": "71",\r\n          "width": "326",\r\n          "height": "212"\r\n        }\r\n		},{\r\n			"id": "balloon_27",\r\n			"name": "balloon_27",\r\n			"src": "resources/images/balloons/balloon_27.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "69",\r\n          "y": "108",\r\n          "width": "248",\r\n          "height": "130"\r\n        }\r\n		},{\r\n			"id": "balloon_28",\r\n			"name": "balloon_28",\r\n			"src": "resources/images/balloons/balloon_28.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "61",\r\n          "y": "108",\r\n          "width": "288",\r\n          "height": "116"\r\n        }\r\n		},{\r\n			"id": "balloon_29",\r\n			"name": "balloon_29",\r\n			"src": "resources/images/balloons/balloon_29.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "49",\r\n          "y": "89",\r\n          "width": "300",\r\n          "height": "128"\r\n        }\r\n		},{\r\n			"id": "balloon_30",\r\n			"name": "balloon_30",\r\n			"src": "resources/images/balloons/balloon_30.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "77",\r\n          "y": "112",\r\n          "width": "245",\r\n          "height": "118"\r\n        }\r\n		},{\r\n			"id": "balloon_31",\r\n			"name": "balloon_31",\r\n			"src": "resources/images/balloons/balloon_31.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "59",\r\n          "y": "85",\r\n          "width": "288",\r\n          "height": "154"\r\n        }\r\n		},{\r\n			"id": "balloon_32",\r\n			"name": "balloon_32",\r\n			"src": "resources/images/balloons/balloon_32.png",\r\n			"width": 400,\r\n			"height": 400,\r\n			"textPos": {\r\n          "x": "59",\r\n          "y": "85",\r\n          "width": "288",\r\n          "height": "154"\r\n        }\r\n		}]\r\n	}\r\n}\r\n'}),define("app/lib",["jquery","underscore","app/lib/cache","app/lib/lang","app/lib/promise","text!app/app.config.json"],function(e,t,n,r,i,s){var o=function(e){return n.get("template",e)||n.set("template",e,t.template(e)),n.get("template",e)},u=function(e,t){return typeof t.lang=="undefined"&&(t.NHIE_Lang=NHIE.Lang),o(e)(t)},a=function(e){var n=new i(function(n,r){try{require(e,function(){var e=[];t.each(arguments,function(t){e.push(t)}),n(e)})}catch(i){r(i)}});return n},f="canvas_cache",l={parseRequest:function(){var e,t=/\+/g,n=/([^&=]+)=?([^&]*)/g,r=function(e){return decodeURIComponent(e.replace(t," "))},i=window.location.search.substring(1);urlParams={};while(e=n.exec(i))urlParams[r(e[1])]=r(e[2]);return urlParams},getImage:function(t){var n=new i(function(n,r){var i=e('<img style="width:30px;height:30px; crossorigin="anonymous"/>');i.on("load",function(){n(i.get(0))}).on("error",function(e){NHIE.app.loading(!1),console.error(e),r(e)}),i.attr("src",t)});return n},canvasCache:{set:function(t){var r=t.id,i=NHIE.workspace.getLayerById(r),s=0,o="";if(i.empty)o="_CACHE::empty_canvas";else do o="_CACHE::"+r+"$"+s++;while(n.get(f,o));var u=t.getContext("2d");n.set(f,o,{width:t.width,height:t.height,data:u.getImageData(0,0,t.width,t.height)}),e(t).attr("data-canvascache-id",o)},get:function(e){return n.get(f,e)}},canvasManager:{resetImageData:function(t){var n=e(t),r=n.attr("data-canvascache-id");if(r&&l.canvasCache.get(r)){var i=l.canvasCache.get(r),s=e("<canvas></canvas>"),o=s.get(0);o.width=i.width,o.height=i.height;var u=o.getContext("2d");u.putImageData(i.data,0,0);var a=NHIE.lib.util.canvasManager.getCanvasModifyData(t),f={x:a.flip.h?-1:1,y:a.flip.v?-1:1},c={width:i.width,height:i.height};a.rotate%180&&(c={width:i.height,height:i.width}),t.height=c.height,t.width=c.width;var h=t.getContext("2d");h.save(),h.scale(f.x,f.y),h.translate(t.width/2*f.x,t.height/2*f.y),h.rotate(a.rotate/180*Math.PI*f.x*f.y),h.drawImage(o,o.width/-2*f.x,o.height/-2*f.y,o.width*f.x,o.height*f.y),h.restore(),s.remove()}},getCanvasModifyData:function(t){var n=e(t),r=e(t).parent();return{rotate:parseInt(r.attr("data-modify-rotate")||"0"),flip:JSON.parse(r.attr("data-modify-flip")||'{"h":false,"v":false}')}},cropCanvas:function(e){var t=e.getContext("2d"),n=e.width,r=e.height,i={x:[],y:[]},s=t.getImageData(0,0,e.width,e.height),o,u,a;console.log(n,r);if(!n||!r)return{};var f=[],l=[];for(u=0;u<r;u++)for(o=0;o<n;o++)a=(u*n+o)*4,s.data[a+3]>0&&(f.push(o),l.push(u));f.sort(function(e,t){return e-t}),l.sort(function(e,t){return e-t});var c=f.length-1;n=f[c]-f[0],r=l[c]-l[0];var h={x:f[0]-1,y:l[0]-1,w:n+2,h:r+2};if(isNaN(h.w)||isNaN(h.h)||isNaN(h.x)||isNaN(h.y))return{};var p=t.getImageData(h.x,h.y,h.w,h.h);return e.width=h.w,e.height=h.h,t.putImageData(p,0,0),h}},getConfig:function(e){e=e||"";var t={};if(typeof NHIE!="undefined")t=NHIE.config;else try{t=JSON.parse(s)}catch(n){}var r=e.split("."),i=null;if(r&&r.length){try{i=t;for(var o=0,u=r.length;o<u;o++){if(typeof i[r[o]]=="undefined")return null;i=i[r[o]]}}catch(n){}if(typeof i!="undefined")return i}},rotatePoint:function(e,t,n,r,i){var s=function(e){return e/180*Math.PI};return r=r||0,i=i||0,{x:r+(t-r)*Math.cos(s(e))-(n-i)*Math.sin(s(e)),y:i+(n-i)*Math.cos(s(e))+(t-r)*Math.sin(s(e))}},getEventTargetLayer:function(t){var n=e(t.target),r=null,i=null;if(n.hasClass("tracker-handle")){var s=n.parent();i=s.attr("data-target-layer-id")}else n.hasClass("layer-resizer")?i=n.attr("data-target-layer-id"):n.hasClass("layer-canvas")?i=n.attr("id"):n.hasClass("layer")&&(i=n.find("canvas").attr("id"));return NHIE.workspace.getLayerById(i)},spinner:function(t,n,r){if(n!==!1){r=r||{},r.color=r.color||"#000",r.size=r.size||"small";if(!t.find(".ui-panel-mask").length){var i=e('<div class="ui-spinner-mask"></div>'),s=e('<div class="spinner spinner-'+r.size+'"></div>');for(var o=0;o<12;o++){var u=e('<div class="spinner-stick spinner-stick-'+o+'"></div>');u.css({transform:"rotate("+30*o+"deg)",animationDelay:-1.2+.1*o+"s",backgroundColor:r.color}),s.append(u)}s.css({width:40,height:40,marginLeft:-20,marginTop:-20}),i.append(s),t.append(i)}}else t.find(".ui-spinner-mask").remove()}},c=function(){var e=navigator.userAgent.toLowerCase(),t=new RegExp("trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(t.exec(e)!=null)var n=parseFloat(RegExp.$1);return{IsIE:!1,IsIE6:!1,IsIE7:!1,IsIE8:!1,IsIE9:!1,IsIE10:!1,IsIE11:!e.match(/msie (\d+)/)&&e.indexOf("trident")>0&&parseInt(e.match(/trident\/(\d+)/)[1],10)>=7||n==11,IsGecko:/gecko\//.test(e),IsOpera:!!window.opera,IsSafari:/applewebkit\//.test(e)&&!/chrome\//.test(e),IsChrome:/applewebkit\//.test(e)&&/chrome\//.test(e),IsEdge:/applewebkit\//.test(e)&&/chrome\//.test(e)&&/edge\//.test(e),IsMac:/macintosh/.test(e),IsIOS5:/(ipad|iphone)/.test(e)&&e.match(/applewebkit\/(\d*)/)[1]>=534&&e.match(/applewebkit\/(\d*)/)[1]<536,IsIOS6:/(ipad|iphone)/.test(e)&&e.match(/applewebkit\/(\d*)/)[1]>=536}}(),h=function(){var e=navigator.userAgent.toLowerCase(),t="",n=function(e){return e.replace(/(^\s*)|(\s*$)/g,"")};return c.IsIE?(t=parseInt(e.match(/msie (\d+)/)[1],10),t>=9&&parent.document.compatMode!="CSS1Compat"&&(t=8)):c.IsGecko?t=e.substring(e.indexOf("firefox/")+8):c.IsOpera?e.indexOf("version/")!=-1?t=n(e.substring(e.indexOf("version/")+8)):t=n(e.substring(0,e.indexOf("(")).replace("opera/","")):c.IsIOS5?t=e.match(/applewebkit\/(\d*)/)[1]:c.IsSafari?t=e.match(/version\/([\d|.]*)/i)[1]:c.IsChrome&&(t=parseInt(e.substring(e.indexOf("safari/")+7))),String(t)}(),p=function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("linux")!=-1?"Linux":c.IsIOS5?"IOS5":e.indexOf("macintosh")!=-1?"Macintosh":e.indexOf("nt 6.0")!=-1?"Windows Vista/Server 2008":e.indexOf("nt 5.2")!=-1?"Windows Server 2003":e.indexOf("nt 5.1")!=-1?"Windows XP":e.indexOf("nt 5.0")!=-1?"Windows 2000":e.indexOf("nt")!=-1?"Windows NT":e.indexOf("9x 4.90")!=-1?"Windows Me":e.indexOf("98")!=-1?"Windows 98":e.indexOf("95")!=-1?"Windows 95":e.indexOf("win16")!=-1?"Windows 3.x":e.indexOf("windows")!=-1?"Windows":""}(),d={ERR_NO_IMAGE:"ERR_NO_IMAGE",ERR_FILE_SIZE_LIMIT:"ERR_FILE_SIZE_LIMIT",ERR_NO_FILE_SELECTED:"ERR_NO_FILE_SELECTED"};return{err:d,useragent:{info:c,version:h,os:p},cache:n,requirePromise:a,lang:r,tmpl:u,Promise:i,util:l}}),define("app/classes/Base",["underscore"],function(_){var initializing=!1,fnTest=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,Class=function(){},__classes__={hash:{},parentmap:{}};Class.extend=function(prop,to){if(!to){prop.classname||(prop.classname="Class");var _super=this.prototype;initializing=!0;var prototype=new this;initializing=!1;for(var name in prop)prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?function(e,t){return function(){var n=this._super;this._super=_super[e];var r=t.apply(this,arguments);return this._super=n,r}}(name,prop[name]):prop[name];var str="function {{Class}}() {if(!initializing && this.construct )this.construct.apply(this, arguments);}{{Class}}.prototype = prototype;{{Class}}.prototype.constructor = {{Class}};{{Class}}.extend = arguments.callee;var tmp = {{Class}};";return str=str.replace(/{{Class}}/g,prop.classname),eval(str),__classes__.hash[prop.classname]=tmp.prototype,__classes__.parentmap[prop.classname]=this.prototype,tmp}var from=prop,result=from.extend(to);return to.classname&&(__classes__.hash[to.classname]=result.prototype,__classes__.parentmap[to.classname]=from.prototype),result};var ClassManager=Class.extend({__classes_hash:__classes__.hash,__classes_parentmap:__classes__.parentmap,getClass:function(e){return this.__classes_hash[e]},getSuperclass:function(e){if(this.getClass(e))return this.__classes_parentmap[e]}});Class.classManager=new ClassManager,Class.define=function(e,t){t.classname=e;var n=this.classManager.getClass(t.extend);return delete t.extend,n.extend(t)};var level=0,indent=function(){var e="";for(var t=0;t<level;t++)e+="   ";return e+level},extend_deeper=function obj_extender(e,t){return t&&_.each(t,function(t,n){if(typeof e[n]!="undefined")if(typeof e[n]!="object")e[n]=t;else{var r={};obj_extender(r,e[n]),typeof t=="object"?r=obj_extender(r,t):r=t,e[n]=r}else e[n]=t}),e};_.extend_deeper=extend_deeper;var cls_uid=0,Base=Class.extend({classname:"Base",construct:function(e){this.initConfig={},_.extend(this,e),_.extend_deeper(this.initConfig,e),this.id=e.id||this.classname+"_"+cls_uid++},getConfig:function(){return this.initConfig},superclass:function(){return Class.classManager.getSuperclass(this.classname)},getAllProps:function(e){var t=this,n=[];while(t&&t.classname)n.push(t),t=t.superclass();n.reverse();var r={};_.each(n,function(t){r=_.extend_deeper(r,t[e])});if(!_.isEmpty(r))return r},init:function(){},destroy:function(){console.log("destroy!!!!!",this)}});return Base.classes=Class.classManager,Base}),define("app/classes/Observable",["underscore","app/classes/Base"],function(e,t){var n=t.extend({classname:"Observable",construct:function(e){this._super(e),this._events={},this._suspendedEvents={},this.init()},init:function(e){this.initEvents()},addEventListener:function(e,t,n){var r=this;r._events[e]||(r._events[e]=[]),r._events[e].push({scope:n,handler:t})},on:function(e,t,n){this.addEventListener(e,t,n)},fireEvent:function(e){var t=this,n;if(t._events[e]&&t._events[e].length>0)for(var r=0;r<t._events[e].length;r++){var i=t._events[e][r],s=!1;t._suspendedEvents[e]||(s=!0);if(s&&typeof i.handler=="function"){var o=[];for(var r=0;r<arguments.length;r++)o.push(arguments[r]);o.shift(),n=i.handler.apply(i.scope||this,o)}}return n},suspendEvent:function(e){var t=this;t.classname==AppConstants.classname.Application?t._suspendedEvents[e]=!0:(t._suspendedEvents[e]=!0,t.events&&(t.events._suspended||(t.events._suspended={}),t.events._suspended[e]=!0))},resumeEvent:function(e){var t=this;t.classname==AppConstants.classname.Application?(t._suspendedEvents[e]=null,delete t._suspendedEvents[e]):(t._suspendedEvents[e]=null,t.events&&(t.events._suspended||(t.events._suspended={}),t.events._suspended[e]=null,delete t.events._suspended[e]))},getTarget:function(){return this.dom||null},initEvents:function(){var e=this,t=this.getAllProps("events");e.events=t,e.events&&$.each(e.events,function(t,n){e.addEventListener(t,n,e)})}});return n}),define("app/classes/ui/UIElement",["jquery","underscore","app/lib/promise","app/classes/Observable"],function(e,t,n,r){var i=0,s=r.extend({classname:"UIElement",defaultConfig:{renderTo:"body",template:{cls:"ui-element",tpl:""}},events:{render:function(){}},construct:function(n){n=n||{},n.renderTo=n.renderTo||this.renderTo||this.defaultConfig.renderTo;var r=JSON.parse(JSON.stringify(this.getAllProps("defaultConfig")||{}));n=t.extend_deeper(r,n);var s=this.template||{};s=t.extend_deeper(r.template,s),s=t.extend_deeper(s,n.template),n.template=s;var o="ui-elements-";if(!n.id&&!this.id){var u=0;u=i++;while(document.getElementById(o+ ++u));n.id=o+ ++u}this.rendered=!1;var a=!!n.clearWrapper;a&&e(n.renderTo).html(""),this._super(n),this.fireEvent("construct",this)},init:function(e){this._super(e);var t=document.getElementById(this.id);t?(this.dom=t,this.rendered=!0):(this.rendered=!1,this.container&&this.render())},getDom:function(){return this.dom},getBody:function(){var t=e(this.dom),n=e(this.dom).find(">."+this.template.bodyCls);return n.length==1?n.get(0):t.get(0)},setContent:function(t){var n=this.initConfig,r=n.renderTo;typeof r=="string"?r=e(r):r instanceof s&&(r=e(renderTarget.getBody()));if(r.length){var i=t;typeof i=="string"&&(i=e(t).get(0)),i.id=this.id,r.get(0).appendChild(i),this.dom=i}},getTemplateConfig:function(){return this.initConfig.template},render:function(t){return t=t||this.initConfig,this.rendered&&this.dom?(this.fireEvent("render",e(this.com)),n.resolve(e(this.com))):(this.dom||(this.rendered=!1),new n(function(n,r){if(!this.rendered){this.setContent(t.template.tpl),this.rendered=!0;var i=e(this.dom);this.fireEvent("render",i),n(i)}else this.fireEvent("render",i)}.bind(this)))},setApplication:function(e){this._app=e},getApplication:function(){return this._app},destroy:function(){e(this.dom).remove(),this.dom=null}});return s}),define("app/classes/Application",["jquery","underscore","app/classes/Observable","app/classes/ui/UIElement"],function(e,t,n,r){var i=n.extend({classname:"Application",construct:function(e){e.ui&&(this.panel=new r(e.ui)),this._super(e)},render:function(){var e=this;return this.panel.render().then(function(){return e.fireEvent("render",e.panel),e.panel})},launch:function(){e(function(){e(".NHIE-loading-prepare-mask .message p").html("Rendering UI..")}),this.render()},__data__:{},data:function(e,t){var n=this.__data__;if(typeof t=="undefined")return n[e];n[e]=t}});return i}),define("app/classes/History",["underscore","jquery","app/classes/Observable"],function(e,t,n){var r=n.extend({classname:"History",__history_inventory__:[],reset:function(){this.__history_inventory__=[],this.__current_index=-1},undo:function(){this.__current_index>0&&this.applyHistoryItem(this.__current_index-1)},redo:function(){this.__history_inventory__[this.__current_index+1]&&this.applyHistoryItem(this.__current_index+1)},saveHistory:function(){console.error("save history!!");var e=NHIE.workspace.getSize(),n=t(".workspace-contents .workspace-contents-wrapper .layer-wrapper").html(),r={size:e,content:n};if(!(this.__current_index<0)){var i=this.__history_inventory__.slice(0,this.__current_index+1);this.__history_inventory__=i}this.__history_inventory__.push(r),this.__current_index=this.__history_inventory__.length-1},getCurrentHistoryItem:function(){var e=this.__current_index;return this.__history_inventory__[e]},applyHistoryItem:function(e){var t=this.__history_inventory__[e];t&&(NHIE.workspace.reload({size:t.size,content:t.content}),this.__current_index=e)}});return r}),define("text!resources/tpl/ui/ui-toolbar.tpl.html",[],function(){return'<div class="toolbar-wrap">\r\n	<div class="button add-photo" data-action="add-image">\r\n		<i aria-hidden="true" class="fa fa-fw fa-camera"></i>\r\n		<span class=""> <%=NHIE_Lang.PluginImageEditor_addPhoto%></span>\r\n		<form name="file-input-form">\r\n			<input type="file" class="fff file-input file-input-add-photo" name="add-photo" accept=".jpg, .png, .gif, .bmp"/>\r\n			<button type="reset" style="display:none"></button>\r\n		</form>\r\n		<div class="" style="position:absolute; left:0px;top:0px;">\r\n			<object id="file-object" class="file-input file-input-add-photo"></object>\r\n		</div>\r\n	</div>\r\n	<div class="tools-main"></div>\r\n	<div class="tools-info">\r\n		<span class="info info-workspace-size">\r\n			<i aria-hidden="true" class="fa fa-cog"></i>\r\n			<span class="content">W: 1024px, H: 768px</span>\r\n		</span>\r\n	</div>\r\n</div>\r\n'}),define("text!resources/tpl/ui/ui-toolbar-button.tpl.html",[],function(){return'<button class="<%=data.cls%>" data-action="<%=data.action%>" data-btn-type="<%=data.type%>" title="<%=data.title%>">\r\n	<i aria-hidden="true" class="<%=data.iconCls%>"></i>\r\n</button>\r\n'}),define("text!resources/tpl/ui/property/ui-property-item.common.text-attributes.tpl.html",[],function(){return'<div class="text-attributes">\r\n	<div class="item-tpl" data-form-tpl="text-attr-fontFamily" style="display:none;">\r\n		<span data-cps-lang="&lt;%=data.langCode%&gt;" style="font-family:&lt;%=data.label%&gt;">&lt;%=data.label%&gt;</span>\r\n	</div>\r\n	<select name="font-family" id="text-attr-fontFamily" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_font_family\']%>">\r\n		<% for (var i=0; i<data.fontFamilyList.length; i++) { %>\r\n		<option value="<%=data.fontFamilyList[i].value%>"><%=data.fontFamilyList[i].title%></option>\r\n		<% } %>\r\n	</select>\r\n	<!--\r\n title="<%=NHIE_Lang[\'\']%>"\r\n	-->\r\n	<select name="font-size" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_font_size\']%>">\r\n		<% for (var i=0;i<data.fontSizeList.length;i++) { %>\r\n		<option value="<%=data.fontSizeList[i]%><%=data.fontSizeUnit%>"><%=data.fontSizeList[i]%><%=data.fontSizeUnit%></option>\r\n		<% } %>\r\n	</select>\r\n\r\n	<div class="button-group">\r\n		<button class="button" data-action="bold" data-btn-type="toggle" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_bold\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-bold"></i>\r\n		</button>\r\n		<button class="button" data-action="italic" data-btn-type="toggle"  title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_italic\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-italic"></i>\r\n		</button>\r\n		<button class="button" data-action="underline" data-btn-type="toggle"  title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_underline\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-underline"></i>\r\n		</button>\r\n	</div>\r\n	<div class="button-group">\r\n		<button class="button on" data-action="align-left" data-btn-type="toggle" data-toggle-group="align" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_align_left\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-align-left"></i>\r\n		</button>\r\n		<button class="button" data-action="align-center" data-btn-type="toggle" data-toggle-group="align" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_align_center\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-align-center"></i>\r\n		</button>\r\n		<button class="button" data-action="align-right" data-btn-type="toggle" data-toggle-group="align" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_align_right\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-align-right"></i>\r\n		</button>\r\n		<!--\r\n		<button class="button" data-action="align-justify" data-btn-type="toggle" data-toggle-group="align" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_align_justify\']%>">\r\n			<i aria-hidden="true" class="fa fa-fw fa-align-justify"></i>\r\n		</button>\r\n		-->\r\n	</div>\r\n	<div class="button-group" style="clear:both;">\r\n		<button class="button" data-action="color" title="<%=NHIE_Lang[\'PluginImageEditor_text_attr_color\']%>">\r\n			<span class="color"></span>\r\n		</button>\r\n	</div>\r\n</div>\r\n'}),function(e,t,n){function c(e,t,n){var r=[];for(var i=0;i<e.length;i++){var s=e[i];if(s){var o=tinycolor(s),a=o.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";a+=tinycolor.equals(t,s)?" sp-thumb-active":"";var f=u?"background-color:"+o.toRgbString():"filter:"+o.toFilter();r.push('<span title="'+o.toRgbString()+'" data-color="'+o.toRgbString()+'" class="'+a+'"><span class="sp-thumb-inner" style="'+f+';" /></span>')}else{var l="sp-clear-display";r.push('<span title="No Color Selected" data-color="" style="background-color:transparent;" class="'+l+'"></span>')}}return"<div class='sp-cf "+n+"'>"+r.join("")+"</div>"}function h(){for(var e=0;e<s.length;e++)s[e]&&s[e].hide()}function p(e,n){var r=t.extend({},i,e);return r.callbacks={move:y(r.move,n),change:y(r.change,n),show:y(r.show,n),hide:y(r.hide,n),beforeShow:y(r.beforeShow,n)},r}function d(r,i){function Ct(){d.showPaletteOnly&&(d.showPalette=!0),Q.toggleClass("sp-flat",m),Q.toggleClass("sp-input-disabled",!d.showInput),Q.toggleClass("sp-alpha-enabled",d.showAlpha),Q.toggleClass("sp-clear-enabled",St),Q.toggleClass("sp-buttons-disabled",!d.showButtons),Q.toggleClass("sp-palette-disabled",!d.showPalette),Q.toggleClass("sp-palette-only",d.showPaletteOnly),Q.toggleClass("sp-initial-disabled",!d.showInitial),Q.addClass(d.className),Vt()}function kt(){function s(e){return e.data&&e.data.ignore?(It(t(this).data("color")),Ut()):(It(t(this).data("color")),Xt(!0),Ut(),jt()),!1}o&&Q.find("*:not(input)").attr("unselectable","on"),Ct(),ht&&J.after(pt).hide(),St||at.hide();if(m)J.after(Q).hide();else{var n=d.appendTo==="parent"?J.parent():t(d.appendTo);n.length!==1&&(n=t("body")),n.append(Q)}if(S&&e.localStorage){try{var r=e.localStorage[S].split(",#");r.length>1&&(delete e.localStorage[S],t.each(r,function(e,t){Lt(t)}))}catch(i){}try{R=e.localStorage[S].split(";")}catch(i){}}dt.bind("click.spectrum touchstart.spectrum",function(e){K||Ht(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(J.is(":disabled")||d.disabled===!0)&&Qt(),Q.click(g),it.change(Pt),it.bind("paste",function(){setTimeout(Pt,1)}),it.keydown(function(e){e.keyCode==13&&Pt()}),ut.text(NHIE.Lang.PluginBtnCancel),ut.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),jt("cancel")}),at.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),Et=!0,Ut(),m&&Xt(!0)}),Tt.bind("click.spectrum",function(e){e.stopPropagation(),Nt(t(this).is(":checked"))}),xt.bind("click.spectrum",function(e){e.preventDefault();var t=Tt.is(":checked");t=!t,Tt.attr("checked",t),Tt.get(0).checked=t,console.log(t,Tt.is(":checked")),Nt(t)}),xt.find("span").text(NHIE.Lang.PluginBtnMoreDisplay),ft.text(NHIE.Lang.PluginBtnConfirm),ft.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),Rt()&&(Xt(!0),jt())}),b(nt,function(e,t,n){F=e/_,Et=!1,n.shiftKey&&(F=Math.round(F*10)/10),Ut()}),b(Z,function(e,t){H=parseFloat(t/O),Et=!1,Ut()},_t,Dt),b(G,function(e,t,n){if(!n.shiftKey)W=null;else if(!W){var r=B*k,i=L-j*L,s=Math.abs(e-r)>Math.abs(t-i);W=s?"x":"y"}var o=!W||W==="x",u=!W||W==="y";o&&(B=parseFloat(e/k)),u&&(j=parseFloat((L-t)/L)),Et=!1,Ut()},_t,Dt),mt?(It(mt),zt(),bt=yt||tinycolor(mt).format,Lt(mt)):zt(),m&&Bt();var u=o?"mousedown.spectrum":"click.spectrum touchstart.spectrum";st.delegate(".sp-thumb-el",u,s),ot.delegate(".sp-thumb-el:nth-child(1)",u,{ignore:!0},s)}function Lt(n){if(y){var r=tinycolor(n).toRgbString();if(t.inArray(r,R)===-1){R.push(r);while(R.length>U)R.shift()}if(S&&e.localStorage)try{e.localStorage[S]=R.join(";")}catch(i){}}}function At(){var e=[],t=R,n={},r;if(d.showPalette){for(var i=0;i<q.length;i++)for(var s=0;s<q[i].length;s++)r=tinycolor(q[i][s]).toRgbString(),n[r]=!0;for(i=0;i<t.length;i++)r=tinycolor(t[i]).toRgbString(),n.hasOwnProperty(r)||(e.push(t[i]),n[r]=!0)}return e.reverse().slice(0,d.maxSelectionSize)}function Ot(){var e=qt(),n=t.map(q,function(t,n){return c(t,e,"sp-palette-row sp-palette-row-"+n)});R&&n.push(c(At(),e,"sp-palette-row sp-palette-row-selection")),st.html(n.join(""))}function Mt(){if(d.showInitial){var e=gt,t=qt();ot.html(c([e,t],t,"sp-palette-row-initial"))}}function _t(){(L<=0||k<=0||O<=0)&&Vt(),Q.addClass(z),W=null}function Dt(){Q.removeClass(z)}function Pt(){var e=it.val();if(e!==null&&e!==""||!St){var t=tinycolor(e);t.ok?It(t):it.addClass("sp-validation-error")}else It(null)}function Ht(){C?jt():Bt()}function Bt(){var n=t.Event("beforeShow.spectrum");if(C){Vt();return}J.trigger(n,[qt()]);if(T.beforeShow(qt())===!1||n.isDefaultPrevented())return;h(),C=!0,Tt.attr("checked",!1),t(X).bind("click.spectrum",jt),t(e).bind("resize.spectrum",N),pt.addClass("sp-active"),Q.removeClass("sp-hidden"),d.showPalette&&Ot(),Vt(),zt(),gt=qt(),Mt(),T.show(gt),J.trigger("show.spectrum",[gt]),t("#property_cp").addClass("holding")}function jt(n){if(w)return!1;if(n&&n.type=="click"&&n.button==2)return;if(!C||m)return;C=!1,t(X).unbind("click.spectrum",jt),t(e).unbind("resize.spectrum",N),pt.removeClass("sp-active"),Q.addClass("sp-hidden");var r=!tinycolor.equals(qt(),gt);r&&(wt&&n!=="cancel"?Xt(!0):Ft()),T.hide(qt()),t("#property_cp").removeClass("holding"),J.trigger("hide.spectrum",[qt()])}function Ft(){It(gt,!0)}function It(e,t){if(tinycolor.equals(e,qt()))return;var n;if(!e&&St)Et=!0;else{Et=!1,n=tinycolor(e);var r=n.toHsv();H=r.h%360/360,B=r.s,j=r.v,F=r.a}zt(),n&&n.ok&&!t&&(bt=yt||n.format)}function qt(e){return e=e||{},St&&Et?null:tinycolor.fromRatio({h:H,s:B,v:j,a:Math.round(F*100)/100},{format:e.format||bt})}function Rt(){return!it.hasClass("sp-validation-error")}function Ut(){zt(),T.move(qt()),J.trigger("move.spectrum",[qt()])}function zt(){it.removeClass("sp-validation-error"),Wt();var e=tinycolor.fromRatio({h:H,s:1,v:1});G.css("background-color",e.toHexString());var t=bt;F<1&&(t==="hex"||t==="hex3"||t==="hex6"||t==="name")&&(t="rgb");var n=qt({format:t}),r="";vt.removeClass("sp-clear-display"),vt.css("background-color","transparent");if(!n&&St)vt.addClass("sp-clear-display");else{var i=n.toHexString(),s=n.toRgbString();u||n.alpha===1?vt.css("background-color",s):(vt.css("background-color","transparent"),vt.css("filter",n.toFilter()));if(d.showAlpha){var o=n.toRgb();o.a=0;var a=tinycolor(o).toRgbString(),f="linear-gradient(left, "+a+", "+i+")";tt.css("background","-webkit-"+f),tt.css("background","-moz-"+f),tt.css("background","-ms-"+f),tt.css("background",f)}r=n.toString(t)}d.showInput&&it.val(r),d.showPalette&&Ot(),Nt(),Mt()}function Wt(){var e=B,t=j;if(St&&Et)rt.hide(),et.hide(),Y.hide();else{rt.show(),et.show(),Y.show();var n=e*k,r=L-t*L;n=Math.max(-A,Math.min(k-A,n-A)),r=Math.max(-A,Math.min(L-A,r-A)),Y.css({top:r,left:n});var i=F*_;rt.css({left:i-D/2});var s=H*O;et.css({top:s-P})}}function Xt(e){var t=qt(),n="",r=!0;t&&(n=t.toString(bt),Lt(t)),lt&&J.val(n),gt=t,e&&r&&(T.change(t),J.trigger("change",[t]))}function Vt(){k=G.width(),L=G.height(),A=Y.height(),M=Z.width(),O=Z.height(),P=et.height(),_=nt.width(),D=rt.width(),m||(Q.css("position","absolute"),Q.offset(v(Q,dt))),Wt()}function $t(){J.show(),dt.unbind("click.spectrum touchstart.spectrum"),Q.remove(),pt.remove(),s[Gt.id]=null}function Jt(e,r){if(e===n)return t.extend({},d);if(r===n)return d[e];d[e]=r,Ct()}function Kt(){K=!1,J.attr("disabled",!1),dt.removeClass("sp-disabled")}function Qt(){jt(),K=!0,J.attr("disabled",!0),dt.addClass("sp-disabled")}var d=p(i,r),m=d.flat,y=d.showSelectionPalette,S=d.localStorageKey,x=d.theme,T=d.callbacks,N=E(Vt,10),C=!1,k=0,L=0,A=0,O=0,M=0,_=0,D=0,P=0,H=0,B=0,j=0,F=1,I=d.palette.slice(0),q=t.isArray(I[0])?I:[I],R=d.selectionPalette.slice(0),U=d.maxSelectionSize,z="sp-dragging",W=null;d.showPalette=!0;var X=r.ownerDocument,V=X.body,J=t(r),K=!1,Q=t(l,X).addClass(x),G=Q.find(".sp-color"),Y=Q.find(".sp-dragger"),Z=Q.find(".sp-hue"),et=Q.find(".sp-slider"),tt=Q.find(".sp-alpha-inner"),nt=Q.find(".sp-alpha"),rt=Q.find(".sp-alpha-handle"),it=Q.find(".sp-input"),st=Q.find(".sp-palette"),ot=Q.find(".sp-initial"),ut=Q.find(".sp-cancel"),at=Q.find(".sp-clear"),ft=Q.find(".sp-choose"),lt=J.is("input"),ct=lt&&a&&J.attr("type")==="color",ht=lt&&!m,pt=ht?t(f).addClass(x).addClass(d.className):t([]),dt=ht?pt:J,vt=pt.find(".sp-preview-inner"),mt=d.color||lt&&J.val(),gt=!1,yt=d.preferredFormat,bt=yt,wt=!d.showButtons||d.clickoutFiresChange,Et=!mt,St=d.allowEmpty&&!ct,xt=t(".sp-button-container-more label",Q),Tt=t(".sp-button-container-more>label>input.sp-more-color",Q),Nt=function(e){typeof e=="undefined"&&(e=Tt.is(":checked"));var n=t(".sp-palette-container",Q),r=t(".sp-picker-container",Q),i=function(e){return e?"block":"none"};n.css("display",i(!e)),r.css("display",i(e)),Vt()};kt();var Gt={show:Bt,hide:jt,toggle:Ht,reflow:Vt,option:Jt,enable:Kt,disable:Qt,set:function(e){It(e),Xt()},get:qt,destroy:$t,container:Q};return Gt.id=s.push(Gt)-1,Gt}function v(e,n){var r=0,i=e.outerWidth(),s=e.outerHeight(),o=n.outerHeight(),u=e[0].ownerDocument,a=u.documentElement,f=a.clientWidth+t(u).scrollLeft(),l=a.clientHeight+t(u).scrollTop(),c=n.offset();return c.top+=o,c.left-=Math.min(c.left,c.left+i>f&&f>i?Math.abs(c.left+i-f):0),c.top-=Math.min(c.top,c.top+s>l&&l>s?Math.abs(s+o-r):r),c}function m(){}function g(e){e.stopPropagation()}function y(e,t){var n=Array.prototype.slice,r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}function b(n,r,i,s){function d(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function v(e){if(a){if(o&&document.documentMode<9&&!e.button)return g();var t=e.originalEvent.touches,i=t?t[0].pageX:e.pageX,s=t?t[0].pageY:e.pageY,u=Math.max(0,Math.min(i-f.left,c)),p=Math.max(0,Math.min(s-f.top,l));h&&d(e),r.apply(n,[u,p,e])}}function m(e){var r=e.which?e.which==3:e.button==2,s=e.originalEvent.touches;!r&&!a&&i.apply(n,arguments)!==!1&&(a=!0,w=!0,l=t(n).height(),c=t(n).width(),f=t(n).offset(),t(u).bind(p),t(u.body).addClass("sp-dragging"),h||v(e),d(e))}function g(){a&&(t(u).unbind(p),t(u.body).removeClass("sp-dragging"),s.apply(n,arguments),setTimeout(function(){w=!1},100)),a=!1}r=r||function(){},i=i||function(){},s=s||function(){};var u=n.ownerDocument||document,a=!1,f={},l=0,c=0,h="ontouchstart"in e,p={};p.selectstart=d,p.dragstart=d,p["touchmove mousemove"]=v,p["touchend mouseup"]=g,t(n).bind("touchstart mousedown",m)}function E(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,e.apply(i,s)};n&&clearTimeout(r);if(n||!r)r=setTimeout(o,t)}}function S(){e.console&&(Function.prototype.bind?S=Function.prototype.bind.call(console.log,console):S=function(){Function.prototype.apply.call(console.log,console,arguments)},S.apply(this,arguments))}var r=[["rgb(0, 0, 0)","rgb(67, 67, 67)","rgb(102, 102, 102)","rgb(204, 204, 204)","rgb(217, 217, 217)","rgb(255, 255, 255)"],["rgb(152, 0, 0)","rgb(255, 0, 0)","rgb(255, 153, 0)","rgb(255, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 255)","rgb(74, 134, 232)","rgb(0, 0, 255)","rgb(153, 0, 255)","rgb(255, 0, 255)"],["rgb(230, 184, 175)","rgb(244, 204, 204)","rgb(252, 229, 205)","rgb(255, 242, 204)","rgb(217, 234, 211)","rgb(208, 224, 227)","rgb(201, 218, 248)","rgb(207, 226, 243)","rgb(217, 210, 233)","rgb(234, 209, 220)","rgb(221, 126, 107)","rgb(234, 153, 153)","rgb(249, 203, 156)","rgb(255, 229, 153)","rgb(182, 215, 168)","rgb(162, 196, 201)","rgb(164, 194, 244)","rgb(159, 197, 232)","rgb(180, 167, 214)","rgb(213, 166, 189)","rgb(204, 65, 37)","rgb(224, 102, 102)","rgb(246, 178, 107)","rgb(255, 217, 102)","rgb(147, 196, 125)","rgb(118, 165, 175)","rgb(109, 158, 235)","rgb(111, 168, 220)","rgb(142, 124, 195)","rgb(194, 123, 160)","rgb(166, 28, 0)","rgb(204, 0, 0)","rgb(230, 145, 56)","rgb(241, 194, 50)","rgb(106, 168, 79)","rgb(69, 129, 142)","rgb(60, 120, 216)","rgb(61, 133, 198)","rgb(103, 78, 167)","rgb(166, 77, 121)","rgb(91, 15, 0)","rgb(102, 0, 0)","rgb(120, 63, 4)","rgb(127, 96, 0)","rgb(39, 78, 19)","rgb(12, 52, 61)","rgb(28, 69, 135)","rgb(7, 55, 99)","rgb(32, 18, 77)","rgb(76, 17, 48)"]],i={beforeShow:m,move:m,change:m,show:m,hide:m,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!1,showInitial:!1,showPalette:!0,showPaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:10,cancelText:"cancel",chooseText:"choose",preferredFormat:!1,className:"",showAlpha:!1,theme:"sp-light",palette:r,selectionPalette:[],disabled:!1},s=[],o=!!/msie/i.exec(e.navigator.userAgent),u=function(){function e(e,t){return!!~(""+e).indexOf(t)}var t=document.createElement("div"),n=t.style;return n.cssText="background-color:rgba(0,0,0,.5)",e(n.backgroundColor,"rgba")||e(n.backgroundColor,"hsla")}(),a=function(){var e=t("<input type='color' value='!' />")[0];return e.type==="color"&&e.value!=="!"}(),f=["<div class='sp-replacer'>","</div>"].join(""),l=function(){var e="";if(o)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden' style='z-index:99999999999'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display' title='Clear Color Selection'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false'  />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button class='sp-choose'>test</button>","</div>","</div>","<div class='sp-button-container sp-button-container-more sp-cf'>","<label for='morecolor'><input class='sp-more-color' type='checkbox' name='morecolor'/><span>Show more color<span></label>","</div>","</div>"].join("")}(),w=!1,x="spectrum.id";t.fn.spectrum=function(e,n){if(typeof e=="string"){var r=this,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=s[t(this).data(x)];if(n){var o=n[e];if(!o)throw new Error("Spectrum: no such method: '"+e+"'");e=="get"?r=n.get():e=="container"?r=n.container:e=="option"?r=n.option.apply(n,i):e=="destroy"?(n.destroy(),t(this).removeData(x)):o.apply(n,i)}}),r}return this.spectrum("destroy").each(function(){var n=d(this,e);t(this).data(x,n.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=b,t.fn.spectrum.defaults=i,t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.spectrum.hideAll=h,t.fn.spectrum.processNativeColorInputs=function(){a||t("input[type=color]").spectrum({preferredFormat:"hex6"})},function(){function f(e,t){e=e?e:"",t=t||{};if(typeof e=="object"&&e.hasOwnProperty("_tc_id"))return e;var n=l(e),i=n.r,o=n.g,u=n.b,a=n.a,c=s(100*a)/100,p=t.format||n.format;return i<1&&(i=s(i)),o<1&&(o=s(o)),u<1&&(u=s(u)),{ok:n.ok,format:p,_tc_id:r++,alpha:a,getAlpha:function(){return a},setAlpha:function(e){a=w(e),c=s(100*a)/100},toHsv:function(){var e=d(i,o,u);return{h:e.h*360,s:e.s,v:e.v,a:a}},toHsvString:function(){var e=d(i,o,u),t=s(e.h*360),n=s(e.s*100),r=s(e.v*100);return a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+c+")"},toHsl:function(){var e=h(i,o,u);return{h:e.h*360,s:e.s,l:e.l,a:a}},toHslString:function(){var e=h(i,o,u),t=s(e.h*360),n=s(e.s*100),r=s(e.l*100);return a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+c+")"},toHex:function(e){return m(i,o,u,e)},toHexString:function(e){return"#"+m(i,o,u,e)},toRgb:function(){return{r:s(i),g:s(o),b:s(u),a:a}},toRgbString:function(){return a==1?"rgb("+s(i)+", "+s(o)+", "+s(u)+")":"rgba("+s(i)+", "+s(o)+", "+s(u)+", "+c+")"},toPercentageRgb:function(){return{r:s(E(i,255)*100)+"%",g:s(E(o,255)*100)+"%",b:s(E(u,255)*100)+"%",a:a}},toPercentageRgbString:function(){return a==1?"rgb("+s(E(i,255)*100)+"%, "+s(E(o,255)*100)+"%, "+s(E(u,255)*100)+"%)":"rgba("+s(E(i,255)*100)+"%, "+s(E(o,255)*100)+"%, "+s(E(u,255)*100)+"%, "+c+")"},toName:function(){return a===0?"transparent":y[m(i,o,u,!0)]||!1},toFilter:function(e){var n=m(i,o,u),r=n,s=Math.round(parseFloat(a)*255).toString(16),l=s,c=t&&t.gradientType?"GradientType = 1, ":"";if(e){var h=f(e);r=h.toHex(),l=Math.round(parseFloat(h.alpha)*255).toString(16)}return"progid:DXImageTransform.Microsoft.gradient("+c+"startColorstr=#"+C(s)+n+",endColorstr=#"+C(l)+r+")"},toString:function(e){var t=!!e;e=e||this.format;var n=!1,r=!t&&a<1&&a>0,i=r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="name");e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString());if(e==="hex"||e==="hex6")n=this.toHexString();return e==="hex3"&&(n=this.toHexString(!0)),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),i?this.toRgbString():n||this.toHexString()}}}function l(e){var t={r:0,g:0,b:0},n=1,r=!1,i=!1;return typeof e=="string"&&(e=A(e)),typeof e=="object"&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(t=c(e.r,e.g,e.b),r=!0,i=String(e.r).substr(-1)==="%"?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=k(e.s),e.v=k(e.v),t=v(e.h,e.s,e.v),r=!0,i="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=k(e.s),e.l=k(e.l),t=p(e.h,e.s,e.l),r=!0,i="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=w(n),{ok:r,format:e.format||i,r:o(255,u(t.r,0)),g:o(255,u(t.g,0)),b:o(255,u(t.b,0)),a:n}}function c(e,t,n){return{r:E(e,255)*255,g:E(t,255)*255,b:E(n,255)*255}}function h(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=u(e,t,n),i=o(e,t,n),s,a,f=(r+i)/2;if(r==i)s=a=0;else{var l=r-i;a=f>.5?l/(2-r-i):l/(r+i);switch(r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4}s/=6}return{h:s,s:a,l:f}}function p(e,t,n){function o(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var r,i,s;e=E(e,360),t=E(t,100),n=E(n,100);if(t===0)r=i=s=n;else{var u=n<.5?n*(1+t):n+t-n*t,a=2*n-u;r=o(a,u,e+1/3),i=o(a,u,e),s=o(a,u,e-1/3)}return{r:r*255,g:i*255,b:s*255}}function d(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=u(e,t,n),i=o(e,t,n),s,a,f=r,l=r-i;a=r===0?0:l/r;if(r==i)s=0;else{switch(r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4}s/=6}return{h:s,s:a,v:f}}function v(e,t,n){e=E(e,360)*6,t=E(t,100),n=E(n,100);var r=i.floor(e),s=e-r,o=n*(1-t),u=n*(1-s*t),a=n*(1-(1-s)*t),f=r%6,l=[n,u,o,o,a,n][f],c=[a,n,n,u,o,o][f],h=[o,o,a,n,n,u][f];return{r:l*255,g:c*255,b:h*255}}function m(e,t,n,r){var i=[C(s(e).toString(16)),C(s(t).toString(16)),C(s(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function b(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function w(e){e=parseFloat(e);if(isNaN(e)||e<0||e>1)e=1;return e}function E(e,t){T(e)&&(e="100%");var n=N(e);return e=o(t,u(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),i.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function S(e){return o(1,u(0,e))}function x(e){return parseInt(e,16)}function T(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function N(e){return typeof e=="string"&&e.indexOf("%")!=-1}function C(e){return e.length==1?"0"+e:""+e}function k(e){return e<=1&&(e=e*100+"%"),e}function A(e){e=e.replace(t,"").replace(n,"").toLowerCase();var r=!1;if(g[e])e=g[e],r=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=L.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=L.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=L.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=L.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=L.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=L.hex6.exec(e))?{r:x(i[1]),g:x(i[2]),b:x(i[3]),format:r?"name":"hex"}:(i=L.hex3.exec(e))?{r:x(i[1]+""+i[1]),g:x(i[2]+""+i[2]),b:x(i[3]+""+i[3]),format:r?"name":"hex"}:!1}var t=/^[\s,#]+/,n=/\s+$/,r=0,i=Math,s=i.round,o=i.min,u=i.max,a=i.random;f.fromRatio=function(e,t){if(typeof e=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=k(e[r]));e=n}return f(e,t)},f.equals=function(e,t){return!e||!t?!1:f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:a(),g:a(),b:a()})},f.desaturate=function(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s-=t/100,n.s=S(n.s),f(n)},f.saturate=function(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s+=t/100,n.s=S(n.s),f(n)},f.greyscale=function(e){return f.desaturate(e,100)},f.lighten=function(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l+=t/100,n.l=S(n.l),f(n)},f.darken=function(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l-=t/100,n.l=S(n.l),f(n)},f.complement=function(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)},f.triad=function(e){var t=f(e).toHsl(),n=t.h;return[f(e),f({h:(n+120)%360,s:t.s,l:t.l}),f({h:(n+240)%360,s:t.s,l:t.l})]},f.tetrad=function(e){var t=f(e).toHsl(),n=t.h;return[f(e),f({h:(n+90)%360,s:t.s,l:t.l}),f({h:(n+180)%360,s:t.s,l:t.l}),f({h:(n+270)%360,s:t.s,l:t.l})]},f.splitcomplement=function(e){var t=f(e).toHsl(),n=t.h;return[f(e),f({h:(n+72)%360,s:t.s,l:t.l}),f({h:(n+216)%360,s:t.s,l:t.l})]},f.analogous=function(e,t,n){t=t||6,n=n||30;var r=f(e).toHsl(),i=360/n,s=[f(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,s.push(f(r));return s},f.monochromatic=function(e,t){t=t||6;var n=f(e).toHsv(),r=n.h,i=n.s,s=n.v,o=[],u=1/t;while(t--)o.push(f({h:r,s:i,v:s})),s=(s+u)%1;return o},f.readability=function(e,t){var n=f(e).toRgb(),r=f(t).toRgb(),i=(n.r*299+n.g*587+n.b*114)/1e3,s=(r.r*299+r.g*587+r.b*114)/1e3,o=Math.max(n.r,r.r)-Math.min(n.r,r.r)+Math.max(n.g,r.g)-Math.min(n.g,r.g)+Math.max(n.b,r.b)-Math.min(n.b,r.b);return{brightness:Math.abs(i-s),color:o}},f.readable=function(e,t){var n=f.readability(e,t);return n.brightness>125&&n.color>500},f.mostReadable=function(e,t){var n=null,r=0,i=!1;for(var s=0;s<t.length;s++){var o=f.readability(e,t[s]),u=o.brightness>125&&o.color>500,a=3*(o.brightness/125)+o.color/500;if(u&&!i||u&&i&&a>r||!u&&!i&&a>r)i=u,r=a,n=f(t[s])}return n};var g=f.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},y=f.hexNames=b(g),L=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();e.tinycolor=f}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})}(window,jQuery),define("lib/jquery/spectrum",function(){}),define("css",["module"],function(e){if(typeof window=="undefined")return{load:function(e,t,n,r){n();return}};var t=window.document,n=t.body||{},r=function(e){var n=t.createElement("link");return n.type="text/css",n.rel="stylesheet",n.href=e,n.className=i(e),n},i=function(e){var t=e.split("/"),n=t[t.length-1].replace(/\./g,"-")+"-loaded";return n},s={};return{load:function(e,o,u){var a=t.getElementsByTagName("head")[0],f,l,c;f=t.createElement("div"),f.className=i(e),f.style.cssText="position: absolute;left:-9999px;top:-9999px;",n.appendChild(f);if(!s[e]){c=r(e),c.onload=function(){u()},t.getElementsByTagName("link")?a.insertBefore(c,t.getElementsByTagName("link")[0]):a.appendChild(c),s[e]=!0;var h=i(e),l=setInterval(function(){var e=t.styleSheets;for(var r=0,i=e.length;r<i;r++){var s=e[r];if(s.ownerNode.className==h)try{s.addRule?s.addRule("."+h,"height:10px"):s.insertRule&&s.insertRule("."+h,"height:10px"),f.offsetHeight>0&&(n.removeChild(f),clearInterval(l),u())}catch(o){}}},50)}else u()}}}),define("app/plugins/colorpicker",["underscore","jquery","lib/jquery/spectrum","css!css/spectrum.css"],function(e,t){}),define("app/classes/tools/ToolBase",["underscore","jquery","app/classes/Observable","text!resources/tpl/ui/ui-toolbar-button.tpl.html","text!resources/tpl/ui/property/ui-property-item.common.text-attributes.tpl.html","app/plugins/colorpicker"],function(e,t,n,r,i){var s=n.extend({classname:"ToolBase",cls:"button",type:"normal",events:{click:function(){var e=this;if(this.type==="normal")NHIE.toolbar.resetToggle(),this.handle();else if(this.type==="toggle"){var t=!this.$button.hasClass("on");t&&NHIE.toolbar.resetToggle().then(function(){e.fireEvent("toggle",t)}).catch(function(e){console.error(e)})}NHIE.toolbar.resetButtonStatus()},toggle:function(e,t){var n="empty",r=this.name;return e&&(n=r),this.$button.removeClass("on off").addClass(e?"on":"off"),this.toggled=e,t||(NHIE.app.setMode(n),NHIE.app.fireEvent("changemode")),this.handle(this.$button,e)}},onResizeWindow:function(){},getToggleStatus:function(){if(this.type==="toggle")return this.$button.hasClass("on")},handle:function(e,t){return console.log("handle tool action : ",this.name,this.type,t),this.handler(e,t)},render:function(e){var n=this.name.replace(/\-/g,"_"),i={action:this.name,type:this.type,cls:this.cls,iconCls:this.iconCls,title:NHIE.Lang["PluginImageEditor_tool_title_"+n]},s=NHIE.tmpl(r,{data:i}),o=t(s);this.$button=o,e.append(o);var u=this;this.type==="toggle"&&(o.addClass("off"),this.toggled=!1),o.on("click",function(){o.hasClass("disabled")||u.fireEvent("click")})},resetButtonStatus:function(){var e=this.enableStatus()&&NHIE.workspace.getAllLayers().length,t=this.$button;e?(t.removeAttr("disabled"),t.removeClass("enabled disabled").addClass("enabled")):(t.attr("disabled","disabled"),t.removeClass("enabled disabled").addClass("disabled"),this.type==="toggle"&&this.toggled===!0&&this.fireEvent("toggle",!1))},initTextAttributeForm:function(n){var r=this,s=e.map(NHIE.Lang.defaultfont,function(e,t){return{title:e,value:t}}),o={fontFamilyList:s,fontSizeList:NHIE.util.getConfig("resources.font-size"),fontSizeUnit:NHIE.util.getConfig("resources.font-size-unit")},u=NHIE.tmpl(i,{data:o}),a=t(u);return this.$text_attrs=a,a},bindTextAttributeEvents:function(){var e=this,n=this.$text_attrs,r=function(){return e.component.$textEditingArea},i=function(){var e=t(this);e.on("click",function(r){if(t(this).hasClass("disabled"))return r.preventDefault(),!1;var i=!e.hasClass("on"),s=e.data("toggle-group");if(s){var o=n.find("button[data-toggle-group="+s+"]");if(!i)return;n.find("button.on[data-toggle-group="+s+"]").length>0&&n.find("button.on[data-toggle-group="+s+"]").trigger("toggle",!1)}e.trigger("toggle",i)}).on("toggle",function(t,n){e.removeClass("on off").addClass(n?"on":"off")})};t("button[data-btn-type=toggle]",n).each(i),t("button[data-action=bold]",n).on("toggle",function(e,t){r().css("font-weight",t?"bold":"normal")}),t("button[data-action=underline]",n).on("toggle",function(e,t){r().css("text-decoration",t?"underline":"none")}),t("button[data-action=italic]",n).on("toggle",function(e,t){r().css("font-style",t?"italic":"normal")}),t("button[data-action=align-left]",n).on("toggle",function(e,t){r().css("text-align",t?"left":"initial")}),t("button[data-action=align-center]",n).on("toggle",function(e,t){r().css("text-align",t?"center":"initial")}),t("button[data-action=align-right]",n).on("toggle",function(e,t){r().css("text-align",t?"right":"initial")}),t("button[data-action=align-justify]",n).on("toggle",function(e,t){r().css("text-align",t?"justify":"initial")}),t(".sp-container").remove(),t("button[data-action=color]",n).spectrum("destroy").spectrum({showAlpha:!0,flat:!1,showInput:!0,preferredFormat:"rgb",showPalette:!1,showPaletteOnly:!1,chooseText:"Ok",cancelText:"Cancel",showInitial:!0,change:function(e){var n=t(this).spectrum("get");t(this).find("span.color").css("background-color",n.toRgbString());var i=r();i&&i.css("color",n.toRgbString())},show:function(e){}});var s=NHIE.util.getConfig("defaultFontConfig");console.log(s),n.find("select[name=font-family]").find('option[value="'+s.fontFamily+'"]').attr("selected","selected"),n.find("select[name=font-family]").customselectmenu({maxHeight:200,select:function(e,t){var n=r();if(n){var i=t.item.value;n.find("span").css("font-family","inherit"),n.css("font-family",i)}}}).customselectmenu("menuWidget").css({height:200}),n.find("select[name=font-size]").val(s.fontSize),n.find("select[name=font-size]").customselectmenu({maxHeight:200,select:function(e,t){var n=r();if(n){var i=t.item.value;n.find("span").css("font-size","inherit"),n.css("font-size",i)}}}).customselectmenu("menuWidget").css({height:200})},enableTextAttributes:function(e){var t=this.$text_attrs;t&&(typeof e=="undefined"?e=!0:e=!!e,e?(t.find("button").removeClass("disabled"),t.find("select").customselectmenu("enable")):(t.find("button").addClass("disabled"),t.find("select").customselectmenu("disable")))},getTextAttributes:function(){var e=this.$text_attrs;return e?{fontSize:t("select[name=font-size]",e).val(),fontFamily:t("select[name=font-family]",e).val(),bold:t("button[data-action=bold]",e).hasClass("on"),italic:t("button[data-action=italic]",e).hasClass("on"),underline:t("button[data-action=underline]",e).hasClass("on"),alignLeft:t("button[data-action=align-left]",e).hasClass("on"),alignCenter:t("button[data-action=align-center]",e).hasClass("on"),alignRight:t("button[data-action=align-right]",e).hasClass("on"),alignJustify:t("button[data-action=align-justify]",e).hasClass("on"),color:t("button[data-action=color]",e).spectrum("get").toRgbString()}:{}},setTextAttrOnEl:function(e,t){t=t||this.getTextAttributes(),e.css("font-weight",t.bold?"bold":"normal"),e.css("font-style",t.italic?"italic":"normal"),e.css("text-decoration",t.underline?"underline":"none");var n="left";t.alignLeft?n="left":t.alignCenter?n="center":t.alignRight?n="right":t.alignJustify&&(n="justify"),e.css("text-align",n),e.css("color",t.color||"")},renderTextComponentOnCanvas:function(e,n,r,i,s){var o=NHIE.util.getConfig("defaultFontConfig"),u=function(e,t,n,r,i,s){e.save(),e.strokeStyle=s,e.beginPath(),e.moveTo(t,parseInt(n)+.5),e.lineTo(r,parseInt(i)+.5),e.stroke(),e.restore()},a=function(e,t,n,r,i,s){var a=t,f=t,l=n,c=parseInt(s.fontSize||o.fontSize);l+=1+NHIE.lib.useragent.info.IsGecko?2:0,s.alignLeft?(a=t,f=t+r):s.alignCenter?(a=t-r/2,f=t+r/2):s.alignRight&&(a=t-r,f=t),u(e,a,l,f,l,s.color)},f=function(e,t){if(!NHIE.lib.useragent.info.IsGecko||!t.italic)return 0;var n=(e-50)/5+11;return n},l=function(e,t,n,r,i,s,o){var u=n,l=r;o.alignLeft?e.textAlign="left":o.alignCenter?(e.textAlign="center",u=n+i/2):o.alignRight&&(u=n+i,e.textAlign="right");var c=!!o.underline,h=t.split("\\n");for(var p=0;p<h.length;p++){var d="",v=0,m=h[p].split(" "),g=" ";m.length===1&&(m=m[0],g="",m===" "&&(g=" "));for(var y=0;y<m.length;y++){var b=d+m[y]+g,w=e.measureText(b),E=w.width;E>i?(console.log(d,v),e.fillText(d,u+f(l,o),l),c&&a(e,u+f(l,o),l,v,i,o),d=m[y]+g,l+=s):(d=b,v=E)}v=e.measureText(d).width,e.fillText(d,u+f(l,o),l),c&&a(e,u+f(l,o),l,v,i,o),v=0,l+=s}},c=e.$component,h=t("<canvas></canvas>"),p=h.get(0),d=p.getContext("2d");p.width=c.width(),p.height=c.height();var v=t(e.tracker.dom).find(".text-editing-area"),m=v.html();console.log("original markup : ",m),m=m.replace(/<span [^>]*>/gm,""),m=m.replace(/<\/span>/gm,""),m=m.replace(/<b [^>]*>/gm,""),m=m.replace(/<\/b>/gm,""),m=m.replace(/<div><br><\/div>/gm,"\\n"),m=m.replace(/<div><br\/><\/div>/gm,"\\n"),m=m.replace(/<p>&nbsp;<\/p>/gm,"\\n"),m=m.replace(/^<div>/gm,""),m=m.replace(/<div>/gm,"\\n"),m=m.replace(/^<p>/gm,""),m=m.replace(/<p>/gm,"\\n"),m=m.replace(/<br>/gm,"\\n"),m=m.replace(/<br\/>/gm,"\\n"),m=m.replace(/<\/p>/gm,""),m=m.replace(/<\/div>/gm,""),m=m.replace(/&nbsp;/gm," ");var g=this.getTextAttributes();console.log(g);var y=g.fontFamily||"gulim",b=v.css("line-height"),w=g.fontSize,E=g.bold?"bold":"normal",S=g.italic?"italic":"normal";b==="normal"&&(b=parseInt(w)*1.3+"px");var x=S+" "+E+" "+w+" "+y;return NHIE.lib.useragent.info.IsGecko&&g.italic&&(x=x.replace("italic","normal"),d.transform(.99,0,-0.2,1,0,0)),d.font=x,d.fillStyle=g.color||"",console.log(x),l(d,m,n,r+parseInt(w),i,parseInt(b),g),p},handler:function(e,t){return NHIE.lib.Promise.resolve(!0)},onRenderPropertyBase:function(e){var t=this.applyBtnTitle||NHIE.Lang.PluginImageEditor_button_apply,n=this.restoreBtnTitle||NHIE.Lang.PluginImageEditor_button_restore,r=this.applyBtnVisible===!1?!1:!0,i=this.restoreBtnVisible===!1?!1:!0,s=e.parent().find(".ui-panel-footer"),o=s.find("button[data-action=apply]"),u=s.find("button[data-action=restore]");o.text(t),u.text(n),r?o.show():o.hide(),i?u.show():u.hide(),this.onRenderProperty(e)},onRenderProperty:function(){},enableStatus:function(){return!0},onShowProperty:function(e){NHIE.propertyPanel.setPropertyContent(this.name,e)},onApplyProperty:function(){},onRestoreProperty:function(){}});return s}),define("app/classes/ui/Dialog",["jquery","underscore","app/classes/ui/UIElement"],function(e,t,n){var r=n.extend({classname:"Dialog",renderTo:".nhie-body",template:{tpl:'<div class="dialog"></div>'},events:{render:function(n){console.log(this);var r=this,i=e(r.dom),s=r.contentData||{};r.content=NHIE.tmpl(r.content,s),r.type=r.type||"alert",r.type==="alert"?(r.buttons={},r.buttons[NHIE.Lang.PluginImageEditor_button_confirm]=function(){e(this).dialog("close")}):r.button_config&&r.button_config.length&&(r.buttons={},t.each(r.button_config,function(e){r.buttons[e.name]=e.action}));var o={title:r.title,draggable:!1,width:r.width||300,modal:!!r.modal,resizable:!!r.resizable,buttons:r.buttons||{}};r.destroyWhenClose?o.close=function(){e(this).dialog("close").remove(),typeof r.onClose=="function"&&r.onClose.apply(this)}:typeof r.onClose=="function"&&(o.close=r.onClose),i.html(r.content),i.dialog(o),r.onRenderDialog(i)}},construct:function(e){this._super(e);var t=this},show:function(e){return this.render()},hide:function(){},onRenderDialog:function(e){}});return r}),define("text!resources/tpl/ui/dialog/ui-dialog-confirm_history_reset.tpl.html",[],function(){return"<p><%=NHIE_Lang['PluginImageEditor_msg_dialog_history_reset']%></p>\r\n"}),define("app/classes/tools/history-reset",["underscore","jquery","app/classes/tools/ToolBase","app/classes/ui/Dialog","text!resources/tpl/ui/dialog/ui-dialog-confirm_history_reset.tpl.html"],function(e,t,n,r,i){var s={};s[NHIE.Lang.PluginImageEditor_button_confirm]=function(){NHIE.history.applyHistoryItem(0),NHIE.toolbar.resetButtonStatus(),t(this).dialog("close")},s[NHIE.Lang.PluginImageEditor_button_cancel]=function(){t(this).dialog("close")};var o=new r({title:NHIE.Lang.PluginImageEditor_tool_title_history_reset,type:"confirm",content:i,width:400,modal:!0,buttons:s});return new n({name:"history-reset",iconCls:"fa fa-fw fa-reply-all",propertyTpl:"history-reset",dialog:o,handler:function(e,t){o.show()},enableStatus:function(){return NHIE.history.__current_index>0}})}),define("app/classes/tools/history-undo",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"history-undo",iconCls:"fa fa-fw fa-reply",propertyTpl:"history-undo",handler:function(e,t){console.log("history-undo"),NHIE.history.undo()},enableStatus:function(){return NHIE.history.__current_index>0}})}),define("app/classes/tools/history-redo",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"history-redo",iconCls:"fa fa-fw fa-share",propertyTpl:"history-redo",handler:function(e,t){console.log("history-redo"),NHIE.history.redo()},enableStatus:function(){return NHIE.history.__current_index<NHIE.history.__history_inventory__.length-1}})}),define("text!resources/tpl/ui/property/ui-property-item-resize-workspace.tpl.html",[],function(){return'<div class="property-item property-resize-layer">\r\n	<dl>\r\n		<dt>W : </dt>\r\n		<dd><%=data.width%></dd>\r\n		<dt>H : </dt>\r\n		<dd><%=data.height%></dd>\r\n	</dl>\r\n</div>\r\n'}),define("app/classes/tools/resize-workspace",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-resize-workspace.tpl.html"],function(e,t,n,r){return new n({name:"resize-workspace",type:"toggle",iconCls:"fa fa-fw fa-arrows-alt",propertyTpl:r,handler:function(e,t){NHIE.workspace.activateResizer(t),t===!1&&this.onApplyProperty()},enableStatus:function(){return!0},onShowProperty:function(e){var t=NHIE.workspace.getSize();NHIE.propertyPanel.setPropertyContent("resize-workspace",t)},onApplyProperty:function(){NHIE.workspace.syncResizerSize(!0),NHIE.workspace.workspace_resizer.resetScale();var e=NHIE.workspace.getSize();NHIE.workspace.restore_state_resize=e},onRestoreProperty:function(){var e=NHIE.workspace.restore_state_resize;e&&(NHIE.workspace.setStyle(e),NHIE.workspace.syncResizerSize(),NHIE.workspace.workspace_resizer.resetScale(),NHIE.app.fireEvent("changeproperty",e))}})}),define("text!resources/tpl/ui/property/ui-property-item-move-layer.tpl.html",[],function(){return'<div class="property-item property-move-layer">\r\n	<dl>\r\n		<dt>X : </dt>\r\n		<dd><%=data.left%></dd>\r\n		<dt>Y : </dt>\r\n		<dd><%=data.top%></dd>\r\n		<dt>W : </dt>\r\n		<dd><%=data.width%></dd>\r\n		<dt>H : </dt>\r\n		<dd><%=data.height%></dd>\r\n\r\n	</dl>\r\n</div>\r\n'}),define("app/classes/tools/move-layer",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-move-layer.tpl.html"],function(e,t,n,r){return new n({name:"move-layer",iconCls:"fa fa-fw fa-arrows",propertyTpl:r,type:"toggle",handler:function(e,n){if(n===!1){var r=NHIE.workspace.getSelectedLayer();r&&r.modified&&this.onApplyProperty(),t(".nhie-body").css("cursor","")}else t(".nhie-body").css("cursor","move")},enableStatus:function(){return!!NHIE.workspace.getSelectedLayer()&&!NHIE.workspace.getSelectedLayer().empty},onShowProperty:function(t){var n=NHIE.workspace.getSelectedLayer();n&&(t=e.clone(n.style),t.left=parseInt(t.left),t.top=parseInt(t.top),t.width=parseInt(t.width),t.height=parseInt(t.height),NHIE.propertyPanel.setPropertyContent("move-layer",t))},onApplyProperty:function(){var e=NHIE.workspace.getSelectedLayer();e&&(e.restore_state=e.getCurrentState(),e.modified=!1,NHIE.app.fireEvent("changecontent"))},onRestoreProperty:function(){var e=NHIE.workspace.getSelectedLayer();if(e){var t=e.restore_state;t&&(e.setCanvasStyle(t.style),NHIE.app.fireEvent("changeproperty",t.style),e.modified=!1)}}})}),define("app/classes/tools/rotate-left",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"rotate-left",iconCls:"fa fa-fw fa-rotate-left",propertyTpl:"rotate-left",handler:function(e,t){NHIE.workspace.rotateWorkspace("left")}})}),define("app/classes/tools/rotate-right",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"rotate-right",iconCls:"fa fa-fw fa-rotate-right",propertyTpl:"rotate-right",handler:function(e,t){NHIE.workspace.rotateWorkspace("right")}})}),define("app/classes/tools/inverse-h",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"inverse-h",iconCls:"fa fa-fw fa-arrows-h",propertyTpl:"inverse-h",handler:function(e,t){NHIE.workspace.flipWorkspace("h")}})}),define("app/classes/tools/inverse-v",["underscore","jquery","app/classes/tools/ToolBase"],function(e,t,n){return new n({name:"inverse-v",iconCls:"fa fa-fw fa-arrows-v",propertyTpl:"inverse-v",handler:function(e,t){NHIE.workspace.flipWorkspace("v")}})}),define("text!resources/tpl/ui/property/ui-property-item-crop-layer.tpl.html",[],function(){return'<div class="property-item property-crop-layer">\r\n	<dl>\r\n		<dt>MouseX : </dt>\r\n		<dd><%=data.x%></dd>\r\n		<dt>MouseY : </dt>\r\n		<dd><%=data.y%></dd>\r\n		<dt>&nbsp;</dt><dd>&nbsp;</dd>\r\n		<dt>X : </dt>\r\n		<dd><%=data.left%></dd>\r\n		<dt>Y : </dt>\r\n		<dd><%=data.top%></dd>\r\n		<dt>W : </dt>\r\n		<dd><%=data.width%></dd>\r\n		<dt>H : </dt>\r\n		<dd><%=data.height%></dd>\r\n	</dl>\r\n</div>\r\n'}),define("app/classes/tools/crop-layer",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-crop-layer.tpl.html"],function(e,t,n,r){var i="";return i+='<ul id="nhie-app-menu-crop" style="display:none;">',i+='<li data-action="cut">'+NHIE.Lang.PluginImageEditor_crop_action_cut+"</li>",i+='<li data-action="crop">'+NHIE.Lang.PluginImageEditor_crop_action_crop+"</li>",i+='<li data-action="cut_add">'+NHIE.Lang.PluginImageEditor_crop_action_cut_add+"</li>",i+='<li data-action="copy_add">'+NHIE.Lang.PluginImageEditor_crop_action_copy_add+"</li>",i+="</ul>",new n({name:"crop-layer",type:"toggle",iconCls:"fa fa-fw fa-crop",propertyTpl:r,applyBtnVisible:!1,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){var n=this.$getCropMenu();n.hide(),this.__crop_menu_show=!1,this.$getCropBox().hide()},enableStatus:function(){return!!NHIE.workspace.getSelectedLayer()&&!NHIE.workspace.getSelectedLayer().empty},onShowProperty:function(e){e=e||{x:0,y:0,width:0,height:0,left:0,top:0},NHIE.propertyPanel.setPropertyContent(this.name,e)},onRenderProperty:function(){},onApplyProperty:function(){},onRestoreProperty:function(){this.initCropBox()},initCropBox:function(){this.$getCropMenu().hide(),this.$getCropBox().hide(),this.__crop_menu_show=!1,this.box={left:"",top:"",width:"",height:""}},onMouseDownWorkspace:function(e){this.initCropBox();var n={},r=t(".layer-container.clipping-area.layer-foreground"),i=r.offset(),s=(NHIE.app.data("navigator-zoom")||100)/100;n.x=parseInt(e.clientX-i.left)/s,n.y=parseInt(e.clientY-i.top)/s,this.status={mousedown:!0,x:n.x,y:n.y},n.x<0||n.y<0},onMouseMoveWorkspace:function(n){var r={},i=t(".layer-container.clipping-area.layer-foreground"),s=t(".nhie-body .workspace"),o=(NHIE.app.data("navigator-zoom")||100)/100,u=NHIE.workspace.getSize(),a=i.offset();r.x=parseInt((n.clientX-a.left)/o),r.y=parseInt((n.clientY-a.top)/o);if(this.status){var f=this.status;f.moved=!0,r.left=f.x>0?f.x:0,r.top=f.y>0?f.y:0,r.left>u.width&&(r.left=u.width),r.top>u.height&&(r.top=u.width),r.width=(r.x>0?r.x:0)-r.left,r.height=(r.y>0?r.y:0)-r.top;var l=e.clone(r);l.width<0&&(l.left=r.left+r.width,l.width=-r.width),l.height<0&&(l.top=r.top+r.height,l.height=-r.height),l.left<0&&(l.left=0),l.top<0&&(l.top=0),l.left+l.width>u.width&&(l.width=u.width-l.left),l.top+l.height>u.height&&(l.height=u.height-l.top),l={left:parseInt(l.left),top:parseInt(l.top),width:parseInt(l.width),height:parseInt(l.height)},this.status.box=this.box=l,this.showCropBox(l),e.extend(r,l)}else e.extend(r,this.box);NHIE.propertyPanel.setPropertyContent(this.name,r)},onMouseUpWorkspace:function(n){if(this.status&&this.status.moved){var r=this.$getCropMenu(),i=this,s=e.clone(this.status.box);if(s.width&&s.height)r.show(),r.menu({select:function(e,t){NHIE.app.loading(!0),i.doCropLayer(t.item.attr("data-action"),s)}}),this.resetCropMenuPosition(),this.__crop_menu_show=!0;else{var o=t(".layer-tracker-container"),u=o.find(".crop-box");u.hide()}}this.status=null},resetCropMenuPosition:function(){var e=this.$getCropMenu(),n=this.$getCropBox();if(n.length){var r=n.offset(),i={width:parseInt(n.css("width")),height:parseInt(n.css("height"))},s=e.width(),o=e.height(),u={width:t(".nhie-body .workspace").width(),height:t(".nhie-body .workspace").height()},a={left:r.left+i.width,top:r.top+i.height-40};a.left+s>u.width-20&&(a.left=u.width-20-s),a.top+o>u.height-20&&(a.top=u.height-20-o),e.css(a)}},resetCropBoxSizeByScale:function(){var t=(NHIE.app.data("navigator-zoom")||100)/100,n=this.$getCropBox();if(n.length){var r=e.clone(this.box),i={left:parseInt(n.css("left")),top:parseInt(n.css("top")),width:parseInt(n.css("width")),height:parseInt(n.css("height"))};i=r,i={left:i.left*t,top:i.top*t,width:i.width*t,height:i.height*t},n.css(i)}},onResizeWindow:function(){this.resetCropBoxSizeByScale(),this.resetCropMenuPosition()},$getCropMenu:function(){var e=t("#nhie-app-menu-crop");return e.length||(e=t(i),e.appendTo(t(".nhie-application .workspace"))),e},$getCropBox:function(){var e=t(".layer-tracker-container"),n=e.find(".crop-box");return console.log("NHIE.lib.useragent.info.IsSafari - ",NHIE.lib.useragent.info.IsSafari,NHIE.lib.useragent.version),n.length===0&&(n=t('<div class="layer-tracker crop-box border-animation"></div>'),n.appendTo(e),NHIE.lib.useragent.info.IsSafari&&parseInt(NHIE.lib.useragent.version)<6&&(console.log(" -- win safari - reset cropbox style.."),n.removeClass("border-animation").css({border:"1px solid black"}))),n},showCropBox:function(e){var t=this.$getCropBox(),n=(NHIE.app.data("navigator-zoom")||100)/100;t.css({left:e.left*n,top:e.top*n,width:e.width*n,height:e.height*n,position:"absolute",display:"block"})},doCropLayer:function(n,r){NHIE.app.loading(!0);var i=NHIE.lib.Promise.resolve(),s=NHIE.workspace.getSelectedLayer(),o=s.getStyle(),u=s.getCanvasElement(),a=u.getContext("2d");o.right=o.width+o.left,o.bottom=o.height+o.top,r.right=r.width+r.left,r.bottom=r.height+r.top;var f=r.right<o.left||r.left>o.right||r.bottom<o.top||r.top>o.bottom,l={},c={};f?l=null:(r.left<o.left?l.left=o.left:l.left=r.left,r.top<o.top?l.top=o.top:l.top=r.top,r.right<o.right?l.width=r.right-l.left:l.width=o.right-l.left,r.bottom<o.bottom?l.height=r.bottom-l.top:l.height=o.bottom-l.top,c={left:l.left-o.left,top:l.top-o.top,width:l.width,height:l.height},c.right=c.left+c.width,c.bottom=c.top+c.height);var h={cut:function(){return s.clearModifyInformation(),i.then(function(){if(!f){var e=s.getCanvasElement(),t=e.getContext("2d");if(e.width==c.width&&e.height==c.height)s.setEmpty();else{t.clearRect(c.left,c.top,c.width,c.height);var n=NHIE.lib.util.canvasManager.cropCanvas(s.getCanvasElement()),r=s.getStyle();s.setStyle({left:r.left+n.x,top:r.top+n.y,width:n.w,height:n.h})}NHIE.util.canvasCache.set(e)}})},crop:function(){return s.clearModifyInformation(),i.then(function(){if(f)s.setEmpty(),NHIE.util.canvasCache.set(u);else{var n=t("<canvas></canvas>"),r=n.get(0),i=NHIE.lib.util.canvasManager.getCanvasModifyData(u),o=t(s.getCanvasElement()).parent().parent(),h={x:parseFloat(o.attr("data-scale-x")||"1"),y:parseFloat(o.attr("data-scale-y")||"1")},p=function(t,n){return t=e.clone(t),t.left*=n.x,t.width*=n.x,t.top*=n.y,t.height*=n.y,t},d=a.getImageData(c.left,c.top,c.width,c.height);r.width=c.width,r.height=c.height;var v=r.getContext("2d");v.putImageData(d,0,0),s.setCanvasContent({canvas:r,style:l}),s.clearModifyInformation(),n.remove()}})},cut_add:function(){return s.clearModifyInformation(),i.then(function(){if(f){var e=NHIE.workspace.addLayer("image");e.setEmpty(),NHIE.util.canvasCache.set(e.getCanvasElement())}else{var n=t("<canvas></canvas>"),r=n.get(0),i=a.getImageData(c.left-1,c.top-1,c.width+2,c.height+2);r.width=c.width+2,r.height=c.height+2,r.getContext("2d").putImageData(i,0,0);var e=NHIE.workspace.addLayer("image");e.setCanvasContent({canvas:r,style:{left:l.left-1,top:l.top-1,width:l.width+2,height:l.height+2}});if(u.width==c.width&&u.height==c.height)s.setEmpty();else{a.clearRect(c.left,c.top,c.width,c.height);var o=NHIE.lib.util.canvasManager.cropCanvas(s.getCanvasElement()),h=s.getStyle();s.setStyle({left:h.left+o.x,top:h.top+o.y,width:o.w,height:o.h})}NHIE.util.canvasCache.set(u),e.select(),n.remove()}})},copy_add:function(){return i.then(function(){if(f){var e=NHIE.workspace.addLayer("image");e.setEmpty(),NHIE.util.canvasCache.set(e.getCanvasElement())}else{var n=t("<canvas></canvas>"),r=n.get(0),i=a.getImageData(c.left,c.top,c.width,c.height);r.width=c.width,r.height=c.height,r.getContext("2d").putImageData(i,0,0);var e=NHIE.workspace.addLayer("canvas");e.setCanvasContent({canvas:r,style:l}),e.select(),n.remove()}})}},p=function(e,t){var n=t?-1:1,r=NHIE.lib.util.canvasManager.getCanvasModifyData(u);e.save();var i={x:r.flip.h?-1*n:1*n,y:r.flip.v?-1*n:1*n};return e.scale(i.x,i.y),e.translate(u.width/2*i.x,u.height/2*i.y),e.rotate(r.rotate/180*Math.PI*i.x*i.y*n),e};if(n&&h[n]&&typeof h[n]=="function"){var d=this;return s.rasterize({skipHistoryEvent:!0}).then(function(){}).then(h[n].bind(this)).then(function(){NHIE.app.fireEvent("changecontent")}).then(function(){NHIE.app.loading(!1),d.initCropBox()}).catch(function(e){NHIE.app.loading(!1),console.error(e)})}return i}})}),define("text!resources/tpl/ui/property/ui-property-item-resize-layer.tpl.html",[],function(){return'<div class="property-item property-resize-layer">\r\n	<dl>\r\n		<dt>W : </dt>\r\n		<dd><%=data.width%></dd>\r\n		<dt>H : </dt>\r\n		<dd><%=data.height%></dd>\r\n		<dt>R : </dt>\r\n		<dd><%=data.rotation%></dd>\r\n	</dl>\r\n</div>\r\n'}),define("app/classes/tools/resize-layer",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-resize-layer.tpl.html"],function(e,t,n,r){return new n({name:"resize-layer",type:"toggle",iconCls:"fa fa-fw fa-arrows-alt",propertyTpl:r,handler:function(e,t){if(t===!1){var n=NHIE.workspace.getSelectedLayer();n&&n.modified&&this.onApplyProperty()}else{var n=NHIE.workspace.getSelectedLayer();n&&(data=n.style,n.tracker.show())}},enableStatus:function(){return!!NHIE.workspace.getSelectedLayer()&&!NHIE.workspace.getSelectedLayer().empty},onShowProperty:function(t){var n=NHIE.workspace.getSelectedLayer();if(n){t=n.getStyle();var r=t.rotation;t=e.clone(n.style),t.left=parseInt(t.left),t.top=parseInt(t.top),t.width=parseInt(t.width),t.height=parseInt(t.height),r=parseInt(r||0),r%=360,r>180&&r<360&&(r-=360),t.rotation=r,n.tracker.show(),NHIE.propertyPanel.setPropertyContent("resize-layer",t)}},onApplyProperty:function(){var e=NHIE.workspace.getSelectedLayer();e&&e.rasterize().then(function(){e.restore_state=e.getCurrentState(),e.modified=!1})},onRestoreProperty:function(){var e=NHIE.workspace.getSelectedLayer();if(e){var t=e.restore_state;t&&(e.setCanvasStyle(t.style),NHIE.app.fireEvent("changeproperty",t.style),e.modified=!1)}}})}),define("text!resources/tpl/ui/workspace/ui-layer-tracker.tpl.html",[],function(){return'<div class="layer-tracker">\r\n	<div class="tracker-body"></div>\r\n	<div class="tracker-handle tracker-resize resize-lt"></div>\r\n	<div class="tracker-handle tracker-resize resize-lm"></div>\r\n	<div class="tracker-handle tracker-resize resize-lb"></div>\r\n	<div class="tracker-handle tracker-resize resize-ct"></div>\r\n	<div class="tracker-handle tracker-resize resize-cb"></div>\r\n	<div class="tracker-handle tracker-resize resize-rt"></div>\r\n	<div class="tracker-handle tracker-resize resize-rm"></div>\r\n	<div class="tracker-handle tracker-resize resize-rb"></div>\r\n	<div class="tracker-handle tracker-rotation"></div>\r\n</div>\r\n'}),define("app/classes/ui/workspace/Tracker",["jquery","underscore","app/classes/ui/UIElement","text!resources/tpl/ui/workspace/ui-layer-tracker.tpl.html"],function(e,t,n,r){var i=n.extend({classname:"Tracker",renderTo:".layer-tracker-container",template:{tpl:r},showPropertyChange:!0,min_width:10,min_height:10,enable_dragmove:!0,info:{},ignoreScale:!0,events:{render:function(e){e.addClass("layer-resizer"),e.attr("data-target-layer-id",this.target.id),this.syncSize(),this.initTrackerEvents()},mousedown_tracker:function(n,r){var i=this,s="",o=["lt","lm","lb","ct","cb","rt","rm","rb"],u=e(n.target),a=null;if(u.hasClass("tracker-handle")){console.log("--mousedown to resize~"),u.hasClass("tracker-rotation")?s="rotation":t.each(o,function(e){if(u.hasClass("resize-"+e))return s=e,!1});if(s){var a=s;a==="rotation"?(NHIE.app.status.action="rotate",this.fireEvent("startrotate",n)):(NHIE.app.status.action="resize",NHIE.app.status.trackerType=a,this.fireEvent("startresize",n,a))}}else if(u.hasClass("layer-tracker")||r&&r.forceDragMove===!0)console.log("--mousedown to move~"),this.enable_dragmove&&(NHIE.app.status.action="move",this.fireEvent("startmove",n))},startmove:function(e){var t=this,n=this.target.getStyle(),r=(NHIE.app.data("navigator-zoom")||100)/100,i={mode:"resize-layer",scale:r,origin:{clientX:e.clientX,clientY:e.clientY,width:n.width,height:n.height,left:n.left,top:n.top,rotation:n.rotation}};this.ignoreScale&&(i.origin.width*=r,i.origin.height*=r,i.origin.left*=r,i.origin.top*=r),this.info=i},onmove:function(t){this.target.modified=!0;var n=this.info,r=n.scale;this.ignoreScale&&(r=1);var i={x:(t.clientX-n.origin.clientX)/r,y:(t.clientY-n.origin.clientY)/r},s={left:n.origin.left+i.x,top:n.origin.top+i.y};this.modified=!0,e(this.dom).css(s),this.syncSize(!0),this.showPropertyChange&&NHIE.app.fireEvent("changeproperty",this.target.style)},endmove:function(e){},startresize:function(e,t){console.log("start resize");var n=this,r=this.target.style,i=(NHIE.app.data("navigator-zoom")||100)/100,s={mode:"resize-layer",origin:{clientX:e.clientX,clientY:e.clientY,width:parseFloat(r.width),height:parseFloat(r.height),left:parseFloat(r.left),top:parseFloat(r.top),rotation:r.rotation}};this.ignoreScale&&(s.origin.width*=i,s.origin.height*=i,s.origin.left*=i,s.origin.top*=i),this.info=s,console.log(s)},onresize:function(t,n){t.preventDefault(),this.target.modified=!0;var r=this.info.origin.width,i=this.info.origin.height,s={left:this.info.origin.left,top:this.info.origin.top},o=this.getResizeOffset(n,t);e(this.dom).css({left:s.left+o.ol+o.centerOffset.x,top:s.top+o.ot+o.centerOffset.y,width:r+o.ow,height:i+o.oh}),this.syncSize(!0),this.showPropertyChange&&NHIE.app.fireEvent("changeproperty",this.target.style)},endresize:function(e,t){console.log("endresize : ",e),this.info={}},startrotate:function(e){console.log("start rotate!!");var t=this,n=this.target.style,r=(NHIE.app.data("navigator-zoom")||100)/100,i={mode:"rotate_layer",origin:{clientX:e.clientX,clientY:e.clientY,width:n.width,height:n.height,left:n.left,top:n.top,rotation:n.rotation,centerX:n.width/2+n.left,centerY:n.height/2+n.top}};this.info=i},onrotate:function(t){t.preventDefault(),this.target.modified=!0;var n=(NHIE.app.data("navigator-zoom")||100)/100,r={x:this.info.origin.centerX,y:this.info.origin.centerY},i={x:(t.clientX-this.info.origin.clientX)/n,y:(t.clientY-this.info.origin.clientY)/n},s={x:r.x,y:r.y-this.info.origin.height/2-20},o=this.info.origin.rotation;s=NHIE.lib.util.rotatePoint(o,s.x,s.y,r.x,r.y);var u={x:s.x+i.x,y:s.y+i.y},a=this.getDegreeOfPointsObj(s,u,r),f=e(this.dom);this.target.setCanvasStyle({rotation:o+a}),this.showPropertyChange&&NHIE.app.fireEvent("changeproperty",this.target.style)},endrotate:function(e){console.log("endrotate : ",e),this.info={}}},construct:function(e){this._super(e),this.target=e.target},initTrackerEvents:function(){},getResizeOffset:function(e,t){var n=(NHIE.app.data("navigator-zoom")||100)/100;this.ignoreScale&&(n=1);var r={x:(t.clientX-this.info.origin.clientX)/n,y:(t.clientY-this.info.origin.clientY)/n},i={left:this.info.origin.left,top:this.info.origin.top},s=this.info.origin.width,o=this.info.origin.height,u,a,f,l;u=a=f=l=0,/l[t|m|b]/i.test(e)&&(u=r.x,f=-r.x),/r[t|m|b]/i.test(e)&&(f=r.x),/[l|c|r]t/i.test(e)&&(a=r.y,l=-r.y),/[l|c|r]b/i.test(e)&&(l=r.y);var c={left:parseFloat(i.left+u),top:parseFloat(i.top+a),width:parseFloat(s+f),height:parseFloat(o+l)},h=this.min_width,p=this.min_width;c.width<h&&(f=h-s,c.width=h,/l[t|m|b]/i.test(e)&&(u=s-h)),c.height<p&&(l=p-o,c.height=p,/[l|c|r]t/i.test(e)&&(a=o-p));var d={x:0,y:0},v=this.info.origin.rotation;if(v){var m={x:i.left+s/2,y:i.top+o/2},g={x:c.left+c.width/2,y:c.top+c.height/2},y=NHIE.lib.util.rotatePoint(v,g.x,g.y,m.x,m.y);d={x:y.x-g.x,y:y.y-g.y}}return{ol:u,ot:a,ow:f,oh:l,centerOffset:d}},syncSize:function(t){t=!!t;var n=this.target.style,r=(NHIE.app.data("navigator-zoom")||100)/100,i=e(this.dom);if(t){var s=this.target;s.setStyle({width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),left:parseFloat(i.css("left")),top:parseFloat(i.css("top"))})}else i.css({width:r*n.width,height:r*n.height,left:r*n.left,top:r*n.top,transform:"rotate("+n.rotation+"deg)"})},getDegreeOfPoints:function(e,t,n,r,i,s){var o=e-i,u=n-i,a=t-s,f=r-s,l=Math.asin((o*f-a*u)/(Math.sqrt(o*o+a*a)*Math.sqrt(u*u+f*f))),c=l/Math.PI*180;return c=parseInt(c),f<0&&(c=180-c),c>=360&&(c-=360),c<0&&(c+=360),c},getDegreeOfPointsObj:function(e,t,n){var r=this.getDegreeOfPoints(n.x,n.y-1,e.x,e.y,n.x,n.y),i=this.getDegreeOfPoints(n.x,n.y-1,t.x,t.y,n.x,n.y),s=r-i;return s>=360&&(s-=360),s<0&&(s+=360),s},rotatePoint:function(e,t,n,r,i){var s=function(e){return e/180*Math.PI};return r=r||0,i=i||0,{x:r+(t-r)*Math.cos(s(e))-(n-i)*Math.sin(s(e)),y:i+(n-i)*Math.cos(s(e))+(t-r)*Math.sin(s(e))}},show:function(){e(this.dom).removeClass("hidden visible").addClass("visible")},hide:function(){e(this.dom).removeClass("hidden visible").addClass("hidden")},remove:function(){e(this.dom).remove()}});return i}),define("app/classes/ui/workspace/component/UIComponent",["jquery","underscore","app/classes/Observable","app/classes/ui/workspace/Tracker"],function(e,t,n,r){var i=n.extend({classname:"UIComponent",construct:function(n){this._super(n);var i=n.style||{};i=t.clone(i);var s=(NHIE.app.data("navigator-zoom")||100)/100;t.each(["left","top","width","height"],function(e){typeof i[e]!="undefined"&&(i[e]*=s)});var o;o=e('<div class="component"></div>'),o.addClass(this.type||""),this.getComponentMarkup()&&o.append(this.getComponentMarkup()),this.$component=o,e(".layer-foreground.layer-container.clipping-area .component-container").append(o);var u=new r({id:"component-resizer_"+this.id,min_width:this.min_width||10,min_height:this.min_height||10,showPropertyChange:!1,target:this});this.tracker=u,u.render().then(function(e){return e.addClass("component-tracker"),e}).then(this.afterRenderTracker.bind(this));if(i){o.css(i);var a=o.parent().parent();t.extend(i,{left:a.width()/2-o.width()/2,top:a.height()/2-o.height()/2}),this.setStyle(i)}},afterRenderTracker:function(e){console.log("afterRenderTracker~~")},getStyle:function(){return t.clone(this.style)},setStyle:function(e){var n=(NHIE.app.data("navigator-zoom")||100)/100;t.each(["left","top","width","height"],function(t){typeof e[t]!="undefined"&&(e[t]/=n)});var r=t.clone(this.style);r=t.extend(r,e),this.style={left:r.left,top:r.top,width:r.width,height:r.height},this.$component.css({left:r.left*n,top:r.top*n,width:r.width*n,height:r.height*n}),this.$component.css(r),this.tracker.syncSize()},getComponentMarkup:function(){},apply:function(){},restore:function(){},remove:function(){this.$component.remove(),this.tracker.remove()}});return i}),define("app/classes/ui/workspace/component/TextBox",["jquery","underscore","app/classes/ui/workspace/component/UIComponent"],function(e,t,n){var r=n.extend({classname:"TextBox",min_width:40,min_height:40,getComponentMarkup:function(){var e=this.style,t=this.style.width,n=this.style.height,r="";return r+='<div style="position:absolute;width:100%;height:100%;" class="dummy">',r+="</div>",r},afterRenderTracker:function(t){var n=this.initConfig.style,r=n.width,i=n.height,s="";s+='<div contentEditable="true" class="tracker-content text-editing-area" style="pointer-events:all;position:absolute;',s+="left:0;",s+="top:0;",s+="width:100%;",s+="height:100%",s+='"></div>';var o=e(s),u=(NHIE.app.data("navigator-zoom")||100)/100;o.css("zoom",u),t.append(o),this.$textEditingArea=o,o.focus()},toCanvas:function(){var e=this.$component,t=this;return NHIE.lib.Promise.resolve().then(function(){var n=NHIE.app.getCurrentTool();return n.renderTextComponentOnCanvas(t,0,0,e.width(),e.height())})}});return r}),define("text!resources/tpl/ui/property/ui-property-item-insert-textbox.tpl.html",[],function(){return'<div class="property-item property-insert-textbox">\r\n\r\n</div>\r\n'}),function(e){typeof define=="function"&&define.amd?define("jquery-ui",["jquery"],e):e(jQuery)}(function(e){function t(t,r){var i,s,o,u=t.nodeName.toLowerCase();return"area"===u?(i=t.parentNode,s=i.name,!t.href||!s||i.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap='#"+s+"']")[0],!!o&&n(o))):(/^(input|select|textarea|button|object)$/.test(u)?!t.disabled:"a"===u?t.href||r:r)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return e.css(this,"visibility")==="hidden"}).length}function T(e){var t,n;while(e.length&&e[0]!==document){t=e.css("position");if(t==="absolute"||t==="relative"||t==="fixed"){n=parseInt(e.css("zIndex"),10);if(!isNaN(n)&&n!==0)return n}e=e.parent()}return 0}function N(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=C(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function C(t){var n="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(n,"mouseout",function(){e(this).removeClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&e(this).removeClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(n,"mouseover",k)}function k(){e.datepicker._isDisabledDatepicker(x.inline?x.dpDiv.parent()[0]:x.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&e(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&e(this).addClass("ui-datepicker-next-hover"))}function L(t,n){e.extend(t,n);for(var r in n)n[r]==null&&(t[r]=n[r]);return t}function P(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var n=this.css("position"),r=n==="absolute",i=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return r&&t.css("position")==="static"?!1:i.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return n==="fixed"||!s.length?e(this[0].ownerDocument||document):s},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(n){return t(n,!isNaN(e.attr(n,"tabindex")))},tabbable:function(n){var r=e.attr(n,"tabindex"),i=isNaN(r);return(i||r>=0)&&t(n,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function o(t,n,i,s){return e.each(r,function(){n-=parseFloat(e.css(t,"padding"+this))||0,i&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var r=n==="Width"?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),s={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return t===undefined?s["inner"+n].call(this):this.each(function(){e(this).css(i,o(this,t)+"px")})},e.fn["outer"+n]=function(t,r){return typeof t!="number"?s["outer"+n].call(this,t):this.each(function(){e(this).css(i,o(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return typeof n=="number"?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(t!==undefined)return this.css("zIndex",t);if(this.length){var n=e(this[0]),r,i;while(n.length&&n[0]!==document){r=n.css("position");if(r==="absolute"||r==="relative"||r==="fixed"){i=parseInt(n.css("zIndex"),10);if(!isNaN(i)&&i!==0)return i}n=n.parent()}}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(!s)return;if(!r&&(!e.element[0].parentNode||e.element[0].parentNode.nodeType===11))return;for(i=0;i<s.length;i++)e.options[s[i][0]]&&s[i][1].apply(e.element,n)}};var r=0,i=Array.prototype.slice;e.cleanData=function(t){return function(n){var r,i,s;for(s=0;(i=n[s])!=null;s++)try{r=e._data(i,"events"),r&&r.remove&&e(i).triggerHandler("remove")}catch(o){}t(n)}}(e.cleanData),e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];return t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){if(!e.isFunction(r)){a[t]=r;return}a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=i,s=r.apply(this,arguments),this._super=t,this._superApply=n,s}}()}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix||t:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){var n=i.call(arguments,1),r=0,s=n.length,o,u;for(;r<s;r++)for(o in n[r])u=n[r][o],n[r].hasOwnProperty(o)&&u!==undefined&&(e.isPlainObject(u)?t[o]=e.isPlainObject(t[o])?e.widget.extend({},t[o],u):e.widget.extend({},u):t[o]=u);return t},e.widget.bridge=function(t,n){var r=n.prototype.widgetFullName||t;e.fn[t]=function(s){var o=typeof s=="string",u=i.call(arguments,1),a=this;return o?this.each(function(){var n,i=e.data(this,r);if(s==="instance")return a=i,!1;if(!i)return e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+s+"'");if(!e.isFunction(i[s])||s.charAt(0)==="_")return e.error("no such method '"+s+"' for "+t+" widget instance");n=i[s].apply(i,u);if(n!==i&&n!==undefined)return a=n&&n.jquery?a.pushStack(n.get()):n,!1}):(u.length&&(s=e.widget.extend.apply(null,[s].concat(u))),this.each(function(){var t=e.data(this,r);t?(t.option(s||{}),t._init&&t._init()):e.data(this,r,new n(s,this))})),a}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=r++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r=t,i,s,o;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof t=="string"){r={},i=t.split("."),t=i.shift();if(i.length){s=r[t]=e.widget.extend({},this.options[t]);for(o=0;o<i.length-1;o++)s[i[o]]=s[i[o]]||{},s=s[i[o]];t=i.pop();if(arguments.length===1)return s[t]===undefined?null:s[t];s[t]=n}else{if(arguments.length===1)return this.options[t]===undefined?null:this.options[t];r[t]=n}}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,n,r){var i,s=this;typeof t!="boolean"&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){if(!t&&(s.options.disabled===!0||e(this).hasClass("ui-state-disabled")))return;return(typeof o=="string"?s[o]:o).apply(s,arguments)}typeof o!="string"&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^([\w:-]*)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(t,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(n).undelegate(n),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}});var s=e.widget,o=!1;e(document).mouseup(function(){o=!1});var u=e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(o)return;this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var n=this,r=t.which===1,i=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!r||i||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),o=!0,!0},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}if(t.which||t.button)this._mouseMoved=!0;return this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),o=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});(function(){function h(e,t,n){return[parseFloat(e[0])*(l.test(e[0])?t/100:1),parseFloat(e[1])*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}function d(t){var n=t[0];return n.nodeType===9?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var t,n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\+\-]\d+(\.[\d]+)?%?/,f=/^\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(t!==undefined)return t;var n,r,i=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),s=i.children()[0];return e("body").append(i),n=s.offsetWidth,i.css("overflow","scroll"),r=s.offsetWidth,n===r&&(r=i[0].clientWidth),i.remove(),t=n-r},getScrollInfo:function(t){var n=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),r=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),i=n==="scroll"||n==="auto"&&t.width<t.element[0].scrollWidth,s=r==="scroll"||r==="auto"&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:i?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]),i=!!n[0]&&n[0].nodeType===9;return{element:n,isWindow:r,isDocument:i,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r||i?n.width():n.outerWidth(),height:r||i?n.height():n.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return c.apply(this,arguments);t=e.extend({},t);var l,v,m,g,y,b,w=e(t.of),E=e.position.getWithinInfo(t.within),S=e.position.getScrollInfo(E),x=(t.collision||"flip").split(" "),T={};return b=d(w),w[0].preventDefault&&(t.at="left top"),v=b.width,m=b.height,g=b.offset,y=e.extend({},g),e.each(["my","at"],function(){var e=(t[this]||"").split(" "),n,r;e.length===1&&(e=o.test(e[0])?e.concat(["center"]):u.test(e[0])?["center"].concat(e):["center","center"]),e[0]=o.test(e[0])?e[0]:"center",e[1]=u.test(e[1])?e[1]:"center",n=a.exec(e[0]),r=a.exec(e[1]),T[this]=[n?n[0]:0,r?r[0]:0],t[this]=[f.exec(e[0])[0],f.exec(e[1])[0]]}),x.length===1&&(x[1]=x[0]),t.at[0]==="right"?y.left+=v:t.at[0]==="center"&&(y.left+=v/2),t.at[1]==="bottom"?y.top+=m:t.at[1]==="center"&&(y.top+=m/2),l=h(T.at,v,m),y.left+=l[0],y.top+=l[1],this.each(function(){var o,u,a=e(this),f=a.outerWidth(),c=a.outerHeight(),d=p(this,"marginLeft"),b=p(this,"marginTop"),N=f+d+p(this,"marginRight")+S.width,C=c+b+p(this,"marginBottom")+S.height,k=e.extend({},y),L=h(T.my,a.outerWidth(),a.outerHeight());t.my[0]==="right"?k.left-=f:t.my[0]==="center"&&(k.left-=f/2),t.my[1]==="bottom"?k.top-=c:t.my[1]==="center"&&(k.top-=c/2),k.left+=L[0],k.top+=L[1],n||(k.left=s(k.left),k.top=s(k.top)),o={marginLeft:d,marginTop:b},e.each(["left","top"],function(n,r){e.ui.position[x[n]]&&e.ui.position[x[n]][r](k,{targetWidth:v,targetHeight:m,elemWidth:f,elemHeight:c,collisionPosition:o,collisionWidth:N,collisionHeight:C,offset:[l[0]+L[0],l[1]+L[1]],my:t.my,at:t.at,within:E,elem:a})}),t.using&&(u=function(e){var n=g.left-k.left,s=n+v-f,o=g.top-k.top,u=o+m-c,l={target:{element:w,left:g.left,top:g.top,width:v,height:m},element:{element:a,left:k.left,top:k.top,width:f,height:c},horizontal:s<0?"left":n>0?"right":"center",vertical:u<0?"top":o>0?"bottom":"middle"};v<f&&i(n+s)<v&&(l.horizontal="center"),m<c&&i(o+u)<m&&(l.vertical="middle"),r(i(n),i(s))>r(i(o),i(u))?l.important="horizontal":l.important="vertical",t.using.call(this,e,l)}),a.offset(e.extend(k,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]==="left"?-t.elemWidth:t.my[0]==="right"?t.elemWidth:0,c=t.at[0]==="left"?t.targetWidth:t.at[0]==="right"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p<i(a))e.left+=l+c+h}else if(f>0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)<f)e.left+=l+c+h}},top:function(e,t){var n=t.within,r=n.offset.top+n.scrollTop,s=n.height,o=n.isWindow?n.scrollTop:n.offset.top,u=e.top-t.collisionPosition.marginTop,a=u-o,f=u+t.collisionHeight-s-o,l=t.my[1]==="top",c=l?-t.elemHeight:t.my[1]==="bottom"?t.elemHeight:0,h=t.at[1]==="top"?t.targetHeight:t.at[1]==="bottom"?-t.targetHeight:0,p=-2*t.offset[1],d,v;if(a<0){v=e.top+c+h+p+t.collisionHeight-s-r;if(v<0||v<i(a))e.top+=c+h+p}else if(f>0){d=e.top-t.collisionPosition.marginTop+c+h+p-o;if(d>0||i(d)<f)e.top+=c+h+p}}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,r,i,s,o,u=document.getElementsByTagName("body")[0],a=document.createElement("div");t=document.createElement(u?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},u&&e.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in i)t.style[o]=i[o];t.appendChild(a),r=u||document.documentElement,r.insertBefore(t,r.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",s=e(a).offset().left,n=s>10&&s<11,t.innerHTML="",r.removeChild(t)}()})();var a=e.ui.position;e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",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(){this.options.helper==="original"&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),e==="handle"&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=!0;return}this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this._blurActiveElement(t),this.helper||n.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(n.iframeFix===!0?"iframe":n.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var n=this.document[0];if(!this.handleElement.is(t.target))return;try{n.activeElement&&n.activeElement.nodeName.toLowerCase()!=="body"&&e(n.activeElement).blur()}catch(r){}},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.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 e(this).css("position")==="fixed"}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){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:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,n){this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=this,r=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(r=e.ui.ddmanager.drop(this,t)),this.dropped&&(r=this.dropped,this.dropped=!1),this.options.revert==="invalid"&&!r||this.options.revert==="valid"&&r||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){n._trigger("stop",t)!==!1&&n._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.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.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper),i=r?e(n.helper.apply(this.element[0],[t])):n.helper==="clone"?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo(n.appendTo==="parent"?this.element[0].parentNode:n.appendTo),r&&i[0]===this.element[0]&&this._setPositionRelative(),i[0]!==this.element[0]&&!/(fixed|absolute)/.test(i.css("position"))&&i.css("position","absolute"),i},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),n=this.document[0];return this.cssPosition==="absolute"&&this.scrollParent[0]!==n&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition!=="relative")return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?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 t,n,r,i=this.options,s=this.document[0];this.relativeContainer=null;if(!i.containment){this.containment=null;return}if(i.containment==="window"){this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(i.containment==="document"){this.containment=[0,0,e(s).width()-this.helperProportions.width-this.margins.left,(e(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(i.containment.constructor===Array){this.containment=i.containment;return}i.containment==="parent"&&(i.containment=this.helper[0].parentNode),n=e(i.containment),r=n[0];if(!r)return;t=/(scroll|auto)/.test(n.css("overflow")),this.containment=[(parseInt(n.css("borderLeftWidth"),10)||0)+(parseInt(n.css("paddingLeft"),10)||0),(parseInt(n.css("borderTopWidth"),10)||0)+(parseInt(n.css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(n.css("borderRightWidth"),10)||0)-(parseInt(n.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(n.css("borderBottomWidth"),10)||0)-(parseInt(n.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=n},_convertPositionTo:function(e,t){t||(t=this.position);var n=e==="absolute"?1:-1,r=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*n+this.offset.parent.top*n-(this.cssPosition==="fixed"?-this.offset.scroll.top:r?0:this.offset.scroll.top)*n,left:t.left+this.offset.relative.left*n+this.offset.parent.left*n-(this.cssPosition==="fixed"?-this.offset.scroll.left:r?0:this.offset.scroll.left)*n}},_generatePosition:function(e,t){var n,r,i,s,o=this.options,u=this._isRootNode(this.scrollParent[0]),a=e.pageX,f=e.pageY;if(!u||!this.offset.scroll)this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()};return t&&(this.containment&&(this.relativeContainer?(r=this.relativeContainer.offset(),n=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):n=this.containment,e.pageX-this.offset.click.left<n[0]&&(a=n[0]+this.offset.click.left),e.pageY-this.offset.click.top<n[1]&&(f=n[1]+this.offset.click.top),e.pageX-this.offset.click.left>n[2]&&(a=n[2]+this.offset.click.left),e.pageY-this.offset.click.top>n[3]&&(f=n[3]+this.offset.click.top)),o.grid&&(i=o.grid[1]?this.originalPageY+Math.round((f-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,f=n?i-this.offset.click.top>=n[1]||i-this.offset.click.top>n[3]?i:i-this.offset.click.top>=n[1]?i-o.grid[1]:i+o.grid[1]:i,s=o.grid[0]?this.originalPageX+Math.round((a-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,a=n?s-this.offset.click.left>=n[0]||s-this.offset.click.left>n[2]?s:s-this.offset.click.left>=n[0]?s-o.grid[0]:s+o.grid[0]:s),o.axis==="y"&&(a=this.originalPageX),o.axis==="x"&&(f=this.originalPageY)),{top:f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:u?0:this.offset.scroll.top),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:u?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){this.options.axis!=="y"&&this.helper.css("right")!=="auto"&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),this.options.axis!=="x"&&this.helper.css("bottom")!=="auto"&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),r.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n,r){var i=e.extend({},n,{item:r.element});r.sortables=[],e(r.options.connectToSortable).each(function(){var n=e(this).sortable("instance");n&&!n.options.disabled&&(r.sortables.push(n),n.refreshPositions(),n._trigger("activate",t,i))})},stop:function(t,n,r){var i=e.extend({},n,{item:r.element});r.cancelHelperRemoval=!1,e.each(r.sortables,function(){var e=this;e.isOver?(e.isOver=0,r.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,i))})},drag:function(t,n,r){e.each(r.sortables,function(){var i=!1,s=this;s.positionAbs=r.positionAbs,s.helperProportions=r.helperProportions,s.offset.click=r.offset.click,s._intersectsWith(s.containerCache)&&(i=!0,e.each(r.sortables,function(){return this.positionAbs=r.positionAbs,this.helperProportions=r.helperProportions,this.offset.click=r.offset.click,this!==s&&this._intersectsWith(this.containerCache)&&e.contains(s.element[0],this.element[0])&&(i=!1),i})),i?(s.isOver||(s.isOver=1,r._parent=n.helper.parent(),s.currentItem=n.helper.appendTo(s.element).data("ui-sortable-item",!0),s.options._helper=s.options.helper,s.options.helper=function(){return n.helper[0]},t.target=s.currentItem[0],s._mouseCapture(t,!0),s._mouseStart(t,!0,!0),s.offset.click.top=r.offset.click.top,s.offset.click.left=r.offset.click.left,s.offset.parent.left-=r.offset.parent.left-s.offset.parent.left,s.offset.parent.top-=r.offset.parent.top-s.offset.parent.top,r._trigger("toSortable",t),r.dropped=s.element,e.each(r.sortables,function(){this.refreshPositions()}),r.currentItem=r.element,s.fromOutside=r),s.currentItem&&(s._mouseDrag(t),n.position=s.position)):s.isOver&&(s.isOver=0,s.cancelHelperRemoval=!0,s.options._revert=s.options.revert,s.options.revert=!1,s._trigger("out",t,s._uiHash(s)),s._mouseStop(t,!0),s.options.revert=s.options._revert,s.options.helper=s.options._helper,s.placeholder&&s.placeholder.remove(),n.helper.appendTo(r._parent),r._refreshOffsets(t),n.position=r._generatePosition(t,!0),r._trigger("fromSortable",t),r.dropped=!1,e.each(r.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n,r){var i=e("body"),s=r.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,n,r){var i=r.options;i._cursor&&e("body").css("cursor",i._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("opacity")&&(s._opacity=i.css("opacity")),i.css("opacity",s.opacity)},stop:function(t,n,r){var i=r.options;i._opacity&&e(n.helper).css("opacity",i._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&n.scrollParentNotHidden[0].tagName!=="HTML"&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(t,n,r){var i=r.options,s=!1,o=r.scrollParentNotHidden[0],u=r.document[0];if(o!==u&&o.tagName!=="HTML"){if(!i.axis||i.axis!=="x")r.overflowOffset.top+o.offsetHeight-t.pageY<i.scrollSensitivity?o.scrollTop=s=o.scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(o.scrollTop=s=o.scrollTop-i.scrollSpeed);if(!i.axis||i.axis!=="y")r.overflowOffset.left+o.offsetWidth-t.pageX<i.scrollSensitivity?o.scrollLeft=s=o.scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(o.scrollLeft=s=o.scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!=="x")t.pageY-e(u).scrollTop()<i.scrollSensitivity?s=e(u).scrollTop(e(u).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(u).scrollTop())<i.scrollSensitivity&&(s=e(u).scrollTop(e(u).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!=="y")t.pageX-e(u).scrollLeft()<i.scrollSensitivity?s=e(u).scrollLeft(e(u).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(u).scrollLeft())<i.scrollSensitivity&&(s=e(u).scrollLeft(e(u).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n,r){var i=r.options;r.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!==r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n,r){var i,s,o,u,a,f,l,c,h,p,d=r.options,v=d.snapTolerance,m=n.offset.left,g=m+r.helperProportions.width,y=n.offset.top,b=y+r.helperProportions.height;for(h=r.snapElements.length-1;h>=0;h--){a=r.snapElements[h].left-r.margins.left,f=a+r.snapElements[h].width,l=r.snapElements[h].top-r.margins.top,c=l+r.snapElements[h].height;if(g<a-v||m>f+v||b<l-v||y>c+v||!e.contains(r.snapElements[h].item.ownerDocument,r.snapElements[h].item)){r.snapElements[h].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=!1;continue}d.snapMode!=="inner"&&(i=Math.abs(l-b)<=v,s=Math.abs(c-y)<=v,o=Math.abs(a-g)<=v,u=Math.abs(f-m)<=v,i&&(n.position.top=r._convertPositionTo("relative",{top:l-r.helperProportions.height,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a-r.helperProportions.width}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f}).left)),p=i||s||o||u,d.snapMode!=="outer"&&(i=Math.abs(l-y)<=v,s=Math.abs(c-b)<=v,o=Math.abs(a-m)<=v,u=Math.abs(f-g)<=v,i&&(n.position.top=r._convertPositionTo("relative",{top:l,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c-r.helperProportions.height,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f-r.helperProportions.width}).left)),!r.snapElements[h].snapping&&(i||s||o||u||p)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=i||s||o||u||p}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n,r){var i,s=r.options,o=e.makeArray(e(s.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!o.length)return;i=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",i+t)}),this.css("zIndex",i+o.length)}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("zIndex")&&(s._zIndex=i.css("zIndex")),i.css("zIndex",s.zIndex)},stop:function(t,n,r){var i=r.options;i._zIndex&&e(n.helper).css("zIndex",i._zIndex)}});var f=e.ui.draggable;e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,n=this.options,r=n.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(r)?r:function(e){return e.is(r)},this.proportions=function(){if(!arguments.length)return t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};t=arguments[0]},this._addToManager(n.scope),n.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){var t=0;for(;t<e.length;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){if(t==="accept")this.accept=e.isFunction(n)?n:function(e){return e.is(n)};else if(t==="scope"){var r=e.ui.ddmanager.droppables[this.options.scope];this._splice(r),this._addToManager(n)}this._super(t,n)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]===this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]===this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current,i=!1;return!r||(r.currentItem||r.element)[0]===this.element[0]?!1:(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var n=e(this).droppable("instance");if(n.options.greedy&&!n.options.disabled&&n.options.scope===r.options.scope&&n.accept.call(n.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(n,{offset:n.element.offset()}),n.options.tolerance,t))return i=!0,!1}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1)},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,n){return e>=t&&e<t+n}return function(t,n,r,i){if(!n.offset)return!1;var s=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,u=s+t.helperProportions.width,a=o+t.helperProportions.height,f=n.offset.left,l=n.offset.top,c=f+n.proportions().width,h=l+n.proportions().height;switch(r){case"fit":return f<=s&&u<=c&&l<=o&&a<=h;case"intersect":return f<s+t.helperProportions.width/2&&u-t.helperProportions.width/2<c&&l<o+t.helperProportions.height/2&&a-t.helperProportions.height/2<h;case"pointer":return e(i.pageY,l,n.proportions().height)&&e(i.pageX,f,n.proportions().width);case"touch":return(o>=l&&o<=h||a>=l&&a<=h||o<l&&a>h)&&(s>=f&&s<=c||u>=f&&u<=c||s<f&&u>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r,i,s=e.ui.ddmanager.droppables[t.options.scope]||[],o=n?n.type:null,u=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(r=0;r<s.length;r++){if(s[r].options.disabled||t&&!s[r].accept.call(s[r].element[0],t.currentItem||t.element))continue;for(i=0;i<u.length;i++)if(u[i]===s[r].element[0]){s[r].proportions().height=0;continue e}s[r].visible=s[r].element.css("display")!=="none";if(!s[r].visible)continue;o==="mousedown"&&s[r]._activate.call(s[r],n),s[r].offset=s[r].element.offset(),s[r].proportions({width:s[r].element[0].offsetWidth,height:s[r].element[0].offsetHeight})}},drop:function(t,n){var r=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){if(!this.options)return;!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,n)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n))}),r},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var r,i,s,o=e.ui.intersect(t,this,this.options.tolerance,n),u=!o&&this.isover?"isout":o&&!this.isover?"isover":null;if(!u)return;this.options.greedy&&(i=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===i}),s.length&&(r=e(s[0]).droppable("instance"),r.greedyChild=u==="isover")),r&&u==="isover"&&(r.isover=!1,r.isout=!0,r._out.call(r,n)),this[u]=!0,this[u==="isout"?"isover":"isout"]=!1,this[u==="isover"?"_over":"_out"].call(this,n),r&&u==="isout"&&(r.isout=!1,r.isover=!0,r._over.call(r,n))})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}};var l=e.ui.droppable;e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,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(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},_create:function(){var t,n,r,i,s,o=this,u=this.options;this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!u.aspectRatio,aspectRatio:u.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:u.helper||u.ghost||u.animate?u.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").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,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom: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({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=u.handles||(e(".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=e();if(this.handles.constructor===String){this.handles==="all"&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={};for(n=0;n<t.length;n++)r=e.trim(t[n]),s="ui-resizable-"+r,i=e("<div class='ui-resizable-handle "+s+"'></div>"),i.css({zIndex:u.zIndex}),"se"===r&&i.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[r]=".ui-resizable-"+r,this.element.append(i)}this._renderAxis=function(t){var n,r,i,s;t=t||this.element;for(n in this.handles){if(this.handles[n].constructor===String)this.handles[n]=this.element.children(this.handles[n]).first().show();else if(this.handles[n].jquery||this.handles[n].nodeType)this.handles[n]=e(this.handles[n]),this._on(this.handles[n],{mousedown:o._mouseDown});this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(r=e(this.handles[n],this.element),s=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth(),i=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[n])}},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=i&&i[1]?i[1]:"se")}),u.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(u.disabled)return;e(this).removeClass("ui-resizable-autohide"),o._handles.show()}).mouseleave(function(){if(u.disabled)return;o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,n=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(n(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),n(this.originalElement),this},_mouseCapture:function(t){var n,r,i=!1;for(n in this.handles){r=e(this.handles[n])[0];if(r===t.target||e.contains(r,t.target))i=!0}return!this.options.disabled&&i},_mouseStart:function(t){var n,r,i,s=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),n=this._num(this.helper.css("left")),r=this._num(this.helper.css("top")),s.containment&&(n+=e(s.containment).scrollLeft()||0,r+=e(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:r},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:n,top:r},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio=typeof s.aspectRatio=="number"?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,i=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor",i==="auto"?this.axis+"-resize":i),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var n,r,i=this.originalMousePosition,s=this.axis,o=t.pageX-i.left||0,u=t.pageY-i.top||0,a=this._change[s];this._updatePrevProperties();if(!a)return!1;n=a.apply(this,[t,o,u]),this._updateVirtualBoundaries(t.shiftKey);if(this._aspectRatio||t.shiftKey)n=this._updateRatio(n,t);return n=this._respectSize(n,t),this._updateCache(n),this._propagate("resize",t),r=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1},_mouseStop:function(t){this.resizing=!1;var n,r,i,s,o,u,a,f=this.options,l=this;return this._helper&&(n=this._proportionallyResizeElements,r=n.length&&/textarea/i.test(n[0].nodeName),i=r&&this._hasScroll(n[0],"left")?0:l.sizeDiff.height,s=r?0:l.sizeDiff.width,o={width:l.helper.width()-s,height:l.helper.height()-i},u=parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left)||null,a=parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top)||null,f.animate||this.element.css(e.extend(o,{top:a,left:u})),l.helper.height(l.size.height),l.helper.width(l.size.width),this._helper&&!f.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),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 e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,n,r,i,s,o=this.options;s={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||e)t=s.minHeight*this.aspectRatio,r=s.minWidth/this.aspectRatio,n=s.maxHeight*this.aspectRatio,i=s.maxWidth/this.aspectRatio,t>s.minWidth&&(s.minWidth=t),r>s.minHeight&&(s.minHeight=r),n<s.maxWidth&&(s.maxWidth=n),i<s.maxHeight&&(s.maxHeight=i);this._vBoundaries=s},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,n=this.size,r=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),r==="sw"&&(e.left=t.left+(n.width-e.width),e.top=null),r==="nw"&&(e.top=t.top+(n.height-e.height),e.left=t.left+(n.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,n=this.axis,r=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,i=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,s=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,u=this.originalPosition.left+this.originalSize.width,a=this.position.top+this.size.height,f=/sw|nw|w/.test(n),l=/nw|ne|n/.test(n);return s&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),i&&(e.height=t.maxHeight),s&&f&&(e.left=u-t.minWidth),r&&f&&(e.left=u-t.maxWidth),o&&l&&(e.top=a-t.minHeight),i&&l&&(e.top=a-t.maxHeight),!e.width&&!e.height&&!e.left&&e.top?e.top=null:!e.width&&!e.height&&!e.top&&e.left&&(e.left=null),e},_getPaddingPlusBorderDimensions:function(e){var t=0,n=[],r=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],i=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];for(;t<4;t++)n[t]=parseInt(r[t],10)||0,n[t]+=parseInt(i[t],10)||0;return{height:n[0]+n[2],width:n[1]+n[3]}},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length)return;var e,t=0,n=this.helper||this.element;for(;t<this._proportionallyResizeElements.length;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:n.height()-this.outerDimensions.height||0,width:n.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var n=this.originalSize,r=this.originalPosition;return{left:r.left+t,width:n.width-t}},n:function(e,t,n){var r=this.originalSize,i=this.originalPosition;return{top:i.top+n,height:r.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),t!=="resize"&&this._trigger(t,n,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}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var n=e(this).resizable("instance"),r=n.options,i=n._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&n._hasScroll(i[0],"left")?0:n.sizeDiff.height,u=s?0:n.sizeDiff.width,a={width:n.size.width-u,height:n.size.height-o},f=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,l=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(a,l&&f?{top:l,left:f}:{}),{duration:r.animateDuration,easing:r.animateEasing,step:function(){var r={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};i&&i.length&&e(i[0]).css({width:r.width,height:r.height}),n._updateCache(r),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,n,r,i,s,o,u,a=e(this).resizable("instance"),f=a.options,l=a.element,c=f.containment,h=c instanceof e?c.get(0):/parent/.test(c)?l.parent().get(0):c;if(!h)return;a.containerElement=e(h),/document/.test(c)||c===document?(a.containerOffset={left:0,top:0},a.containerPosition={left:0,top:0},a.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(h),n=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){n[e]=a._num(t.css("padding"+r))}),a.containerOffset=t.offset(),a.containerPosition=t.position(),a.containerSize={height:t.innerHeight()-n[3],width:t.innerWidth()-n[1]},r=a.containerOffset,i=a.containerSize.height,s=a.containerSize.width,o=a._hasScroll(h,"left")?h.scrollWidth:s,u=a._hasScroll(h)?h.scrollHeight:i,a.parentData={element:h,left:r.left,top:r.top,width:o,height:u})},resize:function(t){var n,r,i,s,o=e(this).resizable("instance"),u=o.options,a=o.containerOffset,f=o.position,l=o._aspectRatio||t.shiftKey,c={top:0,left:0},h=o.containerElement,p=!0;h[0]!==document&&/static/.test(h.css("position"))&&(c=a),f.left<(o._helper?a.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-a.left:o.position.left-c.left),l&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=u.helper?a.left:0),f.top<(o._helper?a.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-a.top:o.position.top),l&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?a.top:0),i=o.containerElement.get(0)===o.element.parent().get(0),s=/relative|absolute/.test(o.containerElement.css("position")),i&&s?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),n=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-c.left:o.offset.left-a.left)),r=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-c.top:o.offset.top-a.top)),n+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-n,l&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),r+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-r,l&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),n=t.options,r=t.containerOffset,i=t.containerPosition,s=t.containerElement,o=e(t.helper),u=o.offset(),a=o.outerWidth()-t.sizeDiff.width,f=o.outerHeight()-t.sizeDiff.height;t._helper&&!n.animate&&/relative/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f}),t._helper&&!n.animate&&/static/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),n=t.options;e(n.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,n){var r=e(this).resizable("instance"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0};e(i.alsoResize).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),i={},s=t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(s,function(e,t){var n=(r[t]||0)+(u[t]||0);n&&n>=0&&(i[t]=n||null)}),t.css(i)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),n=t.options,r=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:r.height,width:r.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof n.ghost=="string"?n.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,n=e(this).resizable("instance"),r=n.options,i=n.size,s=n.originalSize,o=n.originalPosition,u=n.axis,a=typeof r.grid=="number"?[r.grid,r.grid]:r.grid,f=a[0]||1,l=a[1]||1,c=Math.round((i.width-s.width)/f)*f,h=Math.round((i.height-s.height)/l)*l,p=s.width+c,d=s.height+h,v=r.maxWidth&&r.maxWidth<p,m=r.maxHeight&&r.maxHeight<d,g=r.minWidth&&r.minWidth>p,y=r.minHeight&&r.minHeight>d;r.grid=a,g&&(p+=f),y&&(d+=l),v&&(p-=f),m&&(d-=l);if(/^(se|s|e)$/.test(u))n.size.width=p,n.size.height=d;else if(/^(ne)$/.test(u))n.size.width=p,n.size.height=d,n.position.top=o.top-h;else if(/^(sw)$/.test(u))n.size.width=p,n.size.height=d,n.position.left=o.left-c;else{if(d-l<=0||p-f<=0)t=n._getPaddingPlusBorderDimensions(this);d-l>0?(n.size.height=d,n.position.top=o.top-h):(d=l-t.height,n.size.height=d,n.position.top=o.top+s.height-d),p-f>0?(n.size.width=p,n.position.left=o.left-c):(p=f-t.width,n.size.width=p,n.position.left=o.left+s.width-p)}}});var c=e.ui.resizable,h=e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,n=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(n.options.filter,n.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this,r=this.options;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().addBack().each(function(){var r,i=e.data(this,"selectable-item");if(i)return r=!t.metaKey&&!t.ctrlKey||!i.$element.hasClass("ui-selected"),i.$element.removeClass(r?"ui-unselecting":"ui-selected").addClass(r?"ui-selecting":"ui-unselecting"),i.unselecting=!r,i.selecting=r,i.selected=r,r?n._trigger("selecting",t,{selecting:i.element}):n._trigger("unselecting",t,{unselecting:i.element}),!1})},_mouseDrag:function(t){this.dragged=!0;if(this.options.disabled)return;var n,r=this,i=this.options,s=this.opos[0],o=this.opos[1],u=t.pageX,a=t.pageY;return s>u&&(n=u,u=s,s=n),o>a&&(n=a,a=o,o=n),this.helper.css({left:s,top:o,width:u-s,height:a-o}),this.selectees.each(function(){var n=e.data(this,"selectable-item"),f=!1;if(!n||n.element===r.element[0])return;i.tolerance==="touch"?f=!(n.left>u||n.right<s||n.top>a||n.bottom<o):i.tolerance==="fit"&&(f=n.left>s&&n.right<u&&n.top>o&&n.bottom<a),f?(n.selected&&(n.$element.removeClass("ui-selected"),n.selected=!1),n.unselecting&&(n.$element.removeClass("ui-unselecting"),n.unselecting=!1),n.selecting||(n.$element.addClass("ui-selecting"),n.selecting=!0,r._trigger("selecting",t,{selecting:n.element}))):(n.selecting&&((t.metaKey||t.ctrlKey)&&n.startselected?(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.$element.addClass("ui-selected"),n.selected=!0):(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.startselected&&(n.$element.addClass("ui-unselecting"),n.unselecting=!0),r._trigger("unselecting",t,{unselecting:n.element}))),n.selected&&!t.metaKey&&!t.ctrlKey&&!n.startselected&&(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,r._trigger("unselecting",t,{unselecting:n.element})))}),!1},_mouseStop:function(t){var n=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),p=e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",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(e,t,n){return e>=t&&e<t+n},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),e==="handle"&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,n){var r=null,i=!1,s=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type==="static")return!1;this._refreshItems(t),e(t.target).parents().each(function(){if(e.data(this,s.widgetName+"-item")===s)return r=e(this),!1}),e.data(t.target,s.widgetName+"-item")===s&&(r=e(t.target));if(!r)return!1;if(this.options.handle&&!n){e(this.options.handle,r).find("*").addBack().each(function(){this===t.target&&(i=!0)});if(!i)return!1}return this.currentItem=r,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,n,r){var i,s,o=this.options;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),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},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.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(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&o.cursor!=="auto"&&(s=this.document.find("body"),this.storedCursor=s.css("cursor"),s.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(s)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var n,r,i,s,o=this.options,u=!1;this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?u=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(u=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?u=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(u=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),u!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!=="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!=="x")this.helper[0].style.top=this.position.top+"px";for(n=this.items.length-1;n>=0;n--){r=this.items[n],i=r.item[0],s=this._intersectsWithPointer(r);if(!s)continue;if(r.instance!==this.currentContainer)continue;if(i!==this.currentItem[0]&&this.placeholder[s===1?"next":"prev"]()[0]!==i&&!e.contains(this.placeholder[0],i)&&(this.options.type==="semi-dynamic"?!e.contains(this.element[0],i):!0)){this.direction=s===1?"down":"up";if(this.options.tolerance!=="pointer"&&!this._intersectsWithSides(r))break;this._rearrange(t,r),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(!t)return;e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t);if(this.options.revert){var r=this,i=this.placeholder.offset(),s=this.options.axis,o={};if(!s||s==="x")o.left=i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft);if(!s||s==="y")o.top=i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop);this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1},cancel:function(){if(this.dragging){this._mouseUp({target:null}),this.options.helper==="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c=this.options.axis==="x"||r+f>u&&r+f<a,h=this.options.axis==="y"||t+l>s&&t+l<o,p=c&&h;return this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:s<t+this.helperProportions.width/2&&n-this.helperProportions.width/2<o&&u<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<a},_intersectsWithPointer:function(e){var t=this.options.axis==="x"||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),n=this.options.axis==="y"||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=t&&n,i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return r?this.floating?s&&s==="right"||i==="down"?2:1:i&&(i==="down"?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),n=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection();return this.floating&&i?i==="right"&&n||i==="left"&&!n:r&&(r==="down"&&t||r==="up"&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return e!==0&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!==0&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function f(){o.push(this)}var n,r,i,s,o=[],u=[],a=this._connectWith();if(a&&t)for(n=a.length-1;n>=0;n--){i=e(a[n],this.document[0]);for(r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&u.push([e.isFunction(s.options.items)?s.options.items.call(s.element):e(s.options.items,s.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),s])}u.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(n=u.length-1;n>=0;n--)u[n][0].each(f);return e(o)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;n<t.length;n++)if(t[n]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n,r,i,s,o,u,a,f,l=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--){i=e(h[n],this.document[0]);for(r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(c.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s))}for(n=c.length-1;n>=0;n--){o=c[n][1],u=c[n][0];for(r=0,f=u.length;r<f;r++)a=e(u[r]),a.data(this.widgetName+"-item",o),l.push({item:a,instance:o,width:0,height:0,left:0,top:0})}},refreshPositions:function(t){this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,s;for(n=this.items.length-1;n>=0;n--){r=this.items[n];if(r.instance!==this.currentContainer&&this.currentContainer&&r.item[0]!==this.currentItem[0])continue;i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item,t||(r.width=i.outerWidth(),r.height=i.outerHeight()),s=i.offset(),r.left=s.left,r.top=s.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)s=this.containers[n].element.offset(),this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var n,r=t.options;if(!r.placeholder||r.placeholder.constructor===String)n=r.placeholder,r.placeholder={element:function(){var r=t.currentItem[0].nodeName.toLowerCase(),i=e("<"+r+">",t.document[0]).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return r==="tbody"?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(i)):r==="tr"?t._createTrPlaceholder(t.currentItem,i):r==="img"&&i.attr("src",t.currentItem.attr("src")),n||i.css("visibility","hidden"),i},update:function(e,i){if(n&&!r.forcePlaceholderSize)return;i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10))}};t.placeholder=e(r.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),r.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,n){var r=this;t.children().each(function(){e("<td>&#160;</td>",r.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(n)})},_contactContainers:function(t){var n,r,i,s,o,u,a,f,l,c,h=null,p=null;for(n=this.containers.length-1;n>=0;n--){if(e.contains(this.currentItem[0],this.containers[n].element[0]))continue;if(this._intersectsWith(this.containers[n].containerCache)){if(h&&e.contains(this.containers[n].element[0],h.element[0]))continue;h=this.containers[n],p=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",t,this._uiHash(this)),this.containers[n].containerCache.over=0)}if(!h)return;if(this.containers.length===1)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{i=1e4,s=null,l=h.floating||this._isFloating(this.currentItem),o=l?"left":"top",u=l?"width":"height",c=l?"clientX":"clientY";for(r=this.items.length-1;r>=0;r--){if(!e.contains(this.containers[p].element[0],this.items[r].item[0]))continue;if(this.items[r].item[0]===this.currentItem[0])continue;a=this.items[r].item.offset()[o],f=!1,t[c]-a>this.items[r][u]/2&&(f=!0),Math.abs(t[c]-a)<i&&(i=Math.abs(t[c]-a),s=this.items[r],this.direction=f?"up":"down")}if(!s&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p]){this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1);return}s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):n.helper==="clone"?this.currentItem.clone():this.currentItem;return r.parents("body").length||e(n.appendTo!=="parent"?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[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")}),(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width()),(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.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 t,n,r,i=this.options;i.containment==="parent"&&(i.containment=this.helper[0].parentNode);if(i.containment==="document"||i.containment==="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,i.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(i.containment==="document"?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];/^(document|window|parent)$/.test(i.containment)||(t=e(i.containment)[0],n=e(i.containment).offset(),r=e(t).css("overflow")!=="hidden",this.containment=[n.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,n){n||(n=this.position);var r=t==="absolute"?1:-1,i=this.cssPosition!=="absolute"||this.scrollParent[0]!==this.document[0]&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():s?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*r}},_generatePosition:function(t){var n,r,i=this.options,s=t.pageX,o=t.pageY,u=this.cssPosition!=="absolute"||this.scrollParent[0]!==this.document[0]&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(u[0].tagName);return this.cssPosition==="relative"&&(this.scrollParent[0]===this.document[0]||this.scrollParent[0]===this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),i.grid&&(n=this.originalPageY+Math.round((o-this.originalPageY)/i.grid[1])*i.grid[1],o=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n,r=this.originalPageX+Math.round((s-this.originalPageX)/i.grid[0])*i.grid[0],s=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():a?0:u.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():a?0:u.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(e,t){function i(e,t,n){return function(r){n._trigger(e,r,t._uiHash(t))}}this.reverting=!1;var n,r=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(n in this._storedCSS)if(this._storedCSS[n]==="auto"||this._storedCSS[n]==="static")this._storedCSS[n]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!t&&r.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!t&&r.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(r.push(function(e){this._trigger("remove",e,this._uiHash())}),r.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),r.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer))));for(n=this.containers.length-1;n>=0;n--)t||r.push(i("deactivate",this,this.containers[n])),this.containers[n].containerCache.over&&(r.push(i("out",this,this.containers[n])),this.containers[n].containerCache.over=0);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",this._storedZIndex==="auto"?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null);if(!t){for(n=0;n<r.length;n++)r[n].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}}),d=e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),!t.collapsible&&(t.active===!1||t.active==null)&&(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),this.options.heightStyle!=="content"&&e.css("height","")},_setOption:function(e,t){if(e==="active"){this._activate(t);return}e==="event"&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),e==="collapsible"&&!t&&this.options.active===!1&&this._activate(0),e==="icons"&&(this._destroyIcons(),t&&this._createIcons()),e==="disabled"&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t))},_keydown:function(t){if(t.altKey||t.ctrlKey)return;var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._eventHandler(t);break;case n.HOME:s=this.headers[0];break;case n.END:s=this.headers[r-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,n=this.options,r=n.heightStyle,i=this.element.parent();this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),n=t.uniqueId().attr("id"),r=t.next(),i=r.uniqueId().attr("id");t.attr("aria-controls",i),r.attr("aria-labelledby",n)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),r==="fill"?(t=i.height(),this.element.siblings(":visible").each(function(){var n=e(this),r=n.css("position");if(r==="absolute"||r==="fixed")return;t-=n.outerHeight(!0)}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):r==="auto"&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var n=this._findActive(t)[0];if(n===this.active[0])return;n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return typeof t=="number"?this.headers.eq(t):e()},_setupEvents:function(t){var n={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,n),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i[0]===r[0],o=s&&n.collapsible,u=o?e():i.next(),a=r.next(),f={oldHeader:r,oldPanel:a,newHeader:o?e():i,newPanel:u};t.preventDefault();if(s&&!n.collapsible||this._trigger("beforeActivate",t,f)===!1)return;n.active=o?!1:this.headers.index(i),this.active=s?e():i,this._toggle(f),r.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&r.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),s||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),i.next().addClass("ui-accordion-content-active"))},_toggle:function(t){var n=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=r,this.options.animate?this._animate(n,r,t):(r.hide(),n.show(),this._toggleComplete(t)),r.attr({"aria-hidden":"true"}),r.prev().attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&r.length?r.prev().attr({tabIndex:-1,"aria-expanded":"false"}):n.length&&this.headers.filter(function(){return parseInt(e(this).attr("tabIndex"),10)===0}).attr("tabIndex",-1),n.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,n){var r,i,s,o=this,u=0,a=e.css("box-sizing"),f=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},c=f&&l.down||l,h=function(){o._toggleComplete(n)};typeof c=="number"&&(s=c),typeof c=="string"&&(i=c),i=i||c.easing||l.easing,s=s||c.duration||l.duration;if(!t.length)return e.animate(this.showProps,s,i,h);if(!e.length)return t.animate(this.hideProps,s,i,h);r=e.show().outerHeight(),t.animate(this.hideProps,{duration:s,easing:i,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:s,easing:i,complete:h,step:function(e,n){n.now=Math.round(e),n.prop!=="height"?a==="content-box"&&(u+=n.now):o.options.heightStyle!=="content"&&(n.now=Math.round(r-t.outerHeight()-u),u=0)}})},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),v=e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var n=e(t.target);!this.mouseHandled&&n.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),n.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&this.active.parents(".ui-menu").length===1&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(this.previousFilter)return;var n=e(t.currentTarget);n.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,n)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var n=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,n)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var n,r,i,s,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,r=this.previousFilter||"",i=String.fromCharCode(t.keyCode),s=!1,clearTimeout(this.filterTimer),i===r?s=!0:i=r+i,n=this._filterMenuItems(i),n=s&&n.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):n,n.length||(i=String.fromCharCode(t.keyCode),n=this._filterMenuItems(i)),n.length?(this.focus(t,n),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,n,r=this,i=this.options.icons.submenu,s=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.parent(),r=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(r),t.attr("aria-labelledby",n.attr("id"))}),t=s.add(this.element),n=t.find(this.options.items),n.not(".ui-menu-item").each(function(){var t=e(this);r._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),n.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),n.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){e==="icons"&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),e==="disabled"&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var n,r;this.blur(e,e&&e.type==="focus"),this._scrollIntoView(t),this.active=t.first(),r=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",r.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&e.type==="keydown"?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=t.children(".ui-menu"),n.length&&e&&/^mouse/.test(e.type)&&this._startOpening(n),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var n,r,i,s,o,u;this._hasScroll()&&(n=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,r=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,i=t.offset().top-this.activeMenu.offset().top-n-r,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),u=t.outerHeight(),i<0?this.activeMenu.scrollTop(s+i):i+u>o&&this.activeMenu.scrollTop(s+i-o+u))},blur:function(e,t){t||clearTimeout(this.timer);if(!this.active)return;this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active})},_startOpening:function(e){clearTimeout(this.timer);if(e.attr("aria-hidden")!=="true")return;this.timer=this._delay(function(){this._close(),this._open(e)},this.delay)},_open:function(t){var n=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(n)},collapseAll:function(t,n){clearTimeout(this.timer),this.timer=this._delay(function(){var r=n?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));r.length||(r=this.element),this._close(r),this.blur(t),this.activeMenu=r},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,n){var r;this.active&&(e==="first"||e==="last"?r=this.active[e==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1):r=this.active[e+"All"](".ui-menu-item").eq(0));if(!r||!r.length||!this.active)r=this.activeMenu.find(this.options.items)[t]();this.focus(n,r)},nextPage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.isLastItem())return;this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r-i<0}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())},previousPage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.isFirstItem())return;this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r+i>0}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items).first())},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var n={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,n)},_filterMenuItems:function(t){var n=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),r=new RegExp("^"+n,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return r.test(e.trim(e(this).text()))})}});e.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,n,r,i=this.element[0].nodeName.toLowerCase(),s=i==="textarea",o=i==="input";this.isMultiLine=s?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[s||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(i){if(this.element.prop("readOnly")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",i);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",i);break;case s.UP:t=!0,this._keyEvent("previous",i);break;case s.DOWN:t=!0,this._keyEvent("next",i);break;case s.ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move("previousPage",r);break;case i.PAGE_DOWN:this._move("nextPage",r);break;case i.UP:this._keyEvent("previous",r);break;case i.DOWN:this._keyEvent("next",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){var r,i;if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});return}}i=n.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:i})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(i.value),r=n.item.attr("aria-label")||i.value,r&&e.trim(r).length&&(this.liveRegion.children().hide(),e("<div>").text(r).appendTo(this.liveRegion))},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e==="source"&&this._initSource(),e==="appendTo"&&this.menu.element.appendTo(this._appendTo()),e==="disabled"&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0));if(!t||!t[0])t=this.element.closest(".ui-front");return t.length||(t=this.document[0].body),t},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source=="string"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),n=this.menu.element.is(":visible"),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(!t||t&&!n&&!r)this.selectedItem=null,this.search(null,e)},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length<this.options.minLength)return this.close(t);if(this._trigger("search",t)===!1)return;return this._search(e)},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return typeof t=="string"?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var n=this.menu.element.empty();this._renderMenu(n,t),this.isNewMenu=!0,this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,n){return e("<li>").text(n.label).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(":visible")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this.isMultiLine||this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var n;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;t&&t.length?n=this.options.messages.results(t.length):n=this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(n).appendTo(this.liveRegion)}});var m=e.ui.autocomplete,g,y="ui-button ui-widget ui-state-default ui-corner-all",b="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",w=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},E=function(t){var n=t.name,r=t.form,i=e([]);return n&&(n=n.replace(/'/g,"\\'"),r?i=e(r).find("[name='"+n+"'][type=radio]"):i=e("[name='"+n+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,w),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,n=this.options,r=this.type==="checkbox"||this.type==="radio",i=r?"":"ui-state-active";n.label===null&&(n.label=this.type==="input"?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(y).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(n.disabled)return;this===g&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){if(n.disabled)return;e(this).removeClass(i)}).bind("click"+this.eventNamespace,function(e){n.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),r&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),this.type==="checkbox"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(n.disabled)return!1}):this.type==="radio"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(n.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var r=t.element[0];E(r).not(r).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(n.disabled)return!1;e(this).addClass("ui-state-active"),g=this,t.document.one("mouseup",function(){g=null})}).bind("mouseup"+this.eventNamespace,function(){if(n.disabled)return!1;e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){if(n.disabled)return!1;(t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active")}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",n.disabled),this._resetButton()},_determineButtonType:function(){var e,t,n;this.element.is("[type=checkbox]")?this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button",this.type==="checkbox"||this.type==="radio"?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),n=this.element.is(":checked"),n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",n)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(y+" ui-state-active "+b).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){this._super(e,t);if(e==="disabled"){this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&(this.type==="checkbox"||this.type==="radio"?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active"));return}this._resetButton()},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),this.type==="radio"?E(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var t=this.buttonElement.removeClass(b),n=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(n)))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){e==="disabled"&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t=this.element.css("direction")==="rtl",n=this.element.find(this.options.items),r=n.filter(":ui-button");n.not(":ui-button").button(),r.button("refresh"),this.buttons=n.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}});var S=e.ui.button;e.extend(e.ui,{datepicker:{version:"1.11.4"}});var x;e.extend(N.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return L(this._defaults,e||{}),this},_attachDatepicker:function(t,n){var r,i,s;r=t.nodeName.toLowerCase(),i=r==="div"||r==="span",t.id||(this.uuid+=1,t.id="dp"+this.uuid),s=this._newInst(e(t),i),s.settings=e.extend({},n||{}),r==="input"?this._connectDatepicker(t,s):i&&this._inlineDatepicker(t,s)},_newInst:function(t,n){var r=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:r,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:n,dpDiv:n?C(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,n){var r=e(t);n.append=e([]),n.trigger=e([]);if(r.hasClass(this.markerClassName))return;this._attachments(r,n),r.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(n),e.data(t,"datepicker",n),n.settings.disabled&&this._disableDatepicker(t)},_attachments:function(t,n){var r,i,s,o=this._get(n,"appendText"),u=this._get(n,"isRTL");n.append&&n.append.remove(),o&&(n.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[u?"before":"after"](n.append)),t.unbind("focus",this._showDatepicker),n.trigger&&n.trigger.remove(),r=this._get(n,"showOn"),(r==="focus"||r==="both")&&t.focus(this._showDatepicker);if(r==="button"||r==="both")i=this._get(n,"buttonText"),s=this._get(n,"buttonImage"),n.trigger=e(this._get(n,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:s,alt:i,title:i}):e("<button type='button'></button>").addClass(this._triggerClass).html(s?e("<img/>").attr({src:s,alt:i,title:i}):i)),t[u?"before":"after"](n.trigger),n.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1})},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,n,r,i,s=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){n=0,r=0;for(i=0;i<e.length;i++)e[i].length>n&&(n=e[i].length,r=i);return r},s.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),s.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-s.getDay())),e.input.attr("size",this._formatDate(e,s).length)}},_inlineDatepicker:function(t,n){var r=e(t);if(r.hasClass(this.markerClassName))return;r.addClass(this.markerClassName).append(n.dpDiv),e.data(t,"datepicker",n),this._setDate(n,this._getDefaultDate(n),!0),this._updateDatepicker(n),this._updateAlternate(n),n.settings.disabled&&this._disableDatepicker(t),n.dpDiv.css("display","block")},_dialogDatepicker:function(t,n,r,i,s){var o,u,a,f,l,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),L(c.settings,i||{}),n=n&&n.constructor===Date?this._formatDate(c,n):n,this._dialogInput.val(n),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(u=document.documentElement.clientWidth,a=document.documentElement.clientHeight,f=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[u/2-100+f,a/2-150+l]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=r,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var n,r=e(t),i=e.data(t,"datepicker");if(!r.hasClass(this.markerClassName))return;n=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),n==="input"?(i.append.remove(),i.trigger.remove(),r.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(n==="div"||n==="span")&&r.removeClass(this.markerClassName).empty(),x===i&&(x=null)},_enableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");if(!i.hasClass(this.markerClassName))return;n=t.nodeName.toLowerCase();if(n==="input")t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(n==="div"||n==="span")r=i.children("."+this._inlineClass),r.children().removeClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1);this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e})},_disableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");if(!i.hasClass(this.markerClassName))return;n=t.nodeName.toLowerCase();if(n==="input")t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(n==="div"||n==="span")r=i.children("."+this._inlineClass),r.children().addClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0);this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(n){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,n,r){var i,s,o,u,a=this._getInst(t);if(arguments.length===2&&typeof n=="string")return n==="defaults"?e.extend({},e.datepicker._defaults):a?n==="all"?e.extend({},a.settings):this._get(a,n):null;i=n||{},typeof n=="string"&&(i={},i[n]=r),a&&(this._curInst===a&&this._hideDatepicker(),s=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(a,"min"),u=this._getMinMaxDate(a,"max"),L(a.settings,i),o!==null&&i.dateFormat!==undefined&&i.minDate===undefined&&(a.settings.minDate=this._formatDate(a,o)),u!==null&&i.dateFormat!==undefined&&i.maxDate===undefined&&(a.settings.maxDate=this._formatDate(a,u)),"disabled"in i&&(i.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),a),this._autoSize(a),this._setDate(a,s),this._updateAlternate(a),this._updateDatepicker(a))},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(t){var n,r,i,s=e.datepicker._getInst(t.target),o=!0,u=s.dpDiv.is(".ui-datepicker-rtl");s._keyEvent=!0;if(e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return i=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",s.dpDiv),i[0]&&e.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),n=e.datepicker._get(s,"onSelect"),n?(r=e.datepicker._formatDate(s),n.apply(s.input?s.input[0]:null,[r,s])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else t.keyCode===36&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var n,r,i=e.datepicker._getInst(t.target);if(e.datepicker._get(i,"constrainInput"))return n=e.datepicker._possibleChars(e.datepicker._get(i,"dateFormat")),r=String.fromCharCode(t.charCode==null?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||r<" "||!n||n.indexOf(r)>-1},_doKeyUp:function(t){var n,r=e.datepicker._getInst(t.target);if(r.input.val()!==r.lastVal)try{n=e.datepicker.parseDate(e.datepicker._get(r,"dateFormat"),r.input?r.input.val():null,e.datepicker._getFormatConfig(r)),n&&(e.datepicker._setDateFromField(r),e.datepicker._updateAlternate(r),e.datepicker._updateDatepicker(r))}catch(i){}return!0},_showDatepicker:function(t){t=t.target||t,t.nodeName.toLowerCase()!=="input"&&(t=e("input",t.parentNode)[0]);if(e.datepicker._isDisabledDatepicker(t)||e.datepicker._lastInput===t)return;var n,r,i,s,o,u,a;n=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==n&&(e.datepicker._curInst.dpDiv.stop(!0,!0),n&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),r=e.datepicker._get(n,"beforeShow"),i=r?r.apply(t,[t,n]):{};if(i===!1)return;L(n.settings,i),n.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(n),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),s=!1,e(t).parents().each(function(){return s|=e(this).css("position")==="fixed",!s}),o={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(n),o=e.datepicker._checkOffset(n,o,s),n.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":s?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),n.inline||(u=e.datepicker._get(n,"showAnim"),a=e.datepicker._get(n,"duration"),n.dpDiv.css("z-index",T(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[u]?n.dpDiv.show(u,e.datepicker._get(n,"showOptions"),a):n.dpDiv[u||"show"](u?a:null),e.datepicker._shouldFocusInput(n)&&n.input.focus(),e.datepicker._curInst=n)},_updateDatepicker:function(t){this.maxRows=4,x=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var n,r=this._getNumberOfMonths(t),i=r[1],s=17,o=t.dpDiv.find("."+this._dayOverClass+" a");o.length>0&&k.apply(o.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),i>1&&t.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",s*i+"em"),t.dpDiv[(r[0]!==1||r[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(n=t.yearshtml,setTimeout(function(){n===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),n=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,n,r){var i=t.dpDiv.outerWidth(),s=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,u=t.input?t.input.outerHeight():0,a=document.documentElement.clientWidth+(r?0:e(document).scrollLeft()),f=document.documentElement.clientHeight+(r?0:e(document).scrollTop());return n.left-=this._get(t,"isRTL")?i-o:0,n.left-=r&&n.left===t.input.offset().left?e(document).scrollLeft():0,n.top-=r&&n.top===t.input.offset().top+u?e(document).scrollTop():0,n.left-=Math.min(n.left,n.left+i>a&&a>i?Math.abs(n.left+i-a):0),n.top-=Math.min(n.top,n.top+s>f&&f>s?Math.abs(s+u):0),n},_findPos:function(t){var n,r=this._getInst(t),i=this._get(r,"isRTL");while(t&&(t.type==="hidden"||t.nodeType!==1||e.expr.filters.hidden(t)))t=t[i?"previousSibling":"nextSibling"];return n=e(t).offset(),[n.left,n.top]},_hideDatepicker:function(t){var n,r,i,s,o=this._curInst;if(!o||t&&o!==e.data(t,"datepicker"))return;this._datepickerShowing&&(n=this._get(o,"showAnim"),r=this._get(o,"duration"),i=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[n]||e.effects[n])?o.dpDiv.hide(n,e.datepicker._get(o,"showOptions"),r,i):o.dpDiv[n==="slideDown"?"slideUp":n==="fadeIn"?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1,s=this._get(o,"onClose"),s&&s.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(!e.datepicker._curInst)return;var n=e(t.target),r=e.datepicker._getInst(n[0]);(n[0].id!==e.datepicker._mainDivId&&n.parents("#"+e.datepicker._mainDivId).length===0&&!n.hasClass(e.datepicker.markerClassName)&&!n.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||n.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==r)&&e.datepicker._hideDatepicker()},_adjustDate:function(t,n,r){var i=e(t),s=this._getInst(i[0]);if(this._isDisabledDatepicker(i[0]))return;this._adjustInstDate(s,n+(r==="M"?this._get(s,"showCurrentAtPos"):0),r),this._updateDatepicker(s)},_gotoToday:function(t){var n,r=e(t),i=this._getInst(r[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(n=new Date,i.selectedDay=n.getDate(),i.drawMonth=i.selectedMonth=n.getMonth(),i.drawYear=i.selectedYear=n.getFullYear()),this._notifyChange(i),this._adjustDate(r)},_selectMonthYear:function(t,n,r){var i=e(t),s=this._getInst(i[0]);s["selected"+(r==="M"?"Month":"Year")]=s["draw"+(r==="M"?"Month":"Year")]=parseInt(n.options[n.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(i)},_selectDay:function(t,n,r,i){var s,o=e(t);if(e(i).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0]))return;s=this._getInst(o[0]),s.selectedDay=s.currentDay=e("a",i).html(),s.selectedMonth=s.currentMonth=n,s.selectedYear=s.currentYear=r,this._selectDate(t,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear))},_clearDate:function(t){var n=e(t);this._selectDate(n,"")},_selectDate:function(t,n){var r,i=e(t),s=this._getInst(i[0]);n=n!=null?n:this._formatDate(s),s.input&&s.input.val(n),this._updateAlternate(s),r=this._get(s,"onSelect"),r?r.apply(s.input?s.input[0]:null,[n,s]):s.input&&s.input.trigger("change"),s.inline?this._updateDatepicker(s):(this._hideDatepicker(),this._lastInput=s.input[0],typeof s.input[0]!="object"&&s.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var n,r,i,s=this._get(t,"altField");s&&(n=this._get(t,"altFormat")||this._get(t,"dateFormat"),r=this._getDate(t),i=this.formatDate(n,r,this._getFormatConfig(t)),e(s).each(function(){e(this).val(i)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&t<6,""]},iso8601Week:function(e){var t,n=new Date(e.getTime());return n.setDate(n.getDate()+4-(n.getDay()||7)),t=n.getTime(),n.setMonth(0),n.setDate(1),Math.floor(Math.round((t-n)/864e5)/7)+1},parseDate:function(t,n,r){if(t==null||n==null)throw"Invalid arguments";n=typeof n=="object"?n.toString():n+"";if(n==="")return null;var i,s,o,u=0,a=(r?r.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=typeof a!="string"?a:(new Date).getFullYear()%100+parseInt(a,10),l=(r?r.dayNamesShort:null)||this._defaults.dayNamesShort,c=(r?r.dayNames:null)||this._defaults.dayNames,h=(r?r.monthNamesShort:null)||this._defaults.monthNamesShort,p=(r?r.monthNames:null)||this._defaults.monthNames,d=-1,v=-1,m=-1,g=-1,y=!1,b,w=function(e){var n=i+1<t.length&&t.charAt(i+1)===e;return n&&i++,n},E=function(e){var t=w(e),r=e==="@"?14:e==="!"?20:e==="y"&&t?4:e==="o"?3:2,i=e==="y"?r:1,s=new RegExp("^\\d{"+i+","+r+"}"),o=n.substring(u).match(s);if(!o)throw"Missing number at position "+u;return u+=o[0].length,parseInt(o[0],10)},S=function(t,r,i){var s=-1,o=e.map(w(t)?i:r,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});e.each(o,function(e,t){var r=t[1];if(n.substr(u,r.length).toLowerCase()===r.toLowerCase())return s=t[0],u+=r.length,!1});if(s!==-1)return s+1;throw"Unknown name at position "+u},x=function(){if(n.charAt(u)!==t.charAt(i))throw"Unexpected literal at position "+u;u++};for(i=0;i<t.length;i++)if(y)t.charAt(i)==="'"&&!w("'")?y=!1:x();else switch(t.charAt(i)){case"d":m=E("d");break;case"D":S("D",l,c);break;case"o":g=E("o");break;case"m":v=E("m");break;case"M":v=S("M",h,p);break;case"y":d=E("y");break;case"@":b=new Date(E("@")),d=b.getFullYear(),v=b.getMonth()+1,m=b.getDate();break;case"!":b=new Date((E("!")-this._ticksTo1970)/1e4),d=b.getFullYear(),v=b.getMonth()+1,m=b.getDate();break;case"'":w("'")?x():y=!0;break;default:x()}if(u<n.length){o=n.substr(u);if(!/^\s+/.test(o))throw"Extra/unparsed characters found in date: "+o}d===-1?d=(new Date).getFullYear():d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=f?0:-100));if(g>-1){v=1,m=g;do{s=this._getDaysInMonth(d,v-1);if(m<=s)break;v++,m-=s}while(!0)}b=this._daylightSavingAdjust(new Date(d,v-1,m));if(b.getFullYear()!==d||b.getMonth()+1!==v||b.getDate()!==m)throw"Invalid date";return b},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(e,t,n){if(!t)return"";var r,i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=function(t){var n=r+1<e.length&&e.charAt(r+1)===t;return n&&r++,n},f=function(e,t,n){var r=""+t;if(a(e))while(r.length<n)r="0"+r;return r},l=function(e,t,n,r){return a(e)?r[t]:n[t]},c="",h=!1;if(t)for(r=0;r<e.length;r++)if(h)e.charAt(r)==="'"&&!a("'")?h=!1:c+=e.charAt(r);else switch(e.charAt(r)){case"d":c+=f("d",t.getDate(),2);break;case"D":c+=l("D",t.getDay(),i,s);break;case"o":c+=f("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":c+=f("m",t.getMonth()+1,2);break;case"M":c+=l("M",t.getMonth(),o,u);break;case"y":c+=a("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":c+=t.getTime();break;case"!":c+=t.getTime()*1e4+this._ticksTo1970;break;case"'":a("'")?c+="'":h=!0;break;default:c+=e.charAt(r)}return c},_possibleChars:function(e){var t,n="",r=!1,i=function(n){var r=t+1<e.length&&e.charAt(t+1)===n;return r&&t++,r};for(t=0;t<e.length;t++)if(r)e.charAt(t)==="'"&&!i("'")?r=!1:n+=e.charAt(t);else switch(e.charAt(t)){case"d":case"m":case"y":case"@":n+="0123456789";break;case"D":case"M":return null;case"'":i("'")?n+="'":r=!0;break;default:n+=e.charAt(t)}return n},_get:function(e,t){return e.settings[t]!==undefined?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()===e.lastVal)return;var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i=this._getDefaultDate(e),s=i,o=this._getFormatConfig(e);try{s=this.parseDate(n,r,o)||i}catch(u){r=t?"":r}e.selectedDay=s.getDate(),e.drawMonth=e.selectedMonth=s.getMonth(),e.drawYear=e.selectedYear=s.getFullYear(),e.currentDay=r?s.getDate():0,e.currentMonth=r?s.getMonth():0,e.currentYear=r?s.getFullYear():0,this._adjustInstDate(e)},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,n,r){var i=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(n){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),n,e.datepicker._getFormatConfig(t))}catch(r){}var i=(n.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,s=i.getFullYear(),o=i.getMonth(),u=i.getDate(),a=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,f=a.exec(n);while(f){switch(f[2]||"d"){case"d":case"D":u+=parseInt(f[1],10);break;case"w":case"W":u+=parseInt(f[1],10)*7;break;case"m":case"M":o+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o));break;case"y":case"Y":s+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o))}f=a.exec(n)}return new Date(s,o,u)},o=n==null||n===""?r:typeof n=="string"?s(n):typeof n=="number"?isNaN(n)?r:i(n):new Date(n.getTime());return o=o&&o.toString()==="Invalid Date"?r:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),(i!==e.selectedMonth||s!==e.selectedYear)&&!n&&this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&e.input.val()===""?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var n=this._get(t,"stepMonths"),r="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(r,-n,"M")},next:function(){e.datepicker._adjustDate(r,+n,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(r)},selectDay:function(){return e.datepicker._selectDay(r,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(r,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(r,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q=new Date,R=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth(),q.getDate())),U=this._get(e,"isRTL"),z=this._get(e,"showButtonPanel"),W=this._get(e,"hideIfNoPrevNext"),X=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),$=this._get(e,"showCurrentAtPos"),J=this._get(e,"stepMonths"),K=V[0]!==1||V[1]!==1,Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(e,"min"),Y=this._getMinMaxDate(e,"max"),Z=e.drawMonth-$,et=e.drawYear;Z<0&&(Z+=12,et--);if(Y){t=this._daylightSavingAdjust(new Date(Y.getFullYear(),Y.getMonth()-V[0]*V[1]+1,Y.getDate())),t=G&&t<G?G:t;while(this._daylightSavingAdjust(new Date(et,Z,1))>t)Z--,Z<0&&(Z=11,et--)}e.drawMonth=Z,e.drawYear=et,n=this._get(e,"prevText"),n=X?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z-J,1)),this._getFormatConfig(e)):n,r=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>":W?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>",i=this._get(e,"nextText"),i=X?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z+J,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>":W?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>",o=this._get(e,"currentText"),u=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,o=X?this.formatDate(o,u,this._getFormatConfig(e)):o,a=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",f=z?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(U?a:"")+(this._isInRange(e,u)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(U?"":a)+"</div>":"",l=parseInt(this._get(e,"firstDay"),10),l=isNaN(l)?0:l,c=this._get(e,"showWeek"),h=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),d=this._get(e,"monthNames"),v=this._get(e,"monthNamesShort"),m=this._get(e,"beforeShowDay"),g=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),w="",E;for(S=0;S<V[0];S++){x="",this.maxRows=4;for(T=0;T<V[1];T++){N=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),C=" ui-corner-all",k="";if(K){k+="<div class='ui-datepicker-group";if(V[1]>1)switch(T){case 0:k+=" ui-datepicker-group-first",C=" ui-corner-"+(U?"right":"left");break;case V[1]-1:k+=" ui-datepicker-group-last",C=" ui-corner-"+(U?"left":"right");break;default:k+=" ui-datepicker-group-middle",C=""}k+="'>"}k+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&S===0?U?s:r:"")+(/all|right/.test(C)&&S===0?U?r:s:"")+this._generateMonthYearHeader(e,Z,et,G,Y,S>0||T>0,d,v)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",L=c?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"";for(E=0;E<7;E++)A=(E+l)%7,L+="<th scope='col'"+((E+l+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+h[A]+"'>"+p[A]+"</span></th>";k+=L+"</tr></thead><tbody>",O=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,O)),M=(this._getFirstDayOfMonth(et,Z)-l+7)%7,_=Math.ceil((M+O)/7),D=K?this.maxRows>_?this.maxRows:_:_,this.maxRows=D,P=this._daylightSavingAdjust(new Date(et,Z,1-M));for(H=0;H<D;H++){k+="<tr>",B=c?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(P)+"</td>":"";for(E=0;E<7;E++)j=m?m.apply(e.input?e.input[0]:null,[P]):[!0,""],F=P.getMonth()!==Z,I=F&&!y||!j[0]||G&&P<G||Y&&P>Y,B+="<td class='"+((E+l+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(P.getTime()===N.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===P.getTime()&&b.getTime()===N.getTime()?" "+this._dayOverClass:"")+(I?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!g?"":" "+j[1]+(P.getTime()===Q.getTime()?" "+this._currentClass:"")+(P.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+((!F||g)&&j[2]?" title='"+j[2].replace(/'/g,"&#39;")+"'":"")+(I?"":" data-handler='selectDay' data-event='click' data-month='"+P.getMonth()+"' data-year='"+P.getFullYear()+"'")+">"+(F&&!g?"&#xa0;":I?"<span class='ui-state-default'>"+P.getDate()+"</span>":"<a class='ui-state-default"+(P.getTime()===R.getTime()?" ui-state-highlight":"")+(P.getTime()===Q.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+P.getDate()+"</a>")+"</td>",P.setDate(P.getDate()+1),P=this._daylightSavingAdjust(P);k+=B+"</tr>"}Z++,Z>11&&(Z=0,et++),k+="</tbody></table>"+(K?"</div>"+(V[0]>0&&T===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=k}w+=x}return w+=f,e._keyEvent=!1,w},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m=this._get(e,"changeMonth"),g=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",w="";if(s||!m)w+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{a=r&&r.getFullYear()===n,f=i&&i.getFullYear()===n,w+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for(l=0;l<12;l++)(!a||l>=r.getMonth())&&(!f||l<=i.getMonth())&&(w+="<option value='"+l+"'"+(l===t?" selected='selected'":"")+">"+u[l]+"</option>");w+="</select>"}y||(b+=w+(s||!m||!g?"&#xa0;":""));if(!e.yearshtml){e.yearshtml="";if(s||!g)b+="<span class='ui-datepicker-year'>"+n+"</span>";else{c=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?n+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);return isNaN(t)?h:t},d=p(c[0]),v=Math.max(d,p(c[1]||"")),d=r?Math.max(d,r.getFullYear()):d,v=i?Math.min(v,i.getFullYear()):v,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for(;d<=v;d++)e.yearshtml+="<option value='"+d+"'"+(d===n?" selected='selected'":"")+">"+d+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}}return b+=this._get(e,"yearSuffix"),y&&(b+=(s||!m||!g?"&#xa0;":"")+w),b+="</div>",b},_adjustInstDate:function(e,t,n){var r=e.drawYear+(n==="Y"?t:0),i=e.drawMonth+(n==="M"?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+(n==="D"?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),(n==="M"||n==="Y")&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&t<n?n:t;return r&&i>r?r:i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return t==null?[1,1]:typeof t=="number"?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(t<0?t:i[0]*i[1]),1));return t<0&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n,r,i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),o=null,u=null,a=this._get(e,"yearRange");return a&&(n=a.split(":"),r=(new Date).getFullYear(),o=parseInt(n[0],10),u=parseInt(n[1],10),n[0].match(/[+\-].*/)&&(o+=r),n[1].match(/[+\-].*/)&&(u+=r)),(!i||t.getTime()>=i.getTime())&&(!s||t.getTime()<=s.getTime())&&(!o||t.getFullYear()>=o)&&(!u||t.getFullYear()<=u)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t=typeof t!="string"?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?typeof t=="object"?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),e("#"+e.datepicker._mainDivId).length===0&&e("body").append(e.datepicker.dpDiv);var n=Array.prototype.slice.call(arguments,1);return typeof t!="string"||t!=="isDisabled"&&t!=="getDate"&&t!=="widget"?t==="option"&&arguments.length===2&&typeof arguments[1]=="string"?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n)):this.each(function(){typeof t=="string"?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(n)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n))},e.datepicker=new N,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4";var A=e.datepicker,O=e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var n=e(this).css(t).offset().top;n<0&&e(this).css("top",t.top-n)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var n,r=this;if(!this._isOpen||this._trigger("beforeClose",t)===!1)return;this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance();if(!this.opener.filter(":focusable").focus().length)try{n=this.document[0].activeElement,n&&n.nodeName.toLowerCase()!=="body"&&e(n).blur()}catch(i){}this._hide(this.uiDialog,this.options.hide,function(){r._trigger("close",t)})},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,n){var r=!1,i=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),s=Math.max.apply(null,i);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),r=!0),r&&!n&&this._trigger("focus",t),r},open:function(){var t=this;if(this._isOpen){this._moveToTop()&&this._focusTabbable();return}this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open")},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function n(){var t=this.document[0].activeElement,n=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);n||this._focusTabbable()}t.preventDefault(),n.call(this),this._delay(n)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE){t.preventDefault(),this.close(t);return}if(t.keyCode!==e.ui.keyCode.TAB||t.isDefaultPrevented())return;var n=this.uiDialog.find(":tabbable"),r=n.filter(":first"),i=n.filter(":last");t.target!==i[0]&&t.target!==this.uiDialog[0]||!!t.shiftKey?(t.target===r[0]||t.target===this.uiDialog[0])&&t.shiftKey&&(this._delay(function(){i.focus()}),t.preventDefault()):(this._delay(function(){r.focus()}),t.preventDefault())},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,n=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty();if(e.isEmptyObject(n)||e.isArray(n)&&!n.length){this.uiDialog.removeClass("ui-dialog-buttons");return}e.each(n,function(n,r){var i,s;r=e.isFunction(r)?{click:r,text:n}:r,r=e.extend({type:"button"},r),i=r.click,r.click=function(){i.apply(t.element[0],arguments)},s={icons:r.icons,text:r.showText},delete r.icons,delete r.showText,e("<button></button>",r).button(s).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)},_makeDraggable:function(){function r(e){return{position:e.position,offset:e.offset}}var t=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,i){e(this).addClass("ui-dialog-dragging"),t._blockFrames(),t._trigger("dragStart",n,r(i))},drag:function(e,n){t._trigger("drag",e,r(n))},stop:function(i,s){var o=s.offset.left-t.document.scrollLeft(),u=s.offset.top-t.document.scrollTop();n.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(u>=0?"+":"")+u,of:t.window},e(this).removeClass("ui-dialog-dragging"),t._unblockFrames(),t._trigger("dragStop",i,r(s))}})},_makeResizable:function(){function o(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var t=this,n=this.options,r=n.resizable,i=this.uiDialog.css("position"),s=typeof r=="string"?r:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:n.maxWidth,maxHeight:n.maxHeight,minWidth:n.minWidth,minHeight:this._minHeight(),handles:s,start:function(n,r){e(this).addClass("ui-dialog-resizing"),t._blockFrames(),t._trigger("resizeStart",n,o(r))},resize:function(e,n){t._trigger("resize",e,o(n))},stop:function(r,i){var s=t.uiDialog.offset(),u=s.left-t.document.scrollLeft(),a=s.top-t.document.scrollTop();n.height=t.uiDialog.height(),n.width=t.uiDialog.width(),n.position={my:"left top",at:"left"+(u>=0?"+":"")+u+" "+"top"+(a>=0?"+":"")+a,of:t.window},e(this).removeClass("ui-dialog-resizing"),t._unblockFrames(),t._trigger("resizeStop",r,o(i))}}).css("position",i)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),n=e.inArray(this,t);n!==-1&&t.splice(n,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return e.height==="auto"?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var n=this,r=!1,i={};e.each(t,function(e,t){n._setOption(e,t),e in n.sizeRelatedOptions&&(r=!0),e in n.resizableRelatedOptions&&(i[e]=t)}),r&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",i)},_setOption:function(e,t){var n,r,i=this.uiDialog;e==="dialogClass"&&i.removeClass(this.options.dialogClass).addClass(t);if(e==="disabled")return;this._super(e,t),e==="appendTo"&&this.uiDialog.appendTo(this._appendTo()),e==="buttons"&&this._createButtons(),e==="closeText"&&this.uiDialogTitlebarClose.button({label:""+t}),e==="draggable"&&(n=i.is(":data(ui-draggable)"),n&&!t&&i.draggable("destroy"),!n&&t&&this._makeDraggable()),e==="position"&&this._position(),e==="resizable"&&(r=i.is(":data(ui-resizable)"),r&&!t&&i.resizable("destroy"),r&&typeof t=="string"&&i.resizable("option","handles",t),!r&&t!==!1&&this._makeResizable()),e==="title"&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title"))},_size:function(){var e,t,n,r=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),r.minWidth>r.width&&(r.width=r.minWidth),e=this.uiDialog.css({height:"auto",width:r.width}).outerHeight(),t=Math.max(0,r.minHeight-e),n=typeof r.maxHeight=="number"?Math.max(0,r.maxHeight-e):"none",r.height==="auto"?this.element.css({minHeight:t,maxHeight:n,height:"auto"}):this.element.height(Math.max(0,r.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(!this.options.modal)return;var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){if(t)return;this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)},_destroyOverlay:function(){if(!this.options.modal)return;if(this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),M=e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){if(e===undefined)return this.options.value;this.options.value=this._constrainedValue(e),this._refreshValue()},_constrainedValue:function(e){return e===undefined&&(e=this.options.value),this.indeterminate=e===!1,typeof e!="number"&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){e==="max"&&(t=Math.max(this.min,t)),e==="disabled"&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,n=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(n.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),_=e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,n){e.preventDefault(),t._setSelection(),t._select(n.item.data("ui-selectmenu-item"),e)},focus:function(e,n){var r=n.item.data("ui-selectmenu-item");t.focusIndex!=null&&r.index!==t.focusIndex&&(t._trigger("focus",e,{item:r}),t.isOpen||t._select(r,e)),t.focusIndex=r.index,t.button.attr("aria-activedescendant",t.menuItems.eq(r.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");if(!t.length)return;this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled"))},open:function(e){if(this.options.disabled)return;this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e)},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){if(!this.isOpen)return;this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e)},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,n){var r=this,i="";e.each(n,function(n,s){s.optgroup!==i&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(s.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:s.optgroup}).appendTo(t),i=s.optgroup),r._renderItemData(t,s)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,n){var r=e("<li>");return n.disabled&&r.addClass("ui-state-disabled"),this._setText(r,n.label),r.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var n,r,i=".ui-menu-item";this.isOpen?n=this.menuItems.eq(this.focusIndex):(n=this.menuItems.eq(this.element[0].selectedIndex),i+=":not(.ui-state-disabled)"),e==="first"||e==="last"?r=n[e==="first"?"prevAll":"nextAll"](i).eq(-1):r=n[e+"All"](i).eq(0),r.length&&this.menuInstance.focus(t,r)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;if(!this.range)return;window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus()},_documentClick:{mousedown:function(t){if(!this.isOpen)return;e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t)}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var n=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),n=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),n=!1}n&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var n=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==n&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){e==="icons"&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),e==="appendTo"&&this.menuWrap.appendTo(this._appendTo()),e==="disabled"&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),e==="width"&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0));if(!t||!t[0])t=this.element.closest(".ui-front");return t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var n=[];t.each(function(t,r){var i=e(r),s=i.parent("optgroup");n.push({element:i,index:t,value:i.val(),label:i.text(),optgroup:s.attr("label")||"",disabled:s.prop("disabled")||i.prop("disabled")})}),this.items=n},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),D=e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,n,r=this.options,i=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),s="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];n=r.values&&r.values.length||1,i.length>n&&(i.slice(n).remove(),i=i.slice(0,n));for(t=i.length;t<n;t++)o.push(s);this.handles=i.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,n="";t.range?(t.range===!0&&(t.values?t.values.length&&t.values.length!==2?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),!this.range||!this.range.length?(this.range=e("<div></div>").appendTo(this.element),n="ui-slider-range ui-widget-header ui-corner-all"):this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}),this.range.addClass(n+(t.range==="min"||t.range==="max"?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var n,r,i,s,o,u,a,f,l=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),n={x:t.pageX,y:t.pageY},r=this._normValueFromMouse(n),i=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var n=Math.abs(r-l.values(t));if(i>n||i===n&&(t===l._lastChangedValue||l.values(t)===c.min))i=n,s=e(this),o=t}),u=this._start(t,o),u===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),a=s.offset(),f=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=f?{left:0,top:0}:{left:t.pageX-a.left-s.width()/2,top:t.pageY-a.top-s.height()/2-(parseInt(s.css("borderTopWidth"),10)||0)-(parseInt(s.css("borderBottomWidth"),10)||0)+(parseInt(s.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return this.orientation==="horizontal"?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),r<0&&(r=0),this.orientation==="vertical"&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),this.options.values.length===2&&this.options.range===!0&&(t===0&&n>r||t===1&&n<r)&&(n=r),n!==this.values(t)&&(i=this.values(),i[t]=n,s=this._trigger("slide",e,{handle:this.handles[t],value:n,values:i}),r=this.values(t?0:1),s!==!1&&this.values(t,n))):n!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:n}),s!==!1&&this.value(n))},_stop:function(e,t){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("stop",e,n)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,n)}},value:function(e){if(arguments.length){this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(t,n){var r,i,s;if(arguments.length>1){this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t);return}if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();r=this.options.values,i=arguments[0];for(s=0;s<r.length;s+=1)r[s]=this._trimAlignValue(i[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,n){var r,i=0;t==="range"&&this.options.range===!0&&(n==="min"?(this.options.value=this._values(0),this.options.values=null):n==="max"&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(i=this.options.values.length),t==="disabled"&&this.element.toggleClass("ui-state-disabled",!!n),this._super(t,n);switch(t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css(n==="horizontal"?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(r=0;r<i;r+=1)this._change(null,r);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e),e},_values:function(e){var t,n,r;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t),t;if(this.options.values&&this.options.values.length){n=this.options.values.slice();for(r=0;r<n.length;r+=1)n[r]=this._trimAlignValue(n[r]);return n}return[]},_trimAlignValue:function(e){if(e<=this._valueMin())return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return Math.abs(n)*2>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),n=this.options.step,r=Math.floor(+(e-t).toFixed(this._precision())/n)*n;e=r+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return this.options.min!==null&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),n=t.indexOf(".");return n===-1?0:t.length-n-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,n,r,i,s,o=this.options.range,u=this.options,a=this,f=this._animateOff?!1:u.animate,l={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=(a.values(r)-a._valueMin())/(a._valueMax()-a._valueMin())*100,l[a.orientation==="horizontal"?"left":"bottom"]=n+"%",e(this).stop(1,1)[f?"animate":"css"](l,u.animate),a.options.range===!0&&(a.orientation==="horizontal"?(r===0&&a.range.stop(1,1)[f?"animate":"css"]({left:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({width:n-t+"%"},{queue:!1,duration:u.animate})):(r===0&&a.range.stop(1,1)[f?"animate":"css"]({bottom:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({height:n-t+"%"},{queue:!1,duration:u.animate}))),t=n}):(r=this.value(),i=this._valueMin(),s=this._valueMax(),n=s!==i?(r-i)/(s-i)*100:0,l[this.orientation==="horizontal"?"left":"bottom"]=n+"%",this.handle.stop(1,1)[f?"animate":"css"](l,u.animate),o==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[f?"animate":"css"]({width:n+"%"},u.animate),o==="max"&&this.orientation==="horizontal"&&this.range[f?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:u.animate}),o==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[f?"animate":"css"]({height:n+"%"},u.animate),o==="max"&&this.orientation==="vertical"&&this.range[f?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:u.animate}))},_handleEvents:{keydown:function(t){var n,r,i,s,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:t.preventDefault();if(!this._keySliding){this._keySliding=!0,e(t.target).addClass("ui-state-active"),n=this._start(t,o);if(n===!1)return}}s=this.options.step,this.options.values&&this.options.values.length?r=i=this.values(o):r=i=this.value();switch(t.keyCode){case e.ui.keyCode.HOME:i=this._valueMin();break;case e.ui.keyCode.END:i=this._valueMax();break;case e.ui.keyCode.PAGE_UP:i=this._trimAlignValue(r+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(r-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(r===this._valueMax())return;i=this._trimAlignValue(r+s);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(r===this._valueMin())return;i=this._trimAlignValue(r-s)}this._slide(t,o,i)},keyup:function(t){var n=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,n),this._change(t,n),e(t.target).removeClass("ui-state-active"))}}}),H=e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this.value()!==""&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},n=this.element;return e.each(["min","max","step"],function(e,r){var i=n.attr(r);i!==undefined&&i.length&&(t[r]=i)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e)},mousewheel:function(e,t){if(!t)return;if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()},"mousedown .ui-spinner-button":function(t){function r(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),r.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,r.call(this)});if(this._start(t)===!1)return;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(!e(t.currentTarget).hasClass("ui-state-active"))return;if(this._start(t)===!1)return!1;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(e.height()*.5)&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var n=this.options,r=e.ui.keyCode;switch(t.keyCode){case r.UP:return this._repeat(null,1,t),!0;case r.DOWN:return this._repeat(null,-1,t),!0;case r.PAGE_UP:return this._repeat(null,n.page,t),!0;case r.PAGE_DOWN:return this._repeat(null,-n.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return!this.spinning&&this._trigger("start",e)===!1?!1:(this.counter||(this.counter=1),this.spinning=!0,!0)},_repeat:function(e,t,n){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,n)},e),this._spin(t*this.options.step,n)},_spin:function(e,t){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+e*this._increment(this.counter));if(!this.spinning||this._trigger("spin",t,{value:n})!==!1)this._value(n),this.counter++},_increment:function(t){var n=this.options.incremental;return n?e.isFunction(n)?n(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return this.options.min!==null&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),n=t.indexOf(".");return n===-1?0:t.length-n-1},_adjustValue:function(e){var t,n,r=this.options;return t=r.min!==null?r.min:0,n=e-t,n=Math.round(n/r.step)*r.step,e=t+n,e=parseFloat(e.toFixed(this._precision())),r.max!==null&&e>r.max?r.max:r.min!==null&&e<r.min?r.min:e},_stop:function(e){if(!this.spinning)return;clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e)},_setOption:function(e,t){if(e==="culture"||e==="numberFormat"){var n=this._parse(this.element.val());this.options[e]=t,this.element.val(this._format(n));return}(e==="max"||e==="min"||e==="step")&&typeof t=="string"&&(t=this._parse(t)),e==="icons"&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),e==="disabled"&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:P(function(e){this._super(e)}),_parse:function(e){return typeof e=="string"&&e!==""&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),e===""||isNaN(e)?null:e},_format:function(e){return e===""?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return e===null?!1:e===this._adjustValue(e)},_value:function(e,t){var n;e!==""&&(n=this._parse(e),n!==null&&(t||(n=this._adjustValue(n)),e=this._format(n))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:P(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:P(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:P(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:P(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){if(!arguments.length)return this._parse(this.element.val());P(this._value).call(this,e)},widget:function(){return this.uiSpinner}}),B=e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var n,r;t=t.cloneNode(!1),n=t.href.replace(e,""),r=location.href.replace(e,"");try{n=decodeURIComponent(n)}catch(i){}try{r=decodeURIComponent(r)}catch(i){}return t.hash.length>1&&n===r}}(),_create:function(){var t=this,n=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible),this._processTabs(),n.active=this._initialActive(),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(n.active):this.active=e(),this._refresh(),this.active.length&&this.load(n.active)},_initialActive:function(){var t=this.options.active,n=this.options.collapsible,r=location.hash.substring(1);if(t===null){r&&this.tabs.each(function(n,i){if(e(i).attr("aria-controls")===r)return t=n,!1}),t===null&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active")));if(t===null||t===-1)t=this.tabs.length?0:!1}return t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),t===-1&&(t=n?!1:0)),!n&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(this._handlePageNav(t))return;switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:t.preventDefault(),clearTimeout(this.activating),this._activate(r);return;case e.ui.keyCode.ENTER:t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r);return;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),!t.ctrlKey&&!t.metaKey&&(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))},_panelKeydown:function(t){if(this._handlePageNav(t))return;t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(t,n){function i(){return t>r&&(t=0),t<0&&(t=r),t}var r=this.tabs.length-1;while(e.inArray(i(),this.options.disabled)!==-1)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){if(e==="active"){this._activate(t);return}if(e==="disabled"){this._setupDisabled(t);return}this._super(e,t),e==="collapsible"&&(this.element.toggleClass("ui-tabs-collapsible",t),!t&&this.options.active===!1&&this._activate(0)),e==="event"&&this._setupEvents(t),e==="heightStyle"&&this._setupHeightStyle(t)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active===!1||!this.anchors.length?(t.active=!1,this.active=e()):this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,n=this.tabs,r=this.anchors,i=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,s,o,u=e(r).uniqueId().attr("id"),a=e(r).closest("li"),f=a.attr("aria-controls");t._isLocal(r)?(i=r.hash,o=i.substring(1),s=t.element.find(t._sanitizeSelector(i))):(o=a.attr("aria-controls")||e({}).uniqueId()[0].id,i="#"+o,s=t.element.find(i),s.length||(s=t._createPanel(o),s.insertAfter(t.panels[n-1]||t.tablist)),s.attr("aria-live","polite")),s.length&&(t.panels=t.panels.add(s)),f&&a.data("ui-tabs-aria-controls",f),a.attr({"aria-controls":o,"aria-labelledby":u}),s.attr("aria-labelledby",u)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),n&&(this._off(n.not(this.tabs)),this._off(r.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n=0,r;r=this.tabs[n];n++)t===!0||e.inArray(n,t)!==-1?e(r).addClass("ui-state-disabled").attr("aria-disabled","true"):e(r).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r=this.element.parent();t==="fill"?(n=r.height(),n-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");if(r==="absolute"||r==="fixed")return;n-=t.outerHeight(!0)}),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):t==="auto"&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault();if(s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1)return;n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),!f.length&&!a.length&&e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l)},_toggle:function(t,n){function o(){r.running=!1,r._trigger("activate",t,n)}function u(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),i.length&&r.options.show?r._show(i,r.options.show,o):(i.show(),o())}var r=this,i=n.newPanel,s=n.oldPanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s.hide(),u()),s.attr("aria-hidden","true"),n.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?n.oldTab.attr("tabIndex",-1):i.length&&this.tabs.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),i.attr("aria-hidden","false"),n.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);if(r[0]===this.active[0])return;r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),this.options.heightStyle!=="content"&&this.panels.css("height","")},enable:function(t){var n=this.options.disabled;if(n===!1)return;t===undefined?n=!1:(t=this._getIndex(t),e.isArray(n)?n=e.map(n,function(e){return e!==t?e:null}):n=e.map(this.tabs,function(e,n){return n!==t?n:null})),this._setupDisabled(n)},disable:function(t){var n=this.options.disabled;if(n===!0)return;if(t===undefined)n=!0;else{t=this._getIndex(t);if(e.inArray(t,n)!==-1)return;e.isArray(n)?n=e.merge([t],n).sort():n=[t]}this._setupDisabled(n)},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),s=i.find(".ui-tabs-anchor"),o=this._getPanelForTab(i),u={tab:i,panel:o},a=function(e,t){t==="abort"&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr};if(this._isLocal(s[0]))return;this.xhr=e.ajax(this._ajaxSettings(s,n,u)),this.xhr&&this.xhr.statusText!=="canceled"&&(i.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,i){setTimeout(function(){o.html(e),r._trigger("load",n,u),a(i,t)},1)}).fail(function(e,t){setTimeout(function(){a(e,t)},1)}))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}}),j=e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))},_removeDescribedBy:function(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);i!==-1&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,n){var r=this;if(t==="disabled"){this[n?"_disable":"_enable"](),this.options[t]=n;return}this._super(t,n),t==="content"&&e.each(this.tooltips,function(e,t){r._updateContent(t.element)})},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r.element[0],t.close(i,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);if(!r.length||r.data("ui-tooltip-id"))return;r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&t.type==="mouseover"&&r.parents().each(function(){var t=e(this),r;t.data("ui-tooltip-open")&&(r=e.Event("blur"),r.target=r.currentTarget=this,n.close(r,!0)),t.attr("title")&&(t.uniqueId(),n.parents[this.id]={element:this,title:t.attr("title")},t.attr("title",""))}),this._registerCloseHandlers(t,r),this._updateContent(r,t)},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;if(typeof r=="string")return this._open(t,e,r);n=r.call(e[0],function(n){i._delay(function(){if(!e.data("ui-tooltip-open"))return;t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n)},_open:function(t,n,r){function f(e){a.of=e;if(s.is(":hidden"))return;s.position(a)}var i,s,o,u,a=e.extend({},this.options.position);if(!r)return;i=this._find(n);if(i){i.tooltip.find(".ui-tooltip-content").html(r);return}n.is("[title]")&&(t&&t.type==="mouseover"?n.attr("title",""):n.removeAttr("title")),i=this._tooltip(n),s=i.tooltip,this._addDescribedBy(n,s.attr("id")),s.find(".ui-tooltip-content").html(r),this.liveRegion.children().hide(),r.clone?(u=r.clone(),u.removeAttr("id").find("[id]").removeAttr("id")):u=r,e("<div>").html(u).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:f}),f(t)):s.position(e.extend({of:n},this.options.position)),s.hide(),this._show(s,this.options.show),this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){s.is(":visible")&&(f(a.of),clearInterval(o))},e.fx.interval)),this._trigger("open",t,{tooltip:s})},_registerCloseHandlers:function(t,n){var r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var r=e.Event(t);r.currentTarget=n[0],this.close(r,!0)}}};n[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(this._find(n).tooltip)});if(!t||t.type==="mouseover")r.mouseleave="close";if(!t||t.type==="focusin")r.focusout="close";this._on(!0,n,r)},close:function(t){var n,r=this,i=e(t?t.currentTarget:this.element),s=this._find(i);if(!s){i.removeData("ui-tooltip-open");return}n=s.tooltip;if(s.closing)return;clearInterval(this.delayedShow),i.data("ui-tooltip-title")&&!i.attr("title")&&i.attr("title",i.data("ui-tooltip-title")),this._removeDescribedBy(i),s.hiding=!0,n.stop(!0),this._hide(n,this.options.hide,function(){r._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&t.type==="mouseleave"&&e.each(this.parents,function(t,n){e(n.element).attr("title",n.title),delete r.parents[t]}),s.closing=!0,this._trigger("close",t,{tooltip:n}),s.hiding||(s.closing=!1)},_tooltip:function(t){var n=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),r=n.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[r]={element:t,tooltip:n}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur"),s=r.element;i.target=i.currentTarget=s[0],t.close(i,!0),e("#"+n).remove(),s.data("ui-tooltip-title")&&(s.attr("title")||s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),F="ui-effects-",I=e;e.effects={effect:{}},function(e,t){function h(e,t,n){var r=u[t.type]||{};return e==null?n||!t.def?null:t.def:(e=r.floor?~~e:parseFloat(e),isNaN(e)?t.def:r.mod?(e+r.mod)%r.mod:0>e?0:r.max<e?r.max:e)}function p(t){var n=s(),r=n._rgba=[];return t=t.toLowerCase(),c(i,function(e,i){var s,u=i.re.exec(t),a=u&&i.parse(u),f=i.space||"rgba";if(a)return s=n[f](a),n[o[f].cache]=s[o[f].cache],r=n._rgba=s._rgba,!1}),r.length?(r.join()==="0,0,0,0"&&e.extend(r,l.transparent),n):l[t]}function d(e,t,n){return n=(n+1)%1,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}var n="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,i=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1]*2.55,e[2]*2.55,e[3]*2.55,e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],s=e.Color=function(t,n,r,i){return new e.Color.fn.parse(t,n,r,i)},o={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},a=s.support={},f=e("<p>")[0],l,c=e.each;f.style.cssText="background-color:rgba(1,1,1,.5)",a.rgba=f.style.backgroundColor.indexOf("rgba")>-1,c(o,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),s.fn=e.extend(s.prototype,{parse:function(n,r,i,u){if(n===t)return this._rgba=[null,null,null,null],this;if(n.jquery||n.nodeType)n=e(n).css(r),r=t;var a=this,f=e.type(n),d=this._rgba=[];r!==t&&(n=[n,r,i,u],f="array");if(f==="string")return this.parse(p(n)||l._default);if(f==="array")return c(o.rgba.props,function(e,t){d[t.idx]=h(n[t.idx],t)}),this;if(f==="object")return n instanceof s?c(o,function(e,t){n[t.cache]&&(a[t.cache]=n[t.cache].slice())}):c(o,function(t,r){var i=r.cache;c(r.props,function(e,t){if(!a[i]&&r.to){if(e==="alpha"||n[e]==null)return;a[i]=r.to(a._rgba)}a[i][t.idx]=h(n[e],t,!0)}),a[i]&&e.inArray(null,a[i].slice(0,3))<0&&(a[i][3]=1,r.from&&(a._rgba=r.from(a[i])))}),this},is:function(e){var t=s(e),n=!0,r=this;return c(o,function(e,i){var s,o=t[i.cache];return o&&(s=r[i.cache]||i.to&&i.to(r._rgba)||[],c(i.props,function(e,t){if(o[t.idx]!=null)return n=o[t.idx]===s[t.idx],n})),n}),n},_space:function(){var e=[],t=this;return c(o,function(n,r){t[r.cache]&&e.push(n)}),e.pop()},transition:function(e,t){var n=s(e),r=n._space(),i=o[r],a=this.alpha()===0?s("transparent"):this,f=a[i.cache]||i.to(a._rgba),l=f.slice();return n=n[i.cache],c(i.props,function(e,r){var i=r.idx,s=f[i],o=n[i],a=u[r.type]||{};if(o===null)return;s===null?l[i]=o:(a.mod&&(o-s>a.mod/2?s+=a.mod:s-o>a.mod/2&&(s-=a.mod)),l[i]=h((o-s)*t+s,r))}),this[r](l)},blend:function(t){if(this._rgba[3]===1)return this;var n=this._rgba.slice(),r=n.pop(),i=s(t)._rgba;return s(e.map(n,function(e,t){return(1-r)*i[t]+r*e}))},toRgbaString:function(){var t="rgba(",n=e.map(this._rgba,function(e,t){return e==null?t>2?1:0:e});return n[3]===1&&(n.pop(),t="rgb("),t+n.join()+")"},toHslaString:function(){var t="hsla(",n=e.map(this.hsla(),function(e,t){return e==null&&(e=t>2?1:0),t&&t<3&&(e=Math.round(e*100)+"%"),e});return n[3]===1&&(n.pop(),t="hsl("),t+n.join()+")"},toHexString:function(t){var n=this._rgba.slice(),r=n.pop();return t&&n.push(~~(r*255)),"#"+e.map(n,function(e){return e=(e||0).toString(16),e.length===1?"0"+e:e}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),s.fn.parse.prototype=s.fn,o.hsla.to=function(e){if(e[0]==null||e[1]==null||e[2]==null)return[null,null,null,e[3]];var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=e[3],s=Math.max(t,n,r),o=Math.min(t,n,r),u=s-o,a=s+o,f=a*.5,l,c;return o===s?l=0:t===s?l=60*(n-r)/u+360:n===s?l=60*(r-t)/u+120:l=60*(t-n)/u+240,u===0?c=0:f<=.5?c=u/a:c=u/(2-a),[Math.round(l)%360,c,f,i==null?1:i]},o.hsla.from=function(e){if(e[0]==null||e[1]==null||e[2]==null)return[null,null,null,e[3]];var t=e[0]/360,n=e[1],r=e[2],i=e[3],s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;return[Math.round(d(o,s,t+1/3)*255),Math.round(d(o,s,t)*255),Math.round(d(o,s,t-1/3)*255),i]},c(o,function(n,i){var o=i.props,u=i.cache,a=i.to,f=i.from;s.fn[n]=function(n){a&&!this[u]&&(this[u]=a(this._rgba));if(n===t)return this[u].slice();var r,i=e.type(n),l=i==="array"||i==="object"?n:arguments,p=this[u].slice();return c(o,function(e,t){var n=l[i==="object"?e:t.idx];n==null&&(n=p[t.idx]),p[t.idx]=h(n,t)}),f?(r=s(f(p)),r[u]=p,r):s(p)},c(o,function(t,i){if(s.fn[t])return;s.fn[t]=function(s){var o=e.type(s),u=t==="alpha"?this._hsla?"hsla":"rgba":n,a=this[u](),f=a[i.idx],l;return o==="undefined"?f:(o==="function"&&(s=s.call(this,f),o=e.type(s)),s==null&&i.empty?this:(o==="string"&&(l=r.exec(s),l&&(s=f+parseFloat(l[2])*(l[1]==="+"?1:-1))),a[i.idx]=s,this[u](a)))}})}),s.hook=function(t){var n=t.split(" ");c(n,function(t,n){e.cssHooks[n]={set:function(t,r){var i,o,u="";if(r!=="transparent"&&(e.type(r)!=="string"||(i=p(r)))){r=s(i||r);if(!a.rgba&&r._rgba[3]!==1){o=n==="backgroundColor"?t.parentNode:t;while((u===""||u==="transparent")&&o&&o.style)try{u=e.css(o,"backgroundColor"),o=o.parentNode}catch(f){}r=r.blend(u&&u!=="transparent"?u:"_default")}r=r.toRgbaString()}try{t.style[n]=r}catch(f){}}},e.fx.step[n]=function(t){t.colorInit||(t.start=s(t.elem,n),t.end=s(t.end),t.colorInit=!0),e.cssHooks[n].set(t.elem,t.start.transition(t.end,t.pos))}})},s.hook(n),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(n,r){t["border"+r+"Color"]=e}),t}},l=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(I),function(){function r(t){var n,r,i=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,s={};if(i&&i.length&&i[0]&&i[i[0]]){r=i.length;while(r--)n=i[r],typeof i[n]=="string"&&(s[e.camelCase(n)]=i[n])}else for(n in i)typeof i[n]=="string"&&(s[n]=i[n]);return s}function i(t,r){var i={},s,o;for(s in r)o=r[s],t[s]!==o&&!n[s]&&(e.fx.step[s]||!isNaN(parseFloat(o)))&&(i[s]=o);return i}var t=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,n){e.fx.step[n]=function(e){if(e.end!=="none"&&!e.setAttr||e.pos===1&&!e.setAttr)I.style(e.elem,n,e.end),e.setAttr=!0}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,s,o,u){var a=e.speed(s,o,u);return this.queue(function(){var s=e(this),o=s.attr("class")||"",u,f=a.children?s.find("*").addBack():s;f=f.map(function(){var t=e(this);return{el:t,start:r(this)}}),u=function(){e.each(t,function(e,t){n[t]&&s[t+"Class"](n[t])})},u(),f=f.map(function(){return this.end=r(this.el[0]),this.diff=i(this.start,this.end),this}),s.attr("class",o),f=f.map(function(){var t=this,n=e.Deferred(),r=e.extend({},a,{queue:!1,complete:function(){n.resolve(t)}});return this.el.animate(this.diff,r),n.promise()}),e.when.apply(e,f.get()).done(function(){u(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),a.complete.call(s[0])})})},e.fn.extend({addClass:function(t){return function(n,r,i,s){return r?e.effects.animateClass.call(this,{add:n},r,i,s):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(n,r,i,s){return arguments.length>1?e.effects.animateClass.call(this,{remove:n},r,i,s):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(n,r,i,s,o){return typeof r=="boolean"||r===undefined?i?e.effects.animateClass.call(this,r?{add:n}:{remove:n},i,s,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:n},r,i,s)}}(e.fn.toggleClass),switchClass:function(t,n,r,i,s){return e.effects.animateClass.call(this,{add:n,remove:t},r,i,s)}})}(),function(){function t(t,n,r,i){e.isPlainObject(t)&&(n=t,t=t.effect),t={effect:t},n==null&&(n={}),e.isFunction(n)&&(i=n,r=null,n={});if(typeof n=="number"||e.fx.speeds[n])i=r,r=n,n={};return e.isFunction(r)&&(i=r,r=null),n&&e.extend(t,n),r=r||n.duration,t.duration=e.fx.off?0:typeof r=="number"?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,t.complete=i||n.complete,t}function n(t){return!t||typeof t=="number"||e.fx.speeds[t]?!0:typeof t=="string"&&!e.effects.effect[t]?!0:e.isFunction(t)?!0:typeof t=="object"&&!t.effect?!0:!1}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.data(F+t[n],e[0].style[t[n]])},restore:function(e,t){var n,r;for(r=0;r<t.length;r++)t[r]!==null&&(n=e.data(F+t[r]),n===undefined&&(n=""),e.css(t[r],n))},setMode:function(e,t){return t==="toggle"&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(o){s=document.body}return t.wrap(r),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),r=t.parent(),t.css("position")==="static"?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(i),r.css(n).show()},removeWrapper:function(t){var n=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===n||e.contains(t[0],n))&&e(n).focus()),t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(){function o(t){function u(){e.isFunction(i)&&i.call(r[0]),e.isFunction(t)&&t()}var r=e(this),i=n.complete,o=n.mode;(r.is(":hidden")?o==="hide":o==="show")?(r[o](),u()):s.call(r[0],n,u)}var n=t.apply(this,arguments),r=n.mode,i=n.queue,s=e.effects.effect[n.effect];return e.fx.off||!s?r?this[r](n.duration,n.complete):this.each(function(){n.complete&&n.complete.call(this)}):i===!1?this.each(o):this.queue(i||"fx",o)},show:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(r){if(n(r)||typeof r=="boolean")return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,n){t[n]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return e===0||e===1?e:-Math.pow(2,8*(e-1))*Math.sin(((e-1)*80-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){var t,n=4;while(e<((t=Math.pow(2,--n))-1)/11);return 1/Math.pow(4,3-n)-7.5625*Math.pow((t*3-2)/22-e,2)}}),e.each(t,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return e<.5?n(e*2)/2:1-n(e*-2+2)/2}})}();var q=e.effects,R=e.effects.effect.blind=function(t,n){var r=e(this),i=/up|down|vertical/,s=/up|left|vertical|horizontal/,o=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(r,t.mode||"hide"),a=t.direction||"up",f=i.test(a),l=f?"height":"width",c=f?"top":"left",h=s.test(a),p={},d=u==="show",v,m,g;r.parent().is(".ui-effects-wrapper")?e.effects.save(r.parent(),o):e.effects.save(r,o),r.show(),v=e.effects.createWrapper(r).css({overflow:"hidden"}),m=v[l](),g=parseFloat(v.css(c))||0,p[l]=d?m:0,h||(r.css(f?"bottom":"right",0).css(f?"top":"left","auto").css({position:"absolute"}),p[c]=d?g:m+g),d&&(v.css(l,0),h||v.css(c,g+m)),v.animate(p,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){u==="hide"&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),n()}})},U=e.effects.effect.bounce=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=s==="hide",u=s==="show",a=t.direction||"up",f=t.distance,l=t.times||5,c=l*2+(u||o?1:0),h=t.duration/c,p=t.easing,d=a==="up"||a==="down"?"top":"left",v=a==="up"||a==="left",m,g,y,b=r.queue(),w=b.length;(u||o)&&i.push("opacity"),e.effects.save(r,i),r.show(),e.effects.createWrapper(r),f||(f=r[d==="top"?"outerHeight":"outerWidth"]()/3),u&&(y={opacity:1},y[d]=0,r.css("opacity",0).css(d,v?-f*2:f*2).animate(y,h,p)),o&&(f/=Math.pow(2,l-1)),y={},y[d]=0;for(m=0;m<l;m++)g={},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p).animate(y,h,p),f=o?f*2:f/2;o&&(g={opacity:0},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p)),r.queue(function(){o&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),w>1&&b.splice.apply(b,[1,0].concat(b.splice(w,c+1))),r.dequeue()},z=e.effects.effect.clip=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"vertical",a=u==="vertical",f=a?"height":"width",l=a?"top":"left",c={},h,p,d;e.effects.save(r,i),r.show(),h=e.effects.createWrapper(r).css({overflow:"hidden"}),p=r[0].tagName==="IMG"?h:r,d=p[f](),o&&(p.css(f,0),p.css(l,d/2)),c[f]=o?d:0,c[l]=o?0:d/2,p.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o||r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})},W=e.effects.effect.drop=function(t,n){var r=e(this),i=["position","top","bottom","left","right","opacity","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left"?"pos":"neg",l={opacity:o?1:0},c;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),c=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0)/2,o&&r.css("opacity",0).css(a,f==="pos"?-c:c),l[a]=(o?f==="pos"?"+=":"-=":f==="pos"?"-=":"+=")+c,r.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})},X=e.effects.effect.explode=function(t,n){function y(){c.push(this),c.length===r*i&&b()}function b(){s.css({visibility:"visible"}),e(c).remove(),u||s.hide(),n()}var r=t.pieces?Math.round(Math.sqrt(t.pieces)):3,i=r,s=e(this),o=e.effects.setMode(s,t.mode||"hide"),u=o==="show",a=s.show().css("visibility","hidden").offset(),f=Math.ceil(s.outerWidth()/i),l=Math.ceil(s.outerHeight()/r),c=[],h,p,d,v,m,g;for(h=0;h<r;h++){v=a.top+h*l,g=h-(r-1)/2;for(p=0;p<i;p++)d=a.left+p*f,m=p-(i-1)/2,s.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-p*f,top:-h*l}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:f,height:l,left:d+(u?m*f:0),top:v+(u?g*l:0),opacity:u?0:1}).animate({left:d+(u?0:m*f),top:v+(u?0:g*l),opacity:u?1:0},t.duration||500,t.easing,y)}},V=e.effects.effect.fade=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"toggle");r.animate({opacity:i},{queue:!1,duration:t.duration,easing:t.easing,complete:n})},$=e.effects.effect.fold=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=s==="hide",a=t.size||15,f=/([0-9]+)%/.exec(a),l=!!t.horizFirst,c=o!==l,h=c?["width","height"]:["height","width"],p=t.duration/2,d,v,m={},g={};e.effects.save(r,i),r.show(),d=e.effects.createWrapper(r).css({overflow:"hidden"}),v=c?[d.width(),d.height()]:[d.height(),d.width()],f&&(a=parseInt(f[1],10)/100*v[u?0:1]),o&&d.css(l?{height:0,width:a}:{height:a,width:0}),m[h[0]]=o?v[0]:a,g[h[1]]=o?v[1]:0,d.animate(m,p,t.easing).animate(g,p,t.easing,function(){u&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()})},J=e.effects.effect.highlight=function(t,n){var r=e(this),i=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(r,t.mode||"show"),o={backgroundColor:r.css("backgroundColor")};s==="hide"&&(o.opacity=0),e.effects.save(r,i),r.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),n()}})},K=e.effects.effect.size=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","width","height","overflow","opacity"],a=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],l=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),d=t.restore||p!=="effect",v=t.scale||"both",m=t.origin||["middle","center"],g=o.css("position"),y=d?u:a,b={height:0,width:0,outerHeight:0,outerWidth:0};p==="show"&&o.show(),r={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},t.mode==="toggle"&&p==="show"?(o.from=t.to||b,o.to=t.from||r):(o.from=t.from||(p==="show"?b:r),o.to=t.to||(p==="hide"?b:r)),s={from:{y:o.from.height/r.height,x:o.from.width/r.width},to:{y:o.to.height/r.height,x:o.to.width/r.width}};if(v==="box"||v==="both")s.from.y!==s.to.y&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,s.from.y,o.from),o.to=e.effects.setTransition(o,c,s.to.y,o.to)),s.from.x!==s.to.x&&(y=y.concat(h),o.from=e.effects.setTransition(o,h,s.from.x,o.from),o.to=e.effects.setTransition(o,h,s.to.x,o.to));(v==="content"||v==="both")&&s.from.y!==s.to.y&&(y=y.concat(l).concat(f),o.from=e.effects.setTransition(o,l,s.from.y,o.from),o.to=e.effects.setTransition(o,l,s.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(i=e.effects.getBaseline(m,r),o.from.top=(r.outerHeight-o.outerHeight())*i.y,o.from.left=(r.outerWidth-o.outerWidth())*i.x,o.to.top=(r.outerHeight-o.to.outerHeight)*i.y,o.to.left=(r.outerWidth-o.to.outerWidth)*i.x),o.css(o.from);if(v==="content"||v==="both")c=c.concat(["marginTop","marginBottom"]).concat(l),h=h.concat(["marginLeft","marginRight"]),f=u.concat(c).concat(h),o.find("*[width]").each(function(){var n=e(this),r={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};d&&e.effects.save(n,f),n.from={height:r.height*s.from.y,width:r.width*s.from.x,outerHeight:r.outerHeight*s.from.y,outerWidth:r.outerWidth*s.from.x},n.to={height:r.height*s.to.y,width:r.width*s.to.x,outerHeight:r.height*s.to.y,outerWidth:r.width*s.to.x},s.from.y!==s.to.y&&(n.from=e.effects.setTransition(n,c,s.from.y,n.from),n.to=e.effects.setTransition(n,c,s.to.y,n.to)),s.from.x!==s.to.x&&(n.from=e.effects.setTransition(n,h,s.from.x,n.from),n.to=e.effects.setTransition(n,h,s.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){d&&e.effects.restore(n,f)})});o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o.to.opacity===0&&o.css("opacity",o.from.opacity),p==="hide"&&o.hide(),e.effects.restore(o,y),d||(g==="static"?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,n){var r=parseInt(n,10),i=e?o.to.left:o.to.top;return n==="auto"?i+"px":r+i+"px"})})),e.effects.removeWrapper(o),n()}})},Q=e.effects.effect.scale=function(t,n){var r=e(this),i=e.extend(!0,{},t),s=e.effects.setMode(r,t.mode||"effect"),o=parseInt(t.percent,10)||(parseInt(t.percent,10)===0?0:s==="hide"?0:100),u=t.direction||"both",a=t.origin,f={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},l={y:u!=="horizontal"?o/100:1,x:u!=="vertical"?o/100:1};i.effect="size",i.queue=!1,i.complete=n,s!=="effect"&&(i.origin=a||["middle","center"],i.restore=!0),i.from=t.from||(s==="show"?{height:0,width:0,outerHeight:0,outerWidth:0}:f),i.to={height:f.height*l.y,width:f.width*l.x,outerHeight:f.outerHeight*l.y,outerWidth:f.outerWidth*l.x},i.fade&&(s==="show"&&(i.from.opacity=0,i.to.opacity=1),s==="hide"&&(i.from.opacity=1,i.to.opacity=0)),r.effect(i)},G=e.effects.effect.puff=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"hide"),s=i==="hide",o=parseInt(t.percent,10)||150,u=o/100,a={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:i,complete:n,percent:s?o:100,from:s?a:{height:a.height*u,width:a.width*u,outerHeight:a.outerHeight*u,outerWidth:a.outerWidth*u}}),r.effect(t)},Y=e.effects.effect.pulsate=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"show"),s=i==="show",o=i==="hide",u=s||i==="hide",a=(t.times||5)*2+(u?1:0),f=t.duration/a,l=0,c=r.queue(),h=c.length,p;if(s||!r.is(":visible"))r.css("opacity",0).show(),l=1;for(p=1;p<a;p++)r.animate({opacity:l},f,t.easing),l=1-l;r.animate({opacity:l},f,t.easing),r.queue(function(){o&&r.hide(),n()}),h>1&&c.splice.apply(c,[1,0].concat(c.splice(h,a+1))),r.dequeue()},Z=e.effects.effect.shake=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=t.direction||"left",u=t.distance||20,a=t.times||3,f=a*2+1,l=Math.round(t.duration/f),c=o==="up"||o==="down"?"top":"left",h=o==="up"||o==="left",p={},d={},v={},m,g=r.queue(),y=g.length;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),p[c]=(h?"-=":"+=")+u,d[c]=(h?"+=":"-=")+u*2,v[c]=(h?"-=":"+=")+u*2,r.animate(p,l,t.easing);for(m=1;m<a;m++)r.animate(d,l,t.easing).animate(v,l,t.easing);r.animate(d,l,t.easing).animate(p,l/2,t.easing).queue(function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),y>1&&g.splice.apply(g,[1,0].concat(g.splice(y,f+1))),r.dequeue()},et=e.effects.effect.slide=function(t,n){var r=e(this),i=["position","top","bottom","left","right","width","height"],s=e.effects.setMode(r,t.mode||"show"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left",l,c={};e.effects.save(r,i),r.show(),l=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),o&&r.css(a,f?isNaN(l)?"-"+l:-l:l),c[a]=(o?f?"+=":"-=":f?"-=":"+=")+l,r.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})},tt=e.effects.effect.transfer=function(t,n){var r=e(this),i=e(t.to),s=i.css("position")==="fixed",o=e("body"),u=s?o.scrollTop():0,a=s?o.scrollLeft():0,f=i.offset(),l={top:f.top-u,left:f.left-a,height:i.innerHeight(),width:i.innerWidth()},c=r.offset(),h=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:c.top-u,left:c.left-a,height:r.innerHeight(),width:r.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){h.remove(),n()})}}),define("app/plugins/jquery-ui",["jquery","underscore","app/lib","jquery-ui","css!css/jquery-ui.css"],function(e,t,n){e.widget("custom.customselectmenu",e.ui.selectmenu,{_getItemTemplate:function(){var t=this.element.attr("id"),n="";return e("[data-form-tpl="+t+"]").length&&(n=e("[data-form-tpl="+t+"]").get(0).innerHTML,n=n.replace(/\&lt\;/gi,"<"),n=n.replace(/\&gt\;/gi,">")),n},_renderItem:function(t,n){var r=e("<li>");return n.disabled&&r.addClass("ui-state-disabled"),this._setItemContent(r,{label:n.label,iconClass:n.element.attr("data-icon-class"),langCode:n.element.attr("data-cps-lang")}),r.appendTo(t)},_setItemContent:function(e,t){var r=this._getItemTemplate(),i=t.value||t.label;r=r?n.tmpl(r,{data:{label:n.lang.get(t.langCode)||t.label,iconClass:t.iconClass,langCode:t.langCode}}):i,r?e.html(r):e.html("&#160;")},defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")||""}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button);var n=this.element.find("option:selected");this._setItemContent(this.buttonText,{label:n.text(),iconClass:n.attr("data-icon-class"),langCode:n.attr("data-cps-lang")}),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,n){e.preventDefault(),t._setSelection(),t._select(n.item.data("ui-selectmenu-item"),e)},focus:function(e,n){var r=n.item.data("ui-selectmenu-item");t.focusIndex!=null&&r.index!==t.focusIndex&&(t._trigger("focus",e,{item:r}),t.isOpen||t._select(r,e)),t.focusIndex=r.index,t.button.attr("aria-activedescendant",t.menuItems.eq(r.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu();var e=this._getSelectedItem();this._setItemContent(this.buttonText,{label:e.label,iconClass:e.element.attr("data-icon-class"),langCode:e.element.attr("data-cps-lang")}),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");if(!t.length)return;this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled"))},open:function(e){if(this.options.disabled)return;this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e)},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){if(!this.isOpen)return;this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e)},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,n){var r=this,i="";e.each(n,function(n,s){s.optgroup!==i&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(s.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:s.optgroup}).appendTo(t),i=s.optgroup),r._renderItemData(t,s)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var n,r,i=".ui-menu-item";this.isOpen?n=this.menuItems.eq(this.focusIndex):(n=this.menuItems.eq(this.element[0].selectedIndex),i+=":not(.ui-state-disabled)"),e==="first"||e==="last"?r=n[e==="first"?"prevAll":"nextAll"](i).eq(-1):r=n[e+"All"](i).eq(0),r.length&&this.menuInstance.focus(t,r)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;if(!this.range)return;window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus()},_documentClick:{mousedown:function(t){if(!this.isOpen)return;e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t)}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var n=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),n=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),n=!1}n&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var n=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setItemContent(this.buttonText,{label:e.label,iconClass:e.element.attr("data-icon-class"),langCode:e.element.attr("data-cps-lang")}),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==n&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){e==="icons"&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),e==="appendTo"&&this.menuWrap.appendTo(this._appendTo()),e==="disabled"&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),e==="width"&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0));if(!t||!t[0])t=this.element.closest(".ui-front");return t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var n=[];t.each(function(t,r){var i=e(r),s=i.parent("optgroup");n.push({element:i,index:t,value:i.val(),label:i.text(),optgroup:s.attr("label")||"",disabled:s.prop("disabled")||i.prop("disabled")})}),this.items=n},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}})}),define("app/classes/tools/insert-textbox",["underscore","jquery","app/classes/tools/ToolBase","app/classes/ui/workspace/component/TextBox","text!resources/tpl/ui/property/ui-property-item-insert-textbox.tpl.html","text!resources/tpl/ui/property/ui-property-item.common.text-attributes.tpl.html","app/plugins/jquery-ui"],function(e,t,n,r,i,s){return new n({name:"insert-textbox",type:"toggle",iconCls:"fa fa-fw fa-font",propertyTpl:i,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){t===!1&&this.onApplyProperty()},enableStatus:function(){return!0},onRenderProperty:function(e){var t=this.initTextAttributeForm(e);e.find(".property-item").append(t),this.bindTextAttributeEvents(t)},onShowProperty:function(e){var e={};NHIE.propertyPanel.setPropertyContent(this.name,e),this.insertTextBox()},onApplyProperty:function(){if(this.component){var e=this.component.toCanvas(),t=this.component.$component,n=this;e.then(function(e){var r=NHIE.lib.util.canvasManager.cropCanvas(e);if(isNaN(r.w)||isNaN(r.h)||isNaN(r.x)||isNaN(r.y))return n.component.remove(),n.component=null,{};var i=NHIE.workspace.addLayer("canvas");i.setCanvasContent({canvas:e,style:{left:parseInt(t.css("left"))+r.x,top:parseInt(t.css("top"))+r.y,width:r.w,height:r.h}}),i.select(),n.component.remove(),n.component=null,NHIE.workspace.$clipping_area.removeClass("insert-component"),NHIE.app.fireEvent("changecontent")}).then(function(){n.toggled&&n.fireEvent("toggle",!1)}).catch(function(e){console.error(e),n.component.remove(),n.component=null})}},onRestoreProperty:function(){this.component&&(this.component.remove(),this.component=null),NHIE.workspace.$clipping_area.removeClass("insert-component"),this.fireEvent("toggle",!1)},default_width:200,default_height:100,insertTextBox:function(){var e=this;NHIE.workspace.$clipping_area.addClass("insert-component");var t=new r({item_id:"textbox",id:"nhie-component-textbox_0",style:{width:e.default_width,height:e.default_height}});this.component=t}})}),define("app/classes/ui/workspace/component/TextBalloon",["jquery","underscore","app/classes/ui/workspace/component/UIComponent"],function(e,t,n){var r=n.extend({classname:"TextBalloon",min_width:40,min_height:40,getComponentMarkup:function(){var e=this.style,t=this.style.width,n=this.style.height,r="";return r+='<div style="position:absolute;width:100%;height:100%;">',r+='<img style="position:absolute;width:100%;height:100%;" src="'+this.src+'">',r+="</div>",r},afterRenderTracker:function(t){var n=this.initConfig.style,r=n.width,i=n.height,s="";s+='<div contentEditable="true" class="tracker-content text-editing-area" style="pointer-events:all;position:absolute;',s+="left:"+this.textPos.x/r*100+"%;",s+="top:"+this.textPos.y/i*100+"%;",s+="width:"+this.textPos.width/r*100+"%;",s+="height:"+this.textPos.height/i*100+"%;",s+='"></div>';var o=e(s),u=(NHIE.app.data("navigator-zoom")||100)/100;o.css("zoom",u),t.append(o);if(this.content){var a=NHIE.app.getCurrentTool(),f=a.getTextAttributes();a.setTextAttrOnEl(o,f),o.html(this.content)}this.$textEditingArea=o,o.focus()},toCanvas:function(){var t=this.$component,n=this.textPos,r=this,i=r.initConfig.style,s=n.x/i.width*t.width(),o=n.y/i.height*t.height(),u=n.width/i.width*t.width(),a=n.height/i.height*t.height();return NHIE.lib.util.getImage(this.src).then(function(n){var r=e("<canvas></canvas>"),i=r.get(0),s=i.getContext("2d");return i.width=t.width(),i.height=t.height(),s.drawImage(n,0,0,i.width,i.height),i}).then(function(e){var t=NHIE.app.getCurrentTool(),n=t.renderTextComponentOnCanvas(r,s,o,u,a),i=n.getContext("2d");return i.clearRect(0,0,n.width,o),i.clearRect(0,o+a,n.width,n.height),i.clearRect(0,o,s,o+a),i.clearRect(s+u,o,n.width,n.height),[e,n]}).then(function(n){var r=n[0],i=n[1],s=e("<canvas></canvas>"),o=s.get(0),u=o.getContext("2d");return o.width=t.width(),o.height=t.height(),u.drawImage(r,0,0,o.width,o.height),u.drawImage(i,0,0,o.width,o.height),o})}});return r}),define("text!resources/tpl/ui/property/ui-property-item-insert-textballoon.tpl.html",[],function(){return'<div class="property-item property-insert-textballoon">\r\n	<ul class="list-items">\r\n		<!-- <% for (var i = 0; i < data.items.length; i++) { %> -->\r\n		<li class="list-item" data-item-id="<%=data.items[i].id%>"><img src="<%=data.items[i].src%>" /></li>\r\n		<!-- <% } %> -->\r\n		<div style="width:1px;height:1px;clear:both;"></div>\r\n	</ul>\r\n</div>\r\n'}),define("app/classes/tools/insert-textballoon",["underscore","jquery","app/classes/tools/ToolBase","app/classes/ui/workspace/component/TextBalloon","app/lib","text!resources/tpl/ui/property/ui-property-item-insert-textballoon.tpl.html"],function(e,t,n,r,i,s){return new n({name:"insert-textballoon",type:"toggle",iconCls:"fa fa-fw fa-comment-o",propertyTpl:s,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){t===!1&&this.onApplyProperty()},enableStatus:function(){return!0},onRenderProperty:function(e){var n=this,r=e.find("ul.list-items");r.mCustomScrollbar(),r.find("li.list-item").on("mouseenter",function(){r.find("li.list-item").removeClass("hover"),t(this).addClass("hover")}).on("mouseleave",function(){r.find("li.list-item").removeClass("hover")}).on("click",function(){r.find("li.list-item").removeClass("selected"),t(this).addClass("selected");var e=t(this).attr("data-item-id");n.selectTextballoon(e),console.log(n.component.$textEditingArea)});var i=this.initTextAttributeForm(e);r.after(i),this.bindTextAttributeEvents(),this.enableTextAttributes(!1),r.find("li.list-item").eq(0).mouseenter().click()},onShowProperty:function(e){var e={};e.items=NHIE.util.getConfig("assets.textballoons"),NHIE.propertyPanel.setPropertyContent("insert-textballoon",e)},onApplyProperty:function(){if(this.component){var e=this.component.toCanvas(),t=this.component.$component,n=this;e.then(function(e){var r=NHIE.workspace.addLayer("canvas");r.setCanvasContent({canvas:e,style:{left:parseInt(t.css("left")),top:parseInt(t.css("top")),width:t.width(),height:t.height()}}),r.select(),n.component.remove(),n.component=null,NHIE.workspace.$clipping_area.removeClass("insert-component"),NHIE.app.fireEvent("changecontent")}).then(function(){n.toggled&&n.fireEvent("toggle",!1)}).catch(function(e){console.error(e)})}},onRestoreProperty:function(){this.component&&(this.component.remove(),this.component=null),NHIE.workspace.$clipping_area.removeClass("insert-component")},getSelectedItem:function(t){var n=NHIE.util.getConfig("assets.textballoons"),r=e.findIndex(n,{id:t});if(r>-1)return n[r]},selectTextballoon:function(e){var n=null;this.component&&(n=t(this.component.tracker.dom).find(".text-editing-area").html(),this.component.remove()),console.log("textballoon selected~ ",e,n);var i=this.getSelectedItem(e);if(i){NHIE.workspace.$clipping_area.addClass("insert-component");var s=new r({item_id:e,src:i.src,id:"nhie-component-textballoon_"+i.id,style:{width:i.width,height:i.height},textPos:i.textPos,content:n});this.component=s,this.enableTextAttributes(!0)}}})}),define("app/classes/ui/workspace/component/Sticker",["jquery","underscore","app/classes/ui/workspace/component/UIComponent"],function(e,t,n){var r=n.extend({classname:"Sticker",getComponentMarkup:function(){return'<img style="position:absolute;width:100%;height:100%;" src="'+this.src+'">'},toCanvas:function(){var t=this.$component;return NHIE.lib.util.getImage(this.src).then(function(n){var r=e("<canvas></canvas>"),i=r.get(0),s=i.getContext("2d");return i.width=t.width(),i.height=t.height(),s.drawImage(n,0,0,i.width,i.height),i})}});return r}),define("text!resources/tpl/ui/property/ui-property-item-insert-sticker.tpl.html",[],function(){return'<div class="property-item property-insert-sticker">\r\n	<ul class="list-items">\r\n		<!-- <% for (var i = 0; i < data.items.length; i++) { %> -->\r\n		<li class="list-item" data-item-id="<%=data.items[i].id%>"><img src="<%=data.items[i].src%>" /></li>\r\n		<!-- <% } %> -->\r\n		<div style="width:1px;height:1px;clear:both;"></div>\r\n	</ul>\r\n</div>\r\n'}),function(e){function t(t){var n=t||window.event,r=[].slice.call(arguments,1),i=0,s=!0,o=0,u=0;return t=e.event.fix(n),t.type="mousewheel",n.wheelDelta&&(i=n.wheelDelta/120),n.detail&&(i=-n.detail/3),u=i,n.axis!==undefined&&n.axis===n.HORIZONTAL_AXIS&&(u=0,o=-1*i),n.wheelDeltaY!==undefined&&(u=n.wheelDeltaY/120),n.wheelDeltaX!==undefined&&(o=-1*n.wheelDeltaX/120),r.unshift(t,i,o,u),(e.event.dispatch||e.event.handle).apply(this,r)}var n=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var r=n.length;r;)e.event.fixHooks[n[--r]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=n.length;e;)this.addEventListener(n[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery),function(e){var t={init:function(t){var n={set_width:!1,set_height:!1,horizontalScroll:!1,scrollInertia:950,mouseWheel:!0,mouseWheelPixels:"auto",autoDraggerLength:!0,autoHideScrollbar:!1,alwaysShowScrollbar:!1,snapAmount:null,snapOffset:0,scrollButtons:{enable:!1,scrollType:"continuous",scrollSpeed:"auto",scrollAmount:40},advanced:{updateOnBrowserResize:!0,updateOnContentResize:!1,autoExpandHorizontalScroll:!1,autoScrollOnFocus:!0,normalizeMouseWheelDelta:!1},contentTouchScroll:!0,callbacks:{onScrollStart:function(){},onScroll:function(){},onTotalScroll:function(){},onTotalScrollBack:function(){},onTotalScrollOffset:0,onTotalScrollBackOffset:0,whileScrolling:function(){}},theme:"light"},t=e.extend(!0,n,t);return this.each(function(){var n=e(this);t.set_width&&n.css("width",t.set_width),t.set_height&&n.css("height",t.set_height);if(!e(document).data("mCustomScrollbar-index"))e(document).data("mCustomScrollbar-index","1");else{var r=parseInt(e(document).data("mCustomScrollbar-index"));e(document).data("mCustomScrollbar-index",r+1)}n.wrapInner("<div class='mCustomScrollBox mCS-"+t.theme+"' id='mCSB_"+e(document).data("mCustomScrollbar-index")+"' style='position:relative; height:100%; overflow:hidden; max-width:100%;' />").addClass("mCustomScrollbar _mCS_"+e(document).data("mCustomScrollbar-index"));var i=n.children(".mCustomScrollBox");if(t.horizontalScroll){i.addClass("mCSB_horizontal").wrapInner("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />");var s=i.children(".mCSB_h_wrapper");s.wrapInner("<div class='mCSB_container' style='position:absolute; left:0;' />").children(".mCSB_container").css({width:s.children().outerWidth(),position:"relative"}).unwrap()}else i.wrapInner("<div class='mCSB_container' style='position:relative; top:0;' />");var o=i.children(".mCSB_container");e.support.touch&&o.addClass("mCS_touch"),o.after("<div class='mCSB_scrollTools' style='position:absolute;'><div class='mCSB_draggerContainer'><div class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' style='position:relative;'></div></div><div class='mCSB_draggerRail'></div></div></div>");var u=i.children(".mCSB_scrollTools"),a=u.children(".mCSB_draggerContainer"),f=a.children(".mCSB_dragger");t.horizontalScroll?f.data("minDraggerWidth",f.width()):f.data("minDraggerHeight",f.height()),t.scrollButtons.enable&&(t.horizontalScroll?u.prepend("<a class='mCSB_buttonLeft' oncontextmenu='return false;'></a>").append("<a class='mCSB_buttonRight' oncontextmenu='return false;'></a>"):u.prepend("<a class='mCSB_buttonUp' oncontextmenu='return false;'></a>").append("<a class='mCSB_buttonDown' oncontextmenu='return false;'></a>")),i.bind("scroll",function(){n.is(".mCS_disabled")||i.scrollTop(0).scrollLeft(0)}),n.data({mCS_Init:!0,mCustomScrollbarIndex:e(document).data("mCustomScrollbar-index"),horizontalScroll:t.horizontalScroll,scrollInertia:t.scrollInertia,scrollEasing:"mcsEaseOut",mouseWheel:t.mouseWheel,mouseWheelPixels:t.mouseWheelPixels,autoDraggerLength:t.autoDraggerLength,autoHideScrollbar:t.autoHideScrollbar,alwaysShowScrollbar:t.alwaysShowScrollbar,snapAmount:t.snapAmount,snapOffset:t.snapOffset,scrollButtons_enable:t.scrollButtons.enable,scrollButtons_scrollType:t.scrollButtons.scrollType,scrollButtons_scrollSpeed:t.scrollButtons.scrollSpeed,scrollButtons_scrollAmount:t.scrollButtons.scrollAmount,autoExpandHorizontalScroll:t.advanced.autoExpandHorizontalScroll,autoScrollOnFocus:t.advanced.autoScrollOnFocus,normalizeMouseWheelDelta:t.advanced.normalizeMouseWheelDelta,contentTouchScroll:t.contentTouchScroll,onScrollStart_Callback:t.callbacks.onScrollStart,onScroll_Callback:t.callbacks.onScroll,onTotalScroll_Callback:t.callbacks.onTotalScroll,onTotalScrollBack_Callback:t.callbacks.onTotalScrollBack,onTotalScroll_Offset:t.callbacks.onTotalScrollOffset,onTotalScrollBack_Offset:t.callbacks.onTotalScrollBackOffset,whileScrolling_Callback:t.callbacks.whileScrolling,bindEvent_scrollbar_drag:!1,bindEvent_content_touch:!1,bindEvent_scrollbar_click:!1,bindEvent_mousewheel:!1,bindEvent_buttonsContinuous_y:!1,bindEvent_buttonsContinuous_x:!1,bindEvent_buttonsPixels_y:!1,bindEvent_buttonsPixels_x:!1,bindEvent_focusin:!1,bindEvent_autoHideScrollbar:!1,mCSB_buttonScrollRight:!1,mCSB_buttonScrollLeft:!1,mCSB_buttonScrollDown:!1,mCSB_buttonScrollUp:!1});if(t.horizontalScroll)n.css("max-width")!=="none"&&(t.advanced.updateOnContentResize||(t.advanced.updateOnContentResize=!0));else if(n.css("max-height")!=="none"){var l=!1,h=parseInt(n.css("max-height"));n.css("max-height").indexOf("%")>=0&&(l=h,h=n.parent().height()*l/100),n.css("overflow","hidden"),i.css("max-height",h)}n.mCustomScrollbar("update");if(t.advanced.updateOnBrowserResize){var p,d=e(window).width(),v=e(window).height();e(window).bind("resize."+n.data("mCustomScrollbarIndex"),function(){p&&clearTimeout(p),p=setTimeout(function(){if(!n.is(".mCS_disabled")&&!n.is(".mCS_destroyed")){var t=e(window).width(),r=e(window).height();if(d!==t||v!==r)n.css("max-height")!=="none"&&l&&i.css("max-height",n.parent().height()*l/100),n.mCustomScrollbar("update"),d=t,v=r}},150)})}if(t.advanced.updateOnContentResize){var m;if(t.horizontalScroll)var g=o.outerWidth();else var g=o.outerHeight();m=setInterval(function(){if(t.horizontalScroll){t.advanced.autoExpandHorizontalScroll&&o.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:o.outerWidth(),position:"relative"}).unwrap();var e=o.outerWidth()}else var e=o.outerHeight();e!=g&&(n.mCustomScrollbar("update"),g=e)},300)}})},update:function(){var t=e(this),n=t.children(".mCustomScrollBox"),r=n.children(".mCSB_container");r.removeClass("mCS_no_scrollbar"),t.removeClass("mCS_disabled mCS_destroyed"),n.scrollTop(0).scrollLeft(0);var i=n.children(".mCSB_scrollTools"),s=i.children(".mCSB_draggerContainer"),o=s.children(".mCSB_dragger");if(t.data("horizontalScroll")){var u=i.children(".mCSB_buttonLeft"),a=i.children(".mCSB_buttonRight"),f=n.width();t.data("autoExpandHorizontalScroll")&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:r.outerWidth(),position:"relative"}).unwrap();var l=r.outerWidth()}else var h=i.children(".mCSB_buttonUp"),p=i.children(".mCSB_buttonDown"),d=n.height(),v=r.outerHeight();if(v>d&&!t.data("horizontalScroll")){i.css("display","block");var m=s.height();if(t.data("autoDraggerLength")){var g=Math.round(d/v*m),y=o.data("minDraggerHeight");if(g<=y)o.css({height:y});else if(g>=m-10){var b=m-10;o.css({height:b})}else o.css({height:g});o.children(".mCSB_dragger_bar").css({"line-height":o.height()+"px"})}var w=o.height(),E=(v-d)/(m-w);t.data("scrollAmount",E).mCustomScrollbar("scrolling",n,r,s,o,h,p,u,a);var S=Math.abs(r.position().top);t.mCustomScrollbar("scrollTo",S,{scrollInertia:0,trigger:"internal"})}else if(l>f&&t.data("horizontalScroll")){i.css("display","block");var x=s.width();if(t.data("autoDraggerLength")){var T=Math.round(f/l*x),N=o.data("minDraggerWidth");if(T<=N)o.css({width:N});else if(T>=x-10){var C=x-10;o.css({width:C})}else o.css({width:T})}var k=o.width(),E=(l-f)/(x-k);t.data("scrollAmount",E).mCustomScrollbar("scrolling",n,r,s,o,h,p,u,a);var S=Math.abs(r.position().left);t.mCustomScrollbar("scrollTo",S,{scrollInertia:0,trigger:"internal"})}else n.unbind("mousewheel focusin"),t.data("horizontalScroll")?o.add(r).css("left",0):o.add(r).css("top",0),t.data("alwaysShowScrollbar")?t.data("horizontalScroll")?t.data("horizontalScroll")&&o.css({width:s.width()}):o.css({height:s.height()}):(i.css("display","none"),r.addClass("mCS_no_scrollbar")),t.data({bindEvent_mousewheel:!1,bindEvent_focusin:!1})},scrolling:function(t,r,i,s,o,u,a,f){function y(e,t,n,r){l.data("horizontalScroll")?l.mCustomScrollbar("scrollTo",s.position().left-t+r,{moveDragger:!0,trigger:"internal"}):l.mCustomScrollbar("scrollTo",s.position().top-e+n,{moveDragger:!0,trigger:"internal"})}var l=e(this);if(!l.data("bindEvent_scrollbar_drag")){var h,p,v,m,g;e.support.pointer?(v="pointerdown",m="pointermove",g="pointerup"):e.support.msPointer&&(v="MSPointerDown",m="MSPointerMove",g="MSPointerUp"),e.support.pointer||e.support.msPointer?(s.bind(v,function(t){t.preventDefault(),l.data({on_drag:!0}),s.addClass("mCSB_dragger_onDrag");var n=e(this),r=n.offset(),i=t.originalEvent.pageX-r.left,o=t.originalEvent.pageY-r.top;i<n.width()&&i>0&&o<n.height()&&o>0&&(h=o,p=i)}),e(document).bind(m+"."+l.data("mCustomScrollbarIndex"),function(e){e.preventDefault();if(l.data("on_drag")){var t=s,n=t.offset(),r=e.originalEvent.pageX-n.left,i=e.originalEvent.pageY-n.top;y(h,p,i,r)}}).bind(g+"."+l.data("mCustomScrollbarIndex"),function(e){l.data({on_drag:!1}),s.removeClass("mCSB_dragger_onDrag")})):(s.bind("mousedown touchstart",function(t){t.preventDefault(),t.stopImmediatePropagation();var n=e(this),r=n.offset(),i,o;if(t.type==="touchstart"){var u=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0];i=u.pageX-r.left,o=u.pageY-r.top}else l.data({on_drag:!0}),s.addClass("mCSB_dragger_onDrag"),i=t.pageX-r.left,o=t.pageY-r.top;i<n.width()&&i>0&&o<n.height()&&o>0&&(h=o,p=i)}).bind("touchmove",function(t){t.preventDefault(),t.stopImmediatePropagation();var n=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],r=e(this),i=r.offset(),s=n.pageX-i.left,o=n.pageY-i.top;y(h,p,o,s)}),e(document).bind("mousemove."+l.data("mCustomScrollbarIndex"),function(e){if(l.data("on_drag")){var t=s,n=t.offset(),r=e.pageX-n.left,i=e.pageY-n.top;y(h,p,i,r)}}).bind("mouseup."+l.data("mCustomScrollbarIndex"),function(e){l.data({on_drag:!1}),s.removeClass("mCSB_dragger_onDrag")})),l.data({bindEvent_scrollbar_drag:!0})}if(e.support.touch&&l.data("contentTouchScroll")&&!l.data("bindEvent_content_touch")){var b,w,E,S,x,T,N;r.bind("touchstart",function(t){t.stopImmediatePropagation(),b=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],w=e(this),E=w.offset(),x=b.pageX-E.left,S=b.pageY-E.top,T=S,N=x}),r.bind("touchmove",function(t){t.preventDefault(),t.stopImmediatePropagation(),b=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],w=e(this).parent(),E=w.offset(),x=b.pageX-E.left,S=b.pageY-E.top,l.data("horizontalScroll")?l.mCustomScrollbar("scrollTo",N-x,{trigger:"internal"}):l.mCustomScrollbar("scrollTo",T-S,{trigger:"internal"})})}l.data("bindEvent_scrollbar_click")||(i.bind("click",function(t){var n=(t.pageY-i.offset().top)*l.data("scrollAmount"),r=e(t.target);l.data("horizontalScroll")&&(n=(t.pageX-i.offset().left)*l.data("scrollAmount")),(r.hasClass("mCSB_draggerContainer")||r.hasClass("mCSB_draggerRail"))&&l.mCustomScrollbar("scrollTo",n,{trigger:"internal",scrollEasing:"draggerRailEase"})}),l.data({bindEvent_scrollbar_click:!0})),l.data("mouseWheel")&&(l.data("bindEvent_mousewheel")||(t.bind("mousewheel",function(e,t){var n,o=l.data("mouseWheelPixels"),u=Math.abs(r.position().top),a=s.position().top,f=i.height()-s.height();l.data("normalizeMouseWheelDelta")&&(t<0?t=-1:t=1),o==="auto"&&(o=100+Math.round(l.data("scrollAmount")/2)),l.data("horizontalScroll")&&(a=s.position().left,f=i.width()-s.width(),u=Math.abs(r.position().left));if(t>0&&a!==0||t<0&&a!==f)e.preventDefault(),e.stopImmediatePropagation();n=u-t*o,l.mCustomScrollbar("scrollTo",n,{trigger:"internal"})}),l.data({bindEvent_mousewheel:!0})));if(l.data("scrollButtons_enable"))if(l.data("scrollButtons_scrollType")==="pixels"){l.data("horizontalScroll")?(f.add(a).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",k,L),l.data({bindEvent_buttonsContinuous_x:!1}),l.data("bindEvent_buttonsPixels_x")||(f.bind("click",function(e){e.preventDefault(),C(Math.abs(r.position().left)+l.data("scrollButtons_scrollAmount"))}),a.bind("click",function(e){e.preventDefault(),C(Math.abs(r.position().left)-l.data("scrollButtons_scrollAmount"))}),l.data({bindEvent_buttonsPixels_x:!0}))):(u.add(o).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",k,L),l.data({bindEvent_buttonsContinuous_y:!1}),l.data("bindEvent_buttonsPixels_y")||(u.bind("click",function(e){e.preventDefault(),C(Math.abs(r.position().top)+l.data("scrollButtons_scrollAmount"))}),o.bind("click",function(e){e.preventDefault(),C(Math.abs(r.position().top)-l.data("scrollButtons_scrollAmount"))}),l.data({bindEvent_buttonsPixels_y:!0})));function C(e){s.data("preventAction")||(s.data("preventAction",!0),l.mCustomScrollbar("scrollTo",e,{trigger:"internal"}))}}else{if(l.data("horizontalScroll")){f.add(a).unbind("click"),l.data({bindEvent_buttonsPixels_x:!1});if(!l.data("bindEvent_buttonsContinuous_x")){f.bind("mousedown touchstart MSPointerDown pointerdown",function(e){e.preventDefault();var t=M();l.data({mCSB_buttonScrollRight:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(r.position().left)+t,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var k=function(e){e.preventDefault(),clearInterval(l.data("mCSB_buttonScrollRight"))};f.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",k),a.bind("mousedown touchstart MSPointerDown pointerdown",function(e){e.preventDefault();var t=M();l.data({mCSB_buttonScrollLeft:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(r.position().left)-t,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var L=function(e){e.preventDefault(),clearInterval(l.data("mCSB_buttonScrollLeft"))};a.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",L),l.data({bindEvent_buttonsContinuous_x:!0})}}else{u.add(o).unbind("click"),l.data({bindEvent_buttonsPixels_y:!1});if(!l.data("bindEvent_buttonsContinuous_y")){u.bind("mousedown touchstart MSPointerDown pointerdown",function(e){e.preventDefault();var t=M();l.data({mCSB_buttonScrollDown:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(r.position().top)+t,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var A=function(e){e.preventDefault(),clearInterval(l.data("mCSB_buttonScrollDown"))};u.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",A),o.bind("mousedown touchstart MSPointerDown pointerdown",function(e){e.preventDefault();var t=M();l.data({mCSB_buttonScrollUp:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(r.position().top)-t,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var O=function(e){e.preventDefault(),clearInterval(l.data("mCSB_buttonScrollUp"))};o.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",O),l.data({bindEvent_buttonsContinuous_y:!0})}}function M(){var e=l.data("scrollButtons_scrollSpeed");return l.data("scrollButtons_scrollSpeed")==="auto"&&(e=Math.round((l.data("scrollInertia")+100)/40)),e}}l.data("autoScrollOnFocus")&&(l.data("bindEvent_focusin")||(t.bind("focusin",function(){t.scrollTop(0).scrollLeft(0);var n=e(document.activeElement);if(n.is("input,textarea,select,button,a[tabindex],area,object")){var i=r.position().top,s=n.position().top,o=t.height()-n.outerHeight();l.data("horizontalScroll")&&(i=r.position().left,s=n.position().left,o=t.width()-n.outerWidth()),(i+s<0||i+s>o)&&l.mCustomScrollbar("scrollTo",s,{trigger:"internal"})}}),l.data({bindEvent_focusin:!0}))),l.data("autoHideScrollbar")&&!l.data("alwaysShowScrollbar")&&(l.data("bindEvent_autoHideScrollbar")||(t.bind("mouseenter",function(e){t.addClass("mCS-mouse-over"),n.showScrollbar.call(t.children(".mCSB_scrollTools"))}).bind("mouseleave touchend",function(e){t.removeClass("mCS-mouse-over"),e.type==="mouseleave"&&n.hideScrollbar.call(t.children(".mCSB_scrollTools"))}),l.data({bindEvent_autoHideScrollbar:!0})))},scrollTo:function(t,r){function E(e){if(i.data("mCustomScrollbarIndex")){this.mcs={top:a.position().top,left:a.position().left,draggerTop:h.position().top,draggerLeft:h.position().left,topPct:Math.round(100*Math.abs(a.position().top)/Math.abs(a.outerHeight()-u.height())),leftPct:Math.round(100*Math.abs(a.position().left)/Math.abs(a.outerWidth()-u.width()))};switch(e){case"onScrollStart":i.data("mCS_tweenRunning",!0).data("onScrollStart_Callback").call(i,this.mcs);break;case"whileScrolling":i.data("whileScrolling_Callback").call(i,this.mcs);break;case"onScroll":i.data("onScroll_Callback").call(i,this.mcs);break;case"onTotalScrollBack":i.data("onTotalScrollBack_Callback").call(i,this.mcs);break;case"onTotalScroll":i.data("onTotalScroll_Callback").call(i,this.mcs)}}}var i=e(this),s={moveDragger:!1,trigger:"external",callbacks:!0,scrollInertia:i.data("scrollInertia"),scrollEasing:i.data("scrollEasing")},r=e.extend(s,r),o,u=i.children(".mCustomScrollBox"),a=u.children(".mCSB_container"),f=u.children(".mCSB_scrollTools"),l=f.children(".mCSB_draggerContainer"),h=l.children(".mCSB_dragger"),p=draggerSpeed=r.scrollInertia,v,m,g,y;if(!a.hasClass("mCS_no_scrollbar")){i.data({mCS_trigger:r.trigger}),i.data("mCS_Init")&&(r.callbacks=!1);if(t||t===0){if(typeof t=="number")r.moveDragger?(o=t,i.data("horizontalScroll")?t=h.position().left*i.data("scrollAmount"):t=h.position().top*i.data("scrollAmount"),draggerSpeed=0):o=t/i.data("scrollAmount");else if(typeof t=="string"){var b;t==="top"?b=0:t==="bottom"&&!i.data("horizontalScroll")?b=a.outerHeight()-u.height():t==="left"?b=0:t==="right"&&i.data("horizontalScroll")?b=a.outerWidth()-u.width():t==="first"?b=i.find(".mCSB_container").find(":first"):t==="last"?b=i.find(".mCSB_container").find(":last"):b=i.find(t),b.length===1?(i.data("horizontalScroll")?t=b.position().left:t=b.position().top,o=t/i.data("scrollAmount")):o=t=b}if(i.data("horizontalScroll")){i.data("onTotalScrollBack_Offset")&&(m=-i.data("onTotalScrollBack_Offset")),i.data("onTotalScroll_Offset")&&(y=u.width()-a.outerWidth()+i.data("onTotalScroll_Offset")),o<0?(o=t=0,clearInterval(i.data("mCSB_buttonScrollLeft")),m||(v=!0)):o>=l.width()-h.width()?(o=l.width()-h.width(),t=u.width()-a.outerWidth(),clearInterval(i.data("mCSB_buttonScrollRight")),y||(g=!0)):t=-t;var w=i.data("snapAmount");w&&(t=Math.round(t/w)*w-i.data("snapOffset")),n.mTweenAxis.call(this,h[0],"left",Math.round(o),draggerSpeed,r.scrollEasing),n.mTweenAxis.call(this,a[0],"left",Math.round(t),p,r.scrollEasing,{onStart:function(){r.callbacks&&!i.data("mCS_tweenRunning")&&E("onScrollStart"),i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")&&n.showScrollbar.call(f)},onUpdate:function(){r.callbacks&&E("whileScrolling")},onComplete:function(){r.callbacks&&(E("onScroll"),(v||m&&a.position().left>=m)&&E("onTotalScrollBack"),(g||y&&a.position().left<=y)&&E("onTotalScroll")),h.data("preventAction",!1),i.data("mCS_tweenRunning",!1),i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")&&(u.hasClass("mCS-mouse-over")||n.hideScrollbar.call(f))}})}else{i.data("onTotalScrollBack_Offset")&&(m=-i.data("onTotalScrollBack_Offset")),i.data("onTotalScroll_Offset")&&(y=u.height()-a.outerHeight()+i.data("onTotalScroll_Offset")),o<0?(o=t=0,clearInterval(i.data("mCSB_buttonScrollUp")),m||(v=!0)):o>=l.height()-h.height()?(o=l.height()-h.height(),t=u.height()-a.outerHeight(),clearInterval(i.data("mCSB_buttonScrollDown")),y||(g=!0)):t=-t;var w=i.data("snapAmount");w&&(t=Math.round(t/w)*w-i.data("snapOffset")),n.mTweenAxis.call(this,h[0],"top",Math.round(o),draggerSpeed,r.scrollEasing),n.mTweenAxis.call(this,a[0],"top",Math.round(t),p,r.scrollEasing,{onStart:function(){r.callbacks&&!i.data("mCS_tweenRunning")&&E("onScrollStart"),i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")&&n.showScrollbar.call(f)},onUpdate:function(){r.callbacks&&E("whileScrolling")},onComplete:function(){r.callbacks&&(E("onScroll"),(v||m&&a.position().top>=m)&&E("onTotalScrollBack"),(g||y&&a.position().top<=y)&&E("onTotalScroll")),h.data("preventAction",!1),i.data("mCS_tweenRunning",!1),i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")&&(u.hasClass("mCS-mouse-over")||n.hideScrollbar.call(f))}})}i.data("mCS_Init")&&i.data({mCS_Init:!1})}}},stop:function(){var t=e(this),r=t.children().children(".mCSB_container"),i=t.children().children().children().children(".mCSB_dragger");n.mTweenAxisStop.call(this,r[0]),n.mTweenAxisStop.call(this,i[0])},disable:function(t){var n=e(this),r=n.children(".mCustomScrollBox"),i=r.children(".mCSB_container"),s=r.children(".mCSB_scrollTools"),o=s.children().children(".mCSB_dragger");r.unbind("mousewheel focusin mouseenter mouseleave touchend"),i.unbind("touchstart touchmove"),t&&(n.data("horizontalScroll")?o.add(i).css("left",0):o.add(i).css("top",0)),s.css("display","none"),i.addClass("mCS_no_scrollbar"),n.data({bindEvent_mousewheel:!1,bindEvent_focusin:!1,bindEvent_content_touch:!1,bindEvent_autoHideScrollbar:!1}).addClass("mCS_disabled")},destroy:function(){var t=e(this);t.removeClass("mCustomScrollbar _mCS_"+t.data("mCustomScrollbarIndex")).addClass("mCS_destroyed").children().children(".mCSB_container").unwrap().children().unwrap().siblings(".mCSB_scrollTools").remove(),e(document).unbind("mousemove."+t.data("mCustomScrollbarIndex")+" mouseup."+t.data("mCustomScrollbarIndex")+" MSPointerMove."+t.data("mCustomScrollbarIndex")+" MSPointerUp."+t.data("mCustomScrollbarIndex")),e(window).unbind("resize."+t.data("mCustomScrollbarIndex"))}},n={showScrollbar:function(){this.stop().animate({opacity:1},"fast")},hideScrollbar:function(){this.stop().animate({opacity:0},"fast")},mTweenAxis:function(e,t,n,r,i,s){function v(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()}function m(){c||o.call(),c=v()-f,g(),c>=e._time&&(e._time=c>e._time?c+l-(c-e._time):c+l-1,e._time<c+1&&(e._time=c+1)),e._time<r?e._id=_request(m):a.call()}function g(){r>0?(e.currVal=w(e._time,h,d,r,i),p[t]=Math.round(e.currVal)+"px"):p[t]=n+"px",u.call()}function y(){l=1e3/60,e._time=c+l,_request=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return g(),setTimeout(e,.01)},e._id=_request(m)}function b(){if(e._id==null)return;window.requestAnimationFrame?window.cancelAnimationFrame(e._id):clearTimeout(e._id),e._id=null}function w(e,t,n,r,i){switch(i){case"linear":return n*e/r+t;case"easeOutQuad":return e/=r,-n*e*(e-2)+t;case"easeInOutQuad":e/=r/2;if(e<1)return n/2*e*e+t;return e--,-n/2*(e*(e-2)-1)+t;case"easeOutCubic":return e/=r,e--,n*(e*e*e+1)+t;case"easeOutQuart":return e/=r,e--,-n*(e*e*e*e-1)+t;case"easeOutQuint":return e/=r,e--,n*(e*e*e*e*e+1)+t;case"easeOutCirc":return e/=r,e--,n*Math.sqrt(1-e*e)+t;case"easeOutSine":return n*Math.sin(e/r*(Math.PI/2))+t;case"easeOutExpo":return n*(-Math.pow(2,-10*e/r)+1)+t;case"mcsEaseOut":var s=(e/=r)*e,o=s*e;return t+n*(.499999999999997*o*s+ -2.5*s*s+5.5*o+ -6.5*s+4*e);case"draggerRailEase":e/=r/2;if(e<1)return n/2*e*e*e+t;return e-=2,n/2*(e*e*e+2)+t}}var s=s||{},o=s.onStart||function(){},u=s.onUpdate||function(){},a=s.onComplete||function(){},f=v(),l,c=0,h=e.offsetTop,p=e.style;t==="left"&&(h=e.offsetLeft);var d=n-h;b(),y()},mTweenAxisStop:function(e){if(e._id==null)return;window.requestAnimationFrame?window.cancelAnimationFrame(e._id):clearTimeout(e._id),e._id=null},rafPolyfill:function(){var e=["ms","moz","webkit","o"],t=e.length;while(--t>-1&&!window.requestAnimationFrame)window.requestAnimationFrame=window[e[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[t]+"CancelAnimationFrame"]||window[e[t]+"CancelRequestAnimationFrame"]}};n.rafPolyfill.call(),e.support.touch="ontouchstart"in window,e.support.pointer=window.navigator.pointerEnabled,e.support.msPointer=window.navigator.msPointerEnabled;var r="https:"==document.location.protocol?"https:":"http:";e.event.special.mousewheel||document.write('<script src="'+r+'//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.0.6/jquery.mousewheel.min.js"></script>'),e.fn.mCustomScrollbar=function(n){if(t[n])return t[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n=="object"||!n)return t.init.apply(this,arguments);e.error("Method "+n+" does not exist")}}(jQuery),define("jquery.mCustomScrollbar",function(){}),define("app/plugins/scrollbar",["jquery","jquery.mCustomScrollbar"],function(e){e("head link").first().before('<link rel="stylesheet" type="text/css" href="css/jquery.mCustomScrollbar.css" />')}),define("app/classes/tools/insert-sticker",["underscore","jquery","app/classes/tools/ToolBase","app/classes/ui/workspace/component/Sticker","text!resources/tpl/ui/property/ui-property-item-insert-sticker.tpl.html","app/plugins/scrollbar"],function(e,t,n,r,i){return new n({name:"insert-sticker",type:"toggle",iconCls:"fa fa-fw fa-star",propertyTpl:i,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){if(t===!1){var n=NHIE.workspace.getSelectedLayer();n&&this.onApplyProperty()}},enableStatus:function(){return!0},onRenderProperty:function(e){var n=this,r=e.find("ul.list-items");r.mCustomScrollbar(),r.find("li.list-item").on("mouseenter",function(){r.find("li.list-item").removeClass("hover"),t(this).addClass("hover")}).on("mouseleave",function(){r.find("li.list-item").removeClass("hover")}).on("click",function(){r.find("li.list-item").removeClass("selected"),t(this).addClass("selected");var e=t(this).attr("data-item-id");n.selectSticker(e)})},onShowProperty:function(e){var e={};e.items=NHIE.util.getConfig("assets.stickers"),NHIE.propertyPanel.setPropertyContent("insert-sticker",e)},onApplyProperty:function(){if(this.component){var e=this.component.toCanvas(),t=this.component.$component,n=this;e.then(function(e){var r=NHIE.workspace.addLayer("canvas");r.setCanvasContent({canvas:e,style:{left:parseInt(t.css("left")),top:parseInt(t.css("top")),width:t.width(),height:t.height()}}),r.select(),n.component.remove(),n.component=null,NHIE.workspace.$clipping_area.removeClass("insert-component"),NHIE.app.fireEvent("changecontent")}).catch(function(e){console.error(e)})}},onRestoreProperty:function(){this.component&&(this.component.remove(),this.component=null),NHIE.workspace.$clipping_area.removeClass("insert-component")},getSelectedItem:function(t){var n=NHIE.util.getConfig("assets.stickers"),r=e.findIndex(n,{id:t});if(r>-1)return n[r]},selectSticker:function(t){this.component&&this.component.remove();var n=NHIE.util.getConfig("assets.stickers"),i=e.findIndex(n,{id:t});if(i>-1){NHIE.workspace.$clipping_area.addClass("insert-component");var s=n[i],o=new r({item_id:t,src:s.src,id:"nhie-component-sticker_"+s.id,style:{width:s.width,height:s.height}});this.component=o}}})}),define("text!resources/tpl/ui/property/ui-property-item-adjust-color.tpl.html",[],function(){return'<div class="property-item property-adjust-color">\r\n	<dl>\r\n		<dt><span style="color:red"><%=NHIE_Lang[\'PluginImageEditor_property_color_red\']%></span>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="color-r"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><span style="color:green"><%=NHIE_Lang[\'PluginImageEditor_property_color_green\']%></span>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="color-g"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><span style="color:blue"><%=NHIE_Lang[\'PluginImageEditor_property_color_blue\']%></span>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="color-b"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><%=NHIE_Lang[\'PluginImageEditor_property_color_brightness\']%>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="brightness"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><%=NHIE_Lang[\'PluginImageEditor_property_color_contrast\']%>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="contrast"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><%=NHIE_Lang[\'PluginImageEditor_property_color_saturation\']%>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="saturation"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n		<dt><%=NHIE_Lang[\'PluginImageEditor_property_color_hue\']%>: </dt>\r\n		<dd>\r\n			<div class="slider" data-form-type="slider" data-name="hue"></div>\r\n			<span class="slider-value">0</span>\r\n		</dd>\r\n	</dl>\r\n</div>\r\n'}),define("app/classes/tools/adjust-color",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-adjust-color.tpl.html"],function(e,t,n,r){function s(e){function p(){var e=new Blob([f],{type:"text/javascript"});return window.URL.createObjectURL(e)}function d(e,t,n){return e=e%360*i|0,t=63*t|0%o,n=63*n|0%u,a[e][t][n]}function v(e,t,n){var r,i,s,o,u;e/=360;if(t===0)r=i=s=n;else{function a(e,t,n){return n%=1,n<.1666667?e+(t-e)*n*6:n<.5?t:n<.6666667?e+(t-e)*(.6666667-n)*6:e}o=n<.5?n*(1+t):n+t-n*t,u=2*n-o,r=a(u,o,e+.3333333),i=a(u,o,e),s=a(u,o,e-.3333333)}return{r:r*255+.5|0,g:i*255+.5|0,b:s*255+.5|0}}function m(){for(var e=0,n,i=1/u;e<s;e++){n=e*r,a[e]=new Array(o);for(var f=0,l;f<o;f++){l=f/o,a[e][f]=new Array(u);for(var c=0;c<u;c++)a[e][f][c]=v(n,l,c*i)}}t.hsl2rgb=d,t.time=0}e=typeof e=="boolean"?e:!1;var t=this,n,r=e?2:4,i=1/r,s=360/r,o=256/r,u=o,a=new Array(s),f="onmessage=function(d){function k(x,D,z){var C,o,e,B,A;x/=360;if(D===0){C=o=e=z}else{function y(h,s,E){E%=1;if(E<0.1666667){return h+(s-h)*E*6}if(E<0.5){return s}if(E<0.6666667){return h+(s-h)*(0.6666667-E)*6}return h}B=z<0.5?z*(1+D):z+D-z*D;A=2*z-B;C=y(A,B,x+0.3333333);o=y(A,B,x);e=y(A,B,x-0.3333333)}b[a++]=C*255;b[a++]=o*255;b[a++]=e*255}var w=new Date().getTime(),f=parseInt(d.data,10),g=1/f,p=360/f,r=256/f,q=r,c=new ArrayBuffer(p*r*q*3),b=new Uint8ClampedArray(c),a=0,j=0,v,m,i,u,n=1/r,l=1/q;for(;j<p;j++){i=j*f;for(v=0;v<r;v++){u=v*n;for(m=0;m<q;m++){k(i,u,m*l)}}}var t={cube:c,time:(new Date().getTime()-w)};postMessage(t,[t.cube])};",l;t.time=-1,this.hsl2rgb=this.hsl2rgbHQ=v;if(typeof window.Array!="undefined"&&typeof window.Worker!="undefined")try{n=new Worker(p()),n.onmessage=function(e){clearTimeout(l),t.time=e.data.time;var n=new Uint8Array(e.data.cube),r=0;for(var i=0,f,c=1/u;i<s;i++){a[i]=new Array(o);for(var h=0,p;h<o;h++){a[i][h]=new Array(u);for(var v=0;v<u;v++)a[i][h][v]={r:n[r],g:n[r+1],b:n[r+2]},r+=3}}t.hsl2rgb=d},l=setTimeout(c,r===2?8e3:2e3),n.postMessage(r);function c(){n.terminate(),m()}}catch(h){m()}else m(),t.hsl2rgb=d,t.time=0}function u(e,t,n){e/=255,t/=255,n/=255;var r=Math.max(e,t,n),i=Math.min(e,t,n),s,o,u=(r+i)/2;if(r==i)s=o=0;else{var a=r-i;o=u>.5?a/(2-r-i):a/(r+i);switch(r){case e:s=(t-n)/a+(t<n?6:0);break;case t:s=(n-e)/a+2;break;case n:s=(e-t)/a+4}s/=6}return{h:s,s:o,l:u}}function a(e,t,n){var r,i,s;if(t==0)r=i=s=n;else{function o(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=n<.5?n*(1+t):n+t-n*t,a=2*n-u;r=o(a,u,e+1/3),i=o(a,u,e),s=o(a,u,e-1/3)}return{r:r*255,g:i*255,b:s*255}}var i=["color-r","color-g","color-b","brightness","contrast","hue","saturation"],o=new s(!1,!0);return new n({name:"adjust-color",type:"toggle",iconCls:"fa fa-fw fa-adjust",propertyTpl:r,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){},enableStatus:function(){return!!NHIE.workspace.getSelectedLayer()&&!NHIE.workspace.getSelectedLayer().empty},onRenderProperty:function(e){this.$property=e;var n=this;t("div[data-form-type=slider]",e).slider({min:-100,max:100,value:0,step:5,slide:function(e,r){var i=r.value,s=t(this).attr("data-name");t(this).parent().find("span.slider-value").text(i),n.color_info.values[s]=i},stop:function(e,r){var i=r.value,s=t(this).attr("data-name");t(this).parent().find("span.slider-value").text(i),n.color_info.values[s]=i,n.adjustColor(s)}})},onShowProperty:function(e){this.color_info&&this.onApplyProperty();if(NHIE.workspace.getSelectedLayer()){var t=NHIE.workspace.getSelectedLayer();this.color_info={id:t.id,data:t.getCanvasImageData(),values:{}}}NHIE.propertyPanel.setPropertyContent("adjust-color",{})},onApplyProperty:function(){if(this.color_info){var e=NHIE.workspace.getLayerById(this.color_info.id);if(e){var t=this.color_info.data;t.data=e.getCanvasImageData().data,e.setCanvasContent(t),NHIE.app.fireEvent("changecontent"),this.color_info.data=e.getCanvasImageData(),this.color_info.values={}}this.resetSliderValues()}},onRestoreProperty:function(){if(this.color_info){var e=NHIE.workspace.getLayerById(this.color_info.id);e&&e.setCanvasContent(this.color_info.data),this.color_info.values={},this.resetSliderValues()}},resetSliderValues:function(){t("div[data-form-type=slider]",this.$property).slider("value",0),t("span.slider-value",this.$property).html("0")},adjustColor:function(n){var r=this.color_info;e.each(i,function(e){typeof r.values[e]=="undefined"&&(r.values[e]=0),r.values[e]=parseInt(r.values[e])});var s=function(e){return r.values[e]},o=NHIE.workspace.getLayerById(r.id);if(o){console.log("adjust color : ",r),console.log("adjust color - hue: ",s("hue")),console.log("adjust color - saturation : ",s("saturation"));var f=t("<canvas></canvas>"),l=f.get(0),c=o.getCanvasElement();l.width=c.width,l.height=c.height;var h=l.getContext("2d").getImageData(0,0,c.width,c.height),p=r.data.data,d=p.data,v=!1;for(var m=0,g=d.length;m<g;m+=4){var y=d[m+0],b=d[m+1],w=d[m+2],E=d[m+3];y=s("color-r")/100*y+y,b=s("color-g")/100*b+b,w=s("color-b")/100*w+w,y+=s("brightness"),b+=s("brightness"),w+=s("brightness");var S=s("contrast")*2.55,x=(255+S)/(255.01-S);y=x*(y-128)+128,b=x*(b-128)+128,w=x*(w-128)+128;var T=u(y,b,w);T.h-=s("hue")/360,T.h>1&&(T.h=1),T.h<-1&&(T.h=-1),T.s+=s("saturation")/200,T.s>1&&(T.s=1),T.s<0&&(T.s=0);var N=a(T.h,T.s,T.l);y=N.r,b=N.g,w=N.b,h.data[m+0]=y,h.data[m+1]=b,h.data[m+2]=w,h.data[m+3]=E}o.setCanvasContent({data:h,style:r.data.style,skipCache:!0}),f.remove()}}})}),define("text!resources/tpl/ui/property/ui-property-item-apply-filter.tpl.html",[],function(){return'<div class="property-item property-apply-filter">\r\n	<ul class="list-items">\r\n		<!-- <% for (var i = 0; i < data.items.length; i++) { %> -->\r\n		<li class="list-item" data-item-id="<%=data.items[i].id%>">\r\n			<img src="<%=data.items[i].src%>" />\r\n			<span class=""><%=NHIE_Lang[\'PluginImageEditor_property_filter_\'+data.items[i].name]%></span>\r\n		</li>\r\n		<!-- <% } %> -->\r\n		<div style="width:1px;height:1px;clear:both;"></div>\r\n	</ul>\r\n</div>\r\n'}),define("app/classes/tools/apply-filter",["underscore","jquery","app/classes/tools/ToolBase","text!resources/tpl/ui/property/ui-property-item-apply-filter.tpl.html"],function(e,t,n,r){var i=[{id:"filter-original",name:"original",src:"resources/images/filters/filter-original.png",doFilter:function(){this.onRestoreProperty()}},{id:"filter-beautify",name:"beautify",src:"resources/images/filters/filter-beautify.png",fn:function(e,t,n,r,i,s){var o=10;e+=o,t+=o,n+=o;var u=25.5,i=(255+u)/(255.01-u);return e=i*(e-128)+128,t=i*(t-128)+128,n=i*(n-128)+128,[e,t,n,r]},doFilter:function(e){var t=e.data;for(var n=0,r=t.length;n<r;n+=4)var i=t[n+0],s=t[n+1],o=t[n+2],u=t[n+3]}},{id:"filter-grayscale",name:"grayscale",src:"resources/images/filters/filter-grayscale.png",fn:function(e,t,n,r,i,s){var o=.3*e+.59*t+.11*n;return[o,o,o]}},{id:"filter-sepia",name:"sepia",src:"resources/images/filters/filter-sepia.png",fn:function(e,t,n,r,i,s){var o=.3*e+.59*t+.11*n;return[o+100,o+50,o]}},{id:"filter-blur",name:"blur",src:"resources/images/filters/filter-blur.png",matrix:[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9]},{id:"filter-sharpen",name:"sharpen",src:"resources/images/filters/filter-sharpen.png",matrix:[0,-1,0,-1,5,-1,0,-1,0]},{id:"filter-edge",name:"edge",src:"resources/images/filters/filter-outline.png",matrix:[1,1,1,1,-7,1,1,1,1]},{id:"filter-bevel",name:"bevel",src:"resources/images/filters/filter-bevel.png",doFilter:function(e){var t=[-1,-2,-1,0,0,0,1,2,1],n=[-1,0,1,-2,0,2,-1,0,1],r=e.width,i=e.height,s=e.data,o=[];for(var u=0;u<i;u++)for(var a=0;a<r;a++){var f=(u*r+a)*4,l=0;gh=0,bh=0;var c=0;gv=0,bv=0;for(var h=-1;h<=1;h++){var p=u+h,d;p>=0&&p<i?d=p*r*4:d=u*r*4;var v=3*(h+1)+1;for(var m=-1;m<=1;m++){var g=a+m;g>=0&&g<r||(g=a),g*=4;var y=s[d+g],b=s[d+g+1],w=s[d+g+2],E=t[v+m],S=n[v+m];l+=parseInt(E*y),bh+=parseInt(E*b),gh+=parseInt(E*w),c+=parseInt(S*y),gv+=parseInt(S*b),bv+=parseInt(S*w)}}y=parseInt(Math.sqrt(l*l+c*c)/1.8),b=parseInt(Math.sqrt(gh*gh+gv*gv)/1.8),w=parseInt(Math.sqrt(bh*bh+bv*bv)/1.8),o[f]=y,o[f+1]=b,o[f+2]=w,o[f+3]=s[f+3]}for(var x=0;x<o.length;x++)s[x]=o[x];return e}},{id:"filter-emboss",name:"emboss",src:"resources/images/filters/filter-emboss.png",matrix:[3,0,0,0,-1,0,0,0,-1]},{id:"filter-fog_glass",name:"fog_glass",src:"resources/images/filters/filter-fog_glass.png",doFilter:function(e,t){var n=t.radius||3,r=10,i=[],o=[];for(var u=0;u<256;u++){var a=Math.PI*2*u/256;i[u]=r*Math.sin(a),o[u]=r*Math.cos(a)}return transInverse=function(e,t,n){var r=parseInt(Math.random()*255),s=Math.random();n[0]=e+s*i[r],n[1]=t+s*o[r]},s(e,transInverse),e}}],s=function(e,n){var r=t("<canvas></canvas>").get(0),i=r.width=e.width,s=r.height=e.height,o=e.data,u=[];r.getContext("2d").putImageData(e,0,0);var a=function(e,t,n,r,i){var s=(n*r+t)*4;return t<0||t>=r||n<0||n>=i?[e[(f(n,0,i-1)*r+f(t,0,r-1))*4],e[(f(n,0,i-1)*r+f(t,0,r-1))*4+1],e[(f(n,0,i-1)*r+f(t,0,r-1))*4+2],e[(f(n,0,i-1)*r+f(t,0,r-1))*4+3]]:[e[s],e[s+1],e[s+2],e[s+3]]},f=function(e,t,n){return e<t?t:e>n?n:e},l=function(e,t,n,r,i,s){var o,u,a=n[0],f=n[1],l=n[2],c=n[3],h=r[0],p=r[1],d=r[2],v=r[3],m=i[0],g=i[1],y=i[2],b=i[3],w=s[0],E=s[1],S=s[2],x=s[3],T=1-e,N=1-t;o=T*c+e*v,u=T*b+e*x;var C=N*o+t*u;o=T*a+e*h,u=T*m+e*w;var k=N*o+t*u;o=T*f+e*p,u=T*g+e*E;var L=N*o+t*u;o=T*l+e*d,u=T*y+e*S;var A=N*o+t*u;return[k,L,A,C]},c=r.getContext("2d").getImageData(0,0,i,s).data;for(var h=0;h<s;h++)for(var p=0;p<i;p++){var d=(h*i+p)*4;n(p,h,u);var v=Math.floor(u[0]),m=Math.floor(u[1]),g=u[0]-v,y=u[1]-m,b,w,E,S;if(v>=0&&v<i-1&&m>=0&&m<s-1){var x=(i*m+v)*4;b=[o[x],o[x+1],o[x+2],o[x+3]],w=[o[x+4],o[x+5],o[x+6],o[x+7]],E=[o[x+i*4],o[x+i*4+1],o[x+i*4+2],o[x+i*4+3]],S=[o[x+(i+1)*4],o[x+(i+1)*4+1],o[x+(i+1)*4+2],o[x+(i+1)*4+3]]}else b=a(o,v,m,i,s),w=a(o,v+1,m,i,s),E=a(o,v,m+1,i,s),S=a(o,v+1,m+1,i,s);var T=l(g,y,b,w,E,S);c[d]=T[0],c[d+1]=T[1],c[d+2]=T[2],c[d+3]=T[3]}for(var x=0;x<c.length;x++)e.data[x]=c[x]},o=function(e,t,n){var r=e.getCanvasElement(),i=r.getContext("2d"),s=i.getImageData(0,0,r.width,r.height),o=s.data,u=[],a=o.length;for(var f=0;f<a;f+=4)u=t.call(this,o[f],o[f+1],o[f+2],o[f+3],n,f),o[f]=u[0],o[f+1]=u[1],o[f+2]=u[2],typeof u[3]!="undefined"&&(o[f+3]=u[3]);return i.putImageData(s,0,0),s},u=function(e,t,n){var r=Math.round(Math.sqrt(t.length)),i=Math.floor(r/2),s=e.getCanvasElement(),o=s.getContext("2d"),u=o.getImageData(0,0,s.width,s.height),a=u.data,f=u.width,l=u.height,c=f,h=l,p=document.createElement("canvas"),d=p.getContext("2d");d.clearRect(0,0,c,h);var v=d.createImageData(c,h),m=v.data,g=n?1:0;for(var y=0;y<h;y++)for(var b=0;b<c;b++){var w=y,E=b,S=(y*c+b)*4,x=0,T=0,N=0,C=0;for(var k=0;k<r;k++)for(var L=0;L<r;L++){var A=w+k-i,O=E+L-i;if(A>=0&&A<l&&O>=0&&O<f){var M=(A*f+O)*4,_=t[k*r+L];x+=a[M]*_,T+=a[M+1]*_,N+=a[M+2]*_,C+=a[M+3]*_}}m[S]=x,m[S+1]=T,m[S+2]=N,m[S+3]=C+g*(255-C)}o.putImageData(v,0,0)};return new n({name:"apply-filter",type:"toggle",iconCls:"fa fa-fw fa-image",propertyTpl:r,restoreBtnTitle:NHIE.Lang.PluginImageEditor_button_cancel,handler:function(e,t){if(t===!1){var n=NHIE.workspace.getSelectedLayer();n&&this.filter_info&&this.filter_info.modified&&this.onApplyProperty()}},enableStatus:function(){return!!NHIE.workspace.getSelectedLayer()&&!NHIE.workspace.getSelectedLayer().empty},onShowProperty:function(e){this.filter_info;if(NHIE.workspace.getSelectedLayer()){var t=NHIE.workspace.getSelectedLayer();this.filter_info={id:t.id,data:t.getCanvasImageData()}}var e={};e.items=i,NHIE.propertyPanel.setPropertyContent(this.name,e)},onRenderProperty:function(e){var n=this,r=e.find("ul.list-items");r.mCustomScrollbar(),r.find("li.list-item").on("mouseenter",function(){r.find("li.list-item").removeClass("hover"),t(this).addClass("hover")}).on("mouseleave",function(){r.find("li.list-item").removeClass("hover")}).on("click",function(){r.find("li.list-item").removeClass("selected"),t(this).addClass("selected");var e=t(this).attr("data-item-id");n.applyFilter(e)})},onApplyProperty:function(){if(this.filter_info){var e=NHIE.workspace.getLayerById(this.filter_info.id);if(e){var t=this.filter_info.data;t.data=e.getCanvasImageData().data,e.setCanvasContent(t),NHIE.app.fireEvent("changecontent"),this.filter_info.data=t}}},onRestoreProperty:function(){if(this.filter_info){var e=NHIE.workspace.getLayerById(this.filter_info.id);e&&e.setCanvasContent(this.filter_info.data)}},getSelectedItem:function(t){var n=i,r=e.findIndex(n,{id:t});if(r>-1)return n[r]},applyFilter:function(e){NHIE.app.loading(!0),e!=="filter-original"?this.filter_info.modified=!0:this.filter_info.modified=!1;var t=this.getSelectedItem(e);if(t&&NHIE.workspace.getSelectedLayer()){var n=NHIE.workspace.getSelectedLayer();if(typeof t.fn=="function")o(n,t.fn);else if(typeof t.matrix!="undefined"&&t.matrix.length)u(n,t.matrix);else if(typeof t.doFilter=="function"){var r=n.getCanvasElement(),i=r.getContext("2d"),s=i.getImageData(0,0,r.width,r.height),a=t.doFilter.apply(this,[s,{}]);a&&i.putImageData(a,0,0)}}NHIE.app.loading(!1)}})}),define("app/classes/ui/Toolbar",["jquery","underscore","app/classes/ui/UIElement","app/lib","text!resources/tpl/ui/ui-toolbar.tpl.html","app/classes/tools/history-reset","app/classes/tools/history-undo","app/classes/tools/history-redo","app/classes/tools/resize-workspace","app/classes/tools/move-layer","app/classes/tools/rotate-left","app/classes/tools/rotate-right","app/classes/tools/inverse-h","app/classes/tools/inverse-v","app/classes/tools/crop-layer","app/classes/tools/resize-layer","app/classes/tools/insert-textbox","app/classes/tools/insert-textballoon","app/classes/tools/insert-sticker","app/classes/tools/adjust-color","app/classes/tools/apply-filter"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w){var E={"history-reset":s,"history-undo":o,"history-redo":u,"resize-workspace":a,"move-layer":f,"rotate-left":l,"rotate-right":c,"inverse-h":h,"inverse-v":p,"crop-layer":d,"resize-layer":v,"insert-sticker":y,"insert-textballoon":g,"insert-textbox":m,"adjust-color":b,"apply-filter":w},S="ERROR_NO_FILE_SELECTED",x=n.extend({classname:"toolbar",renderTo:".toolbar-top",defaultConfig:{template:{tpl:r.tmpl(i,{})}},tools:{},events:{render:function(e){this.initToolbar()}},initToolbar:function(){var n=this,r=e(".tools-main",this.dom),i='<div class="toolbar-separator"></div>',s='<div class="button-group"></div>',o=NHIE.util.getConfig("ui.toolbar")||[];t.each(o,function(o){if(o==="|")r.append(i);else if(t.isArray(o)){var u=e(s);r.append(u),t.each(o,function(e){var t=E[e];t&&(n.tools[e]=t,t.render(u))})}});var u=e("input.file-input-add-photo"),a=u.get(0).outerHTML,f=u.parent();e("#file-object").hide(),u=e("input.file-input-add-photo"),u.on("mousedown",function(){var t=NHIE.app.getCurrentTool();t&&t.toggled&&t.fireEvent("toggle",!1),console.log("input form clicked...before ",u.parent().get(0)),e(this).parent().get(0).reset(),e(this).parent().find("button").trigger("click"),e(this).val(""),console.log("input form clicked...after ",e(this).val())}),u.change(function(t){console.log("input form changed...",e(this).val());if(!e(this).val())return;var n=this,r;(typeof window.FileReader=="function"||typeof window.FileReader=="object")&&n&&n.files?(NHIE.app.loading(!0),r=new NHIE.lib.Promise(function(e,t){try{var r=n.files[0];if(!r)throw S;var i=new FileReader;i.onload=function(t){e(i)},i.onerror=function(e){t(o)};var s=i.readAsDataURL(r)}catch(o){t(o)}}),r=r.then(function(e){console.log(e);var t=e.result;return NHIE.lib.util.getImage(t)})):n&&t.target.files&&t.target.files[0]&&(r=NHIE.adapter.upload({type:"form",data:n.files}).then(function(e){console.log(e),console.log(e),console.log(e),console.log(e);if(e.success){var t=e.src;return NHIE.lib.util.getImage(t)}throw e.message})),r=r.then(function(t){var n=e("<canvas></canvas>").get(0);n.width=100,n.height=100;var r=n.getContext("2d");r.drawImage(t,0,0,100,100);var i=r.getImageData(0,0,100,100);return t}).then(function(e){var t=NHIE.workspace.addLayer("image"),n=t.getCanvasElement(),r=n.getContext("2d"),i=e.naturalWidth,s=e.naturalHeight,o=NHIE.util.getConfig("maxImageWidth"),u=NHIE.util.getConfig("maxImageHeight");if(i>o||s>u)NHIE.dialog.alert_dialog_bigimage.show(),i>o&&(s=o*s/i,i=o),s>u&&(i=u*i/s,s=u);n.width=i,n.height=s,r.drawImage(e,0,0,i,s),NHIE.util.canvasCache.set(n);var a=NHIE.workspace.getSize(),f=i,l=s,c=a.width,h=a.height,p=f,d=l;t.setCanvasStyle({width:parseInt(p),height:parseInt(d),left:parseInt((c-p)/2),top:parseInt((h-d)/2)}),t.select(),t.empty=!1,NHIE.app.loading(!1),NHIE.app.fireEvent("changecontent")}).catch(function(e){console.error(e),NHIE.app.loading(!1);if(e===S)console.log("skip proc by ERROR_NO_FILE_SELECTED");else{console.log("e.NHIE_ERROR - ",e.NHIE_ERROR);if(e.NHIE_ERROR==="ERROR"){var t={title:"Image Editor",type:"alert",width:400,modal:!0,destroyWhenClose:!0};t.content="<p>"+NHIE.Lang.PluginImageUploadFail+"</p>";switch(e.TYPE){case"invalid_size":t.content="<p>"+NHIE.Lang.PluginImageSizeInvalid+"</p>"}var n=new Dialog(t);n.show()}else NHIE.dialog.alert_dialog_wrongimage.show()}})})},resetToggle:function(){var e=[];return t.each(this.tools,function(t,n){if(t.type==="toggle"&&t.getToggleStatus()===!0){var r=t.fireEvent("toggle",!1,!0);typeof r!="undefined"&&r.then&&e.push(r)}}),e.length?NHIE.lib.Promise.all(e).then(function(){NHIE.propertyPanel.showProperty("empty")}):NHIE.lib.Promise.resolve(!0).then(function(){NHIE.propertyPanel.showProperty("empty")})},resetButtonStatus:function(){t.each(this.tools,function(e,t){e.resetButtonStatus()})},getToolbarButton:function(t){return e(this.dom).find("[data-action="+t+"]")},updateCanvasSize:function(t,n){var r=e(this.dom).find(".info.info-workspace-size span.content"),i="W: <%=size.width%>, H:<%=size.height%>",s=NHIE.tmpl(i,{size:{width:parseInt(t),height:parseInt(n)}});r.html(s)}});return x}),define("text!resources/tpl/ui/ui-navigator.tpl.html",[],function(){return'<div class="navigator expanded">\r\n	<div class="navigator-top">\r\n		<button class="navigator-expander"><i class="fa fa-fw fa-play"></i></button>\r\n	</div>\r\n	<div class="navigator-preview ">\r\n		<div class="preview-wrapper"></div>\r\n		<div class="preview-scroller"></div>\r\n	</div>\r\n	<div class="navigator-controller">\r\n		<div class="navigator-controller-slider" data-form-type="slider" data-name="zoom"></div>\r\n		<span class="navigator-controller-zoom-value">100%</span>\r\n	</div>\r\n</div>\n'}),define("app/classes/ui/Navigator",["jquery","underscore","app/classes/ui/UIElement","text!resources/tpl/ui/ui-navigator.tpl.html"],function(e,t,n,r){var i=n.extend({classname:"Navigator",renderTo:".nhie-body",defaultConfig:{template:{tpl:r}},zoom:100,events:{render:function(t){var n=this,r=NHIE.util.getConfig("ui.navigator.zoom_steps");e("div[data-form-type=slider]",t).slider({min:0,max:r.length-1,value:5,step:1,slide:function(i,s){var o=s.value;e(".navigator-controller-zoom-value",t).text(r[o]+"%"),n.fireEvent("changezoom",r[o])}}),e(".navigator-expander",t).on("click",function(){t.toggleClass("expanded");var e=t.hasClass("expanded"),r="on"+(e?"expanded":"closed");console.log("---",r),n.fireEvent(r)});var i=e(".preview-wrapper",t),s=e(".navigator-preview",t);e(".preview-scroller",t).draggable({drag:function(t,r){var o=s.offset(),u=i.offset(),a=i.width(),f=i.height(),l=e(this).width(),c=e(this).height(),h={left:u.left-o.left,top:u.top-o.top};r.position.top-h.top<0&&(r.position.top=h.top+0),r.position.top-h.top+c>f&&(r.position.top=h.top+f-c),r.position.left-h.left<0&&(r.position.left=h.left+0),r.position.left-h.left+l>a&&(r.position.left=h.left+a-l);var p={left:r.position.left-h.left,top:r.position.top-h.top};n.setWorkspacePositionByScroller(p.left,p.top)}})},changezoom:function(e){this.zoom=e,NHIE.app.fireEvent("changenavigatorzoom",e),NHIE.navigator.resetScroller()},onclosed:function(){console.log("navigator closed!!"),e(this.dom).find(".navigator-preview").hide()},onexpanded:function(){console.log("navigator expanded!!"),e(this.dom).find(".navigator-preview").show(),this.update(),this.resetScroller()}},update:function(){var t=e(this.dom).find(".navigator-preview .preview-wrapper");t.html("");var n=e(".workspace .layer-container.layer-workspace").clone();t.append(n);var r=e(this.dom).find(".navigator-preview");r.find(".layer-wrapper").css({transform:"scale(1,1)"});var i={width:r.width(),height:r.height()};n.find("canvas").each(function(e,t){NHIE.util.canvasManager.resetImageData(t)});var s=1,o=NHIE.workspace.getSize();o.width>o.height?(s=i.width/o.width,s*o.height>i.height&&(s=i.height/o.height)):(s=i.height/o.height,s*o.width>i.width&&(s=i.width/o.width)),this.nav_zoom=s,t.css({width:s*o.width,height:s*o.height,marginLeft:s*o.width/-2,marginTop:s*o.height/-2}),n.css({position:"absolute",left:"50%",top:"50%",zoom:1}),n.css("transform","scale("+s+")")},resetScroller:function(){var t={width:e(".nhie-body .workspace").width(),height:e(".nhie-body .workspace").height()},n=t.width,r=t.height,i=NHIE.workspace.getSize(),s=this.zoom||100,o=e(".navigator-preview .preview-wrapper"),u={width:o.width(),height:o.height()},a=e(this.dom).find(".preview-scroller"),f=1,l=e(".workspace .layer-container"),c=e(".navigator-preview").offset(),h=e(".navigator-preview .preview-wrapper").offset(),p={left:h.left-c.left,top:h.top-c.top};if(i.width*s/100>n){a.show(),this.scrollerEnabled=!0,f=u.width/i.width/(s/100),r>i.height*s/100&&(r=i.height*s/100);var d={width:n*f,height:r*f};d.left=p.left,d.top=p.top,a.css(d),this.setWorkspacePositionByScroller(a.offset().left-o.offset().left,a.offset().top-o.offset().top)}else if(i.height*s/100>r){a.show(),this.scrollerEnabled=!0,f=u.height/i.height/(s/100);var d={width:n*f,height:r*f};d.width>u.width&&(d.width=u.width),d.left=p.left,d.top=p.top,a.css(d),this.setWorkspacePositionByScroller(a.offset().left-o.offset().left,a.offset().top-o.offset().top)}else this.setWorkspacePositionByScroller(0,0),a.hide(),this.scrollerEnabled=!1},setWorkspacePositionByScroller:function(t,n){var r=e(this.dom),i=e(".preview-wrapper",r),s=e(".navigator-preview",r),o=i.width(),u=i.height(),a=NHIE.workspace.getSize(),f=a.scale/100,l={width:a.width*f,height:a.height*f},c=l.width/o,h={left:t*c,top:n*c},p={width:e(".nhie-body .workspace").width(),height:e(".nhie-body .workspace").height()},d={left:(p.width-l.width)/2,top:(p.height-l.height)/2},v={left:0,top:0};p.width<l.width&&(v.left=-h.left-d.left),p.height<l.height&&(v.top=-h.top-d.top),e(".workspace-contents-wrapper").css(v),NHIE.app.fireEvent("moveworkspace")},clear:function(){var t=e(this.dom).find(".navigator-preview .preview-wrapper");t.html("")}});return i}),define("app/classes/ui/workspace/LayerTracker",["jquery","underscore","app/classes/ui/workspace/Tracker"],function(e,t,n){var r=n.extend({classname:"LayerTracker",renderTo:".layer-tracker-container",enable_dragmove:!1,ignoreScale:!1,events:{render:function(e){e.addClass("layer-resizer"),e.attr("data-target-layer-id",this.target.id),this.syncSize(),this.initTrackerEvents()}},syncSize:function(t){t=!!t;var n=this.target.style,r=(NHIE.app.data("navigator-zoom")||100)/100,i=e(this.dom);if(t){var s=this.target;s.setStyle({width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),left:parseFloat(i.css("left")),top:parseFloat(i.css("top"))})}else i.css({width:r*n.width,height:r*n.height,left:r*n.left,top:r*n.top,transform:"rotate("+n.rotation+"deg)"})}});return r}),define("app/classes/ui/workspace/LayerCanvas",["jquery","underscore","app/classes/Observable","app/classes/ui/workspace/LayerTracker"],function(e,t,n,r){var i=n.extend({classname:"LayerCanvas",construct:function(t){this._super(t);var n,i;t.dom?(n=e(t.dom),i=n.parent(),this.style={left:parseFloat(i.css("left")),top:parseFloat(i.css("top")),width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),rotation:parseFloat(i.attr("data-transform-rotation"))},n.attr("data-canvascache-id")==="_CACHE::empty_canvas"&&(this.empty=!0)):(n=e('<canvas class="layer-canvas" id="'+this.id+'" style="position:absolute;"></canvas>'),i=e('<div class="layer"></div>'),i.append(n),e(".workspace-contents div.layer-container.layer-workspace .layer-wrapper").append(i),this.style={left:0,top:0,rotation:0}),this.$canvas=n,this.$canvasWrapper=i;var s=new r({id:"layer-tracker-"+this.id,target:this});s.render(),this.tracker=s;if(!t.dom)this.initCanvas();else{var o={left:parseFloat(i.css("left")),top:parseFloat(i.css("top")),width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),rotation:parseFloat(i.attr("data-transform-rotation"))};this.setCanvasStyle(o)}NHIE.layerPanel.add(this)},events:{mousedown_layer:function(e){console.log("move-layer: mousedown~~"),this.fireEvent("startmove",e)},startmove:function(e){var n=this,r=t.clone(this.style),i=(NHIE.app.data("navigator-zoom")||100)/100,s={mode:"move-layer",scale:i,origin:{clientX:e.clientX,clientY:e.clientY,width:r.width,height:r.height,left:r.left,top:r.top,rotation:r.rotation}};this.info=s},onmove:function(e){var t=this.info,n={x:(e.clientX-t.origin.clientX)/t.scale,y:(e.clientY-t.origin.clientY)/t.scale},r={left:t.origin.left+n.x,top:t.origin.top+n.y};this.modified=!0,this.setCanvasStyle(r),NHIE.app.fireEvent("changeproperty",r)},endmove:function(e){}},initCanvas:function(){var e=NHIE.workspace.getSize(),t={left:e.width/2,top:e.height/2,width:e.width,height:e.height,marginLeft:e.width/-2,marginTop:e.height/-2};this.setCanvasStyle({left:0,top:0,width:e.width,height:e.height})},getCanvasElement:function(){return this.$canvas.get(0)},setEmpty:function(){var e=this.getCanvasElement(),t=e.getContext("2d");e.width=1,e.height=1,this.empty=!0},setImage:function(t){var n=this.getCanvasElement(),r=n.getContext("2d"),i=this;return NHIE.lib.util.getImage(t.src).then(function(e){var i,s,o=!1;t.style?(i=parseInt(t.style.width),s=parseInt(t.style.height)):(i=e.naturalWidth,s=e.naturalHeight);var u=NHIE.util.getConfig("maxImageWidth"),a=NHIE.util.getConfig("maxImageHeight");if(i>u||s>a)o=!0,NHIE.dialog.alert_dialog_bigimage.show(),i>u&&(s=u*s/i,i=u),s>a&&(i=a*i/s,s=a);return n.width=i,n.height=s,NHIE.workspace.setSize(i,s),r.drawImage(e,0,0,i,s),NHIE.util.canvasCache.set(n),{img:e,size:{width:i,height:s},oversize:o}}).then(function(n){var r={};if(!t.style){var s=NHIE.workspace.getSize(),o=n.size.width,u=n.size.height,a=s.width,f=s.height,l=0,c=0;o<a&&u<f?(l=o,c=u):(l=o>u?a:f*o/u,c=u>o?f:a*u/o),r={width:l,height:c}}else console.log(n,t),n.oversize?r={width:n.size.width,height:n.size.height}:r={width:t.style.width,height:t.style.height};return i.setCanvasStyle(r),e(window).resize(),r}).then(function(e){return i.syncLayerpanelThumbnail(),e}).then(function(e){return i.empty=!1,NHIE.app.fireEvent("changecontent"),e}).catch(function(e){console.error(e)})},setCanvasContent:function(t){var n=this.getCanvasElement(),r={};t.style&&(n.width=t.style.width,n.height=t.style.height);var i=n.getContext("2d");if(t.canvas){var s=t.canvas,o=s.getContext("2d");r=o.getImageData(0,0,s.width,s.height)}else t.data&&(r=t.data);var u=function(e,t){var n=t?1:-1,r=NHIE.lib.util.canvasManager.getCanvasModifyData(e);console.log("--- prepare context: ",n),console.log("--- prepare context: ",r.flip),console.log("--- prepare context: ",r.rotate);var i=e.getContext("2d");i.save();var s={x:r.flip.h?-1*n:1*n,y:r.flip.v?-1*n:1*n};return i.scale(s.x,s.y),i.translate(e.width/2*s.x,e.height/2*s.y),i.rotate(r.rotate/180*Math.PI*s.x*s.y*n),i};i.putImageData(r,0,0),this.empty=!1,this.setCanvasStyle(t.style),e(window).resize(),t.skipCache||NHIE.util.canvasCache.set(n)},selected:!1,show:function(){this.$canvasWrapper.show(),NHIE.app.fireEvent("changecontent")},hide:function(){this.$canvasWrapper.hide(),NHIE.app.fireEvent("changecontent")},select:function(){console.log("  -- select layer! ",this.id),NHIE.workspace.unselectLayers(),this.tracker.show(),NHIE.layerPanel.select(this.id),this.selected=!0,this.restore_state=this.getCurrentState(),NHIE.toolbar.resetButtonStatus(),NHIE.app.fireEvent("changeproperty",this.style)},unselect:function(){this.selected&&(console.log("  -- unselect layer! ",this.id),this.modified&&this.rasterize(),this.tracker.hide(),this.selected=!1)},syncTrackerSize:function(){this.tracker.syncSize()},resizeCanvas:function(e,t){this.$canvasWrapper.css({width:e,height:t}),this.$canvas.css({width:e,height:t,marginLeft:-e/2,marginTop:-t/2}),this.style.width=e,this.style.height=t},moveCanvas:function(e,t){this.$canvasWrapper.css({left:e,top:t}),this.style.left=e,this.style.top=t},rotateCanvas:function(e){e=parseInt(e)||0,this.style.rotation=e,this.$canvas.css("transform","rotate("+e+"deg)"),this.$canvasWrapper.attr("data-transform-rotation",e)},modifyCanvas:function(e,t,n){console.log("modifyCanvas - ",e,t);var r=this.getCanvasElement();e==="rotate"?(t=t||"0",t=parseInt(t),this.$canvasWrapper.attr("data-modify-rotate",t)):e==="flip"&&(t=t||{h:!1,v:!1},this.$canvasWrapper.attr("data-modify-flip",JSON.stringify(t))),NHIE.util.canvasManager.resetImageData(r),this.restore_state=this.getCurrentState(),n||NHIE.app.fireEvent("changecontent")},getModifyInformation:function(e){var t="data-modify-"+e;return this.$canvasWrapper.attr(t)},setCanvasStyle:function(e){var n=t.clone(this.style);n=t.extend(n,e),this.moveCanvas(n.left,n.top),this.resizeCanvas(n.width,n.height),this.rotateCanvas(n.rotation),this.style=n,this.syncTrackerSize()},setStyle:function(e){this.setCanvasStyle(e)},getStyle:function(){return t.clone(this.style)},cropCanvasByContent:function(){var e=this.getCanvasElement(),t=e.getContext("2d"),n=e.width,r=e.height,i={x:[],y:[]},s=t.getImageData(0,0,e.width,e.height),o,u,a;for(u=0;u<r;u++)for(o=0;o<n;o++)a=(u*n+o)*4,s.data[a+3]>0&&(i.x.push(o),i.y.push(u));i.x.sort(function(e,t){return e-t}),i.y.sort(function(e,t){return e-t});var f=i.x.length-1;n=i.x[f]-i.x[0],r=i.y[f]-i.y[0];var l=t.getImageData(i.x[0],i.y[0],n,r);e.width=n,e.height=r,t.putImageData(l,0,0)},rasterize:function(t){console.log("RASTERIZE LAYER!!!");var n=this.$canvas,r=this.getCanvasElement(),i=r.getBoundingClientRect(),s=this.getStyle(),o=this;t=t||{},skipHistoryEvent=!!t.skipHistoryEvent;var u=NHIE.lib.util.getImage,a=u(r.toDataURL());return a=a.then(function(e){r.width=s.width,r.height=s.height,r.getContext("2d").drawImage(e,0,0,r.width,r.height)}).then(function(){var t=o.style.rotation||0;if(t){var n=e("<canvas></canvas>"),a=n.get(0);a.width=i.width,a.height=i.height;var f=a.getContext("2d");return f.clearRect(0,0,i.width,i.height),u(r.toDataURL()).then(function(e){var u=i.width,a=i.height,l=s.width,c=s.height;f.translate(u/2,a/2),f.rotate(Math.PI/180*t),f.drawImage(e,-l/2,-c/2,l,c);var h=f.getImageData(0,0,u,a);r.width=i.width,r.height=i.height;var p=r.getContext("2d");p.putImageData(h,0,0),NHIE.lib.util.canvasManager.cropCanvas(o.getCanvasElement()),u=o.getCanvasElement().width,a=o.getCanvasElement().height;var d=(s.width-u)/2,v=(s.height-a)/2;o.moveCanvas(s.left+d,s.top+v),o.resizeCanvas(u,a),n.remove(),o.rotateCanvas(0)})}}).then(function(){o.modified&&(NHIE.util.canvasCache.set(o.getCanvasElement()),e(o.getCanvasElement()).parent().attr("data-modify-rotate","").attr("data-modify-flip",""))}).then(function(){o.syncTrackerSize(),o.modified=!1,skipHistoryEvent||NHIE.app.fireEvent("changecontent")}).catch(function(e){console.error(e)}),a},clearModifyInformation:function(){e(this.getCanvasElement()).parent().attr("data-modify-rotate","").attr("data-modify-flip","")},getCurrentState:function(){return{style:t.clone(this.style)}},syncLayerpanelThumbnail:function(){NHIE.layerPanel.drawThumbnail(this.id)},getCanvasImageData:function(){var e=this.getCanvasElement();return{data:e.getContext("2d").getImageData(0,0,e.width,e.height),style:t.clone(this.style)}}});return i}),define("app/classes/ui/workspace/WorkspaceResizer",["jquery","underscore","app/classes/ui/workspace/LayerTracker","text!resources/tpl/ui/workspace/ui-layer-tracker.tpl.html"],function(e,t,n,r){var i=n.extend({classname:"WorkspaceResizer",events:{render:function(e){e.addClass("workspace-resizer border-animation"),this.syncSize(),this.initTrackerEvents()},onresize:function(t,n){t.preventDefault(),this.target.modified=!0;var r=(NHIE.app.data("navigator-zoom")||100)/100,i={x:(t.clientX-this.info.origin.clientX)/r,y:(t.clientY-this.info.origin.clientY)/r},s={left:this.info.origin.left,top:this.info.origin.top},o=this.info.origin.width,u=this.info.origin.height,a,f,l,c;a=f=l=c=0,/l[t|m|b]/i.test(n)&&(a=i.x,l=-i.x),/r[t|m|b]/i.test(n)&&(l=i.x),/[l|c|r]t/i.test(n)&&(f=i.y,c=-i.y),/[l|c|r]b/i.test(n)&&(c=i.y);var h={width:parseFloat(o+2*l),height:parseFloat(u+2*c)},p=50,d=1600,v=50,m=1600;h.width<p&&(l=(p-o)/2,h.width=p),h.height<v&&(c=(v-u)/2,h.height=v),h.width>d&&(l=(d-o)/2,h.width=d),h.height>m&&(c=(m-o)/2,h.height=m),e(this.dom).css({left:"50%",top:"50%",width:o+2*l,height:u+2*c,marginLeft:-(o+2*l)/2,marginTop:-(u+2*c)/2}),this.syncSize(!0),NHIE.app.fireEvent("changeproperty",this.target.getSize())}},syncSize:function(t){t=!!t;var n=this.target.style,r=(NHIE.app.data("navigator-zoom")||100)/100,i=e(this.dom);if(t){var s=this.target,o={width:parseFloat(i.css("width")),height:parseFloat(i.css("height"))};s.setStyle({width:o.width,height:o.height});var u={width:parseFloat(e(this.dom).attr("data-org-width")),height:parseFloat(e(this.dom).attr("data-org-height"))},a={x:o.width/u.width,y:o.height/u.height};e(".workspace .layer-container.layer-workspace .layer-wrapper").css({transform:"scale("+a.x+","+a.y+")"}).attr({"data-scale-x":a.x,"data-scale-y":a.y})}else i.css({width:r*n.width,height:r*n.height,marginLeft:r*n.width/-2,marginTop:r*n.height/-2,left:"50%",top:"50%"})},resetScale:function(){var t=this.target.getSize();e(this.dom).attr({"data-org-width":t.width,"data-org-height":t.height}),e(".workspace .layer-container.layer-workspace .layer-wrapper").css({transform:"scale(1, 1)"}).attr({"data-scale-x":1,"data-scale-y":1})}});return i}),define("text!resources/tpl/ui/ui-workspace.tpl.html",[],function(){return'<content class="workspace-contents">\r\n\r\n	<div class="workspace-contents-wrapper">\r\n		<div class="layer-background layer-container clipping-area">\r\n			<svg class="viewport viewport-bg"\r\n				xmlns="http://www.w3.org/2000/svg"\r\n				xmlns:xlink="http://www.w3.org/1999/xlink"\r\n				xmlns:xml="http://www.w3.org/XML/1998/namespace"\r\n				version="1.1"\r\n				overflow = "hidden"\r\n				width="100%" height="100%" >\r\n				<defs>\r\n					<pattern id="__NHIE-canvas-bg" x="0" y="0" width="16" height="16" patternUnits="userSpaceOnUse">\r\n						<rect x="0" y="0" width="16" height="16" fill="rgba(255,255,255,1)"></rect>\r\n						<rect x="0" y="0" width="8"  height="8"  fill="rgba(0,0,0,0.1)"></rect>\r\n						<rect x="8" y="8" width="8"  height="8"  fill="rgba(0,0,0,0.1)"></rect>\r\n					</pattern>\r\n				</defs>\r\n				<g class="canvas-bg">\r\n					<rect class="workarea" fill="url(#__NHIE-canvas-bg)" x="0" y="0" width="100%" height="100%" stroke="black"></rect>\r\n				</g>\r\n			</svg>\r\n		</div>\r\n		<div class="layer-container layer-workspace">\r\n			<div class="layer-wrapper"></div>\r\n		</div>\r\n		<div class="layer-container clipping-area layer-foreground">\r\n			<div class="component-container"></div>\r\n		</div>\r\n		<div class="layer-tracker-container"></div>\r\n	</div>\r\n</content>\r\n'}),define("app/classes/ui/Workspace",["jquery","underscore","app/classes/ui/UIElement","app/classes/ui/workspace/LayerCanvas","app/classes/ui/workspace/WorkspaceResizer","text!resources/tpl/ui/ui-workspace.tpl.html"],function(e,t,n,r,i,s){var o=n.extend({defaultConfig:{renderTo:".nhie-body .workspace",template:{tpl:s}},style:{},layers:[],layersHash:{},events:{render:function(t){this.initResizer(),this.$clipping_area=e(".layer-container.layer-foreground.clipping-area")}},initResizer:function(){var e=new i({id:"workspace-resizer",target:this});e.render(),this.workspace_resizer=e},getSize:function(){return{width:NHIE.app.data("canvas-width")||600,height:NHIE.app.data("canvas-height")||400,scale:NHIE.app.data("navigator-zoom")||100}},setSize:function(t,n,r){t=t||640,n=n||480,NHIE.app.data("canvas-width",t),NHIE.app.data("canvas-height",n),this.style={width:t,height:n};var i=(NHIE.app.data("navigator-zoom")||100)/100;e(".workspace .layer-container.layer-workspace").css({width:t,height:n,marginLeft:t/-2,marginTop:n/-2,transform:"scale("+i+")"});var s=e(".workspace .layer-workspace"),o={width:s.width()*i,height:s.height()*i,marginLeft:s.width()*i/-2,marginTop:s.height()*i/-2,left:"50%",top:"50%"};e(".layer-tracker-container").css(o),e(".clipping-area").css(o),this.workspace_resizer.syncSize(),r&&NHIE.toolbar.updateCanvasSize(t,n),e(window).resize()},setStyle:function(e){var t=this.getSize();this.setSize(e.width||t.width,e.height||t.height)},addLayer:function(e){var t={};if(e&&e.id)t.id=e.id,t.dom=e.dom;else{var n=this.layers.length;while(this.layers[n])n++;t.id="nhie-layercanvas-"+n}var i=new r(t);return this.layers.push(i),this.layersHash[i.id]=i,i},clear:function(){this.layers=[],this.layersHash={},e(".workspace-contents .workspace-contents-wrapper .layer-wrapper").html(""),e(".workspace-contents .workspace-contents-wrapper .layer-tracker-container").html(""),NHIE.layerPanel.clear(),NHIE.navigator.clear()},getAllLayers:function(){return this.layers||[]},getLayer:function(e){return this.layers[e]},getLayerById:function(e){return this.layersHash[e]},selectLayer:function(e){this.layers[e]&&this.layers[e].select()},unselectLayers:function(){t.each(this.layers,function(e){e.unselect()})},getSelectedLayer:function(){var e=null;return t.each(this.layers,function(t){if(t.selected)return e=t,!1}),e},$getResizer:function(){var t=e(this.dom).find(".layer-tracker-container .workspace-resizer");return t.length||(this.initResizer(),t=e(this.dom).find(".layer-tracker-container .workspace-resizer")),t},activateResizer:function(e){var n=this.$getResizer();if(e){n.show(),t.each(this.layers,function(e){e.tracker.hide()});var r=this.getSize();n.attr({"data-org-width":r.width,"data-org-height":r.height}),NHIE.workspace.restore_state_resize=r,this.syncResizerSize()}else n.hide(),n.attr({"data-org-width":"","data-org-height":""})},syncResizerSize:function(n){if(!n){var r=this.getSize(),i=(NHIE.app.data("navigator-zoom")||100)/100,s=this.$getResizer(),o={width:r.width*i,height:r.height*i,marginLeft:r.width*i/-2,marginTop:r.height*i/-2};console.log("resizer_style : ",o),s.css(o)}else{var u=e(".workspace .layer-container.layer-workspace .layer-wrapper"),a={x:parseFloat(u.attr("data-scale-x")||1),y:parseFloat(u.attr("data-scale-y")||1)};t.each(this.layers,function(e){var n=t.clone(e.style);n=t.extend(n,{left:n.left*a.x,top:n.top*a.y,width:n.width*a.x,height:n.height*a.y}),e.setCanvasStyle(n)}),NHIE.app.fireEvent("changecontent")}},rotateWorkspace:function(e){var n=90*(e==="left"?-1:1),r=this.getSize();NHIE.workspace.setSize(r.height,r.width),t.each(this.layers,function(t){var i=parseInt(t.getModifyInformation("rotate")||"0");i=(i+n+360)%360;var s=t.style,o=t.getCanvasElement(),u={};e==="left"?(u.left=s.top,u.top=r.width-s.left-s.width):e==="right"&&(u.left=r.height-s.top-s.height,u.top=s.left),t.setCanvasStyle({width:s.height,height:s.width,left:u.left,top:u.top}),o.width=s.height,o.height=s.width,t.modifyCanvas("rotate",i,!0)}),NHIE.app.fireEvent("changecontent")},flipWorkspace:function(e){t.each(this.layers,function(n){var r=JSON.parse(n.getModifyInformation("flip")||'{"h":false,"v":false}');r.h=e==="h"!==r.h,r.v=e==="v"!==r.v;var i=NHIE.workspace.getSize(),s=t.clone(n.style);e==="h"&&(s.left=i.width-s.width-s.left),e==="v"&&(s.top=i.height-s.height-s.top),n.setCanvasStyle(s),n.modifyCanvas("flip",r,!0)}),NHIE.app.fireEvent("changecontent")},reload:function(t){NHIE.app.setMode("empty"),t=t||{};var n=e(".workspace-contents .workspace-contents-wrapper .layer-wrapper"),r=t.content||"",i=t.size||NHIE.workspace.getSize();if(t.id_arr&&t.id_arr.length){r="";for(var s=0;s<t.id_arr.length;s++){var o=NHIE.workspace.getLayerById(t.id_arr[s]);o&&(r+=o.$canvasWrapper.get(0).outerHTML)}}NHIE.workspace.clear(),NHIE.workspace.setSize(i.width,i.height),n.html(r),n.find("canvas").each(function(e,t){var n=NHIE.workspace.addLayer({id:t.id,dom:t});NHIE.lib.util.canvasManager.resetImageData(t)});var u=NHIE.workspace.getAllLayers();if(u&&u.length){var a=u[u.length-1];a&&a.select()}var f=t.skipEvent!==!1;NHIE.app.fireEvent("changecontent",f)},mergeLayers:function(){var n=e("<canvas></canvas>"),r=n.get(0),i=r.getContext("2d"),s=NHIE.workspace.getSize();r.width=s.width,r.height=s.height;var o=this.getAllLayers(),u=[];return t.each(o,function(e){u.push(e.rasterize())}),NHIE.lib.Promise.all(u).then(function(){return t.each(o,function(e){var t=e.getStyle(),n=e.getCanvasElement();i.drawImage(n,t.left,t.top)}),r})}});return o}),define("text!resources/tpl/ui/ui-panel.tpl.html",[],function(){return'<div class="<%=cls%>_panel ui-panel">\r\n	<div class="<%=cls%>_panel-header ui-panel-header"></div>\r\n	<div class="<%=cls%>_panel-body ui-panel-body"></div>\r\n	<div class="<%=cls%>_panel-footer ui-panel-footer"></div>\r\n</div>\r\n'}),define("app/classes/ui/Panel",["jquery","underscore","app/classes/ui/UIElement","text!resources/tpl/ui/ui-panel.tpl.html"],function(e,t,n,r){var i=n.extend({classname:"Panel",defaultConfig:{template:{tpl:r}},setBodyContent:function(t){var n=this.getTemplateConfig(),r=e(this.dom).find(".ui-panel-body");r.append(e(t))},setContent:function(e){var t=this.getTemplateConfig();e=NHIE.tmpl(e,t),this._super(e);var n=this.initConfig.title||"PanelTitle";this.setHeaderContent("<h3>"+n+"</h3>"),this.setBodyContent(t.bodyTpl),t.footerTpl&&this.setFooterContent(t.footerTpl)},setHeaderContent:function(t){e(this.dom).find(".ui-panel-header").html("").append(t)},setFooterContent:function(t){e(this.dom).find(".ui-panel-footer").html("").append(t)},setBodyContent:function(t){e(this.dom).find(".ui-panel-body").html("").append(t)},render:function(e){var t=this;this._super(e).then(function(e){return e.draggable({handle:"h3"}),e})},loading:function(t){var n=this,r=e(this.dom);NHIE.util.spinner(r,isLoading)}});return i}),define("text!resources/tpl/ui/layerpanel/ui-layerpanel.body.tpl.html",[],function(){return'<div class="layer-panel-body-content">\r\n	<ul class="layer-items"></ul>\r\n</div>\r\n'}),define("text!resources/tpl/ui/layerpanel/ui-layerpanel.item.tpl.html",[],function(){return'<li class="layer-item" data-layer-id="<%=layer_id%>">\r\n	<div class="layer-visibility">\r\n		<button class="btn-visibility layer-visible fa fa-eye"></button>\r\n	</div>\r\n	<div class="layer-thumbnail">\r\n		<div class="layer-thumbnail-container"></div>\r\n	</div>\r\n	<div class="layer-tools">\r\n		<button class="btn-remove fa fa-trash"></button>\r\n	</div>\r\n</li>\r\n'}),define("app/classes/ui/LayerPanel",["jquery","underscore","app/classes/ui/Panel","text!resources/tpl/ui/layerpanel/ui-layerpanel.body.tpl.html","text!resources/tpl/ui/layerpanel/ui-layerpanel.item.tpl.html","app/plugins/jquery-ui"],function(t,n,r,i,s){var o=r.extend({classname:"LayerPanel",renderTo:".panels",defaultConfig:{template:{cls:"ui-layerpanel",bodyTpl:i}},events:{render:function(){var n=this;t(this.dom).find("ul").off("click").on("mouseenter","li[data-layer-id]",function(){t(this).parent().find("li").removeClass("hover"),t(this).addClass("hover")}).on("mouseleave","li[data-layer-id]",function(){t(this).removeClass("hover")}).on("click","li",function(e){var n=t(this).attr("data-layer-id"),r=NHIE.workspace.getLayerById(n);r&&r.select()}).on("click","button.btn-visibility",function(e){e.preventDefault(),e.stopPropagation();var r=t(this).closest("li[data-layer-id]"),i=r.attr("data-layer-id"),s=NHIE.workspace.getLayerById(i);t(this).hasClass("layer-visible")?(n.setItemVisibility(i,!1),s.hide()):(n.setItemVisibility(i,!0),s.show())}).on("click","button.btn-remove",function(e){e.preventDefault(),e.stopPropagation();var n=t(this).closest("li[data-layer-id]"),r=n.attr("data-layer-id"),i=NHIE.workspace.getLayerById(r),s=[];n.parent().find("li[data-layer-id]").each(function(e,n){var i=t(n).attr("data-layer-id");i!==r&&s.push(i)}),s=s.reverse(),s.length?NHIE.workspace.reload({id_arr:s,skipEvent:!1}):n.parent().find("button.btn-remove").hide(),NHIE.app.setMode("empty"),NHIE.toolbar.resetButtonStatus()});var r=t(this.dom).find(".layer-panel-body-content"),i=0,s=t(this.dom).find("ul");s.sortable({axis:"y",start:function(t,n){var o=n.item.parent();s.addClass("sorting"),s.find("li").removeClass("hover"),o.find("li[data-layer-id]").length<=1&&e.preventDefault(),i=-1*parseInt(r.find(".mCSB_container").css("top"))},update:function(e,n){console.log(e,n);var o=n.item.attr("data-layer-id"),u=n.item.parent().find("li[data-layer-id]"),a=[];u.each(function(e,n){a.push(t(this).attr("data-layer-id"))}),a=a.reverse(),NHIE.workspace.reload({id_arr:a,skipEvent:!1});var f=NHIE.workspace.getLayerById(o);f.select(),i&&(r.mCustomScrollbar("scrollTo",i,{scrollInertia:0}),i=0),setTimeout(function(){s.removeClass("sorting"),s.find("li[data-layer-id="+o+"]").trigger("mouseenter")},50)}}),r.mCustomScrollbar()}},items:[],setItemVisibility:function(e,n,r){var i=t(this.dom).find(".layer-item[data-layer-id="+e+"]"),s=i.find("button"),o=NHIE.workspace.getLayerById(e);if(o){var u="layer-visible fa-eye",a="layer-hidden fa-eye-slash";n?s.removeClass(a).addClass(u):s.removeClass(u).addClass(a)}},add:function(e){var n=NHIE.tmpl(s,{layer_id:e.id}),r=t(n);t(this.dom).find("ul.layer-items").prepend(r),t(this.dom).find("ul.layer-items button.btn-remove").length>1?t(this.dom).find("ul.layer-items button.btn-remove").show():t(this.dom).find("ul.layer-items button.btn-remove").hide(),t(this.dom).find(".layer-panel-body-content").mCustomScrollbar("update")},clear:function(){t(this.dom).find("ul.layer-items").html("")},select:function(e){var n=NHIE.workspace.getLayerById(e);n&&(t(this.dom).find("li.layer-item").removeClass("selected"),t(this.dom).find("li.layer-item[data-layer-id="+e+"]").addClass("selected"))},resetThumbnails:function(){var e=this;n.each(NHIE.workspace.getAllLayers(),function(t){e.drawThumbnail(t.id);var n=t.$canvasWrapper.is(":hidden");e.setItemVisibility(t.id,!n)})},drawThumbnail:function(e){var n=NHIE.workspace.getLayerById(e);if(n){var r=t("li.layer-item[data-layer-id="+e+"] div.layer-thumbnail .layer-thumbnail-container"),i=t('<div class="layer-container"></div>'),s=n.$canvasWrapper.clone();s.show(),i.append(s),r.html("").append(i);var o=r.find("canvas").get(0);NHIE.util.canvasManager.resetImageData(o);var u=NHIE.workspace.getSize();i.css({width:u.width,height:u.height});var a=40,f=40,l={width:a,height:f},c=1;if(u.width>u.height){l.height=f/u.width*u.height,c=a/u.width;if(l.height>f){var h=l.height/f;l.height=f,l.width/=h,c/=h}}else{l.width=a/u.height*u.width,c=f/u.height;if(l.width>a){var h=l.width/a;l.width=a,l.height/=h,c/=h}}l.marginLeft=l.width/-2,l.marginTop=l.height/-2,console.log("drawThumbnail - ",c),r.css(l),i.css({transform:"scale("+c+")",transformOrigin:"0px 0px",position:"absolute"})}}});return o}),define("text!resources/tpl/ui/property/ui-property-body.tpl.html",[],function(){return"<div>\r\n	\r\n</div>\r\n"}),define("text!resources/tpl/ui/property/ui-property-footer.tpl.html",[],function(){return'<div class="property-footer">\r\n	<div class="button-group">\r\n		<button class="button" data-action="restore"><%=NHIE_Lang[\'PluginImageEditor_button_restore\']%></button>\r\n		<button class="button" data-action="apply"><%=NHIE_Lang[\'PluginImageEditor_button_apply\']%></button>\r\n	</div>\r\n</div>\r\n'}),define("app/classes/ui/PropertyPanel",["jquery","underscore","app/classes/ui/Panel","text!resources/tpl/ui/property/ui-property-body.tpl.html","text!resources/tpl/ui/property/ui-property-footer.tpl.html"],function(e,t,n,r,i){var s=n.extend({classname:"PropertyPanel",renderTo:".panels",defaultConfig:{template:{cls:"ui-propertypanel",bodyTpl:r,footerTpl:i}},events:{render:function(){var t=this;e(this.dom).find("button[data-action=apply]").off("click").on("click",function(){var e=t.currentPropertyType,n=t.applyHandler[e]||function(){};n.bind(t)()}),e(this.dom).find("button[data-action=restore]").off("click").on("click",function(){var e=t.currentPropertyType,n=t.restoreHandler[e]||function(){};n.bind(t)()})}},registerHandler:function(e,t){NHIE.app._modenames.push(e);var n=t.tpl||" not implemented..",r=t.show||function(e){return function(t){this.setPropertyContent(e,t)}}.bind(this)(e),i=t.apply||function(){},s=t.restore||function(){},o=t.render||function(){};this.propertyItemTpl[e]=n,this.showHandler[e]=r,this.applyHandler[e]=i,this.restoreHandler[e]=s,this.renderHandler[e]=o},construct:function(n){this._super(n);var r=this;this.propertyItemTpl={},this.registerHandler("empty",{tpl:" ",show:function(t){e(this.dom).find(".ui-panel-footer").hide(),this.setBodyContent("")}}),t.each(NHIE.toolbar.tools,function(e,t){r.registerHandler(t,{tpl:e.propertyTpl,render:e.onRenderPropertyBase.bind(e),show:e.onShowProperty.bind(e),apply:e.onApplyProperty.bind(e),restore:e.onRestoreProperty.bind(e)})})},showProperty:function(e,t){t=t||{},this.currentPropertyType=e;var n=this.showHandler[e];n?n.bind(this)(t):this.setPropertyContent(e,t)},setPropertyData:function(e){var t=NHIE.app.mode||"empty";this.showProperty(t,e)},setPropertyContent:function(t,n){var r=this.propertyItemTpl[t]||"not implemented yet";if(r){e(this.dom).find(".ui-panel-footer").show(),this.setBodyContent(NHIE.tmpl(r,{data:n}));if(this.renderHandler[t]){var i=this.renderHandler[t];i(e(this.dom).find(".ui-panel-body"))}}else console.log("no tpl defined for",t)},renderHandler:{},showHandler:{},applyHandler:{},restoreHandler:{}});return s}),define("text!resources/tpl/nhie-editor.tpl.html",[],function(){return'<div class="nhie-body mode-empty">\r\n	<div class="toolbar-top"></div>\r\n	<div class="workspace"></div>\r\n	<div class="panels"></div>\r\n	<div class="footer">\r\n		<div class="button-group">\r\n			<button class="button" data-action="NHIE-apply" data-btn-type="normal">\r\n				<span>확인</span>\r\n			</button>\r\n			<button class="button" data-action="NHIE-cancel" data-btn-type="normal">\r\n				<span>취소</span>\r\n			</button>\r\n		</div>\r\n	</div>\r\n</div>\r\n'}),define("app/plugins/font-awesome",["css!css/font-awesome/css/font-awesome.css"],function(){}),define("app/nhie",["jquery","underscore","app/lib","app/classes/Base","app/classes/Application","app/classes/History","app/classes/ui/Toolbar","app/classes/ui/Navigator","app/classes/ui/Workspace","app/classes/ui/LayerPanel","app/classes/ui/PropertyPanel","app/classes/ui/Dialog","text!resources/tpl/nhie-editor.tpl.html","app/plugins/font-awesome","app/plugins/jquery-ui","app/plugins/scrollbar"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){var p=window.NHIE||{};return t.extend(p,{config:{},lib:n,history:new s({}),cls:r,init:function(e){t.extend_deeper(p.config,e)},launch:function(){console.log("LAUNCH NHIE!!!",p.lib.useragent.info,p.lib.useragent.version),console.log("LAUNCH NHIE!!!",p.lib.useragent.info.IsIE);var t=!0;p.lib.useragent.info.IsIE&&parseInt(p.lib.useragent.version)<10&&(t=!1),console.log("LAUNCH NHIE!!!",t);if(!t){e(".NHIE-loading-prepare-mask").hide();var n=new c({title:"Image Editor",renderTo:"body",type:"alert",content:"<p>"+p.Lang.PluginImageEditor_not_supported_browser+"</p>",width:400,modal:!0,onClose:function(){window.close()}});n.show()}else p.app.launch()}}),p.app=new i({id:"nhie-app",ui:{id:"nhie-app-body",renderTo:".nhie-application",template:{tpl:h}},status:{},events:{render:function(e){var t=this;this.data("canvas-width",800),this.data("canvas-height",600),this.initUI().then(function(){p.navigator.update(),p.navigator.resetScroller()}).then(function(){p.app.fireEvent("focuswindow"),t.fireEvent("initcomplete")}).catch(function(e){console.error(e)})},initcomplete:function(){var t=p.adapter.getInitialData();console.log(t),e(".NHIE-loading-prepare-mask").hide(),p.app.loading(!0);if(t.src){var n=p.workspace.addLayer("image");n.setImage({src:t.src,style:{width:t.width,height:t.height}}).then(function(e){n.select(),p.workspace.setSize(e.width,e.height,!0)}).then(function(){p.app.loading(!1)}).catch(function(e){console.error(e)})}else p.workspace.setSize(800,600,!0),p.toolbar.resetButtonStatus(),p.app.loading(!1)},changenavigatorzoom:function(n){console.log("navigator zoom change!! ",n),this.data("navigator-zoom",n),this.fireEvent("resizewindow");var r=p.app.data("canvas-width")||600,i=p.app.data("canvas-height")||400;p.workspace.setSize(r,i),p.workspace.syncResizerSize(),t.each(p.workspace.getAllLayers(),function(e){e.syncTrackerSize()});var s=n/100;e(".layer-container .component-container").css({transform:"scale("+s+", "+s+")",width:r,height:i});var o=["left","top","width","height"],u=p.toolbar.tools[this.mode];if(u){if(u.component){var a=u.component,f=a.getStyle();e(a.tracker.dom).each(function(n,r){var i=e(r);t.each(o,function(e){i.css(e,f[e]*s)}),i.find(".text-editing-area").css("zoom",s)})}u.onResizeWindow.apply(u)}},resizewindow:function(){console.log("window size change!! ");var t=e(".nhie-body .workspace"),n=e(".nhie-body .toolbar-top"),r=e(".nhie-body .footer");t.css({top:n.height(),height:e(window).height()-n.height()-r.height()}),p.navigator.resetScroller()},moveworkspace:function(){var n=(p.app.data("navigator-zoom")||100)/100,r=["left","top","width","height"],i=p.toolbar.tools[this.mode];if(i){if(i.component){var s=i.component,o=s.getStyle();e(s.tracker.dom).each(function(i,s){var u=e(s);t.each(r,function(e){u.css(e,o[e]*n)}),u.find(".text-editing-area").css("zoom",n)})}typeof i.onResizeWindow=="function"&&i.onResizeWindow.apply(i)}},focuswindow:function(){e(this.panel.dom).removeClass("window-focus window-blur").addClass("window-focus")},blurwindow:function(){e(this.panel.dom).removeClass("window-focus window-blur").addClass("window-blur")},changemode:function(){var e=p.app.mode;console.log("[NHIE.app] change mode : ",e),p.propertyPanel.showProperty(e)},changeproperty:function(e){p.propertyPanel.setPropertyData(e)},changecontent:function(e){p.layerPanel.resetThumbnails(),p.navigator.update();var t=p.workspace.getSize();p.toolbar.updateCanvasSize(t.width,t.height),e||p.history.saveHistory(),p.toolbar.resetButtonStatus(),p.navigator.resetScroller()},changecanvassize:function(){},selectlayer:function(e){},mousedown_workspace:function(t){var n=p.app.mode,r=e(t.target);p.app.status.mode=n;switch(n){case"insert-sticker":case"insert-textbox":if(r.hasClass("tracker-handle")||r.hasClass("layer-tracker")){var i=p.toolbar.tools[n].component;i&&i.tracker&&(p.app.status.tracker=i.tracker,p.app.status.tracker.fireEvent("mousedown_tracker",t))}break;case"insert-textballoon":console.log(r[0].outerHTML);if(r.hasClass("tracker-handle")||r.hasClass("layer-tracker")){var i=p.toolbar.tools[n].component;i&&i.tracker&&(p.app.status.tracker=i.tracker,p.app.status.tracker.fireEvent("mousedown_tracker",t))}else if(r.closest(".component").length&&!(r.hasClass("text-editing-area")||r.closest(".text-editing-area")>0)){var i=p.toolbar.tools[n].component;i&&i.tracker&&(p.app.status.tracker=i.tracker,p.app.status.tracker.fireEvent("mousedown_tracker",t,{forceDragMove:!0})),t.preventDefault()}break;case"resize-layer":if(r.hasClass("tracker-handle")||r.hasClass("layer-tracker")){var s=p.lib.util.getEventTargetLayer(t);s&&s.tracker&&(p.app.status.tracker=s.tracker,p.app.status.tracker.fireEvent("mousedown_tracker",t))}break;case"resize-workspace":if(r.hasClass("tracker-handle")||r.hasClass("layer-tracker"))p.app.status.tracker=p.workspace.workspace_resizer,p.app.status.tracker.fireEvent("mousedown_tracker",t);break;case"move-layer":console.log(r);var o=p.workspace.getSelectedLayer();o&&(p.app.status.layer=o,o.fireEvent("mousedown_layer",t));break;case"crop-layer":if(r.closest("#nhie-app-menu-crop").length){p.app.status.mode=null;return}var o=p.workspace.getSelectedLayer();if(o){p.app.status.layer=o;var u=p.toolbar.tools["crop-layer"];u.onMouseDownWorkspace.apply(u,[t])}}},mousemove_workspace:function(e){var t=p.app.status.tracker;switch(p.app.status.mode){case"insert-sticker":case"insert-textbox":case"insert-textballoon":case"resize-workspace":case"resize-layer":if(t){var n=p.app.status.action;n==="rotate"?t.fireEvent("onrotate",e):n==="resize"?t.fireEvent("onresize",e,p.app.status.trackerType):n==="move"&&t.fireEvent("onmove",e)}break;case"move-layer":var r=p.app.status.layer;r&&r.fireEvent("onmove",e);break;case"crop-layer":}if(p.app.mode==="crop-layer"){var i=p.workspace.getSelectedLayer();if(i){var s=p.toolbar.tools["crop-layer"];s.onMouseMoveWorkspace.apply(s,[e])}}},mouseup_workspace:function(e){switch(p.app.status.mode){case"insert-sticker":case"insert-textbox":case"insert-textballoon":case"resize-workspace":case"resize-layer":if(t){var t=p.app.status.tracker,n=p.app.status.action;n==="rotate"?t.fireEvent("endrotate",e):n==="resize"&&t.fireEvent("endresize",e)}break;case"move-layer":var r=p.app.status.layer;r&&r.fireEvent("endmove",e);break;case"crop-layer":var r=p.workspace.getSelectedLayer();if(r){var i=p.toolbar.tools["crop-layer"];i.onMouseUpWorkspace.apply(i,[e])}}p.app.mode==="crop-layer",p.app.status.mode="",p.app.status={}}},_modenames:[],setMode:function(n){p.app.mode=n||"empty";var r=e(this.panel.dom),i="";t.each(this._modenames,function(e){i+=" mode-"+e}),r.removeClass(i),r.addClass("mode-"+n)},getCurrentTool:function(){var e=p.app.mode||"empty";return p.toolbar.tools[e]},initUI:function(){var t=this,r=e(this.panel.dom),i=[],s=new o({id:"nhie-toolbar"});i.push(s.render()),p.toolbar=s;var h=new u({id:"nhie-navigator"});i.push(h.render()),p.navigator=h;var d=new l({id:"nhie-propertypanel",title:"<span>"+p.Lang.PluginImageEditor_panel_property_title+"</span>"});i.push(d.render()),p.propertyPanel=d;var v=new f({id:"nhie-layerpanel",title:"<span>"+p.Lang.PluginImageEditor_panel_layer_title+"</span>"});i.push(v.render()),p.layerPanel=v;var m=new a({id:"nhie-workspace"});return p.workspace=m,i.push(m.render()),e("button[data-action=NHIE-apply]>span").text(p.Lang.PluginImageEditor_button_confirm),e("button[data-action=NHIE-cancel]>span").text(p.Lang.PluginImageEditor_button_cancel),e("button[data-action=NHIE-apply]").click(function(){p.app.loading(!0);var t=p.workspace.getAllLayers();if(!t||t.length===0){console.log("no image set.. just close"),e("button[data-action=NHIE-cancel]").click();return}p.adapter.onApply()}),e("button[data-action=NHIE-cancel]").click(function(){p.adapter.onCancel(),window.close()}),p.dialog={alert_dialog_wrongimage:new c({title:"Image Editor",type:"alert",content:"<p><%=NHIE_Lang['PluginImageEditor_msg_wrong_image']%></p>",width:400,modal:!0}),alert_dialog_bigimage:new c({title:"Image Editor",type:"alert",content:"<p>"+p.Lang.PluginImageEditor_msg_big_image+"</p>",contentData:{width:n.util.getConfig("maxImageWidth"),height:n.util.getConfig("maxImageHeight")},width:400,modal:!0})},p.lib.Promise.all(i)},loading:function(t){p.lib.util.spinner(e(".nhie-body"),t,{color:"white"})}}),t.extend(p,n),e(function(){e(window).on("resize",function(){p.app.fireEvent("resizewindow")}).on("focus",function(){p.app.fireEvent("focuswindow")}).on("blur",function(){p.app.fireEvent("blurwindow")}).on("unload",function(){p.adapter.onUnload()}),e(document.body).on("mousedown",function(t){var n=e(t.target);n.closest(".workspace").length>0&&(p.app.status=p.app.status||{},p.app.status.mousedown=!0,p.app.fireEvent("mousedown_workspace",t))}).on("mousemove",function(e){p.app.fireEvent("mousemove_workspace",e)}).on("mouseup",function(e){p.app.fireEvent("mouseup_workspace",e)})}),window.NHIE=p,p});