/* Minification failed. Returning unminified contents.
(681,15-21): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(681,24-30): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(697,15-21): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(697,24-30): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(663,9-23): run-time error JS1137: 'native = true;' is a new reserved word and should not be used as an identifier: native = true;
 */
/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function p(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return p.apply(null,arguments)}var q=Date.now||function(){return+new Date};function ca(a,b){this.a=a;this.o=b||a;this.c=this.o.document}var da=!!window.FontFace;function t(a,b,c,d){b=a.c.createElement(b);if(c)for(var e in c)c.hasOwnProperty(e)&&("style"==e?b.style.cssText=c[e]:b.setAttribute(e,c[e]));d&&b.appendChild(a.c.createTextNode(d));return b}function u(a,b,c){a=a.c.getElementsByTagName(b)[0];a||(a=document.documentElement);a.insertBefore(c,a.lastChild)}function v(a){a.parentNode&&a.parentNode.removeChild(a)}
function w(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function y(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
function ea(a){return a.o.location.hostname||a.a.location.hostname}function z(a,b,c){function d(){m&&e&&f&&(m(g),m=null)}b=t(a,"link",{rel:"stylesheet",href:b,media:"all"});var e=!1,f=!0,g=null,m=c||null;da?(b.onload=function(){e=!0;d()},b.onerror=function(){e=!0;g=Error("Stylesheet failed to load");d()}):setTimeout(function(){e=!0;d()},0);u(a,"head",b)}
function A(a,b,c,d){var e=a.c.getElementsByTagName("head")[0];if(e){var f=t(a,"script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function B(){this.a=0;this.c=null}function C(a){a.a++;return function(){a.a--;D(a)}}function E(a,b){a.c=b;D(a)}function D(a){0==a.a&&a.c&&(a.c(),a.c=null)};function F(a){this.a=a||"-"}F.prototype.c=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.a)};function G(a,b){this.c=a;this.f=4;this.a="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.a=c[1],this.f=parseInt(c[2],10))}function fa(a){return H(a)+" "+(a.f+"00")+" 300px "+I(a.c)}function I(a){var b=[];a=a.split(/,\s*/);for(var c=0;c<a.length;c++){var d=a[c].replace(/['"]/g,"");-1!=d.indexOf(" ")||/^\d/.test(d)?b.push("'"+d+"'"):b.push(d)}return b.join(",")}function J(a){return a.a+a.f}function H(a){var b="normal";"o"===a.a?b="oblique":"i"===a.a&&(b="italic");return b}
function ga(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ha(a,b){this.c=a;this.f=a.o.document.documentElement;this.h=b;this.a=new F("-");this.j=!1!==b.events;this.g=!1!==b.classes}function ia(a){a.g&&w(a.f,[a.a.c("wf","loading")]);K(a,"loading")}function L(a){if(a.g){var b=y(a.f,a.a.c("wf","active")),c=[],d=[a.a.c("wf","loading")];b||c.push(a.a.c("wf","inactive"));w(a.f,c,d)}K(a,"inactive")}function K(a,b,c){if(a.j&&a.h[b])if(c)a.h[b](c.c,J(c));else a.h[b]()};function ja(){this.c={}}function ka(a,b,c){var d=[],e;for(e in b)if(b.hasOwnProperty(e)){var f=a.c[e];f&&d.push(f(b[e],c))}return d};function M(a,b){this.c=a;this.f=b;this.a=t(this.c,"span",{"aria-hidden":"true"},this.f)}function N(a){u(a.c,"body",a.a)}function O(a){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+I(a.c)+";"+("font-style:"+H(a)+";font-weight:"+(a.f+"00")+";")};function P(a,b,c,d,e,f){this.g=a;this.j=b;this.a=d;this.c=c;this.f=e||3E3;this.h=f||void 0}P.prototype.start=function(){var a=this.c.o.document,b=this,c=q(),d=new Promise(function(d,e){function f(){q()-c>=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?d():setTimeout(f,25)},function(){e()})}f()}),e=null,f=new Promise(function(a,d){e=setTimeout(d,b.f)});Promise.race([f,d]).then(function(){e&&(clearTimeout(e),e=null);b.g(b.a)},function(){b.j(b.a)})};function Q(a,b,c,d,e,f,g){this.v=a;this.B=b;this.c=c;this.a=d;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.m=this.j=this.h=this.g=null;this.g=new M(this.c,this.s);this.h=new M(this.c,this.s);this.j=new M(this.c,this.s);this.m=new M(this.c,this.s);a=new G(this.a.c+",serif",J(this.a));a=O(a);this.g.a.style.cssText=a;a=new G(this.a.c+",sans-serif",J(this.a));a=O(a);this.h.a.style.cssText=a;a=new G("serif",J(this.a));a=O(a);this.j.a.style.cssText=a;a=new G("sans-serif",J(this.a));a=
O(a);this.m.a.style.cssText=a;N(this.g);N(this.h);N(this.j);N(this.m)}var R={D:"serif",C:"sans-serif"},S=null;function T(){if(null===S){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);S=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return S}Q.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.m.a.offsetWidth;this.A=q();U(this)};
function la(a,b,c){for(var d in R)if(R.hasOwnProperty(d)&&b===a.f[R[d]]&&c===a.f[R[d]])return!0;return!1}function U(a){var b=a.g.a.offsetWidth,c=a.h.a.offsetWidth,d;(d=b===a.f.serif&&c===a.f["sans-serif"])||(d=T()&&la(a,b,c));d?q()-a.A>=a.w?T()&&la(a,b,c)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):ma(a):V(a,a.v)}function ma(a){setTimeout(p(function(){U(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.m.a);b(this.a)},a),0)};function W(a,b,c){this.c=a;this.a=b;this.f=0;this.m=this.j=!1;this.s=c}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,J(a).toString(),"active")],[b.a.c("wf",a.c,J(a).toString(),"loading"),b.a.c("wf",a.c,J(a).toString(),"inactive")]);K(b,"fontactive",a);this.m=!0;na(this)};
W.prototype.h=function(a){var b=this.a;if(b.g){var c=y(b.f,b.a.c("wf",a.c,J(a).toString(),"active")),d=[],e=[b.a.c("wf",a.c,J(a).toString(),"loading")];c||d.push(b.a.c("wf",a.c,J(a).toString(),"inactive"));w(b.f,d,e)}K(b,"fontinactive",a);na(this)};function na(a){0==--a.f&&a.j&&(a.m?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),K(a,"active")):L(a.a))};function oa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}oa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;pa(this,new ha(this.c,a),a)};
function qa(a,b,c,d,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,m=d||null||{};if(0===c.length&&f)L(b.a);else{b.f+=c.length;f&&(b.j=f);var h,l=[];for(h=0;h<c.length;h++){var k=c[h],n=m[k.c],r=b.a,x=k;r.g&&w(r.f,[r.a.c("wf",x.c,J(x).toString(),"loading")]);K(r,"fontloading",x);r=null;if(null===X)if(window.FontFace){var x=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),xa=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);
X=x?42<parseInt(x[1],10):xa?!1:!0}else X=!1;X?r=new P(p(b.g,b),p(b.h,b),b.c,k,b.s,n):r=new Q(p(b.g,b),p(b.h,b),b.c,k,b.s,a,n);l.push(r)}for(h=0;h<l.length;h++)l[h].start()}},0)}function pa(a,b,c){var d=[],e=c.timeout;ia(b);var d=ka(a.a,c,a.c),f=new W(a.c,b,e);a.h=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,d,c){qa(a,f,b,d,c)})};function ra(a,b){this.c=a;this.a=b}
ra.prototype.load=function(a){function b(){if(f["__mti_fntLst"+d]){var c=f["__mti_fntLst"+d](),e=[],h;if(c)for(var l=0;l<c.length;l++){var k=c[l].fontfamily;void 0!=c[l].fontStyle&&void 0!=c[l].fontWeight?(h=c[l].fontStyle+c[l].fontWeight,e.push(new G(k,h))):e.push(new G(k))}a(e)}else setTimeout(function(){b()},50)}var c=this,d=c.a.projectId,e=c.a.version;if(d){var f=c.c.o;A(this.c,(c.a.api||"https://fast.fonts.net/jsapi")+"/"+d+".js"+(e?"?v="+e:""),function(e){e?a([]):(f["__MonotypeConfiguration__"+
d]=function(){return c.a},b())}).id="__MonotypeAPIScript__"+d}else a([])};function sa(a,b){this.c=a;this.a=b}sa.prototype.load=function(a){var b,c,d=this.a.urls||[],e=this.a.families||[],f=this.a.testStrings||{},g=new B;b=0;for(c=d.length;b<c;b++)z(this.c,d[b],C(g));var m=[];b=0;for(c=e.length;b<c;b++)if(d=e[b].split(":"),d[1])for(var h=d[1].split(","),l=0;l<h.length;l+=1)m.push(new G(d[0],h[l]));else m.push(new G(d[0]));E(g,function(){a(m,f)})};function ta(a,b){a?this.c=a:this.c=ua;this.a=[];this.f=[];this.g=b||""}var ua="https://fonts.googleapis.com/css";function va(a,b){for(var c=b.length,d=0;d<c;d++){var e=b[d].split(":");3==e.length&&a.f.push(e.pop());var f="";2==e.length&&""!=e[1]&&(f=":");a.a.push(e.join(f))}}
function wa(a){if(0==a.a.length)throw Error("No fonts to load!");if(-1!=a.c.indexOf("kit="))return a.c;for(var b=a.a.length,c=[],d=0;d<b;d++)c.push(a.a[d].replace(/ /g,"+"));b=a.c+"?family="+c.join("%7C");0<a.f.length&&(b+="&subset="+a.f.join(","));0<a.g.length&&(b+="&text="+encodeURIComponent(a.g));return b};function ya(a){this.f=a;this.a=[];this.c={}}
var za={latin:"BESbswy","latin-ext":"\u00e7\u00f6\u00fc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},Aa={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ba={i:"i",italic:"i",n:"n",normal:"n"},
Ca=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
function Da(a){for(var b=a.f.length,c=0;c<b;c++){var d=a.f[c].split(":"),e=d[0].replace(/\+/g," "),f=["n4"];if(2<=d.length){var g;var m=d[1];g=[];if(m)for(var m=m.split(","),h=m.length,l=0;l<h;l++){var k;k=m[l];if(k.match(/^[\w-]+$/)){var n=Ca.exec(k.toLowerCase());if(null==n)k="";else{k=n[2];k=null==k||""==k?"n":Ba[k];n=n[1];if(null==n||""==n)n="4";else var r=Aa[n],n=r?r:isNaN(n)?"4":n.substr(0,1);k=[k,n].join("")}}else k="";k&&g.push(k)}0<g.length&&(f=g);3==d.length&&(d=d[2],g=[],d=d?d.split(","):
g,0<d.length&&(d=za[d[0]])&&(a.c[e]=d))}a.c[e]||(d=za[e])&&(a.c[e]=d);for(d=0;d<f.length;d+=1)a.a.push(new G(e,f[d]))}};function Ea(a,b){this.c=a;this.a=b}var Fa={Arimo:!0,Cousine:!0,Tinos:!0};Ea.prototype.load=function(a){var b=new B,c=this.c,d=new ta(this.a.api,this.a.text),e=this.a.families;va(d,e);var f=new ya(e);Da(f);z(c,wa(d),C(b));E(b,function(){a(f.a,f.c,Fa)})};function Ga(a,b){this.c=a;this.a=b}Ga.prototype.load=function(a){var b=this.a.id,c=this.c.o;b?A(this.c,(this.a.api||"https://use.typekit.net")+"/"+b+".js",function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var e=[],f=0;f<b.length;f+=2)for(var g=b[f],m=b[f+1],h=0;h<m.length;h++)e.push(new G(g,m[h]));try{c.Typekit.load({events:!1,classes:!1,async:!0})}catch(l){}a(e)}},2E3):a([])};function Ha(a,b){this.c=a;this.f=b;this.a=[]}Ha.prototype.load=function(a){var b=this.f.id,c=this.c.o,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,m=c.fonts.length;g<m;++g){var h=c.fonts[g];d.a.push(new G(h.name,ga("font-weight:"+h.weight+";font-style:"+h.style)))}a(d.a)},A(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+ea(this.c)+"/"+b+".js",function(b){b&&a([])})):a([])};var Y=new oa(window);Y.a.c.custom=function(a,b){return new sa(b,a)};Y.a.c.fontdeck=function(a,b){return new Ha(b,a)};Y.a.c.monotype=function(a,b){return new ra(b,a)};Y.a.c.typekit=function(a,b){return new Ga(b,a)};Y.a.c.google=function(a,b){return new Ea(b,a)};var Z={load:p(Y.load,Y)};"function"===typeof define&&define.amd?define(function(){return Z}):"undefined"!==typeof module&&module.exports?module.exports=Z:(window.WebFont=Z,window.WebFontConfig&&Y.load(window.WebFontConfig));}());
;/*globals jQuery:true*/

