SiteOrigin Widgets Bundle - Version 1.5.3

Version Description

  • November 17 2015 =
  • Fixed defaults for Features widget and Hero Image widget.
  • Fixed previewing for Editor widget.
  • Change measurement field to work as single string.
  • Use new measurement field for existing widgets.
  • Carousel widget supports RTL.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin Widgets Bundle
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.2 to 1.5.3

Files changed (37) hide show
  1. admin/trianglify.min.js +1 -1
  2. base/inc/fields/base.class.php +7 -4
  3. base/inc/fields/checkbox.class.php +1 -1
  4. base/inc/fields/color.class.php +1 -1
  5. base/inc/fields/container-base.class.php +2 -2
  6. base/inc/fields/error.class.php +1 -1
  7. base/inc/fields/font.class.php +1 -1
  8. base/inc/fields/icon.class.php +1 -1
  9. base/inc/fields/js/so-tinymce-field.js +0 -2
  10. base/inc/fields/link.class.php +1 -1
  11. base/inc/fields/measurement.class.php +43 -13
  12. base/inc/fields/media.class.php +1 -1
  13. base/inc/fields/number.class.php +1 -1
  14. base/inc/fields/posts.class.php +1 -1
  15. base/inc/fields/radio.class.php +1 -1
  16. base/inc/fields/repeater.class.php +2 -2
  17. base/inc/fields/select.class.php +1 -1
  18. base/inc/fields/slider.class.php +1 -1
  19. base/inc/fields/text-input-base.class.php +1 -1
  20. base/inc/fields/tinymce.class.php +1 -1
  21. base/js/admin.js +16 -0
  22. base/js/admin.min.js +1 -1
  23. base/siteorigin-widget.class.php +11 -2
  24. readme.txt +8 -1
  25. so-widgets-bundle.php +3 -3
  26. widgets/so-contact-widget/so-contact-widget.php +1 -4
  27. widgets/so-features-widget/so-features-widget.php +5 -5
  28. widgets/so-features-widget/styles/features.less +23 -29
  29. widgets/so-headline-widget/so-headline-widget.php +20 -0
  30. widgets/so-headline-widget/styles/sow-headline.less +7 -5
  31. widgets/so-hero-widget/styles/default.less +1 -1
  32. widgets/so-post-carousel-widget/css/style.css +12 -6
  33. widgets/so-post-carousel-widget/js/carousel.js +13 -9
  34. widgets/so-post-carousel-widget/js/carousel.min.js +1 -1
  35. widgets/so-post-carousel-widget/so-post-carousel-widget.php +1 -14
  36. widgets/so-post-carousel-widget/tpl/base.php +5 -18
  37. widgets/so-post-carousel-widget/tpl/carousel-post-loop.php +16 -0
