text: // Cart.js
  // version: 0.3.9
  // author: Gavin Ballard
  // license: MIT
  !function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.returnExports=b()}(this,function(){var a,b=Array.prototype,c=Object.prototype,d=Function.prototype,e=String.prototype,f=Number.prototype,g=b.slice,h=b.splice,i=b.push,j=b.unshift,k=b.concat,l=d.call,m=c.toString,n=Array.isArray||function(a){return"[object Array]"===m.call(a)},o="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,p=Function.prototype.toString,q=function(a){try{return p.call(a),!0}catch(b){return!1}},r="[object Function]",s="[object GeneratorFunction]";a=function(a){if("function"!=typeof a)return!1;if(o)return q(a);var b=m.call(a);return b===r||b===s};var t,u=RegExp.prototype.exec,v=function(a){try{return u.call(a),!0}catch(b){return!1}},w="[object RegExp]";t=function(a){return"object"!=typeof a?!1:o?v(a):m.call(a)===w};var x,y=String.prototype.valueOf,z=function(a){try{return y.call(a),!0}catch(b){return!1}},A="[object String]";x=function(a){return"string"==typeof a?!0:"object"!=typeof a?!1:o?z(a):m.call(a)===A};var B=function(b){var c=m.call(b),d="[object Arguments]"===c;return d||(d=!n(b)&&null!==b&&"object"==typeof b&&"number"==typeof b.length&&b.length>=0&&a(b.callee)),d},C=function(a){var b,c=Object.defineProperty&&function(){try{var a={};Object.defineProperty(a,"x",{enumerable:!1,value:a});for(var b in a)return!1;return a.x===a}catch(c){return!1}}();return b=c?function(a,b,c,d){!d&&b in a||Object.defineProperty(a,b,{configurable:!0,enumerable:!1,writable:!0,value:c})}:function(a,b,c,d){!d&&b in a||(a[b]=c)},function(c,d,e){for(var f in d)a.call(d,f)&&b(c,f,d[f],e)}}(c.hasOwnProperty),D=function(a){var b=typeof a;return null===a||"object"!==b&&"function"!==b},E={ToInteger:function(a){var b=+a;return b!==b?b=0:0!==b&&b!==1/0&&b!==-(1/0)&&(b=(b>0||-1)*Math.floor(Math.abs(b))),b},ToPrimitive:function(b){var c,d,e;if(D(b))return b;if(d=b.valueOf,a(d)&&(c=d.call(b),D(c)))return c;if(e=b.toString,a(e)&&(c=e.call(b),D(c)))return c;throw new TypeError},ToObject:function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)},ToUint32:function(a){return a>>>0}},F=function(){};C(d,{bind:function(b){var c=this;if(!a(c))throw new TypeError("Function.prototype.bind called on incompatible "+c);for(var d,e=g.call(arguments,1),f=function(){if(this instanceof d){var a=c.apply(this,k.call(e,g.call(arguments)));return Object(a)===a?a:this}return c.apply(b,k.call(e,g.call(arguments)))},h=Math.max(0,c.length-e.length),i=[],j=0;h>j;j++)i.push("$"+j);return d=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this, arguments); }")(f),c.prototype&&(F.prototype=c.prototype,d.prototype=new F,F.prototype=null),d}});var G=l.bind(c.hasOwnProperty),H=function(){var a=[1,2],b=a.splice();return 2===a.length&&n(b)&&0===b.length}();C(b,{splice:function(){return 0===arguments.length?[]:h.apply(this,arguments)}},!H);var I=function(){var a={};return b.splice.call(a,0,0,1),1===a.length}();C(b,{splice:function(a,b){if(0===arguments.length)return[];var c=arguments;return this.length=Math.max(E.ToInteger(this.length),0),arguments.length>0&&"number"!=typeof b&&(c=g.call(arguments),c.length<2?c.push(this.length-a):c[1]=E.ToInteger(b)),h.apply(this,c)}},!I);var J=1!==[].unshift(0);C(b,{unshift:function(){return j.apply(this,arguments),this.length}},J),C(Array,{isArray:n});var K=Object("a"),L="a"!==K[0]||!(0 in K),M=function(a){var b=!0,c=!0;return a&&(a.call("foo",function(a,c,d){"object"!=typeof d&&(b=!1)}),a.call([1],function(){"use strict";c="string"==typeof this},"x")),!!a&&b&&c};C(b,{forEach:function(b){var c,d=E.ToObject(this),e=L&&x(this)?this.split(""):d,f=-1,g=e.length>>>0;if(arguments.length>1&&(c=arguments[1]),!a(b))throw new TypeError("Array.prototype.forEach callback must be a function");for(;++f<g;)f in e&&("undefined"!=typeof c?b.call(c,e[f],f,d):b(e[f],f,d))}},!M(b.forEach)),C(b,{map:function(b){var c,d=E.ToObject(this),e=L&&x(this)?this.split(""):d,f=e.length>>>0,g=Array(f);if(arguments.length>1&&(c=arguments[1]),!a(b))throw new TypeError("Array.prototype.map callback must be a function");for(var h=0;f>h;h++)h in e&&(g[h]="undefined"!=typeof c?b.call(c,e[h],h,d):b(e[h],h,d));return g}},!M(b.map)),C(b,{filter:function(b){var c,d,e=E.ToObject(this),f=L&&x(this)?this.split(""):e,g=f.length>>>0,h=[];if(arguments.length>1&&(d=arguments[1]),!a(b))throw new TypeError("Array.prototype.filter callback must be a function");for(var i=0;g>i;i++)i in f&&(c=f[i],("undefined"==typeof d?b(c,i,e):b.call(d,c,i,e))&&h.push(c));return h}},!M(b.filter)),C(b,{every:function(b){var c,d=E.ToObject(this),e=L&&x(this)?this.split(""):d,f=e.length>>>0;if(arguments.length>1&&(c=arguments[1]),!a(b))throw new TypeError("Array.prototype.every callback must be a function");for(var g=0;f>g;g++)if(g in e&&!("undefined"==typeof c?b(e[g],g,d):b.call(c,e[g],g,d)))return!1;return!0}},!M(b.every)),C(b,{some:function(b){var c,d=E.ToObject(this),e=L&&x(this)?this.split(""):d,f=e.length>>>0;if(arguments.length>1&&(c=arguments[1]),!a(b))throw new TypeError("Array.prototype.some callback must be a function");for(var g=0;f>g;g++)if(g in e&&("undefined"==typeof c?b(e[g],g,d):b.call(c,e[g],g,d)))return!0;return!1}},!M(b.some));var N=!1;b.reduce&&(N="object"==typeof b.reduce.call("es5",function(a,b,c,d){return d})),C(b,{reduce:function(b){var c=E.ToObject(this),d=L&&x(this)?this.split(""):c,e=d.length>>>0;if(!a(b))throw new TypeError("Array.prototype.reduce callback must be a function");if(0===e&&1===arguments.length)throw new TypeError("reduce of empty array with no initial value");var f,g=0;if(arguments.length>=2)f=arguments[1];else for(;;){if(g in d){f=d[g++];break}if(++g>=e)throw new TypeError("reduce of empty array with no initial value")}for(;e>g;g++)g in d&&(f=b(f,d[g],g,c));return f}},!N);var O=!1;b.reduceRight&&(O="object"==typeof b.reduceRight.call("es5",function(a,b,c,d){return d})),C(b,{reduceRight:function(b){var c=E.ToObject(this),d=L&&x(this)?this.split(""):c,e=d.length>>>0;if(!a(b))throw new TypeError("Array.prototype.reduceRight callback must be a function");if(0===e&&1===arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var f,g=e-1;if(arguments.length>=2)f=arguments[1];else for(;;){if(g in d){f=d[g--];break}if(--g<0)throw new TypeError("reduceRight of empty array with no initial value")}if(0>g)return f;do g in d&&(f=b(f,d[g],g,c));while(g--);return f}},!O);var P=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);C(b,{indexOf:function(a){var b=L&&x(this)?this.split(""):E.ToObject(this),c=b.length>>>0;if(0===c)return-1;var d=0;for(arguments.length>1&&(d=E.ToInteger(arguments[1])),d=d>=0?d:Math.max(0,c+d);c>d;d++)if(d in b&&b[d]===a)return d;return-1}},P);var Q=Array.prototype.lastIndexOf&&-1!==[0,1].lastIndexOf(0,-3);C(b,{lastIndexOf:function(a){var b=L&&x(this)?this.split(""):E.ToObject(this),c=b.length>>>0;if(0===c)return-1;var d=c-1;for(arguments.length>1&&(d=Math.min(d,E.ToInteger(arguments[1]))),d=d>=0?d:c-Math.abs(d);d>=0;d--)if(d in b&&a===b[d])return d;return-1}},Q);var R=!{toString:null}.propertyIsEnumerable("toString"),S=function(){}.propertyIsEnumerable("prototype"),T=!G("x","0"),U=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],V=U.length;C(Object,{keys:function(b){var c=a(b),d=B(b),e=null!==b&&"object"==typeof b,f=e&&x(b);if(!e&&!c&&!d)throw new TypeError("Object.keys called on a non-object");var g=[],h=S&&c;if(f&&T||d)for(var i=0;i<b.length;++i)g.push(String(i));if(!d)for(var j in b)h&&"prototype"===j||!G(b,j)||g.push(String(j));if(R)for(var k=b.constructor,l=k&&k.prototype===b,m=0;V>m;m++){var n=U[m];l&&"constructor"===n||!G(b,n)||g.push(n)}return g}});var W=Object.keys&&function(){return 2===Object.keys(arguments).length}(1,2),X=Object.keys;C(Object,{keys:function(a){return X(B(a)?b.slice.call(a):a)}},!W);var Y=-621987552e5,Z="-000001",$=Date.prototype.toISOString&&-1===new Date(Y).toISOString().indexOf(Z);C(Date.prototype,{toISOString:function(){var a,b,c,d,e;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(d=this.getUTCFullYear(),e=this.getUTCMonth(),d+=Math.floor(e/12),e=(e%12+12)%12,a=[e+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],d=(0>d?"-":d>9999?"+":"")+("00000"+Math.abs(d)).slice(d>=0&&9999>=d?-4:-6),b=a.length;b--;)c=a[b],10>c&&(a[b]="0"+c);return d+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},$);var _=function(){try{return Date.prototype.toJSON&&null===new Date(0/0).toJSON()&&-1!==new Date(Y).toJSON().indexOf(Z)&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(a){return!1}}();_||(Date.prototype.toJSON=function(){var b=Object(this),c=E.ToPrimitive(b);if("number"==typeof c&&!isFinite(c))return null;var d=b.toISOString;if(!a(d))throw new TypeError("toISOString property is not callable");return d.call(b)});var aa=1e15===Date.parse("+033658-09-27T01:46:40.000Z"),ba=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"))||!isNaN(Date.parse("2012-12-31T23:59:60.000Z")),ca=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));(!Date.parse||ca||ba||!aa)&&(Date=function(a){var b=function(c,d,e,f,g,h,i){var j,k=arguments.length;return j=this instanceof a?1===k&&String(c)===c?new a(b.parse(c)):k>=7?new a(c,d,e,f,g,h,i):k>=6?new a(c,d,e,f,g,h):k>=5?new a(c,d,e,f,g):k>=4?new a(c,d,e,f):k>=3?new a(c,d,e):k>=2?new a(c,d):k>=1?new a(c):new a:a.apply(this,arguments),C(j,{constructor:b},!0),j},c=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),d=[0,31,59,90,120,151,181,212,243,273,304,334,365],e=function(a,b){var c=b>1?1:0;return d[b]+Math.floor((a-1969+c)/4)-Math.floor((a-1901+c)/100)+Math.floor((a-1601+c)/400)+365*(a-1970)},f=function(b){return Number(new a(1970,0,1,0,0,0,b))};for(var g in a)G(a,g)&&(b[g]=a[g]);C(b,{now:a.now,UTC:a.UTC},!0),b.prototype=a.prototype,C(b.prototype,{constructor:b},!0);var h=function(b){var d=c.exec(b);if(d){var g,h=Number(d[1]),i=Number(d[2]||1)-1,j=Number(d[3]||1)-1,k=Number(d[4]||0),l=Number(d[5]||0),m=Number(d[6]||0),n=Math.floor(1e3*Number(d[7]||0)),o=Boolean(d[4]&&!d[8]),p="-"===d[9]?1:-1,q=Number(d[10]||0),r=Number(d[11]||0);return(l>0||m>0||n>0?24:25)>k&&60>l&&60>m&&1e3>n&&i>-1&&12>i&&24>q&&60>r&&j>-1&&j<e(h,i+1)-e(h,i)&&(g=60*(24*(e(h,i)+j)+k+q*p),g=1e3*(60*(g+l+r*p)+m)+n,o&&(g=f(g)),g>=-864e13&&864e13>=g)?g:0/0}return a.parse.apply(this,arguments)};return C(b,{parse:h}),b}(Date)),Date.now||(Date.now=function(){return(new Date).getTime()});var da=f.toFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0)),ea={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(a,b){for(var c=-1,d=b;++c<ea.size;)d+=a*ea.data[c],ea.data[c]=d%ea.base,d=Math.floor(d/ea.base)},divide:function(a){for(var b=ea.size,c=0;--b>=0;)c+=ea.data[b],ea.data[b]=Math.floor(c/a),c=c%a*ea.base},numToString:function(){for(var a=ea.size,b="";--a>=0;)if(""!==b||0===a||0!==ea.data[a]){var c=String(ea.data[a]);""===b?b=c:b+="0000000".slice(0,7-c.length)+c}return b},pow:function qa(a,b,c){return 0===b?c:b%2===1?qa(a,b-1,c*a):qa(a*a,b/2,c)},log:function(a){for(var b=0,c=a;c>=4096;)b+=12,c/=4096;for(;c>=2;)b+=1,c/=2;return b}};C(f,{toFixed:function(a){var b,c,d,e,f,g,h,i;if(b=Number(a),b=b!==b?0:Math.floor(b),0>b||b>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(c=Number(this),c!==c)return"NaN";if(-1e21>=c||c>=1e21)return String(c);if(d="",0>c&&(d="-",c=-c),e="0",c>1e-21)if(f=ea.log(c*ea.pow(2,69,1))-69,g=0>f?c*ea.pow(2,-f,1):c/ea.pow(2,f,1),g*=4503599627370496,f=52-f,f>0){for(ea.multiply(0,g),h=b;h>=7;)ea.multiply(1e7,0),h-=7;for(ea.multiply(ea.pow(10,h,1),0),h=f-1;h>=23;)ea.divide(1<<23),h-=23;ea.divide(1<<h),ea.multiply(1,1),ea.divide(2),e=ea.numToString()}else ea.multiply(0,g),ea.multiply(1<<-f,0),e=ea.numToString()+"0.00000000000000000000".slice(2,2+b);return b>0?(i=e.length,e=b>=i?d+"0.0000000000000000000".slice(0,b-i+2)+e:d+e.slice(0,i-b)+"."+e.slice(i-b)):e=d+e,e}},da);var fa=e.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var a="undefined"==typeof/()??/.exec("")[1];e.split=function(b,c){var d=this;if("undefined"==typeof b&&0===c)return[];if(!t(b))return fa.call(this,b,c);var e,f,g,h,j=[],k=(b.ignoreCase?"i":"")+(b.multiline?"m":"")+(b.extended?"x":"")+(b.sticky?"y":""),l=0,m=new RegExp(b.source,k+"g");d+="",a||(e=new RegExp("^"+m.source+"$(?!\\s)",k));var n="undefined"==typeof c?-1>>>0:E.ToUint32(c);for(f=m.exec(d);f&&(g=f.index+f[0].length,!(g>l&&(j.push(d.slice(l,f.index)),!a&&f.length>1&&f[0].replace(e,function(){for(var a=1;a<arguments.length-2;a++)"undefined"==typeof arguments[a]&&(f[a]=void 0)}),f.length>1&&f.index<d.length&&i.apply(j,f.slice(1)),h=f[0].length,l=g,j.length>=n)));)m.lastIndex===f.index&&m.lastIndex++,f=m.exec(d);return l===d.length?(h||!m.test(""))&&j.push(""):j.push(d.slice(l)),j.length>n?j.slice(0,n):j}}():"0".split(void 0,0).length&&(e.split=function(a,b){return"undefined"==typeof a&&0===b?[]:fa.call(this,a,b)});var ga=e.replace,ha=function(){var a=[];return"x".replace(/x(.)?/g,function(b,c){a.push(c)}),1===a.length&&"undefined"==typeof a[0]}();ha||(e.replace=function(b,c){var d=a(c),e=t(b)&&/\)[*?]/.test(b.source);if(d&&e){var f=function(a){var d=arguments.length,e=b.lastIndex;b.lastIndex=0;var f=b.exec(a)||[];return b.lastIndex=e,f.push(arguments[d-2],arguments[d-1]),c.apply(this,f)};return ga.call(this,b,f)}return ga.call(this,b,c)});var ia=e.substr,ja="".substr&&"b"!=="0b".substr(-1);C(e,{substr:function(a,b){var c=a;return 0>a&&(c=Math.max(this.length+a,0)),ia.call(this,c,b)}},ja);var ka="	\n\f\r   ᠎             　\u2028\u2029\ufeff",la="​",ma="["+ka+"]",na=new RegExp("^"+ma+ma+"*"),oa=new RegExp(ma+ma+"*$"),pa=e.trim&&(ka.trim()||!la.trim());C(e,{trim:function(){if("undefined"==typeof this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(na,"").replace(oa,"")}},pa),(8!==parseInt(ka+"08")||22!==parseInt(ka+"0x16"))&&(parseInt=function(a){var b=/^0[xX]/;return function(c,d){var e=String(c).trim(),f=Number(d)||(b.test(e)?16:10);return a(e,f)}}(parseInt))}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.returnExports=b()}(this,function(){var a,b,c,d,e=Function.prototype.call,f=Object.prototype,g=e.bind(f.hasOwnProperty),h=g(f,"__defineGetter__");h&&(a=e.bind(f.__defineGetter__),b=e.bind(f.__defineSetter__),c=e.bind(f.__lookupGetter__),d=e.bind(f.__lookupSetter__)),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){var b=a.__proto__;return b||null===b?b:a.constructor?a.constructor.prototype:f});var i=function(a){try{return a.sentinel=0,0===Object.getOwnPropertyDescriptor(a,"sentinel").value}catch(b){return!1}};if(Object.defineProperty){var j=i({}),k="undefined"==typeof document||i(document.createElement("div"));if(!k||!j)var l=Object.getOwnPropertyDescriptor}if(!Object.getOwnPropertyDescriptor||l){var m="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(a,b){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError(m+a);if(l)try{return l.call(Object,a,b)}catch(e){}var i;if(!g(a,b))return i;if(i={enumerable:!0,configurable:!0},h){var j=a.__proto__,k=a!==f;k&&(a.__proto__=f);var n=c(a,b),o=d(a,b);if(k&&(a.__proto__=j),n||o)return n&&(i.get=n),o&&(i.set=o),i}return i.value=a[b],i.writable=!0,i}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(a){return Object.keys(a)}),!Object.create){var n,o=!({__proto__:null}instanceof Object),p=function(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(a){return!1}},q=function(){var a,b;return b=new ActiveXObject("htmlfile"),b.write("<script></script>"),b.close(),a=b.parentWindow.Object.prototype,b=null,a},r=function(){var a,b=document.createElement("iframe"),c=document.body||document.documentElement;return b.style.display="none",c.appendChild(b),b.src="javascript:",a=b.contentWindow.Object.prototype,c.removeChild(b),b=null,a};n=o||"undefined"==typeof document?function(){return{__proto__:null}}:function(){var a=p()?q():r();delete a.constructor,delete a.hasOwnProperty,delete a.propertyIsEnumerable,delete a.isPrototypeOf,delete a.toLocaleString,delete a.toString,delete a.valueOf,a.__proto__=null;var b=function(){};return b.prototype=a,n=function(){return new b},new b},Object.create=function(a,b){var c,d=function(){};if(null===a)c=n();else{if("object"!=typeof a&&"function"!=typeof a)throw new TypeError("Object prototype may only be an Object or null");d.prototype=a,c=new d,c.__proto__=a}return void 0!==b&&Object.defineProperties(c,b),c}}var s=function(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(b){return!1}};if(Object.defineProperty){var t=s({}),u="undefined"==typeof document||s(document.createElement("div"));if(!t||!u)var v=Object.defineProperty,w=Object.defineProperties}if(!Object.defineProperty||v){var x="Property description must be an object: ",y="Object.defineProperty called on non-object: ";Object.defineProperty=function(e,g,i){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(y+e);if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError(x+i);if(v)try{return v.call(Object,e,g,i)}catch(j){}if("value"in i)if(h&&(c(e,g)||d(e,g))){var k=e.__proto__;e.__proto__=f,delete e[g],e[g]=i.value,e.__proto__=k}else e[g]=i.value;else{if(!h)return e;"get"in i&&a(e,g,i.get),"set"in i&&b(e,g,i.set)}return e}}(!Object.defineProperties||w)&&(Object.defineProperties=function(a,b){if(w)try{return w.call(Object,a,b)}catch(c){}return Object.keys(b).forEach(function(c){"__proto__"!==c&&Object.defineProperty(a,c,b[c])}),a}),Object.seal||(Object.seal=function(a){if(Object(a)!==a)throw new TypeError("Object.seal can only be called on Objects.");return a}),Object.freeze||(Object.freeze=function(a){if(Object(a)!==a)throw new TypeError("Object.freeze can only be called on Objects.");return a});try{Object.freeze(function(){})}catch(z){Object.freeze=function(a){return function(b){return"function"==typeof b?b:a(b)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(a){if(Object(a)!==a)throw new TypeError("Object.preventExtensions can only be called on Objects.");return a}),Object.isSealed||(Object.isSealed=function(a){if(Object(a)!==a)throw new TypeError("Object.isSealed can only be called on Objects.");return!1}),Object.isFrozen||(Object.isFrozen=function(a){if(Object(a)!==a)throw new TypeError("Object.isFrozen can only be called on Objects.");return!1}),Object.isExtensible||(Object.isExtensible=function(a){if(Object(a)!==a)throw new TypeError("Object.isExtensible can only be called on Objects.");for(var b="";g(a,b);)b+="?";a[b]=!0;var c=g(a,b);return delete a[b],c})}),function(){function a(a,c,d,e){return new b(a,c,d,e)}function b(a,b,d,e){this.options=e||{},this.options.adapters=this.options.adapters||{},this.obj=a,this.keypath=b,this.callback=d,this.objectPath=[],this.parse(),c(this.target=this.realize())&&this.set(!0,this.key,this.target,this.callback)}function c(a){return"object"==typeof a&&null!==a}function d(a){throw new Error("[sightglass] "+a)}a.adapters={},b.tokenize=function(a,b,c){var d,e,f=[],g={i:c,path:""};for(d=0;d<a.length;d++)e=a.charAt(d),~b.indexOf(e)?(f.push(g),g={i:e,path:""}):g.path+=e;return f.push(g),f},b.prototype.parse=function(){var c,e,f=this.interfaces();f.length||d("Must define at least one adapter interface."),~f.indexOf(this.keypath[0])?(c=this.keypath[0],e=this.keypath.substr(1)):("undefined"==typeof(c=this.options.root||a.root)&&d("Must define a default root adapter."),e=this.keypath),this.tokens=b.tokenize(e,f,c),this.key=this.tokens.pop()},b.prototype.realize=function(){var a,b=this.obj,d=!1;return this.tokens.forEach(function(e,f){c(b)?("undefined"!=typeof this.objectPath[f]?b!==(a=this.objectPath[f])&&(this.set(!1,e,a,this.update.bind(this)),this.set(!0,e,b,this.update.bind(this)),this.objectPath[f]=b):(this.set(!0,e,b,this.update.bind(this)),this.objectPath[f]=b),b=this.get(e,b)):(d===!1&&(d=f),(a=this.objectPath[f])&&this.set(!1,e,a,this.update.bind(this)))},this),d!==!1&&this.objectPath.splice(d),b},b.prototype.update=function(){var a,b;(a=this.realize())!==this.target&&(c(this.target)&&this.set(!1,this.key,this.target,this.callback),c(a)&&this.set(!0,this.key,a,this.callback),b=this.value(),this.target=a,this.value()!==b&&this.callback())},b.prototype.value=function(){return c(this.target)?this.get(this.key,this.target):void 0},b.prototype.setValue=function(a){c(this.target)&&this.adapter(this.key).set(this.target,this.key.path,a)},b.prototype.get=function(a,b){return this.adapter(a).get(b,a.path)},b.prototype.set=function(a,b,c,d){var e=a?"observe":"unobserve";this.adapter(b)[e](c,b.path,d)},b.prototype.interfaces=function(){var b=Object.keys(this.options.adapters);return Object.keys(a.adapters).forEach(function(a){~b.indexOf(a)||b.push(a)}),b},b.prototype.adapter=function(b){return this.options.adapters[b.i]||a.adapters[b.i]},b.prototype.unobserve=function(){var a;this.tokens.forEach(function(b,c){(a=this.objectPath[c])&&this.set(!1,b,a,this.update.bind(this))},this),c(this.target)&&this.set(!1,this.key,this.target,this.callback)},"undefined"!=typeof module&&module.exports?module.exports=a:"function"==typeof define&&define.amd?define([],function(){return this.sightglass=a}):this.sightglass=a}.call(this),function(){var a,b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}},f=[].slice,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a={options:["prefix","templateDelimiters","rootInterface","preloadData","handler"],extensions:["binders","formatters","components","adapters"],"public":{binders:{},components:{},formatters:{},adapters:{},prefix:"rv",templateDelimiters:["{","}"],rootInterface:".",preloadData:!0,handler:function(a,b,c){return this.call(a,b,c.view.models)},configure:function(b){var c,d,e,f;null==b&&(b={});for(e in b)if(f=b[e],"binders"===e||"components"===e||"formatters"===e||"adapters"===e)for(d in f)c=f[d],a[e][d]=c;else a["public"][e]=f},bind:function(b,c,d){var e;return null==c&&(c={}),null==d&&(d={}),e=new a.View(b,c,d),e.bind(),e},init:function(b,c,d){var e,f;return null==d&&(d={}),null==c&&(c=document.createElement("div")),b=a["public"].components[b],c.innerHTML=b.template.call(this,c),e=b.initialize.call(this,c,d),f=new a.View(c,e),f.bind(),f}}},window.jQuery||window.$?(d="on"in jQuery.prototype?["on","off"]:["bind","unbind"],b=d[0],c=d[1],a.Util={bindEvent:function(a,c,d){return jQuery(a)[b](c,d)},unbindEvent:function(a,b,d){return jQuery(a)[c](b,d)},getInputValue:function(a){var b;return b=jQuery(a),"checkbox"===b.attr("type")?b.is(":checked"):b.val()}}):a.Util={bindEvent:function(){return"addEventListener"in window?function(a,b,c){return a.addEventListener(b,c,!1)}:function(a,b,c){return a.attachEvent("on"+b,c)}}(),unbindEvent:function(){return"removeEventListener"in window?function(a,b,c){return a.removeEventListener(b,c,!1)}:function(a,b,c){return a.detachEvent("on"+b,c)}}(),getInputValue:function(a){var b,c,d,e;if("checkbox"===a.type)return a.checked;if("select-multiple"===a.type){for(e=[],c=0,d=a.length;d>c;c++)b=a[c],b.selected&&e.push(b.value);return e}return a.value}},a.TypeParser=function(){function a(){}return a.types={primitive:0,keypath:1},a.parse=function(a){return/^'.*'$|^".*"$/.test(a)?{type:this.types.primitive,value:a.slice(1,-1)}:"true"===a?{type:this.types.primitive,value:!0}:"false"===a?{type:this.types.primitive,value:!1}:"null"===a?{type:this.types.primitive,value:null}:"undefined"===a?{type:this.types.primitive,value:void 0}:isNaN(Number(a))===!1?{type:this.types.primitive,value:Number(a)}:{type:this.types.keypath,value:a}},a}(),a.TextTemplateParser=function(){function a(){}return a.types={text:0,binding:1},a.parse=function(a,b){var c,d,e,f,g,h,i;for(h=[],f=a.length,c=0,d=0;f>d;){if(c=a.indexOf(b[0],d),0>c){h.push({type:this.types.text,value:a.slice(d)});break}if(c>0&&c>d&&h.push({type:this.types.text,value:a.slice(d,c)}),d=c+b[0].length,c=a.indexOf(b[1],d),0>c){g=a.slice(d-b[1].length),e=h[h.length-1],(null!=e?e.type:void 0)===this.types.text?e.value+=g:h.push({type:this.types.text,value:g});break}i=a.slice(d,c).trim(),h.push({type:this.types.binding,value:i}),d=c+b[1].length}return h},a}(),a.View=function(){function b(b,c,d){var f,g,h,i,j,k,l,m,n,o,p,q,r;for(this.els=b,this.models=c,null==d&&(d={}),this.update=e(this.update,this),this.publish=e(this.publish,this),this.sync=e(this.sync,this),this.unbind=e(this.unbind,this),this.bind=e(this.bind,this),this.select=e(this.select,this),this.traverse=e(this.traverse,this),this.build=e(this.build,this),this.buildBinding=e(this.buildBinding,this),this.bindingRegExp=e(this.bindingRegExp,this),this.options=e(this.options,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),n=a.extensions,j=0,l=n.length;l>j;j++){if(g=n[j],this[g]={},d[g]){o=d[g];for(f in o)h=o[f],this[g][f]=h}p=a["public"][g];for(f in p)h=p[f],null==(i=this[g])[f]&&(i[f]=h)}for(q=a.options,k=0,m=q.length;m>k;k++)g=q[k],this[g]=null!=(r=d[g])?r:a["public"][g];this.build()}return b.prototype.options=function(){var b,c,d,e,f;for(c={},f=a.extensions.concat(a.options),d=0,e=f.length;e>d;d++)b=f[d],c[b]=this[b];return c},b.prototype.bindingRegExp=function(){return new RegExp("^"+this.prefix+"-")},b.prototype.buildBinding=function(b,c,d,e){var f,g,h,i,j,k,l;return j={},l=function(){var a,b,c,d;for(c=e.split("|"),d=[],a=0,b=c.length;b>a;a++)k=c[a],d.push(k.trim());return d}(),f=function(){var a,b,c,d;for(c=l.shift().split("<"),d=[],a=0,b=c.length;b>a;a++)g=c[a],d.push(g.trim());return d}(),i=f.shift(),j.formatters=l,(h=f.shift())&&(j.dependencies=h.split(/\s+/)),this.bindings.push(new a[b](this,c,d,i,j))},b.prototype.build=function(){var b,c,d,e,f;for(this.bindings=[],c=function(b){return function(d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r;if(3===d.nodeType){if(i=a.TextTemplateParser,(g=b.templateDelimiters)&&(l=i.parse(d.data,g)).length&&(1!==l.length||l[0].type!==i.types.text)){for(m=0,o=l.length;o>m;m++)k=l[m],j=document.createTextNode(k.value),d.parentNode.insertBefore(j,d),1===k.type&&b.buildBinding("TextBinding",j,null,k.value);d.parentNode.removeChild(d)}}else 1===d.nodeType&&(e=b.traverse(d));if(!e){for(q=function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;b>a;a++)h=c[a],e.push(h);return e}(),r=[],n=0,p=q.length;p>n;n++)f=q[n],r.push(c(f));return r}}}(this),f=this.els,d=0,e=f.length;e>d;d++)b=f[d],c(b);this.bindings.sort(function(a,b){var c,d;return((null!=(c=b.binder)?c.priority:void 0)||0)-((null!=(d=a.binder)?d.priority:void 0)||0)})},b.prototype.traverse=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(f=this.bindingRegExp(),g="SCRIPT"===b.nodeName||"STYLE"===b.nodeName,p=b.attributes,l=0,n=p.length;n>l;l++)if(c=p[l],f.test(c.name)){if(j=c.name.replace(f,""),!(e=this.binders[j])){q=this.binders;for(h in q)k=q[h],"*"!==h&&-1!==h.indexOf("*")&&(i=new RegExp("^"+h.replace(/\*/g,".+")+"$"),i.test(j)&&(e=k))}e||(e=this.binders["*"]),e.block&&(g=!0,d=[c])}for(r=d||b.attributes,m=0,o=r.length;o>m;m++)c=r[m],f.test(c.name)&&(j=c.name.replace(f,""),this.buildBinding("Binding",b,j,c.value));return g||(j=b.nodeName.toLowerCase(),this.components[j]&&!b._bound&&(this.bindings.push(new a.ComponentBinding(this,b,j)),g=!0)),g},b.prototype.select=function(a){var b,c,d,e,f;for(e=this.bindings,f=[],c=0,d=e.length;d>c;c++)b=e[c],a(b)&&f.push(b);return f},b.prototype.bind=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.bind());return e},b.prototype.unbind=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.unbind());return e},b.prototype.sync=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push("function"==typeof a.sync?a.sync():void 0);return e},b.prototype.publish=function(){var a,b,c,d,e;for(d=this.select(function(a){var b;return null!=(b=a.binder)?b.publishes:void 0}),e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.publish());return e},b.prototype.update=function(a){var b,c,d,e,f,g,h;null==a&&(a={});for(c in a)d=a[c],this.models[c]=d;for(g=this.bindings,h=[],e=0,f=g.length;f>e;e++)b=g[e],h.push("function"==typeof b.update?b.update(a):void 0);return h},b}(),a.Binding=function(){function b(a,b,c,d,f){this.view=a,this.el=b,this.type=c,this.keypath=d,this.options=null!=f?f:{},this.getValue=e(this.getValue,this),this.update=e(this.update,this),this.unbind=e(this.unbind,this),this.bind=e(this.bind,this),this.publish=e(this.publish,this),this.sync=e(this.sync,this),this.set=e(this.set,this),this.eventHandler=e(this.eventHandler,this),this.formattedValue=e(this.formattedValue,this),this.parseTarget=e(this.parseTarget,this),this.observe=e(this.observe,this),this.setBinder=e(this.setBinder,this),this.formatters=this.options.formatters||[],this.dependencies=[],this.formatterObservers={},this.model=void 0,this.setBinder()}return b.prototype.setBinder=function(){var a,b,c,d;if(!(this.binder=this.view.binders[this.type])){d=this.view.binders;for(a in d)c=d[a],"*"!==a&&-1!==a.indexOf("*")&&(b=new RegExp("^"+a.replace(/\*/g,".+")+"$"),b.test(this.type)&&(this.binder=c,this.args=new RegExp("^"+a.replace(/\*/g,"(.+)")+"$").exec(this.type),this.args.shift()))}return this.binder||(this.binder=this.view.binders["*"]),this.binder instanceof Function?this.binder={routine:this.binder}:void 0},b.prototype.observe=function(b,c,d){return a.sightglass(b,c,d,{root:this.view.rootInterface,adapters:this.view.adapters})},b.prototype.parseTarget=function(){var b;return b=a.TypeParser.parse(this.keypath),0===b.type?this.value=b.value:(this.observer=this.observe(this.view.models,this.keypath,this.sync),this.model=this.observer.target)},b.prototype.formattedValue=function(b){var c,d,e,g,h,i,j,k,l,m,n,o,p,q;for(q=this.formatters,g=m=0,o=q.length;o>m;g=++m){for(h=q[g],e=h.match(/[^\s']+|'([^']|'[^\s])*'|"([^"]|"[^\s])*"/g),i=e.shift(),h=this.view.formatters[i],e=function(){var b,c,f;for(f=[],b=0,c=e.length;c>b;b++)d=e[b],f.push(a.TypeParser.parse(d));return f}(),k=[],c=n=0,p=e.length;p>n;c=++n)d=e[c],k.push(0===d.type?d.value:((l=this.formatterObservers)[g]||(l[g]={}),(j=this.formatterObservers[g][c])?void 0:(j=this.observe(this.view.models,d.value,this.sync),this.formatterObservers[g][c]=j),j.value()));(null!=h?h.read:void 0)instanceof Function?b=h.read.apply(h,[b].concat(f.call(k))):h instanceof Function&&(b=h.apply(null,[b].concat(f.call(k))))}return b},b.prototype.eventHandler=function(a){var b,c;return c=(b=this).view.handler,function(d){return c.call(a,this,d,b)}},b.prototype.set=function(a){var b;return a=this.formattedValue(a instanceof Function&&!this.binder["function"]?a.call(this.model):a),null!=(b=this.binder.routine)?b.call(this,this.el,a):void 0},b.prototype.sync=function(){var a,b;return this.set(function(){var c,d,e,f,g,h,i;if(this.observer){if(this.model!==this.observer.target){for(g=this.dependencies,c=0,e=g.length;e>c;c++)b=g[c],b.unobserve();if(this.dependencies=[],null!=(this.model=this.observer.target)&&(null!=(h=this.options.dependencies)?h.length:void 0))for(i=this.options.dependencies,d=0,f=i.length;f>d;d++)a=i[d],b=this.observe(this.model,a,this.sync),this.dependencies.push(b)}return this.observer.value()}return this.value}.call(this))},b.prototype.publish=function(){
  var a,b,c,d,e,g,h,i,j;if(this.observer){for(d=this.getValue(this.el),h=this.formatters.slice(0).reverse(),e=0,g=h.length;g>e;e++)b=h[e],a=b.split(/\s+/),c=a.shift(),(null!=(i=this.view.formatters[c])?i.publish:void 0)&&(d=(j=this.view.formatters[c]).publish.apply(j,[d].concat(f.call(a))));return this.observer.setValue(d)}},b.prototype.bind=function(){var a,b,c,d,e,f,g;if(this.parseTarget(),null!=(e=this.binder.bind)&&e.call(this,this.el),null!=this.model&&(null!=(f=this.options.dependencies)?f.length:void 0))for(g=this.options.dependencies,c=0,d=g.length;d>c;c++)a=g[c],b=this.observe(this.model,a,this.sync),this.dependencies.push(b);return this.view.preloadData?this.sync():void 0},b.prototype.unbind=function(){var a,b,c,d,e,f,g,h,i,j;for(null!=(g=this.binder.unbind)&&g.call(this,this.el),null!=(h=this.observer)&&h.unobserve(),i=this.dependencies,e=0,f=i.length;f>e;e++)d=i[e],d.unobserve();this.dependencies=[],j=this.formatterObservers;for(c in j){b=j[c];for(a in b)d=b[a],d.unobserve()}return this.formatterObservers={}},b.prototype.update=function(a){var b,c;return null==a&&(a={}),this.model=null!=(b=this.observer)?b.target:void 0,null!=(c=this.binder.update)?c.call(this,a):void 0},b.prototype.getValue=function(b){return this.binder&&null!=this.binder.getValue?this.binder.getValue.call(this,b):a.Util.getInputValue(b)},b}(),a.ComponentBinding=function(b){function c(a,b,c){var d,f,g,h,j,k,l;for(this.view=a,this.el=b,this.type=c,this.unbind=e(this.unbind,this),this.bind=e(this.bind,this),this.locals=e(this.locals,this),this.component=this.view.components[this.type],this["static"]={},this.observers={},this.upstreamObservers={},f=a.bindingRegExp(),k=this.el.attributes||[],h=0,j=k.length;j>h;h++)d=k[h],f.test(d.name)||(g=this.camelCase(d.name),i.call(null!=(l=this.component["static"])?l:[],g)>=0?this["static"][g]=d.value:this.observers[g]=d.value)}return h(c,b),c.prototype.sync=function(){},c.prototype.update=function(){},c.prototype.publish=function(){},c.prototype.locals=function(){var a,b,c,d,e,f;c={},e=this["static"];for(a in e)d=e[a],c[a]=d;f=this.observers;for(a in f)b=f[a],c[a]=b.value();return c},c.prototype.camelCase=function(a){return a.replace(/-([a-z])/g,function(a){return a[1].toUpperCase()})},c.prototype.bind=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(!this.bound){o=this.observers;for(c in o)d=o[c],this.observers[c]=this.observe(this.view.models,d,function(a){return function(b){return function(){return a.componentView.models[b]=a.observers[b].value()}}}(this).call(this,c));this.bound=!0}if(null!=this.componentView)return this.componentView.bind();for(this.el.innerHTML=this.component.template.call(this),h=this.component.initialize.call(this,this.el,this.locals()),this.el._bound=!0,g={},p=a.extensions,k=0,m=p.length;m>k;k++){if(f=p[k],g[f]={},this.component[f]){q=this.component[f];for(b in q)i=q[b],g[f][b]=i}r=this.view[f];for(b in r)i=r[b],null==(j=g[f])[b]&&(j[b]=i)}for(s=a.options,l=0,n=s.length;n>l;l++)f=s[l],g[f]=null!=(t=this.component[f])?t:this.view[f];this.componentView=new a.View(this.el,h,g),this.componentView.bind(),u=this.observers,v=[];for(c in u)e=u[c],v.push(this.upstreamObservers[c]=this.observe(this.componentView.models,c,function(a){return function(b,c){return function(){return c.setValue(a.componentView.models[b])}}}(this).call(this,c,e)));return v},c.prototype.unbind=function(){var a,b,c,d,e;c=this.upstreamObservers;for(a in c)b=c[a],b.unobserve();d=this.observers;for(a in d)b=d[a],b.unobserve();return null!=(e=this.componentView)?e.unbind.call(this):void 0},c}(a.Binding),a.TextBinding=function(a){function b(a,b,c,d,f){this.view=a,this.el=b,this.type=c,this.keypath=d,this.options=null!=f?f:{},this.sync=e(this.sync,this),this.formatters=this.options.formatters||[],this.dependencies=[],this.formatterObservers={}}return h(b,a),b.prototype.binder={routine:function(a,b){return a.data=null!=b?b:""}},b.prototype.sync=function(){return b.__super__.sync.apply(this,arguments)},b}(a.Binding),a["public"].binders.text=function(a,b){return null!=a.textContent?a.textContent=null!=b?b:"":a.innerText=null!=b?b:""},a["public"].binders.html=function(a,b){return a.innerHTML=null!=b?b:""},a["public"].binders.show=function(a,b){return a.style.display=b?"":"none"},a["public"].binders.hide=function(a,b){return a.style.display=b?"none":""},a["public"].binders.enabled=function(a,b){return a.disabled=!b},a["public"].binders.disabled=function(a,b){return a.disabled=!!b},a["public"].binders.checked={publishes:!0,priority:2e3,bind:function(b){return a.Util.bindEvent(b,"change",this.publish)},unbind:function(b){return a.Util.unbindEvent(b,"change",this.publish)},routine:function(a,b){var c;return a.checked="radio"===a.type?(null!=(c=a.value)?c.toString():void 0)===(null!=b?b.toString():void 0):!!b}},a["public"].binders.unchecked={publishes:!0,priority:2e3,bind:function(b){return a.Util.bindEvent(b,"change",this.publish)},unbind:function(b){return a.Util.unbindEvent(b,"change",this.publish)},routine:function(a,b){var c;return a.checked="radio"===a.type?(null!=(c=a.value)?c.toString():void 0)!==(null!=b?b.toString():void 0):!b}},a["public"].binders.value={publishes:!0,priority:3e3,bind:function(b){return"INPUT"!==b.tagName||"radio"!==b.type?(this.event="SELECT"===b.tagName?"change":"input",a.Util.bindEvent(b,this.event,this.publish)):void 0},unbind:function(b){return"INPUT"!==b.tagName||"radio"!==b.type?a.Util.unbindEvent(b,this.event,this.publish):void 0},routine:function(a,b){var c,d,e,f,g,h,j;if("INPUT"===a.tagName&&"radio"===a.type)return a.setAttribute("value",b);if(null!=window.jQuery){if(a=jQuery(a),(null!=b?b.toString():void 0)!==(null!=(f=a.val())?f.toString():void 0))return a.val(null!=b?b:"")}else if("select-multiple"===a.type){if(null!=b){for(j=[],d=0,e=a.length;e>d;d++)c=a[d],j.push(c.selected=(g=c.value,i.call(b,g)>=0));return j}}else if((null!=b?b.toString():void 0)!==(null!=(h=a.value)?h.toString():void 0))return a.value=null!=b?b:""}},a["public"].binders["if"]={block:!0,priority:4e3,bind:function(a){var b,c;return null==this.marker?(b=[this.view.prefix,this.type].join("-").replace("--","-"),c=a.getAttribute(b),this.marker=document.createComment(" rivets: "+this.type+" "+c+" "),this.bound=!1,a.removeAttribute(b),a.parentNode.insertBefore(this.marker,a),a.parentNode.removeChild(a)):void 0},unbind:function(){var a;return null!=(a=this.nested)?a.unbind():void 0},routine:function(b,c){var d,e,f,g;if(!!c==!this.bound){if(c){f={},g=this.view.models;for(d in g)e=g[d],f[d]=e;return(this.nested||(this.nested=new a.View(b,f,this.view.options()))).bind(),this.marker.parentNode.insertBefore(b,this.marker.nextSibling),this.bound=!0}return b.parentNode.removeChild(b),this.nested.unbind(),this.bound=!1}},update:function(a){var b;return null!=(b=this.nested)?b.update(a):void 0}},a["public"].binders.unless={block:!0,priority:4e3,bind:function(b){return a["public"].binders["if"].bind.call(this,b)},unbind:function(){return a["public"].binders["if"].unbind.call(this)},routine:function(b,c){return a["public"].binders["if"].routine.call(this,b,!c)},update:function(b){return a["public"].binders["if"].update.call(this,b)}},a["public"].binders["on-*"]={"function":!0,priority:1e3,unbind:function(b){return this.handler?a.Util.unbindEvent(b,this.args[0],this.handler):void 0},routine:function(b,c){return this.handler&&a.Util.unbindEvent(b,this.args[0],this.handler),a.Util.bindEvent(b,this.args[0],this.handler=this.eventHandler(c))}},a["public"].binders["each-*"]={block:!0,priority:4e3,bind:function(a){var b,c,d,e,f;if(null==this.marker)b=[this.view.prefix,this.type].join("-").replace("--","-"),this.marker=document.createComment(" rivets: "+this.type+" "),this.iterated=[],a.removeAttribute(b),a.parentNode.insertBefore(this.marker,a),a.parentNode.removeChild(a);else for(f=this.iterated,d=0,e=f.length;e>d;d++)c=f[d],c.bind()},unbind:function(){var a,b,c,d,e;if(null!=this.iterated){for(d=this.iterated,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.unbind());return e}},routine:function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;if(j=this.args[0],c=c||[],this.iterated.length>c.length)for(u=Array(this.iterated.length-c.length),o=0,r=u.length;r>o;o++)f=u[o],n=this.iterated.pop(),n.unbind(),this.marker.parentNode.removeChild(n.els[0]);for(g=p=0,s=c.length;s>p;g=++p)if(i=c[g],e={index:g},e[j]=i,null==this.iterated[g]){v=this.view.models;for(h in v)i=v[h],null==e[h]&&(e[h]=i);l=this.iterated.length?this.iterated[this.iterated.length-1].els[0]:this.marker,k=this.view.options(),k.preloadData=!0,m=b.cloneNode(!0),n=new a.View(m,e,k),n.bind(),this.iterated.push(n),this.marker.parentNode.insertBefore(m,l.nextSibling)}else this.iterated[g].models[j]!==i&&this.iterated[g].update(e);if("OPTION"===b.nodeName){for(w=this.view.bindings,x=[],q=0,t=w.length;t>q;q++)d=w[q],x.push(d.el===this.marker.parentNode&&"value"===d.type?d.sync():void 0);return x}},update:function(a){var b,c,d,e,f,g,h,i;b={};for(c in a)d=a[c],c!==this.args[0]&&(b[c]=d);for(h=this.iterated,i=[],f=0,g=h.length;g>f;f++)e=h[f],i.push(e.update(b));return i}},a["public"].binders["class-*"]=function(a,b){var c;return c=" "+a.className+" ",!b==(-1!==c.indexOf(" "+this.args[0]+" "))?a.className=b?""+a.className+" "+this.args[0]:c.replace(" "+this.args[0]+" "," ").trim():void 0},a["public"].binders["*"]=function(a,b){return null!=b?a.setAttribute(this.type,b):a.removeAttribute(this.type)},a["public"].adapters["."]={id:"_rv",counter:0,weakmap:{},weakReference:function(a){var b,c,d;return a.hasOwnProperty(this.id)||(b=this.counter++,Object.defineProperty(a,this.id,{value:b})),(c=this.weakmap)[d=a[this.id]]||(c[d]={callbacks:{}})},cleanupWeakReference:function(a,b){return Object.keys(a.callbacks).length||a.pointers&&Object.keys(a.pointers).length?void 0:delete this.weakmap[b]},stubFunction:function(a,b){var c,d,e;return d=a[b],c=this.weakReference(a),e=this.weakmap,a[b]=function(){var b,f,g,h,i,j,k,l,m,n;h=d.apply(a,arguments),k=c.pointers;for(g in k)for(f=k[g],n=null!=(l=null!=(m=e[g])?m.callbacks[f]:void 0)?l:[],i=0,j=n.length;j>i;i++)(b=n[i])();return h}},observeMutations:function(a,b,c){var d,e,f,g,h,j;if(Array.isArray(a)){if(f=this.weakReference(a),null==f.pointers)for(f.pointers={},e=["push","pop","shift","unshift","sort","reverse","splice"],h=0,j=e.length;j>h;h++)d=e[h],this.stubFunction(a,d);if(null==(g=f.pointers)[b]&&(g[b]=[]),i.call(f.pointers[b],c)<0)return f.pointers[b].push(c)}},unobserveMutations:function(a,b,c){var d,e,f;return Array.isArray(a)&&null!=a[this.id]&&(e=this.weakmap[a[this.id]])&&(f=e.pointers[b])?((d=f.indexOf(c))>=0&&f.splice(d,1),f.length||delete e.pointers[b],this.cleanupWeakReference(e,a[this.id])):void 0},observe:function(a,b,c){var d,e,f;return d=this.weakReference(a).callbacks,null==d[b]&&(d[b]=[],e=Object.getOwnPropertyDescriptor(a,b),(null!=e?e.get:void 0)||(null!=e?e.set:void 0)||(f=a[b],Object.defineProperty(a,b,{enumerable:!0,get:function(){return f},set:function(e){return function(g){var h,j,k,l;if(g!==f&&(e.unobserveMutations(f,a[e.id],b),f=g,h=e.weakmap[a[e.id]])){if(d=h.callbacks,d[b])for(l=d[b].slice(),j=0,k=l.length;k>j;j++)c=l[j],i.call(d[b],c)>=0&&c();return e.observeMutations(g,a[e.id],b)}}}(this)}))),i.call(d[b],c)<0&&d[b].push(c),this.observeMutations(a[b],a[this.id],b)},unobserve:function(a,b,c){var d,e,f;return(f=this.weakmap[a[this.id]])&&(d=f.callbacks[b])?((e=d.indexOf(c))>=0&&(d.splice(e,1),d.length||delete f.callbacks[b]),this.unobserveMutations(a[b],a[this.id],b),this.cleanupWeakReference(f,a[this.id])):void 0},get:function(a,b){return a[b]},set:function(a,b,c){return a[b]=c}},a.factory=function(b){return a.sightglass=b,a["public"]._=a,a["public"]},"object"==typeof("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=a.factory(require("sightglass")):"function"==typeof define&&define.amd?define(["sightglass"],function(b){return this.rivets=a.factory(b)}):this.rivets=a.factory(sightglass)}.call(this),function(){var a,b,c,d,e,f,g=function(a,b){return function(){return a.apply(b,arguments)}};b=function(){function a(){this.update=g(this.update,this)}return a.prototype.update=function(a){var b,c,e;for(c in a)e=a[c],"items"!==c&&(this[c]=e);return this.items=function(){var c,e,f,g;for(f=a.items,g=[],c=0,e=f.length;e>c;c++)b=f[c],g.push(new d(b));return g}()},a}(),d=function(){function a(a){this.propertyArray=g(this.propertyArray,this),this.update=g(this.update,this),this.update(a)}return a.prototype.update=function(a){var b,d;for(b in a)d=a[b],"properties"!==b&&(this[b]=d);return this.properties=c.Utils.extend({},a.properties)},a.prototype.propertyArray=function(){var a,b,c,d;c=this.properties,d=[];for(a in c)b=c[a],d.push({name:a,value:b});return d},a}(),c={settings:{debug:!1,dataAPI:!0,requestBodyClass:null,rivetsModels:{},currency:null,moneyFormat:null,moneyWithCurrencyFormat:null,weightUnit:"g",weightPrecision:0},cart:new b},c.init=function(a,b){return null==b&&(b={}),c.configure(b),c.Utils.log("Initialising CartJS."),c.cart.update(a),c.settings.dataAPI&&(c.Utils.log('"dataAPI" setting is true, initialising Data API.'),c.Data.init()),c.settings.requestBodyClass&&(c.Utils.log('"requestBodyClass" set, adding event listeners.'),jQuery(document).on("cart.requestStarted",function(){return jQuery("body").addClass(c.settings.requestBodyClass)}),jQuery(document).on("cart.requestComplete",function(){return jQuery("body").removeClass(c.settings.requestBodyClass)})),c.Rivets.init(),jQuery(document).trigger("cart.ready",[c.cart])},c.configure=function(a){return null==a&&(a={}),c.Utils.extend(c.settings,a)},null==window.console&&(window.console={},window.console.log=function(){}),c.Utils={log:function(){return c.Utils.console(console.log,arguments)},error:function(){return c.Utils.console(console.error,arguments)},console:function(a,b){return c.settings.debug&&"undefined"!=typeof console&&null!==console?(b=Array.prototype.slice.call(b),b.unshift("[CartJS]:"),a.apply(console,b)):void 0},wrapKeys:function(a,b,c){var d,e,f;null==b&&(b="properties"),f={};for(d in a)e=a[d],f[""+b+"["+d+"]"]=null!=c?c:e;return f},unwrapKeys:function(a,b,c){var d,e,f,g;null==b&&(b="properties"),e={};for(d in a)g=a[d],f=d.replace(""+b+"[","").replace("]",""),e[f]=null!=c?c:g;return e},extend:function(a,b){var c,d;for(c in b)d=b[c],a[c]=d;return a},clone:function(a){var b,c;if(null==a||"object"!=typeof a)return a;c=new a.constructor;for(b in a)c[b]=clone(a[b]);return c},isArray:Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},ensureArray:function(a){return c.Utils.isArray(a)?a:null!=a?[a]:[]},formatMoney:function(a,b,d,e){var f,g;return null==e&&(e=""),e||(e=c.settings.currency),null!=window.Currency&&e!==c.settings.currency&&(a=Currency.convert(a,c.settings.currency,e),null!=(null!=(f=window.Currency)?f.moneyFormats:void 0)&&e in window.Currency.moneyFormats&&(b=window.Currency.moneyFormats[e][d])),null!=(null!=(g=window.Shopify)?g.formatMoney:void 0)?Shopify.formatMoney(a,b):a},getSizedImageUrl:function(a,b){var c,d;return null!=(null!=(c=window.Shopify)&&null!=(d=c.Image)?d.getSizedImageUrl:void 0)?a?Shopify.Image.getSizedImageUrl(a,b):Shopify.Image.getSizedImageUrl("https://cdn.shopify.com/s/images/admin/no-image-.gif",b).replace("-_","-"):a?a:"https://cdn.shopify.com/s/images/admin/no-image-large.gif"}},f=[],e=!1,c.Queue={add:function(a,b,d){var g;return null==d&&(d={}),g={url:a,data:b,type:d.type||"POST",dataType:d.dataType||"json",success:c.Utils.ensureArray(d.success),error:c.Utils.ensureArray(d.error),complete:c.Utils.ensureArray(d.complete)},d.updateCart&&g.success.push(c.cart.update),f.push(g),e?void 0:(jQuery(document).trigger("cart.requestStarted",[c.cart]),c.Queue.process())},process:function(){var a;return f.length?(e=!0,a=f.shift(),a.complete=c.Queue.process,jQuery.ajax(a)):(e=!1,void jQuery(document).trigger("cart.requestComplete",[c.cart]))}},c.Core={getCart:function(a){return null==a&&(a={}),a.type="GET",a.updateCart=!0,c.Queue.add("/cart.js",{},a)},addItem:function(a,b,d,e){var f;return null==b&&(b=1),null==d&&(d={}),null==e&&(e={}),f=c.Utils.wrapKeys(d),f.id=a,f.quantity=b,c.Queue.add("/cart/add.js",f,e),c.Core.getCart()},updateItem:function(a,b,d,e){var f;return null==d&&(d={}),null==e&&(e={}),f=c.Utils.wrapKeys(d),f.line=a,null!=b&&(f.quantity=b),e.updateCart=!0,c.Queue.add("/cart/change.js",f,e)},removeItem:function(a,b){return null==b&&(b={}),c.Core.updateItem(a,0,{},b)},updateItemById:function(a,b,d,e){var f;return null==d&&(d={}),null==e&&(e={}),f=c.Utils.wrapKeys(d),f.id=a,null!=b&&(f.quantity=b),e.updateCart=!0,c.Queue.add("/cart/change.js",f,e)},updateItemQuantitiesById:function(a,b){return null==a&&(a={}),null==b&&(b={}),b.updateCart=!0,c.Queue.add("/cart/update.js",{updates:a},b)},removeItemById:function(a,b){var d;return null==b&&(b={}),d={id:a,quantity:0},b.updateCart=!0,c.Queue.add("/cart/change.js",d,b)},clear:function(a){return null==a&&(a={}),a.updateCart=!0,c.Queue.add("/cart/clear.js",{},a)},getAttribute:function(a,b){return a in c.cart.attributes?c.cart.attributes[a]:b},setAttribute:function(a,b,d){var e;return null==d&&(d={}),e={},e[a]=b,c.Core.setAttributes(e,d)},getAttributes:function(){return c.cart.attributes},setAttributes:function(a,b){return null==a&&(a={}),null==b&&(b={}),b.updateCart=!0,c.Queue.add("/cart/update.js",c.Utils.wrapKeys(a,"attributes"),b)},clearAttributes:function(a){return null==a&&(a={}),a.updateCart=!0,c.Queue.add("/cart/update.js",c.Utils.wrapKeys(c.Core.getAttributes(),"attributes",""),a)},getNote:function(){return c.cart.note},setNote:function(a,b){return null==b&&(b={}),b.updateCart=!0,c.Queue.add("/cart/update.js",{note:a},b)}},a=jQuery(document),c.Data={init:function(){return c.Data.setEventListeners("on"),c.Data.render(null,c.cart)},destroy:function(){return c.Data.setEventListeners("off")},setEventListeners:function(b){return a[b]("click","[data-cart-add]",c.Data.add),a[b]("click","[data-cart-remove]",c.Data.remove),a[b]("click","[data-cart-remove-id]",c.Data.removeById),a[b]("click","[data-cart-update]",c.Data.update),a[b]("click","[data-cart-update-id]",c.Data.updateById),a[b]("click","[data-cart-clear]",c.Data.clear),a[b]("change","[data-cart-toggle]",c.Data.toggle),a[b]("change","[data-cart-toggle-attribute]",c.Data.toggleAttribute),a[b]("submit","[data-cart-submit]",c.Data.submit),a[b]("cart.requestComplete",c.Data.render)},add:function(a){var b;return a.preventDefault(),b=jQuery(this),c.Core.addItem(b.attr("data-cart-add"),b.attr("data-cart-quantity"))},remove:function(a){var b;return a.preventDefault(),b=jQuery(this),c.Core.removeItem(b.attr("data-cart-remove"))},removeById:function(a){var b;return a.preventDefault(),b=jQuery(this),c.Core.removeItemById(b.attr("data-cart-remove-id"))},update:function(a){var b;return a.preventDefault(),b=jQuery(this),c.Core.updateItem(b.attr("data-cart-update"),b.attr("data-cart-quantity"))},updateById:function(a){var b;return a.preventDefault(),b=jQuery(this),c.Core.updateItemById(b.attr("data-cart-update-id"),b.attr("data-cart-quantity"))},clear:function(a){return a.preventDefault(),c.Core.clear()},toggle:function(){var a,b;return a=jQuery(this),b=a.attr("data-cart-toggle"),a.is(":checked")?c.Core.addItem(b):c.Core.removeItemById(b)},toggleAttribute:function(){var a,b;return a=jQuery(this),b=a.attr("data-cart-toggle-attribute"),c.Core.setAttribute(b,a.is(":checked")?"Yes":"")},submit:function(a){var b,d,e,f;return a.preventDefault(),b=jQuery(this).serializeArray(),d=void 0,f=void 0,e={},jQuery.each(b,function(a,b){return"id"===b.name?d=b.value:"quantity"===b.name?f=b.value:e[b.name]=b.value}),c.Core.addItem(d,f,c.Utils.unwrapKeys(e))},render:function(a,b){var d;return d={item_count:b.item_count,total_price:b.total_price,total_price_money:c.Utils.formatMoney(b.total_price,c.settings.moneyFormat,"money_format",null!=("undefined"!=typeof Currency&&null!==Currency?Currency.currentCurrency:void 0)?Currency.currentCurrency:void 0),total_price_money_with_currency:c.Utils.formatMoney(b.total_price,c.settings.moneyWithCurrencyFormat,"money_with_currency_format",null!=("undefined"!=typeof Currency&&null!==Currency?Currency.currentCurrency:void 0)?Currency.currentCurrency:void 0)},jQuery("[data-cart-render]").each(function(){var a;return a=jQuery(this),a.html(d[a.attr("data-cart-render")])})}},"rivets"in window?(c.Rivets={model:null,boundViews:[],init:function(){return c.Rivets.bindViews(),null!=c.IE8?c.IE8.init():void 0},destroy:function(){return c.Rivets.unbindViews(),null!=c.IE8?c.IE8.destroy():void 0},bindViews:function(){return c.Utils.log("Rivets.js is present, binding views."),c.Rivets.unbindViews(),c.Rivets.model=c.Utils.extend({cart:c.cart},c.settings.rivetsModels),null!=window.Currency&&(c.Rivets.model.Currency=window.Currency),jQuery("[data-cart-view]").each(function(){var a;return a=rivets.bind(jQuery(this),c.Rivets.model),c.Rivets.boundViews.push(a)})},unbindViews:function(){var a,b,d,e;for(e=c.Rivets.boundViews,b=0,d=e.length;d>b;b++)a=e[b],a.unbind();return c.Rivets.boundViews=[]}},rivets.formatters.eq=function(a,b){return a===b},rivets.formatters.includes=function(a,b){return a.indexOf(b)>=0},rivets.formatters.match=function(a,b,c){return a.match(new RegExp(b,c))},rivets.formatters.lt=function(a,b){return b>a},rivets.formatters.gt=function(a,b){return a>b},rivets.formatters.not=function(a){return!a},rivets.formatters.empty=function(a){return!a.length},rivets.formatters.plus=function(a,b){return parseInt(a)+parseInt(b)},rivets.formatters.minus=function(a,b){return parseInt(a)-parseInt(b)},rivets.formatters.prepend=function(a,b){return b+a},rivets.formatters.append=function(a,b){return a+b},rivets.formatters.money=function(a,b){return c.Utils.formatMoney(a,c.settings.moneyFormat,"money_format",b)},rivets.formatters.money_with_currency=function(a,b){return c.Utils.formatMoney(a,c.settings.moneyWithCurrencyFormat,"money_with_currency_format",b)},rivets.formatters.weight=function(a){switch(c.settings.weightUnit){case"kg":return(a/1e3).toFixed(c.settings.weightPrecision);case"oz":return(.035274*a).toFixed(c.settings.weightPrecision);case"lb":return(.00220462*a).toFixed(c.settings.weightPrecision);default:return a.toFixed(c.settings.weightPrecision)}},rivets.formatters.weight_with_unit=function(a){return rivets.formatters.weight(a)+c.settings.weightUnit},rivets.formatters.product_image_size=function(a,b){return c.Utils.getSizedImageUrl(a,b)},rivets.formatters.moneyWithCurrency=rivets.formatters.money_with_currency,rivets.formatters.weightWithUnit=rivets.formatters.weight_with_unit,rivets.formatters.productImageSize=rivets.formatters.product_image_size):c.Rivets={init:function(){},destroy:function(){}},c.factory=function(a){return a.init=c.init,a.configure=c.configure,a.cart=c.cart,a.settings=c.settings,a.getCart=c.Core.getCart,a.addItem=c.Core.addItem,a.updateItem=c.Core.updateItem,a.updateItemById=c.Core.updateItemById,a.updateItemQuantitiesById=c.Core.updateItemQuantitiesById,a.removeItem=c.Core.removeItem,a.removeItemById=c.Core.removeItemById,a.clear=c.Core.clear,a.getAttribute=c.Core.getAttribute,a.setAttribute=c.Core.setAttribute,a.getAttributes=c.Core.getAttributes,a.setAttributes=c.Core.setAttributes,a.clearAttributes=c.Core.clearAttributes,a.getNote=c.Core.getNote,a.setNote=c.Core.setNote,a.render=c.Data.render},"object"==typeof exports?c.factory(exports):"function"==typeof define&&define.amd?define(["exports"],function(a){return c.factory(this.CartJS=a),a}):c.factory(this.CartJS={}),c.Compatibility="rivets"in window?{init:function(){return c.Utils.log("Initialising compatibility module."),jQuery(document).on("cart.requestComplete",c.Compatibility.rebindViews)},destroy:function(){return c.Utils.log("Tearing down compatibility module."),jQuery(document).off("cart.requestComplete",c.Compatibility.rebindViews)},rebindViews:function(){var a,b,d,e,f;for(e=c.Rivets.boundViews,f=[],b=0,d=e.length;d>b;b++)a=e[b],a.unbind(),a.update(c.Rivets.model),a.sync(),a.bind(),a.update(c.Rivets.model),f.push(a.sync());return f}}:{init:function(){},destroy:function(){}}}.call(this);