(function($) {

  /*
   *  Util Functions
   */

  // Defaults for Embedly.
  var defaults = {
    key:              null,
    endpoint:         'oembed',         // default endpoint is oembed (preview and objectify available too)
    secure:           null,            // use https endpoint vs http
    query:            {},
    method:           'replace',        // embed handling option for standard callback
    addImageStyles:   true,             // add style="" attribute to images for query.maxwidth and query.maxhidth
    wrapElement:      'div',            // standard wrapper around all returned embeds
    className:        'embed',          // class on the wrapper element
    batch:            20,                // Default Batch Size.
    urlRe:            null
  };

  var urlRe = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;

  var none = function(obj){
    return obj === null || obj === undefined;
  };
  // Split a list into a bunch of batchs.
  var batch = function(list, split){
    var batches = [], current = [];
    $.each(list, function(i, obj){
      current.push(obj);
      if (current.length === split){
        batches.push(current);
        current = [];
      }
    });
    if (current.length !== 0){
      batches.push(current);
    }
    return batches;
  };
  // Make an argument a list
  var listify = function(obj){
    if (none(obj)){
      return [];
    } else if (!$.isArray(obj)){
      return [obj];
    }
    return obj;
  };

  // From: http://bit.ly/T9SjVv
  var zip = function(arrays) {
    return $.map(arrays[0], function(_,i){
      return [$.map(arrays, function(array){return array[i];})];
    });
  };

  /* Keeper
   *
   * alittle wrapper around Deferred that lets us keep track of
   * all the callbacks that we have.
   */
  var Keeper = function (len, each, after) {
    this.init(len, each, after);
  };
  Keeper.prototype = {

    init: function(urls){
      this.urls = urls;
      this.count = 0;
      this.results = {};
      this._deferred = $.Deferred();
    },
    // Only 2 methods we really care about.
    notify : function(result) {
      // Store the result.
      this.results[result.original_url] = result;
      // Increase the count.
      this.count++;
      // Notify the success functions
      this._deferred.notify.apply(this._deferred, [result]);
      // If all the callbacks have completed, do your thing.
      if (this.count === this.urls.length){
        // This sorts the results in the manner in which they were added.
        var self = this;
        var results = $.map(this.urls, function(url){ return self.results[url];});
        this._deferred.resolve(results);
      }
      return this;
    },
    state: function() {
      return this._deferred.state.apply(this._deferred, arguments);
    }
  };
  window.Keeper = Keeper;

  // direct API for dealing with the
  var API = function () {};
  API.prototype = {
    /*
      For dealing directly with Embedly's API.

      options: {
        key: 'Your API key'
        secure: false,
        query: {
          maxwidth: 500,
          colors: true,
        }
      }
    */
    defaults: {},

    log: function(level, message){
      if (!none(window.console) && !none(window.console[level])){
        window.console[level].apply(window.console, [message]);
      }
    },
    // Based on the method and options, build the url,
    build: function(method, urls, options){
      // Technically, not great.
      options = none(options) ? {}: options;
      // Base method.

      var secure = options.secure;
      if (none(secure)){
        // If the secure param was not see, use the protocol instead.
        secure = window.location.protocol === 'https:'? true:false;
      }

      var base = (secure ? 'https': 'http') +
        '://api.embed.ly/' + (method === 'objectify' ? '2/' : '1/') + method;

      // Base Query;
      var query = none(options.query) ? {} : options.query;
      query.key = options.key;
      base += '?'+$.param(query);

      // Add the urls the way we like.
      base += '&urls='+ $.map(urls, encodeURIComponent).join(',');

      return base;
    },
    // Batch a bunch of URLS up for processing. Will split longer lists out
    // into many batches and return the callback on each and after on done.
    ajax: function(method, urls, options){

      // Use the defaults.
      options = $.extend({}, defaults, $.embedly.defaults, typeof options === 'object' && options);

      if (none(options.key)){
        this.log('error', 'Embedly jQuery requires an API Key. Please sign up for one at http://embed.ly');
        return null;
      }

      // Everything is dealt with in lists.
      urls = listify(urls);

      // add a keeper that holds everything till we are good to go.
      var keeper = new Keeper(urls);

      var valid_urls = [], rejects = [], valid;
      // Debunk the invalid urls right now.
      $.each(urls, function(i, url){
        valid = false;
        // Make sure it's a URL
        if (urlRe.test(url)){
          valid = true;
          // If the urlRe has been defined make sure it works.
          if (options.urlRe !== null && options.urlRe.test && !options.urlRe.test(url)){
            valid = false;
          }
        }
        // deal with the valid urls
        if(valid === true){
          valid_urls.push(url);
        } else {
          // Notify the keeper that we have a bad url.
          rejects.push({
            url: url,
            original_url: url,
            error: true,
            invalid: true,
            type: 'error',
            error_message: 'Invalid URL "'+ url+'"'
          });
        }
      });

      // Put everything into batches, even if these is only one.
      var batches = batch(valid_urls, options.batch), self = this;

      // Actually make those calls.
      $.each(batches, function(i, batch){
        $.ajax({
          url: self.build(method, batch, options),
          dataType: 'jsonp',
          success: function(data){
            // We zip together the urls and the data so we have the original_url
            $.each(zip([batch, data]), function(i, obj){
              var result = obj[1];
              result.original_url = obj[0];
              result.invalid = false;
              keeper.notify(result);
            });
          }
        });
      });

      if (rejects.length){
        // set a short timeout so we can set up progress and done, otherwise
        // the progress notifier will not get all the events.
        setTimeout(function(){
          $.each(rejects, function(i, reject){
            keeper.notify(reject);
          });
        }, 1);
      }

      return keeper._deferred;
    },

    // Wrappers around ajax.
    oembed: function(urls, options){
      return this.ajax('oembed', urls, options);
    },
    preview: function(urls, options){
      return this.ajax('preview', urls, options);
    },
    objectify: function(urls, options){
      return this.ajax('objectify', urls, options);
    },
    extract: function(urls, options){
      return this.ajax('extract', urls, options);
    }
  };

  // direct API dealing directly with Embedly's Display API.
  var ImageAPI = function () {};
  ImageAPI.prototype = {

    // Based on the method and options, build the image url,
    build: function(method, url, options){
      options  = $.extend({}, $.embedly.defaults, typeof options === 'object' && options);

      var secure = options.secure;
      if (none(secure)){
        // If the secure param was not seen, use the protocol instead.
        secure = window.location.protocol === 'https:'? true:false;
      }

      var base = (secure ? 'https': 'http') +
        '://i.embed.ly/' + (method === 'display' ? '1/' : '1/display/') + method;

      // Base Query
      var query = none(options.query) ? {} : options.query;
      query.key = options.key;
      base += '?'+$.param(query);

      // Add the image url
      base += '&url='+ encodeURIComponent(url);

      return base;
    },
    // Wrappers around build image url function.
    display: function(url, options){
      return this.build('display', url, options);
    },
    resize: function(url, options){
      return this.build('resize', url, options);
    },
    fill: function(url, options){
      return this.build('fill', url, options);
    },
    crop: function(url, options){
      return this.build('crop', url, options);
    }
  };

  var Embedly = function (element, url, options) {
    this.init(element, url, options);
  };

  Embedly.prototype = {
    init: function(elem, original_url, options){
      this.elem = elem;
      this.$elem = $(elem);
      this.original_url = original_url;
      this.options = options;
      this.loaded = $.Deferred();

      // Sets up some triggers.
      var self = this;
      this.loaded.done(function(){
        self.$elem.trigger('loaded', [self]);
      });

      // So you can listen when the tag has been initialized;
      this.$elem.trigger('initialized', [this]);
    },
    progress: function(obj){
      $.extend(this, obj);

      // if there is a custom display method, use it.
      if (this.options.display){
        this.options.display.apply(this.elem, [this, this.elem]);
      }
      // We only have a simple case for oEmbed. Everything else should be a custom
      // success method.
      else if(this.options.endpoint === 'oembed'){
        this.display();
      }

      // Notifies all listeners that the data has been loaded.
      this.loaded.resolve(this);
    },
    imageStyle: function(){
      var style = [], units;
      if (this.options.addImageStyles) {
        if (this.options.query.maxwidth) {
          units = isNaN(parseInt(this.options.query.maxwidth, 10)) ? '' : 'px';
            style.push("max-width: " + (this.options.query.maxwidth)+units);
        }
        if (this.options.query.maxheight) {
          units = isNaN(parseInt(this.options.query.maxheight,10)) ? '' : 'px';
            style.push("max-height: " + (this.options.query.maxheight)+units);
          }
       }
       return style.join(';');
    },

    display: function(){
      // Ignore errors
      if (this.type === 'error'){
        return false;
      }

      // Image Style.
      this.style = this.imageStyle();

      var html;
      if (this.type === 'photo'){
        html = "<a href='" + this.original_url + "' target='_blank'>";
        html += "<img style='" + this.style + "' src='" + this.url + "' alt='" + this.title + "' /></a>";
      } else if (this.type === 'video' || this.type === 'rich'){
        html = this.html;
      } else {
        this.title = this.title || this.url;
        html = this.thumbnail_url ? "<img src='" + this.thumbnail_url + "' class='thumb' style='" + this.style + "'/>" : "";
        html += "<a href='" + this.original_url + "'>" + this.title + "</a>";
        html += this.provider_name ? "<a href='" + this.provider_url + "' class='provider'>" + this.provider_name + "</a>" : "";
        html += this.description ? '<div class="description">' + this.description + '</div>' : '';
      }

      if (this.options.wrapElement) {
        html = '<' + this.options.wrapElement+ ' class="' + this.options.className + '">' + html + '</' + this.options.wrapElement + '>';
      }

      this.code = html;
      // Yay.
      if (this.options.method === 'replace'){
        this.$elem.replaceWith(this.code);
      } else if (this.options.method === 'after'){
        this.$elem.after(this.code);
      } else if (this.options.method === 'afterParent'){
        this.$elem.parent().after(this.code);
      } else if (this.options.method === 'replaceParent'){
        this.$elem.parent().replaceWith(this.code);
      }
      // for DOM elements we add the oembed object as a data field to that element and trigger a custom event called oembed
      // with the custom event, developers can do any number of custom interactions with the data that is returned.
      this.$elem.trigger('displayed', [this]);
    }
  };

  // Sets up a generic API for use.
  $.embedly = new API();

  // Add display to it.
  $.embedly.display = new ImageAPI();

  $.fn.embedly = function ( options ) {
    if (options === undefined || typeof options === 'object') {

      // Use the defaults
      options = $.extend({}, defaults, $.embedly.defaults, typeof options === 'object' && options);

      // Kill these early.
      if (none(options.key)){
        $.embedly.log('error', 'Embedly jQuery requires an API Key. Please sign up for one at http://embed.ly');
        return this.each($.noop);
      }
      // Keep track of the nodes we are working on so we can add them to the
      // progress events.
      var nodes = {};

      // Create the node.
      var create = function (elem){
        if (!$.data($(elem), 'embedly')) {
          var url = $(elem).attr('href');

          var node = new Embedly(elem, url, options);
          $.data(elem, 'embedly', node);

          if (nodes.hasOwnProperty(url)){
            nodes[url].push(node);
          } else {
            nodes[url] = [node];
          }
        }
      };

      // Find everything with a URL on it.
      var elems = this.each(function () {
        if ( !none($(this).attr('href')) ){
          create(this);
        } else {
          $(this).find('a').each(function(){
            if ( ! none($(this).attr('href')) ){
              create(this);
            }
          });
        }
      });

      // set up the api call.
      var deferred = $.embedly.ajax(options.endpoint,
        $.map(nodes, function(value, key) {return key;}),
        options)
        .progress(function(obj){
          $.each(nodes[obj.original_url], function(i, node){
            node.progress(obj);
          });
        });

      if (options.progress){
        deferred.progress(options.progress);
      }
      if (options.done){
        deferred.done(options.done);
      }
      return elems;
    }
  };

  // Custom selector.
  $.expr[':'].embedly = function(elem) {
    return ! none($(elem).data('embedly'));
  };

  // Use with selector to find img tags with data-src attribute
  // e.g. <img data-src="http://embed.ly/static/images/logo.png"></img>
  $.fn.display = function (endpoint, options) {

    // default to display
    if (none(endpoint)) {
      endpoint = 'display';
    }

    if (options === undefined || typeof options === 'object') {

      // Use the defaults
      options = $.extend({}, defaults, $.embedly.defaults, typeof options === 'object' && options);

      // Key Check.
      if (none(options.key)){
        $.embedly.log('error', 'Embedly jQuery requires an API Key. Please sign up for one at http://embed.ly/display');
        return this.each($.noop);
      }

      // Create the node for all elements
      var create = function (elem){
        var $elem = $(elem);
        if (!$elem.data('display')) {
          var url = $elem.data('src') || $elem.attr('href');

          var data = {
            original_url : url,
            url : $.embedly.display.build(endpoint, url, options)
          };

          $elem.data('display', data);
          $elem.trigger('initialized', [elem]);

          var html = "<img src='" + data.url + "' />";
          if ($elem.is('a')){
            $elem.append(html);
          }else {
            $elem.replaceWith(html);
          }
        }
      };
      var doCreate = function(elem){
        if (none($(elem).data('src')) && none($(elem).attr('href'))){
          return false;
        }
        return true;
      };

      // Find every image or a tag with a data-src attribute
      var elems = this.each(function () {
        if ( doCreate(this) ){
          create(this);
        } else {
          $(this).find('img,a').each(function(){
            if ( doCreate(this) ){
              create(this);
            }
          });
        }
      });

      return elems;
    }
  };

  // Custom selector.
  $.expr[':'].display = function(elem) {
    return ! none($(elem).data('display'));
  };

}(jQuery, window));
;; window.fabrik = window.fabrik || {};

