!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(e,t,n){n(1),n(4);t.BaseOperation=function(){},t.add_op=function(e,t,n){e.prototype.type=[t.module_name,n],"op_map"in t||(t.op_map={}),t.op_map[n]=e};var r=n(3),o=n(15),i=n(6),a=n(5),s=n(14);t.NO_OP=r.NO_OP,t.SET=r.SET,t.MATH=r.MATH,t.PATCH=o.PATCH,t.SPLICE=o.SPLICE,t.ATINDEX=o.ATINDEX,t.MAP=o.MAP,t.PUT=i.PUT,t.REM=i.REM,t.APPLY=i.APPLY,t.LIST=a.LIST,t.COPY=s.COPY,t.diff=n(12).diff,t.BaseOperation.prototype.isNoOp=function(){return this instanceof r.NO_OP},t.BaseOperation.prototype.visit=function(e){return e(this)||this},t.BaseOperation.prototype.toJSON=function(e,t){var n={};if(void 0===t)t=1,n._ver=t;else if(1!==t)throw new Error("Invalid protocol version: "+t);return n._type=this.type[0]+"."+this.type[1],this.internalToJSON(n,t),n},t.opFromJSON=function(e,t,n){if("object"!=typeof e)throw new Error("Not an operation.");if(void 0===t){if(1!==(t=e._ver))throw new Error("JOT serialized data structure is missing protocol version and one wasn't provided as an argument.")}else{if(1!==t)throw new Error("Invalid protocol version provided: "+t);if("_ver"in e)throw new Error("JOT serialized data structure should not have protocol version because it was provided as an argument.")}if(!n){function u(e){for(var t in n[e.module_name]={},e.op_map)n[e.module_name][t]=e.op_map[t]}n={},u(r),u(o),u(i),u(a),u(s)}if("string"!=typeof e._type)throw new Error("Not an operation.");var f=e._type.split(/\./g,2);if(2!=f.length)throw new Error("Not an operation.");return n[f[0]][f[1]].internalFromJSON(e,t,n)},t.BaseOperation.prototype.serialize=function(){return JSON.stringify(this)},t.deserialize=function(e){return t.opFromJSON(JSON.parse(e))},t.BaseOperation.prototype.compose=function(e){if(!(e instanceof t.BaseOperation))throw new Error("Argument must be an operation.");if(this instanceof r.NO_OP)return e;if(e instanceof r.NO_OP)return this;if(e instanceof r.SET)return e;if(this.atomic_compose){var n=this.atomic_compose(e);if(null!=n)return n}return new a.LIST([this,e]).simplify()},t.BaseOperation.prototype.rebase=function(e,t,n){for(var o=0;o<(null!=this.rebase_functions?this.rebase_functions.length:0);o++){if(e instanceof this.rebase_functions[o][0])if(null!=(i=this.rebase_functions[o][1].call(this,e,t))&&null!=i[0])return n&&n("rebase",this,"on",e,t?"conflictless":"","document"in t?JSON.stringify(t.document):"","=>",i[0]),i[0]}for(o=0;o<(null!=e.rebase_functions?e.rebase_functions.length:0);o++){var i;if(this instanceof e.rebase_functions[o][0])if(null!=(i=e.rebase_functions[o][1].call(e,this,t))&&null!=i[1])return n&&n("rebase",this,"on",e,t?"conflictless":"","document"in t?JSON.stringify(t.document):"","=>",i[0]),i[1]}if(this instanceof a.LIST||e instanceof a.LIST){var u=a.rebase(e,this,t,n);return n&&n("rebase",this,"on",e,"=>",u),u}if(t){if(e instanceof s.COPY&&void 0!==t.document)return e.clone_operation(this,t.document);if(this instanceof r.SET)return n&&n("rebase",this,"on",e,"=>",this),this;if(e instanceof r.SET)return n&&n("rebase",this,"on",e,"=>",new r.NO_OP),new r.NO_OP;throw new Error("Rebase failed between "+this.inspect()+" and "+e.inspect()+".")}return null},t.createRandomValue=function(e){var n=[];if(n.push(null),n.push(!1),n.push(!0),n.push(1e3*Math.floor(Math.random()-.5)),n.push(Math.random()-.5),n.push(1e3*(Math.random()-.5)),n.push(Math.random().toString(36).substring(7)),Math.random()n?1:0;if("string"==typeof e)return e.localeCompare(n);if(Array.isArray(e)){var r=t.cmp(e.length,n.length);if(0!=r)return r;for(var o=0;o=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),p(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function f(e,t){return e}function p(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return m(o)||(o=p(e,o,r)),o}var i=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var a=Object.keys(n),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),P(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(n);if(0===a.length){if(_(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(w(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(b(n))return e.stylize(Date.prototype.toString.call(n),"date");if(P(n))return l(n)}var f,O="",A=!1,T=["{","}"];(h(n)&&(A=!0,T=["[","]"]),_(n))&&(O=" [Function"+(n.name?": "+n.name:"")+"]");return w(n)&&(O=" "+RegExp.prototype.toString.call(n)),b(n)&&(O=" "+Date.prototype.toUTCString.call(n)),P(n)&&(O=" "+l(n)),0!==a.length||A&&0!=n.length?r<0?w(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),f=A?function(e,t,n,r,o){for(var i=[],a=0,s=t.length;a=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(f,O,T)):T[0]+O+T[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,n,r,o,i){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),M(r,o)||(a="["+o+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?p(e,u.value,null):p(e,u.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),v(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function h(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function m(e){return"string"==typeof e}function v(e){return void 0===e}function w(e){return O(e)&&"[object RegExp]"===A(e)}function O(e){return"object"==typeof e&&null!==e}function b(e){return O(e)&&"[object Date]"===A(e)}function P(e){return O(e)&&("[object Error]"===A(e)||e instanceof Error)}function _(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(v(i)&&(i=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!a[e])if(new RegExp("\\b"+e+"\\b","i").test(i)){var n=r.pid;a[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else a[e]=function(){};return a[e]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=w,t.isObject=O,t.isDate=b,t.isError=P,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(22);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),S[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=n(21),t._extend=function(e,t){if(!t||!O(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,n(8),n(23))},function(e,t,n){var r=Array.prototype.slice,o=n(17),i=n(16),a=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:function(e,t,n){var f,p;if(s(e)||s(t))return!1;if(e.prototype!==t.prototype)return!1;if(i(e))return!!i(t)&&(e=r.call(e),t=r.call(t),a(e,t,n));if(u(e)){if(!u(t))return!1;if(e.length!==t.length)return!1;for(f=0;f=0;f--)if(l[f]!=c[f])return!1;for(f=l.length-1;f>=0;f--)if(p=l[f],!a(e[p],t[p],n))return!1;return typeof e==typeof t}(e,t,n))};function s(e){return null===e||void 0===e}function u(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}},function(e,t,n){var r=n(1),o=n(2),i=n(0),a=n(6).MISSING;t.module_name="values",t.NO_OP=function(){Object.freeze(this)},t.NO_OP.prototype=Object.create(i.BaseOperation.prototype),i.add_op(t.NO_OP,t,"NO_OP"),t.SET=function(e){this.value=e,Object.freeze(this)},t.SET.prototype=Object.create(i.BaseOperation.prototype),i.add_op(t.SET,t,"SET"),t.MATH=function(e,t){if(this.operator=e,this.operand=t,("add"==this.operator||"mult"==this.operator)&&"number"!=typeof this.operand)throw new Error("MATH[add] and MATH[mult]'s operand must be a number.");if(("and"==this.operator||"or"==this.operator||"xor"==this.operator)&&!Number.isInteger(this.operand)&&"boolean"!=typeof this.operand)throw new Error("MATH[and] and MATH[or] and MATH[xor]'s operand must be a boolean or integer.");if("not"==this.operator&&null!==this.operand)throw new Error("MATH[not]'s operand must be null --- it is not used.");if("rot"==this.operator){if(!Array.isArray(this.operand)||2!=this.operand.length||!Number.isInteger(this.operand[0])||!Number.isInteger(this.operand[1]))throw new Error("MATH[rot] operand must be an array with two integer elements.");if(this.operand[1]<=1)throw new Error("MATH[rot]'s second operand, the modulus, must be greater than one.");if(this.operand[0]>=Math.abs(this.operand[1]))throw new Error("MATH[rot]'s first operand, the increment, must be less than its second operand, the modulus.")}Object.freeze(this)},t.MATH.prototype=Object.create(i.BaseOperation.prototype),i.add_op(t.MATH,t,"MATH"),t.NO_OP.prototype.inspect=function(e){return""},t.NO_OP.prototype.internalToJSON=function(e,t){},t.NO_OP.internalFromJSON=function(e,n,r){return new t.NO_OP},t.NO_OP.prototype.apply=function(e){return e},t.NO_OP.prototype.simplify=function(){return this},t.NO_OP.prototype.drilldown=function(e){return new values.NO_OP},t.NO_OP.prototype.inverse=function(e){return this},t.NO_OP.prototype.atomic_compose=function(e){return e},t.NO_OP.prototype.rebase_functions=[[i.BaseOperation,function(e,t){return[this,e]}]],t.NO_OP.prototype.get_length_change=function(e){return 0},t.NO_OP.prototype.decompose=function(e,t){return[this,this]},t.SET.prototype.inspect=function(e){return r.format("",function(e){return e===a?"~":r.format("%j",e)}(this.value))},t.SET.prototype.internalToJSON=function(e,t){this.value===a?e.value_missing=!0:e.value=this.value},t.SET.internalFromJSON=function(e,n,r){return e.value_missing?new t.SET(a):new t.SET(e.value)},t.SET.prototype.apply=function(e){return this.value},t.SET.prototype.simplify=function(){return this},t.SET.prototype.drilldown=function(e){if("object"==typeof this.value&&Array.isArray(this.value)){if(!Number.isInteger(e)||e<0)throw new Error("Cannot drilldown() on array with non-negative-integer ("+typeof e+").");return e>=this.value.length?new t.SET(a):new t.SET(this.value[e])}if("object"==typeof this.value&&!Array.isArray(this.value)){if("string"!=typeof e)throw new Error("Cannot drilldown() on object with non-string ("+typeof e+").");return e in this.value?new t.SET(this.value[e]):new t.SET(a)}throw new Error("Cannot drilldown() because document data type changed to "+typeof this.value+".")},t.SET.prototype.inverse=function(e){return new t.SET(e)},t.SET.prototype.atomic_compose=function(e){return new t.SET(e.apply(this.value)).simplify()},t.SET.prototype.rebase_functions=[[t.SET,function(e,n){return o(this.value,e.value,{strict:!0})?[new t.NO_OP,new t.NO_OP]:n&&i.cmp(this.value,e.value)<0?[new t.NO_OP,new t.SET(e.value)]:null}],[t.MATH,function(e,n){return[this,new t.NO_OP]}]],t.SET.prototype.get_length_change=function(e){if("string"==typeof this.value||Array.isArray(this.value))return this.value.length-e;throw new Error("not applicable: new value is of type "+typeof this.value)},t.SET.prototype.decompose=function(e,n){if("string"!=typeof this.value&&!Array.isArray(this.value))throw new Error("invalid value type for call");return e?[new t.SET(this.value.slice(0,n)),new t.SET(this.value.slice(n))]:[new t.SET(this.value.slice(0,0)),this]},t.MATH.prototype.inspect=function(e){return r.format("",this.operator,"number"!=typeof this.operand||"and"!=this.operator&&"or"!=this.operator&&"xor"!=this.operator?r.format("%j",this.operand):"0x"+this.operand.toString(16))},t.MATH.prototype.internalToJSON=function(e,t){e.operator=this.operator,e.operand=this.operand},t.MATH.internalFromJSON=function(e,n,r){return new t.MATH(e.operator,e.operand)},t.MATH.prototype.apply=function(e){if("number"==typeof e){if("add"==this.operator)return e+this.operand;if("mult"==this.operator)return e*this.operand;if(Number.isInteger(e)){if("rot"==this.operator)return(e+this.operand[0])%this.operand[1];if("and"==this.operator)return e&this.operand;if("or"==this.operator)return e|this.operand;if("xor"==this.operator)return e^this.operand;if("not"==this.operator)return~e}throw new Error("MATH operator "+this.operator+" cannot apply to "+e+".")}if("boolean"==typeof e){if("and"==this.operator)return e&&this.operand;if("or"==this.operator)return e||this.operand;if("xor"==this.operator)return!!(e^this.operand);if("not"==this.operator)return!e;throw new Error("MATH operator "+this.operator+" does not apply to boolean values.")}throw new Error("MATH operations only apply to number and boolean values, not "+i.type_name(e)+".")},t.MATH.prototype.simplify=function(){return"add"==this.operator&&0==this.operand?new t.NO_OP:"rot"==this.operator&&0==this.operand[0]?new t.NO_OP:"mult"==this.operator&&1==this.operand?new t.NO_OP:"and"==this.operator&&0===this.operand?new t.SET(0):"and"==this.operator&&!1===this.operand?new t.SET(!1):"or"==this.operator&&0===this.operand?new t.NO_OP:"or"==this.operator&&!1===this.operand?new t.NO_OP:"xor"==this.operator&&0==this.operand?new t.NO_OP:this},t.MATH.prototype.drilldown=function(e){throw new Error("Cannot drilldown() because document data type changed (MATH operation implies the wrong data type).")},t.MATH.prototype.inverse=function(e){return"add"==this.operator?new t.MATH("add",-this.operand):"rot"==this.operator?new t.MATH("rot",[-this.operand[0],this.operand[1]]):"mult"==this.operator?new t.MATH("mult",1/this.operand):"and"==this.operator?new t.MATH("or",e&~this.operand):"or"==this.operator?new t.MATH("xor",~e&this.operand):"xor"==this.operator?this:"not"==this.operator?this:void 0},t.MATH.prototype.atomic_compose=function(e){if(e instanceof t.MATH){if(this.operator==e.operator&&"add"==this.operator)return new t.MATH("add",this.operand+e.operand).simplify();if(this.operator==e.operator&&"rot"==this.operator&&this.operand[1]==e.operand[1])return new t.MATH("rot",[this.operand[0]+e.operand[0],this.operand[1]]).simplify();if(this.operator==e.operator&&"mult"==this.operator)return new t.MATH("mult",this.operand*e.operand).simplify();if(this.operator==e.operator&&"and"==this.operator&&typeof this.operand==typeof e.operand&&"number"==typeof this.operand)return new t.MATH("and",this.operand&e.operand).simplify();if(this.operator==e.operator&&"and"==this.operator&&typeof this.operand==typeof e.operand&&"boolean"==typeof this.operand)return new t.MATH("and",this.operand&&e.operand).simplify();if(this.operator==e.operator&&"or"==this.operator&&typeof this.operand==typeof e.operand&&"number"==typeof this.operand)return new t.MATH("or",this.operand|e.operand).simplify();if(this.operator==e.operator&&"or"==this.operator&&typeof this.operand==typeof e.operand&&"boolean"==typeof this.operand)return new t.MATH("or",this.operand||e.operand).simplify();if(this.operator==e.operator&&"xor"==this.operator&&typeof this.operand==typeof e.operand&&"number"==typeof this.operand)return new t.MATH("xor",this.operand^e.operand).simplify();if(this.operator==e.operator&&"xor"==this.operator&&typeof this.operand==typeof e.operand&&"boolean"==typeof this.operand)return new t.MATH("xor",!!(this.operand^e.operand)).simplify();if(this.operator==e.operator&&"not"==this.operator)return new t.NO_OP;if("and"==this.operator&&"or"==e.operator&&this.operand===e.operand)return new t.SET(this.operand);if("or"==this.operator&&"xor"==e.operator&&this.operand===e.operand&&"number"==typeof this.operand)return new t.MATH("and",~this.operand);if("or"==this.operator&&"xor"==e.operator&&this.operand===e.operand&&"boolean"==typeof this.operand)return new t.MATH("and",!this.operand)}return null},t.MATH.prototype.rebase_functions=[[t.MATH,function(e,n){return this.operator!=e.operator||"rot"==this.operator&&this.operand[1]!=e.operand[1]?n&&"document"in n&&i.cmp([this.operator,this.operand],[e.operator,e.operand])<0?[new t.SET(this.compose(e).apply(n.document)),e]:null:[this,e]}]],t.createRandomOp=function(e,n){var r=[];if(r.push(function(){return new t.NO_OP}),r.push(function(){return new t.SET(e)}),"string-elem"!=n&&"string"!=n&&r.push(function(){return new t.SET(i.createRandomValue())}),"object"==n&&r.push(function(){return new t.SET(a)}),"boolean"==typeof e&&r.push(function(){return new t.SET(!e)}),"number"==typeof e&&(Number.isInteger(e)?r.push(function(){return new t.SET(e+Math.floor(100*(Math.random()+.5)))}):r.push(function(){return new t.SET(e*(Math.random()+.5))})),("string"==typeof e||Array.isArray(e))&&"string-elem"!=n){if(e.length>0&&r.push(function(){return new t.SET(e.slice(0,0))}),e.length>=1&&(r.push(function(){return new t.SET(e.slice(Math.floor(Math.random()*(e.length-1)),e.length))}),r.push(function(){return new t.SET(e.slice(0,Math.floor(Math.random()*(e.length-1))))})),e.length>=2){var o=Math.floor(Math.random()*e.length-1),s=Math.floor(Math.random()*(e.length-o));r.push(function(){return new t.SET(e.slice(o,o+s))})}if(e.length>0){function u(e,t){return e instanceof String?e+t:e.concat(t)}r.push(function(){return new t.SET(u(e.slice(0,1+Math.floor(Math.random()*(e.length-1))),e))}),r.push(function(){return new t.SET(u(e,e.slice(0,1+Math.floor(Math.random()*(e.length-1)))))}),r.push(function(){return new t.SET(function(e,t,n){return e instanceof String?e+t+n:e.concat(t).concat(n)}(e.slice(0,1+Math.floor(Math.random()*(e.length-1))),e,e.slice(0,1+Math.floor(Math.random()*(e.length-1)))))})}else"string"==typeof e?r.push(function(){return new t.SET((Math.random()+"").slice(2))}):Array.isArray(e)&&r.push(function(){return new t.SET([null,null,null].map(function(){return Math.random()}))})}if("string"==typeof e&&(e!=e.split("").reverse().join("")&&r.push(function(){return new t.SET(e.split("").reverse().join(""))}),e.length>0)){for(var f="",p=0;p1&&r.push(function(){return new t.MATH("rot",[1,Math.min(13,e)])}),r.push(function(){return new t.MATH("and",241)}),r.push(function(){return new t.MATH("or",241)}),r.push(function(){return new t.MATH("xor",241)}),r.push(function(){return new t.MATH("not",null)})):(r.push(function(){return new t.MATH("add",100*(Math.random()-.25))}),r.push(function(){return new t.MATH("mult",Math.exp(Math.random()+.5))}))),"boolean"==typeof e&&(r.push(function(){return new t.MATH("and",!0)}),r.push(function(){return new t.MATH("and",!1)}),r.push(function(){return new t.MATH("or",!0)}),r.push(function(){return new t.MATH("or",!1)}),r.push(function(){return new t.MATH("xor",!0)}),r.push(function(){return new t.MATH("xor",!1)}),r.push(function(){return new t.MATH("not",null)})),r[Math.floor(Math.random()*r.length)]()}},function(e,t,n){"use strict"; /*! * shallow-clone * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var r=n(7),o=n(20),i=n(18);function a(e){var t=i(e);return a.hasOwnProperty(t)?a[t](e):e}a.array=function(e){return e.slice()},a.date=function(e){return new Date(+e)},a.object=function(e){return r(e)?o({},e):e},a.regexp=function(e){var t="";return t+=e.multiline?"m":"",t+=e.global?"g":"",t+=e.ignorecase?"i":"",new RegExp(e.source,t)},e.exports=a},function(e,t,n){var r=n(1),o=n(4),i=n(0),a=n(3);t.module_name="lists",t.LIST=function(e){if(!Array.isArray(e))throw new Error("Argument must be an array.");e.forEach(function(e){if(!(e instanceof i.BaseOperation))throw new Error("Argument must be an array containing operations (found "+e+").")}),this.ops=e,Object.freeze(this)},t.LIST.prototype=Object.create(i.BaseOperation.prototype),i.add_op(t.LIST,t,"LIST"),t.LIST.prototype.inspect=function(e){return r.format("",this.ops.map(function(t){return t.inspect(e-1)}).join(", "))},t.LIST.prototype.visit=function(e){var n=new t.LIST(this.ops.map(function(t){return t.visit(e)}));return e(n)||n},t.LIST.prototype.internalToJSON=function(e,t){e.ops=this.ops.map(function(e){return e.toJSON(void 0,t)})},t.LIST.internalFromJSON=function(e,n,r){var o=e.ops.map(function(e){return i.opFromJSON(e,n,r)});return new t.LIST(o)},t.LIST.prototype.apply=function(e){for(var t=0;t0&&!o.isNoOp();){var i=n[n.length-1].atomic_compose(o);if(!i)break;n.pop(),o=i}o.isNoOp()||n.push(o)}return 0==n.length?new a.NO_OP:1==n.length?n[0]:new t.LIST(n)},t.LIST.prototype.inverse=function(e){var n=[];return this.ops.forEach(function(t){n.push(t.inverse(e)),e=t.apply(e)}),n.reverse(),new t.LIST(n)},t.LIST.prototype.atomic_compose=function(e){if(0==this.ops.length)return e;if(e instanceof t.LIST)return 0==e.ops.length?this:new t.LIST(this.ops.concat(e.ops));var n=this.ops.slice();return n.push(e),new t.LIST(n)},t.rebase=function(e,n,r,s){e=e.simplify(),n=n.simplify();var u=function e(t,n,r,s){if(0==n.length||0==t.length)return n;if(1==n.length&&1==t.length){var u=n[0].rebase(t[0],r,s);return u?u instanceof i.NO_OP?[]:u instanceof i.LIST?u.ops:[u]:null}if(s){s("rebasing",n,"on",t,r?"conflictless":"","document"in r?JSON.stringify(r.document):"","...");var f=s;s=function(){var e=[">"].concat(Array.from(arguments));f.apply(null,e)}}if(1==t.length){if(t[0]instanceof a.NO_OP)return n;var p=n.slice(0,1),l=n.slice(1),c=e(t,p,r,s);if(null==c)return null;var h=e(p,t,r,s);if(null==h)return null;var d=null;r&&"document"in(d=o(r))&&(d.document=p[0].apply(d.document));var g=e(h,l,d,s);return null==g?null:c.concat(g)}r=r?o(r):null;for(var y=0;y",t.join(", "))},t.APPLY.prototype.visit=function(e){var n={};for(var r in this.ops)n[r]=this.ops[r].visit(e);var o=new t.APPLY(n);return e(o)||o},t.APPLY.prototype.internalToJSON=function(e,t){for(var n in e.ops={},this.ops)e.ops[n]=this.ops[n].toJSON(void 0,t)},t.APPLY.internalFromJSON=function(e,n,r){var o={};for(var a in e.ops)o[a]=i.opFromJSON(e.ops[a],n,r);return new t.APPLY(o)},t.APPLY.prototype.apply=function(e){var n={};for(var r in e)n[r]=e[r];for(var o in this.ops){var i=this.ops[o].apply(n[o],[n,o]);i===t.MISSING?delete n[o]:n[o]=i}return n},t.APPLY.prototype.simplify=function(){var e={},n=!1;for(var r in this.ops)e[r]=this.ops[r].simplify(),e[r]instanceof a.NO_OP?delete e[r]:n=!0;return n?new t.APPLY(e):new a.NO_OP},t.APPLY.prototype.inverse=function(e){var n={};for(var r in this.ops)n[r]=this.ops[r].inverse(r in e?e[r]:t.MISSING);return new t.APPLY(n)},t.APPLY.prototype.atomic_compose=function(e){if(e instanceof t.APPLY){var n=o(this.ops);for(var r in e.ops)if(r in n){var i=n[r].compose(e.ops[r]);i instanceof a.NO_OP?delete n[r]:n[r]=i}else n[r]=e.ops[r];return new t.APPLY(n).simplify()}return null},t.APPLY.prototype.rebase_functions=[[t.APPLY,function(e,n){function r(e){if(!(n&&"document"in n))return n;var r=o(n);return e in n.document?r.document=n.document[e]:r.document=t.MISSING,r}var i={};for(var a in this.ops)if(i[a]=this.ops[a],a in e.ops&&(i[a]=i[a].rebase(e.ops[a],r(a))),null===i[a])return null;var s={};for(var a in e.ops)if(s[a]=e.ops[a],a in this.ops&&(s[a]=s[a].rebase(this.ops[a],r(a))),null===s[a])return null;return[new t.APPLY(i).simplify(),new t.APPLY(s).simplify()]}]],t.APPLY.prototype.drilldown=function(e){if("string"!=typeof e)throw new Error("Cannot drilldown() on object with non-string ("+typeof e+").");return e in this.ops?this.ops[e]:new a.NO_OP},t.createRandomOp=function(e,n){var r=[];return r.push(function(){return new t.PUT("k"+Math.floor(1e3*Math.random()),i.createRandomValue())}),Object.keys(e).forEach(function(t){r.push(function(){return i.createRandomOp(e[t],"object")})}),r[Math.floor(Math.random()*r.length)]()}},function(e,t,n){"use strict"; /*! * is-extendable * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */e.exports=function(e){return void 0!==e&&null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";e.exports=Object.assign||function(e,t){for(var n,r,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i=a&&d>=s)return p[l]=r({},f),i(p,e,t)}p[l]=r({},f)}throw Error("Unreachable diff path reached")};var r=n(9);function o(e,t){return e===t}function i(e,t,n){for(var r=[],o={x:t.length,y:n.length},i=e.length-1;o.x>0||o.y>0;i-=1){for(var s=e[i],u=o.x-o.y,f=s[u],p=u===-i||u!==i&&s[u-1]d;)a(r,t[f-1],!1,!1),f-=1;if(h<0)break;p?a(r,n[h],!0,!1):a(r,t[c],!1,!0),o.x=c,o.y=h}return r.reverse()}function a(e,t,n,r){var o=e[e.length-1];o&&o.added===n&&o.removed===r?o.items.unshift(t):e.push({items:[t],added:n,removed:r})}},function(e,t,n){ /*! diff v3.5.0 Software License Agreement (BSD License) Copyright (c) 2009-2015, Kevin Decker All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Kevin Decker nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @license */ !function(t,n){e.exports=n()}(0,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";t.__esModule=!0,t.canonicalize=t.convertChangesToXML=t.convertChangesToDMP=t.merge=t.parsePatch=t.applyPatches=t.applyPatch=t.createPatch=t.createTwoFilesPatch=t.structuredPatch=t.diffArrays=t.diffJson=t.diffCss=t.diffSentences=t.diffTrimmedLines=t.diffLines=t.diffWordsWithSpace=t.diffWords=t.diffChars=t.Diff=void 0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(1)),o=n(2),i=n(3),a=n(5),s=n(6),u=n(7),f=n(8),p=n(9),l=n(10),c=n(11),h=n(13),d=n(14),g=n(16),y=n(17);t.Diff=r.default,t.diffChars=o.diffChars,t.diffWords=i.diffWords,t.diffWordsWithSpace=i.diffWordsWithSpace,t.diffLines=a.diffLines,t.diffTrimmedLines=a.diffTrimmedLines,t.diffSentences=s.diffSentences,t.diffCss=u.diffCss,t.diffJson=f.diffJson,t.diffArrays=p.diffArrays,t.structuredPatch=d.structuredPatch,t.createTwoFilesPatch=d.createTwoFilesPatch,t.createPatch=d.createPatch,t.applyPatch=l.applyPatch,t.applyPatches=l.applyPatches,t.parsePatch=c.parsePatch,t.merge=h.merge,t.convertChangesToDMP=g.convertChangesToDMP,t.convertChangesToXML=y.convertChangesToXML,t.canonicalize=f.canonicalize},function(e,t){"use strict";function n(){}function r(e,t,n,r,o){for(var i=0,a=t.length,s=0,u=0;ie.length?n:e}),f.value=e.join(l)}else f.value=e.join(n.slice(s,s+f.count));s+=f.count,f.added||(u+=f.count)}}var c=t[a-1];return a>1&&"string"==typeof c.value&&(c.added||c.removed)&&e.equals("",c.value)&&(t[a-2].value+=c.value,t.pop()),t}function o(e){return{newPos:e.newPos,components:e.components.slice(0)}}t.__esModule=!0,t.default=n,n.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.callback;"function"==typeof n&&(i=n,n={}),this.options=n;var a=this;function s(e){return i?(setTimeout(function(){i(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var u=(t=this.removeEmpty(this.tokenize(t))).length,f=e.length,p=1,l=u+f,c=[{newPos:-1,components:[]}],h=this.extractCommon(c[0],t,e,0);if(c[0].newPos+1>=u&&h+1>=f)return s([{value:this.join(t),count:t.length}]);function d(){for(var n=-1*p;n<=p;n+=2){var i=void 0,l=c[n-1],h=c[n+1],d=(h?h.newPos:0)-n;l&&(c[n-1]=void 0);var g=l&&l.newPos+1=u&&d+1>=f)return s(r(a,i.components,t,e,a.useLongestToken));c[n]=i}else c[n]=void 0}p++}if(i)!function e(){setTimeout(function(){if(p>l)return i();d()||e()},0)}();else for(;p<=l;){var g=d();if(g)return g}},pushComponent:function(e,t,n){var r=e[e.length-1];r&&r.added===t&&r.removed===n?e[e.length-1]={count:r.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,r){for(var o=t.length,i=n.length,a=e.newPos,s=a-r,u=0;a+12&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof t&&(t=(0,r.parsePatch)(t)),Array.isArray(t)){if(t.length>1)throw new Error("applyPatch only works with a single input.");t=t[0]}var i=e.split(/\r\n|[\n\v\f\r\x85]/),a=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],s=t.hunks,u=n.compareLine||function(e,t,n,r){return t===r},f=0,p=n.fuzzFactor||0,l=0,c=0,h=void 0,d=void 0;function g(e,t){for(var n=0;n0?r[0]:" ",a=r.length>0?r.substr(1):r;if(" "===o||"-"===o){if(!u(t+1,i[t],o,a)&&++f>p)return!1;t++}}return!0}for(var y=0;y0?M[0]:" ",N=M.length>0?M.substr(1):M,k=A.linedelimiters[S];if(" "===E)T++;else if("-"===E)i.splice(T,1),a.splice(T,1);else if("+"===E)i.splice(T,0,N),a.splice(T,0,k),T++;else if("\\"===E){var j=A.lines[S-1]?A.lines[S-1][0]:null;"+"===j?h=!0:"-"===j&&(d=!0)}}}if(h)for(;!i[i.length-1];)i.pop(),a.pop();else d&&(i.push(""),a.push("\n"));for(var x=0;x1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(/\r\n|[\n\v\f\r\x85]/),r=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],o=[],i=0;function a(){var e={};for(o.push(e);i0?p(s.lines.slice(-u.context)):[],c-=d.length,h-=d.length)}(a=d).push.apply(a,o(r.map(function(e){return(t.added?"+":"-")+e}))),t.added?y+=r.length:g+=r.length}else{if(c)if(r.length<=2*u.context&&e=f.length-2&&r.length<=u.context){var b=/\n$/.test(n),P=/\n$/.test(i);0!=r.length||b?b&&P||d.push("\\ No newline at end of file"):d.splice(O.oldLines,0,"\\ No newline at end of file")}l.push(O),c=0,h=0,d=[]}g+=r.length,y+=r.length}},v=0;ve.length)return!1;for(var n=0;n/g,">")).replace(/"/g,""")}t.__esModule=!0,t.convertChangesToXML=function(e){for(var t=[],r=0;r"):o.removed&&t.push(""),t.push(n(o.value)),o.added?t.push(""):o.removed&&t.push("")}return t.join("")}}])})},function(e,t,n){var r=n(2),o=n(0);function i(e,t,a){function s(e){if(void 0===e)throw new Error("Illegal argument: undefined passed to diff");if(null===e)return"null";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return typeof e;if(Array.isArray(e))return"array";if("object"!=typeof e)throw new Error("Illegal argument: "+typeof e+" passed to diff");return"object"}var u=s(e),f=s(t);return r(e,t,{strict:!0})?{op:new o.NO_OP,pct:0,size:JSON.stringify(e).length}:"string"==u&&"string"==f?function(e,t,r){var i=n(11),a="Chars";r.words&&(a="Words");r.lines&&(a="Lines");r.sentences&&(a="Sentences");var s=0,u=0,f=0,p=i["diff"+a](e,t).map(function(e){if(s+=e.value.length,e.added||e.removed){u+=e.value.length;var t=0,n="";e.removed&&(t=e.value.length),e.added&&(n=e.value);var r={offset:f,length:t,op:new o.SET(n)};return f=0,r}return f+=e.value.length,null}).filter(function(e){return null!=e});return{op:new o.PATCH(p).simplify(),pct:(u+1)/(s+1),size:s}}(e,t,a):"array"==u&&"array"==f?function(e,t,r){var a=n(10),s=e.map(function(e,t){return t}),u=t.map(function(e,t){return t}),f=[],p=0,l=0,c=0;return function n(s,u,h){var d=[],g=0,y=0;a(s,u,function(n,o){return i(e[n],t[o],r).pct<=h}).forEach(function(e){if(e.removed||e.added)0!=d.length&&"equal"!=d[d.length-1].type||d.push({type:"unequal",ai:[],bi:[]}),e.added?(d[d.length-1].bi=d[d.length-1].bi.concat(e.items),y+=e.items.length):e.removed&&(d[d.length-1].ai=d[d.length-1].ai.concat(e.items),g+=e.items.length);else{if(g+e.items.length>s.length)throw new Error("out of range");if(y+e.items.length>u.length)throw new Error("out of range");d.push({type:"equal",ai:s.slice(g,g+e.items.length),bi:u.slice(y,y+e.items.length)}),g+=e.items.length,y+=e.items.length}}),d.forEach(function(a){if(h<1&&a.ai.length>0&&a.bi.length>0&&(h>0||"unequal"==a.type))n(a.ai,a.bi,(h+1.1)/2);else{if(a.ai.length!=a.bi.length){var s=new o.SPLICE(c,a.ai.length,a.bi.map(function(e){return t[e]}));f.push(s);var u=JSON.stringify(a.ai.map(function(t){return e[t]}))+JSON.stringify(a.bi.map(function(e){return t[e]}));u=u.length/2,p+=u,l+=u}else for(var d=0;d and released with the kind permission of * NetDev. * * Copyright 2011-2013 Thomas Parslow. All rights reserved. * Permission is hereby granted,y free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Implements the JSON Patch IETF RFC 6902 as specified at: * * http://tools.ietf.org/html/rfc6902 * * Also implements the JSON Pointer IETF RFC 6901 as specified at: * * http://tools.ietf.org/html/rfc6901 * */ !function(e){var t,n,r,o;function i(e){Error.call(this,e),this.message=e}function a(e){Error.call(this,e),this.message=e}function s(e,t){!function(e){var t,n;if(!e.op)throw new i("Operation missing!");if(!r.hasOwnProperty(e.op))throw new i("Invalid operation!");if(!("path"in e))throw new i("Path missing!");for(n=r[e.op],t=0;te.length)throw new a("Add operation must not attempt to create a sparse array!");e.splice(n,0,t)}else e[n]=t;return e},n)},n.prototype.remove=function(e,t){if(0!==this.length)return this._action(e,function(e,t){if(!Object.hasOwnProperty.call(e,t))throw new a("Remove operation must point to an existing value!");return o(e)?e.splice(t,1):delete e[t],e},t)},n.prototype.replace=function(e,t,n){return 0===this.length?t:this._action(e,function(e,n){if(!Object.hasOwnProperty.call(e,n))throw new a("Replace operation must point to an existing value!");return o(e)?e.splice(n,1,t):e[n]=t,e},n)},n.prototype.get=function(e){var t;return 0===this.length?e:(this._action(e,function(e,n){if(!Object.hasOwnProperty.call(e,n))throw new a("Path not found in document");return t=e[n],e},!0),t)},n.prototype.subsetOf=function(e){if(this.length<=e.length)return!1;for(var t=0;t=0;)n="string"==typeof r[i]?new o.APPLY(r[i],n):new o.ATINDEX(r[i],n),i--;return n}function f(e){var t=[];if("string"==typeof e||Array.isArray(e)){if(0==e.length)return t;var n=Math.floor(Math.random()*e.length);t.push(""+n);try{Math.random()<.5&&"string"!=typeof e&&(t=t.concat(f(e[n])))}catch(e){}}else{if("object"!=typeof e||null===e)throw new Error("COPY cannot apply to this document type: "+e);var r=Object.keys(e);if(0==r.length)return t;var o=r[Math.floor(Math.random()*r.length)];t.push(o);try{Math.random()<.5&&(t=t.concat(f(e[o])))}catch(e){}}return t}t.module_name="copies",t.COPY=function(e){if(console.log(e),!Array.isArray(e))throw new Error("argument must be a list");this.pathpairs=e.map(function(e){if(!Array.isArray(e)||2!=e.length)throw new Error("each element in pathpairs must be an array of two string elements");if(e[0]instanceof i&&e[1]instanceof i)return e;if("string"!=typeof e[0]||"string"!=typeof e[1])throw new Error("each element in pathpairs must be an array of two strings");if(e[0]==e[1])throw new Error("can't copy a path to itself");return[new i(e[0]),new i(e[1])]}),Object.freeze(this)},t.COPY.prototype=Object.create(o.BaseOperation.prototype),o.add_op(t.COPY,t,"COPY"),t.COPY.prototype.inspect=function(e){return r.format("",this.pathpairs.map(function(e){return a(e[0])+" => "+a(e[1])}).join(", "))},t.COPY.prototype.visit=function(e){return e(this)||this},t.COPY.prototype.internalToJSON=function(e,t){e.pathpairs=this.pathpairs.map(function(e){return[a(e[0]),a(e[1])]})},t.COPY.internalFromJSON=function(e,n,r){return new t.COPY(e.pathpairs)},t.COPY.prototype.apply=function(e){return this.pathpairs.forEach(function(t){var n=t[0].get(e);e=t[1].replace(e,n)}),e},t.COPY.prototype.simplify=function(e){return this},t.COPY.prototype.inverse=function(e){return new o.LIST(this.pathpairs.map(function(t){return u(t[1],e,new o.SET(t[1].get(e)))}))},t.COPY.prototype.atomic_compose=function(e){if(e instanceof t.COPY)return new t.COPY(this.pathpairs.concat(e.pathpairs)).simplify()},t.rebase=function(e,t,n,r){},t.COPY.prototype.clone_operation=function(e,t){var n=[e];return this.pathpairs.forEach(function(r){var o=function(e,t,n){for(var r=s(e,t),o=0;o0){var l=(c=s.old_hunks.shift()).op.decompose(!1,f);s.old_hunks.unshift({offset:0,length:c.length-f,op:l[1]}),s.old_hunks.unshift({offset:c.offset,length:f,op:l[0]}),s.take(u)}else if(f<0){l=(c=u.old_hunks.shift()).op.decompose(!1,-f);u.old_hunks.unshift({offset:0,length:c.length+f,op:l[1]}),u.old_hunks.unshift({offset:c.offset,length:-f,op:l[0]}),u.take(s)}else if(p<0){l=(c=s.old_hunks.shift()).op.decompose(!1,c.length+p);s.old_hunks.unshift({offset:0,length:-p,op:l[1]}),s.old_hunks.unshift({offset:c.offset,length:c.length+p,op:l[0]})}else{if(!(p>0))throw new Error("We thought this line was not reachable.");var c;l=(c=u.old_hunks.shift()).op.decompose(!1,c.length-p);u.old_hunks.unshift({offset:0,length:p,op:l[1]}),u.old_hunks.unshift({offset:c.offset,length:c.length-p,op:l[0]})}}else{var h=r?i(r):null;h&&"document"in h&&(h.document=h.document.slice(s.start(),s.end()));var d=s.old_hunks[0].op.rebase(u.old_hunks[0].op,h),g=u.old_hunks[0].op.rebase(s.old_hunks[0].op,h);if(null==d||null==g)return null;s.old_hunks[0]={offset:s.old_hunks[0].offset,length:s.old_hunks[0].length,dlength:u.old_hunks[0].op.get_length_change(u.old_hunks[0].length),op:d},u.old_hunks[0]={offset:u.old_hunks[0].offset,length:u.old_hunks[0].length,dlength:s.old_hunks[0].op.get_length_change(s.old_hunks[0].length),op:g},s.take(u,!0),u.take(s,!0)}}else{if(!r)return null;a.cmp(s.old_hunks[0].op,u.old_hunks[0].op)<0?s.take(u):u.take(s)}return[new t.PATCH(s.new_hunks).simplify(),new t.PATCH(u.new_hunks).simplify()]}t.module_name="sequences",t.PATCH=function(){if("__hmm__"!==arguments[0]){if(1!=arguments.length)throw new Error("Invaid Argument");if(this.hunks=arguments[0],!Array.isArray(this.hunks))throw new Error("Invaid Argument");this.hunks.forEach(function(e){if("number"!=typeof e.offset)throw new Error("Invalid Argument (hunk offset not a number)");if(e.offset<0)throw new Error("Invalid Argument (hunk offset is negative)");if("number"!=typeof e.length)throw new Error("Invalid Argument (hunk length is not a number)");if(e.length<0)throw new Error("Invalid Argument (hunk length is negative)");if(!(e.op instanceof a.BaseOperation))throw new Error("Invalid Argument (hunk operation is not an operation)");if("function"!=typeof e.op.get_length_change)throw new Error("Invalid Argument (hunk operation "+e.op.inspect()+" does not support get_length_change)");if("function"!=typeof e.op.decompose)throw new Error("Invalid Argument (hunk operation "+e.op.inspect()+" does not support decompose)");Object.freeze(e)}),Object.freeze(this)}},t.PATCH.prototype=Object.create(a.BaseOperation.prototype),a.add_op(t.PATCH,t,"PATCH"),t.SPLICE=function(e,n,r){t.PATCH.apply(this,[[{offset:e,length:n,op:new s.SET(r)}]])},t.SPLICE.prototype=new t.PATCH("__hmm__"),t.ATINDEX=function(){var e,n;if(1==arguments.length)n=arguments[0],e=[],Object.keys(n).forEach(function(t){e.push(parseInt(t))}),e.sort();else{if(2!=arguments.length)throw new Error("Invalid Argument");e=[arguments[0]],(n={})[arguments[0]]=arguments[1]}var r=[],o=0;e.forEach(function(e){r.push({offset:e-o,length:1,op:new t.MAP(n[e])}),o=e+1}),t.PATCH.apply(this,[r])},t.ATINDEX.prototype=new t.PATCH("__hmm__"),t.MAP=function(e){if(null==e)throw new Error("Invalid Argument");this.op=e,Object.freeze(this)},t.MAP.prototype=Object.create(a.BaseOperation.prototype),a.add_op(t.MAP,t,"MAP"),t.PATCH.prototype.inspect=function(e){return r.format("",this.hunks.map(function(n){return 1==n.length&&n.op instanceof t.MAP?r.format(" +%d %s",n.offset,n.op.op.inspect(e-1)):r.format(" +%dx%d %s",n.offset,n.length,n.op instanceof s.SET?r.format("%j",n.op.value):n.op.inspect(e-1))}).join(","))},t.PATCH.prototype.visit=function(e){var n=new t.PATCH(this.hunks.map(function(t){var n=i(t);return n.op=n.op.visit(e),n}));return e(n)||n},t.PATCH.prototype.internalToJSON=function(e,t){e.hunks=this.hunks.map(function(e){var n=i(e);return n.op=n.op.toJSON(void 0,t),n})},t.PATCH.internalFromJSON=function(e,n,r){var o=e.hunks.map(function(e){var t=i(e);return t.op=a.opFromJSON(e.op,n,r),t});return new t.PATCH(o)},t.PATCH.prototype.apply=function(e){var t=0,n=e.slice(0,0);return this.hunks.forEach(function(r){if(t+r.offset+r.length>e.length)throw new Error("offset past end of document");n=f(n,e.slice(t,t+r.offset)),t+=r.offset;var o=r.op.apply(e.slice(t,t+r.length));if("string"==typeof e&&"string"!=typeof o)throw new Error("operation yielded invalid substring");if(Array.isArray(e)&&!Array.isArray(o))throw new Error("operation yielded invalid subarray");n=f(n,o),t+=r.length}),n=f(n,e.slice(t))},t.PATCH.prototype.simplify=function(){var e=null;this.hunks.forEach(function(t){t.op instanceof s.SET&&("string"==typeof t.op.value?e="string":Array.isArray(t.op.value)&&(e="array"))});var n=[],r=0;return this.hunks.forEach(function(o){var i=o.op.simplify();if(i.isNoOp())r+=o.offset+o.length;else if(0!=o.length||0!=o.op.get_length_change(o.length))if(n.length>0&&0==o.offset&&0==r&&(n[n.length-1].op instanceof s.SET||n[n.length-1].op instanceof t.MAP&&n[n.length-1].op.op instanceof s.SET)&&(o.op instanceof s.SET||o.op instanceof t.MAP&&o.op.op instanceof s.SET)&&null!=e){function a(t){if(t.op instanceof s.SET)return t.op.value;for(var n=[],r=0;r=0&&f<=0){var p=s.hunks[0].op,l=p.get_length_change(s.hunks[0].length);0==u&&0==f||(p=new t.PATCH([{offset:u,length:s.hunks[0].length,op:p}]));var c=a.hunks[0].op.atomic_compose(p);if(c){a.hunks[0]={offset:a.hunks[0].offset,length:a.hunks[0].length,op:c},s.index+=l,s.skip();continue}}if(u>0){var h;if(0!=(d=a.hunks[0].op.decompose(!0,u))[0].get_length_change(u))throw new Error("Not sure what to do in this case.");h=u,r.push({offset:a.index+a.hunks[0].offset-o,length:h,op:d[0]}),a.index=a.start()+u,o=a.index,a.hunks[0]={offset:0,length:a.hunks[0].length-h,op:d[1]}}else{if(!(u<0))return null;var d=s.hunks[0].op.decompose(!1,-u);r.push({offset:s.index+s.hunks[0].offset-o,length:-u,op:d[0]}),s.index=s.start()+-u,o=s.index,s.hunks[0]={offset:0,length:s.hunks[0].length- -u,op:d[1]}}}return new t.PATCH(r).simplify()}(this,e):null},t.PATCH.prototype.rebase_functions=[[t.PATCH,function(e,t){return p(this,e,t)}]],t.PATCH.prototype.get_length_change=function(e){var t=0;return this.hunks.forEach(function(e){t+=e.op.get_length_change(e.length)}),t},t.MAP.prototype.inspect=function(e){return r.format("",this.op.inspect(e-1))},t.MAP.prototype.visit=function(e){var n=new t.MAP(this.op.visit(e));return e(n)||n},t.MAP.prototype.internalToJSON=function(e,t){e.op=this.op.toJSON(void 0,t)},t.MAP.internalFromJSON=function(e,n,r){return new t.MAP(a.opFromJSON(e.op,n,r))},t.MAP.prototype.apply=function(e){var t;t="string"==typeof e?e.split(/.{0}/):e.slice();for(var n=0;n * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */e.exports=function(e,t,n){for(var r in e)if(!1===t.call(n,e[r],r,e))break}},function(e,t,n){"use strict";var r=n(7),o=n(19);function i(e,t){this[t]=e}e.exports=function(e,t){if(!r(e))throw new TypeError("mixin-object expects the first argument to be an object.");for(var n=arguments.length,a=0;++a1)for(var n=1;n