meme_captain 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/ChangeLog +4 -0
  2. data/README.md +0 -45
  3. data/lib/meme_captain.rb +0 -6
  4. data/lib/meme_captain/caption.rb +6 -4
  5. data/lib/meme_captain/caption_choice.rb +3 -1
  6. data/lib/meme_captain/image_list.rb +0 -5
  7. data/lib/meme_captain/text_pos.rb +8 -6
  8. data/lib/meme_captain/version.rb +1 -1
  9. data/meme_captain.gemspec +5 -18
  10. metadata +2 -181
  11. data/config.ru +0 -50
  12. data/doc/lightweight_front_end.md +0 -64
  13. data/doc/setup.md +0 -13
  14. data/lib/meme_captain/image_list/cache.rb +0 -49
  15. data/lib/meme_captain/image_list/fetch.rb +0 -28
  16. data/lib/meme_captain/image_list/fetch_error.rb +0 -17
  17. data/lib/meme_captain/image_list/source_image.rb +0 -30
  18. data/lib/meme_captain/meme_data.rb +0 -33
  19. data/lib/meme_captain/norm_params.rb +0 -92
  20. data/lib/meme_captain/pretty_format.rb +0 -12
  21. data/lib/meme_captain/server.rb +0 -303
  22. data/lib/meme_captain/source_fetch_fail.rb +0 -28
  23. data/lib/meme_captain/upload.rb +0 -30
  24. data/public/css/screen.css +0 -80
  25. data/public/favicon.ico +0 -0
  26. data/public/js/fabric.min.js +0 -4
  27. data/public/js/jquery-1.7.2.min.js +0 -4
  28. data/public/js/meme_captain.js +0 -391
  29. data/public/source_images.json +0 -234
  30. data/public/thumbs.jpg +0 -0
  31. data/public/thumbs_1330486916.jpg +0 -0
  32. data/public/thumbs_1333591668.jpg +0 -0
  33. data/public/thumbs_1334189407.jpg +0 -0
  34. data/public/thumbs_1334973608.jpg +0 -0
  35. data/public/thumbs_1336623277.jpg +0 -0
  36. data/public/thumbs_1336624196.jpg +0 -0
  37. data/public/thumbs_1339811279.jpg +0 -0
  38. data/public/tmp/.gitignore +0 -0
  39. data/script/thumb_sprites.rb +0 -76
  40. data/spec/image_list/fetch_spec.rb +0 -33
  41. data/spec/norm_params_spec.rb +0 -223
  42. data/spec/pretty_format_spec.rb +0 -9
  43. data/views/404.erb +0 -17
  44. data/views/index.erb +0 -130
  45. data/watermark.png +0 -0