(function (fabrik, $) {

  fabrik.EmbedService = EmbedService;

  function EmbedService() {
    this.providers = [];
    this.addProvider = addProvider;
    this.getEmbed = getEmbed;
    this.processLinks = processLinks;

    function addProvider(provider, index) {
      if (index !== undefined) {
        this.providers.splice(index, 0, provider);
      } else {
        this.providers.push(provider);
      }
    }

    function getEmbed(url, options) {
      var i = 0, j = this.providers.length;
      for (i; i < j; i++) {
        var provider = this.providers[i];
        if (provider.canProcess(url)) {
          console.log('Processing embed with ' + provider.name, url);
          return provider.getEmbed(url, options);
        }
      }
    }

    function processLinks(links, options) {

      if (!links || !links.length) {
        return $.Deferred().reject().promise();
      }

      var p = 0,
          pl = this.providers.length,
          e = 0,
          el = links.length,
          batches = {};

      // loop through each link
      for (e; e < el; e++) {
        var link = links[e];

        // find the matching provider
        for (p = 0; p < pl; p++) {
          var provider = this.providers[p];

          if (provider.canProcess(link.href)) {

            // batch the links by provider, group by url
            var batch = batches[provider.name] || (batches[provider.name] = { provider: provider, links: {} });

            // Track the links by url
            var embedLink = new EmbedLink(link);

            console.log('Processing embed with ' + provider.name, embedLink.url);

            if (batch.links.hasOwnProperty(embedLink.url)) {
              batch.links[embedLink.url].push(embedLink);
            } else {
              batch.links[embedLink.url] = [embedLink];
            }

            break;
          }
        }
      }

      // Process the batches
      console.log('Batches', batches);

      var deferred = $.Deferred();

      var tasks = [];
      for (provider in batches) {

        // wrap in a closure otherwise batch gets overridden
        (function (batch) {
          var task = batch.provider.getEmbedData(Object.keys(batch.links), options).progress(function (data) {
            console.log('Received embed data for ' + data.original_url);
            batch.links[data.original_url].forEach(function (link) {
              // pass the link to the progress callback
              deferred.notify(data, link.element); // or node.progress;
            });

          });

          tasks.push(task);

        })(batches[provider]);
        
      }

      $.when.apply($, tasks).done(function (data) {
        deferred.resolve(data);
      });

      return deferred.promise();
    }

    function EmbedLink(element) {
      this.element = element;
      this.url = element.href;
      // TODO handle options
    }
  }
})(window.fabrik, jQuery);;; window.fabrik = window.fabrik || {};