admin/trianglify.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Trianglify=e()}}(function(){var e;return function r(e,n,t){function f(o,i){if(!n[o]){if(!e[o]){var s="function"==typeof require&&require;if(!i&&s)return s(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};e[o][0].call(u.exports,function(r){var n=e[o][1][r];return f(n?n:r)},u,u.exports,r,e,n,t)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<t.length;o++)f(t[o]);return f}({"./lib/trianglify.js":[function(e,r,n){function t(e){function r(e,r,n){return(e-r[0])*(n[1]-n[0])/(r[1]-r[0])+n[0]}function n(n,t){for(var f=[],a=-y;n+y>a;a+=e.cell_size)for(var o=-w;t+w>o;o+=e.cell_size){var i=a+e.cell_size/2+r(rand(),[0,1],[-v,v]),s=o+e.cell_size/2+r(rand(),[0,1],[-v,v]);f.push([i,s].map(Math.floor))}return f}function t(e){return{x:(e[0][0]+e[1][0]+e[2][0])/3,y:(e[0][1]+e[1][1]+e[2][1])/3}}function i(){if(e.palette instanceof Array)return e.palette[Math.floor(rand()*e.palette.length)];var r=Object.keys(e.palette);return e.palette[r[Math.floor(rand()*r.length)]]}function u(e,r){var n={};for(var t in e)n[t]=e[t];for(t in r){if(!e.hasOwnProperty(t))throw new Error(t+" is not a configuration option for Trianglify. Check your spelling?");n[t]=r[t]}return n}if(e=u(c,e),rand=a(e.seed),"random"===e.x_colors&&(e.x_colors=i()),"random"===e.y_colors&&(e.y_colors=i()),"match_x"===e.y_colors&&(e.y_colors=e.x_colors),!(e.width>0&&e.height>0))throw new Error("Width and height must be numbers greater than 0");if(e.cell_size<2)throw new Error("Cell size must be greater than 2.");var d;if(e.color_function)d=function(r,n){return o(e.color_function(r,n))};else{var l=o.scale(e.x_colors).mode(e.color_space),b=o.scale(e.y_colors).mode(e.color_space);d=function(r,n){return o.interpolate(l(r),b(n),.5,e.color_space)}}for(var h=e.width,g=e.height,p=Math.floor((h+4*e.cell_size)/e.cell_size),m=Math.floor((g+4*e.cell_size)/e.cell_size),y=(p*e.cell_size-h)/2,w=(m*e.cell_size-g)/2,v=e.cell_size*e.variance/2,x=function(e){return r(e,[-y,h+y],[0,1])},_=function(e){return r(e,[-w,g+w],[0,1])},k=n(h,g),j=f.triangulate(k),M=[],N=function(e){return k[e]},D=0;D<j.length;D+=3){var U=[j[D],j[D+1],j[D+2]].map(N),A=t(U),P=d(x(A.x),_(A.y)).hex();M.push([P,U])}return s(M,e)}var f=e("delaunay-fast"),a=e("seedrandom"),o=e("chroma-js"),i=e("./colorbrewer"),s=e("./pattern"),c={width:600,height:400,cell_size:75,variance:.75,seed:null,x_colors:"random",y_colors:"match_x",palette:i,color_space:"lab",color_function:null,stroke_width:1.51};t.colorbrewer=i,t.defaults=c,r.exports=t},{"./colorbrewer":"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js","./pattern":"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js","chroma-js":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js",seedrandom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js"}],"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js":[function(e,r,n){r.exports={YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]}},{}],"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js":[function(e,r,n){(function(n){function t(r,t){function a(){var e=f.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("width",t.width),e.setAttribute("height",t.height),r.forEach(function(r){var n=f.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M"+r[1].join("L")+"Z"),n.setAttribute("fill",r[0]),n.setAttribute("stroke",r[0]),n.setAttribute("stroke-width",t.stroke_width),e.appendChild(n)}),e}function o(a){if("undefined"!=typeof n)try{e("canvas")}catch(o){throw Error("The optional node-canvas dependency is needed for Trianglify to render using canvas in node.")}return a||(a=f.createElement("canvas")),a.setAttribute("width",t.width),a.setAttribute("height",t.height),ctx=a.getContext("2d"),ctx.canvas.width=t.width,ctx.canvas.height=t.height,r.forEach(function(e){ctx.fillStyle=ctx.strokeStyle=e[0],ctx.lineWidth=t.stroke_width,ctx.beginPath(),ctx.moveTo.apply(ctx,e[1][0]),ctx.lineTo.apply(ctx,e[1][1]),ctx.lineTo.apply(ctx,e[1][2]),ctx.fill(),ctx.stroke()}),a}function i(){return o().toDataURL("image/png")}return{polys:r,opts:t,svg:a,canvas:o,png:i}}var f="undefined"!=typeof document?document:e("jsdom").jsdom("<html/>");r.exports=t}).call(this,e("_process"))},{_process:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js",canvas:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js",jsdom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js":[function(e,r,n){},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js":[function(e,r,n){function t(){if(!i){i=!0;for(var e,r=o.length;r;){e=o,o=[];for(var n=-1;++n<r;)e[n]();r=o.length}i=!1}}function f(){}var a=r.exports={},o=[],i=!1;a.nextTick=function(e){o.push(e),i||setTimeout(t,0)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=f,a.addListener=f,a.once=f,a.off=f,a.removeListener=f,a.removeAllListeners=f,a.emit=f,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js":[function(r,n,t){(function(){var r,f,a,o,i,s,c,u,d,l,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,R,S,O,C,T;l=function(e,n,t,f){return new r(e,n,t,f)},"undefined"!=typeof n&&null!==n&&null!=n.exports&&(n.exports=l),"function"==typeof e&&e.amd?e([],function(){return l}):(q="undefined"!=typeof t&&null!==t?t:this,q.chroma=l),l.color=function(e,n,t,f){return new r(e,n,t,f)},l.hsl=function(e,n,t,f){return new r(e,n,t,f,"hsl")},l.hsv=function(e,n,t,f){return new r(e,n,t,f,"hsv")},l.rgb=function(e,n,t,f){return new r(e,n,t,f,"rgb")},l.hex=function(e){return new r(e)},l.css=function(e){return new r(e)},l.lab=function(e,n,t){return new r(e,n,t,"lab")},l.lch=function(e,n,t){return new r(e,n,t,"lch")},l.hsi=function(e,n,t){return new r(e,n,t,"hsi")},l.gl=function(e,n,t,f){return new r(255*e,255*n,255*t,f,"gl")},l.interpolate=function(e,n,t,f){return null==e||null==n?"#000":("string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),e.interpolate(t,n,f))},l.mix=l.interpolate,l.contrast=function(e,n){var t,f;return"string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),t=e.luminance(),f=n.luminance(),t>f?(t+.05)/(f+.05):(f+.05)/(t+.05)},l.luminance=function(e){return l(e).luminance()},l._Color=r,r=function(){function e(){var e,r,n,t,f,a,o,i,s,c,u,d,l,h,g,p;for(f=this,n=[],c=0,u=arguments.length;u>c;c++)r=arguments[c],null!=r&&n.push(r);if(0===n.length)d=[255,0,255,1,"rgb"],o=d[0],i=d[1],s=d[2],e=d[3],t=d[4];else if("array"===R(n[0])){if(3===n[0].length)l=n[0],o=l[0],i=l[1],s=l[2],e=1;else{if(4!==n[0].length)throw"unknown input argument";h=n[0],o=h[0],i=h[1],s=h[2],e=h[3]}t=null!=(g=n[1])?g:"rgb"}else"string"===R(n[0])?(o=n[0],t="hex"):"object"===R(n[0])?(p=n[0]._rgb,o=p[0],i=p[1],s=p[2],e=p[3],t="rgb"):n.length>=3&&(o=n[0],i=n[1],s=n[2]);3===n.length?(t="rgb",e=1):4===n.length?"string"===R(n[3])?(t=n[3],e=1):"number"===R(n[3])&&(t="rgb",e=n[3]):5===n.length&&(e=n[3],t=n[4]),null==e&&(e=1),"rgb"===t?f._rgb=[o,i,s,e]:"gl"===t?f._rgb=[255*o,255*i,255*s,e]:"hsl"===t?(f._rgb=w(o,i,s),f._rgb[3]=e):"hsv"===t?(f._rgb=v(o,i,s),f._rgb[3]=e):"hex"===t?f._rgb=m(o):"lab"===t?(f._rgb=_(o,i,s),f._rgb[3]=e):"lch"===t?(f._rgb=M(o,i,s),f._rgb[3]=e):"hsi"===t&&(f._rgb=y(o,i,s),f._rgb[3]=e),a=b(f._rgb)}return e.prototype.rgb=function(){return this._rgb.slice(0,3)},e.prototype.rgba=function(){return this._rgb},e.prototype.hex=function(){return A(this._rgb)},e.prototype.toString=function(){return this.name()},e.prototype.hsl=function(){return z(this._rgb)},e.prototype.hsv=function(){return G(this._rgb)},e.prototype.lab=function(){return E(this._rgb)},e.prototype.lch=function(){return B(this._rgb)},e.prototype.hsi=function(){return P(this._rgb)},e.prototype.gl=function(){return[this._rgb[0]/255,this._rgb[1]/255,this._rgb[2]/255,this._rgb[3]]},e.prototype.luminance=function(r,n){var t,f,a,o;return null==n&&(n="rgb"),arguments.length?(0===r&&(this._rgb=[0,0,0,this._rgb[3]]),1===r&&(this._rgb=[255,255,255,this._rgb[3]]),t=D(this._rgb),f=1e-7,a=20,o=function(e,t){var i,s;return s=e.interpolate(.5,t,n),i=s.luminance(),Math.abs(r-i)<f||!a--?s:i>r?o(e,s):o(s,t)},this._rgb=(t>r?o(new e("black"),this):o(this,new e("white"))).rgba(),this):D(this._rgb)},e.prototype.name=function(){var e,r;e=this.hex();for(r in l.colors)if(e===l.colors[r])return r;return e},e.prototype.alpha=function(e){return arguments.length?(this._rgb[3]=e,this):this._rgb[3]},e.prototype.css=function(e){var r,n,t,f;return null==e&&(e="rgb"),n=this,t=n._rgb,3===e.length&&t[3]<1&&(e+="a"),"rgb"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+","+t[3]+")":"hsl"===e||"hsla"===e?(r=n.hsl(),f=function(e){return Math.round(100*e)/100},r[0]=f(r[0]),r[1]=f(100*r[1])+"%",r[2]=f(100*r[2])+"%",4===e.length&&(r[3]=t[3]),e+"("+r.join(",")+")"):void 0},e.prototype.interpolate=function(r,n,t){var f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=this,null==t&&(t="rgb"),"string"===R(n)&&(n=new e(n)),"hsl"===t||"hsv"===t||"lch"===t||"hsi"===t)"hsl"===t?(p=d.hsl(),m=n.hsl()):"hsv"===t?(p=d.hsv(),m=n.hsv()):"hsi"===t?(p=d.hsi(),m=n.hsi()):"lch"===t&&(p=d.lch(),m=n.lch()),"h"===t.substr(0,1)?(o=p[0],h=p[1],c=p[2],i=m[0],g=m[1],u=m[2]):(c=p[0],h=p[1],o=p[2],u=m[0],g=m[1],i=m[2]),isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?a=Number.NaN:(a=i,1!==c&&0!==c||"hsv"===t||(b=g)):(a=o,1!==u&&0!==u||"hsv"===t||(b=h)):(f=i>o&&i-o>180?i-(o+360):o>i&&o-i>180?i+360-o:i-o,a=o+r*f),null==b&&(b=h+r*(g-h)),s=c+r*(u-c),l="h"===t.substr(0,1)?new e(a,b,s,t):new e(s,b,a,t);else if("rgb"===t)p=d._rgb,m=n._rgb,l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t);else{if("lab"!==t)throw"color mode "+t+" is not supported";p=d.lab(),m=n.lab(),l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t)}return l.alpha(d.alpha()+r*(n.alpha()-d.alpha())),l},e.prototype.premultiply=function(){var e,r;return r=this.rgb(),e=this.alpha(),l(r[0]*e,r[1]*e,r[2]*e,e)},e.prototype.darken=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[0]-=e,l.lch(r).alpha(n.alpha())},e.prototype.darker=function(e){return this.darken(e)},e.prototype.brighten=function(e){return null==e&&(e=20),this.darken(-e)},e.prototype.brighter=function(e){return this.brighten(e)},e.prototype.saturate=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[1]+=e,l.lch(r).alpha(n.alpha())},e.prototype.desaturate=function(e){return null==e&&(e=20),this.saturate(-e)},e}(),b=function(e){var r;for(r in e)3>r?(e[r]<0&&(e[r]=0),e[r]>255&&(e[r]=255)):3===r&&(e[r]<0&&(e[r]=0),e[r]>1&&(e[r]=1));return e},p=function(e){var r,n,t,f,a,o,i,s;if(e=e.toLowerCase(),null!=l.colors&&l.colors[e])return m(l.colors[e]);if(t=e.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(f=t.slice(1,4),n=a=0;2>=a;n=++a)f[n]=+f[n];f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(f=t.slice(1,5),n=o=0;3>=o;n=++o)f[n]=+f[n];else if(t=e.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(f=t.slice(1,4),n=i=0;2>=i;n=++i)f[n]=Math.round(2.55*f[n]);f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(f=t.slice(1,5),n=s=0;2>=s;n=++s)f[n]=Math.round(2.55*f[n]);f[3]=+f[3]}else(t=e.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=1):(t=e.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=+t[4]);return f},m=function(e){var r,n,t,f,a,o;if(e.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})#x2F;))return(4===e.length||7===e.length)&&(e=e.substr(1)),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),o=parseInt(e,16),f=o>>16,t=o>>8&255,n=255&o,[f,t,n,1];if(e.match(/^#?([A-Fa-f0-9]{8})#x2F;))return 9===e.length&&(e=e.substr(1)),o=parseInt(e,16),f=o>>24&255,t=o>>16&255,n=o>>8&255,r=255&o,[f,t,n,r];if(a=p(e))return a;throw"unknown color: "+e},y=function(e,r,n){var t,f,i,s;return s=S(arguments),e=s[0],r=s[1],n=s[2],e/=360,1/3>e?(t=(1-r)/3,i=(1+r*g(o*e)/g(a-o*e))/3,f=1-(t+i)):2/3>e?(e-=1/3,i=(1-r)/3,f=(1+r*g(o*e)/g(a-o*e))/3,t=1-(i+f)):(e-=2/3,f=(1-r)/3,t=(1+r*g(o*e)/g(a-o*e))/3,i=1-(f+t)),i=N(n*i*3),f=N(n*f*3),t=N(n*t*3),[255*i,255*f,255*t]},w=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b;if(l=S(arguments),t=l[0],i=l[1],a=l[2],0===i)o=n=e=255*a;else{for(u=[0,0,0],r=[0,0,0],c=.5>a?a*(1+i):a+i-a*i,s=2*a-c,t/=360,u[0]=t+1/3,u[1]=t,u[2]=t-1/3,f=d=0;2>=d;f=++d)u[f]<0&&(u[f]+=1),u[f]>1&&(u[f]-=1),6*u[f]<1?r[f]=s+6*(c-s)*u[f]:2*u[f]<1?r[f]=c:3*u[f]<2?r[f]=s+(c-s)*(2/3-u[f])*6:r[f]=s;b=[Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])],o=b[0],n=b[1],e=b[2]}return[o,n,e]},v=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=S(arguments),t=d[0],s=d[1],u=d[2],u*=255,0===s)i=n=e=u;else switch(360===t&&(t=0),t>360&&(t-=360),0>t&&(t+=360),t/=60,f=Math.floor(t),r=t-f,a=u*(1-s),o=u*(1-s*r),c=u*(1-s*(1-r)),f){case 0:l=[u,c,a],i=l[0],n=l[1],e=l[2];break;case 1:b=[o,u,a],i=b[0],n=b[1],e=b[2];break;case 2:h=[a,u,c],i=h[0],n=h[1],e=h[2];break;case 3:g=[a,o,u],i=g[0],n=g[1],e=g[2];break;case 4:p=[c,a,u],i=p[0],n=p[1],e=p[2];break;case 5:m=[u,a,o],i=m[0],n=m[1],e=m[2]}return i=Math.round(i),n=Math.round(n),e=Math.round(e),[i,n,e]},f=18,i=.95047,s=1,c=1.08883,x=function(){var e,r,n,t,f,a;return a=S(arguments),f=a[0],e=a[1],r=a[2],n=Math.sqrt(e*e+r*r),t=Math.atan2(r,e)/Math.PI*180,[f,n,t]},_=function(e,r,n){var t,f,a,o,u,d,l;return void 0!==e&&3===e.length&&(d=e,e=d[0],r=d[1],n=d[2]),void 0!==e&&3===e.length&&(l=e,e=l[0],r=l[1],n=l[2]),o=(e+16)/116,a=o+r/500,u=o-n/200,a=k(a)*i,o=k(o)*s,u=k(u)*c,f=C(3.2404542*a-1.5371385*o-.4985314*u),t=C(-.969266*a+1.8760108*o+.041556*u),n=C(.0556434*a-.2040259*o+1.0572252*u),[N(f,0,255),N(t,0,255),N(n,0,255),1]},k=function(e){return e>.206893034?e*e*e:(e-4/29)/7.787037},C=function(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))},j=function(){var e,r,n,t;return t=S(arguments),n=t[0],e=t[1],r=t[2],r=r*Math.PI/180,[n,Math.cos(r)*e,Math.sin(r)*e]},M=function(e,r,n){var t,f,a,o,i,s,c;return s=j(e,r,n),t=s[0],f=s[1],a=s[2],c=_(t,f,a),i=c[0],o=c[1],a=c[2],[N(i,0,255),N(o,0,255),N(a,0,255)]},D=function(e,r,n){var t;return t=S(arguments),e=t[0],r=t[1],n=t[2],e=U(e),r=U(r),n=U(n),.2126*e+.7152*r+.0722*n},U=function(e){return e/=255,.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},A=function(){var e,r,n,t,f,a;return a=S(arguments),n=a[0],r=a[1],e=a[2],f=n<<16|r<<8|e,t="000000"+f.toString(16),"#"+t.substr(t.length-6)},P=function(){var e,r,n,t,f,a,o,i,s;return s=S(arguments),o=s[0],n=s[1],r=s[2],e=2*Math.PI,o/=255,n/=255,r/=255,a=Math.min(o,n,r),f=(o+n+r)/3,i=1-a/f,0===i?t=0:(t=(o-n+(o-r))/2,t/=Math.sqrt((o-n)*(o-n)+(o-r)*(n-r)),t=Math.acos(t),r>n&&(t=e-t),t/=e),[360*t,i,f]},z=function(e,r,n){var t,f,a,o,i,s;return void 0!==e&&e.length>=3&&(s=e,e=s[0],r=s[1],n=s[2]),e/=255,r/=255,n/=255,o=Math.min(e,r,n),a=Math.max(e,r,n),f=(a+o)/2,a===o?(i=0,t=Number.NaN):i=.5>f?(a-o)/(a+o):(a-o)/(2-a-o),e===a?t=(r-n)/(a-o):r===a?t=2+(n-e)/(a-o):n===a&&(t=4+(e-r)/(a-o)),t*=60,0>t&&(t+=360),[t,i,f]},G=function(){var e,r,n,t,f,a,o,i,s,c;return c=S(arguments),o=c[0],n=c[1],e=c[2],a=Math.min(o,n,e),f=Math.max(o,n,e),r=f-a,s=f/255,0===f?(t=Number.NaN,i=0):(i=r/f,o===f&&(t=(n-e)/r),n===f&&(t=2+(e-o)/r),e===f&&(t=4+(o-n)/r),t*=60,0>t&&(t+=360)),[t,i,s]},E=function(){var e,r,n,t,f,a,o;return o=S(arguments),n=o[0],r=o[1],e=o[2],n=I(n),r=I(r),e=I(e),t=O((.4124564*n+.3575761*r+.1804375*e)/i),f=O((.2126729*n+.7151522*r+.072175*e)/s),a=O((.0193339*n+.119192*r+.9503041*e)/c),[116*f-16,500*(t-f),200*(f-a)]},I=function(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},O=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},B=function(){var e,r,n,t,f,a,o;return a=S(arguments),f=a[0],n=a[1],r=a[2],o=E(f,n,r),t=o[0],e=o[1],r=o[2],x(t,e,r)},l.scale=function(e,r){var n,t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k;return y="rgb",w=l("#ccc"),k=0,g=!1,h=[0,1],d=[],x=!1,_=[],m=0,p=1,b=!1,v=0,u={},i=function(e,r){var n,t,f,a,i,s,c;if(null==e&&(e=["#ddd","#222"]),null!=e&&"string"===R(e)&&null!=(null!=(i=l.brewer)?i[e]:void 0)&&(e=l.brewer[e]),"array"===R(e)){for(e=e.slice(0),n=f=0,s=e.length-1;s>=0?s>=f:f>=s;n=s>=0?++f:--f)t=e[n],"string"===R(t)&&(e[n]=l(t));if(null!=r)_=r;else for(_=[],n=a=0,c=e.length-1;c>=0?c>=a:a>=c;n=c>=0?++a:--a)_.push(n/(e.length-1))}return o(),d=e},s=function(e){return null==e&&(e=[]),h=e,m=e[0],p=e[e.length-1],o(),v=2===e.length?0:e.length-1},f=function(e){var r,n;if(null!=h){for(n=h.length-1,r=0;n>r&&e>=h[r];)r++;return r-1}return 0},c=function(e){return e},n=function(e){var r,n,t,a,o;return o=e,h.length>2&&(a=h.length-1,r=f(e),t=h[0]+(h[1]-h[0])*(0+.5*k),n=h[a-1]+(h[a]-h[a-1])*(1-.5*k),o=m+(h[r]+.5*(h[r+1]-h[r])-t)/(n-t)*(p-m)),o},a=function(e,r){var n,t,a,o,i,s,b,g,x;if(null==r&&(r=!1),isNaN(e))return w;if(r?b=e:h.length>2?(n=f(e),b=n/(v-1)):(b=a=m!==p?(e-m)/(p-m):0,b=a=(e-m)/(p-m),b=Math.min(1,Math.max(0,b))),r||(b=c(b)),i=Math.floor(1e4*b),u[i])t=u[i];else{if("array"===R(d))for(o=g=0,x=_.length-1;x>=0?x>=g:g>=x;o=x>=0?++g:--g){if(s=_[o],s>=b){t=d[o];break}if(b>=s&&o===_.length-1){t=d[o];break}if(b>s&&b<_[o+1]){b=(b-s)/(_[o+1]-s),t=l.interpolate(d[o],d[o+1],b,y);break}}else"function"===R(d)&&(t=d(b));u[i]=t}return t},o=function(){return u={}},i(e,r),t=function(e){var r;return r=a(e),x&&r[x]?r[x]():r},t.domain=function(e,r,n,f){var a;return null==n&&(n="e"),arguments.length?(null!=r&&(a=l.analyze(e,f),e=0===r?[a.min,a.max]:l.limits(a,n,r)),s(e),t):h},t.mode=function(e){return arguments.length?(y=e,o(),t):y},t.range=function(e,r){return i(e,r),t},t.out=function(e){return x=e,t},t.spread=function(e){return arguments.length?(k=e,t):k},t.correctLightness=function(e){return arguments.length?(b=e,o(),c=b?function(e){var r,n,t,f,o,i,s,c,u;for(r=a(0,!0).lab()[0],n=a(1,!0).lab()[0],s=r>n,t=a(e,!0).lab()[0],o=r+(n-r)*e,f=t-o,c=0,u=1,i=20;Math.abs(f)>.01&&i-->0;)!function(){return s&&(f*=-1),0>f?(c=e,e+=.5*(u-e)):(u=e,e+=.5*(c-e)),t=a(e,!0).lab()[0],f=t-o}();return e}:function(e){return e},t):b},t.colors=function(r){var n,f,a,o,i,s;if(null==r&&(r="hex"),e=[],f=[],h.length>2)for(n=a=1,s=h.length;s>=1?s>a:a>s;n=s>=1?++a:--a)f.push(.5*(h[n-1]+h[n]));else f=h;for(o=0,i=f.length;i>o;o++)n=f[o],e.push(t(n)[r]());return e},t},null==(T=l.scales)&&(l.scales={}),l.scales.cool=function(){return l.scale([l.hsl(180,1,.9),l.hsl(250,.7,.4)])},l.scales.hot=function(){return l.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},l.analyze=function(e,r,n){var t,f,a,o,i,s,c;if(a={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==n&&(n=function(){return!0}),t=function(e){null==e||isNaN(e)||(a.values.push(e),a.sum+=e,e<a.min&&(a.min=e),e>a.max&&(a.max=e),a.count+=1)},i=function(e,f){return n(e,f)?t(null!=r&&"function"===R(r)?r(e):null!=r&&"string"===R(r)||"number"===R(r)?e[r]:e):void 0},"array"===R(e))for(s=0,c=e.length;c>s;s++)o=e[s],i(o);else for(f in e)o=e[f],i(o,f);return a.domain=[a.min,a.max],a.limits=function(e,r){return l.limits(a,e,r)},a},l.limits=function(e,r,n){var t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,S,O,C,T,Y,L,F,V,X,W,$,Z,H,J,K,Q,ee,re,ne,te,fe,ae,oe;if(null==r&&(r="equal"),null==n&&(n=7),"array"===R(e)&&(e=l.analyze(e)),p=e.min,h=e.max,N=e.sum,A=e.values.sort(function(e,r){return e-r}),b=[],"c"===r.substr(0,1)&&(b.push(p),b.push(h)),"e"===r.substr(0,1)){for(b.push(p),c=P=1,T=n-1;T>=1?T>=P:P>=T;c=T>=1?++P:--P)b.push(p+c/n*(h-p));b.push(h)}else if("l"===r.substr(0,1)){if(0>=p)throw"Logarithmic scales are only possible for values > 0";for(m=Math.LOG10E*Math.log(p),g=Math.LOG10E*Math.log(h),b.push(p),c=z=1,$=n-1;gt;=1?gt;=z:z>=$;c=gt;=1?++z:--z)b.push(Math.pow(10,m+c/n*(g-m)));b.push(h)}else if("q"===r.substr(0,1)){for(b.push(p),c=G=1,Z=n-1;Z>=1?Z>=G:G>=Z;c=Z>=1?++G:--G)_=A.length*c/n,k=Math.floor(_),k===_?b.push(A[k]):(j=_-k,b.push(A[k]*j+A[k+1]*(1-j)));b.push(h)}else if("k"===r.substr(0,1)){for(w=A.length,t=new Array(w),i=new Array(n),M=!0,v=0,a=null,a=[],a.push(p),c=E=1,H=n-1;H>=1?H>=E:E>=H;c=H>=1?++E:--E)a.push(p+c/n*(h-p));for(a.push(h);M;){for(u=B=0,J=n-1;J>=0?J>=B:B>=J;u=J>=0?++B:--B)i[u]=0;for(c=I=0,K=w-1;K>=0?K>=I:I>=K;c=K>=0?++I:--I){for(U=A[c],y=Number.MAX_VALUE,u=q=0,Q=n-1;Q>=0?Q>=q:q>=Q;u=Q>=0?++q:--q)s=Math.abs(a[u]-U),y>s&&(y=s,f=u);i[f]++,t[c]=f}for(x=new Array(n),u=S=0,ee=n-1;ee>=0?ee>=S:S>=ee;u=ee>=0?++S:--S)x[u]=null;for(c=O=0,re=w-1;re>=0?re>=O:O>=re;c=re>=0?++O:--O)o=t[c],null===x[o]?x[o]=A[c]:x[o]+=A[c];for(u=C=0,Y=n-1;Y>=0?Y>=C:C>=Y;u=Y>=0?++C:--C)x[u]*=1/i[u];for(M=!1,u=ne=0,L=n-1;L>=0?L>=ne:ne>=L;u=L>=0?++ne:--ne)if(x[u]!==a[c]){M=!0;break}a=x,v++,v>200&&(M=!1)}for(d={},u=te=0,F=n-1;F>=0?F>=te:te>=F;u=F>=0?++te:--te)d[u]=[];for(c=fe=0,V=w-1;V>=0?V>=fe:fe>=V;c=V>=0?++fe:--fe)o=t[c],d[o].push(A[c]);for(D=[],u=ae=0,X=n-1;X>=0?X>=ae:ae>=X;u=X>=0?++ae:--ae)D.push(d[u][0]),D.push(d[u][d[u].length-1]);for(D=D.sort(function(e,r){return e-r}),b.push(D[0]),c=oe=1,W=D.length-1;W>=oe;c=oe+=2)isNaN(D[c])||b.push(D[c])}return b},l.brewer=d={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},l.colors=h={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"},R=function(){var e,r,n,t,f;for(e={},f="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,t=f.length;t>n;n++)r=f[n],e["[object "+r+"]"]=r.toLowerCase();return function(r){var n;return n=Object.prototype.toString.call(r),e[n]||"object"}}(),N=function(e,r,n){return null==r&&(r=0),null==n&&(n=1),r>e&&(e=r),e>n&&(e=n),e},S=function(e){return e.length>=3?e:e[0]},o=2*Math.PI,a=Math.PI/3,g=Math.cos,u=function(e){var r,n,t,f,a,o,i,s,c,d,b;return e=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(l(f));return t}(),2===e.length?(c=function(){var r,n,t;for(t=[],r=0,
2
n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=c[0],o=c[1],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push(a[r]+e*(o[r]-a[r]));return t}(),l.lab.apply(l,n)}):3===e.length?(d=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=d[0],o=d[1],i=d[2],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*a[r]+2*(1-e)*e*o[r]+e*e*i[r]);return t}(),l.lab.apply(l,n)}):4===e.length?(b=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=b[0],o=b[1],i=b[2],s=b[3],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*(1-e)*a[r]+3*(1-e)*(1-e)*e*o[r]+3*(1-e)*e*e*i[r]+e*e*e*s[r]);return t}(),l.lab.apply(l,n)}):5===e.length&&(n=u(e.slice(0,3)),t=u(e.slice(2,5)),r=function(e){return.5>e?n(2*e):t(2*(e-.5))}),r},l.interpolate.bezier=u}).call(this)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js":[function(e,r,n){var t;!function(){"use strict";function e(e){var r,n,t,f,a,o,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(r=e.length;r--;)e[r][0]<i&&(i=e[r][0]),e[r][0]>c&&(c=e[r][0]),e[r][1]<s&&(s=e[r][1]),e[r][1]>u&&(u=e[r][1]);return n=c-i,t=u-s,f=Math.max(n,t),a=i+.5*n,o=s+.5*t,[[a-20*f,o-f],[a,o+20*f],[a+20*f,o-f]]}function n(e,r,n,t){var f,o,i,s,c,u,d,l,b,h,g=e[r][0],p=e[r][1],m=e[n][0],y=e[n][1],w=e[t][0],v=e[t][1],x=Math.abs(p-y),_=Math.abs(y-v);if(a>x&&a>_)throw new Error("Eek! Coincident points!");return a>x?(s=-((w-m)/(v-y)),u=(m+w)/2,l=(y+v)/2,f=(m+g)/2,o=s*(f-u)+l):a>_?(i=-((m-g)/(y-p)),c=(g+m)/2,d=(p+y)/2,f=(w+m)/2,o=i*(f-c)+d):(i=-((m-g)/(y-p)),s=-((w-m)/(v-y)),c=(g+m)/2,u=(m+w)/2,d=(p+y)/2,l=(y+v)/2,f=(i*c-s*u+l-d)/(i-s),o=x>_?i*(f-c)+d:s*(f-u)+l),b=m-f,h=y-o,{i:r,j:n,k:t,x:f,y:o,r:b*b+h*h}}function f(e){var r,n,t,f,a,o;for(n=e.length;n;)for(f=e[--n],t=e[--n],r=n;r;)if(o=e[--r],a=e[--r],t===a&&f===o||t===o&&f===a){e.splice(n,2),e.splice(r,2);break}}var a=1/1048576;t={triangulate:function(r,t){var o,i,s,c,u,d,l,b,h,g,p,m,y=r.length;if(3>y)return[];if(r=r.slice(0),t)for(o=y;o--;)r[o]=r[o][t];for(s=new Array(y),o=y;o--;)s[o]=o;for(s.sort(function(e,n){return r[n][0]-r[e][0]}),c=e(r),r.push(c[0],c[1],c[2]),u=[n(r,y+0,y+1,y+2)],d=[],l=[],o=s.length;o--;l.length=0){for(m=s[o],i=u.length;i--;)b=r[m][0]-u[i].x,b>0&&b*b>u[i].r?(d.push(u[i]),u.splice(i,1)):(h=r[m][1]-u[i].y,b*b+h*h-u[i].r>a||(l.push(u[i].i,u[i].j,u[i].j,u[i].k,u[i].k,u[i].i),u.splice(i,1)));for(f(l),i=l.length;i;)p=l[--i],g=l[--i],u.push(n(r,g,p,m))}for(o=u.length;o--;)d.push(u[o]);for(u.length=0,o=d.length;o--;)d[o].i<y&&d[o].j<y&&d[o].k<y&&u.push(d[o].i,d[o].j,d[o].k);return u},contains:function(e,r){if(r[0]<e[0][0]&&r[0]<e[1][0]&&r[0]<e[2][0]||r[0]>e[0][0]&&r[0]>e[1][0]&&r[0]>e[2][0]||r[1]<e[0][1]&&r[1]<e[1][1]&&r[1]<e[2][1]||r[1]>e[0][1]&&r[1]>e[1][1]&&r[1]>e[2][1])return null;var n=e[1][0]-e[0][0],t=e[2][0]-e[0][0],f=e[1][1]-e[0][1],a=e[2][1]-e[0][1],o=n*a-t*f;if(0===o)return null;var i=(a*(r[0]-e[0][0])-t*(r[1]-e[0][1]))/o,s=(n*(r[1]-e[0][1])-f*(r[0]-e[0][0]))/o;return 0>i||0>s||i+s>1?null:[i,s]}},"undefined"!=typeof r&&(r.exports=t)}()},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js":[function(e,r,n){var t=e("./lib/alea"),f=e("./lib/xor128"),a=e("./lib/xorwow"),o=e("./lib/xorshift7"),i=e("./lib/xor4096"),s=e("./lib/tychei"),c=e("./seedrandom");c.alea=t,c.xor128=f,c.xorwow=a,c.xorshift7=o,c.xor4096=i,c.tychei=s,r.exports=c},{"./lib/alea":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js","./lib/tychei":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js","./lib/xor128":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js","./lib/xor4096":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js","./lib/xorshift7":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js","./lib/xorwow":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js","./seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n=o();r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function f(e,r){return r.c=e.c,r.s0=e.s0,r.s1=e.s1,r.s2=e.s2,r}function a(e,r){var n=new t(e),a=r&&r.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o["double"]=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}function o(){var e=4022871197,r=function(r){r=r.toString();for(var n=0;n<r.length;n++){e+=r.charCodeAt(n);var t=.02519603282416938*e;e=t>>>0,t-=e,t*=e,e=t>>>0,t-=e,e+=4294967296*t}return 2.3283064365386963e-10*(e>>>0)};return r}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.alea=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.b,n=r.c,t=r.d,f=r.a;return e=e<<25^e>>>7^n,n=n-t|0,t=t<<24^t>>>8^f,f=f-e|0,r.b=e=e<<20^e>>>12^n,r.c=n=n-t|0,r.d=t<<16^n>>>16^f,r.a=f-e|0},r.a=0,r.b=0,r.c=-1640531527,r.d=1367130551,e===Math.floor(e)?(r.a=e/4294967296|0,r.b=0|e):n+=e;for(var t=0;t<n.length+20;t++)r.b^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.tychei=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var e=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^e^e>>>8},e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor128=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f,a,o,i=[],s=128;for(r===(0|r)?(t=r,r=null):(r+="\x00",t=0,s=Math.max(s,r.length)),f=0,a=-32;s>a;++a)r&&(t^=r.charCodeAt((a+32)%r.length)),0===a&&(o=t),t^=t<<10,t^=t>>>15,t^=t<<4,t^=t>>>13,a>=0&&(o=o+1640531527|0,n=i[127&a]^=t+o,f=0==n?f+1:0);for(f>=128&&(i[127&(r&&r.length||0)]=-1),f=127,a=512;a>0;--a)t=i[f+34&127],n=i[f=f+1&127],t^=t<<13,n^=n<<17,t^=t>>>15,n^=n>>>12,i[f]=t^n;e.w=o,e.X=i,e.i=f}var n=this;n.next=function(){var e,r,t=n.w,f=n.X,a=n.i;return n.w=t=t+1640531527|0,r=f[a+34&127],e=f[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=f[a]=r^e,n.i=a,r+(t^t>>>16)|0},r(n,e)}function f(e,r){return r.i=e.i,r.w=e.w,r.X=e.X.slice(),r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.X&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor4096=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f=[];if(r===(0|r))t=f[0]=r;else for(r=""+r,n=0;n<r.length;++n)f[7&n]=f[7&n]<<15^r.charCodeAt(n)+f[n+1&7]<<13;for(;f.length<8;)f.push(0);for(n=0;8>n&&0===f[n];++n);for(t=8==n?f[7]=-1:f[n],e.x=f,e.i=0,n=256;n>0;--n)e.next()}var n=this;n.next=function(){var e,r,t=n.x,f=n.i;return e=t[f],e^=e>>>7,r=e^e<<24,e=t[f+1&7],r^=e^e>>>10,e=t[f+3&7],r^=e^e>>>3,e=t[f+4&7],r^=e^e<<7,e=t[f+7&7],e^=e<<13,r^=e^e<<9,t[f]=r,n.i=f+1&7,r},r(n,e)}function f(e,r){return r.x=e.x.slice(),r.i=e.i,r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.x&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorshift7=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(e^e<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),t==n.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r.v=e.v,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorwow=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js":[function(r,n,t){!function(t,f){function a(e,r,n){var a=[];r=1==r?{entropy:!0}:r||{};var l=c(s(r.entropy?[e,d(t)]:null==e?u():e,3),a),b=new o(a),p=function(){for(var e=b.g(g),r=y,n=0;w>e;)e=(e+n)*h,r*=h,n=b.g(1);for(;e>=v;)e/=2,r/=2,n>>>=1;return(e+n)/r};return p.int32=function(){return 0|b.g(4)},p.quick=function(){return b.g(4)/4294967296},p["double"]=p,c(d(b.S),t),(r.pass||n||function(e,r,n,t){return t&&(t.S&&i(t,b),e.state=function(){return i(b,{})}),n?(f[m]=e,r):e})(p,l,"global"in r?r.global:this==f,r.state)}function o(e){var r,n=e.length,t=this,f=0,a=t.i=t.j=0,o=t.S=[];for(n||(e=[n++]);h>f;)o[f]=f++;for(f=0;h>f;f++)o[f]=o[a=x&a+e[f%n]+(r=o[f])],o[a]=r;(t.g=function(e){for(var r,n=0,f=t.i,a=t.j,o=t.S;e--;)r=o[f=x&f+1],n=n*h+o[x&(o[f]=o[a=x&a+r])+(o[a]=r)];return t.i=f,t.j=a,n})(h)}function i(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function s(e,r){var n,t=[],f=typeof e;if(r&&"object"==f)for(n in e)try{t.push(s(e[n],r-1))}catch(a){}return t.length?t:"string"==f?e:e+"\x00"}function c(e,r){for(var n,t=e+"",f=0;f<t.length;)r[x&f]=x&(n^=19*r[x&f])+t.charCodeAt(f++);return d(r)}function u(){try{if(l)return d(l.randomBytes(h));var e=new Uint8Array(h);return(b.crypto||b.msCrypto).getRandomValues(e),d(e)}catch(r){var n=b.navigator,f=n&&n.plugins;return[+new Date,b,f,b.screen,d(t)]}}function d(e){return String.fromCharCode.apply(0,e)}var l,b=this,h=256,g=6,p=52,m="random",y=f.pow(h,g),w=f.pow(2,p),v=2*w,x=h-1;if(f["seed"+m]=a,c(f.random(),t),"object"==typeof n&&n.exports){n.exports=a;try{l=r("crypto")}catch(_){}}else"function"==typeof e&&e.amd&&e(function(){return a})}([],Math)},{crypto:!1}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")});
1
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Trianglify=e()}}(function(){var e;return function r(e,n,t){function f(o,i){if(!n[o]){if(!e[o]){var s="function"==typeof require&&require;if(!i&&s)return s(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};e[o][0].call(u.exports,function(r){var n=e[o][1][r];return f(n?n:r)},u,u.exports,r,e,n,t)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<t.length;o++)f(t[o]);return f}({"./lib/trianglify.js":[function(e,r,n){function t(e){function r(e,r,n){return(e-r[0])*(n[1]-n[0])/(r[1]-r[0])+n[0]}function n(n,t){for(var f=[],a=-y;n+y>a;a+=e.cell_size)for(var o=-w;t+w>o;o+=e.cell_size){var i=a+e.cell_size/2+r(rand(),[0,1],[-v,v]),s=o+e.cell_size/2+r(rand(),[0,1],[-v,v]);f.push([i,s].map(Math.floor))}return f}function t(e){return{x:(e[0][0]+e[1][0]+e[2][0])/3,y:(e[0][1]+e[1][1]+e[2][1])/3}}function i(){if(e.palette instanceof Array)return e.palette[Math.floor(rand()*e.palette.length)];var r=Object.keys(e.palette);return e.palette[r[Math.floor(rand()*r.length)]]}function u(e,r){var n={};for(var t in e)n[t]=e[t];for(t in r){if(!e.hasOwnProperty(t))throw new Error(t+" is not a configuration option for Trianglify. Check your spelling?");n[t]=r[t]}return n}if(e=u(c,e),rand=a(e.seed),"random"===e.x_colors&&(e.x_colors=i()),"random"===e.y_colors&&(e.y_colors=i()),"match_x"===e.y_colors&&(e.y_colors=e.x_colors),!(e.width>0&&e.height>0))throw new Error("Width and height must be numbers greater than 0");if(e.cell_size<2)throw new Error("Cell size must be greater than 2.");var d;if(e.color_function)d=function(r,n){return o(e.color_function(r,n))};else{var l=o.scale(e.x_colors).mode(e.color_space),b=o.scale(e.y_colors).mode(e.color_space);d=function(r,n){return o.interpolate(l(r),b(n),.5,e.color_space)}}for(var h=e.width,g=e.height,p=Math.floor((h+4*e.cell_size)/e.cell_size),m=Math.floor((g+4*e.cell_size)/e.cell_size),y=(p*e.cell_size-h)/2,w=(m*e.cell_size-g)/2,v=e.cell_size*e.variance/2,x=function(e){return r(e,[-y,h+y],[0,1])},_=function(e){return r(e,[-w,g+w],[0,1])},k=n(h,g),j=f.triangulate(k),M=[],N=function(e){return k[e]},D=0;D<j.length;D+=3){var U=[j[D],j[D+1],j[D+2]].map(N),A=t(U),P=d(x(A.x),_(A.y)).hex();M.push([P,U])}return s(M,e)}var f=e("delaunay-fast"),a=e("seedrandom"),o=e("chroma-js"),i=e("./colorbrewer"),s=e("./pattern"),c={width:600,height:400,cell_size:75,variance:.75,seed:null,x_colors:"random",y_colors:"match_x",palette:i,color_space:"lab",color_function:null,stroke_width:1.51};t.colorbrewer=i,t.defaults=c,r.exports=t},{"./colorbrewer":"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js","./pattern":"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js","chroma-js":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js",seedrandom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js"}],"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js":[function(e,r,n){r.exports={YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]}},{}],"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js":[function(e,r,n){(function(n){function t(r,t){function a(){var e=f.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("width",t.width),e.setAttribute("height",t.height),r.forEach(function(r){var n=f.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M"+r[1].join("L")+"Z"),n.setAttribute("fill",r[0]),n.setAttribute("stroke",r[0]),n.setAttribute("stroke-width",t.stroke_width),e.appendChild(n)}),e}function o(a){if("undefined"!=typeof n)try{e("canvas")}catch(o){throw Error("The optional node-canvas dependency is needed for Trianglify to render using canvas in node.")}return a||(a=f.createElement("canvas")),a.setAttribute("width",t.width),a.setAttribute("height",t.height),ctx=a.getContext("2d"),ctx.canvas.width=t.width,ctx.canvas.height=t.height,r.forEach(function(e){ctx.fillStyle=ctx.strokeStyle=e[0],ctx.lineWidth=t.stroke_width,ctx.beginPath(),ctx.moveTo.apply(ctx,e[1][0]),ctx.lineTo.apply(ctx,e[1][1]),ctx.lineTo.apply(ctx,e[1][2]),ctx.fill(),ctx.stroke()}),a}function i(){return o().toDataURL("image/png")}return{polys:r,opts:t,svg:a,canvas:o,png:i}}var f="undefined"!=typeof document?document:e("jsdom").jsdom("<html/>");r.exports=t}).call(this,e("_process"))},{_process:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js",canvas:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js",jsdom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js":[function(e,r,n){},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js":[function(e,r,n){function t(){if(!i){i=!0;for(var e,r=o.length;r;){e=o,o=[];for(var n=-1;++n<r;)e[n]();r=o.length}i=!1}}function f(){}var a=r.exports={},o=[],i=!1;a.nextTick=function(e){o.push(e),i||setTimeout(t,0)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=f,a.addListener=f,a.once=f,a.off=f,a.removeListener=f,a.removeAllListeners=f,a.emit=f,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js":[function(r,n,t){(function(){var r,f,a,o,i,s,c,u,d,l,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,R,S,O,C,T;l=function(e,n,t,f){return new r(e,n,t,f)},"undefined"!=typeof n&&null!==n&&null!=n.exports&&(n.exports=l),"function"==typeof e&&e.amd?e([],function(){return l}):(q="undefined"!=typeof t&&null!==t?t:this,q.chroma=l),l.color=function(e,n,t,f){return new r(e,n,t,f)},l.hsl=function(e,n,t,f){return new r(e,n,t,f,"hsl")},l.hsv=function(e,n,t,f){return new r(e,n,t,f,"hsv")},l.rgb=function(e,n,t,f){return new r(e,n,t,f,"rgb")},l.hex=function(e){return new r(e)},l.css=function(e){return new r(e)},l.lab=function(e,n,t){return new r(e,n,t,"lab")},l.lch=function(e,n,t){return new r(e,n,t,"lch")},l.hsi=function(e,n,t){return new r(e,n,t,"hsi")},l.gl=function(e,n,t,f){return new r(255*e,255*n,255*t,f,"gl")},l.interpolate=function(e,n,t,f){return null==e||null==n?"#000":("string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),e.interpolate(t,n,f))},l.mix=l.interpolate,l.contrast=function(e,n){var t,f;return"string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),t=e.luminance(),f=n.luminance(),t>f?(t+.05)/(f+.05):(f+.05)/(t+.05)},l.luminance=function(e){return l(e).luminance()},l._Color=r,r=function(){function e(){var e,r,n,t,f,a,o,i,s,c,u,d,l,h,g,p;for(f=this,n=[],c=0,u=arguments.length;u>c;c++)r=arguments[c],null!=r&&n.push(r);if(0===n.length)d=[255,0,255,1,"rgb"],o=d[0],i=d[1],s=d[2],e=d[3],t=d[4];else if("array"===R(n[0])){if(3===n[0].length)l=n[0],o=l[0],i=l[1],s=l[2],e=1;else{if(4!==n[0].length)throw"unknown input argument";h=n[0],o=h[0],i=h[1],s=h[2],e=h[3]}t=null!=(g=n[1])?g:"rgb"}else"string"===R(n[0])?(o=n[0],t="hex"):"object"===R(n[0])?(p=n[0]._rgb,o=p[0],i=p[1],s=p[2],e=p[3],t="rgb"):n.length>=3&&(o=n[0],i=n[1],s=n[2]);3===n.length?(t="rgb",e=1):4===n.length?"string"===R(n[3])?(t=n[3],e=1):"number"===R(n[3])&&(t="rgb",e=n[3]):5===n.length&&(e=n[3],t=n[4]),null==e&&(e=1),"rgb"===t?f._rgb=[o,i,s,e]:"gl"===t?f._rgb=[255*o,255*i,255*s,e]:"hsl"===t?(f._rgb=w(o,i,s),f._rgb[3]=e):"hsv"===t?(f._rgb=v(o,i,s),f._rgb[3]=e):"hex"===t?f._rgb=m(o):"lab"===t?(f._rgb=_(o,i,s),f._rgb[3]=e):"lch"===t?(f._rgb=M(o,i,s),f._rgb[3]=e):"hsi"===t&&(f._rgb=y(o,i,s),f._rgb[3]=e),a=b(f._rgb)}return e.prototype.rgb=function(){return this._rgb.slice(0,3)},e.prototype.rgba=function(){return this._rgb},e.prototype.hex=function(){return A(this._rgb)},e.prototype.toString=function(){return this.name()},e.prototype.hsl=function(){return z(this._rgb)},e.prototype.hsv=function(){return G(this._rgb)},e.prototype.lab=function(){return E(this._rgb)},e.prototype.lch=function(){return B(this._rgb)},e.prototype.hsi=function(){return P(this._rgb)},e.prototype.gl=function(){return[this._rgb[0]/255,this._rgb[1]/255,this._rgb[2]/255,this._rgb[3]]},e.prototype.luminance=function(r,n){var t,f,a,o;return null==n&&(n="rgb"),arguments.length?(0===r&&(this._rgb=[0,0,0,this._rgb[3]]),1===r&&(this._rgb=[255,255,255,this._rgb[3]]),t=D(this._rgb),f=1e-7,a=20,o=function(e,t){var i,s;return s=e.interpolate(.5,t,n),i=s.luminance(),Math.abs(r-i)<f||!a--?s:i>r?o(e,s):o(s,t)},this._rgb=(t>r?o(new e("black"),this):o(this,new e("white"))).rgba(),this):D(this._rgb)},e.prototype.name=function(){var e,r;e=this.hex();for(r in l.colors)if(e===l.colors[r])return r;return e},e.prototype.alpha=function(e){return arguments.length?(this._rgb[3]=e,this):this._rgb[3]},e.prototype.css=function(e){var r,n,t,f;return null==e&&(e="rgb"),n=this,t=n._rgb,3===e.length&&t[3]<1&&(e+="a"),"rgb"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+","+t[3]+")":"hsl"===e||"hsla"===e?(r=n.hsl(),f=function(e){return Math.round(100*e)/100},r[0]=f(r[0]),r[1]=f(100*r[1])+"%",r[2]=f(100*r[2])+"%",4===e.length&&(r[3]=t[3]),e+"("+r.join(",")+")"):void 0},e.prototype.interpolate=function(r,n,t){var f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=this,null==t&&(t="rgb"),"string"===R(n)&&(n=new e(n)),"hsl"===t||"hsv"===t||"lch"===t||"hsi"===t)"hsl"===t?(p=d.hsl(),m=n.hsl()):"hsv"===t?(p=d.hsv(),m=n.hsv()):"hsi"===t?(p=d.hsi(),m=n.hsi()):"lch"===t&&(p=d.lch(),m=n.lch()),"h"===t.substr(0,1)?(o=p[0],h=p[1],c=p[2],i=m[0],g=m[1],u=m[2]):(c=p[0],h=p[1],o=p[2],u=m[0],g=m[1],i=m[2]),isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?a=Number.NaN:(a=i,1!==c&&0!==c||"hsv"===t||(b=g)):(a=o,1!==u&&0!==u||"hsv"===t||(b=h)):(f=i>o&&i-o>180?i-(o+360):o>i&&o-i>180?i+360-o:i-o,a=o+r*f),null==b&&(b=h+r*(g-h)),s=c+r*(u-c),l="h"===t.substr(0,1)?new e(a,b,s,t):new e(s,b,a,t);else if("rgb"===t)p=d._rgb,m=n._rgb,l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t);else{if("lab"!==t)throw"color mode "+t+" is not supported";p=d.lab(),m=n.lab(),l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t)}return l.alpha(d.alpha()+r*(n.alpha()-d.alpha())),l},e.prototype.premultiply=function(){var e,r;return r=this.rgb(),e=this.alpha(),l(r[0]*e,r[1]*e,r[2]*e,e)},e.prototype.darken=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[0]-=e,l.lch(r).alpha(n.alpha())},e.prototype.darker=function(e){return this.darken(e)},e.prototype.brighten=function(e){return null==e&&(e=20),this.darken(-e)},e.prototype.brighter=function(e){return this.brighten(e)},e.prototype.saturate=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[1]+=e,l.lch(r).alpha(n.alpha())},e.prototype.desaturate=function(e){return null==e&&(e=20),this.saturate(-e)},e}(),b=function(e){var r;for(r in e)3>r?(e[r]<0&&(e[r]=0),e[r]>255&&(e[r]=255)):3===r&&(e[r]<0&&(e[r]=0),e[r]>1&&(e[r]=1));return e},p=function(e){var r,n,t,f,a,o,i,s;if(e=e.toLowerCase(),null!=l.colors&&l.colors[e])return m(l.colors[e]);if(t=e.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(f=t.slice(1,4),n=a=0;2>=a;n=++a)f[n]=+f[n];f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(f=t.slice(1,5),n=o=0;3>=o;n=++o)f[n]=+f[n];else if(t=e.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(f=t.slice(1,4),n=i=0;2>=i;n=++i)f[n]=Math.round(2.55*f[n]);f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(f=t.slice(1,5),n=s=0;2>=s;n=++s)f[n]=Math.round(2.55*f[n]);f[3]=+f[3]}else(t=e.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=1):(t=e.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=+t[4]);return f},m=function(e){var r,n,t,f,a,o;if(e.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})#x2F;))return(4===e.length||7===e.length)&&(e=e.substr(1)),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),o=parseInt(e,16),f=o>>16,t=o>>8&255,n=255&o,[f,t,n,1];if(e.match(/^#?([A-Fa-f0-9]{8})#x2F;))return 9===e.length&&(e=e.substr(1)),o=parseInt(e,16),f=o>>24&255,t=o>>16&255,n=o>>8&255,r=255&o,[f,t,n,r];if(a=p(e))return a;throw"unknown color: "+e},y=function(e,r,n){var t,f,i,s;return s=S(arguments),e=s[0],r=s[1],n=s[2],e/=360,1/3>e?(t=(1-r)/3,i=(1+r*g(o*e)/g(a-o*e))/3,f=1-(t+i)):2/3>e?(e-=1/3,i=(1-r)/3,f=(1+r*g(o*e)/g(a-o*e))/3,t=1-(i+f)):(e-=2/3,f=(1-r)/3,t=(1+r*g(o*e)/g(a-o*e))/3,i=1-(f+t)),i=N(n*i*3),f=N(n*f*3),t=N(n*t*3),[255*i,255*f,255*t]},w=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b;if(l=S(arguments),t=l[0],i=l[1],a=l[2],0===i)o=n=e=255*a;else{for(u=[0,0,0],r=[0,0,0],c=.5>a?a*(1+i):a+i-a*i,s=2*a-c,t/=360,u[0]=t+1/3,u[1]=t,u[2]=t-1/3,f=d=0;2>=d;f=++d)u[f]<0&&(u[f]+=1),u[f]>1&&(u[f]-=1),6*u[f]<1?r[f]=s+6*(c-s)*u[f]:2*u[f]<1?r[f]=c:3*u[f]<2?r[f]=s+(c-s)*(2/3-u[f])*6:r[f]=s;b=[Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])],o=b[0],n=b[1],e=b[2]}return[o,n,e]},v=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=S(arguments),t=d[0],s=d[1],u=d[2],u*=255,0===s)i=n=e=u;else switch(360===t&&(t=0),t>360&&(t-=360),0>t&&(t+=360),t/=60,f=Math.floor(t),r=t-f,a=u*(1-s),o=u*(1-s*r),c=u*(1-s*(1-r)),f){case 0:l=[u,c,a],i=l[0],n=l[1],e=l[2];break;case 1:b=[o,u,a],i=b[0],n=b[1],e=b[2];break;case 2:h=[a,u,c],i=h[0],n=h[1],e=h[2];break;case 3:g=[a,o,u],i=g[0],n=g[1],e=g[2];break;case 4:p=[c,a,u],i=p[0],n=p[1],e=p[2];break;case 5:m=[u,a,o],i=m[0],n=m[1],e=m[2]}return i=Math.round(i),n=Math.round(n),e=Math.round(e),[i,n,e]},f=18,i=.95047,s=1,c=1.08883,x=function(){var e,r,n,t,f,a;return a=S(arguments),f=a[0],e=a[1],r=a[2],n=Math.sqrt(e*e+r*r),t=Math.atan2(r,e)/Math.PI*180,[f,n,t]},_=function(e,r,n){var t,f,a,o,u,d,l;return void 0!==e&&3===e.length&&(d=e,e=d[0],r=d[1],n=d[2]),void 0!==e&&3===e.length&&(l=e,e=l[0],r=l[1],n=l[2]),o=(e+16)/116,a=o+r/500,u=o-n/200,a=k(a)*i,o=k(o)*s,u=k(u)*c,f=C(3.2404542*a-1.5371385*o-.4985314*u),t=C(-.969266*a+1.8760108*o+.041556*u),n=C(.0556434*a-.2040259*o+1.0572252*u),[N(f,0,255),N(t,0,255),N(n,0,255),1]},k=function(e){return e>.206893034?e*e*e:(e-4/29)/7.787037},C=function(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))},j=function(){var e,r,n,t;return t=S(arguments),n=t[0],e=t[1],r=t[2],r=r*Math.PI/180,[n,Math.cos(r)*e,Math.sin(r)*e]},M=function(e,r,n){var t,f,a,o,i,s,c;return s=j(e,r,n),t=s[0],f=s[1],a=s[2],c=_(t,f,a),i=c[0],o=c[1],a=c[2],[N(i,0,255),N(o,0,255),N(a,0,255)]},D=function(e,r,n){var t;return t=S(arguments),e=t[0],r=t[1],n=t[2],e=U(e),r=U(r),n=U(n),.2126*e+.7152*r+.0722*n},U=function(e){return e/=255,.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},A=function(){var e,r,n,t,f,a;return a=S(arguments),n=a[0],r=a[1],e=a[2],f=n<<16|r<<8|e,t="000000"+f.toString(16),"#"+t.substr(t.length-6)},P=function(){var e,r,n,t,f,a,o,i,s;return s=S(arguments),o=s[0],n=s[1],r=s[2],e=2*Math.PI,o/=255,n/=255,r/=255,a=Math.min(o,n,r),f=(o+n+r)/3,i=1-a/f,0===i?t=0:(t=(o-n+(o-r))/2,t/=Math.sqrt((o-n)*(o-n)+(o-r)*(n-r)),t=Math.acos(t),r>n&&(t=e-t),t/=e),[360*t,i,f]},z=function(e,r,n){var t,f,a,o,i,s;return void 0!==e&&e.length>=3&&(s=e,e=s[0],r=s[1],n=s[2]),e/=255,r/=255,n/=255,o=Math.min(e,r,n),a=Math.max(e,r,n),f=(a+o)/2,a===o?(i=0,t=Number.NaN):i=.5>f?(a-o)/(a+o):(a-o)/(2-a-o),e===a?t=(r-n)/(a-o):r===a?t=2+(n-e)/(a-o):n===a&&(t=4+(e-r)/(a-o)),t*=60,0>t&&(t+=360),[t,i,f]},G=function(){var e,r,n,t,f,a,o,i,s,c;return c=S(arguments),o=c[0],n=c[1],e=c[2],a=Math.min(o,n,e),f=Math.max(o,n,e),r=f-a,s=f/255,0===f?(t=Number.NaN,i=0):(i=r/f,o===f&&(t=(n-e)/r),n===f&&(t=2+(e-o)/r),e===f&&(t=4+(o-n)/r),t*=60,0>t&&(t+=360)),[t,i,s]},E=function(){var e,r,n,t,f,a,o;return o=S(arguments),n=o[0],r=o[1],e=o[2],n=I(n),r=I(r),e=I(e),t=O((.4124564*n+.3575761*r+.1804375*e)/i),f=O((.2126729*n+.7151522*r+.072175*e)/s),a=O((.0193339*n+.119192*r+.9503041*e)/c),[116*f-16,500*(t-f),200*(f-a)]},I=function(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},O=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},B=function(){var e,r,n,t,f,a,o;return a=S(arguments),f=a[0],n=a[1],r=a[2],o=E(f,n,r),t=o[0],e=o[1],r=o[2],x(t,e,r)},l.scale=function(e,r){var n,t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k;return y="rgb",w=l("#ccc"),k=0,g=!1,h=[0,1],d=[],x=!1,_=[],m=0,p=1,b=!1,v=0,u={},i=function(e,r){var n,t,f,a,i,s,c;if(null==e&&(e=["#ddd","#222"]),null!=e&&"string"===R(e)&&null!=(null!=(i=l.brewer)?i[e]:void 0)&&(e=l.brewer[e]),"array"===R(e)){for(e=e.slice(0),n=f=0,s=e.length-1;s>=0?s>=f:f>=s;n=s>=0?++f:--f)t=e[n],"string"===R(t)&&(e[n]=l(t));if(null!=r)_=r;else for(_=[],n=a=0,c=e.length-1;c>=0?c>=a:a>=c;n=c>=0?++a:--a)_.push(n/(e.length-1))}return o(),d=e},s=function(e){return null==e&&(e=[]),h=e,m=e[0],p=e[e.length-1],o(),v=2===e.length?0:e.length-1},f=function(e){var r,n;if(null!=h){for(n=h.length-1,r=0;n>r&&e>=h[r];)r++;return r-1}return 0},c=function(e){return e},n=function(e){var r,n,t,a,o;return o=e,h.length>2&&(a=h.length-1,r=f(e),t=h[0]+(h[1]-h[0])*(0+.5*k),n=h[a-1]+(h[a]-h[a-1])*(1-.5*k),o=m+(h[r]+.5*(h[r+1]-h[r])-t)/(n-t)*(p-m)),o},a=function(e,r){var n,t,a,o,i,s,b,g,x;if(null==r&&(r=!1),isNaN(e))return w;if(r?b=e:h.length>2?(n=f(e),b=n/(v-1)):(b=a=m!==p?(e-m)/(p-m):0,b=a=(e-m)/(p-m),b=Math.min(1,Math.max(0,b))),r||(b=c(b)),i=Math.floor(1e4*b),u[i])t=u[i];else{if("array"===R(d))for(o=g=0,x=_.length-1;x>=0?x>=g:g>=x;o=x>=0?++g:--g){if(s=_[o],s>=b){t=d[o];break}if(b>=s&&o===_.length-1){t=d[o];break}if(b>s&&b<_[o+1]){b=(b-s)/(_[o+1]-s),t=l.interpolate(d[o],d[o+1],b,y);break}}else"function"===R(d)&&(t=d(b));u[i]=t}return t},o=function(){return u={}},i(e,r),t=function(e){var r;return r=a(e),x&&r[x]?r[x]():r},t.domain=function(e,r,n,f){var a;return null==n&&(n="e"),arguments.length?(null!=r&&(a=l.analyze(e,f),e=0===r?[a.min,a.max]:l.limits(a,n,r)),s(e),t):h},t.mode=function(e){return arguments.length?(y=e,o(),t):y},t.range=function(e,r){return i(e,r),t},t.out=function(e){return x=e,t},t.spread=function(e){return arguments.length?(k=e,t):k},t.correctLightness=function(e){return arguments.length?(b=e,o(),c=b?function(e){var r,n,t,f,o,i,s,c,u;for(r=a(0,!0).lab()[0],n=a(1,!0).lab()[0],s=r>n,t=a(e,!0).lab()[0],o=r+(n-r)*e,f=t-o,c=0,u=1,i=20;Math.abs(f)>.01&&i-- >0;)!function(){return s&&(f*=-1),0>f?(c=e,e+=.5*(u-e)):(u=e,e+=.5*(c-e)),t=a(e,!0).lab()[0],f=t-o}();return e}:function(e){return e},t):b},t.colors=function(r){var n,f,a,o,i,s;if(null==r&&(r="hex"),e=[],f=[],h.length>2)for(n=a=1,s=h.length;s>=1?s>a:a>s;n=s>=1?++a:--a)f.push(.5*(h[n-1]+h[n]));else f=h;for(o=0,i=f.length;i>o;o++)n=f[o],e.push(t(n)[r]());return e},t},null==(T=l.scales)&&(l.scales={}),l.scales.cool=function(){return l.scale([l.hsl(180,1,.9),l.hsl(250,.7,.4)])},l.scales.hot=function(){return l.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},l.analyze=function(e,r,n){var t,f,a,o,i,s,c;if(a={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==n&&(n=function(){return!0}),t=function(e){null==e||isNaN(e)||(a.values.push(e),a.sum+=e,e<a.min&&(a.min=e),e>a.max&&(a.max=e),a.count+=1)},i=function(e,f){return n(e,f)?t(null!=r&&"function"===R(r)?r(e):null!=r&&"string"===R(r)||"number"===R(r)?e[r]:e):void 0},"array"===R(e))for(s=0,c=e.length;c>s;s++)o=e[s],i(o);else for(f in e)o=e[f],i(o,f);return a.domain=[a.min,a.max],a.limits=function(e,r){return l.limits(a,e,r)},a},l.limits=function(e,r,n){var t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,S,O,C,T,Y,L,F,V,X,W,$,Z,H,J,K,Q,ee,re,ne,te,fe,ae,oe;if(null==r&&(r="equal"),null==n&&(n=7),"array"===R(e)&&(e=l.analyze(e)),p=e.min,h=e.max,N=e.sum,A=e.values.sort(function(e,r){return e-r}),b=[],"c"===r.substr(0,1)&&(b.push(p),b.push(h)),"e"===r.substr(0,1)){for(b.push(p),c=P=1,T=n-1;T>=1?T>=P:P>=T;c=T>=1?++P:--P)b.push(p+c/n*(h-p));b.push(h)}else if("l"===r.substr(0,1)){if(0>=p)throw"Logarithmic scales are only possible for values > 0";for(m=Math.LOG10E*Math.log(p),g=Math.LOG10E*Math.log(h),b.push(p),c=z=1,$=n-1;gt;=1?gt;=z:z>=$;c=gt;=1?++z:--z)b.push(Math.pow(10,m+c/n*(g-m)));b.push(h)}else if("q"===r.substr(0,1)){for(b.push(p),c=G=1,Z=n-1;Z>=1?Z>=G:G>=Z;c=Z>=1?++G:--G)_=A.length*c/n,k=Math.floor(_),k===_?b.push(A[k]):(j=_-k,b.push(A[k]*j+A[k+1]*(1-j)));b.push(h)}else if("k"===r.substr(0,1)){for(w=A.length,t=new Array(w),i=new Array(n),M=!0,v=0,a=null,a=[],a.push(p),c=E=1,H=n-1;H>=1?H>=E:E>=H;c=H>=1?++E:--E)a.push(p+c/n*(h-p));for(a.push(h);M;){for(u=B=0,J=n-1;J>=0?J>=B:B>=J;u=J>=0?++B:--B)i[u]=0;for(c=I=0,K=w-1;K>=0?K>=I:I>=K;c=K>=0?++I:--I){for(U=A[c],y=Number.MAX_VALUE,u=q=0,Q=n-1;Q>=0?Q>=q:q>=Q;u=Q>=0?++q:--q)s=Math.abs(a[u]-U),y>s&&(y=s,f=u);i[f]++,t[c]=f}for(x=new Array(n),u=S=0,ee=n-1;ee>=0?ee>=S:S>=ee;u=ee>=0?++S:--S)x[u]=null;for(c=O=0,re=w-1;re>=0?re>=O:O>=re;c=re>=0?++O:--O)o=t[c],null===x[o]?x[o]=A[c]:x[o]+=A[c];for(u=C=0,Y=n-1;Y>=0?Y>=C:C>=Y;u=Y>=0?++C:--C)x[u]*=1/i[u];for(M=!1,u=ne=0,L=n-1;L>=0?L>=ne:ne>=L;u=L>=0?++ne:--ne)if(x[u]!==a[c]){M=!0;break}a=x,v++,v>200&&(M=!1)}for(d={},u=te=0,F=n-1;F>=0?F>=te:te>=F;u=F>=0?++te:--te)d[u]=[];for(c=fe=0,V=w-1;V>=0?V>=fe:fe>=V;c=V>=0?++fe:--fe)o=t[c],d[o].push(A[c]);for(D=[],u=ae=0,X=n-1;X>=0?X>=ae:ae>=X;u=X>=0?++ae:--ae)D.push(d[u][0]),D.push(d[u][d[u].length-1]);for(D=D.sort(function(e,r){return e-r}),b.push(D[0]),c=oe=1,W=D.length-1;W>=oe;c=oe+=2)isNaN(D[c])||b.push(D[c])}return b},l.brewer=d={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},l.colors=h={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"},R=function(){var e,r,n,t,f;for(e={},f="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,t=f.length;t>n;n++)r=f[n],e["[object "+r+"]"]=r.toLowerCase();return function(r){var n;return n=Object.prototype.toString.call(r),e[n]||"object"}}(),N=function(e,r,n){return null==r&&(r=0),null==n&&(n=1),r>e&&(e=r),e>n&&(e=n),e},S=function(e){return e.length>=3?e:e[0]},o=2*Math.PI,a=Math.PI/3,g=Math.cos,u=function(e){var r,n,t,f,a,o,i,s,c,d,b;return e=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(l(f));return t}(),2===e.length?(c=function(){var r,n,t;for(t=[],r=0,
2
n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=c[0],o=c[1],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push(a[r]+e*(o[r]-a[r]));return t}(),l.lab.apply(l,n)}):3===e.length?(d=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=d[0],o=d[1],i=d[2],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*a[r]+2*(1-e)*e*o[r]+e*e*i[r]);return t}(),l.lab.apply(l,n)}):4===e.length?(b=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=b[0],o=b[1],i=b[2],s=b[3],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*(1-e)*a[r]+3*(1-e)*(1-e)*e*o[r]+3*(1-e)*e*e*i[r]+e*e*e*s[r]);return t}(),l.lab.apply(l,n)}):5===e.length&&(n=u(e.slice(0,3)),t=u(e.slice(2,5)),r=function(e){return.5>e?n(2*e):t(2*(e-.5))}),r},l.interpolate.bezier=u}).call(this)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js":[function(e,r,n){var t;!function(){"use strict";function e(e){var r,n,t,f,a,o,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(r=e.length;r--;)e[r][0]<i&&(i=e[r][0]),e[r][0]>c&&(c=e[r][0]),e[r][1]<s&&(s=e[r][1]),e[r][1]>u&&(u=e[r][1]);return n=c-i,t=u-s,f=Math.max(n,t),a=i+.5*n,o=s+.5*t,[[a-20*f,o-f],[a,o+20*f],[a+20*f,o-f]]}function n(e,r,n,t){var f,o,i,s,c,u,d,l,b,h,g=e[r][0],p=e[r][1],m=e[n][0],y=e[n][1],w=e[t][0],v=e[t][1],x=Math.abs(p-y),_=Math.abs(y-v);if(a>x&&a>_)throw new Error("Eek! Coincident points!");return a>x?(s=-((w-m)/(v-y)),u=(m+w)/2,l=(y+v)/2,f=(m+g)/2,o=s*(f-u)+l):a>_?(i=-((m-g)/(y-p)),c=(g+m)/2,d=(p+y)/2,f=(w+m)/2,o=i*(f-c)+d):(i=-((m-g)/(y-p)),s=-((w-m)/(v-y)),c=(g+m)/2,u=(m+w)/2,d=(p+y)/2,l=(y+v)/2,f=(i*c-s*u+l-d)/(i-s),o=x>_?i*(f-c)+d:s*(f-u)+l),b=m-f,h=y-o,{i:r,j:n,k:t,x:f,y:o,r:b*b+h*h}}function f(e){var r,n,t,f,a,o;for(n=e.length;n;)for(f=e[--n],t=e[--n],r=n;r;)if(o=e[--r],a=e[--r],t===a&&f===o||t===o&&f===a){e.splice(n,2),e.splice(r,2);break}}var a=1/1048576;t={triangulate:function(r,t){var o,i,s,c,u,d,l,b,h,g,p,m,y=r.length;if(3>y)return[];if(r=r.slice(0),t)for(o=y;o--;)r[o]=r[o][t];for(s=new Array(y),o=y;o--;)s[o]=o;for(s.sort(function(e,n){return r[n][0]-r[e][0]}),c=e(r),r.push(c[0],c[1],c[2]),u=[n(r,y+0,y+1,y+2)],d=[],l=[],o=s.length;o--;l.length=0){for(m=s[o],i=u.length;i--;)b=r[m][0]-u[i].x,b>0&&b*b>u[i].r?(d.push(u[i]),u.splice(i,1)):(h=r[m][1]-u[i].y,b*b+h*h-u[i].r>a||(l.push(u[i].i,u[i].j,u[i].j,u[i].k,u[i].k,u[i].i),u.splice(i,1)));for(f(l),i=l.length;i;)p=l[--i],g=l[--i],u.push(n(r,g,p,m))}for(o=u.length;o--;)d.push(u[o]);for(u.length=0,o=d.length;o--;)d[o].i<y&&d[o].j<y&&d[o].k<y&&u.push(d[o].i,d[o].j,d[o].k);return u},contains:function(e,r){if(r[0]<e[0][0]&&r[0]<e[1][0]&&r[0]<e[2][0]||r[0]>e[0][0]&&r[0]>e[1][0]&&r[0]>e[2][0]||r[1]<e[0][1]&&r[1]<e[1][1]&&r[1]<e[2][1]||r[1]>e[0][1]&&r[1]>e[1][1]&&r[1]>e[2][1])return null;var n=e[1][0]-e[0][0],t=e[2][0]-e[0][0],f=e[1][1]-e[0][1],a=e[2][1]-e[0][1],o=n*a-t*f;if(0===o)return null;var i=(a*(r[0]-e[0][0])-t*(r[1]-e[0][1]))/o,s=(n*(r[1]-e[0][1])-f*(r[0]-e[0][0]))/o;return 0>i||0>s||i+s>1?null:[i,s]}},"undefined"!=typeof r&&(r.exports=t)}()},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js":[function(e,r,n){var t=e("./lib/alea"),f=e("./lib/xor128"),a=e("./lib/xorwow"),o=e("./lib/xorshift7"),i=e("./lib/xor4096"),s=e("./lib/tychei"),c=e("./seedrandom");c.alea=t,c.xor128=f,c.xorwow=a,c.xorshift7=o,c.xor4096=i,c.tychei=s,r.exports=c},{"./lib/alea":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js","./lib/tychei":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js","./lib/xor128":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js","./lib/xor4096":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js","./lib/xorshift7":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js","./lib/xorwow":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js","./seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n=o();r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function f(e,r){return r.c=e.c,r.s0=e.s0,r.s1=e.s1,r.s2=e.s2,r}function a(e,r){var n=new t(e),a=r&&r.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o["double"]=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}function o(){var e=4022871197,r=function(r){r=r.toString();for(var n=0;n<r.length;n++){e+=r.charCodeAt(n);var t=.02519603282416938*e;e=t>>>0,t-=e,t*=e,e=t>>>0,t-=e,e+=4294967296*t}return 2.3283064365386963e-10*(e>>>0)};return r}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.alea=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.b,n=r.c,t=r.d,f=r.a;return e=e<<25^e>>>7^n,n=n-t|0,t=t<<24^t>>>8^f,f=f-e|0,r.b=e=e<<20^e>>>12^n,r.c=n=n-t|0,r.d=t<<16^n>>>16^f,r.a=f-e|0},r.a=0,r.b=0,r.c=-1640531527,r.d=1367130551,e===Math.floor(e)?(r.a=e/4294967296|0,r.b=0|e):n+=e;for(var t=0;t<n.length+20;t++)r.b^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.tychei=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var e=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^e^e>>>8},e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor128=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f,a,o,i=[],s=128;for(r===(0|r)?(t=r,r=null):(r+="\x00",t=0,s=Math.max(s,r.length)),f=0,a=-32;s>a;++a)r&&(t^=r.charCodeAt((a+32)%r.length)),0===a&&(o=t),t^=t<<10,t^=t>>>15,t^=t<<4,t^=t>>>13,a>=0&&(o=o+1640531527|0,n=i[127&a]^=t+o,f=0==n?f+1:0);for(f>=128&&(i[127&(r&&r.length||0)]=-1),f=127,a=512;a>0;--a)t=i[f+34&127],n=i[f=f+1&127],t^=t<<13,n^=n<<17,t^=t>>>15,n^=n>>>12,i[f]=t^n;e.w=o,e.X=i,e.i=f}var n=this;n.next=function(){var e,r,t=n.w,f=n.X,a=n.i;return n.w=t=t+1640531527|0,r=f[a+34&127],e=f[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=f[a]=r^e,n.i=a,r+(t^t>>>16)|0},r(n,e)}function f(e,r){return r.i=e.i,r.w=e.w,r.X=e.X.slice(),r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.X&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor4096=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f=[];if(r===(0|r))t=f[0]=r;else for(r=""+r,n=0;n<r.length;++n)f[7&n]=f[7&n]<<15^r.charCodeAt(n)+f[n+1&7]<<13;for(;f.length<8;)f.push(0);for(n=0;8>n&&0===f[n];++n);for(t=8==n?f[7]=-1:f[n],e.x=f,e.i=0,n=256;n>0;--n)e.next()}var n=this;n.next=function(){var e,r,t=n.x,f=n.i;return e=t[f],e^=e>>>7,r=e^e<<24,e=t[f+1&7],r^=e^e>>>10,e=t[f+3&7],r^=e^e>>>3,e=t[f+4&7],r^=e^e<<7,e=t[f+7&7],e^=e<<13,r^=e^e<<9,t[f]=r,n.i=f+1&7,r},r(n,e)}function f(e,r){return r.x=e.x.slice(),r.i=e.i,r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.x&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorshift7=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(e^e<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),t==n.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r.v=e.v,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorwow=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js":[function(r,n,t){!function(t,f){function a(e,r,n){var a=[];r=1==r?{entropy:!0}:r||{};var l=c(s(r.entropy?[e,d(t)]:null==e?u():e,3),a),b=new o(a),p=function(){for(var e=b.g(g),r=y,n=0;w>e;)e=(e+n)*h,r*=h,n=b.g(1);for(;e>=v;)e/=2,r/=2,n>>>=1;return(e+n)/r};return p.int32=function(){return 0|b.g(4)},p.quick=function(){return b.g(4)/4294967296},p["double"]=p,c(d(b.S),t),(r.pass||n||function(e,r,n,t){return t&&(t.S&&i(t,b),e.state=function(){return i(b,{})}),n?(f[m]=e,r):e})(p,l,"global"in r?r.global:this==f,r.state)}function o(e){var r,n=e.length,t=this,f=0,a=t.i=t.j=0,o=t.S=[];for(n||(e=[n++]);h>f;)o[f]=f++;for(f=0;h>f;f++)o[f]=o[a=x&a+e[f%n]+(r=o[f])],o[a]=r;(t.g=function(e){for(var r,n=0,f=t.i,a=t.j,o=t.S;e--;)r=o[f=x&f+1],n=n*h+o[x&(o[f]=o[a=x&a+r])+(o[a]=r)];return t.i=f,t.j=a,n})(h)}function i(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function s(e,r){var n,t=[],f=typeof e;if(r&&"object"==f)for(n in e)try{t.push(s(e[n],r-1))}catch(a){}return t.length?t:"string"==f?e:e+"\x00"}function c(e,r){for(var n,t=e+"",f=0;f<t.length;)r[x&f]=x&(n^=19*r[x&f])+t.charCodeAt(f++);return d(r)}function u(){try{if(l)return d(l.randomBytes(h));var e=new Uint8Array(h);return(b.crypto||b.msCrypto).getRandomValues(e),d(e)}catch(r){var n=b.navigator,f=n&&n.plugins;return[+new Date,b,f,b.screen,d(t)]}}function d(e){return String.fromCharCode.apply(0,e)}var l,b=this,h=256,g=6,p=52,m="random",y=f.pow(h,g),w=f.pow(2,p),v=2*w,x=h-1;if(f["seed"+m]=a,c(f.random(),t),"object"==typeof n&&n.exports){n.exports=a;try{l=r("crypto")}catch(_){}}else"function"==typeof e&&e.amd&&e(function(){return a})}([],Math)},{crypto:!1}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")});
base/inc/fields/base.class.php CHANGED
@@ -257,7 +257,6 @@ abstract class SiteOrigin_Widget_Field_Base {
257
if ( is_null( $value ) && isset( $this->default ) ) {
258
$value = $this->default;
259
}
260
-
261
$wrapper_attributes = array(
262
'class' => array(
263
'siteorigin-widget-field',
@@ -344,11 +343,13 @@ abstract class SiteOrigin_Widget_Field_Base {
344
* The default sanitization function.
345
*
346
* @param $value mixed The value to be sanitized.
347
* @return mixed|string|void
348
*/
349
- public function sanitize( $value ) {
350
351
- $value = $this->sanitize_field_input( $value );
352
353
if( isset( $this->sanitize ) ) {
354
// This field also needs some custom sanitization
@@ -397,9 +398,11 @@ abstract class SiteOrigin_Widget_Field_Base {
397
* input received from their HTML form field.
398
*
399
* @param $value mixed The current value of this field.
400
* @return mixed The sanitized value.
401
*/
402
- abstract protected function sanitize_field_input( $value );
403
404
/**
405
* There are cases where a field may affect values on the widget instance, other than it's own input. It then becomes
257
if ( is_null( $value ) && isset( $this->default ) ) {
258
$value = $this->default;
259
}
260
$wrapper_attributes = array(
261
'class' => array(
262
'siteorigin-widget-field',
343
* The default sanitization function.
344
*
345
* @param $value mixed The value to be sanitized.
346
+ * @param $instance array The widget instance.
347
+ *
348
* @return mixed|string|void
349
*/
350
+ public function sanitize( $value, $instance = array() ) {
351
352
+ $value = $this->sanitize_field_input( $value, $instance );
353
354
if( isset( $this->sanitize ) ) {
355
// This field also needs some custom sanitization
398
* input received from their HTML form field.
399
*
400
* @param $value mixed The current value of this field.
401
+ * @param $instance array The widget instance.
402
+ *
403
* @return mixed The sanitized value.
404
*/
405
+ abstract protected function sanitize_field_input( $value, $instance );
406
407
/**
408
* There are cases where a field may affect values on the widget instance, other than it's own input. It then becomes
base/inc/fields/checkbox.class.php CHANGED
@@ -19,7 +19,7 @@ class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
19
// Empty override. This field renders it's own label in the render_field() function.
20
}
21
22
- protected function sanitize_field_input( $value ) {
23
return ! empty( $value );
24
}
25
19
// Empty override. This field renders it's own label in the render_field() function.
20
}
21
22
+ protected function sanitize_field_input( $value, $instance ) {
23
return ! empty( $value );
24
}
25
base/inc/fields/color.class.php CHANGED
@@ -11,7 +11,7 @@ class SiteOrigin_Widget_Field_Color extends SiteOrigin_Widget_Field_Text_Input_B
11
return $input_classes;
12
}
13
14
- protected function sanitize_field_input( $value ) {
15
$sanitized_value = $value;
16
if( ! preg_match('|^#|', $sanitized_value) ) {
17
$sanitized_value = '#' . $sanitized_value;
11
return $input_classes;
12
}
13
14
+ protected function sanitize_field_input( $value, $instance ) {
15
$sanitized_value = $value;
16
if( ! preg_match('|^#|', $sanitized_value) ) {
17
$sanitized_value = '#' . $sanitized_value;
base/inc/fields/container-base.class.php CHANGED
@@ -95,7 +95,7 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
95
}
96
}
97
98
- protected function sanitize_field_input( $value ) {
99
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
100
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
101
foreach( $this->fields as $sub_field_name => $sub_field_options ) {
@@ -112,7 +112,7 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
112
$this->parent_container
113
);
114
}
115
- $value[$sub_field_name] = $sub_field->sanitize( isset($value[$sub_field_name]) ? $value[$sub_field_name] : null );
116
$value = $sub_field->sanitize_instance( $value );
117
}
118
95
}
96
}
97
98
+ protected function sanitize_field_input( $value, $instance ) {
99
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
100
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
101
foreach( $this->fields as $sub_field_name => $sub_field_options ) {
112
$this->parent_container
113
);
114
}
115
+ $value[$sub_field_name] = $sub_field->sanitize( isset($value[$sub_field_name]) ? $value[$sub_field_name] : null, $value );
116
$value = $sub_field->sanitize_instance( $value );
117
}
118
base/inc/fields/error.class.php CHANGED
@@ -20,7 +20,7 @@ class SiteOrigin_Widget_Field_Error extends SiteOrigin_Widget_Field_Base {
20
printf( __($this->message, 'so-widgets-bundle') );
21
}
22
23
- protected function sanitize_field_input( $value ) {
24
return $value;
25
}
26
}
20
printf( __($this->message, 'so-widgets-bundle') );
21
}
22
23
+ protected function sanitize_field_input( $value, $instance ) {
24
return $value;
25
}
26
}
base/inc/fields/font.class.php CHANGED
@@ -23,7 +23,7 @@ class SiteOrigin_Widget_Field_Font extends SiteOrigin_Widget_Field_Base {
23
<?php
24
}
25
26
- protected function sanitize_field_input( $value ) {
27
$sanitized_value = trim( $value );
28
// Any alphanumeric character followed by alphanumeric or whitespace characters (except newline),
29
// with optional colon and number.
23
<?php
24
}
25
26
+ protected function sanitize_field_input( $value, $instance ) {
27
$sanitized_value = trim( $value );
28
// Any alphanumeric character followed by alphanumeric or whitespace characters (except newline),
29
// with optional colon and number.
base/inc/fields/icon.class.php CHANGED
@@ -34,7 +34,7 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
34
<?php
35
}
36
37
- protected function sanitize_field_input( $value ) {
38
$sanitized_value = $value;
39
// Alphanumeric characters and hyphens.
40
if( preg_match( '/[\w\d]+[\w\d-]*/', $sanitized_value, $sanitized_matches ) ) {
34
<?php
35
}
36
37
+ protected function sanitize_field_input( $value, $instance ) {
38
$sanitized_value = $value;
39
// Alphanumeric characters and hyphens.
40
if( preg_match( '/[\w\d]+[\w\d-]*/', $sanitized_value, $sanitized_matches ) ) {
base/inc/fields/js/so-tinymce-field.js CHANGED
@@ -74,13 +74,11 @@
74
}
75
}
76
}
77
- //if (!QTags.instances[id]) {
78
var qtSettings = $container.data('qtSettings');
79
qtSettings = $.extend({}, tinyMCEPreInit.qtInit['siteorigin-widget-input-tinymce-field'], qtSettings, {id: id});
80
tinyMCEPreInit.qtInit[id] = qtSettings;
81
$container.find('.quicktags-toolbar').remove();
82
quicktags(tinyMCEPreInit.qtInit[id]);
83
- //}
84
85
$(this).on( 'click', function(event) {
86
74
}
75
}
76
}
77
var qtSettings = $container.data('qtSettings');
78
qtSettings = $.extend({}, tinyMCEPreInit.qtInit['siteorigin-widget-input-tinymce-field'], qtSettings, {id: id});
79
tinyMCEPreInit.qtInit[id] = qtSettings;
80
$container.find('.quicktags-toolbar').remove();
81
quicktags(tinyMCEPreInit.qtInit[id]);
82
83
$(this).on( 'click', function(event) {
84
base/inc/fields/link.class.php CHANGED
@@ -31,7 +31,7 @@ class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Ba
31
parent::render_after_field( $value, $instance );
32
}
33
34
- protected function sanitize_field_input( $value ) {
35
$sanitized_value = trim( $value );
36
if( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
37
$sanitized_value = 'post: ' . $matches[1];
31
parent::render_after_field( $value, $instance );
32
}
33
34
+ protected function sanitize_field_input( $value, $instance ) {
35
$sanitized_value = trim( $value );
36
if( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
37
$sanitized_value = 'post: ' . $matches[1];
base/inc/fields/measurement.class.php CHANGED
@@ -11,9 +11,33 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
11
return $input_classes;
12
}
13
14
protected function render_after_field( $value, $instance ) {
15
- $unit_name = $this->get_unit_field_name( $this->base_name );
16
- $unit = ! empty( $instance[ $unit_name ] ) ? $instance[ $unit_name ] : '';
17
?>
18
<select class="sow-measurement-select-unit"
19
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
@@ -31,26 +55,32 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
31
wp_enqueue_style( 'so-measurement-field', plugin_dir_url(__FILE__) . 'css/so-measurement-field.css', array(), SOW_BUNDLE_VERSION );
32
}
33
34
-
35
- protected function sanitize_field_input( $value ) {
36
- return ( $value === '' ) ? false : (float) $value;
37
- }
38
-
39
- public function sanitize_instance( $instance ) {
40
$unit_name = $this->get_unit_field_name( $this->base_name );
41
- if( ! empty( $instance[ $unit_name ] ) ) {
42
$units = siteorigin_widgets_get_measurements_list();
43
- $instance[ $unit_name ] = in_array( $instance[ $unit_name ], $units ) ? $instance[ $unit_name ] : 'px';
44
- esc_url_raw( $instance[ $unit_name ] );
45
}
46
- return $instance;
47
}
48
49
public function get_unit_field_name( $base_name ) {
50
$v_name = $base_name;
51
if( strpos($v_name, '][') !== false ) {
52
// Remove this splitter
53
- $v_name = substr( $v_name, strpos($v_name, '][') + 2 );
54
}
55
return $v_name . '_unit';
56
}
11
return $input_classes;
12
}
13
14
+ protected function get_render_values( $value ) {
15
+ preg_match('/(\d+)([a-z%]+)*/', $value, $matches);
16
+ $num_matches = count( $matches );
17
+ $val = array();
18
+ $val['value'] = $num_matches > 1 ? $matches[1] : null;
19
+ $val['unit'] = $num_matches > 2 ? $matches[2] : null;
20
+ return $val;
21
+ }
22
+
23
+ protected function render_field( $value, $instance ) {
24
+ $num_value = $this->get_render_values($value)['value'];
25
+
26
+ parent::render_field( $num_value, $instance );
27
+ }
28
+
29
protected function render_after_field( $value, $instance ) {
30
+ $unit = $this->get_render_values($value)['unit'];
31
+ if ( is_null( $unit ) ) {
32
+ $unit_name = $this->get_unit_field_name( $this->base_name );
33
+
34
+ if( !empty( $instance[ $unit_name ] ) ) {
35
+ $unit = $instance[ $unit_name ];
36
+ }
37
+ else if ( isset( $this->default ) ) {
38
+ $unit = $this->get_render_values( $this->default )['unit'];
39
+ }
40
+ }
41
?>
42
<select class="sow-measurement-select-unit"
43
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
55
wp_enqueue_style( 'so-measurement-field', plugin_dir_url(__FILE__) . 'css/so-measurement-field.css', array(), SOW_BUNDLE_VERSION );
56
}
57
58
+ // This is doing sanitization and is being used to concatenate the numeric measurement value and the selected
59
+ // measurement unit.
60
+ protected function sanitize_field_input( $value, $instance ) {
61
+ //Get the property name of the unit field
62
$unit_name = $this->get_unit_field_name( $this->base_name );
63
+ //Initialize with default value, if any.
64
+ $unit = $this->get_render_values( $this->default )['unit'];
65
+ if( isset( $instance[ $unit_name ] ) ) {
66
$units = siteorigin_widgets_get_measurements_list();
67
+ if ( in_array( $instance[ $unit_name ], $units ) ) {
68
+ $unit = $instance[ $unit_name ];
69
+ }
70
+ unset( $instance[ $unit_name ] );
71
}
72
+
73
+ $value = ( $value === '' ) ? false : (float) $value;
74
+ $value .= $unit;
75
+ return $value;
76
}
77
78
+ // Get the name of the dropdown field rendered to allow the user to select a measurement unit.
79
public function get_unit_field_name( $base_name ) {
80
$v_name = $base_name;
81
if( strpos($v_name, '][') !== false ) {
82
// Remove this splitter
83
+ $v_name = substr( $v_name, strrpos($v_name, '][') + 2 );
84
}
85
return $v_name . '_unit';
86
}
base/inc/fields/media.class.php CHANGED
@@ -106,7 +106,7 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
106
parent::render_after_field( $value, $instance );
107
}
108
109
- protected function sanitize_field_input( $value ) {
110
// Media values should be integer
111
return intval( $value );
112
}
106
parent::render_after_field( $value, $instance );
107
}
108
109
+ protected function sanitize_field_input( $value, $instance ) {
110
// Media values should be integer
111
return intval( $value );
112
}
base/inc/fields/number.class.php CHANGED
@@ -11,7 +11,7 @@ class SiteOrigin_Widget_Field_Number extends SiteOrigin_Widget_Field_Text_Input_
11
return $input_classes;
12
}
13
14
- protected function sanitize_field_input( $value ) {
15
return ( $value === '' ) ? false : (float) $value;
16
}
17
}
11
return $input_classes;
12
}
13
14
+ protected function sanitize_field_input( $value, $instance ) {
15
return ( $value === '' ) ? false : (float) $value;
16
}
17
}
base/inc/fields/posts.class.php CHANGED
@@ -9,7 +9,7 @@ class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Base {
9
siteorigin_widget_post_selector_admin_form_field( is_array( $value ) ? '' : $value, $this->element_name );
10
}
11
12
- protected function sanitize_field_input( $value ) {
13
// Posts selector functions handle sanitization.
14
return $value;
15
}
9
siteorigin_widget_post_selector_admin_form_field( is_array( $value ) ? '' : $value, $this->element_name );
10
}
11
12
+ protected function sanitize_field_input( $value, $instance ) {
13
// Posts selector functions handle sanitization.
14
return $value;
15
}
base/inc/fields/radio.class.php CHANGED
@@ -26,7 +26,7 @@ class SiteOrigin_Widget_Field_Radio extends SiteOrigin_Widget_Field_Base {
26
}
27
}
28
29
- protected function sanitize_field_input( $value ) {
30
$sanitized_value = $value;
31
$keys = array_keys( $this->options );
32
if( ! in_array( $sanitized_value, $keys ) ) $sanitized_value = isset( $this->default ) ? $this->default : false;
26
}
27
}
28
29
+ protected function sanitize_field_input( $value, $instance ) {
30
$sanitized_value = $value;
31
$keys = array_keys( $this->options );
32
if( ! in_array( $sanitized_value, $keys ) ) $sanitized_value = isset( $this->default ) ? $this->default : false;
base/inc/fields/repeater.class.php CHANGED
@@ -116,11 +116,11 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
116
*
117
* @return array|mixed
118
*/
119
- function sanitize_field_input( $value ){
120
if( empty($value) ) return array();
121
122
foreach( $value as &$el ) {
123
- $el = parent::sanitize_field_input( $el );
124
}
125
126
return $value;
116
*
117
* @return array|mixed
118
*/
119
+ function sanitize_field_input( $value, $instance ){
120
if( empty($value) ) return array();
121
122
foreach( $value as &$el ) {
123
+ $el = parent::sanitize_field_input( $el, $instance );
124
}
125
126
return $value;
base/inc/fields/select.class.php CHANGED
@@ -52,7 +52,7 @@ class SiteOrigin_Widget_Field_Select extends SiteOrigin_Widget_Field_Base {
52
<?php
53
}
54
55
- protected function sanitize_field_input( $value ) {
56
$values = is_array( $value ) ? $value : array( $value );
57
$keys = array_keys( $this->options );
58
$sanitized_value = array();
52
<?php
53
}
54
55
+ protected function sanitize_field_input( $value, $instance ) {
56
$values = is_array( $value ) ? $value : array( $value );
57
$keys = array_keys( $this->options );
58
$sanitized_value = array();
base/inc/fields/slider.class.php CHANGED
@@ -33,7 +33,7 @@ class SiteOrigin_Widget_Field_Slider extends SiteOrigin_Widget_Field_Base {
33
<?php
34
}
35
36
- protected function sanitize_field_input( $value ) {
37
return (float) $value;
38
}
39
33
<?php
34
}
35
36
+ protected function sanitize_field_input( $value, $instance ) {
37
return (float) $value;
38
}
39
base/inc/fields/text-input-base.class.php CHANGED
@@ -40,7 +40,7 @@ abstract class SiteOrigin_Widget_Field_Text_Input_Base extends SiteOrigin_Widget
40
<?php
41
}
42
43
- protected function sanitize_field_input( $value ) {
44
$sanitized_value = wp_kses_post( $value );
45
$sanitized_value = balanceTags( $sanitized_value , true );
46
return $sanitized_value;
40
<?php
41
}
42
43
+ protected function sanitize_field_input( $value, $instance ) {
44
$sanitized_value = wp_kses_post( $value );
45
$sanitized_value = balanceTags( $sanitized_value , true );
46
return $sanitized_value;
base/inc/fields/tinymce.class.php CHANGED
@@ -213,7 +213,7 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
213
wp_enqueue_style( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'css/so-tinymce-field.css', array(), SOW_BUNDLE_VERSION );
214
}
215
216
- protected function sanitize_field_input( $value ) {
217
if( current_user_can( 'unfiltered_html' ) ) {
218
$sanitized_value = $value;
219
} else {
213
wp_enqueue_style( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'css/so-tinymce-field.css', array(), SOW_BUNDLE_VERSION );
214
}
215
216
+ protected function sanitize_field_input( $value, $instance ) {
217
if( current_user_can( 'unfiltered_html' ) ) {
218
$sanitized_value = $value;
219
} else {
base/js/admin.js CHANGED
@@ -583,6 +583,8 @@
583
previewButton.find('> a').click(function(e){
584
e.preventDefault();
585
586
// Lets build the data from the widget
587
var data = {};
588
$el.find( '*[name]' ).each( function () {
@@ -622,6 +624,20 @@
622
sub[ parts[i] ] = $.val() !== '' ? $.val() : true;
623
}
624
}
625
else {
626
sub[ parts[i] ] = $.val();
627
}
583
previewButton.find('> a').click(function(e){
584
e.preventDefault();
585
586
+ // TODO: This very closely resembles the data extraction code in Page Builder. Try find a way to avoid having
587
+ // to maintain it in two places.
588
// Lets build the data from the widget
589
var data = {};
590
$el.find( '*[name]' ).each( function () {
624
sub[ parts[i] ] = $.val() !== '' ? $.val() : true;
625
}
626
}
627
+ else if($.prop('tagName') === 'TEXTAREA' && $.hasClass('wp-editor-area')) {
628
+ // This is a TinyMCE editor, so we'll use the tinyMCE object to get the content
629
+ var editor = null;
630
+ if ( typeof tinyMCE !== 'undefined' ) {
631
+ editor = tinyMCE.get( $.attr('id') );
632
+ }
633
+
634
+ if( editor !== null && typeof( editor.getContent ) === "function" && !editor.isHidden() ) {
635
+ sub[ parts[i] ] = editor.getContent();
636
+ }
637
+ else {
638
+ sub[ parts[i] ] = $.val();
639
+ }
640
+ }
641
else {
642
sub[ parts[i] ] = $.val();
643
}
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,g,c={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var m in a)p[m.replace("{$repeater}",u)]=a[m];a=p}for(var m in a)if(f=!1,r=m.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var w=0;w<g.length&&!(f=o.group===t&&g[w]===n);w++);}if(f){d=a[m],o.multi||(d=[d]);for(var w=0;w<d.length;w++)l="undefined"!=typeof d[w][1]&&Boolean(d[w][1])?i.find(d[w][1]):i,l[d[w][0]].apply(l,"undefined"!=typeof d[w][2]?d[w][2]:[]);c[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(o.hasClass("siteorigin-widget-active")||o.click(),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)s===a.length-1?"checkbox"===i.attr("type")?i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1:"radio"===i.attr("type")?i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0):r[a[s]]=i.val():("undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]])});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");g.remove(),c.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var m=p+"-"+d[p]++;i.attr("id",m),r.find("label[for="+s+"]").attr("for",m),r.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,m);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(m)&&tinymce.get(m).remove()}var w=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(w+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(w-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};
1
+ !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,g,c={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var m in a)p[m.replace("{$repeater}",u)]=a[m];a=p}for(var m in a)if(f=!1,r=m.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var w=0;w<g.length&&!(f=o.group===t&&g[w]===n);w++);}if(f){d=a[m],o.multi||(d=[d]);for(var w=0;w<d.length;w++)l="undefined"!=typeof d[w][1]&&Boolean(d[w][1])?i.find(d[w][1]):i,l[d[w][0]].apply(l,"undefined"!=typeof d[w][2]?d[w][2]:[]);c[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(o.hasClass("siteorigin-widget-active")||o.click(),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)if(s===a.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0);else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?r[a[s]]=i.val():r[a[s]]=o.getContent()}else r[a[s]]=i.val();else"undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]]});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");g.remove(),c.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var m=p+"-"+d[p]++;i.attr("id",m),r.find("label[for="+s+"]").attr("for",m),r.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,m);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(m)&&tinymce.get(m).remove()}var w=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(w+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(w-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};
base/siteorigin-widget.class.php CHANGED
@@ -464,7 +464,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
464
$field = $field_factory->create_field( $field_name, $field_options, $this );
465
$this->fields[$field_name] = $field;
466
}
467
- $new_instance[$field_name] = $field->sanitize( isset( $new_instance[$field_name] ) ? $new_instance[$field_name] : null );
468
$new_instance = $field->sanitize_instance( $new_instance );
469
}
470
@@ -626,7 +626,16 @@ abstract class SiteOrigin_Widget extends WP_Widget {
626
$lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
627
$lc_functions->registerFunctions($c);
628
629
- return apply_filters( 'siteorigin_widgets_instance_css', $c->compile( $less ), $instance, $this );
630
}
631
632
/**
464
$field = $field_factory->create_field( $field_name, $field_options, $this );
465
$this->fields[$field_name] = $field;
466
}
467
+ $new_instance[$field_name] = $field->sanitize( isset( $new_instance[$field_name] ) ? $new_instance[$field_name] : null, $new_instance );
468
$new_instance = $field->sanitize_instance( $new_instance );
469
}
470
626
$lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
627
$lc_functions->registerFunctions($c);
628
629
+ $css = $c->compile( $less );
630
+
631
+ // Remove any attributes with default as the value
632
+ $css = preg_replace('/[a-zA-Z\-]+ *: *default *;/', '', $css);
633
+
634
+ // Remove any empty CSS
635
+ $css = preg_replace('/[^{}]*\{\s*\}/m', '', $css);
636
+ $css = trim($css);
637
+
638
+ return apply_filters( 'siteorigin_widgets_instance_css', $css, $instance, $this );
639
}
640
641
/**
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 3.9
4
Tested up to: 4.3
5
- Stable tag: 1.5.1
6
License: GPLv3 or later
7
Contributors: gpriday, braam-genis
8
@@ -50,6 +50,13 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
50
51
== Changelog ==
52
53
= 1.5.2 - November 10 2015 =
54
* Removed word break style from headline widget.
55
* Fixed image grid URL field.
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 3.9
4
Tested up to: 4.3
5
+ Stable tag: 1.5.2
6
License: GPLv3 or later
7
Contributors: gpriday, braam-genis
8
50
51
== Changelog ==
52
53
+ = 1.5.3 - November 17 2015 =
54
+ * Fixed defaults for Features widget and Hero Image widget.
55
+ * Fixed previewing for Editor widget.
56
+ * Change measurement field to work as single string.
57
+ * Use new measurement field for existing widgets.
58
+ * Carousel widget supports RTL.
59
+
60
= 1.5.2 - November 10 2015 =
61
* Removed word break style from headline widget.
62
* Fixed image grid URL field.
so-widgets-bundle.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: SiteOrigin Widgets Bundle
4
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
- Version: 1.5.2
6
Text Domain: so-widgets-bundle
7
Domain Path: /languages
8
Author: SiteOrigin
@@ -12,7 +12,7 @@ License: GPL3
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
- define('SOW_BUNDLE_VERSION', '1.5.2');
16
define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
@@ -306,7 +306,7 @@ class SiteOrigin_Widgets_Bundle {
306
add_plugins_page(
307
__('SiteOrigin Widgets', 'so-widgets-bundle'),
308
__('SiteOrigin Widgets', 'so-widgets-bundle'),
309
- apply_filters('siteorigin_widgets_admin_menu_capability', 'install_plugins'),
310
'so-widgets-plugins',
311
array($this, 'admin_page')
312
);
2
/*
3
Plugin Name: SiteOrigin Widgets Bundle
4
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
+ Version: 1.5.3
6
Text Domain: so-widgets-bundle
7
Domain Path: /languages
8
Author: SiteOrigin
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
+ define('SOW_BUNDLE_VERSION', '1.5.3');
16
define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
306
add_plugins_page(
307
__('SiteOrigin Widgets', 'so-widgets-bundle'),
308
__('SiteOrigin Widgets', 'so-widgets-bundle'),
309
+ apply_filters('siteorigin_widgets_admin_menu_capability', 'manage_options'),
310
'so-widgets-plugins',
311
array($this, 'admin_page')
312
);
widgets/so-contact-widget/so-contact-widget.php CHANGED
@@ -434,9 +434,6 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
434
}
435
436
function get_less_variables( $instance ){
437
- // Newly added field could cause fatal errors with previously saved forms.
438
- $font_size = empty( $instance['design']['submit']['font_size'] ) ? 'default' : $instance['design']['submit']['font_size'];
439
- $font_size_unit = empty( $instance['design']['submit']['font_size_unit'] ) ? 'px' : $instance['design']['submit']['font_size_unit'];
440
$vars = array(
441
// All the container variables.
442
'container_background' => $instance['design']['container']['background'],
@@ -460,7 +457,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
460
'submit_border_width' => $instance['design']['submit']['border_width'] . 'px',
461
'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px',
462
'submit_text_color' => $instance['design']['submit']['text_color'],
463
- 'submit_font_size' => $font_size . $font_size_unit,
464
'submit_weight' => $instance['design']['submit']['weight'],
465
'submit_padding' => $instance['design']['submit']['padding'] . 'px',
466
'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%',
434
}
435
436
function get_less_variables( $instance ){
437
$vars = array(
438
// All the container variables.
439
'container_background' => $instance['design']['container']['background'],
457
'submit_border_width' => $instance['design']['submit']['border_width'] . 'px',
458
'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px',
459
'submit_text_color' => $instance['design']['submit']['text_color'],
460
+ 'submit_font_size' => $instance['design']['submit']['font_size'],
461
'submit_weight' => $instance['design']['submit']['weight'],
462
'submit_padding' => $instance['design']['submit']['padding'] . 'px',
463
'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%',
widgets/so-features-widget/so-features-widget.php CHANGED
@@ -159,15 +159,15 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
159
),
160
161
'container_size' => array(
162
- 'type' => 'number',
163
'label' => __('Container size', 'so-widgets-bundle'),
164
- 'default' => 84,
165
),
166
167
'icon_size' => array(
168
- 'type' => 'number',
169
'label' => __('Icon size', 'so-widgets-bundle'),
170
- 'default' => 24,
171
),
172
173
'per_row' => array(
@@ -233,7 +233,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
233
if ( ! empty( $fonts[$field_name.'_options'] ) ) {
234
$styles = $fonts[$field_name.'_options'];
235
if ( ! empty( $styles['size'] ) ) {
236
- $less_vars[$field_name.'_size'] = $styles['size'] . $styles['size_unit'];
237
}
238
if ( ! empty( $styles['color'] ) ) {
239
$less_vars[$field_name.'_color'] = $styles['color'];
159
),
160
161
'container_size' => array(
162
+ 'type' => 'measurement',
163
'label' => __('Container size', 'so-widgets-bundle'),
164
+ 'default' => '84px',
165
),
166
167
'icon_size' => array(
168
+ 'type' => 'measurement',
169
'label' => __('Icon size', 'so-widgets-bundle'),
170
+ 'default' => '24px',
171
),
172
173
'per_row' => array(
233
if ( ! empty( $fonts[$field_name.'_options'] ) ) {
234
$styles = $fonts[$field_name.'_options'];
235
if ( ! empty( $styles['size'] ) ) {
236
+ $less_vars[$field_name.'_size'] = $styles['size'];
237
}
238
if ( ! empty( $styles['color'] ) ) {
239
$less_vars[$field_name.'_color'] = $styles['color'];
widgets/so-features-widget/styles/features.less CHANGED
@@ -4,44 +4,38 @@
4
5
@title_font: default;
6
@title_font_weight: 400;
7
- @title_size: 16px;
8
- @title_color: #000000;
9
10
@text_font: default;
11
@text_font_weight: 400;
12
- @text_size: 12px;
13
- @text_color: #000000;
14
15
@more_text_font: default;
16
@more_text_font_weight: 400;
17
- @more_text_size: 12px;
18
- @more_text_color: #000000;
19
20
.sow-features-list .sow-features-feature {
21
22
.textwidget {
23
- > h5 {
24
- .font(@title_font, @title_font_weight);
25
- //text-align: @headline_align;
26
- font-size: @title_size;
27
- color: @title_color;
28
- line-height: 1.3;
29
- }
30
-
31
- > p {
32
- .font(@text_font, @text_font_weight);
33
- //text-align: @headline_align;
34
- font-size: @text_size;
35
- color: @text_color;
36
- line-height: 1.3;
37
- }
38
-
39
- > p.sow-more-text {
40
- .font(@more_text_font, @more_text_font_weight);
41
- //text-align: @headline_align;
42
- font-size: @more_text_size;
43
- color: @more_text_color;
44
- line-height: 1.3;
45
- }
46
}
47
}
4
5
@title_font: default;
6
@title_font_weight: 400;
7
+ @title_size: default;
8
+ @title_color: default;
9
10
@text_font: default;
11
@text_font_weight: 400;
12
+ @text_size: default;
13
+ @text_color: default;
14
15
@more_text_font: default;
16
@more_text_font_weight: 400;
17
+ @more_text_size: default;
18
+ @more_text_color: default;
19
20
.sow-features-list .sow-features-feature {
21
22
.textwidget {
23
+ > h5 {
24
+ .font(@title_font, @title_font_weight);
25
+ font-size: @title_size;
26
+ color: @title_color;
27
+ }
28
+
29
+ > p {
30
+ .font(@text_font, @text_font_weight);
31
+ font-size: @text_size;
32
+ color: @text_color;
33
+ }
34
+
35
+ > p.sow-more-text {
36
+ .font(@more_text_font, @more_text_font_weight);
37
+ font-size: @more_text_size;
38
+ color: @more_text_color;
39
+ }
40
}
41
}
widgets/so-headline-widget/so-headline-widget.php CHANGED
@@ -142,6 +142,16 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
142
'type' => 'color',
143
'label' => __('Color', 'so-widgets-bundle'),
144
'default' => '#EEEEEE'
145
)
146
)
147
)
@@ -210,6 +220,16 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
210
if ( ! empty( $divider_styles['color'] ) ) {
211
$less_vars['divider_color'] = $divider_styles['color'];
212
}
213
}
214
215
return $less_vars;
142
'type' => 'color',
143
'label' => __('Color', 'so-widgets-bundle'),
144
'default' => '#EEEEEE'
145
+ ),
146
+ 'side_margin' => array(
147
+ 'type' => 'measurement',
148
+ 'label' => __('Side Margin', 'so-widgets-bundle'),
149
+ 'default' => '60px',
150
+ ),
151
+ 'top_margin' => array(
152
+ 'type' => 'measurement',
153
+ 'label' => __('Top/Bottom Margin', 'so-widgets-bundle'),
154
+ 'default' => '20px',
155
)
156
)
157
)
220
if ( ! empty( $divider_styles['color'] ) ) {
221
$less_vars['divider_color'] = $divider_styles['color'];
222
}
223
+
224
+ if ( !empty( $divider_styles['top_margin'] ) && !empty( $divider_styles['top_margin_unit'] ) ) {
225
+ $less_vars['divider_top_margin'] = $divider_styles['top_margin'] . $divider_styles['top_margin_unit'];
226
+ }
227
+
228
+ if ( !empty( $divider_styles['side_margin'] ) && !empty( $divider_styles['side_margin_unit'] ) ) {
229
+ $less_vars['divider_side_margin'] = $divider_styles['side_margin'] . $divider_styles['side_margin_unit'];
230
+ }
231
+
232
+
233
}
234
235
return $less_vars;
widgets/so-headline-widget/styles/sow-headline.less CHANGED
@@ -6,17 +6,19 @@
6
@headline_font: default;
7
@headline_font_weight: 400;
8
@headline_align: left;
9
- @headline_color: #000000;
10
11
@sub_headline_tag: h3;
12
@sub_headline_font: default;
13
@sub_headline_font_weight: 400;
14
@sub_headline_align: left;
15
- @sub_headline_color: #000000;
16
17
@divider_weight: thin;
18
@divider_style: solid;
19
@divider_color: #EEEEEE;
20
21
#sow-headline-container.sow-headline {
22
@@ -24,20 +26,20 @@
24
.font(@headline_font, @headline_font_weight);
25
text-align: @headline_align;
26
color: @headline_color;
27
- line-height: 1.3;
28
}
29
30
@{sub_headline_tag} {
31
.font(@sub_headline_font, @sub_headline_font_weight);
32
text-align: @sub_headline_align;
33
color: @sub_headline_color;
34
- line-height: 1.3;
35
}
36
37
.decoration {
38
border-top: @divider_weight @divider_style @divider_color;
39
position: relative;
40
height: 1px;
41
- margin: 20px 60px 20px 60px;
42
}
43
}
6
@headline_font: default;
7
@headline_font_weight: 400;
8
@headline_align: left;
9
+ @headline_color: default;
10
11
@sub_headline_tag: h3;
12
@sub_headline_font: default;
13
@sub_headline_font_weight: 400;
14
@sub_headline_align: left;
15
+ @sub_headline_color: default;
16
17
@divider_weight: thin;
18
@divider_style: solid;
19
@divider_color: #EEEEEE;
20
+ @divider_top_margin: 20px;
21
+ @divider_side_margin: 60px;
22
23
#sow-headline-container.sow-headline {
24
26
.font(@headline_font, @headline_font_weight);
27
text-align: @headline_align;
28
color: @headline_color;
29
+ line-height: 1.4;
30
}
31
32
@{sub_headline_tag} {
33
.font(@sub_headline_font, @sub_headline_font_weight);
34
text-align: @sub_headline_align;
35
color: @sub_headline_color;
36
+ line-height: 1.4;
37
}
38
39
.decoration {
40
border-top: @divider_weight @divider_style @divider_color;
41
position: relative;
42
height: 1px;
43
+ margin: @divider_top_margin @divider_side_margin;
44
}
45
}
widgets/so-hero-widget/styles/default.less CHANGED
@@ -13,7 +13,7 @@
13
@text_size: 16px;
14
@heading_shadow: 50;
15
16
- @heading_font: "Arial", sans-serif;
17
@heading_font_weight: 400;
18
19
.sow-slider-base {
13
@text_size: 16px;
14
@heading_shadow: 50;
15
16
+ @heading_font: default;
17
@heading_font_weight: 400;
18
19
.sow-slider-base {
widgets/so-post-carousel-widget/css/style.css CHANGED
@@ -97,6 +97,12 @@
97
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item:last-child {
98
margin-right: 0;
99
}
100
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail {
101
line-height: 0;
102
}
@@ -131,11 +137,11 @@
131
display: block;
132
width: 242px;
133
height: 162px;
134
- background: #e8e8e8;
135
- background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e0e0e0), color-stop(1, #e8e8e8));
136
- background: -ms-linear-gradient(bottom, #e0e0e0, #e8e8e8);
137
- background: -moz-linear-gradient(center bottom, #e0e0e0 0%, #e8e8e8 100%);
138
- background: -o-linear-gradient(#e8e8e8, #e0e0e0);
139
}
140
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3 {
141
font-size: 15px;
@@ -153,7 +159,7 @@
153
width: 242px;
154
height: 162px;
155
float: left;
156
- background: url(images/carousel-loader.gif) #f6f6f6 center center no-repeat;
157
margin: 0;
158
}
159
a.sow-carousel-previous {
97
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item:last-child {
98
margin-right: 0;
99
}
100
+ .sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl {
101
+ float: right;
102
+ }
103
+ .sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl:last-child {
104
+ margin-right: 15px;
105
+ }
106
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail {
107
line-height: 0;
108
}
137
display: block;
138
width: 242px;
139
height: 162px;
140
+ background: #E8E8E8;
141
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #E0E0E0), color-stop(1, #E8E8E8));
142
+ background: -ms-linear-gradient(bottom, #E0E0E0, #E8E8E8);
143
+ background: -moz-linear-gradient(center bottom, #E0E0E0 0%, #E8E8E8 100%);
144
+ background: -o-linear-gradient(#E8E8E8, #E0E0E0);
145
}
146
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3 {
147
font-size: 15px;
159
width: 242px;
160
height: 162px;
161
float: left;
162
+ background: url(images/carousel-loader.gif) #F6F6F6 center center no-repeat;
163
margin: 0;
164
}
165
a.sow-carousel-previous {
widgets/so-post-carousel-widget/js/carousel.js CHANGED
@@ -3,6 +3,7 @@ jQuery( function($){
3
$('.sow-carousel-wrapper').each(function(){
4
5
var $ = $(this),
6
$container = $.closest('.sow-carousel-container').parent(),
7
$itemsContainer = $.find('.sow-carousel-items'),
8
$items = $.find('.sow-carousel-item'),
@@ -14,7 +15,9 @@ jQuery( function($){
14
numItems = $items.length,
15
totalPosts = $.data('found-posts'),
16
complete = numItems == totalPosts,
17
- itemWidth = ( $firstItem.width() + parseInt($firstItem.css('margin-right')) );
18
19
var updatePosition = function() {
20
if ( position < 0 ) position = 0;
@@ -45,13 +48,13 @@ jQuery( function($){
45
}
46
}
47
$itemsContainer.css('transition-duration', "0.45s");
48
- $itemsContainer.css('margin-left', -( itemWidth * position) + 'px' );
49
};
50
51
$container.on( 'click', 'a.sow-carousel-previous',
52
function(e){
53
e.preventDefault();
54
- position -= 1;
55
updatePosition();
56
}
57
);
@@ -59,7 +62,7 @@ jQuery( function($){
59
$container.on( 'click', 'a.sow-carousel-next',
60
function(e){
61
e.preventDefault();
62
- position += 1;
63
updatePosition();
64
}
65
);
@@ -69,6 +72,7 @@ jQuery( function($){
69
var velocity = 0;
70
var prevTime = 0;
71
var posInterval;
72
$.swipe( {
73
excludedElements: "",
74
triggerOnTouchEnd: true,
@@ -80,7 +84,7 @@ jQuery( function($){
80
clearInterval(posInterval);
81
}
82
else if ( phase == "move" ) {
83
- if( direction == "left" ) distance *= -1;
84
setNewPosition(startPosition + distance);
85
var newTime = new Date().getTime();
86
var timeDelta = (newTime - prevTime) / 1000;
@@ -90,7 +94,7 @@ jQuery( function($){
90
}
91
else if ( phase == "end" ) {
92
validSwipe = true;
93
- if( direction == "left" ) distance *= -1;
94
if(Math.abs(velocity) > 400) {
95
velocity *= 0.1;
96
var startTime = new Date().getTime();
@@ -101,7 +105,7 @@ jQuery( function($){
101
var newPos = startPosition + distance + cumulativeDistance;
102
var decel = 30;
103
var end = (Math.abs(velocity) - decel) < 0;
104
- if(direction == "left") {
105
velocity += decel;
106
} else {
107
velocity -= decel;
@@ -123,13 +127,13 @@ jQuery( function($){
123
var setNewPosition = function(newPosition) {
124
if(newPosition < 50 && newPosition > -( itemWidth * numItems )) {
125
$itemsContainer.css('transition-duration', "0s");
126
- $itemsContainer.css('margin-left', newPosition + 'px' );
127
return true;
128
}
129
return false;
130
};
131
var setFinalPosition = function() {
132
- var finalPosition = parseInt( $itemsContainer.css('margin-left') );
133
position = Math.abs( Math.round( finalPosition / itemWidth ) );
134
updatePosition();
135
};
3
$('.sow-carousel-wrapper').each(function(){
4
5
var $ = $(this),
6
+ $postsContainer = $.closest('.sow-carousel-container'),
7
$container = $.closest('.sow-carousel-container').parent(),
8
$itemsContainer = $.find('.sow-carousel-items'),
9
$items = $.find('.sow-carousel-item'),
15
numItems = $items.length,
16
totalPosts = $.data('found-posts'),
17
complete = numItems == totalPosts,
18
+ itemWidth = ( $firstItem.width() + parseInt($firstItem.css('margin-right')) ),
19
+ isRTL = $postsContainer.hasClass('js-rtl'),
20
+ updateProp = isRTL ? 'margin-right' : 'margin-left';
21
22
var updatePosition = function() {
23
if ( position < 0 ) position = 0;
48
}
49
}
50
$itemsContainer.css('transition-duration', "0.45s");
51
+ $itemsContainer.css(updateProp, -( itemWidth * position) + 'px' );
52
};
53
54
$container.on( 'click', 'a.sow-carousel-previous',
55
function(e){
56
e.preventDefault();
57
+ position -= isRTL ? -1 : 1;
58
updatePosition();
59
}
60
);
62
$container.on( 'click', 'a.sow-carousel-next',
63
function(e){
64
e.preventDefault();
65
+ position += isRTL ? -1 : 1;
66
updatePosition();
67
}
68
);
72
var velocity = 0;
73
var prevTime = 0;
74
var posInterval;
75
+ var negativeDirection = isRTL ? 'right' : 'left';
76
$.swipe( {
77
excludedElements: "",
78
triggerOnTouchEnd: true,
84
clearInterval(posInterval);
85
}
86
else if ( phase == "move" ) {
87
+ if( direction == negativeDirection ) distance *= -1;
88
setNewPosition(startPosition + distance);
89
var newTime = new Date().getTime();
90
var timeDelta = (newTime - prevTime) / 1000;
94
}
95
else if ( phase == "end" ) {
96
validSwipe = true;
97
+ if( direction == negativeDirection ) distance *= -1;
98
if(Math.abs(velocity) > 400) {
99
velocity *= 0.1;
100
var startTime = new Date().getTime();
105
var newPos = startPosition + distance + cumulativeDistance;
106
var decel = 30;
107
var end = (Math.abs(velocity) - decel) < 0;
108
+ if(direction == negativeDirection) {
109
velocity += decel;
110
} else {
111
velocity -= decel;
127
var setNewPosition = function(newPosition) {
128
if(newPosition < 50 && newPosition > -( itemWidth * numItems )) {
129
$itemsContainer.css('transition-duration', "0s");
130
+ $itemsContainer.css(updateProp, newPosition + 'px' );
131
return true;
132
}
133
return false;
134
};
135
var setFinalPosition = function() {
136
+ var finalPosition = parseInt( $itemsContainer.css(updateProp) );
137
position = Math.abs( Math.round( finalPosition / itemWidth ) );
138
updatePosition();
139
};
widgets/so-post-carousel-widget/js/carousel.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){e(".sow-carousel-wrapper").each(function(){var t=e(this),a=t.closest(".sow-carousel-container").parent(),n=t.find(".sow-carousel-items"),s=t.find(".sow-carousel-item"),o=s.eq(0),i=0,r=1,l=!1,c=s.length,u=t.data("found-posts"),f=c==u,d=o.width()+parseInt(o.css("margin-right")),w=function(){0>i&&(i=0),i>=t.find(".sow-carousel-item").length-1&&(i=t.find(".sow-carousel-item").length-1,l||f||(l=!0,r++,n.append('<li class="sow-carousel-item sow-carousel-loading"></li>'),e.get(t.data("ajax-url"),{query:t.data("query"),action:"sow_carousel_load",paged:r},function(a,s){var o=e(a.html);o.appendTo(n).hide().fadeIn(),t.find(".sow-carousel-loading").remove(),c=t.find(".sow-carousel-item").length,f=c==u,l=!1}))),n.css("transition-duration","0.45s"),n.css("margin-left",-(d*i)+"px")};a.on("click","a.sow-carousel-previous",function(e){e.preventDefault(),i-=1,w()}),a.on("click","a.sow-carousel-next",function(e){e.preventDefault(),i+=1,w()});var g,m=!1,p=0,v=0,h=0,D=0;t.swipe({excludedElements:"",triggerOnTouchEnd:!0,threshold:75,swipeStatus:function(e,t,a,n,s,o,r){if("start"==t)v=-(d*i),D=(new Date).getTime(),clearInterval(g);else if("move"==t){"left"==a&&(n*=-1),I(v+n);var l=(new Date).getTime(),c=(l-D)/1e3;h=(n-p)/c,D=l,p=n}else if("end"==t)if(m=!0,"left"==a&&(n*=-1),Math.abs(h)>400){h*=.1;var u=(new Date).getTime(),f=0;g=setInterval(function(){var e=((new Date).getTime()-u)/1e3;f+=h*e;var t=v+n+f,s=30,o=Math.abs(h)-s<0;"left"==a?h+=s:h-=s,(o||!I(t))&&(clearInterval(g),T())},20)}else T();else"cancel"==t&&w()}});var I=function(e){return 50>e&&e>-(d*c)?(n.css("transition-duration","0s"),n.css("margin-left",e+"px"),!0):!1},T=function(){var e=parseInt(n.css("margin-left"));i=Math.abs(Math.round(e/d)),w()};t.on("click",".sow-carousel-item a",function(e){m&&(e.preventDefault(),m=!1)})})});
1
+ jQuery(function(e){e(".sow-carousel-wrapper").each(function(){var a=e(this),t=a.closest(".sow-carousel-container"),s=a.closest(".sow-carousel-container").parent(),n=a.find(".sow-carousel-items"),o=a.find(".sow-carousel-item"),r=o.eq(0),i=0,l=1,c=!1,u=o.length,f=a.data("found-posts"),d=u==f,w=r.width()+parseInt(r.css("margin-right")),g=t.hasClass("js-rtl"),h=g?"margin-right":"margin-left",p=function(){0>i&&(i=0),i>=a.find(".sow-carousel-item").length-1&&(i=a.find(".sow-carousel-item").length-1,c||d||(c=!0,l++,n.append('<li class="sow-carousel-item sow-carousel-loading"></li>'),e.get(a.data("ajax-url"),{query:a.data("query"),action:"sow_carousel_load",paged:l},function(t,s){var o=e(t.html);o.appendTo(n).hide().fadeIn(),a.find(".sow-carousel-loading").remove(),u=a.find(".sow-carousel-item").length,d=u==f,c=!1}))),n.css("transition-duration","0.45s"),n.css(h,-(w*i)+"px")};s.on("click","a.sow-carousel-previous",function(e){e.preventDefault(),i-=g?-1:1,p()}),s.on("click","a.sow-carousel-next",function(e){e.preventDefault(),i+=g?-1:1,p()});var m,v=!1,D=0,I=0,T=0,x=0,M=g?"right":"left";a.swipe({excludedElements:"",triggerOnTouchEnd:!0,threshold:75,swipeStatus:function(e,a,t,s,n,o,r){if("start"==a)I=-(w*i),x=(new Date).getTime(),clearInterval(m);else if("move"==a){t==M&&(s*=-1),b(I+s);var l=(new Date).getTime(),c=(l-x)/1e3;T=(s-D)/c,x=l,D=s}else if("end"==a)if(v=!0,t==M&&(s*=-1),Math.abs(T)>400){T*=.1;var u=(new Date).getTime(),f=0;m=setInterval(function(){var e=((new Date).getTime()-u)/1e3;f+=T*e;var a=I+s+f,n=30,o=Math.abs(T)-n<0;t==M?T+=n:T-=n,(o||!b(a))&&(clearInterval(m),j())},20)}else j();else"cancel"==a&&p()}});var b=function(e){return 50>e&&e>-(w*u)?(n.css("transition-duration","0s"),n.css(h,e+"px"),!0):!1},j=function(){var e=parseInt(n.css(h));i=Math.abs(Math.round(e/w)),p()};a.on("click",".sow-carousel-item a",function(e){v&&(e.preventDefault(),v=!1)})})});
widgets/so-post-carousel-widget/so-post-carousel-widget.php CHANGED
@@ -27,20 +27,7 @@ function sow_carousel_get_next_posts_page() {
27
28
$posts = new WP_Query($query);
29
ob_start();
30
- while($posts->have_posts()) : $posts->the_post(); ?>
31
- <li class="sow-carousel-item">
32
- <div class="sow-carousel-thumbnail">
33
- <?php if( has_post_thumbnail() ) : $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default'); ?>
34
- <a href="<?php the_permalink() ?>" style="background-image: url(<?php echo sow_esc_url($img[0]) ?>)">
35
- <span class="overlay"></span>
36
- </a>
37
- <?php else : ?>
38
- <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"><span class="overlay"></span></a>
39
- <?php endif; ?>
40
- </div>
41
- <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
42
- </li>
43
- <?php endwhile; wp_reset_postdata();
44
$result = array( 'html' => ob_get_clean() );
45
header('content-type: application/json');
46
echo json_encode( $result );
27
28
$posts = new WP_Query($query);
29
ob_start();
30
+ include 'tpl/carousel-post-loop.php';
31
$result = array( 'html' => ob_get_clean() );
32
header('content-type: application/json');
33
echo json_encode( $result );
widgets/so-post-carousel-widget/tpl/base.php CHANGED
@@ -1,9 +1,9 @@
1
<?php
2
$query = siteorigin_widget_post_selector_process_query( $instance['posts'] );
3
- $the_query = new WP_Query( $query );
4
?>
5
6
- <?php if($the_query->have_posts()) : ?>
7
<div class="sow-carousel-title">
8
<?php echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
9
@@ -11,7 +11,7 @@ $the_query = new WP_Query( $query );
11
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
12
</div>
13
14
- <div class="sow-carousel-container">
15
16
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
17
@@ -19,24 +19,11 @@ $the_query = new WP_Query( $query );
19
20
<div class="sow-carousel-wrapper"
21
data-query="<?php echo esc_attr($instance['posts']) ?>"
22
- data-found-posts="<?php echo esc_attr($the_query->found_posts) ?>"
23
data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
24
>
25
<ul class="sow-carousel-items">
26
- <?php while($the_query->have_posts()) : $the_query->the_post(); ?>
27
- <li class="sow-carousel-item">
28
- <div class="sow-carousel-thumbnail">
29
- <?php if( has_post_thumbnail() ) : $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default'); ?>
30
- <a href="<?php the_permalink() ?>" style="background-image: url(<?php echo sow_esc_url($img[0]) ?>)">
31
- <span class="overlay"></span>
32
- </a>
33
- <?php else : ?>
34
- <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"><span class="overlay"></span></a>
35
- <?php endif; ?>
36
- </div>
37
- <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
38
- </li>
39
- <?php endwhile; wp_reset_postdata(); ?>
40
</ul>
41
</div>
42
</div>
1
<?php
2
$query = siteorigin_widget_post_selector_process_query( $instance['posts'] );
3
+ $posts = new WP_Query( $query );
4
?>
5
6
+ <?php if($posts->have_posts()) : ?>
7
<div class="sow-carousel-title">
8
<?php echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
9
11
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
12
</div>
13
14
+ <div class="sow-carousel-container<?php if( is_rtl() ) echo ' js-rtl' ?>">
15
16
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
17
19
20
<div class="sow-carousel-wrapper"
21
data-query="<?php echo esc_attr($instance['posts']) ?>"
22
+ data-found-posts="<?php echo esc_attr($posts->found_posts) ?>"
23
data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
24
>
25
<ul class="sow-carousel-items">
26
+ <?php include 'carousel-post-loop.php' ?>
27
</ul>
28
</div>
29
</div>
widgets/so-post-carousel-widget/tpl/carousel-post-loop.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ $posts = new WP_Query($query);
3
+ while($posts->have_posts()) : $posts->the_post(); ?>
4
+ <li class="sow-carousel-item<?php if( is_rtl() ) echo ' rtl' ?>">
5
+ <div class="sow-carousel-thumbnail">
6
+ <?php if( has_post_thumbnail() ) : $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default'); ?>
7
+ <a href="<?php the_permalink() ?>" style="background-image: url(<?php echo sow_esc_url($img[0]) ?>)">
8
+ <span class="overlay"></span>
9
+ </a>
10
+ <?php else : ?>
11
+ <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"><span class="overlay"></span></a>
12
+ <?php endif; ?>
13
+ </div>
14
+ <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
15
+ </li>
16
+ <?php endwhile; wp_reset_postdata(); ?>