@@ -1,28 +0,0 @@
1
- require 'mongo_mapper'
2
-
3
- module MemeCaptain
4
-
5
- # For tracking source image fetch failures so they won't be retried.
6
- class SourceFetchFail
7
- include MongoMapper::Document
8
-
9
- set_collection_name 'source_fetch_fail'
10
-
11
- key :url, String
12
-
13
- key :orig_ip, String
14
- key :response_code, Integer
15
-
16
- key :attempt_count, Integer
17
- key :last_request, Time
18
-
19
- timestamps!
20
-
21
- def requested!
22
- increment :attempt_count => 1
23
- set :last_request => Time.now
24
- end
25
-
26
- end
27
-
28
- end
@@ -1,30 +0,0 @@
1
- require 'mongo_mapper'
2
-
3
- module MemeCaptain
4
-
5
- # Data about uploaded files.
6
- class Upload
7
- include MongoMapper::Document
8
-
9
- set_collection_name 'upload'
10
-
11
- key :upload_id, String
12
- key :fs_path, String
13
- key :mime_type, String
14
- key :size, Integer
15
-
16
- key :request_count, Integer
17
- key :last_request, Time
18
-
19
- key :creator_ip, String
20
-
21
- timestamps!
22
-
23
- def requested!
24
- increment :request_count => 1
25
- set :last_request => Time.now
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,80 +0,0 @@
1
- body {
2
- background-color : #0772a1;
3
- color : #dffa00;
4
- font-family : verdana, helvetica, arial, sans-serif;
5
- }
6
-
7
- a img {
8
- border : 0;
9
- }
10
-
11
- a:link {
12
- color : #edfc72;
13
- }
14
-
15
- a:visited {
16
- color : #63afd0;
17
- }
18
-
19
- img.thumb {
20
- margin : 2px;
21
- }
22
-
23
- #logo {
24
- margin-top : 0.5em;
25
- margin-bottom : 0.5em;
26
- }
27
-
28
- #chooseSourceImage {
29
- background-color : #ececec;
30
- border-bottom : 2px solid #e4e4e4;
31
- color : #000;
32
- padding : 0.25em 1em 0.25em 1em;
33
- }
34
-
35
- #chooseText {
36
- background-color : #dcdcdc;
37
- border-bottom : 2px solid #d4d4d4;
38
- color : #000;
39
- padding : 0.25em 1em 0.25em 1em;
40
- }
41
-
42
- #positionText {
43
- background-color : #ccc;
44
- border-bottom : 2px solid #c4c4c4;
45
- color : #000;
46
- padding : 0.25em 1em 0.25em 1em;
47
- }
48
-
49
- #positionTable {
50
- display : none;
51
- }
52
-
53
- #createdImageContainer {
54
- background-color : #bcbcbc;
55
- border-bottom : 2px solid #b4b4b4;
56
- color : #000;
57
- padding : 0.25em 1em 0.25em 1em;
58
- }
59
-
60
- input[type=text] {
61
- border-top : 2px solid #6e227e;
62
- border-right : 2px solid #5a016d;
63
- border-bottom : 2px solid #5a016d;
64
- border-left : 2px solid #6e227e;
65
- padding : 4px 8px 4px 8px;
66
- }
67
-
68
- input[type=button] {
69
- padding : 4px 8px 4px 8px;
70
- }
71
-
72
- input[type=text].attn {
73
- background-color : #a7e464;
74
- }
75
-
76
- div.share {
77
- display : inline-block;
78
- margin-right : 1em;
79
- vertical-align : middle;
80
- }
Binary file
@@ -1,4 +0,0 @@
1
- /*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */var fabric=fabric||{version:"0.8.13"};typeof exports!="undefined"&&(exports.fabric=fabric),typeof document!="undefined"&&typeof window!="undefined"?(fabric.document=document,fabric.window=window):(fabric.document=require("jsdom").jsdom("<!DOCTYPE html><html><head></head><body></body></html>"),fabric.window=fabric.document.createWindow()),fabric.isTouchSupported="ontouchstart"in fabric.document.documentElement,this.JSON||(this.JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)r=rep[n],typeof r=="string"&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();var Cufon=function(){function r(e){var t=this.face=e.face;this.glyphs=e.glyphs,this.w=e.w,this.baseSize=parseInt(t["units-per-em"],10),this.family=t["font-family"].toLowerCase(),this.weight=t["font-weight"],this.style=t["font-style"]||"normal",this.viewBox=function(){var e=t.bbox.split(/\s+/),n={minX:parseInt(e[0],10),minY:parseInt(e[1],10),maxX:parseInt(e[2],10),maxY:parseInt(e[3],10)};return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")},n}(),this.ascent=-parseInt(t.ascent,10),this.descent=-parseInt(t.descent,10),this.height=-this.ascent+this.descent}function i(){var e={},t={oblique:"italic",italic:"oblique"};this.add=function(t){(e[t.style]||(e[t.style]={}))[t.weight]=t},this.get=function(n,r){var i=e[n]||e[t[n]]||e.normal||e.italic||e.oblique;if(!i)return null;r={normal:400,bold:700}[r]||parseInt(r,10);if(i[r])return i[r];var s={1:1,99:0}[r%100],o=[],u,a;s===undefined&&(s=r>400),r==500&&(r=400);for(var f in i){f=parseInt(f,10);if(!u||f<u)u=f;if(!a||f>a)a=f;o.push(f)}return r<u&&(r=u),r>a&&(r=a),o.sort(function(e,t){return(s?e>r&&t>r?e<t:e>t:e<r&&t<r?e>t:e<t)?-1:1}),i[o[0]]}}function s(){function t(e,t){return e.contains?e.contains(t):e.compareDocumentPosition(t)&16}function n(e){var n=e.relatedTarget;if(!n||t(this,n))return;i(this)}function r(e){i(this)}function i(t){setTimeout(function(){e.replace(t,g.get(t).options,!0)},10)}this.attach=function(e){e.onmouseenter===undefined?(a(e,"mouseover",n),a(e,"mouseout",n)):(a(e,"mouseenter",r),a(e,"mouseleave",r))}}function o(){function n(e){return e.cufid||(e.cufid=++t)}var e={},t=0;this.get=function(t){var r=n(t);return e[r]||(e[r]={})}}function u(e){var t={},r={};this.get=function(n){return t[n]!=undefined?t[n]:e[n]},this.getSize=function(e,t){return r[e]||(r[e]=new n.Size(this.get(e),t))},this.extend=function(e){for(var n in e)t[n]=e[n];return this}}function a(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){return n.call(e,fabric.window.event)})}function f(e,t){var n=g.get(e);return n.options?e:(t.hover&&t.hoverables[e.nodeName.toLowerCase()]&&y.attach(e),n.options=t,e)}function l(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.apply(null,arguments)),t[n]}}function c(e,t){t||(t=n.getStyle(e));var r=n.quotedList(t.get("fontFamily").toLowerCase()),i;for(var s=0,o=r.length;s<o;++s){i=r[s];if(E[i])return E[i].get(t.get("fontStyle"),t.get("fontWeight"))}return null}function h(e){return fabric.document.getElementsByTagName(e)}function p(){var e={},t;for(var n=0,r=arguments.length;n<r;++n)for(t in arguments[n])e[t]=arguments[n][t];return e}function d(e,t,r,i,s,o){var u=i.separate;if(u=="none")return w[i.engine].apply(null,arguments);var a=fabric.document.createDocumentFragment(),f,l=t.split(x[u]),c=u=="words";c&&m&&(/^\s/.test(t)&&l.unshift(""),/\s$/.test(t)&&l.push(""));for(var h=0,p=l.length;h<p;++h)f=w[i.engine](e,c?n.textAlign(l[h],r,h,p):l[h],r,i,s,o,h<p-1),f&&a.appendChild(f);return a}function v(e,t){var r,i,s,o;for(var u=f(e,t).firstChild;u;u=s){s=u.nextSibling,o=!1;if(u.nodeType==1){if(!u.firstChild)continue;if(!/cufon/.test(u.className)){arguments.callee(u,t);continue}o=!0}i||(i=n.getStyle(e).extend(t)),r||(r=c(e,i));if(!r)continue;if(o){w[t.engine](r,null,i,t,u,e);continue}var a=u.data;typeof G_vmlCanvasManager!="undefined"&&(a=a.replace(/\r/g,"\n"));if(a==="")continue;var l=d(r,a,i,t,u,e);l?u.parentNode.replaceChild(l,u):u.parentNode.removeChild(u)}}var e=function(){return e.replace.apply(null,arguments)},t=e.DOM={ready:function(){var e=!1,t={loaded:1,complete:1},n=[],r=function(){if(e)return;e=!0;for(var t;t=n.shift();t());};return fabric.document.addEventListener&&(fabric.document.addEventListener("DOMContentLoaded",r,!1),fabric.window.addEventListener("pageshow",r,!1)),!fabric.window.opera&&fabric.document.readyState&&function(){t[fabric.document.readyState]?r():setTimeout(arguments.callee,10)}(),fabric.document.readyState&&fabric.document.createStyleSheet&&function(){try{fabric.document.body.doScroll("left"),r()}catch(e){setTimeout(arguments.callee,1)}}(),a(fabric.window,"load",r),function(t){arguments.length?e?t():n.push(t):r()}}()},n=e.CSS={Size:function(e,t){this.value=parseFloat(e),this.unit=String(e).match(/[a-z%]*$/)[0]||"px",this.convert=function(e){return e/t*this.value},this.convertFrom=function(e){return e/this.value*t},this.toString=function(){return this.value+this.unit}},getStyle:function(e){return new u(e.style)},quotedList:l(function(e){var t=[],n=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,r;while(r=n.exec(e))t.push(r[3]||r[1]);return t}),ready:function(){var e=!1,n=[],r=function(){e=!0;for(var t;t=n.shift();t());},i=Object.prototype.propertyIsEnumerable?h("style"):{length:0},s=h("link");return t.ready(function(){var e=0,t;for(var n=0,o=s.length;t=s[n],n<o;++n)!t.disabled&&t.rel.toLowerCase()=="stylesheet"&&++e;fabric.document.styleSheets.length>=i.length+e?r():setTimeout(arguments.callee,10)}),function(t){e?t():n.push(t)}}(),supports:function(e,t){var n=fabric.document.createElement("span").style;return n[e]===undefined?!1:(n[e]=t,n[e]===t)},textAlign:function(e,t,n,r){return t.get("textAlign")=="right"?n>0&&(e=" "+e):n<r-1&&(e+=" "),e},textDecoration:function(e,t){t||(t=this.getStyle(e));var n={underline:null,overline:null,"line-through":null};for(var r=e;r.parentNode&&r.parentNode.nodeType==1;){var i=!0;for(var s in n){if(n[s])continue;t.get("textDecoration").indexOf(s)!=-1&&(n[s]=t.get("color")),i=!1}if(i)break;t=this.getStyle(r=r.parentNode)}return n},textShadow:l(function(e){if(e=="none")return null;var t=[],n={},r,i=0,s=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(r=s.exec(e))r[0]==","?(t.push(n),n={},i=0):r[1]?n.color=r[1]:n[["offX","offY","blur"][i++]]=r[2];return t.push(n),t}),color:l(function(e){var t={};return t.color=e.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(e,n,r){return t.opacity=parseFloat(r),"rgb("+n+")"}),t}),textTransform:function(e,t){return e[{uppercase:"toUpperCase",lowercase:"toLowerCase"}[t.get("textTransform")]||"toString"]()}},m=" ".split(/\s+/).length==0,g=new o,y=new s,b=[],w={},E={},S={engine:null,hover:!1,hoverables:{a:!0},printable:!0,selector:fabric.window.Sizzle||fabric.window.jQuery&&function(e){return jQuery(e)}||fabric.window.dojo&&dojo.query||fabric.window.$$&&function(e){return $$(e)}||fabric.window.$&&function(e){return $(e)}||fabric.document.querySelectorAll&&function(e){return fabric.document.querySelectorAll(e)}||h,separate:"words",textShadow:"none"},x={words:/\s+/,characters:""};return e.now=function(){return t.ready(),e},e.refresh=function(){var t=b.splice(0,b.length);for(var n=0,r=t.length;n<r;++n)e.replace.apply(null,t[n]);return e},e.registerEngine=function(t,n){return n?(w[t]=n,e.set("engine",t)):e},e.registerFont=function(t){var n=new r(t),s=n.family;return E[s]||(E[s]=new i),E[s].add(n),e.set("fontFamily",'"'+s+'"')},e.replace=function(t,r,i){r=p(S,r);if(!r.engine)return e;typeof r.textShadow=="string"&&r.textShadow&&(r.textShadow=n.textShadow(r.textShadow)),i||b.push(arguments);if(t.nodeType||typeof t=="string")t=[t];return n.ready(function(){for(var n=0,i=t.length;n<i;++n){var s=t[n];typeof s=="string"?e.replace(r.selector(s),r,!0):v(s,r)}}),e},e.replaceElement=function(e,t){return t=p(S,t),typeof t.textShadow=="string"&&t.textShadow&&(t.textShadow=n.textShadow(t.textShadow)),v(e,t)},e.engines=w,e.fonts=E,e.getOptions=function(){return p(S)},e.set=function(t,n){return S[t]=n,e},e}();Cufon.registerEngine("canvas",function(){function s(e,t){var n=0,r=0,i=[],s=/([mrvxe])([^a-z]*)/g,o;e:for(var u=0;o=s.exec(e);++u){var a=o[2].split(",");switch(o[1]){case"v":i[u]={m:"bezierCurveTo",a:[n+~~a[0],r+~~a[1],n+~~a[2],r+~~a[3],n+=~~a[4],r+=~~a[5]]};break;case"r":i[u]={m:"lineTo",a:[n+=~~a[0],r+=~~a[1]]};break;case"m":i[u]={m:"moveTo",a:[n=~~a[0],r=~~a[1]]};break;case"x":i[u]={m:"closePath",a:[]};break;case"e":break e}t[i[u].m].apply(t,i[u].a)}return i}function o(e,t){for(var n=0,r=e.length;n<r;++n){var i=e[n];t[i.m].apply(t,i.a)}}var e=Cufon.CSS.supports("display","inline-block"),t=!e&&(fabric.document.compatMode=="BackCompat"||/frameset|transitional/i.test(fabric.document.doctype.publicId)),n=fabric.document.createElement("style");n.type="text/css";var r=fabric.document.createTextNode(".cufon-canvas{text-indent:0}@media screen,projection{.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle"+(t?"":";font-size:1px;line-height:1px")+"}.cufon-canvas .cufon-alt{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden}"+(e?".cufon-canvas canvas{position:relative}":".cufon-canvas canvas{position:absolute}")+"}"+"@media print{"+".cufon-canvas{padding:0 !important}"+".cufon-canvas canvas{display:none}"+".cufon-canvas .cufon-alt{display:inline}"+"}");try{n.appendChild(r)}catch(i){n.setAttribute("type","text/css"),n.styleSheet.cssText=r.data}return fabric.document.getElementsByTagName("head")[0].appendChild(n),function(t,n,r,i,u,a){function $(e,t){W.strokeStyle=t,W.beginPath(),W.moveTo(0,e),W.lineTo(N,e),W.stroke()}function Q(){W.save(),W.fillStyle=i.backgroundColor;var e=0,n=0,r=[{left:0}];i.textAlign==="right"?(W.translate(M[n],0),r[0].left=M[n]*X):i.textAlign==="center"&&(W.translate(M[n]/2,0),r[0].left=M[n]/2*X);for(var s=0,o=T.length;s<o;++s){if(T[s]==="\n"){n++;var u=-t.ascent-t.ascent/5*i.lineHeight,a=r[r.length-1],f={left:0};a.width=e*X,a.height=(-t.ascent+t.descent)*X,i.textAlign==="right"?(W.translate(-N,u),W.translate(M[n],0),f.left=M[n]*X):i.textAlign==="center"?(W.translate(-e-M[n-1]/2,u),W.translate(M[n]/2,0),f.left=M[n]/2*X):W.translate(-e,u),r.push(f),e=0;continue}var l=t.glyphs[T[s]]||t.missingGlyph;if(!l)continue;var c=Number(l.w||t.w)+h;i.backgroundColor&&(W.save(),W.translate(0,t.ascent),W.fillRect(0,0,c+10,-t.ascent+t.descent),W.restore()),W.translate(c,0),e+=c,s==o-1&&(r[r.length-1].width=e*X,r[r.length-1].height=(-t.ascent+t.descent)*X)}W.restore(),Cufon.textOptions.boundaries=r}function G(e){W.fillStyle=e||Cufon.textOptions.color||r.get("color");var n=0,u=0;i.textAlign==="right"?W.translate(M[u],0):i.textAlign==="center"&&W.translate(M[u]/2,0);for(var a=0,f=T.length;a<f;++a){if(T[a]==="\n"){u++;var l=-t.ascent-t.ascent/5*i.lineHeight;i.textAlign==="right"?(W.translate(-N,l),W.translate(M[u],0)):i.textAlign==="center"?(W.translate(-n-M[u-1]/2,l),W.translate(M[u]/2,0)):W.translate(-n,l),n=0;continue}var c=t.glyphs[T[a]]||t.missingGlyph;if(!c)continue;var p=Number(c.w||t.w)+h;J&&(W.save(),W.strokeStyle=W.fillStyle,W.lineWidth+=W.lineWidth,W.beginPath(),J.underline&&(W.moveTo(0,-t.face["underline-position"]+.5),W.lineTo(p,-t.face["underline-position"]+.5)),J.overline&&(W.moveTo(0,t.ascent+.5),W.lineTo(p,t.ascent+.5)),J["line-through"]&&(W.moveTo(0,-t.descent+.5),W.lineTo(p,-t.descent+.5)),W.stroke(),W.restore()),K&&(W.save(),W.transform(1,0,-0.25,1,0,0)),W.beginPath(),c.d&&(c.code?o(c.code,W):c.code=s("m"+c.d,W)),W.fill(),i.strokeStyle&&(W.closePath(),W.save(),W.lineWidth=i.strokeWidth,W.strokeStyle=i.strokeStyle,W.stroke(),W.restore()),K&&W.restore(),W.translate(p,0),n+=p}}var f=n===null,l=t.viewBox,c=r.getSize("fontSize",t.baseSize),h=r.get("letterSpacing");h=h=="normal"?0:c.convertFrom(parseInt(h,10));var p=0,d=0,v=0,m=0,g=i.textShadow,y=[];Cufon.textOptions.shadowOffsets=[],Cufon.textOptions.shadows=null;if(g){Cufon.textOptions.shadows=g;for(var b=0,w=g.length;b<w;++b){var E=g[b],S=c.convertFrom(parseFloat(E.offX)),x=c.convertFrom(parseFloat(E.offY));y[b]=[S,x],x<p&&(p=x),S>d&&(d=S),x>v&&(v=x),S<m&&(m=S)}}var T=Cufon.CSS.textTransform(f?u.alt:n,r).split(""),N=0,C=null,k=0,L=1,A=[];for(var b=0,w=T.length;b<w;++b){if(T[b]==="\n"){L++,N>k&&(k=N),A.push(N),N=0;continue}var O=t.glyphs[T[b]]||t.missingGlyph;if(!O)continue;N+=C=Number(O.w||t.w)+h}A.push(N),N=Math.max(k,N);var M=[];for(var b=A.length;b--;)M[b]=N-A[b];if(C===null)return null;d+=l.width-C,m+=l.minX;var _,D;if(f)_=u,D=u.firstChild;else{_=fabric.document.createElement("span"),_.className="cufon cufon-canvas",_.alt=n,D=fabric.document.createElement("canvas"),_.appendChild(D);if(i.printable){var P=fabric.document.createElement("span");P.className="cufon-alt",P.appendChild(fabric.document.createTextNode(n)),_.appendChild(P)}}var H=_.style,B=D.style||{},j=c.convert(l.height-p+v),F=Math.ceil(j),I=F/j;D.width=Math.ceil(c.convert(N+d-m)*I),D.height=F,p+=l.minY,B.top=Math.round(c.convert(p-t.ascent))+"px",B.left=Math.round(c.convert(m))+"px";var q=Math.ceil(c.convert(N*I)),R=q+"px",U=c.convert(t.height),z=(i.lineHeight-1)*c.convert(-t.ascent/5)*(L-1);Cufon.textOptions.width=q,Cufon.textOptions.height=U*L+z,Cufon.textOptions.lines=L,Cufon.textOptions.totalLineHeight=z,e?(H.width=R,H.height=U+"px"):(H.paddingLeft=R,H.paddingBottom=U-1+"px");var W=Cufon.textOptions.context||D.getContext("2d"),X=F/l.height;Cufon.textOptions.fontAscent=t.ascent*X,Cufon.textOptions.boundaries=null;for(var V=Cufon.textOptions.shadowOffsets,b=y.length;b--;)V[b]=[y[b][0]*X,y[b][1]*X];W.save(),W.scale(X,X),W.translate(-m-1/X*D.width/2+(Cufon.fonts[t.family].offsetLeft||0),-p-Cufon.textOptions.height/X/2),W.lineWidth=t.face["underline-thickness"],W.save();var J=Cufon.getTextDecoration(i),K=i.fontStyle==="italic";if(g)for(var b=0,w=g.length;b<w;++b){var E=g[b];W.save(),W.translate.apply(W,y[b]),G(E.color),W.restore()}return W.save(),Q(),G(),W.restore(),W.restore(),W.restore(),_}}()),Cufon.registerEngine("vml",function(){function n(e,t){return r(e,/(?:em|ex|%)$/i.test(t)?"1em":t)}function r(e,t){if(/px$/i.test(t))return parseFloat(t);var n=e.style.left,r=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left,e.style.left=t;var i=e.style.pixelLeft;return e.style.left=n,e.runtimeStyle.left=r,i}if(!fabric.document.namespaces)return;var e=fabric.document.createElement("canvas");if(e&&e.getContext&&e.getContext.apply)return;fabric.document.namespaces.cvml==null&&fabric.document.namespaces.add("cvml","urn:schemas-microsoft-com:vml");var t=fabric.document.createElement("cvml:shape");t.style.behavior="url(#default#VML)";if(!t.coordsize)return;return t=null,fabric.document.write('<style type="text/css">.cufon-vml-canvas{text-indent:0}@media screen{cvml\\:shape,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute}.cufon-vml-canvas{position:absolute;text-align:left}.cufon-vml{display:inline-block;position:relative;vertical-align:middle}.cufon-vml .cufon-alt{position:absolute;left:-10000in;font-size:1px}a .cufon-vml{cursor:pointer}}@media print{.cufon-vml *{display:none}.cufon-vml .cufon-alt{display:inline}}</style>'),function(e,t,i,s,o,u,a){var f=t===null;f&&(t=o.alt);var l=e.viewBox,c=i.computedFontSize||(i.computedFontSize=new Cufon.CSS.Size(n(u,i.get("fontSize"))+"px",e.baseSize)),h=i.computedLSpacing;h==undefined&&(h=i.get("letterSpacing"),i.computedLSpacing=h=h=="normal"?0:~~c.convertFrom(r(u,h)));var p,d;if(f)p=o,d=o.firstChild;else{p=fabric.document.createElement("span"),p.className="cufon cufon-vml",p.alt=t,d=fabric.document.createElement("span"),d.className="cufon-vml-canvas",p.appendChild(d);if(s.printable){var v=fabric.document.createElement("span");v.className="cufon-alt",v.appendChild(fabric.document.createTextNode(t)),p.appendChild(v)}a||p.appendChild(fabric.document.createElement("cvml:shape"))}var m=p.style,g=d.style,y=c.convert(l.height),b=Math.ceil(y),w=b/y,E=l.minX,S=l.minY;g.height=b,g.top=Math.round(c.convert(S-e.ascent)),g.left=Math.round(c.convert(E)),m.height=c.convert(e.height)+"px";var x=Cufon.getTextDecoration(s),T=i.get("color"),N=Cufon.CSS.textTransform(t,i).split(""),C=0,k=0,L=null,A,O,M=s.textShadow;for(var _=0,D=0,P=N.length;_<P;++_)A=e.glyphs[N[_]]||e.missingGlyph,A&&(C+=L=~~(A.w||e.w)+h);if(L===null)return null;var H=-E+C+(l.width-L),B=c.convert(H*w),j=Math.round(B),F=H+","+l.height,I,q="r"+F+"nsnf";for(_=0;_<P;++_){A=e.glyphs[N[_]]||e.missingGlyph;if(!A)continue;f?(O=d.childNodes[D],O.firstChild&&O.removeChild(O.firstChild)):(O=fabric.document.createElement("cvml:shape"),d.appendChild(O)),O.stroked="f",O.coordsize=F,O.coordorigin=I=E-k+","+S,O.path=(A.d?"m"+A.d+"xe":"")+"m"+I+q,O.fillcolor=T;var R=O.style;R.width=j,R.height=b;if(M){var U=M[0],z=M[1],W=Cufon.CSS.color(U.color),X,V=fabric.document.createElement("cvml:shadow");V.on="t",V.color=W.color,V.offset=U.offX+","+U.offY,z&&(X=Cufon.CSS.color(z.color),V.type="double",V.color2=X.color,V.offset2=z.offX+","+z.offY),V.opacity=W.opacity||X&&X.opacity||1,O.appendChild(V)}k+=~~(A.w||e.w)+h,++D}return m.width=Math.max(Math.ceil(c.convert(C*w)),0),p}}()),Cufon.getTextDecoration=function(e){return{underline:e.textDecoration==="underline",overline:e.textDecoration==="overline","line-through":e.textDecoration==="line-through"}},typeof exports!="undefined"&&(exports.Cufon=Cufon),fabric.log=function(){},fabric.warn=function(){},typeof console!="undefined"&&(typeof console.log!="undefined"&&console.log.apply&&(fabric.log=function(){return console.log.apply(console,arguments)}),typeof console.warn!="undefined"&&console.warn.apply&&(fabric.warn=function(){return console.warn.apply(console,arguments)})),fabric.Observable={observe:function(e,t){this.__eventListeners||(this.__eventListeners={});if(arguments.length===1)for(var n in e)this.observe(n,e[n]);else this.__eventListeners[e]||(this.__eventListeners[e]=[]),this.__eventListeners[e].push(t)},stopObserving:function(e,t){this.__eventListeners||(this.__eventListeners={}),this.__eventListeners[e]&&fabric.util.removeFromArray(this.__eventListeners[e],t)},fire:function(e,t){this.__eventListeners||(this.__eventListeners={});var n=this.__eventListeners[e];if(!n)return;for(var r=0,i=n.length;r<i;r++)n[r](t||{})}},function(){function e(e,t){var n=e.indexOf(t);return n!==-1&&e.splice(n,1),e}function t(e,t){return Math.floor(Math.random()*(t-e+1))+e}function r(e){return e*n}function i(e,t){return parseFloat(Number(e).toFixed(t))}function s(){return!1}function o(e){e||(e={});var t=+(new Date),n=e.duration||500,r=t+n,i,s,o=e.onChange||function(){},a=e.abort||function(){return!1},f=e.easing||function(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t},l="startValue"in e?e.startValue:0,c="endValue"in e?e.endValue:100;byValue=e.byValue||c-l,e.onStart&&e.onStart(),function h(){i=+(new Date),currentTime=i>r?n:i-t,o(f(currentTime,l,byValue,n));if(i>r||a()){e.onComplete&&e.onComplete();return}u(h)}()}function a(e,t,n){if(e){var r=new Image;r.onload=function(){t&&t.call(n,r),r=r.onload=null},r.src=e}else t&&t.call(n,e)}fabric.util={};var n=Math.PI/180,u=function(){return fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(e,t){fabric.window.setTimeout(e,1e3/60)}}();fabric.util.removeFromArray=e,fabric.util.degreesToRadians=r,fabric.util.toFixed=i,fabric.util.getRandomInt=t,fabric.util.falseFunction=s,fabric.util.animate=o,fabric.util.requestAnimFrame=u,fabric.util.loadImage=a}(),function(){function t(t,n){var r=e.call(arguments,2),i=[];for(var s=0,o=t.length;s<o;s++)i[s]=r.length?t[s][n].apply(t[s],r):t[s][n].call(t[s]);return i}function n(e,t){if(!e||e.length===0)return undefined;var n=e.length-1,r=t?e[n][t]:e[n];if(t)while(n--)e[n][t]>=r&&(r=e[n][t]);else while(n--)e[n]>=r&&(r=e[n]);return r}function r(e,t){if(!e||e.length===0)return undefined;var n=e.length-1,r=t?e[n][t]:e[n];if(t)while(n--)e[n][t]<r&&(r=e[n][t]);else while(n--)e[n]<r&&(r=e[n]);return r}var e=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(n===0)return-1;var r=0;arguments.length>0&&(r=Number(arguments[1]),r!==r?r=0:r!==0&&r!==1/0&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r))));if(r>=n)return-1;var i=r>=0?r:Math.max(n-Math.abs(r),0);for(;i<n;i++)if(i in t&&t[i]===e)return i;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=0,r=this.length>>>0;n<r;n++)n in this&&e.call(t,this[n],n,this)}),Array.prototype.map||(Array.prototype.map=function(e,t){var n=[];for(var r=0,i=this.length>>>0;r<i;r++)r in this&&(n[r]=e.call(t,this[r],r,this));return n}),Array.prototype.every||(Array.prototype.every=function(e,t){for(var n=0,r=this.length>>>0;n<r;n++)if(n in this&&!e.call(t,this[n],n,this))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e,t){for(var n=0,r=this.length>>>0;n<r;n++)if(n in this&&e.call(t,this[n],n,this))return!0;return!1}),Array.prototype.filter||(Array.prototype.filter=function(e,t){var n=[],r;for(var i=0,s=this.length>>>0;i<s;i++)i in this&&(r=this[i],e.call(t,r,i,this)&&n.push(r));return n}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=this.length>>>0,n=0,r;if(arguments.length>1)r=arguments[1];else do{if(n in this){r=this[n++];break}if(++n>=t)throw new TypeError}while(!0);for(;n<t;n++)n in this&&(r=e.call(null,r,this[n],n,this));return r}),fabric.util.array={invoke:t,min:r,max:n}}(),function(){function e(e,t){for(var n in t)e[n]=t[n];return e}function t(t){return e({},t)}fabric.util.object={extend:e,clone:t}}(),function(){function e(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})}function t(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function n(e){return e.replace("&","&amp;").replace('"',"&quot;").replace("'","&apos;").replace("<","&lt;").replace(">","&gt;")}String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}),fabric.util.string={camelize:e,capitalize:t,escapeXml:n}}(),function(){var e=Array.prototype.slice,t=Function.prototype.apply,n=function(){};Function.prototype.bind||(Function.prototype.bind=function(r){var i=this,s=e.call(arguments,1),o;return s.length?o=function(){return t.call(i,this instanceof n?this:r,s.concat(e.call(arguments)))}:o=function(){return t.call(i,this instanceof n?this:r,arguments)},n.prototype=this.prototype,o.prototype=new n,o})}(),function(){function i(){}function s(){function o(){this.initialize.apply(this,arguments)}var n=null,s=e.call(arguments,0);typeof s[0]=="function"&&(n=s.shift()),o.superclass=n,o.subclasses=[],n&&(i.prototype=n.prototype,o.prototype=new i,n.subclasses.push(o));for(var u=0,a=s.length;u<a;u++)r(o,s[u]);return o.prototype.initialize||(o.prototype.initialize=t),o.prototype.constructor=o,o}var e=Array.prototype.slice,t=function(){},n=function(){for(var e in{toString:1})if(e==="toString")return!1;return!0}(),r;n?r=function(e,t){t.toString!==Object.prototype.toString&&(e.prototype.toString=t.toString),t.valueOf!==Object.prototype.valueOf&&(e.prototype.valueOf=t.valueOf);for(var n in t)e.prototype[n]=t[n]}:r=function(e,t){for(var n in t)e.prototype[n]=t[n]},fabric.util.createClass=s}(),function(e){function t(e){var t=Array.prototype.slice.call(arguments,1),n,r,i=t.length;for(r=0;r<i;r++){n=typeof e[t[r]];if(!/^(?:function|object|unknown)$/.test(n))return!1}return!0}function s(e,t){return{handler:t,wrappedHandler:o(e,t)}}function o(e,t){return function(n){t.call(r(e),n||fabric.window.event)}}function u(e,t){return function(n){if(c[e]&&c[e][t]){var r=c[e][t];for(var i=0,s=r.length;i<s;i++)r[i].call(this,n||fabric.window.event)}}}function d(e){return{x:v(e),y:m(e)}}function v(e){var t=fabric.document.documentElement,n=fabric.document.body||{scrollLeft:0};return e.pageX||(typeof e.clientX!="unknown"?e.clientX:0)+(t.scrollLeft||n.scrollLeft)-(t.clientLeft||0)}function m(e){var t=fabric.document.documentElement,n=fabric.document.body||{scrollTop:0};return e.pageY||(typeof e.clientY!="unknown"?e.clientY:0)+(t.scrollTop||n.scrollTop)-(t.clientTop||0)}var n=function(){if(typeof fabric.document.documentElement.uniqueID!="undefined")return function(e){return e.uniqueID};var e=0;return function(t){return t.__uniqueID||(t.__uniqueID="uniqueID__"+e++)}}(),r,i;(function(){var e={};r=function(t){return e[t]},i=function(t,n){e[t]=n}})();var a=t(fabric.document.documentElement,"addEventListener","removeEventListener")&&t(fabric.window,"addEventListener","removeEventListener"),f=t(fabric.document.documentElement,"attachEvent","detachEvent")&&t(fabric.window,"attachEvent","detachEvent"),l={},c={},h,p;a?(h=function(e,t,n){e.addEventListener(t,n,!1)},p=function(e,t,n){e.removeEventListener(t,n,!1)}):f?(h=function(e,t,r){var o=n(e);i(o,e),l[o]||(l[o]={}),l[o][t]||(l[o][t]=[]);var u=s(o,r);l[o][t].push(u),e.attachEvent("on"+t,u.wrappedHandler)},p=function(e,t,r){var i=n(e),s;if(l[i]&&l[i][t])for(var o=0,u=l[i][t].length;o<u;o++)s=l[i][t][o],s&&s.handler===r&&(e.detachEvent("on"+t,s.wrappedHandler),l[i][t][o]=null)}):(h=function(e,t,r){var i=n(e);c[i]||(c[i]={});if(!c[i][t]){c[i][t]=[];var s=e["on"+t];s&&c[i][t].push(s),e["on"+t]=u(i,t)}c[i][t].push(r)},p=function(e,t,r){var i=n(e);if(c[i]&&c[i][t]){var s=c[i][t];for(var o=0,u=s.length;o<u;o++)s[o]===r&&s.splice(o,1)}}),fabric.util.addListener=h,fabric.util.removeListener=p,fabric.isTouchSupported&&(v=function(e){return e.touches&&e.touches[0]&&e.touches[0].pageX},m=function(e){return e.touches&&e.touches[0]&&e.touches[0].pageY}),fabric.util.getPointer=d,fabric.util.object.extend(fabric.util,fabric.Observable)}(this),function(){function e(e,t){var n=e.style,r;if(typeof t=="string")return e.style.cssText+=";"+t,t.indexOf("opacity")>-1?u(e,t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var i in t)if(i==="opacity")u(e,t[i]);else{var s=i==="float"||i==="cssFloat"?typeof n.styleFloat=="undefined"?"cssFloat":"styleFloat":i;n[s]=t[i]}return e}var t=fabric.document.createElement("div"),n=typeof t.style.opacity=="string",r=typeof t.style.filter=="string",i=fabric.document.defaultView,s=i&&typeof i.getComputedStyle!="undefined",o=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,u=function(e){return e};n?u=function(e,t){return e.style.opacity=t,e}:r&&(u=function(e,t){var n=e.style;return e.currentStyle&&!e.currentStyle.hasLayout&&(n.zoom=1),o.test(n.filter)?(t=t>=.9999?"":"alpha(opacity="+t*100+")",n.filter=n.filter.replace(o,t)):n.filter+=" alpha(opacity="+t*100+")",e}),fabric.util.setStyle=e}(),function(){function t(e){return typeof e=="string"?fabric.document.getElementById(e):e}function n(t){return e.call(t,0)}function s(e,t){var n=fabric.document.createElement(e);for(var r in t)r==="class"?n.className=t[r]:r==="for"?n.htmlFor=t[r]:n.setAttribute(r,t[r]);return n}function o(e,t){(" "+e.className+" ").indexOf(" "+t+" ")===-1&&(e.className+=(e.className?" ":"")+t)}function u(e,t,n){return typeof t=="string"&&(t=s(t,n)),e.parentNode&&e.parentNode.replaceChild(t,e),t.appendChild(e),t}function a(e){var t=0,n=0;do t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;while(e);return{left:n,top:t}}var e=Array.prototype.slice;try{var r=n(fabric.document.childNodes)instanceof Array}catch(i){}r||(n=function(e){var t=new Array(e.length),n=e.length;while(n--)t[n]=e[n];return t}),function(){function n(e){return typeof e.onselectstart!="undefined"&&(e.onselectstart=fabric.util.falseFunction),t?e.style[t]="none":typeof e.unselectable=="string"&&(e.unselectable="on"),e}function r(e){return typeof e.onselectstart!="undefined"&&(e.onselectstart=null),t?e.style[t]="":typeof e.unselectable=="string"&&(e.unselectable=""),e}var e=fabric.document.documentElement.style,t="userSelect"in e?"userSelect":"MozUserSelect"in e?"MozUserSelect":"WebkitUserSelect"in e?"WebkitUserSelect":"KhtmlUserSelect"in e?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=n,fabric.util.makeElementSelectable=r}(),function(){function e(e,t){var n=fabric.document.getElementsByTagName("head")[0],r=fabric.document.createElement("script"),i=!0;r.type="text/javascript",r.setAttribute("runat","server"),r.onload=r.onreadystatechange=function(e){if(i){if(typeof this.readyState=="string"&&this.readyState!=="loaded"&&this.readyState!=="complete")return;i=!1,t(e||fabric.window.event),r=r.onload=r.onreadystatechange=null}},r.src=e,n.appendChild(r)}fabric.util.getScript=e}(),fabric.util.getById=t,fabric.util.toArray=n,fabric.util.makeElement=s,fabric.util.addClass=o,fabric.util.wrapElement=u,fabric.util.getElementOffset=a}(),function(){function e(e,t){return e+(/\?/.test(e)?"&":"?")+t}function n(){}function r(r,i){i||(i={});var s=i.method?i.method.toUpperCase():"GET",o=i.onComplete||function(){},u=t(),a;return u.onreadystatechange=function(){u.readyState===4&&(o(u),u.onreadystatechange=n)},s==="GET"&&(a=null,typeof i.parameters=="string"&&(r=e(r,i.parameters))),u.open(s,r,!0),(s==="POST"||s==="PUT")&&u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),u.send(a),u}var t=function(){var e=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}];for(var t=e.length;t--;)try{var n=e[t]();if(n)return e[t]}catch(r){}}();fabric.util.request=r}(),function(){function e(e,t,n,r){return n*(e/=r)*e+t}function t(e,t,n,r){return-n*(e/=r)*(e-2)+t}function n(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}function r(e,t,n,r){return n*(e/=r)*e*e+t}function i(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function s(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}function o(e,t,n,r){return n*(e/=r)*e*e*e+t}function u(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t}function a(e,t,n,r){return(e/=r/2)<1?n/2*
2
- e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}function f(e,t,n,r){return n*(e/=r)*e*e*e*e+t}function l(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}function c(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}function h(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}function p(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t}function d(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t}function v(e,t,n,r){return e==0?t:n*Math.pow(2,10*(e/r-1))+t}function m(e,t,n,r){return e==r?t+n:n*(-Math.pow(2,-10*e/r)+1)+t}function g(e,t,n,r){return e==0?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t:n/2*(-Math.pow(2,-10*--e)+2)+t}function y(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t}function b(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t}function w(e,t,n,r){return(e/=r/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}function E(e,t,n,r){var i=1.70158,s=0,o=n;if(e==0)return t;if((e/=r)==1)return t+n;s||(s=r*.3);if(o<Math.abs(n)){o=n;var i=s/4}else var i=s/(2*Math.PI)*Math.asin(n/o);return-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-i)*2*Math.PI/s))+t}function S(e,t,n,r){var i=1.70158,s=0,o=n;if(e==0)return t;if((e/=r)==1)return t+n;s||(s=r*.3);if(o<Math.abs(n)){o=n;var i=s/4}else var i=s/(2*Math.PI)*Math.asin(n/o);return o*Math.pow(2,-10*e)*Math.sin((e*r-i)*2*Math.PI/s)+n+t}function x(e,t,n,r){var i=1.70158,s=0,o=n;if(e==0)return t;if((e/=r/2)==2)return t+n;s||(s=r*.3*1.5);if(o<Math.abs(n)){o=n;var i=s/4}else var i=s/(2*Math.PI)*Math.asin(n/o);return e<1?-0.5*o*Math.pow(2,10*(e-=1))*Math.sin((e*r-i)*2*Math.PI/s)+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-i)*2*Math.PI/s)*.5+n+t}function T(e,t,n,r,i){return i==undefined&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t}function N(e,t,n,r,i){return i==undefined&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function C(e,t,n,r,i){return i==undefined&&(i=1.70158),(e/=r/2)<1?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t}function k(e,t,n,r){return n-L(r-e,0,n,r)+t}function L(e,t,n,r){return(e/=r)<1/2.75?n*7.5625*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}function A(e,t,n,r){return e<r/2?k(e*2,0,n,r)*.5+t:L(e*2-r,0,n,r)*.5+n*.5+t}fabric.util.ease={},fabric.util.ease={easeInQuad:e,easeOutQuad:t,easeInOutQuad:n,easeInCubic:r,easeOutCubic:i,easeInOutCubic:s,easeInQuart:o,easeOutQuart:u,easeInOutQuart:a,easeInQuint:f,easeOutQuint:l,easeInOutQuint:c,easeInSine:h,easeOutSine:p,easeInOutSine:d,easeInExpo:v,easeOutExpo:m,easeInOutExpo:g,easeInCirc:y,easeOutCirc:b,easeInOutCirc:w,easeInElastic:E,easeOutElastic:S,easeInOutElastic:x,easeInBack:T,easeOutBack:N,easeInOutBack:C,easeInBounce:k,easeOutBounce:L,easeInOutBounce:A}}(),function(e){"use strict";function o(e,r){if(!e)return;var i,o,u={};e.parentNode&&/^g$/i.test(e.parentNode.nodeName)&&(u=t.parseAttributes(e.parentNode,r));var a=r.reduce(function(n,r){return i=e.getAttribute(r),o=parseFloat(i),i&&((r==="fill"||r==="stroke")&&i==="none"&&(i=""),r==="fill-rule"&&(i=i==="evenodd"?"destination-over":i),r==="transform"&&(i=t.parseTransformAttribute(i)),r in s&&(r=s[r]),n[r]=isNaN(o)?i:o),n},{});return a=n(a,n(h(e),t.parseStyleAttribute(e))),n(u,a)}function u(e){if(!e)return null;e=e.trim();var t=e.indexOf(",")>-1;e=e.split(/\s+/);var n=[];if(t)for(var r=0,i=e.length;r<i;r++){var s=e[r].split(",");n.push({x:parseFloat(s[0]),y:parseFloat(s[1])})}else for(var r=0,i=e.length;r<i;r+=2)n.push({x:parseFloat(e[r]),y:parseFloat(e[r+1])});return n.length%2!==0,n}function a(e){var t={},n=e.getAttribute("style");if(n)if(typeof n=="string")n=n.replace(/;$/,"").split(";").forEach(function(e){var n=e.split(":");t[n[0].trim().toLowerCase()]=n[1].trim()});else for(var r in n)typeof n[r]!="undefined"&&(t[r.toLowerCase()]=n[r]);return t}function f(e){var n=t.Canvas.activeInstance,r=n?n.getContext():null;if(!r)return;for(var i=e.length;i--;){var s=e[i].get("fill");if(/^url\(/.test(s)){var o=s.slice(5,s.length-1);t.gradientDefs[o]&&e[i].set("fill",t.Gradient.fromElement(t.gradientDefs[o],r,e[i]))}}}function l(e,n,i){function u(){--o===0&&(s=s.filter(function(e){return e!=null}),f(s),n(s))}var s=Array(e.length),o=e.length;for(var a=0,l,c=e.length;a<c;a++){l=e[a];var h=t[r(l.tagName)];if(h&&h.fromElement)try{h.async?h.fromElement(l,function(e){return function(t){s.splice(e,0,t),u()}}(a),i):(s.splice(a,0,h.fromElement(l,i)),u())}catch(p){t.log(p.message||p)}else u()}}function c(e){var t=e.getElementsByTagName("style"),n={},r;for(var i=0,s=t.length;i<s;i++){var o=t[0].textContent;o=o.replace(/\/\*[\s\S]*?\*\//g,""),r=o.match(/[^{]*\{[\s\S]*?\}/g),r=r.map(function(e){return e.trim()}),r.forEach(function(e){var t=e.match(/([\s\S]*?)\s*\{([^}]*)\}/),e=t[1],r=t[2].trim(),i=r.replace(/;$/,"").split(/\s*;\s*/);n[e]||(n[e]={});for(var s=0,o=i.length;s<o;s++){var u=i[s].split(/\s*:\s*/),a=u[0],f=u[1];n[e][a]=f}})}return n}function h(e){var n=e.nodeName,r=e.getAttribute("class"),i=e.getAttribute("id"),s={};for(var o in t.cssRules){var u=r&&(new RegExp("^\\."+r)).test(o)||i&&(new RegExp("^#"+i)).test(o)||(new RegExp("^"+n)).test(o);if(u)for(var a in t.cssRules[o])s[a]=t.cssRules[o][a]}return s}function d(e,n){function r(r){var i=r.responseXML;!i.documentElement&&t.window.ActiveXObject&&r.responseText&&(i=new ActiveXObject("Microsoft.XMLDOM"),i.async="false",i.loadXML(r.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));if(!i.documentElement)return;t.parseSVGDocument(i.documentElement,function(r,i){p.set(e,{objects:t.util.array.invoke(r,"toObject"),options:i}),n(r,i)})}e=e.replace(/^\n\s*/,"").trim(),p.has(e,function(i){i?p.get(e,function(e){var t=v(e);n(t.objects,t.options)}):new t.util.request(e,{method:"get",onComplete:r})})}function v(e){var n=e.objects,i=e.options;return n=n.map(function(e){return t[r(e.type)].fromObject(e)}),{objects:n,options:i}}function m(e,n){e=e.trim();var r;if(typeof DOMParser!="undefined"){var i=new DOMParser;i&&i.parseFromString&&(r=i.parseFromString(e,"text/xml"))}else if(t.window.ActiveXObject){var r=new ActiveXObject("Microsoft.XMLDOM");r.async="false",r.loadXML(e.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,""))}t.parseSVGDocument(r.documentElement,function(e,t){n(e,t)})}function g(e){var t="";for(var n=0,r=e.length;n<r;n++){if(e[n].type!=="text"||!e[n].path)continue;t+=["@font-face {","font-family: ",e[n].fontFamily,"; ","src: url('",e[n].path,"')","}"].join("")}return t&&(t=["<defs>",'<style type="text/css">',"<![CDATA[",t,"]]>","</style>","</defs>"].join("")),t}var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.string.capitalize,i=t.util.object.clone,s={cx:"left",x:"left",cy:"top",y:"top",r:"radius","fill-opacity":"opacity","fill-rule":"fillRule","stroke-width":"strokeWidth",transform:"transformMatrix"};t.parseTransformAttribute=function(){function e(e,t){var n=t[0];e[0]=Math.cos(n),e[1]=Math.sin(n),e[2]=-Math.sin(n),e[3]=Math.cos(n)}function t(e,t){var n=t[0],r=t.length===2?t[1]:t[0];e[0]=n,e[3]=r}function n(e,t){e[2]=t[0]}function r(e,t){e[1]=t[0]}function i(e,t){e[4]=t[0],t.length===2&&(e[5]=t[1])}var s=[1,0,0,1,0,0],o="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",u="(?:\\s+,?\\s*|,\\s*)",a="(?:(skewX)\\s*\\(\\s*("+o+")\\s*\\))",f="(?:(skewY)\\s*\\(\\s*("+o+")\\s*\\))",l="(?:(rotate)\\s*\\(\\s*("+o+")(?:"+u+"("+o+")"+u+"("+o+"))?\\s*\\))",c="(?:(scale)\\s*\\(\\s*("+o+")(?:"+u+"("+o+"))?\\s*\\))",h="(?:(translate)\\s*\\(\\s*("+o+")(?:"+u+"("+o+"))?\\s*\\))",p="(?:(matrix)\\s*\\(\\s*("+o+")"+u+"("+o+")"+u+"("+o+")"+u+"("+o+")"+u+"("+o+")"+u+"("+o+")"+"\\s*\\))",d="(?:"+p+"|"+h+"|"+c+"|"+l+"|"+a+"|"+f+")",v="(?:"+d+"(?:"+u+d+")*"+")",m="^\\s*(?:"+v+"?)\\s*$",g=new RegExp(m),y=new RegExp(d);return function(o){var u=s.concat();return!o||o&&!g.test(o)?u:(o.replace(y,function(s){var o=(new RegExp(d)).exec(s).filter(function(e){return e!==""&&e!=null}),a=o[1],f=o.slice(2).map(parseFloat);switch(a){case"translate":i(u,f);break;case"rotate":e(u,f);break;case"scale":t(u,f);break;case"skewX":n(u,f);break;case"skewY":r(u,f);break;case"matrix":u=f}}),u)}}(),t.parseSVGDocument=function(){function s(e,t){while(e&&(e=e.parentNode))if(t.test(e.nodeName))return!0;return!1}var e=/^(path|circle|polygon|polyline|ellipse|rect|line|image)$/,n="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",r=new RegExp("^\\s*("+n+"+)\\s*,?"+"\\s*("+n+"+)\\s*,?"+"\\s*("+n+"+)\\s*,?"+"\\s*("+n+"+)\\s*"+"$");return function(n,o){if(!n)return;var u=new Date,a=t.util.toArray(n.getElementsByTagName("*"));if(a.length===0){a=n.selectNodes("//*[name(.)!='svg']");var f=[];for(var l=0,h=a.length;l<h;l++)f[l]=a[l];a=f}var p=a.filter(function(t){return e.test(t.tagName)&&!s(t,/^(?:pattern|defs)$/)});if(!p||p&&!p.length)return;var d=n.getAttribute("viewBox"),v=n.getAttribute("width"),m=n.getAttribute("height"),g=null,y=null,b,w;d&&(d=d.match(r))&&(b=parseInt(d[1],10),w=parseInt(d[2],10),g=parseInt(d[3],10),y=parseInt(d[4],10)),g=v?parseFloat(v):g,y=m?parseFloat(m):y;var E={width:g,height:y};t.gradientDefs=t.getGradientDefs(n),t.cssRules=c(n),t.parseElements(p,function(e){t.documentParsingTime=new Date-u,o&&o(e,E)},i(E))}}();var p={has:function(e,t){t(!1)},get:function(e,t){},set:function(e,t){}};n(t,{parseAttributes:o,parseElements:l,parseStyleAttribute:a,parsePointsAttribute:u,getCSSRules:c,loadSVGFromURL:d,loadSVGFromString:m,createSVGFontFacesMarkup:g})}(typeof exports!="undefined"?exports:this),function(){function e(e){var t=e.getAttribute("style");if(t){var n=t.split(/\s*;\s*/);for(var r=n.length;r--;){var i=n[r].split(/\s*:\s*/),s=i[0].trim(),o=i[1].trim();if(s==="stop-color")return o}}}function t(e,t){for(var n in t){if(typeof t[n]=="string"&&/^\d+%$/.test(t[n])){var r=parseFloat(t[n],10);if(n==="x1"||n==="x2")t[n]=e.width*r/100;else if(n==="y1"||n==="y2")t[n]=e.height*r/100}if(n==="x1"||n==="x2")t[n]-=e.width/2;else if(n==="y1"||n==="y2")t[n]-=e.height/2}}function n(e){var t=e.getElementsByTagName("linearGradient"),n=e.getElementsByTagName("radialGradient"),r,i={};for(var s=t.length;s--;)r=t[s],i[r.id]=r;for(var s=n.length;s--;)r=n[s],i[r.id]=r;return i}fabric.Gradient={create:function(e,t){t||(t={});var n=t.x1||0,r=t.y1||0,i=t.x2||e.canvas.width,s=t.y2||0,o=t.colorStops,u=e.createLinearGradient(n,r,i,s);for(var a in o){var f=o[a];u.addColorStop(parseFloat(a),f)}return u},fromElement:function(n,r,i){var s=n.getElementsByTagName("stop"),n,o,u={},a,f={x1:n.getAttribute("x1")||0,y1:n.getAttribute("y1")||0,x2:n.getAttribute("x2")||"100%",y2:n.getAttribute("y2")||0};for(var l=s.length;l--;)n=s[l],o=n.getAttribute("offset"),o=parseFloat(o)/(/%$/.test(o)?100:1),u[o]=e(n)||n.getAttribute("stop-color");return t(i,f),fabric.Gradient.create(r,{x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,colorStops:u})},forObject:function(e,n,r){r||(r={}),t(e,r);var i=fabric.Gradient.create(n,{x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,colorStops:r.colorStops});return i}},fabric.getGradientDefs=n}(),function(e){"use strict";function n(e,t){arguments.length>0&&this.init(e,t)}var t=e.fabric||(e.fabric={});if(t.Point){t.warn("fabric.Point is already defined");return}t.Point=n,n.prototype={constructor:n,init:function(e,t){this.x=e,this.y=t},add:function(e){return new n(this.x+e.x,this.y+e.y)},addEquals:function(e){return this.x+=e.x,this.y+=e.y,this},scalarAdd:function(e){return new n(this.x+e,this.y+e)},scalarAddEquals:function(e){return this.x+=e,this.y+=e,this},subtract:function(e){return new n(this.x-e.x,this.y-e.y)},subtractEquals:function(e){return this.x-=e.x,this.y-=e.y,this},scalarSubtract:function(e){return new n(this.x-e,this.y-e)},scalarSubtractEquals:function(e){return this.x-=e,this.y-=e,this},multiply:function(e){return new n(this.x*e,this.y*e)},multiplyEquals:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return new n(this.x/e,this.y/e)},divideEquals:function(e){return this.x/=e,this.y/=e,this},eq:function(e){return this.x==e.x&&this.y==e.y},lt:function(e){return this.x<e.x&&this.y<e.y},lte:function(e){return this.x<=e.x&&this.y<=e.y},gt:function(e){return this.x>e.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,t){return new n(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t)},distanceFrom:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},min:function(e){return new n(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new n(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+","+this.y},setXY:function(e,t){this.x=e,this.y=t},setFromPoint:function(e){this.x=e.x,this.y=e.y},swap:function(e){var t=this.x,n=this.y;this.x=e.x,this.y=e.y,e.x=t,e.y=n}}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function n(e){arguments.length>0&&this.init(e)}var t=e.fabric||(e.fabric={});if(t.Intersection){t.warn("fabric.Intersection is already defined");return}t.Intersection=n,t.Intersection.prototype={init:function(e){this.status=e,this.points=[]},appendPoint:function(e){this.points.push(e)},appendPoints:function(e){this.points=this.points.concat(e)}},t.Intersection.intersectLineLine=function(e,r,i,s){var o,u=(s.x-i.x)*(e.y-i.y)-(s.y-i.y)*(e.x-i.x),a=(r.x-e.x)*(e.y-i.y)-(r.y-e.y)*(e.x-i.x),f=(s.y-i.y)*(r.x-e.x)-(s.x-i.x)*(r.y-e.y);if(f!=0){var l=u/f,c=a/f;0<=l&&l<=1&&0<=c&&c<=1?(o=new n("Intersection"),o.points.push(new t.Point(e.x+l*(r.x-e.x),e.y+l*(r.y-e.y)))):o=new n("No Intersection")}else u==0||a==0?o=new n("Coincident"):o=new n("Parallel");return o},t.Intersection.intersectLinePolygon=function(e,t,r){var i=new n("No Intersection"),s=r.length;for(var o=0;o<s;o++){var u=r[o],a=r[(o+1)%s],f=n.intersectLineLine(e,t,u,a);i.appendPoints(f.points)}return i.points.length>0&&(i.status="Intersection"),i},t.Intersection.intersectPolygonPolygon=function(e,t){var r=new n("No Intersection"),i=e.length;for(var s=0;s<i;s++){var o=e[s],u=e[(s+1)%i],a=n.intersectLinePolygon(o,u,t);r.appendPoints(a.points)}return r.points.length>0&&(r.status="Intersection"),r},t.Intersection.intersectPolygonRectangle=function(e,r,i){var s=r.min(i),o=r.max(i),u=new t.Point(o.x,s.y),a=new t.Point(s.x,o.y),f=n.intersectLinePolygon(s,u,e),l=n.intersectLinePolygon(u,o,e),c=n.intersectLinePolygon(o,a,e),h=n.intersectLinePolygon(a,s,e),p=new n("No Intersection");return p.appendPoints(f.points),p.appendPoints(l.points),p.appendPoints(c.points),p.appendPoints(h.points),p.points.length>0&&(p.status="Intersection"),p}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function n(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}var t=e.fabric||(e.fabric={});if(t.Color){t.warn("fabric.Color is already defined.");return}t.Color=n,t.Color.prototype={_tryParsingColor:function(e){var t=n.sourceFromHex(e);t||(t=n.sourceFromRgb(e)),t&&this.setSource(t)},getSource:function(){return this._source},setSource:function(e){this._source=e},toRgb:function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"},toRgba:function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},toHex:function(){var e=this.getSource(),t=e[0].toString(16);t=t.length==1?"0"+t:t;var n=e[1].toString(16);n=n.length==1?"0"+n:n;var r=e[2].toString(16);return r=r.length==1?"0"+r:r,t.toUpperCase()+n.toUpperCase()+r.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(e){var t=this.getSource();return t[3]=e,this.setSource(t),this},toGrayscale:function(){var e=this.getSource(),t=parseInt((e[0]*.3+e[1]*.59+e[2]*.11).toFixed(0),10),n=e[3];return this.setSource([t,t,t,n]),this},toBlackWhite:function(e){var t=this.getSource(),n=(t[0]*.3+t[1]*.59+t[2]*.11).toFixed(0),r=t[3],e=e||127;return n=Number(n)<Number(e)?0:255,this.setSource([n,n,n,r]),this},overlayWith:function(e){e instanceof n||(e=new n(e));var t=[],r=this.getAlpha(),i=.5,s=this.getSource(),o=e.getSource();for(var u=0;u<3;u++)t.push(Math.round(s[u]*(1-i)+o[u]*i));return t[3]=r,this.setSource(t),this}},t.Color.reRGBa=/^rgba?\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d+(?:\.\d+)?))?\)$/,t.Color.reHex=/^#?([0-9a-f]{6}|[0-9a-f]{3})$/i,t.Color.fromRgb=function(e){return n.fromSource(n.sourceFromRgb(e))},t.Color.sourceFromRgb=function(e){var t=e.match(n.reRGBa);if(t)return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),t[4]?parseFloat(t[4]):1]},t.Color.fromRgba=n.fromRgb,t.Color.fromHex=function(e){return n.fromSource(n.sourceFromHex(e))},t.Color.sourceFromHex=function(e){if(e.match(n.reHex)){var t=e.slice(e.indexOf("#")+1),r=t.length===3,i=r?t.charAt(0)+t.charAt(0):t.substring(0,2),s=r?t.charAt(1)+t.charAt(1):t.substring(2,4),o=r?t.charAt(2)+t.charAt(2):t.substring(4,6);return[parseInt(i,16),parseInt(s,16),parseInt(o,16),1]}},t.Color.fromSource=function(e){var t=new n;return t.setSource(e),t}}(typeof exports!="undefined"?exports:this),function(e){"use strict";if(fabric.StaticCanvas){fabric.warn("fabric.StaticCanvas is already defined.");return}var t=fabric.util.object.extend,n=fabric.util.getElementOffset,r=fabric.util.removeFromArray,i=fabric.util.removeListener,s=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=function(e,t){t||(t={}),this._initStatic(e,t),fabric.StaticCanvas.activeInstance=this},t(fabric.StaticCanvas.prototype,fabric.Observable),t(fabric.StaticCanvas.prototype,{backgroundColor:"rgba(0, 0, 0, 0)",backgroundImage:"",backgroundImageOpacity:1,backgroundImageStretch:!0,includeDefaultValues:!0,stateful:!0,renderOnAddition:!0,clipTo:null,CANVAS_WIDTH:600,CANVAS_HEIGHT:600,onBeforeScaleRotate:function(e){},onFpsUpdate:null,_initStatic:function(e,t){this._objects=[],this._createLowerCanvas(e),this._initOptions(t),t.overlayImage&&this.setOverlayImage(t.overlayImage,this.renderAll.bind(this)),t.backgroundImage&&this.setBackgroundImage(t.backgroundImage,this.renderAll.bind(this)),this.calcOffset()},calcOffset:function(){return this._offset=n(this.lowerCanvasEl),this},setOverlayImage:function(e,t){return fabric.util.loadImage(e,function(e){this.overlayImage=e,t&&t()},this)},setBackgroundImage:function(e,t,n){return fabric.util.loadImage(e,function(e){this.backgroundImage=e,n&&n.backgroundOpacity&&(this.backgroundOpacity=n.backgroundOpacity),n&&n.backgroundStretch&&(this.backgroundStretch=n.backgroundStretch),t&&t()},this)},_createCanvasElement:function(){var e=fabric.document.createElement("canvas");e.style||(e.style={});if(!e)throw s;return this._initCanvasElement(e),e},_initCanvasElement:function(e){typeof e.getContext=="undefined"&&typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager.initElement&&G_vmlCanvasManager.initElement(e);if(typeof e.getContext=="undefined")throw s},_initOptions:function(e){for(var t in e)this[t]=e[t];this.width=parseInt(this.lowerCanvasEl.width,10)||0,this.height=parseInt(this.lowerCanvasEl.height,10)||0,this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px"},_createLowerCanvas:function(e){this.lowerCanvasEl=fabric.util.getById(e)||this._createCanvasElement(),this._initCanvasElement(this.lowerCanvasEl),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(e){return this._setDimension("width",e)},setHeight:function(e){return this._setDimension("height",e)},setDimensions:function(e){for(var t in e)this._setDimension(t,e[t]);return this},_setDimension:function(e,t){return this.lowerCanvasEl[e]=t,this.lowerCanvasEl.style[e]=t+"px",this.upperCanvasEl&&(this.upperCanvasEl[e]=t,this.upperCanvasEl.style[e]=t+"px"),this.wrapperEl&&(this.wrapperEl.style[e]=t+"px"),this[e]=t,this.calcOffset(),this.renderAll(),this},getElement:function(){return this.lowerCanvasEl},getActiveObject:function(){return null},getActiveGroup:function(){return null},_draw:function(e,t){t&&t.render(e)},add:function(){this._objects.push.apply(this._objects,arguments);for(var e=arguments.length;e--;)this.stateful&&arguments[e].setupState(),arguments[e].setCoords();return this.renderOnAddition&&this.renderAll(),this},insertAt:function(e,t,n){return n?this._objects[t]=e:this._objects.splice(t,0,e),this.stateful&&e.setupState(),e.setCoords(),this.renderAll(),this},getObjects:function(){return this._objects},clearContext:function(e){return e.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this._objects.length=0,this.clearContext(this.contextContainer),this.contextTop&&this.clearContext(this.contextTop),this.renderAll(),this},renderAll:function(e){var t=this[e===!0&&this.interactive?"contextTop":"contextContainer"];this.contextTop&&this.clearContext(this.contextTop),(e===!1||typeof e=="undefined")&&this.clearContext(t);var n=this._objects.length,r=this.getActiveGroup(),i=new Date;this.clipTo&&(t.save(),t.beginPath(),this.clipTo(t),t.clip()),t.fillStyle=this.backgroundColor,t.fillRect(0,0,this.width,this.height),typeof this.backgroundImage=="object"&&(t.save(),t.globalAlpha=this.backgroundImageOpacity,this.backgroundImageStretch?t.drawImage(this.backgroundImage,0,0,this.width,this.height):t.drawImage(this.backgroundImage,0,0),t.restore());if(n)for(var s=0;s<n;++s)(!r||r&&this._objects[s]&&!r.contains(this._objects[s]))&&this._draw(t,this._objects[s]);this.clipTo&&t.restore(),r&&this._draw(this.contextTop,r),this.overlayImage&&(this.contextTop||this.contextContainer).drawImage(this.overlayImage,0,0);if(this.onFpsUpdate){var o=new Date-i;this.onFpsUpdate(~~(1e3/o))}return this.fire("after:render"),this},renderTop:function(){this.clearContext(this.contextTop||this.contextContainer),this.overlayImage&&(this.contextTop||this.contextContainer).drawImage(this.overlayImage,0,0),this.selection&&this._groupSelector&&this._drawSelection();var e=this.getActiveGroup();return e&&e.render(this.contextTop),this.fire("after:render"),this},toDataURL:function(e){this.renderAll(!0);var t=(this.upperCanvasEl||this.lowerCanvasEl).toDataURL("image/"+e);return this.renderAll(),t},toDataURLWithMultiplier:function(e,t){var n=this.getWidth(),r=this.getHeight(),i=n*t,s=r*t,o=this.getActiveObject();this.setWidth(i).setHeight(s),this.contextTop.scale(t,t),o&&this.deactivateAll(),this.width=n,this.height=r,this.renderAll(!0);var u=this.toDataURL(e);return this.contextTop.scale(1/t,1/t),this.setWidth(n).setHeight(r),o&&this.setActiveObject(o),this.renderAll(),u},getCenter:function(){return{top:this.getHeight()/2,left:this.getWidth()/2}},centerObjectH:function(e){return e.set("left",this.getCenter().left),this.renderAll(),this},centerObjectV:function(e){return e.set("top",this.getCenter().top),this.renderAll(),this},centerObject:function(e){return this.centerObjectH(e).centerObjectV(e)},toDatalessJSON:function(){return this.toDatalessObject()},toObject:function(){return this._toObjectMethod("toObject")},toDatalessObject:function(){return this._toObjectMethod("toDatalessObject")},_toObjectMethod:function(e){var t={objects:this._objects.map(function(t){if(!this.includeDefaultValues){var n=t.includeDefaultValues;t.includeDefaultValues=!1}var r=t[e]();return this.includeDefaultValues||(t.includeDefaultValues=n),r},this),background:this.backgroundColor};return this.backgroundImage&&(t.backgroundImage=this.backgroundImage.src,t.backgroundImageOpacity=this.backgroundImageOpacity,t.backgroundImageStretch=this.backgroundImageStretch),t},toSVG:function(){var e=['<?xml version="1.0" standalone="no" ?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" ','"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',"<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',this.width,'" ','height="',this.height,'" ','xml:space="preserve">',"<desc>Created with Fabric.js ",fabric.version,"</desc>",fabric.createSVGFontFacesMarkup(this.getObjects())];this.backgroundImage&&e.push('<image x="0" y="0" ','width="',this.width,'" height="',this.height,'" preserveAspectRatio="',this.backgroundImageStretch?"none":"defer",'" xlink:href="',this.backgroundImage.src,'" style="opacity:',this.backgroundImageOpacity,'"></image>');for(var t=0,n=this.getObjects(),r=n.length;t<r;t++)e.push(n[t].toSVG());return e.push("</svg>"),e.join("")},isEmpty:function(){return this._objects.length===0},remove:function(e){return r(this._objects,e),this.getActiveObject()===e&&this.discardActiveObject(),this.renderAll(),e},sendToBack:function(e){return r(this._objects,e),this._objects.unshift(e),this.renderAll()},bringToFront:function(e){return r(this._objects,e),this._objects.push(e),this.renderAll()},sendBackwards:function(e){var t=this._objects.indexOf(e),n=t;if(t!==0){for(var i=t-1;i>=0;--i)if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])){n=i;break}r(this._objects,e),this._objects.splice(n,0,e)}return this.renderAll()},bringForward:function(e){var t=this.getObjects(),n=t.indexOf(e),i=n;if(n!==t.length-1){for(var s=n+1,o=this._objects.length;s<o;++s)if(e.intersectsWithObject(t[s])||e.isContainedWithinObject(this._objects[s])){i=s;break}r(t,e),t.splice(i,0,e)}this.renderAll()},item:function(e){return this.getObjects()[e]},complexity:function(){return this.getObjects().reduce(function(e,t){return e+=t.complexity?t.complexity():0,e},0)},forEachObject:function(e,t){var n=this.getObjects(),r=n.length;while(r--)e.call(t,n[r],r,n);return this},dispose:function(){return this.clear(),this.interactive&&(i(this.upperCanvasEl,"mousedown",this._onMouseDown),i(this.upperCanvasEl,"mousemove",this._onMouseMove),i(fabric.window,"resize",this._onResize)),this},_resizeImageToFit:function(e){var t=e.width||e.offsetWidth,n=this.getWidth()/t;t&&(e.width=t*n)}}),fabric.StaticCanvas.prototype.toString=function(){return"#<fabric.Canvas ("+this.complexity()+"): "+"{ objects: "+this.getObjects().length+" }>"},t(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',toGrayscale:function(e){var t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),r=n.data,i=n.width,s=n.height,o,u,a,f;for(a=0;a<i;a++)for(f=0;f<s;f++)o=a*4*s+f*4,u=(r[o]+r[o+1]+r[o+2])/3,r[o]=u,r[o+1]=u,r[o+2]=u;t.putImageData(n,0,0)},supports:function(e){var t=fabric.document.createElement("canvas");typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager.initElement(t);if(!t||!t.getContext)return null;var n=t.getContext("2d");if(!n)return null;switch(e){case"getImageData":return typeof n.getImageData!="undefined";case"toDataURL":return typeof t.toDataURL!="undefined";default:return null}}}),fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject}(typeof exports!="undefined"?exports:this),function(){function d(){}var e=fabric.util.object.extend,t=fabric.util.getPointer,n=fabric.util.addListener,r=fabric.util.removeListener,i={tr:"ne-resize",br:"se-resize",bl:"sw-resize",tl:"nw-resize",ml:"w-resize",mt:"n-resize",mr:"e-resize",mb:"s-resize"},s=fabric.util.array.min,o=fabric.util.array.max,u=Math.sqrt,a=Math.pow,f=Math.atan2,l=Math.abs,c=Math.min,h=Math.max,p=.5;fabric.Canvas=function(e,t){t||(t={}),this._initStatic(e,t),this._initInteractive(),fabric.Canvas.activeInstance=this},d.prototype=fabric.StaticCanvas.prototype,fabric.Canvas.prototype=new d;var v={interactive:!0,selection:!0,selectionColor:"rgba(100, 100, 255, 0.3)",selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,freeDrawingColor:"rgb(0, 0, 0)",freeDrawingLineWidth:1,HOVER_CURSOR:"move",CURSOR:"default",ROTATION_CURSOR:"crosshair",CONTAINER_CLASS:"canvas-container",_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._freeDrawingXPoints=[],this._freeDrawingYPoints=[],this._initWrapperElement(),this._createUpperCanvas(),this._initEvents(),this.calcOffset()},_initEvents:function(){var e=this;this._onMouseDown=function(t){e.__onMouseDown(t),n(fabric.document,"mouseup",e._onMouseUp),fabric.isTouchSupported&&n(fabric.document,"touchend",e._onMouseUp),n(fabric.document,"mousemove",e._onMouseMove),fabric.isTouchSupported&&n(fabric.document,"touchmove",e._onMouseMove),r(e.upperCanvasEl,"mousemove",e._onMouseMove),fabric.isTouchSupported&&r(e.upperCanvasEl,"touchmove",e._onMouseMove)},this._onMouseUp=function(t){e.__onMouseUp(t),r(fabric.document,"mouseup",e._onMouseUp),fabric.isTouchSupported&&r(fabric.document,"touchend",e._onMouseUp),r(fabric.document,"mousemove",e._onMouseMove),fabric.isTouchSupported&&r(fabric.document,"touchmove",e._onMouseMove),n(e.upperCanvasEl,"mousemove",e._onMouseMove),fabric.isTouchSupported&&n(e.upperCanvasEl,"touchmove",e._onMouseMove)},this._onMouseMove=function(t){t.preventDefault&&t.preventDefault(),e.__onMouseMove(t)},this._onResize=function(t){e.calcOffset()},n(fabric.window,"resize",this._onResize),fabric.isTouchSupported?(n(this.upperCanvasEl,"touchstart",this._onMouseDown),n(this.upperCanvasEl,"touchmove",this._onMouseMove)):(n(this.upperCanvasEl,"mousedown",this._onMouseDown),n(this.upperCanvasEl,"mousemove",this._onMouseMove))},__onMouseUp:function(e){if(this.isDrawingMode&&this._isCurrentlyDrawing){this._finalizeDrawingPath();return}if(this._currentTransform){var t=this._currentTransform,n=t.target;n._scaling&&(n._scaling=!1);var r=this._objects.length;while(r--)this._objects[r].setCoords();this.stateful&&n.hasStateChanged()&&(n.isMoving=!1,this.fire("object:modified",{target:n}))}this._currentTransform=null,this._groupSelector&&this._findSelectedObjects(e);var i=this.getActiveGroup();i&&(i.setObjectsCoords(),i.set("isMoving",!1),this._setCursor(this.CURSOR)),this._groupSelector=null,this.renderAll(),this._setCursorFromEvent(e,n),this._setCursor("");var s=this;setTimeout(function(){s._setCursorFromEvent(e,n)},50),this.fire("mouse:up",{target:n,e:e})},__onMouseDown:function(e){var t="which"in e?e.which==1:e.button==1;if(!t&&!fabric.isTouchSupported)return;if(this.isDrawingMode){this._prepareForDrawing(e),this._captureDrawingPath(e);return}if(this._currentTransform)return;var n=this.findTarget(e),r=this.getPointer(e),i=this.getActiveGroup(),s;if(this._shouldClearSelection(e))this._groupSelector={ex:r.x,ey:r.y,top:0,left:0},this.deactivateAllWithDispatch();else{this.stateful&&n.saveState(),(s=n._findTargetCorner(e,this._offset))&&this.onBeforeScaleRotate(n),this._setupCurrentTransform(e,n);var o=e.shiftKey&&(i||this.getActiveObject())&&this.selection;o?this._handleGroupLogic(e,n):(n!==this.getActiveGroup()&&this.deactivateAll(),this.setActiveObject(n,e))}this.renderAll(),this.fire("mouse:down",{target:n,e:e})},__onMouseMove:function(e){if(this.isDrawingMode){this._isCurrentlyDrawing&&this._captureDrawingPath(e);return}var n=this._groupSelector;if(n!==null){var r=t(e);n.left=r.x-this._offset.left-n.ex,n.top=r.y-this._offset.top-n.ey,this.renderTop()}else if(!this._currentTransform){var i=this.upperCanvasEl.style,s=this.findTarget(e);if(!s){for(var o=this._objects.length;o--;)this._objects[o]&&!this._objects[o].active&&this._objects[o].setActive(!1);i.cursor=this.CURSOR}else this._setCursorFromEvent(e,s),s.isActive()&&s.setCornersVisibility&&s.setCornersVisibility(!0)}else{var r=t(e),u=r.x,a=r.y;this._currentTransform.target.isMoving=!0,this._currentTransform.action==="rotate"?(e.shiftKey||(this._rotateObject(u,a),this.fire("object:rotating",{target:this._currentTransform.target})),this._currentTransform.target.hasRotatingPoint||(this._scaleObject(u,a),this.fire("object:scaling",{target:this._currentTransform.target}))):this._currentTransform.action==="scale"?(this._scaleObject(u,a),this.fire("object:scaling",{target:this._currentTransform.target})):this._currentTransform.action==="scaleX"?(this._scaleObject(u,a,"x"),this.fire("object:scaling",{target:this._currentTransform.target})):this._currentTransform.action==="scaleY"?(this._scaleObject(u,a,"y"),this.fire("object:scaling",{target:this._currentTransform.target})):(this._translateObject(u,a),this.fire("object:moving",{target:this._currentTransform.target})),this.renderAll()}this.fire("mouse:move",{target:s,e:e})},containsPoint:function(e,t){var n=this.getPointer(e),r=this._normalizePointer(t,n),i=r.x,s=r.y,o=t._getImageLines(t.oCoords),u=t._findCrossPoints(i,s,o);return u&&u%2===1||t._findTargetCorner(e,this._offset)?!0:!1},_normalizePointer:function(e,t){var n=this.getActiveGroup(),r=t.x,i=t.y,s=n&&e.type!=="group"&&n.contains(e);return s&&(r-=n.left,i-=n.top),{x:r,y:i}},_shouldClearSelection:function(e){var t=this.findTarget(e),n=this.getActiveGroup();return!t||t&&n&&!n.contains(t)&&n!==t&&!e.shiftKey},_setupCurrentTransform:function(e,n){var r="drag",i,s=t(e);if(i=n._findTargetCorner(e,this._offset))r=i==="ml"||i==="mr"?"scaleX":i==="mt"||i==="mb"?"scaleY":i==="mtr"||i==="mbr"?"rotate":n.hasRotatingPoint?"scale":"rotate";this._currentTransform={target:n,action:r,scaleX:n.scaleX,scaleY:n.scaleY,offsetX:s.x-n.left,offsetY:s.y-n.top,ex:s.x,ey:s.y,left:n.left,top:n.top,theta:n.theta,width:n.width*n.scaleX}
3
- ,this._currentTransform.original={left:n.left,top:n.top}},_handleGroupLogic:function(e,t){if(t.isType("group")){t=this.findTarget(e,!0);if(!t||t.isType("group"))return}var n=this.getActiveGroup();if(n)n.contains(t)?(n.remove(t),t.setActive(!1),n.size()===1&&this.discardActiveGroup()):n.add(t),this.fire("selection:created",{target:n,e:e}),n.setActive(!0);else{if(this._activeObject&&t!==this._activeObject){var r=new fabric.Group([this._activeObject,t]);this.setActiveGroup(r),n=this.getActiveGroup()}t.setActive(!0)}n&&n.saveCoords()},_prepareForDrawing:function(e){this._isCurrentlyDrawing=!0,this.discardActiveObject().renderAll();var t=this.getPointer(e);this._freeDrawingXPoints.length=this._freeDrawingYPoints.length=0,this._freeDrawingXPoints.push(t.x),this._freeDrawingYPoints.push(t.y),this.contextTop.beginPath(),this.contextTop.moveTo(t.x,t.y),this.contextTop.strokeStyle=this.freeDrawingColor,this.contextTop.lineWidth=this.freeDrawingLineWidth,this.contextTop.lineCap=this.contextTop.lineJoin="round"},_captureDrawingPath:function(e){var t=this.getPointer(e);this._freeDrawingXPoints.push(t.x),this._freeDrawingYPoints.push(t.y),this.contextTop.lineTo(t.x,t.y),this.contextTop.stroke()},_finalizeDrawingPath:function(){this.contextTop.closePath(),this._isCurrentlyDrawing=!1;var e=s(this._freeDrawingXPoints),t=s(this._freeDrawingYPoints),n=o(this._freeDrawingXPoints),r=o(this._freeDrawingYPoints),i=this.contextTop,u=[],a,f,l=this._freeDrawingXPoints,c=this._freeDrawingYPoints;u.push("M ",l[0]-e," ",c[0]-t," ");for(var h=1;a=l[h],f=c[h];h++)u.push("L ",a-e," ",f-t," ");u=u.join("");if(u==="M 0 0 L 0 0 ")return;var p=new fabric.Path(u);p.fill=null,p.stroke=this.freeDrawingColor,p.strokeWidth=this.freeDrawingLineWidth,this.add(p),p.set("left",e+(n-e)/2).set("top",t+(r-t)/2).setCoords(),this.renderAll(),this.fire("path:created",{path:p})},_translateObject:function(e,t){var n=this._currentTransform.target;n.lockMovementX||n.set("left",e-this._currentTransform.offsetX),n.lockMovementY||n.set("top",t-this._currentTransform.offsetY)},_scaleObject:function(e,t,n){var r=this._currentTransform,i=this._offset,s=r.target;if(s.lockScalingX&&s.lockScalingY)return;var o=u(a(r.ey-r.top-i.top,2)+a(r.ex-r.left-i.left,2)),f=u(a(t-r.top-i.top,2)+a(e-r.left-i.left,2));s._scaling=!0,n?n==="x"&&!s.lockUniScaling?s.lockScalingX||s.set("scaleX",r.scaleX*f/o):n==="y"&&!s.lockUniScaling&&(s.lockScalingY||s.set("scaleY",r.scaleY*f/o)):(s.lockScalingX||s.set("scaleX",r.scaleX*f/o),s.lockScalingY||s.set("scaleY",r.scaleY*f/o))},_rotateObject:function(e,t){var n=this._currentTransform,r=this._offset;if(n.target.lockRotation)return;var i=f(n.ey-n.top-r.top,n.ex-n.left-r.left),s=f(t-n.top-r.top,e-n.left-r.left);n.target.set("theta",s-i+n.theta)},_setCursor:function(e){this.upperCanvasEl.style.cursor=e},_setCursorFromEvent:function(e,t){var n=this.upperCanvasEl.style;if(!t)return n.cursor=this.CURSOR,!1;var r=this.getActiveGroup(),s=!!t._findTargetCorner&&(!r||!r.contains(t))&&t._findTargetCorner(e,this._offset);if(!s)n.cursor=this.HOVER_CURSOR;else if(s in i)n.cursor=i[s];else{if(s!=="mtr"&&s!=="mbr")return n.cursor=this.CURSOR,!1;n.cursor=this.ROTATION_CURSOR}return!0},_drawSelection:function(){var e=this._groupSelector,t=e.left,n=e.top,r=l(t),i=l(n);this.contextTop.fillStyle=this.selectionColor,this.contextTop.fillRect(e.ex-(t>0?0:-t),e.ey-(n>0?0:-n),r,i),this.contextTop.lineWidth=this.selectionLineWidth,this.contextTop.strokeStyle=this.selectionBorderColor,this.contextTop.strokeRect(e.ex+p-(t>0?0:r),e.ey+p-(n>0?0:i),r,i)},_findSelectedObjects:function(e){var t,n,r=[],i=this._groupSelector.ex,s=this._groupSelector.ey,o=i+this._groupSelector.left,u=s+this._groupSelector.top,a,f=new fabric.Point(c(i,o),c(s,u)),l=new fabric.Point(h(i,o),h(s,u));for(var p=0,d=this._objects.length;p<d;++p){a=this._objects[p];if(!a)continue;(a.intersectsWithRect(f,l)||a.isContainedWithinRect(f,l))&&this.selection&&a.selectable&&(a.setActive(!0),r.push(a))}if(r.length===1)this.setActiveObject(r[0],e);else if(r.length>1){var r=new fabric.Group(r);this.setActiveGroup(r),r.saveCoords(),this.fire("selection:created",{target:r})}this.renderAll()},findTarget:function(e,t){var n,r=this.getPointer(e),i=this.getActiveGroup();if(i&&!t&&this.containsPoint(e,i))return n=i,n;for(var s=this._objects.length;s--;)if(this._objects[s]&&this.containsPoint(e,this._objects[s])){n=this._objects[s],this.relatedTarget=n;break}if(n&&n.selectable)return n},getPointer:function(e){var n=t(e);return{x:n.x-this._offset.left,y:n.y-this._offset.top}},_createUpperCanvas:function(){this.upperCanvasEl=this._createCanvasElement(),this.upperCanvasEl.className="upper-canvas",this.wrapperEl.appendChild(this.upperCanvasEl),this._applyCanvasStyle(this.upperCanvasEl),this.contextTop=this.upperCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=fabric.util.wrapElement(this.lowerCanvasEl,"div",{"class":this.CONTAINER_CLASS}),fabric.util.setStyle(this.wrapperEl,{width:this.getWidth()+"px",height:this.getHeight()+"px",position:"relative"}),fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(e){var t=this.getWidth()||e.width,n=this.getHeight()||e.height;fabric.util.setStyle(e,{position:"absolute",width:t+"px",height:n+"px",left:0,top:0}),e.width=t,e.height=n,fabric.util.makeElementUnselectable(e)},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},setActiveObject:function(e,t){return this._activeObject&&this._activeObject.setActive(!1),this._activeObject=e,e.setActive(!0),this.renderAll(),this.fire("object:selected",{target:e,e:t}),this},getActiveObject:function(){return this._activeObject},discardActiveObject:function(){return this._activeObject&&this._activeObject.setActive(!1),this._activeObject=null,this},setActiveGroup:function(e){return this._activeGroup=e,this},getActiveGroup:function(){return this._activeGroup},discardActiveGroup:function(){var e=this.getActiveGroup();return e&&e.destroy(),this.setActiveGroup(null)},deactivateAll:function(){var e=this.getObjects(),t=0,n=e.length;for(;t<n;t++)e[t].setActive(!1);return this.discardActiveGroup(),this.discardActiveObject(),this},deactivateAllWithDispatch:function(){var e=this.getActiveGroup()||this.getActiveObject();return e&&this.fire("before:selection:cleared",{target:e}),this.deactivateAll(),e&&this.fire("selection:cleared"),this}};fabric.Canvas.prototype.toString=fabric.StaticCanvas.prototype.toString,e(fabric.Canvas.prototype,v);for(var m in fabric.StaticCanvas)m!=="prototype"&&(fabric.Canvas[m]=fabric.StaticCanvas[m]);fabric.isTouchSupported&&(fabric.Canvas.prototype._setCursorFromEvent=function(){}),fabric.Element=fabric.Canvas}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(e,t){t=t||{};var n=function(){},r=t.onComplete||n,i=t.onChange||n,s=this;return fabric.util.animate({startValue:e.get("left"),endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(t){e.set("left",t),s.renderAll(),i()},onComplete:function(){e.setCoords(),r()}}),this},fxCenterObjectV:function(e,t){t=t||{};var n=function(){},r=t.onComplete||n,i=t.onChange||n,s=this;return fabric.util.animate({startValue:e.get("top"),endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(t){e.set("top",t),s.renderAll(),i()},onComplete:function(){e.setCoords(),r()}}),this},fxRemove:function(e,t){t=t||{};var n=function(){},r=t.onComplete||n,i=t.onChange||n,s=this;return fabric.util.animate({startValue:e.get("opacity"),endValue:0,duration:this.FX_DURATION,onStart:function(){e.setActive(!1)},onChange:function(t){e.set("opacity",t),s.renderAll(),i()},onComplete:function(){s.remove(e),r()}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromDatalessJSON:function(e,t){if(!e)return;var n=typeof e=="string"?JSON.parse(e):e;if(!n||n&&!n.objects)return;this.clear(),this.backgroundColor=n.background,this._enlivenDatalessObjects(n.objects,t)},_enlivenDatalessObjects:function(e,t){function n(e,n){r.insertAt(e,n,!0),e.setCoords(),++i===s&&t&&t()}var r=this,i=0,s=e.length;s===0&&t&&t();try{e.forEach(function(e,t){var r=e.paths?"paths":"path",i=e[r];delete e[r];if(typeof i!="string")switch(e.type){case"image":fabric[fabric.util.string.capitalize(e.type)].fromObject(e,function(e){n(e,t)});break;default:var s=fabric[fabric.util.string.camelize(fabric.util.string.capitalize(e.type))];s&&s.fromObject&&(i&&(e[r]=i),n(s.fromObject(e),t))}else if(e.type==="image")fabric.util.loadImage(i,function(r){var s=new fabric.Image(r);s.setSourcePath(i),fabric.util.object.extend(s,e),s.setAngle(e.angle),n(s,t)});else if(e.type==="text"){e.path=i;var o=fabric.Text.fromObject(e),u=function(){Object.prototype.toString.call(fabric.window.opera)==="[object Opera]"?setTimeout(function(){n(o,t)},500):n(o,t)};fabric.util.getScript(i,u)}else fabric.loadSVGFromURL(i,function(r,s){if(r.length>1)var o=new fabric.PathGroup(r,e);else var o=r[0];o.setSourcePath(i),o instanceof fabric.PathGroup||(fabric.util.object.extend(o,e),typeof e.angle!="undefined"&&o.setAngle(e.angle)),n(o,t)})},this)}catch(o){fabric.log(o.message)}},loadFromJSON:function(e,t){if(!e)return;var n=JSON.parse(e);if(!n||n&&!n.objects)return;this.clear();var r=this;return this._enlivenObjects(n.objects,function(){r.backgroundColor=n.background,n.backgroundImage&&(r.setBackgroundImage(n.backgroundImage),r.backgroundImageOpacity=n.backgroundImageOpacity,r.backgroundImageStretch=n.backgroundImageStretch),t&&t()}),this},_enlivenObjects:function(e,t){var n=0,r=e.filter(function(e){return e.type==="image"}).length,i=this;e.forEach(function(e,s){if(!e.type)return;switch(e.type){case"image":case"font":fabric[fabric.util.string.capitalize(e.type)].fromObject(e,function(e){i.insertAt(e,s,!0),++n===r&&t&&t()});break;default:var o=fabric[fabric.util.string.camelize(fabric.util.string.capitalize(e.type))];o&&o.fromObject&&i.insertAt(o.fromObject(e),s,!0)}}),r===0&&t&&t()},_toDataURL:function(e,t){this.clone(function(n){t(n.toDataURL(e))})},_toDataURLWithMultiplier:function(e,t,n){this.clone(function(r){n(r.toDataURLWithMultiplier(e,t))})},clone:function(e){var t=JSON.stringify(this);this.cloneWithoutData(function(n){n.loadFromJSON(t,function(){e&&e(n)})})},cloneWithoutData:function(e){var t=fabric.document.createElement("canvas");t.width=this.getWidth(),t.height=this.getHeight();var n=this.__clone||(this.__clone=new fabric.Canvas(t));n.clipTo=this.clipTo,e&&e(n)}}),function(e){"use strict";var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.object.clone,i=t.util.toFixed,s=t.util.string.capitalize,o=t.util.getPointer,u=t.util.degreesToRadians,a=Array.prototype.slice;if(t.Object)return;t.Object=t.util.createClass({type:"object",includeDefaultValues:!0,NUM_FRACTION_DIGITS:2,MIN_SCALE_LIMIT:.1,stateProperties:"top left width height scaleX scaleY flipX flipY theta angle opacity cornersize fill overlayFill stroke strokeWidth fillRule borderScaleFactor transformMatrix selectable".split(" "),top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,theta:0,opacity:1,angle:0,cornersize:12,padding:0,borderColor:"rgba(102,153,255,0.75)",cornerColor:"rgba(102,153,255,0.5)",fill:"rgb(0,0,0)",fillRule:"source-over",overlayFill:null,stroke:null,strokeWidth:1,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,selectable:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!1,callSuper:function(e){var t=this.constructor.superclass.prototype[e];return arguments.length>1?t.apply(this,a.call(arguments,1)):t.call(this)},initialize:function(e){e&&this.setOptions(e)},setOptions:function(e){var t=this.stateProperties.length,n;while(t--)n=this.stateProperties[t],n in e&&this.set(n,e[n])},transform:function(e){e.globalAlpha=this.opacity,e.translate(this.left,this.top),e.rotate(this.theta),e.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1))},toObject:function(){var e={type:this.type,left:i(this.left,this.NUM_FRACTION_DIGITS),top:i(this.top,this.NUM_FRACTION_DIGITS),width:i(this.width,this.NUM_FRACTION_DIGITS),height:i(this.height,this.NUM_FRACTION_DIGITS),fill:this.fill,overlayFill:this.overlayFill,stroke:this.stroke,strokeWidth:this.strokeWidth,scaleX:i(this.scaleX,this.NUM_FRACTION_DIGITS),scaleY:i(this.scaleY,this.NUM_FRACTION_DIGITS),angle:i(this.getAngle(),this.NUM_FRACTION_DIGITS),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,this.NUM_FRACTION_DIGITS),selectable:this.selectable,hasControls:this.hasControls,hasBorders:this.hasBorders,hasRotatingPoint:this.hasRotatingPoint};return this.includeDefaultValues||(e=this._removeDefaultValues(e)),e},toDatalessObject:function(){return this.toObject()},getSvgStyles:function(){return["stroke: ",this.stroke?this.stroke:"none","; ","stroke-width: ",this.strokeWidth?this.strokeWidth:"0","; ","fill: ",this.fill?this.fill:"none","; ","opacity: ",this.opacity?this.opacity:"1",";"].join("")},getSvgTransform:function(){var e=this.getAngle();return["translate(",i(this.left,2)," ",i(this.top,2),")",e!==0?" rotate("+i(e,2)+")":"",this.scaleX===1&&this.scaleY===1?"":" scale("+i(this.scaleX,2)+" "+i(this.scaleY,2)+")"].join("")},_removeDefaultValues:function(e){var n=t.Object.prototype.options;return n&&this.stateProperties.forEach(function(t){e[t]===n[t]&&delete e[t]}),e},isActive:function(){return!!this.active},setActive:function(e){return this.active=!!e,this},toString:function(){return"#<fabric."+s(this.type)+">"},set:function(e,t){var n=(e==="scaleX"||e==="scaleY")&&t<this.MIN_SCALE_LIMIT;n&&(t=this.MIN_SCALE_LIMIT);if(typeof e=="object")for(var r in e)this.set(r,e[r]);else e==="angle"?this.setAngle(t):this[e]=t;return this},toggle:function(e){var t=this.get(e);return typeof t=="boolean"&&this.set(e,!t),this},setSourcePath:function(e){return this.sourcePath=e,this},get:function(e){return e==="angle"?this.getAngle():this[e]},render:function(e,t){if(this.width===0||this.height===0)return;e.save();var n=this.transformMatrix;n&&e.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),t||this.transform(e),this.stroke&&(e.lineWidth=this.strokeWidth,e.strokeStyle=this.stroke),this.overlayFill?e.fillStyle=this.overlayFill:this.fill&&(e.fillStyle=this.fill),this._render(e,t),this.active&&!t&&(this.drawBorders(e),this.hideCorners||this.drawCorners(e)),e.restore()},getWidth:function(){return this.width*this.scaleX},getHeight:function(){return this.height*this.scaleY},scale:function(e){return this.scaleX=e,this.scaleY=e,this},scaleToWidth:function(e){return this.scale(e/this.width)},scaleToHeight:function(e){return this.scale(e/this.height)},setOpacity:function(e){return this.set("opacity",e),this},getAngle:function(){return this.theta*180/Math.PI},setAngle:function(e){return this.theta=e/180*Math.PI,this.angle=e,this},setCoords:function(){this.currentWidth=this.width*this.scaleX,this.currentHeight=this.height*this.scaleY,this._hypotenuse=Math.sqrt(Math.pow(this.currentWidth/2,2)+Math.pow(this.currentHeight/2,2)),this._angle=Math.atan(this.currentHeight/this.currentWidth);var e=Math.cos(this._angle+this.theta)*this._hypotenuse,t=Math.sin(this._angle+this.theta)*this._hypotenuse,n=this.theta,r=Math.sin(n),i=Math.cos(n),s={x:this.left-e,y:this.top-t},o={x:s.x+this.currentWidth*i,y:s.y+this.currentWidth*r},u={x:o.x-this.currentHeight*r,y:o.y+this.currentHeight*i},a={x:s.x-this.currentHeight*r,y:s.y+this.currentHeight*i},f={x:s.x-this.currentHeight/2*r,y:s.y+this.currentHeight/2*i},l={x:s.x+this.currentWidth/2*i,y:s.y+this.currentWidth/2*r},c={x:o.x-this.currentHeight/2*r,y:o.y+this.currentHeight/2*i},h={x:a.x+this.currentWidth/2*i,y:a.y+this.currentWidth/2*r},p={x:s.x+this.currentWidth/2*i,y:s.y+this.currentWidth/2*r},d={x:s.x+this.currentWidth/2*i,y:s.y+this.currentWidth/2*r};return this.oCoords={tl:s,tr:o,br:u,bl:a,ml:f,mt:l,mr:c,mb:h,mtr:p,mbr:d},this._setCornerCoords(),this},drawBorders:function(e){if(!this.hasBorders)return;var t=this.padding,n=t*2;e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,e.strokeStyle=this.borderColor;var r=1/(this.scaleX<this.MIN_SCALE_LIMIT?this.MIN_SCALE_LIMIT:this.scaleX),i=1/(this.scaleY<this.MIN_SCALE_LIMIT?this.MIN_SCALE_LIMIT:this.scaleY);e.lineWidth=1/this.borderScaleFactor,e.scale(r,i);var s=this.getWidth(),o=this.getHeight();e.strokeRect(~~(-(s/2)-t)+.5,~~(-(o/2)-t)+.5,~~(s+n),~~(o+n));if(this.hasRotatingPoint&&!this.hideCorners&&!this.lockRotation){var u=-o/2,a=-s/2;e.beginPath(),e.moveTo(0,u),e.lineTo(0,u-40),e.closePath(),e.stroke()}return e.restore(),this},drawCorners:function(e){if(!this.hasControls)return;var t=this.cornersize,n=t/2,r=this.padding,i=-(this.width/2),s=-(this.height/2),o,u,a=t/this.scaleX,f=t/this.scaleY,l=(r+n)/this.scaleY,c=(r+n)/this.scaleX,h=(r+n-t)/this.scaleX,p=(r+n-t)/this.scaleY,d=this.height;return e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,e.fillStyle=this.cornerColor,o=i-c,u=s-l,e.fillRect(o,u,a,f),o=i+this.width-c,u=s-l,e.fillRect(o,u,a,f),o=i-c,u=s+d+p,e.fillRect(o,u,a,f),o=i+this.width+h,u=s+d+p,e.fillRect(o,u,a,f),o=i+this.width/2-c,u=s-l,e.fillRect(o,u,a,f),o=i+this.width/2-c,u=s+d+p,e.fillRect(o,u,a,f),o=i+this.width+h,u=s+d/2-l,e.fillRect(o,u,a,f),o=i-c,u=s+d/2-l,e.fillRect(o,u,a,f),this.hasRotatingPoint&&(o=i+this.width/2-c,u=s-45/this.scaleY,e.fillRect(o,u,a,f)),e.restore(),this},clone:function(e){return this.constructor.fromObject?this.constructor.fromObject(this.toObject(),e):new t.Object(this.toObject())},cloneAsImage:function(e){if(t.Image){var n=new Image;n.onload=function(){e&&e(new t.Image(n),r),n=n.onload=null};var r={angle:this.get("angle"),flipX:this.get("flipX"),flipY:this.get("flipY")};this.set("angle",0).set("flipX",!1).set("flipY",!1),this.toDataURL(function(e){n.src=e})}return this},toDataURL:function(e){function i(t){t.left=n.width/2,t.top=n.height/2,t.setActive(!1),r.add(t);var i=r.toDataURL("png");r.dispose(),r=t=null,e&&e(i)}var n=t.document.createElement("canvas");!n.getContext&&typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager.initElement(n),n.width=this.getWidth(),n.height=this.getHeight(),t.util.wrapElement(n,"div");var r=new t.Canvas(n);r.backgroundColor="transparent",r.renderAll(),this.constructor.async?this.clone(i):i(this.clone())},hasStateChanged:function(){return this.stateProperties.some(function(e){return this[e]!==this.originalState[e]},this)},saveState:function(){return this.stateProperties.forEach(function(e){this.originalState[e]=this.get(e)},this),this},setupState:function(){this.originalState={},this.saveState()},intersectsWithRect:function(e,n){var r=this.oCoords,i=new t.Point(r.tl.x,r.tl.y),s=new t.Point(r.tr.x,r.tr.y),o=new t.Point(r.bl.x,r.bl.y),u=new t.Point(r.br.x,r.br.y),a=t.Intersection.intersectPolygonRectangle([i,s,u,o],e,n);return a.status==="Intersection"},intersectsWithObject:function(e){function n(e){return{tl:new t.Point(e.tl.x,e.tl.y),tr:new t.Point(e.tr.x,e.tr.y),bl:new t.Point(e.bl.x,e.bl.y),br:new t.Point(e.br.x,e.br.y)}}var r=n(this.oCoords),i=n(e.oCoords),s=t.Intersection.intersectPolygonPolygon([r.tl,r.tr,r.br,r.bl],[i.tl,i.tr,i.br,i.bl]);return s.status==="Intersection"},isContainedWithinObject:function(e){return this.isContainedWithinRect(e.oCoords.tl,e.oCoords.br)},isContainedWithinRect:function(e,n){var r=this.oCoords,i=new t.Point(r.tl.x,r.tl.y),s=new t.Point(r.tr.x,r.tr.y),o=new t.Point(r.bl.x,r.bl.y),u=new t.Point(r.br.x,r.br.y);return i.x>e.x&&s.x<n.x&&i.y>e.y&&o.y<n.y},isType:function(e){return this.type===e},_findTargetCorner:function(e,t){if(!this.hasControls)return!1;var n=o(e),r=n.x-t.left,i=n.y-t.top,s,u;for(var a in this.oCoords){u=this._getImageLines(this.oCoords[a].corner,a),s=this._findCrossPoints(r,i,u);if(s%2==1&&s!=0)return this.__corner=a,a}return!1},_findCrossPoints:function(e,t,n){var r,i,s,o,u,a,f=0,l;for(var c in n){l=n[c];if(l.o.y<t&&l.d.y<t)continue;if(l.o.y>=t&&l.d.y>=t)continue;l.o.x==l.d.x&&l.o.x>=e?(u=l.o.x,a=t):(r=0,i=(l.d.y-l.o.y)/(l.d.x-l.o.x),s=t-r*e,o=l.o.y-i*l.o.x,u=-(s-o)/(r-i),a=s+r*u),u>=e&&(f+=1);if(f==2)break}return f},_getImageLines:function(e,t){return{topline:{o:e.tl,d:e.tr},rightline:{o:e.tr,d:e.br},bottomline:{o:e.br,d:e.bl},leftline:{o:e.bl,d:e.tl}}},_setCornerCoords:function(){var e=this.oCoords,t=u(45-this.getAngle()),n=Math.sqrt(2*Math.pow(this.cornersize,2))/2,r=n*Math.cos(t),i=n*Math.sin(t),s=Math.sin(this.theta),o=Math.cos(this.theta);e.tl.corner={tl:{x:e.tl.x-i,y:e.tl.y-r},tr:{x:e.tl.x+r,y:e.tl.y-i},bl:{x:e.tl.x-r,y:e.tl.y+i},br:{x:e.tl.x+i,y:e.tl.y+r}},e.tr.corner={tl:{x:e.tr.x-i,y:e.tr.y-r},tr:{x:e.tr.x+r,y:e.tr.y-i},br:{x:e.tr.x+i,y:e.tr.y+r},bl:{x:e.tr.x-r,y:e.tr.y+i}},e.bl.corner={tl:{x:e.bl.x-i,y:e.bl.y-r},bl:{x:e.bl.x-r,y:e.bl.y+i},br:{x:e.bl.x+i,y:e.bl.y+r},tr:{x:e.bl.x+r,y:e.bl.y-i}},e.br.corner={tr:{x:e.br.x+r,y:e.br.y-i},bl:{x:e.br.x-r,y:e.br.y+i},br:{x:e.br.x+i,y:e.br.y+r},tl:{x:e.br.x-i,y:e.br.y-r}},e.ml.corner={tl:{x:e.ml.x-i,y:e.ml.y-r},tr:{x:e.ml.x+r,y:e.ml.y-i},bl:{x:e.ml.x-r,y:e.ml.y+i},br:{x:e.ml.x+i,y:e.ml.y+r}},e.mt.corner={tl:{x:e.mt.x-i,y:e.mt.y-r},tr:{x:e.mt.x+r,y:e.mt.y-i},bl:{x:e.mt.x-r,y:e.mt.y+i},br:{x:e.mt.x+i,y:e.mt.y+r}},e.mr.corner={tl:{x:e.mr.x-i,y:e.mr.y-r},tr:{x:e.mr.x+r,y:e.mr.y-i},bl:{x:e.mr.x-r,y:e.mr.y+i},br:{x:e.mr.x+i,y:e.mr.y+r}},e.mb.corner={tl:{x:e.mb.x-i,y:e.mb.y-r},tr:{x:e.mb.x+r,y:e.mb.y-i},bl:{x:e.mb.x-r,y:e.mb.y+i},br:{x:e.mb.x+i,y:e.mb.y+r}};var a=40;e.mtr.corner={tl:{x:e.mtr.x-i+s*a,y:e.mtr.y-r-o*a},tr:{x:e.mtr.x+r+s*a,y:e.mtr.y-i-o*a},bl:{x:e.mtr.x-r+s*a,y:e.mtr.y+i-o*a},br:{x:e.mtr.x+i+s*a,y:e.mtr.y+r-o*a}};var f=-a-this.currentHeight;e.mbr.corner={tl:{x:e.mbr.x-i+s*f,y:e.mbr.y-r-o*f},tr:{x:e.mbr.x+r+s*f,y:e.mbr.y-i-o*f},bl:{x:e.mbr.x-r+s*f,y:e.mbr.y+i-o*f},br:{x:e.mbr.x+i+s*f,y:e.mbr.y+r-o*f}}},toGrayscale:function(){var e=this.get("fill");return e&&this.set("overlayFill",(new t.Color(e)).toGrayscale().toRgb()),this},complexity:function(){return 0},toJSON:function(){return this.toObject()},setGradientFill:function(e,n){this.set("fill",t.Gradient.forObject(this,e,n))},animate:function(e,n,r){var i=this;"from"in r||(r.from=this.get(e)),/[+-]/.test(n.charAt(0))&&(n=this.get(e)+parseFloat(n)),t.util.animate({startValue:r.from,endValue:n,byValue:r.by,easing:r.easing,duration:r.duration,onChange:function(t){i.set(e,t),r.onChange&&r.onChange()},onComplete:function(){i.setCoords(),r.onComplete&&r.onComplete()}})}}),t.Object.prototype.rotate=t.Object.prototype.setAngle;var f=t.Object.prototype;for(var l=f.stateProperties.length;l--;){var c=f.stateProperties[l],h=c.charAt(0).toUpperCase()+c.slice(1),p="set"+h,d="get"+h;f[d]||(f[d]=function(e){return new Function('return this.get("'+e+'")')}(c)),f[p]||(f[p]=function(e){return new Function("value",'return this.set("'+e+'", value)')}(c))}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.Object.prototype.set,i={x1:1,x2:1,y1:1,y2:1};if(t.Line){t.warn("fabric.Line is already defined");return}t.Line=t.util.createClass(t.Object,{type:"line",initialize:function(e,t){e||(e=[0,0,0,0]),this.callSuper("initialize",t),this.set("x1",e[0]),this.set("y1",e[1]),this.set("x2",e[2]),this.set("y2",e[3]),this._setWidthHeight()},_setWidthHeight:function(){this.set("width",this.x2-this.x1||1),this.set("height",this.y2-this.y1||1),this.set("left",this.x1+this.width/2),this.set("top",this.y1+this.height/2)},set:function(e,t){return r.call(this,e,t),e in i&&this._setWidthHeight(),this},_render:function(e){e.beginPath(),e.moveTo(this.width===1?0:-this.width/2,this.height===1?0:-this.height/2),e.lineTo(this.width===1?0:this.width/2,this.height===1?0:this.height/2),e.lineWidth=this.strokeWidth;var t=e.strokeStyle;e.strokeStyle=e.fillStyle,e.stroke(),e.strokeStyle=t},complexity:function(){return 1},toObject:function(){return n(this.callSuper("toObject"),{x1:this.get("x1"),y1:this.get("y1"),x2:this.get("x2"),y2:this.get("y2")})},toSVG:function(){return["<line ",'x1="',this.get("x1"),'" ','y1="',this.get("y1"),'" ','x2="',this.get("x2"),'" ','y2="',this.get("y2"),'" ','style="',this.getSvgStyles(),'" ',"/>"].join("")}}),t.Line.ATTRIBUTE_NAMES="x1 y1 x2 y2 stroke stroke-width transform".split(" "),t.Line.fromElement=function(e,r){var i=t.parseAttributes(e,t.Line.ATTRIBUTE_NAMES),s=[i.x1||0,i.y1||0,i.x2||0,i.y2||0];return new t.Line(s,n(i,r))},t.Line.fromObject=function(e){var n=[e.x1,e.y1,e.x2,e.y2];return new t.Line(n,e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function i(e){return"radius"in e&&e.radius>0}var t=e.fabric||(e.fabric={}),n=Math.PI*2,r=t.util.object.extend;if(t.Circle){t.warn("fabric.Circle is already defined.");return}t.Circle=t.util.createClass(t.Object,{type:"circle",initialize:function(e){e=e||{},this.set("radius",e.radius||0),this.callSuper("initialize",e);var t=this.get("radius")*2;this.set("width",t).set("height",t)},toObject:function(){return r(this.callSuper("toObject"),{radius:this.get("radius")})},toSVG:function(){return'<circle cx="0" cy="0" r="'+this.radius+'" '+'style="'+this.getSvgStyles()+'" '+'transform="'+this.getSvgTransform()+'" '+"/>"},_render:function(e,t){e.beginPath(),e.globalAlpha*=this.opacity,e.arc(t?this.left:0,t?this.top:0,this.radius,0,n,!1),e.closePath(),this.fill&&e.fill(),this.stroke&&e.stroke()},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(e){this.radius=e,this.set("width",e*2).set("height",e*2)},complexity:function(){return 1}}),t.Circle.ATTRIBUTE_NAMES="cx cy r fill fill-opacity opacity stroke stroke-width transform".split(" "),t.Circle.fromElement=function(e,n){n||(n={});var s=t.parseAttributes(e,t.Circle.ATTRIBUTE_NAMES);if(!i(s))throw Error("value of `r` attribute is required and can not be negative");return"left"in s&&(s.left-=n.width/2||0),"top"in s&&(s.top-=n.height/2||0),new t.Circle(r(s,n))},t.Circle.fromObject=function(e){return new t.Circle(e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=e.fabric||(e.fabric={});if(t.Triangle){t.warn("fabric.Triangle is already defined");return}t.Triangle=t.util.createClass(t.Object,{type:"triangle",initialize:function(e){e=e||{},this.callSuper("initialize",e),this.set("width",e.width||100).set("height",e.height||100)},_render:function(e){var t=this.width/2,n=this.height/2;e.beginPath(),e.moveTo(-t,n),e.lineTo(0,-n),e.lineTo(t,n),e.closePath(),this.fill&&e.fill(),this.stroke&&e.stroke()},complexity:function(){return 1},toSVG:function(){var e=this.width/2,t=this.height/2,n=[-e+" "+t,"0 "+ -t,e+" "+t].join(",");return'<polygon points="'+n+'" '+'style="'+this.getSvgStyles()+'" '+'transform="'+this.getSvgTransform()+'" '+"/>"}}),t.Triangle.fromObject=function(e){return new t.Triangle(e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=e.fabric||(e.fabric={}),n=Math.PI*2,r=t.util.object.extend;if(t.Ellipse){t.warn("fabric.Ellipse is already defined.");return}t.Ellipse=t.util.createClass(t.Object,{type:"ellipse",initialize:function(e){e=e||{},this.callSuper("initialize",e),this.set("rx",e.rx||0),this.set("ry",e.ry||0),this.set("width",this.get("rx")*2),this.set("height",this.get("ry")*2)},toObject:function(){return r(this.callSuper("toObject"),{rx:this.get("rx"),ry:this.get("ry")})},toSVG:function(){return["<ellipse ",'rx="',this.get("rx"),'" ','ry="',this.get("ry"),'" ','style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransform(),'" ',"/>"].join("")},render:function(e,t){if(this.rx===0||this.ry===0)return;return this.callSuper("render",e,t)},_render:function(e,t){e.beginPath(),e.save(),e.globalAlpha*=this.opacity,e.transform(1,0,0,this.ry/this.rx,0,0),e.arc(t?this.left:0,t?this.top:0,this.rx,0,n,!1),this.stroke&&e.stroke(),this.fill&&e.fill(),e.restore()},complexity:function(){return 1}}),t.Ellipse.ATTRIBUTE_NAMES="cx cy rx ry fill fill-opacity opacity stroke stroke-width transform".split(" "),t.Ellipse.fromElement=function(e,n){n||(n={});var i=t.parseAttributes(e,t.Ellipse.ATTRIBUTE_NAMES);return"left"in i&&(i.left-=n.width/2||0),"top"in i&&(i.top-=n.height/2||0),new t.Ellipse(r(i,n))},t.Ellipse.fromObject=function(e){return new t.Ellipse(e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function n(e){return e.left=e.left||0,e.top=e.top||0,e}var t=e.fabric||(e.fabric={});if(t.Rect){console.warn("fabric.Rect is already defined");return}t.Rect=t.util.createClass(t.Object,{type:"rect",options:{rx:0,ry:0},initialize:function(e){this._initStateProperties(),this.callSuper("initialize",e),this._initRxRy()},_initStateProperties:function(){this.stateProperties=this.stateProperties.concat(["rx","ry"])},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(e){var t=this.rx||0,n=this.ry||0,r=-this.width/2,i=-this.height/2,s=this.width,o=this.height;e.beginPath(),e.globalAlpha*=this.opacity,this.group&&e.translate(this.x||0,this.y||0),e.moveTo(r+t,i),e.lineTo(r+s-t,i),e.bezierCurveTo(r+s,i,r+s,i+n,r+s,i+n),e.lineTo(r+s,i+o-n),e.bezierCurveTo(r+s,i+o,r+s-t,i+o,r+s-t,i+o),e.lineTo(r+t,i+o),e.bezierCurveTo(r,i+o,r,i+o-n,r,i+o-n),e.lineTo(r,i+n),e.bezierCurveTo(r,i,r+t,i,r+t,i),e.closePath(),this.fill&&e.fill(),this.stroke&&e.stroke()},_normalizeLeftTopProperties:function(e){return e.left&&this.set("left",e.left+this.getWidth()/2),this.set("x",e.left||0),e.top&&this.set("top",e.top+this.getHeight()/2),this.set("y",e.top||0),this},complexity:function(){return 1},toObject:function(){return t.util.object.extend(this.callSuper("toObject"),{rx:this.get("rx")||0,ry:this.get("ry")||0})},toSVG:function(){return'<rect x="'+ -1*this.width/2+'" y="'+ -1*this.height/2+'" '+'rx="'+this.get("rx")+'" ry="'+this.get("ry")+'" '+'width="'+this.width+'" height="'+this.height+'" '+'style="'+this.getSvgStyles()+'" '+'transform="'+this.getSvgTransform()+'" '+"/>"}}),t.Rect.ATTRIBUTE_NAMES="x y width height rx ry fill fill-opacity opacity stroke stroke-width transform".split(" "),t.Rect.fromElement=function(e,r){if(!e)return null;var i=t.parseAttributes(e,t.Rect.ATTRIBUTE_NAMES);i=n(i);var s=new t.Rect(t.util.object.extend(r?t.util.object.clone(r):{},i));return s._normalizeLeftTopProperties(i),s},t.Rect.fromObject=function(e){return new t.Rect(e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=e.fabric||(e.fabric={}),n=t.util.toFixed;if(t.Polyline){t.warn("fabric.Polyline is already defined");return}t.Polyline=t.util.createClass(t.Object,{type:"polyline",initialize:function(e,t){t=t||{},this.set("points",e),this.callSuper("initialize",t),this._calcDimensions()},_calcDimensions:function(){return t.Polygon.prototype._calcDimensions.call(this)},toObject:function(){return t.Polygon.prototype.toObject.call(this)},toSVG:function(){var e=[];for(var t=0,r=this.points.length;t<r;t++)e.push(n(this.points[t].x,2),",",n(this.points[t].y,2)," ");return["<polyline ",'points="',e.join(""),'" ','style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransform(),'" ',"/>"].join("")},_render:function(e){var t;e.beginPath();for(var n=0,r=this.points.length;n<r;n++)t=this.points[n],e.lineTo(t.x,t.y);this.fill&&e.fill(),this.stroke&&e.stroke()},complexity:function(){return this.get("points").length}}),t.Polyline.ATTRIBUTE_NAMES="fill fill-opacity opacity stroke stroke-width transform".split(" "),t.Polyline.fromElement=function(e,n){if(!e)return null;n||(n={});var r=t.parsePointsAttribute(e.getAttribute("points")),i=t.parseAttributes(e,t.Polyline.ATTRIBUTE_NAMES);for(var s=0,o=r.length;s<o;s++)r[s].x-=n.width/2||0,r[s].y-=n.height/2||0;return new t.Polyline(r,t.util.object.extend(i,n))},t.Polyline.fromObject=function(e){var n=e.points;return new t.Polyline(n,e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function o(e){return e.x}function u(e){return e.y}var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.array.min,i=t.util.array.max,s=t.util.toFixed;if(t.Polygon){t.warn("fabric.Polygon is already defined");return}t.Polygon=t.util.createClass(t.Object,{type:"polygon",initialize:function(e,t){t=t||{},this.points=e,this.callSuper("initialize",t),this._calcDimensions()},_calcDimensions:function(){var e=this.points,t=r(e,"x"),n=r(e,"y"),s=i(e,"x"),o=i(e,"y");this.width=s-t,this.height=o-n,this.minX=t,this.minY=n},toObject:function(){return n(this.callSuper("toObject"),{points:this.points.concat()})},toSVG:function(){var e=[];for(var t=0,n=this.points.length;t<n;t++)e.push(s(this.points[t].x,2),",",s(this.points[t].y,2)," ");return["<polygon ",'points="',e.join(""),'" ','style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransform(),'" ',"/>"].join("")},_render:function(e){var t;e.beginPath();for(var n=0,r=this.points.length;n<r;n++)t=this.points[n],e.lineTo(t.x,t.y);this.fill&&e.fill(),this.stroke&&(e.closePath
4
- (),e.stroke())},complexity:function(){return this.points.length}}),t.Polygon.ATTRIBUTE_NAMES="fill fill-opacity opacity stroke stroke-width transform".split(" "),t.Polygon.fromElement=function(e,r){if(!e)return null;r||(r={});var i=t.parsePointsAttribute(e.getAttribute("points")),s=t.parseAttributes(e,t.Polygon.ATTRIBUTE_NAMES);for(var o=0,u=i.length;o<u;o++)i[o].x-=r.width/2||0,i[o].y-=r.height/2||0;return new t.Polygon(i,n(s,r))},t.Polygon.fromObject=function(e){return new t.Polygon(e.points,e)}}(typeof exports!="undefined"?exports:this),function(e){function n(e,t,n,r){var i=r[0],s=r[1],o=r[2],f=r[3],l=r[4],c=r[5],h=r[6],p=u(c,h,i,s,f,l,o,t,n);for(var d=0;d<p.length;d++){var v=a.apply(this,p[d]);e.bezierCurveTo.apply(e,v)}}function u(e,t,n,i,u,a,f,l,c){o=s.call(arguments);if(r[o])return r[o];var h=f*(Math.PI/180),p=Math.sin(h),d=Math.cos(h);n=Math.abs(n),i=Math.abs(i);var v=d*(l-e)*.5+p*(c-t)*.5,m=d*(c-t)*.5-p*(l-e)*.5,g=v*v/(n*n)+m*m/(i*i);g>1&&(g=Math.sqrt(g),n*=g,i*=g);var y=d/n,b=p/n,w=-p/i,E=d/i,S=y*l+b*c,x=w*l+E*c,T=y*e+b*t,N=w*e+E*t,C=(T-S)*(T-S)+(N-x)*(N-x),k=1/C-.25;k<0&&(k=0);var L=Math.sqrt(k);a==u&&(L=-L);var A=.5*(S+T)-L*(N-x),O=.5*(x+N)+L*(T-S),M=Math.atan2(x-O,S-A),_=Math.atan2(N-O,T-A),D=_-M;D<0&&a==1?D+=2*Math.PI:D>0&&a==0&&(D-=2*Math.PI);var P=Math.ceil(Math.abs(D/(Math.PI*.5+.001))),H=[];for(var B=0;B<P;B++){var j=M+B*D/P,F=M+(B+1)*D/P;H[B]=[A,O,j,F,n,i,p,d]}return r[o]=H}function a(e,t,n,r,u,a,f,l){o=s.call(arguments);if(i[o])return i[o];var c=l*u,h=-f*a,p=f*u,d=l*a,v=.5*(r-n),m=8/3*Math.sin(v*.5)*Math.sin(v*.5)/Math.sin(v),g=e+Math.cos(n)-m*Math.sin(n),y=t+Math.sin(n)+m*Math.cos(n),b=e+Math.cos(r),w=t+Math.sin(r),E=b+m*Math.sin(r),S=w-m*Math.cos(r);return i[o]=[c*g+h*y,p*g+d*y,c*E+h*S,p*E+d*S,c*b+h*w,p*b+d*w]}function d(e){return e[0]==="H"?e[1]:e[e.length-2]}function v(e){return e[0]==="V"?e[1]:e[e.length-1]}var t={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},r={},i={},s=Array.prototype.join,o;"use strict";var f=e.fabric||(e.fabric={}),l=f.util.array.min,c=f.util.array.max,h=f.util.object.extend,p=Object.prototype.toString;if(f.Path){f.warn("fabric.Path is already defined");return}if(!f.Object){f.warn("fabric.Path requires fabric.Object");return}f.Path=f.util.createClass(f.Object,{type:"path",initialize:function(e,t){t=t||{},this.setOptions(t);if(!e)throw Error("`path` argument is required");var n=p.call(e)==="[object Array]";this.path=n?e:e.match&&e.match(/[a-zA-Z][^a-zA-Z]*/g);if(!this.path)return;n||this._initializeFromArray(t),t.sourcePath&&this.setSourcePath(t.sourcePath)},_initializeFromArray:function(e){var t="width"in e,n="height"in e;this.path=this._parsePath();if(!t||!n)h(this,this._parseDimensions()),t&&(this.width=e.width),n&&(this.height=e.height)},_render:function(e){var t,r=0,i=0,s=0,o=0,u,a,f=-(this.width/2),l=-(this.height/2);for(var c=0,h=this.path.length;c<h;++c){t=this.path[c];switch(t[0]){case"l":r+=t[1],i+=t[2],e.lineTo(r+f,i+l);break;case"L":r=t[1],i=t[2],e.lineTo(r+f,i+l);break;case"h":r+=t[1],e.lineTo(r+f,i+l);break;case"H":r=t[1],e.lineTo(r+f,i+l);break;case"v":i+=t[1],e.lineTo(r+f,i+l);break;case"V":i=t[1],e.lineTo(r+f,i+l);break;case"m":r+=t[1],i+=t[2],e.moveTo(r+f,i+l);break;case"M":r=t[1],i=t[2],e.moveTo(r+f,i+l);break;case"c":u=r+t[5],a=i+t[6],s=r+t[3],o=i+t[4],e.bezierCurveTo(r+t[1]+f,i+t[2]+l,s+f,o+l,u+f,a+l),r=u,i=a;break;case"C":r=t[5],i=t[6],s=t[3],o=t[4],e.bezierCurveTo(t[1]+f,t[2]+l,s+f,o+l,r+f,i+l);break;case"s":u=r+t[3],a=i+t[4],s=2*r-s,o=2*i-o,e.bezierCurveTo(s+f,o+l,r+t[1]+f,i+t[2]+l,u+f,a+l),r=u,i=a;break;case"S":u=t[3],a=t[4],s=2*r-s,o=2*i-o,e.bezierCurveTo(s+f,o+l,t[1]+f,t[2]+l,u+f,a+l),r=u,i=a;break;case"q":r+=t[3],i+=t[4],e.quadraticCurveTo(t[1]+f,t[2]+l,r+f,i+l);break;case"Q":r=t[3],i=t[4],s=t[1],o=t[2],e.quadraticCurveTo(s+f,o+l,r+f,i+l);break;case"T":u=r,a=i,r=t[1],i=t[2],s=-s+2*u,o=-o+2*a,e.quadraticCurveTo(s+f,o+l,r+f,i+l);break;case"a":n(e,r+f,i+l,[t[1],t[2],t[3],t[4],t[5],t[6]+r+f,t[7]+i+l]),r+=t[6],i+=t[7];break;case"A":n(e,r+f,i+l,[t[1],t[2],t[3],t[4],t[5],t[6]+f,t[7]+l]),r=t[6],i=t[7];break;case"z":case"Z":e.closePath()}}},render:function(e,t){e.save();var n=this.transformMatrix;n&&e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),t||this.transform(e),this.overlayFill?e.fillStyle=this.overlayFill:this.fill&&(e.fillStyle=this.fill),this.stroke&&(e.strokeStyle=this.stroke),e.beginPath(),this._render(e),this.fill&&e.fill(),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.lineCap=e.lineJoin="round",e.stroke()),!t&&this.active&&(this.drawBorders(e),this.hideCorners||this.drawCorners(e)),e.restore()},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(){var e=h(this.callSuper("toObject"),{path:this.path});return this.sourcePath&&(e.sourcePath=this.sourcePath),this.transformMatrix&&(e.transformMatrix=this.transformMatrix),e},toDatalessObject:function(){var e=this.toObject();return this.sourcePath&&(e.path=this.sourcePath),delete e.sourcePath,e},toSVG:function(){var e=[];for(var t=0,n=this.path.length;t<n;t++)e.push(this.path[t].join(" "));var r=e.join(" ");return['<g transform="',this.getSvgTransform(),'">',"<path ",'width="',this.width,'" height="',this.height,'" ','d="',r,'" ','style="',this.getSvgStyles(),'" ','transform="translate(',-this.width/2," ",-this.height/2,')" />',"</g>"].join("")},complexity:function(){return this.path.length},_parsePath:function(){var e=[],n,r,i;for(var s=0,o,u,a=this.path.length;s<a;s++){n=this.path[s],r=n.slice(1).trim().replace(/(\d)-/g,"$1###-").split(/\s|,|###/),u=[n.charAt(0)];for(var o=0,f=r.length;o<f;o++)i=parseFloat(r[o]),isNaN(i)||u.push(i);var l=u[0].toLowerCase(),c=t[l];if(u.length-1>c)for(var h=1,p=u.length;h<p;h+=c)e.push([u[0]].concat(u.slice(h,h+c)));else e.push(u)}return e},_parseDimensions:function(){var e=[],t=[],n,r,i=!1,s,o;this.path.forEach(function(u,a){u[0]!=="H"&&(n=a===0?d(u):d(this.path[a-1])),u[0]!=="V"&&(r=a===0?v(u):v(this.path[a-1])),u[0]===u[0].toLowerCase()&&(i=!0),s=i?n+d(u):u[0]==="V"?n:d(u),o=i?r+v(u):u[0]==="H"?r:v(u);var f=parseInt(s,10);isNaN(f)||e.push(f),f=parseInt(o,10),isNaN(f)||t.push(f)},this);var u=l(e),a=l(t),f=0,h=0,p={top:a-h,left:u-f,bottom:c(t)-h,right:c(e)-f};return p.width=p.right-p.left,p.height=p.bottom-p.top,p}}),f.Path.fromObject=function(e){return new f.Path(e.path,e)},f.Path.ATTRIBUTE_NAMES="d fill fill-opacity opacity fill-rule stroke stroke-width transform".split(" "),f.Path.fromElement=function(e,t){var n=f.parseAttributes(e,f.Path.ATTRIBUTE_NAMES);return new f.Path(n.d,h(n,t))}}(typeof exports!="undefined"?exports:this),function(e){"use strict";function a(e){for(var n=0,r=e.length;n<r;n++)if(!(e[n]instanceof t.Object)){var i=o(u(e[n].type));e[n]=t[i].fromObject(e[n])}return e}var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.array.invoke,i=t.Object.prototype.set,s=t.Object.prototype.toObject,o=t.util.string.camelize,u=t.util.string.capitalize;if(t.PathGroup){t.warn("fabric.PathGroup is already defined");return}t.PathGroup=t.util.createClass(t.Path,{type:"path-group",forceFillOverwrite:!1,initialize:function(e,t){t=t||{},this.paths=e||[];for(var n=this.paths.length;n--;)this.paths[n].group=this;this.setOptions(t),this.setCoords(),t.sourcePath&&this.setSourcePath(t.sourcePath)},render:function(e){if(this.stub)e.save(),this.transform(e),this.stub.render(e,!1),this.active&&(this.drawBorders(e),this.drawCorners(e)),e.restore();else{e.save();var t=this.transformMatrix;t&&e.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this.transform(e);for(var n=0,r=this.paths.length;n<r;++n)this.paths[n].render(e,!0);this.active&&(this.drawBorders(e),this.hideCorners||this.drawCorners(e)),e.restore()}},set:function(e,t){if(e!=="fill"&&e!=="overlayFill"||!this.isSameColor())i.call(this,e,t);else{this[e]=t;var n=this.paths.length;while(n--)this.paths[n].set(e,t)}return this},toObject:function(){return n(s.call(this),{paths:r(this.getObjects(),"clone"),sourcePath:this.sourcePath})},toDatalessObject:function(){var e=this.toObject();return this.sourcePath&&(e.paths=this.sourcePath),e},toSVG:function(){var e=this.getObjects(),t=["<g ",'width="',this.width,'" ','height="',this.height,'" ','style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransform(),'" ',">"];for(var n=0,r=e.length;n<r;n++)t.push(e[n].toSVG());return t.push("</g>"),t.join("")},toString:function(){return"#<fabric.PathGroup ("+this.complexity()+"): { top: "+this.top+", left: "+this.left+" }>"},isSameColor:function(){var e=this.getObjects()[0].get("fill");return this.getObjects().every(function(t){return t.get("fill")===e})},complexity:function(){return this.paths.reduce(function(e,t){return e+(t&&t.complexity?t.complexity():0)},0)},toGrayscale:function(){var e=this.paths.length;while(e--)this.paths[e].toGrayscale();return this},getObjects:function(){return this.paths}}),t.PathGroup.fromObject=function(e){var n=a(e.paths);return new t.PathGroup(n,e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.array.min,i=t.util.array.max,s=t.util.array.invoke,o=t.util.removeFromArray;if(t.Group)return;t.Group=t.util.createClass(t.Object,{type:"group",initialize:function(e,t){this.objects=e||[],this.originalState={},this.callSuper("initialize"),this._calcBounds(),this._updateObjectsCoords(),t&&n(this,t),this._setOpacityIfSame(),this.setCoords(!0),this.saveCoords(),this.activateAllObjects()},_updateObjectsCoords:function(){var e=this.left,t=this.top;this.forEachObject(function(n){var r=n.get("left"),i=n.get("top");n.set("originalLeft",r),n.set("originalTop",i),n.set("left",r-e),n.set("top",i-t),n.setCoords(),n.hideCorners=!0},this)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},getObjects:function(){return this.objects},add:function(e){return this._restoreObjectsState(),this.objects.push(e),e.setActive(!0),this._calcBounds(),this._updateObjectsCoords(),this},remove:function(e){return this._restoreObjectsState(),o(this.objects,e),e.setActive(!1),this._calcBounds(),this._updateObjectsCoords(),this},size:function(){return this.getObjects().length},set:function(e,t){if(typeof t=="function")this.set(e,t(this[e]));else if(e==="fill"||e==="opacity"){var n=this.objects.length;this[e]=t;while(n--)this.objects[n].set(e,t)}else this[e]=t;return this},contains:function(e){return this.objects.indexOf(e)>-1},toObject:function(){return n(this.callSuper("toObject"),{objects:s(this.objects,"clone")})},render:function(e){e.save(),this.transform(e);var t=Math.max(this.scaleX,this.scaleY);for(var n=0,r=this.objects.length,i;i=this.objects[n];n++){var s=i.borderScaleFactor;i.borderScaleFactor=t,i.render(e),i.borderScaleFactor=s}this.hideBorders||this.drawBorders(e),this.hideCorners||this.drawCorners(e),e.restore(),this.setCoords()},item:function(e){return this.getObjects()[e]},complexity:function(){return this.getObjects().reduce(function(e,t){return e+=typeof t.complexity=="function"?t.complexity():0,e},0)},_restoreObjectsState:function(){return this.objects.forEach(this._restoreObjectState,this),this},_restoreObjectState:function(e){var t=this.get("left"),n=this.get("top"),r=this.getAngle()*(Math.PI/180),i=e.get("originalLeft"),s=e.get("originalTop"),o=Math.cos(r)*e.get("top")+Math.sin(r)*e.get("left"),u=-Math.sin(r)*e.get("top")+Math.cos(r)*e.get("left");return e.setAngle(e.getAngle()+this.getAngle()),e.set("left",t+u*this.get("scaleX")),e.set("top",n+o*this.get("scaleY")),e.set("scaleX",e.get("scaleX")*this.get("scaleX")),e.set("scaleY",e.get("scaleY")*this.get("scaleY")),e.setCoords(),e.hideCorners=!1,e.setActive(!1),e.setCoords(),this},destroy:function(){return this._restoreObjectsState()},saveCoords:function(){return this._originalLeft=this.get("left"),this._originalTop=this.get("top"),this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){return this.forEachObject(function(e){e.setCoords()}),this},activateAllObjects:function(){return this.setActive(!0)},setActive:function(e){return this.forEachObject(function(t){t.setActive(e)}),this},forEachObject:t.StaticCanvas.prototype.forEachObject,_setOpacityIfSame:function(){var e=this.getObjects(),t=e[0]?e[0].get("opacity"):1,n=e.every(function(e){return e.get("opacity")===t});n&&(this.opacity=t)},_calcBounds:function(){var e=[],t=[],n,s,o,u,a,f,l,c=0,h=this.objects.length;for(;c<h;++c){a=this.objects[c],a.setCoords();for(var p in a.oCoords)e.push(a.oCoords[p].x),t.push(a.oCoords[p].y)}n=r(e),o=i(e),s=r(t),u=i(t),f=o-n||0,l=u-s||0,this.width=f,this.height=l,this.left=n+f/2||0,this.top=s+l/2||0},containsPoint:function(e){var t=this.get("width")/2,n=this.get("height")/2,r=this.get("left"),i=this.get("top");return r-t<e.x&&r+t>e.x&&i-n<e.y&&i+n>e.y},toGrayscale:function(){var e=this.objects.length;while(e--)this.objects[e].toGrayscale()}}),t.Group.fromObject=function(e){return new t.Group(e.objects,e)}}(typeof exports!="undefined"?exports:this),function(e){"use strict";var t=fabric.util.object.extend;e.fabric||(e.fabric={});if(e.fabric.Image){fabric.warn("fabric.Image is already defined.");return}if(!fabric.Object){fabric.warn("fabric.Object is required for fabric.Image initialization");return}fabric.Image=fabric.util.createClass(fabric.Object,{active:!1,bordervisibility:!1,cornervisibility:!1,type:"image",filters:[],initialize:function(e,t){t||(t={}),this.callSuper("initialize",t),this._initElement(e),this._originalImage=this.getElement(),this._initConfig(t),t.filters&&(this.filters=t.filters,this.applyFilters())},getElement:function(){return this._element},setElement:function(e){return this._element=e,this._initConfig(),this},getOriginalSize:function(){var e=this.getElement();return{width:e.width,height:e.height}},setBorderVisibility:function(e){this._resetWidthHeight(),this._adjustWidthHeightToBorders(showBorder),this.setCoords()},setCornersVisibility:function(e){this.cornervisibility=!!e},render:function(e,t){e.save(),t||this.transform(e),this._render(e),this.active&&!t&&(this.drawBorders(e),this.hideCorners||this.drawCorners(e)),e.restore()},toObject:function(){return t(this.callSuper("toObject"),{src:this._originalImage.src||this._originalImage._src,filters:this.filters.concat()})},toSVG:function(){return'<g transform="'+this.getSvgTransform()+'">'+'<image xlink:href="'+this.getSvgSrc()+'" '+'style="'+this.getSvgStyles()+'" '+'transform="translate('+ -this.width/2+" "+ -this.height/2+')" '+'width="'+this.width+'" '+'height="'+this.height+'"'+"/>"+"</g>"},getSrc:function(){return this.getElement().src||this.getElement()._src},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},clone:function(e){this.constructor.fromObject(this.toObject(),e)},applyFilters:function(e){if(this.filters.length===0){this.setElement(this._originalImage),e&&e();return}var t=typeof Buffer!="undefined"&&typeof window=="undefined",n=this._originalImage,r=fabric.document.createElement("canvas"),i=t?new(require("canvas").Image):fabric.document.createElement("img"),s=this;!r.getContext&&typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager.initElement(r),r.width=n.width,r.height=n.height,r.getContext("2d").drawImage(n,0,0),this.filters.forEach(function(e){e&&e.applyTo(r)}),i.onload=function(){s.setElement(i),e&&e(),i.onload=r=n=null},i.width=n.width,i.height=n.height;if(t){var o=r.toDataURL("image/png").replace(/data:image\/png;base64,/,"");i.src=new Buffer(o,"base64"),s.setElement(i),e&&e()}else i.src=r.toDataURL("image/png");return this},_render:function(e){e.drawImage(this.getElement(),-this.width/2,-this.height/2,this.width,this.height)},_adjustWidthHeightToBorders:function(e){e?(this.currentBorder=this.borderwidth,this.width+=2*this.currentBorder,this.height+=2*this.currentBorder):this.currentBorder=0},_resetWidthHeight:function(){var e=this.getElement();this.set("width",e.width),this.set("height",e.height)},_initElement:function(e){this.setElement(fabric.util.getById(e)),fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(e){this.setOptions(e||{}),this._setBorder(),this._setWidthHeight()},_initFilters:function(e){e.filters&&e.filters.length&&(this.filters=e.filters.map(function(e){return fabric.Image.filters[e.type].fromObject(e)}))},_setBorder:function(){this.bordervisibility?this.currentBorder=this.borderwidth:this.currentBorder=0},_setWidthHeight:function(){var e=2*this.currentBorder;this.width=(this.getElement().width||0)+e,this.height=(this.getElement().height||0)+e},complexity:function(){return 1}}),fabric.Image.CSS_CANVAS="canvas-img",fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc,fabric.Image.fromObject=function(e,t){var n=fabric.document.createElement("img"),r=e.src;e.width&&(n.width=e.width),e.height&&(n.height=e.height),n.onload=function(){fabric.Image.prototype._initFilters.call(e,e);var r=new fabric.Image(n,e);t&&t(r),n=n.onload=null},n.src=r},fabric.Image.fromURL=function(e,t,n){var r=fabric.document.createElement("img");r.onload=function(){t&&t(new fabric.Image(r,n)),r=r.onload=null},r.src=e},fabric.Image.ATTRIBUTE_NAMES="x y width height fill fill-opacity opacity stroke stroke-width transform xlink:href".split(" "),fabric.Image.fromElement=function(e,n,r){r||(r={});var i=fabric.parseAttributes(e,fabric.Image.ATTRIBUTE_NAMES);fabric.Image.fromURL(i["xlink:href"],n,t(i,r))},fabric.Image.async=!0}(typeof exports!="undefined"?exports:this),fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var e=this.get("angle");return e>-225&&e<=-135?-180:e>-135&&e<=-45?-90:e>-45&&e<=45?0:e>45&&e<=135?90:e>135&&e<=225?180:e>225&&e<=315?270:e>315?360:0},straighten:function(){var e=this._getAngleValueForStraighten();return this.setAngle(e),this},fxStraighten:function(e){e=e||{};var t=function(){},n=e.onComplete||t,r=e.onChange||t,i=this;return fabric.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(e){i.setAngle(e),r()},onComplete:function(){i.setCoords(),n()},onStart:function(){i.setActive(!1)}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(e){return e.straighten(),this.renderAll(),this},fxStraightenObject:function(e){return e.fxStraighten({onChange:this.renderAll.bind(this)}),this}}),fabric.Image.filters={},fabric.Image.filters.Grayscale=fabric.util.createClass({type:"Grayscale",applyTo:function(e){var t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),r=n.data,i=n.width,s=n.height,o,u,a,f;for(a=0;a<i;a++)for(f=0;f<s;f++)o=a*4*s+f*4,u=(r[o]+r[o+1]+r[o+2])/3,r[o]=u,r[o+1]=u,r[o+2]=u;t.putImageData(n,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Grayscale.fromObject=function(){return new fabric.Image.filters.Grayscale},fabric.Image.filters.RemoveWhite=fabric.util.createClass({type:"RemoveWhite",initialize:function(e){e||(e={}),this.threshold=e.threshold||30,this.distance=e.distance||20},applyTo:function(e){var t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),r=n.data,i=this.threshold,s=this.distance,o=255-i,u=Math.abs,a,f,l;for(var c=0,h=r.length;c<h;c+=4)a=r[c],f=r[c+1],l=r[c+2],a>o&&f>o&&l>o&&u(a-f)<s&&u(a-l)<s&&u(f-l)<s&&(r[c+3]=1);t.putImageData(n,0,0)},toJSON:function(){return{type:this.type,threshold:this.threshold,distance:this.distance}}}),fabric.Image.filters.RemoveWhite.fromObject=function(e){return new fabric.Image.filters.RemoveWhite(e)},fabric.Image.filters.Invert=fabric.util.createClass({type:"Invert",applyTo:function(e){var t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),r=n.data,i=r.length,s;for(s=0;s<i;s+=4)r[s]=255-r[s],r[s+1]=255-r[s+1],r[s+2]=255-r[s+2];t.putImageData(n,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Invert.fromObject=function(){return new fabric.Image.filters.Invert},function(e){"use strict";var t=e.fabric||(e.fabric={}),n=t.util.object.extend,r=t.util.object.clone,i=t.util.toFixed;if(t.Text){t.warn("fabric.Text is already defined");return}if(!t.Object){t.warn("fabric.Text requires fabric.Object");return}t.Text=t.util.createClass(t.Object,{fontSize:40,fontWeight:100,fontFamily:"Times_New_Roman",textDecoration:"",textShadow:null,textAlign:"left",fontStyle:"",lineHeight:1.6,strokeStyle:"",strokeWidth:1,backgroundColor:"",path:null,type:"text",initialize:function(e,t){this._initStateProperties(),this.text=e,this.setOptions(t),this.theta=this.angle*Math.PI/180,this.width=this.getWidth(),this.setCoords()},_initStateProperties:function(){this.stateProperties=this.stateProperties.concat(),this.stateProperties.push("fontFamily","fontWeight","fontSize","path","text","textDecoration","textShadow","textAlign","fontStyle","lineHeight","strokeStyle","strokeWidth","backgroundColor"),t.util.removeFromArray(this.stateProperties,"width")},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_render:function(e){var t=Cufon.textOptions||(Cufon.textOptions={});t.left=this.left,t.top=this.top,t.context=e,t.color=this.fill;var n=this._initDummyElement();this.transform(e),Cufon.replaceElement(n,{engine:"canvas",separate:"none",fontFamily:this.fontFamily,fontWeight:this.fontWeight,textDecoration:this.textDecoration,textShadow:this.textShadow,textAlign:this.textAlign,fontStyle:this.fontStyle,lineHeight:this.lineHeight,strokeStyle:this.strokeStyle,strokeWidth:this.strokeWidth,backgroundColor:this.backgroundColor}),this.width=t.width,this.height=t.height,this._totalLineHeight=t.totalLineHeight,this._fontAscent=t.fontAscent,this._boundaries=t.boundaries,this._shadowOffsets=t.shadowOffsets,this._shadows=t.shadows||[],this.setCoords()},_initDummyElement:function(){var e=t.document.createElement("pre"),n=t.document.createElement("div");return n.appendChild(e),typeof G_vmlCanvasManager=="undefined"?e.innerHTML=this.text:e.innerText=this.text.replace(/\r?\n/gi,"\r"),e.style.fontSize=this.fontSize+"px",e.style.letterSpacing="normal",e},render:function(e,t){e.save(),this._render(e),!t&&this.active&&(this.drawBorders(e),this.hideCorners||this.drawCorners(e)),e.restore()},toObject:function(){return n(this.callSuper("toObject"),{text:this.text,fontSize:this.fontSize,fontWeight:this.fontWeight,fontFamily:this.fontFamily,fontStyle:this.fontStyle,lineHeight:this.lineHeight,textDecoration:this.textDecoration,textShadow:this.textShadow,textAlign:this.textAlign,path:this.path,strokeStyle:this.strokeStyle,strokeWidth:this.strokeWidth,backgroundColor:this.backgroundColor})},toSVG:function(){var e=this.text.split(/\r?\n/),t=-this._fontAscent-this._fontAscent/5*this.lineHeight,n=-(this.width/2),r=this.height/2-e.length*this.fontSize-this._totalLineHeight,s=this._getSVGTextAndBg(t,n,e),o=this._getSVGShadows(t,e);return r+=this._fontAscent/5*this.lineHeight,['<g transform="',this.getSvgTransform(),'">',s.textBgRects.join(""),"<text ",this.fontFamily?"font-family=\"'"+this.fontFamily+"'\" ":"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",this.textDecoration?'text-decoration="'+this.textDecoration+'" ':"",'style="',this.getSvgStyles(),'" ','transform="translate(',i(n,2)," ",i(r,2),')">',o.join(""),s.textSpans.join(""),"</text>","</g>"].join("")},_getSVGShadows:function(e,n){var r=[],s,o,u,a,f=1;for(s=0,u=this._shadows.length;s<u;s++)for(o=0,a=n.length;o<a;o++)if(n[o]!==""){var l=this._boundaries&&this._boundaries[o]?this._boundaries[o].left:0;r.push('<tspan x="',i(l+f+this._shadowOffsets[s][0],2),o===0?'" y':'" dy','="',i(e+(o===0?this._shadowOffsets[s][1]:0),2),'" ',this._getFillAttributes(this._shadows[s].color),">",t.util.string.escapeXml(n[o]),"</tspan>"),f=1}else f++;return r},_getSVGTextAndBg:function(e,n,r){var s=[],o=[],u,a,f,l=1;for(u=0,f=r.length;u<f;u++){r[u]!==""?(a=this._boundaries&&this._boundaries[u]?i(this._boundaries[u].left,2):0,s.push('<tspan x="',a,'" ',u===0?"y":"dy",'="',i(e*l,2),'" ',this._getFillAttributes(this.fill),">",t.util.string.escapeXml(r[u]),"</tspan>"),l=1):l++;if(!this.backgroundColor)continue;o.push("<rect ",this._getFillAttributes(this.backgroundColor),' x="',i(n+this._boundaries[u].left,2),'" y="',i(e*u-this.height/2,2),'" width="',i(this._boundaries[u].width,2),'" height="',i(this._boundaries[u].height,2),'"></rect>')}return{textSpans:s,textBgRects:o}},_getFillAttributes:function(e){var n=e?new t.Color(e):"";return!n||!n.getSource()||n.getAlpha()===1?'fill="'+e+'"':'opacity="'+n.getAlpha()+'" fill="'+n.setAlpha(1).toRgb()+'"'},setColor:function(e){return this.set("fill",e),this},setFontsize:function(e){return this.set("fontSize",e),this.setCoords(),this},getText:function(){return this.text},setText:function(e){return this.set("text",e),this.setCoords(),this},set:function(e,t){if(typeof e=="object")for(var n in e)this.set(n,e[n]);else this[e]=t,e==="fontFamily"&&this.path&&(this.path=this.path.replace(/(.*?)([^\/]*)(\.font\.js)/,"$1"+t+"$3"));return this}}),t.Text.fromObject=function(e){return new t.Text(e.text,r(e))},t.Text.fromElement=function(e){}}(typeof exports!="undefined"?exports:this),function(){function request(e,t,n){var r=URL.parse(e),i=HTTP.createClient(80,r.hostname),s=i.request("GET",r.pathname,{host:r.hostname});i.addListener("error",function(e){e.errno===process.ECONNREFUSED?fabric.log("ECONNREFUSED: connection refused to "+i.host+":"+i.port):fabric.log(e.message)}),s.end(),s.on("response",function(e){var r="";t&&e.setEncoding(t),e.on("end",function(){n(r)}),e.on("data",function(t){e.statusCode==200&&(r+=t)})})}if(typeof document!="undefined"&&typeof window!="undefined")return;var DOMParser=(new require("xmldom")).DOMParser,URL=require("url"),HTTP=require("http"),Canvas=require("canvas"),Image=require("canvas").Image;fabric.util.loadImage=function(e,t){request(e,"binary",function(n){var r=new Image;r.src=new Buffer(n,"binary"),r._src=e,t(r)})},fabric.loadSVGFromURL=function(e,t){e=e.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim(),request(e,"",function(e){var n=(new DOMParser).parseFromString(e);fabric.parseSVGDocument(n.documentElement,function(e,n){t(e,n)})})},fabric.util.getScript=function(url,callback){request(url,"",function(body){eval(body),callback&&callback()})},fabric.Image.fromObject=function(e,t){fabric.util.loadImage(e.src,function(n){var r=new fabric.Image(n);r._initConfig(e),r._initFilters(e),t(r)})},fabric.createCanvasForNode=function(e,t){var n=fabric.document.createElement("canvas"),r=new Canvas(e||600,t||600);n.style={},n.width=r.width,n.height=r.height;var i=fabric.Canvas||fabric.StaticCanvas,s=new i(n);return s.contextContainer=r.getContext("2d"),s.nodeCanvas=r,s},fabric.StaticCanvas.prototype.createPNGStream=function(){return this.nodeCanvas.createPNGStream()},fabric.Canvas&&fabric.Canvas.prototype.createPNGStream;var origSetWidth=fabric.StaticCanvas.prototype.setWidth;fabric.StaticCanvas.prototype.setWidth=function(e){return origSetWidth.call(this),this.nodeCanvas.width=e,this},fabric.Canvas&&(fabric.Canvas.prototype.setWidth=fabric.StaticCanvas.prototype.setWidth);var origSetHeight=fabric.StaticCanvas.prototype.setHeight;fabric.StaticCanvas.prototype.setHeight=function(e){return origSetHeight.call(this),this.nodeCanvas.height=e,this},fabric.Canvas&&(fabric.Canvas.prototype.setHeight=fabric.StaticCanvas.prototype.setHeight)}();
@@ -1,4 +0,0 @@
1
- /*! jQuery v1.7.2 jquery.com | jquery.org/license */
2
- (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
3
- a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
4
- .clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
@@ -1,391 +0,0 @@
1
- var MEMECAPTAIN = (function (window, $, fabric) {
2
- "use strict";
3
-
4
- var my = {},
5
-
6
- facebookAppId = '108445492580525',
7
- googleApiKey = 'ABQIAAAA-E0uJIHoMJX6M6atCgYANRS1DzXPXMqKnKNRJm2Z_PRWxvtqGBSOvBqyXOwxGZU5jLxExg_5ym69rw',
8
- genUrl = '/g',
9
- genDataType = genUrl === '/g' ? 'json' : 'jsonp',
10
- imageMaxSide = 800;
11
-
12
- function setSourceUrl(sourceUrl) {
13
- $('#u').val(sourceUrl).addClass('attn');
14
- $('#t1x,#t1y,#t1w,#t1h,#t2x,#t2y,#t2w,#t2h').val('');
15
- $('#positionTextCanvasDiv').empty();
16
- $('#positionTable').hide();
17
- }
18
-
19
- // scale width and height so that neither is larger than maxSide
20
- function resizeToFit(width, height, maxSide) {
21
- var result = {
22
- width : width,
23
- height : height
24
- };
25
-
26
- if (width > maxSide) {
27
- result.width = maxSide;
28
- result.height = Math.round(height * (maxSide / width));
29
- }
30
-
31
- if (result.height > maxSide) {
32
- result.width = Math.round(
33
- result.width * (maxSide / result.height)
34
- );
35
- result.height = maxSide;
36
- }
37
-
38
- return result;
39
- }
40
-
41
- // build an image search result thumbnail
42
- function searchThumbnail(thumbnailUrl, imgUrl, imgWidth, imgHeight) {
43
- var scaledDimensions = resizeToFit(imgWidth, imgHeight, imageMaxSide),
44
- title = scaledDimensions.width + ' x ' + scaledDimensions.height,
45
- thumbnailImage = $('<img />').attr({
46
- src : thumbnailUrl,
47
- title : title,
48
- width : scaledDimensions.width / 4.0,
49
- height : scaledDimensions.height / 4.0
50
- }).addClass('thumb');
51
-
52
- return thumbnailImage.click(function () { setSourceUrl(imgUrl); });
53
- }
54
-
55
- function showGoogleImages(resp) {
56
- var div = $('#imageSearchResults'),
57
- searchResults = resp.responseData.results;
58
-
59
- if (searchResults.length > 0) {
60
- $.each(searchResults, function (i, img) {
61
- div.append(searchThumbnail(img.tbUrl, img.unescapedUrl,
62
- parseInt(img.width, 10), parseInt(img.height, 10)));
63
- });
64
- } else {
65
- div.append($('<p />').append('No Google results.'));
66
- }
67
- }
68
-
69
- function loadSourceImages() {
70
- $.get('source_images.json', function (data) {
71
- var pos = 0,
72
- div = $('#localSourceImages');
73
-
74
- $.each(data.images, function (i, img) {
75
- div.append($('<img />').attr('src',
76
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAAXNSR0IArs4c6QAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AIBAQMqmgCy0wAAAAtJREFUCNdjYGAAAAADAAEg1ZTHAAAAAElFTkSuQmCC'
77
- ).addClass('thumb').css({
78
- 'background-image' : 'url(' + data.thumbSpritesUrl + ')',
79
- 'background-position' : pos + 'px 0px',
80
- height : data.thumbHeight,
81
- width : img.thumbWidth + 'px'
82
- }).click(function () { setSourceUrl(img.url); }));
83
-
84
- pos -= img.thumbWidth;
85
- });
86
- });
87
- }
88
-
89
- function imageSearch() {
90
- var imageSearchInput = $('#imageSearch'),
91
- imageSearchVal = imageSearchInput.val();
92
-
93
- if (imageSearchVal.match(/[^\s]/)) {
94
- imageSearchInput.val('');
95
- $('#imageSearchResults').empty();
96
-
97
- $.ajax({
98
- type : 'GET',
99
- url : 'http://ajax.googleapis.com/ajax/services/search/images',
100
- data : {
101
- imgsz : 'large',
102
- key : googleApiKey,
103
- q : imageSearchVal,
104
- rsz : '8',
105
- v : '1.0'
106
- },
107
- dataType : 'jsonp',
108
- success : showGoogleImages
109
- });
110
- }
111
- }
112
-
113
- function positionText() {
114
- var imageUrl = $('#u').val(),
115
- canvas;
116
-
117
- if (imageUrl.length > 0) {
118
- $('#positionTable').show();
119
- $('#positionTextCanvasDiv').empty().append($('<canvas />').attr({
120
- id : 'positionTextCanvas'
121
- }));
122
-
123
- canvas = new fabric.Canvas('positionTextCanvas');
124
-
125
- canvas.setBackgroundImage(imageUrl, function () {
126
- var canvasSize = resizeToFit(canvas.backgroundImage.width,
127
- canvas.backgroundImage.height, imageMaxSide),
128
- textWidth,
129
- textHeight,
130
- rect1,
131
- rect2;
132
-
133
- canvas.setWidth(canvasSize.width);
134
- canvas.setHeight(canvasSize.height);
135
-
136
- canvas.renderAll.bind(canvas);
137
-
138
- textWidth = 0.9 * canvas.getWidth();
139
- textHeight = 0.25 * canvas.getHeight();
140
-
141
- rect1 = new fabric.Rect({
142
- top : textHeight / 2.0,
143
- left : canvas.getWidth() / 2.0,
144
- width : textWidth,
145
- height : textHeight,
146
- fill : 'red',
147
- cornersize : 20
148
- });
149
-
150
- rect1.name = '1';
151
- rect1.set('lockRotation', true);
152
-
153
- canvas.add(rect1);
154
-
155
- rect2 = new fabric.Rect({
156
- top : canvas.getHeight() - (textHeight / 2.0),
157
- left : canvas.getWidth() / 2.0,
158
- width : textWidth,
159
- height : textHeight,
160
- fill : 'red',
161
- cornersize : 20
162
- });
163
-
164
- rect2.name = '2';
165
- rect2.set('lockRotation', true);
166
-
167
- canvas.add(rect2);
168
-
169
- canvas.observe('object:moving', function (o) {
170
- var target = o.target,
171
-
172
- halfWidth = target.getWidth() / 2,
173
- leftSide = Math.round(target.getLeft() - halfWidth),
174
- rightSide = Math.round(target.getLeft() + halfWidth),
175
-
176
- halfHeight = target.getHeight() / 2,
177
- topSide = Math.round(target.getTop() - halfHeight),
178
- bottomSide = Math.round(target.getTop() + halfHeight);
179
-
180
- if (leftSide < 0) {
181
- target.setLeft(halfWidth);
182
- }
183
- if (rightSide > canvas.getWidth()) {
184
- target.setLeft(canvas.getWidth() - halfWidth);
185
- }
186
- if (topSide < 0) {
187
- target.setTop(halfHeight);
188
- }
189
- if (bottomSide > canvas.getHeight()) {
190
- target.setTop(canvas.getHeight() - halfHeight);
191
- }
192
- });
193
-
194
- canvas.observe('object:modified', function (o) {
195
- var target = o.target;
196
-
197
- $('#t' + target.name + 'x').val(
198
- Math.round(target.getLeft() - (target.getWidth() / 2))
199
- );
200
- $('#t' + target.name + 'y').val(
201
- Math.round(target.getTop() - (target.getHeight() / 2))
202
- );
203
- $('#t' + target.name + 'w').val(Math.round(target.getWidth()));
204
- $('#t' + target.name + 'h').val(Math.round(target.getHeight()));
205
- });
206
-
207
- canvas.observe('object:scaling', function (o) {
208
- var target = o.target,
209
- maxScaleX = canvas.width / target.width,
210
- maxScaleY = canvas.height / target.height;
211
-
212
- if (target.scaleX > maxScaleX) {
213
- target.scaleX = maxScaleX;
214
- }
215
-
216
- if (target.scaleY > maxScaleY) {
217
- target.scaleY = maxScaleY;
218
- }
219
-
220
- canvas.fire('object:moving', { target : target });
221
- });
222
-
223
- canvas.fire('object:modified', { target : rect1 });
224
- canvas.fire('object:modified', { target : rect2 });
225
- });
226
- }
227
- }
228
-
229
- function imgurLink(url) {
230
- return $('<a />').attr('href',
231
- 'http://api.imgur.com/2/upload?url=' +
232
- encodeURIComponent(url)).append('imgur');
233
- }
234
-
235
- function redditLink(url) {
236
- return $('<a />').attr('href',
237
- 'http://www.reddit.com/submit?url=' +
238
- encodeURIComponent(url)).append('reddit');
239
- }
240
-
241
- // build a Twitter tweet link for a url
242
- function tweetLink(url) {
243
- return $('<a />').attr({
244
- href : 'http://twitter.com/share',
245
- 'class' : 'twitter-share-button',
246
- 'data-count' : 'none',
247
- 'data-text' : ' ',
248
- 'data-url' : url
249
- }).append('Tweet');
250
- }
251
-
252
- // build Twitter tweet script tag
253
- function tweetScript() {
254
- return $('<script />').attr(
255
- 'src',
256
- 'http://platform.twitter.com/widgets.js'
257
- );
258
- }
259
-
260
- // build Facebook Like div for a url
261
- function facebookLikeDiv(url) {
262
- return $('<div />').attr('id', 'fb-root').addClass('share').append(
263
- $('<fb:like />').attr({
264
- href : url,
265
- send : 'true',
266
- width : '450',
267
- show_faces : 'true',
268
- font : ''
269
- })
270
- );
271
- }
272
-
273
- // Facebook asynchronous init
274
- function fbAsyncInit() {
275
- FB.init({
276
- appId : facebookAppId,
277
- status : true,
278
- cookie : true,
279
- xfbml : true
280
- });
281
- }
282
-
283
- function facebookScript() {
284
- return $('<script />').attr({
285
- src : 'http://connect.facebook.net/en_US/all.js'
286
- });
287
- }
288
-
289
- function createImage() {
290
- var createdImageDiv,
291
- uVal = $('#u').val();
292
-
293
- if (uVal !== '') {
294
- createdImageDiv = $('#createdImage');
295
-
296
- $('#positionTextCanvasDiv').empty();
297
-
298
- createdImageDiv.prepend($('<p />').append('Creating image ...'));
299
-
300
- $.get(genUrl, {
301
- u : uVal,
302
- t1 : $('#t1').val(),
303
- t2 : $('#t2').val(),
304
-
305
- t1x : $('#t1x').val(),
306
- t1y : $('#t1y').val(),
307
- t1w : $('#t1w').val(),
308
- t1h : $('#t1h').val(),
309
-
310
- t2x : $('#t2x').val(),
311
- t2y : $('#t2y').val(),
312
- t2w : $('#t2w').val(),
313
- t2h : $('#t2h').val()
314
- }, function (data) {
315
- var img = $('<img />').attr('src', data.imageUrl),
316
- imgLink = $('<a />').attr('href', data.imageUrl).append(
317
- data.imageUrl
318
- ),
319
- templateLink = $('<a />').attr(
320
- 'href',
321
- data.templateUrl
322
- ).append(data.templateUrl);
323
-
324
- createdImageDiv.empty().append(img).append(
325
- $('<p />').append('Image: ').append(imgLink)
326
- );
327
-
328
- // template link
329
- createdImageDiv.append(
330
- $('<p />').append('To make more with this source image: ').
331
- append(templateLink)
332
- );
333
-
334
- // imgur link
335
- createdImageDiv.append($('<div />').addClass(
336
- 'share'
337
- ).append(imgurLink(data.imageUrl)));
338
-
339
- // reddit link
340
- createdImageDiv.append($('<div />').addClass(
341
- 'share'
342
- ).append(redditLink(data.imageUrl)));
343
-
344
- // tweet link
345
- createdImageDiv.append($('<div />').addClass('share').append(
346
- tweetLink(data.imageUrl)
347
- ).append(tweetScript()));
348
-
349
- // Facebook like
350
- createdImageDiv.append(facebookLikeDiv(data.imageUrl));
351
- window.fbAsyncInit = fbAsyncInit;
352
- createdImageDiv.append(facebookScript());
353
- }, genDataType).error(function (j) {
354
- createdImageDiv.empty().append($('<p />').text(j.responseText));
355
- });
356
- }
357
- }
358
-
359
- my.init = function () {
360
- loadSourceImages();
361
-
362
- $('#imageSearch').keypress(function (event) {
363
- if (event.which === 13) {
364
- event.preventDefault();
365
- imageSearch();
366
- }
367
- });
368
-
369
- $('#imageSearchButton').click(imageSearch);
370
-
371
- $('#positionTextButton').click(positionText);
372
-
373
- $('#createImageButton').click(createImage);
374
-
375
- $('#upload').change(function () {
376
- $('#uploadSubmit').removeAttr('disabled');
377
- });
378
-
379
- // highlight input fields that have been preloaded from the query string
380
- $(":text[value!='']").addClass('attn');
381
-
382
- if (!window.CanvasRenderingContext2D) {
383
- $('.hasCanvas').hide();
384
- $('.noCanvas').show();
385
- }
386
- };
387
-
388
- return my;
389
- }(window, $, fabric));
390
-
391
- $(MEMECAPTAIN.init);