(function (fabrik, $) {

  fabrik.EmbedlyProvider = EmbedlyProvider;

  function EmbedlyProvider(key) {

    this.key = key;

    var clearCache = false,
        native = true;

    $.embedly.defaults.key = key;

    return {
      name: 'Embedly',
      canProcess: canProcess,
      getEmbed: getEmbed,
      getEmbedData: getEmbedData
    };

    function canProcess(url) {
      return true;
    }

    function getEmbed(url, options) {
      options = options || {};

      options.native = native;

      if (clearCache) {
        options.force = true;
      }

      var embedData = { query: options };

      return $.embedly.oembed([url], embedData).pipe(function (data) {
        return data[0]; // Embedly always returns an array
      });
    }

    function getEmbedData(urls, options) {
      options = options || {};

      options.native = native;

      if (clearCache) {
        options.force = true;
      }

      var embedData = { query: options };

      return $.embedly.oembed(urls, embedData);
    }
  }


})(window.fabrik, jQuery);;;window.fabrik = window.fabrik || {};

(function (fabrik, $) {

  fabrik.VimeoProvider = VimeoProvider;

  function VimeoProvider(key) {

    var VIMEO_ENDPOINT = 'https://vimeo.com/api/oembed.json?url=',
        VIMEO_REGEX = /https?:\/\/(www.)?vimeo.com\//i;

    this.key = key;

		return {
      name: 'Vimeo',
		  canProcess: canProcess,
		  getEmbed: getEmbed,
		  getEmbedData: getEmbedData
		};

		function canProcess(url) {
		  return url && url.match(VIMEO_REGEX);
		}

		function getEmbed(url, options) {

      return $.getJSON(VIMEO_ENDPOINT + encodeURIComponent(url), options, function (embed) {
		    return embed;
		  });
		}

		function getEmbedData(urls, options) {

		  var deferred = $.Deferred(),
          ui = 0,
          ul = urls.length,
          tasks = [];

		  for (ui; ui < ul; ui++) {

		    var url = urls[ui],
            options = $.extend({}, options);

        tasks.push($.getJSON(VIMEO_ENDPOINT + encodeURIComponent(url), options));
		  }

		  $.when.apply($, tasks).done(function () {

		    for (var i = 0; i < ul; i++) {
		      tasks[i].responseJSON.original_url = urls[i];
		      deferred.notify(tasks[i].responseJSON);
		    }

		    deferred.resolve();
		  });

		  return deferred.promise();
		}

	}


})(window.fabrik, jQuery);
;; window.fabrik = window.fabrik || {};

(function (fabrik, $) {

    fabrik.SlateProvider = SlateProvider;

    function SlateProvider(endpoint) {

        var SLATE_REGEX = /^https?:\/\/[\w\.\-]+slateapp.com\/[\w\/\-]*$/;

        var self = this;
        self.endpoint = endpoint; // e.g. http://bare2.slateapp.com/api/v1/oembed

        return {
            name: 'Slate',
            canProcess: canProcess,
            getEmbed: getEmbed,
            getEmbedData: getEmbedData
        };

        function canProcess(url) {
            return url && url.match(SLATE_REGEX);
        }

        function getEmbed(url, options) {
            options = options || {};
            options.url = url;

            return $.getJSON(self.endpoint, options);
        }

        function getEmbedData(urls, options) {

            //options = options || {};

            var deferred = $.Deferred();

            var ui = 0,
            ul = urls.length;

            var tasks = [];

            for (ui; ui < ul; ui++) {
                var url = urls[ui];

                var options = { url: url }; // TODO need to clone the options above - don't set URL as shared by all providers

                tasks.push($.getJSON(self.endpoint, options).done(function (data) {
                    data.response.original_url = url; // used as a key lookup
                    deferred.notify(data.response);
                }));
            }

            $.when.apply($, tasks).done(function () {
                deferred.resolve();
            });

            return deferred.promise();
        }
    }


})(window.fabrik, jQuery);;; window.fabrik = window.fabrik || {};

(function (fabrik, $) {

  fabrik.WiredriveProvider = WiredriveProvider;

  function WiredriveProvider() {

    var WIREDRIVE_REGEX = /^https?:\/\/(?:\w+.)?wdrv.it\/([\w]+)$/;

    var self = this;

    return {
      name: 'Wiredrive',
      canProcess: canProcess,
      getEmbed: getEmbed,
      getEmbedData: getEmbedData
    };

    function canProcess(url) {
      return url && url.match(WIREDRIVE_REGEX);
    }

    function getEmbed(url, options) {
      return createRequest(url, options);
    }

    function getEmbedData(urls, options) {

      var deferred = $.Deferred(),
          ui = 0,
          ul = urls.length,
          tasks = [];

      for (ui; ui < ul; ui++) {

        var url = urls[ui],
            options = $.extend({}, options);

        tasks.push(createRequest(url, options));
      }

      $.when.apply($, tasks).done(function () {

        for (var i = 0; i < ul; i++) {
          tasks[i].responseJSON.original_url = urls[i];
          deferred.notify(tasks[i].responseJSON);
        }

        deferred.resolve();
      });

      return deferred.promise();
    }

    function createRequest(url, options) {
      
      var tokens = WIREDRIVE_REGEX.exec(url),
          token = tokens[1],
          videoUrl = 'https://wdrv.it/' + token,
          endpoint = 'https://wdrv.it/oembed/json/';

      options = options || {};
      options.url = videoUrl;

      return $.getJSON(endpoint, options);
    }
  }


})(window.fabrik, jQuery);;/// <reference path="_references.js" />

; window.fabrik = window.fabrik || {};

(function (fabrik, $) {

  var embedService = new fabrik.EmbedService();
  embedService.addProvider(new fabrik.EmbedlyProvider('dd72fc66b7df11e089614040d3dc5c07'));
  //embedService.addProvider(new fabrik.VimeoProvider());
  //embedService.addProvider(new fabrik.WiredriveProvider());
  //embedService.addProvider(new fabrik.SlateProvider('http://bare2.slateapp.com/api/v1/oembed'));

  // Extend Fabrik
  fabrik.embedService = embedService;
  fabrik.embedLinks = embedLinks;
  fabrik.init = init;
  fabrik.loadWebFonts = loadWebFonts;

  function init() {
    processEmbedLinks();
    loadChildActions();
    trackSocialSharing();
    wrapGifs();

    if (fabrik.theme && fabrik.theme.init) {
      fabrik.theme.init();
    }
  }

  // Use this helper only if you don't want to do anything with the links,
  // otherwise just use embedService.processLinks directly
  function embedLinks(links, options) {

    var deferred = embedService.processLinks(links, options)
      .progress(function (data, elem) {
        if (data && data.invalid !== true && data.type !== 'error') {
          var html = '<div class="embed">' + data.html + '</div>';
          $(elem).replaceWith(html); // TODO don't forget to wrap in embed div
        }
      });

    return deferred;
  }

  function processEmbedLinks() {

    $("a[data-embed]").each(function () {

      var $link = $(this),
          options = {};

      var width = $link.data("embed-width");
      if (width) {
        options.width = width;
        options.maxwidth = width;
      }

      var height = $link.data("embed-height");
      if (height) {
        options.height = height;
        options.maxheight = height;
      }

      if ($link.data("embed-autoplay")) {
        options.autoplay = "true";
      }

      return embedService.getEmbed(this.href, options).done(function (embed) {
        var html = '<div class="embed">' + embed.html + '</div>';
        $link.replaceWith(html);
      });
    });
  }

  function loadChildActions() {
    $("[data-ajax-action]").each(function () {
      $(this).load($(this).data("ajax-action"), function () {
        $(this).removeAttr("data-ajax-action");
      });
    });
  };

  function trackSocialSharing() {
    var track = function (link, network, action) {
      _ga('fabrik.send', 'social', network, action, $(link).data('social-target') || window.location.href);
    }

    $('.social-facebook-like').on('click', function () {
      track(this, 'facebook', 'like');
    });
    $('.social-twitter-tweet').on('click', function () {
      track(this, 'twitter', 'tweet');
    });
    $('.social-google-plus').on('click', function () {
      track(this, 'google', 'plus');
    });
  }

  function wrapGifs() {
    var gifsToWrap = document.getElementsByClassName('img-gif');

    for (var index = 0; index < gifsToWrap.length; index++) {

      var image = gifsToWrap[index];

      if (image.parentNode.classList.contains('placeholder')) {
        var wrapper = document.createElement("div");
        wrapper.className = "gif-wrap";
        wrapper.style.backgroundImage = 'url(' + image.src + ')';
        image.parentNode.insertBefore(wrapper, image);
        wrapper.appendChild(image);
      }
    }
  }

  function loadWebFonts(fonts) {

    if (!fonts || !fonts.length) {
      return;
    }

    var config = {
      classes: true
    };

    fonts.forEach(function (font) {
      if (font.provider === 'google') {
        config.google = {
          families: font.fonts
        };
      }

      if (font.provider === 'typekit') {
        config.typekit = {
          id: font.fonts[0] // will only ever load one kit at a time
        }
      }
    });

    WebFont.load(config);
  };

})(window.fabrik, jQuery);


// Avoid `console` errors in browsers that lack a console.
(function () {
  var method;
  var noop = function noop() { };
  var methods = [
      'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
      'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
      'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
      'timeStamp', 'trace', 'warn'
  ];
  var length = methods.length;
  var console = (window.console = window.console || {});

  while (length--) {
    method = methods[length];

    // Only stub undefined methods.
    if (!console[method]) {
      console[method] = noop;
    }
  }
}());;