text: import React,{useContext,createContext,memo,useMemo,useState,useCallback,useRef,Children,useReducer,useEffect}from"react";import PropTypes from"prop-types";function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _extends(){return(_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target}).apply(this,arguments)}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(source,!0).forEach((function(key){_defineProperty(target,key,source[key])})):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(source).forEach((function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}))}return target}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=function(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],excluded.indexOf(key)>=0||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||function(arr,i){if(!(Symbol.iterator in Object(arr)||"[object Arguments]"===Object.prototype.toString.call(arr)))return;var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||_nonIterableRest()}function _toArray(arr){return _arrayWithHoles(arr)||_iterableToArray(arr)||_nonIterableRest()}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(arr)||_iterableToArray(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}var classnames=createCommonjsModule((function(module){
  /*!
    Copyright (c) 2017 Jed Watson.
    Licensed under the MIT License (MIT), see
    http://jedwatson.github.io/classnames
  */
  !function(){var hasOwn={}.hasOwnProperty;function classNames(){for(var classes=[],i=0;i<arguments.length;i++){var arg=arguments[i];if(arg){var argType=typeof arg;if("string"===argType||"number"===argType)classes.push(arg);else if(Array.isArray(arg)&&arg.length){var inner=classNames.apply(null,arg);inner&&classes.push(inner)}else if("object"===argType)for(var key in arg)hasOwn.call(arg,key)&&arg[key]&&classes.push(key)}}return classes.join(" ")}module.exports?(classNames.default=classNames,module.exports=classNames):window.classNames=classNames}()})),ContextType=createContext(),Provider=ContextType.Provider,useDiffSettings=function(){return useContext(ContextType)},first=function(array){return array[0]},last=function(array){return array[array.length-1]},sideToProperty=function(side){return[side+"Start",side+"Lines"]},computeLineNumberFactory=function(side){return"old"===side?function(_ref){var isNormal=_ref.isNormal,isInsert=_ref.isInsert,lineNumber=_ref.lineNumber,oldLineNumber=_ref.oldLineNumber;return isInsert?-1:isNormal?oldLineNumber:lineNumber}:function(_ref2){var isNormal=_ref2.isNormal,isDelete=_ref2.isDelete,lineNumber=_ref2.lineNumber,newLineNumber=_ref2.newLineNumber;return isDelete?-1:isNormal?newLineNumber:lineNumber}},isInHunkFactory=function(startProperty,linesProperty){return function(hunk,lineNumber){var start=hunk[startProperty],end=start+hunk[linesProperty];return lineNumber>=start&&lineNumber<end}},isBetweenHunksFactory=function(startProperty,linesProperty){return function(previousHunk,nextHunk,lineNumber){var start=previousHunk[startProperty]+previousHunk[linesProperty],end=nextHunk[startProperty];return lineNumber>=start&&lineNumber<end}},findChangeByLineNumberFactory=function(side){var computeLineNumber=computeLineNumberFactory(side),findContainerHunk=function(side){var _sideToProperty2=_slicedToArray(sideToProperty(side),2),startProperty=_sideToProperty2[0],linesProperty=_sideToProperty2[1],isInHunk=isInHunkFactory(startProperty,linesProperty);return function(hunks,lineNumber){return hunks.find((function(hunk){return isInHunk(hunk,lineNumber)}))}}(side);return function(hunks,lineNumber){var containerHunk=findContainerHunk(hunks,lineNumber);if(containerHunk)return containerHunk.changes.find((function(change){return computeLineNumber(change)===lineNumber}))}},getCorrespondingLineNumberFactory=function(baseSide){var anotherSide="old"===baseSide?"new":"old",_sideToProperty4=_slicedToArray(sideToProperty(baseSide),2),baseStart=_sideToProperty4[0],baseLines=_sideToProperty4[1],_sideToProperty6=_slicedToArray(sideToProperty(anotherSide),2),correspondingStart=_sideToProperty6[0],correspondingLines=_sideToProperty6[1],baseLineNumber=computeLineNumberFactory(baseSide),correspondingLineNumber=computeLineNumberFactory(anotherSide),isInHunk=isInHunkFactory(baseStart,baseLines),isBetweenHunks=isBetweenHunksFactory(baseStart,baseLines);return function(hunks,lineNumber){var firstHunk=first(hunks);if(lineNumber<firstHunk[baseStart]){var spanFromStart=firstHunk[baseStart]-lineNumber;return firstHunk[correspondingStart]-spanFromStart}var lastHunk=last(hunks);if(lastHunk[baseStart]+lastHunk[baseLines]<=lineNumber){var spanFromEnd=lineNumber-lastHunk[baseStart]-lastHunk[baseLines];return lastHunk[correspondingStart]+lastHunk[correspondingLines]+spanFromEnd}for(var i=0;i<hunks.length;i++){var currentHunk=hunks[i],nextHunk=hunks[i+1];if(isInHunk(currentHunk,lineNumber)){var changeIndex=currentHunk.changes.findIndex((function(change){return baseLineNumber(change)===lineNumber})),change=currentHunk.changes[changeIndex];if(change.isNormal)return correspondingLineNumber(change);var possibleCorrespondingChangeIndex=change.isDelete?changeIndex+1:changeIndex-1,possibleCorrespondingChange=currentHunk.changes[possibleCorrespondingChangeIndex];if(!possibleCorrespondingChange)return-1;var negativeChangeType=change.isInsert?"delete":"insert";return possibleCorrespondingChange.type===negativeChangeType?correspondingLineNumber(possibleCorrespondingChange):-1}if(isBetweenHunks(currentHunk,nextHunk,lineNumber)){var _spanFromEnd=lineNumber-currentHunk[baseStart]-currentHunk[baseLines];return currentHunk[correspondingStart]+currentHunk[correspondingLines]+_spanFromEnd}}throw new Error("Unexpected line position ".concat(lineNumber))}};var _baseFindIndex=function(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1};var _listCacheClear=function(){this.__data__=[],this.size=0};var eq_1=function(value,other){return value===other||value!=value&&other!=other};var _assocIndexOf=function(array,key){for(var length=array.length;length--;)if(eq_1(array[length][0],key))return length;return-1},splice=Array.prototype.splice;var _listCacheDelete=function(key){var data=this.__data__,index=_assocIndexOf(data,key);return!(index<0)&&(index==data.length-1?data.pop():splice.call(data,index,1),--this.size,!0)};var _listCacheGet=function(key){var data=this.__data__,index=_assocIndexOf(data,key);return index<0?void 0:data[index][1]};var _listCacheHas=function(key){return _assocIndexOf(this.__data__,key)>-1};var _listCacheSet=function(key,value){var data=this.__data__,index=_assocIndexOf(data,key);return index<0?(++this.size,data.push([key,value])):data[index][1]=value,this};function ListCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}ListCache.prototype.clear=_listCacheClear,ListCache.prototype.delete=_listCacheDelete,ListCache.prototype.get=_listCacheGet,ListCache.prototype.has=_listCacheHas,ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache;var _stackClear=function(){this.__data__=new _ListCache,this.size=0};var _stackDelete=function(key){var data=this.__data__,result=data.delete(key);return this.size=data.size,result};var _stackGet=function(key){return this.__data__.get(key)};var _stackHas=function(key){return this.__data__.has(key)},_freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,_root=_freeGlobal||freeSelf||Function("return this")(),_Symbol=_root.Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=_Symbol?_Symbol.toStringTag:void 0;var _getRawTag=function(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=void 0;var unmasked=!0}catch(e){}var result=nativeObjectToString.call(value);return unmasked&&(isOwn?value[symToStringTag]=tag:delete value[symToStringTag]),result},nativeObjectToString$1=Object.prototype.toString;var _objectToString=function(value){return nativeObjectToString$1.call(value)},nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;var _baseGetTag=function(value){return null==value?void 0===value?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(value)?_getRawTag(value):_objectToString(value)};var isObject_1=function(value){var type=typeof value;return null!=value&&("object"==type||"function"==type)},asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";var isFunction_1=function(value){if(!isObject_1(value))return!1;var tag=_baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag},_coreJsData=_root["__core-js_shared__"],maskSrcKey=function(){var uid=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var _isMasked=function(func){return!!maskSrcKey&&maskSrcKey in func},funcToString=Function.prototype.toString;var _toSource=function(func){if(null!=func){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""},reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$2=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$1).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _baseIsNative=function(value){return!(!isObject_1(value)||_isMasked(value))&&(isFunction_1(value)?reIsNative:reIsHostCtor).test(_toSource(value))};var _getValue=function(object,key){return null==object?void 0:object[key]};var _getNative=function(object,key){var value=_getValue(object,key);return _baseIsNative(value)?value:void 0},_Map=_getNative(_root,"Map"),_nativeCreate=_getNative(Object,"create");var _hashClear=function(){this.__data__=_nativeCreate?_nativeCreate(null):{},this.size=0};var _hashDelete=function(key){var result=this.has(key)&&delete this.__data__[key];return this.size-=result?1:0,result},HASH_UNDEFINED="__lodash_hash_undefined__",hasOwnProperty$2=Object.prototype.hasOwnProperty;var _hashGet=function(key){var data=this.__data__;if(_nativeCreate){var result=data[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty$2.call(data,key)?data[key]:void 0},hasOwnProperty$3=Object.prototype.hasOwnProperty;var _hashHas=function(key){var data=this.__data__;return _nativeCreate?void 0!==data[key]:hasOwnProperty$3.call(data,key)},HASH_UNDEFINED$1="__lodash_hash_undefined__";var _hashSet=function(key,value){var data=this.__data__;return this.size+=this.has(key)?0:1,data[key]=_nativeCreate&&void 0===value?HASH_UNDEFINED$1:value,this};function Hash(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}Hash.prototype.clear=_hashClear,Hash.prototype.delete=_hashDelete,Hash.prototype.get=_hashGet,Hash.prototype.has=_hashHas,Hash.prototype.set=_hashSet;var _Hash=Hash;var _mapCacheClear=function(){this.size=0,this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}};var _isKeyable=function(value){var type=typeof value;return"string"==type||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value};var _getMapData=function(map,key){var data=map.__data__;return _isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map};var _mapCacheDelete=function(key){var result=_getMapData(this,key).delete(key);return this.size-=result?1:0,result};var _mapCacheGet=function(key){return _getMapData(this,key).get(key)};var _mapCacheHas=function(key){return _getMapData(this,key).has(key)};var _mapCacheSet=function(key,value){var data=_getMapData(this,key),size=data.size;return data.set(key,value),this.size+=data.size==size?0:1,this};function MapCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}MapCache.prototype.clear=_mapCacheClear,MapCache.prototype.delete=_mapCacheDelete,MapCache.prototype.get=_mapCacheGet,MapCache.prototype.has=_mapCacheHas,MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache,LARGE_ARRAY_SIZE=200;var _stackSet=function(key,value){var data=this.__data__;if(data instanceof _ListCache){var pairs=data.__data__;if(!_Map||pairs.length<LARGE_ARRAY_SIZE-1)return pairs.push([key,value]),this.size=++data.size,this;data=this.__data__=new _MapCache(pairs)}return data.set(key,value),this.size=data.size,this};function Stack(entries){var data=this.__data__=new _ListCache(entries);this.size=data.size}Stack.prototype.clear=_stackClear,Stack.prototype.delete=_stackDelete,Stack.prototype.get=_stackGet,Stack.prototype.has=_stackHas,Stack.prototype.set=_stackSet;var _Stack=Stack,HASH_UNDEFINED$2="__lodash_hash_undefined__";var _setCacheAdd=function(value){return this.__data__.set(value,HASH_UNDEFINED$2),this};var _setCacheHas=function(value){return this.__data__.has(value)};function SetCache(values){var index=-1,length=null==values?0:values.length;for(this.__data__=new _MapCache;++index<length;)this.add(values[index])}SetCache.prototype.add=SetCache.prototype.push=_setCacheAdd,SetCache.prototype.has=_setCacheHas;var _SetCache=SetCache;var _arraySome=function(array,predicate){for(var index=-1,length=null==array?0:array.length;++index<length;)if(predicate(array[index],index,array))return!0;return!1};var _cacheHas=function(cache,key){return cache.has(key)},COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;var _equalArrays=function(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength))return!1;var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=!0,seen=bitmask&COMPARE_UNORDERED_FLAG?new _SetCache:void 0;for(stack.set(array,other),stack.set(other,array);++index<arrLength;){var arrValue=array[index],othValue=other[index];if(customizer)var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);if(void 0!==compared){if(compared)continue;result=!1;break}if(seen){if(!_arraySome(other,(function(othValue,othIndex){if(!_cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack)))return seen.push(othIndex)}))){result=!1;break}}else if(arrValue!==othValue&&!equalFunc(arrValue,othValue,bitmask,customizer,stack)){result=!1;break}}return stack.delete(array),stack.delete(other),result},_Uint8Array=_root.Uint8Array;var _mapToArray=function(map){var index=-1,result=Array(map.size);return map.forEach((function(value,key){result[++index]=[key,value]})),result};var _setToArray=function(set){var index=-1,result=Array(set.size);return set.forEach((function(value){result[++index]=value})),result},COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=_Symbol?_Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;var _equalByTag=function(object,other,tag,bitmask,customizer,equalFunc,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset)return!1;object=object.buffer,other=other.buffer;case arrayBufferTag:return!(object.byteLength!=other.byteLength||!equalFunc(new _Uint8Array(object),new _Uint8Array(other)));case boolTag:case dateTag:case numberTag:return eq_1(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=_mapToArray;case setTag:var isPartial=bitmask&COMPARE_PARTIAL_FLAG$1;if(convert||(convert=_setToArray),object.size!=other.size&&!isPartial)return!1;var stacked=stack.get(object);if(stacked)return stacked==other;bitmask|=COMPARE_UNORDERED_FLAG$1,stack.set(object,other);var result=_equalArrays(convert(object),convert(other),bitmask,customizer,equalFunc,stack);return stack.delete(object),result;case symbolTag:if(symbolValueOf)return symbolValueOf.call(object)==symbolValueOf.call(other)}return!1};var _arrayPush=function(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array},isArray_1=Array.isArray;var _baseGetAllKeys=function(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray_1(object)?result:_arrayPush(result,symbolsFunc(object))};var _arrayFilter=function(array,predicate){for(var index=-1,length=null==array?0:array.length,resIndex=0,result=[];++index<length;){var value=array[index];predicate(value,index,array)&&(result[resIndex++]=value)}return result};var stubArray_1=function(){return[]},propertyIsEnumerable=Object.prototype.propertyIsEnumerable,nativeGetSymbols=Object.getOwnPropertySymbols,_getSymbols=nativeGetSymbols?function(object){return null==object?[]:(object=Object(object),_arrayFilter(nativeGetSymbols(object),(function(symbol){return propertyIsEnumerable.call(object,symbol)})))}:stubArray_1;var _baseTimes=function(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result};var isObjectLike_1=function(value){return null!=value&&"object"==typeof value},argsTag="[object Arguments]";var _baseIsArguments=function(value){return isObjectLike_1(value)&&_baseGetTag(value)==argsTag},objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty,propertyIsEnumerable$1=objectProto$6.propertyIsEnumerable,isArguments_1=_baseIsArguments(function(){return arguments}())?_baseIsArguments:function(value){return isObjectLike_1(value)&&hasOwnProperty$4.call(value,"callee")&&!propertyIsEnumerable$1.call(value,"callee")};var stubFalse_1=function(){return!1},isBuffer_1=createCommonjsModule((function(module,exports){var freeExports=exports&&!exports.nodeType&&exports,freeModule=freeExports&&module&&!module.nodeType&&module,Buffer=freeModule&&freeModule.exports===freeExports?_root.Buffer:void 0,isBuffer=(Buffer?Buffer.isBuffer:void 0)||stubFalse_1;module.exports=isBuffer})),MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;var _isIndex=function(value,length){var type=typeof value;return!!(length=null==length?MAX_SAFE_INTEGER:length)&&("number"==type||"symbol"!=type&&reIsUint.test(value))&&value>-1&&value%1==0&&value<length},MAX_SAFE_INTEGER$1=9007199254740991;var isLength_1=function(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER$1},typedArrayTags={};typedArrayTags["[object Float32Array]"]=typedArrayTags["[object Float64Array]"]=typedArrayTags["[object Int8Array]"]=typedArrayTags["[object Int16Array]"]=typedArrayTags["[object Int32Array]"]=typedArrayTags["[object Uint8Array]"]=typedArrayTags["[object Uint8ClampedArray]"]=typedArrayTags["[object Uint16Array]"]=typedArrayTags["[object Uint32Array]"]=!0,typedArrayTags["[object Arguments]"]=typedArrayTags["[object Array]"]=typedArrayTags["[object ArrayBuffer]"]=typedArrayTags["[object Boolean]"]=typedArrayTags["[object DataView]"]=typedArrayTags["[object Date]"]=typedArrayTags["[object Error]"]=typedArrayTags["[object Function]"]=typedArrayTags["[object Map]"]=typedArrayTags["[object Number]"]=typedArrayTags["[object Object]"]=typedArrayTags["[object RegExp]"]=typedArrayTags["[object Set]"]=typedArrayTags["[object String]"]=typedArrayTags["[object WeakMap]"]=!1;var _baseIsTypedArray=function(value){return isObjectLike_1(value)&&isLength_1(value.length)&&!!typedArrayTags[_baseGetTag(value)]};var _baseUnary=function(func){return function(value){return func(value)}},_nodeUtil=createCommonjsModule((function(module,exports){var freeExports=exports&&!exports.nodeType&&exports,freeModule=freeExports&&module&&!module.nodeType&&module,freeProcess=freeModule&&freeModule.exports===freeExports&&_freeGlobal.process,nodeUtil=function(){try{var types=freeModule&&freeModule.require&&freeModule.require("util").types;return types||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();module.exports=nodeUtil})),nodeIsTypedArray=_nodeUtil&&_nodeUtil.isTypedArray,isTypedArray_1=nodeIsTypedArray?_baseUnary(nodeIsTypedArray):_baseIsTypedArray,hasOwnProperty$5=Object.prototype.hasOwnProperty;var _arrayLikeKeys=function(value,inherited){var isArr=isArray_1(value),isArg=!isArr&&isArguments_1(value),isBuff=!isArr&&!isArg&&isBuffer_1(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray_1(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?_baseTimes(value.length,String):[],length=result.length;for(var key in value)!inherited&&!hasOwnProperty$5.call(value,key)||skipIndexes&&("length"==key||isBuff&&("offset"==key||"parent"==key)||isType&&("buffer"==key||"byteLength"==key||"byteOffset"==key)||_isIndex(key,length))||result.push(key);return result},objectProto$8=Object.prototype;var _isPrototype=function(value){var Ctor=value&&value.constructor;return value===("function"==typeof Ctor&&Ctor.prototype||objectProto$8)};var _overArg=function(func,transform){return function(arg){return func(transform(arg))}},_nativeKeys=_overArg(Object.keys,Object),hasOwnProperty$6=Object.prototype.hasOwnProperty;var _baseKeys=function(object){if(!_isPrototype(object))return _nativeKeys(object);var result=[];for(var key in Object(object))hasOwnProperty$6.call(object,key)&&"constructor"!=key&&result.push(key);return result};var isArrayLike_1=function(value){return null!=value&&isLength_1(value.length)&&!isFunction_1(value)};var keys_1=function(object){return isArrayLike_1(object)?_arrayLikeKeys(object):_baseKeys(object)};var _getAllKeys=function(object){return _baseGetAllKeys(object,keys_1,_getSymbols)},COMPARE_PARTIAL_FLAG$2=1,hasOwnProperty$7=Object.prototype.hasOwnProperty;var _equalObjects=function(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG$2,objProps=_getAllKeys(object),objLength=objProps.length;if(objLength!=_getAllKeys(other).length&&!isPartial)return!1;for(var index=objLength;index--;){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty$7.call(other,key)))return!1}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=!0;stack.set(object,other),stack.set(other,object);for(var skipCtor=isPartial;++index<objLength;){var objValue=object[key=objProps[index]],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(void 0===compared?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=!1;break}skipCtor||(skipCtor="constructor"==key)}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;objCtor!=othCtor&&"constructor"in object&&"constructor"in other&&!("function"==typeof objCtor&&objCtor instanceof objCtor&&"function"==typeof othCtor&&othCtor instanceof othCtor)&&(result=!1)}return stack.delete(object),stack.delete(other),result},_DataView=_getNative(_root,"DataView"),_Promise=_getNative(_root,"Promise"),_Set=_getNative(_root,"Set"),_WeakMap=_getNative(_root,"WeakMap"),dataViewCtorString=_toSource(_DataView),mapCtorString=_toSource(_Map),promiseCtorString=_toSource(_Promise),setCtorString=_toSource(_Set),weakMapCtorString=_toSource(_WeakMap),getTag=_baseGetTag;(_DataView&&"[object DataView]"!=getTag(new _DataView(new ArrayBuffer(1)))||_Map&&"[object Map]"!=getTag(new _Map)||_Promise&&"[object Promise]"!=getTag(_Promise.resolve())||_Set&&"[object Set]"!=getTag(new _Set)||_WeakMap&&"[object WeakMap]"!=getTag(new _WeakMap))&&(getTag=function(value){var result=_baseGetTag(value),Ctor="[object Object]"==result?value.constructor:void 0,ctorString=Ctor?_toSource(Ctor):"";if(ctorString)switch(ctorString){case dataViewCtorString:return"[object DataView]";case mapCtorString:return"[object Map]";case promiseCtorString:return"[object Promise]";case setCtorString:return"[object Set]";case weakMapCtorString:return"[object WeakMap]"}return result});var _getTag=getTag,COMPARE_PARTIAL_FLAG$3=1,argsTag$2="[object Arguments]",arrayTag$1="[object Array]",objectTag$2="[object Object]",hasOwnProperty$8=Object.prototype.hasOwnProperty;var _baseIsEqualDeep=function(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray_1(object),othIsArr=isArray_1(other),objTag=objIsArr?arrayTag$1:_getTag(object),othTag=othIsArr?arrayTag$1:_getTag(other),objIsObj=(objTag=objTag==argsTag$2?objectTag$2:objTag)==objectTag$2,othIsObj=(othTag=othTag==argsTag$2?objectTag$2:othTag)==objectTag$2,isSameTag=objTag==othTag;if(isSameTag&&isBuffer_1(object)){if(!isBuffer_1(other))return!1;objIsArr=!0,objIsObj=!1}if(isSameTag&&!objIsObj)return stack||(stack=new _Stack),objIsArr||isTypedArray_1(object)?_equalArrays(object,other,bitmask,customizer,equalFunc,stack):_equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack);if(!(bitmask&COMPARE_PARTIAL_FLAG$3)){var objIsWrapped=objIsObj&&hasOwnProperty$8.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty$8.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;return stack||(stack=new _Stack),equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}return!!isSameTag&&(stack||(stack=new _Stack),_equalObjects(object,other,bitmask,customizer,equalFunc,stack))};var _baseIsEqual=function baseIsEqual(value,other,bitmask,customizer,stack){return value===other||(null==value||null==other||!isObjectLike_1(value)&&!isObjectLike_1(other)?value!=value&&other!=other:_baseIsEqualDeep(value,other,bitmask,customizer,baseIsEqual,stack))},COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2;var _baseIsMatch=function(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(null==object)return!length;for(object=Object(object);index--;){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return!1}for(;++index<length;){var key=(data=matchData[index])[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(void 0===objValue&&!(key in object))return!1}else{var stack=new _Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(void 0===result?_baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG$4|COMPARE_UNORDERED_FLAG$2,customizer,stack):result))return!1}}return!0};var _isStrictComparable=function(value){return value==value&&!isObject_1(value)};var _getMatchData=function(object){for(var result=keys_1(object),length=result.length;length--;){var key=result[length],value=object[key];result[length]=[key,value,_isStrictComparable(value)]}return result};var _matchesStrictComparable=function(key,srcValue){return function(object){return null!=object&&(object[key]===srcValue&&(void 0!==srcValue||key in Object(object)))}};var _baseMatches=function(source){var matchData=_getMatchData(source);return 1==matchData.length&&matchData[0][2]?_matchesStrictComparable(matchData[0][0],matchData[0][1]):function(object){return object===source||_baseIsMatch(object,source,matchData)}},symbolTag$1="[object Symbol]";var isSymbol_1=function(value){return"symbol"==typeof value||isObjectLike_1(value)&&_baseGetTag(value)==symbolTag$1},reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;var _isKey=function(value,object){if(isArray_1(value))return!1;var type=typeof value;return!("number"!=type&&"symbol"!=type&&"boolean"!=type&&null!=value&&!isSymbol_1(value))||(reIsPlainProp.test(value)||!reIsDeepProp.test(value)||null!=object&&value in Object(object))},FUNC_ERROR_TEXT="Expected a function";function memoize(func,resolver){if("function"!=typeof func||null!=resolver&&"function"!=typeof resolver)throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result)||cache,result};return memoized.cache=new(memoize.Cache||_MapCache),memoized}memoize.Cache=_MapCache;var memoize_1=memoize,MAX_MEMOIZE_SIZE=500;var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,_stringToPath=function(func){var result=memoize_1(func,(function(key){return cache.size===MAX_MEMOIZE_SIZE&&cache.clear(),key})),cache=result.cache;return result}((function(string){var result=[];return 46===string.charCodeAt(0)&&result.push(""),string.replace(rePropName,(function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number||match)})),result}));var _arrayMap=function(array,iteratee){for(var index=-1,length=null==array?0:array.length,result=Array(length);++index<length;)result[index]=iteratee(array[index],index,array);return result},INFINITY=1/0,symbolProto$1=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto$1?symbolProto$1.toString:void 0;var _baseToString=function baseToString(value){if("string"==typeof value)return value;if(isArray_1(value))return _arrayMap(value,baseToString)+"";if(isSymbol_1(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result};var toString_1=function(value){return null==value?"":_baseToString(value)};var _castPath=function(value,object){return isArray_1(value)?value:_isKey(value,object)?[value]:_stringToPath(toString_1(value))},INFINITY$1=1/0;var _toKey=function(value){if("string"==typeof value||isSymbol_1(value))return value;var result=value+"";return"0"==result&&1/value==-INFINITY$1?"-0":result};var _baseGet=function(object,path){for(var index=0,length=(path=_castPath(path,object)).length;null!=object&&index<length;)object=object[_toKey(path[index++])];return index&&index==length?object:void 0};var get_1=function(object,path,defaultValue){var result=null==object?void 0:_baseGet(object,path);return void 0===result?defaultValue:result};var _baseHasIn=function(object,key){return null!=object&&key in Object(object)};var _hasPath=function(object,path,hasFunc){for(var index=-1,length=(path=_castPath(path,object)).length,result=!1;++index<length;){var key=_toKey(path[index]);if(!(result=null!=object&&hasFunc(object,key)))break;object=object[key]}return result||++index!=length?result:!!(length=null==object?0:object.length)&&isLength_1(length)&&_isIndex(key,length)&&(isArray_1(object)||isArguments_1(object))};var hasIn_1=function(object,path){return null!=object&&_hasPath(object,path,_baseHasIn)},COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;var _baseMatchesProperty=function(path,srcValue){return _isKey(path)&&_isStrictComparable(srcValue)?_matchesStrictComparable(_toKey(path),srcValue):function(object){var objValue=get_1(object,path);return void 0===objValue&&objValue===srcValue?hasIn_1(object,path):_baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG$5|COMPARE_UNORDERED_FLAG$3)}};var identity_1=function(value){return value};var _baseProperty=function(key){return function(object){return null==object?void 0:object[key]}};var _basePropertyDeep=function(path){return function(object){return _baseGet(object,path)}};var property_1=function(path){return _isKey(path)?_baseProperty(_toKey(path)):_basePropertyDeep(path)};var _baseIteratee=function(value){return"function"==typeof value?value:null==value?identity_1:"object"==typeof value?isArray_1(value)?_baseMatchesProperty(value[0],value[1]):_baseMatches(value):property_1(value)},NAN=NaN,reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;var toNumber_1=function(value){if("number"==typeof value)return value;if(isSymbol_1(value))return NAN;if(isObject_1(value)){var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject_1(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value},INFINITY$2=1/0,MAX_INTEGER=17976931348623157e292;var toFinite_1=function(value){return value?(value=toNumber_1(value))===INFINITY$2||value===-INFINITY$2?(value<0?-1:1)*MAX_INTEGER:value==value?value:0:0===value?value:0};var toInteger_1=function(value){var result=toFinite_1(value),remainder=result%1;return result==result?remainder?result-remainder:result:0},nativeMax=Math.max,nativeMin=Math.min;var findLastIndex_1=function(array,predicate,fromIndex){var length=null==array?0:array.length;if(!length)return-1;var index=length-1;return void 0!==fromIndex&&(index=toInteger_1(fromIndex),index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1)),_baseFindIndex(array,_baseIteratee(predicate),index,!0)},computeOldLineNumber=computeLineNumberFactory("old"),computeNewLineNumber=computeLineNumberFactory("new"),getOldRangeFromHunk=function(_ref){var oldStart=_ref.oldStart;return[oldStart,oldStart+_ref.oldLines-1]},createHunkFromChanges=function(changes){if(!changes.length)return null;var hunk=changes.reduce((function(hunk,change){return change.isNormal||(hunk.isPlain=!1),change.isInsert||(hunk.oldLines=hunk.oldLines+1,-1===hunk.oldStart&&(hunk.oldStart=computeOldLineNumber(change))),change.isDelete||(hunk.newLines=hunk.newLines+1,-1===hunk.newStart&&(hunk.newStart=computeNewLineNumber(change))),hunk}),{isPlain:!0,content:"",oldStart:-1,oldLines:0,newStart:-1,newLines:0}),oldStart=hunk.oldStart,oldLines=hunk.oldLines,newStart=hunk.newStart,newLines=hunk.newLines;return _objectSpread2({},hunk,{content:"@@ -".concat(oldStart,",").concat(oldLines," +").concat(newStart,",").concat(newLines),changes:changes})},textLinesToHunk=function(lines,oldStartLineNumber,newStartLineNumber){var changes=lines.map((function(line,i){return{type:"normal",isNormal:!0,oldLineNumber:oldStartLineNumber+i,newLineNumber:newStartLineNumber+i,content:""+line}}));return createHunkFromChanges(changes)},sliceHunk=function(_ref2,startOldLineNumber,endOldLineNumber){var changes=_ref2.changes,changeIndex=changes.findIndex((function(change){return computeOldLineNumber(change)>=startOldLineNumber}));if(-1===changeIndex)return null;var startIndex=function(){if(0===changeIndex)return changeIndex;var nearestHeadingNocmalChangeIndex=findLastIndex_1(changes,(function(change){return!change.isInsert}),changeIndex-1);return-1===nearestHeadingNocmalChangeIndex?changeIndex:nearestHeadingNocmalChangeIndex+1}();if(void 0===endOldLineNumber){var _slicedChanges=changes.slice(startIndex);return createHunkFromChanges(_slicedChanges)}var endIndex=findLastIndex_1(changes,(function(change){return computeOldLineNumber(change)<=endOldLineNumber})),slicedChanges=changes.slice(startIndex,-1===endIndex?void 0:endIndex);return createHunkFromChanges(slicedChanges)},appendOrMergeHunk=function(hunks,nextHunk){var lastHunk=last(hunks);if(!lastHunk)return[nextHunk];if(lastHunk.oldStart+lastHunk.oldLines<nextHunk.oldStart)return hunks.concat(nextHunk);var mergedHunk=function mergeHunk(previousHunk,nextHunk){if(!previousHunk)return nextHunk;if(!nextHunk)return previousHunk;var _getOldRangeFromHunk2=_slicedToArray(getOldRangeFromHunk(previousHunk),2),previousStart=_getOldRangeFromHunk2[0],previousEnd=_getOldRangeFromHunk2[1],_getOldRangeFromHunk4=_slicedToArray(getOldRangeFromHunk(nextHunk),2),nextStart=_getOldRangeFromHunk4[0],nextEnd=_getOldRangeFromHunk4[1];if(previousEnd+1===nextStart)return createHunkFromChanges([].concat(_toConsumableArray(previousHunk.changes),_toConsumableArray(nextHunk.changes)));if(previousStart<=nextStart&&previousEnd>=nextEnd){if(previousHunk.isPlain&&!nextHunk.isPlain){var head=sliceHunk(previousHunk,previousStart,nextStart),_tail=sliceHunk(previousHunk,nextEnd+1);return mergeHunk(mergeHunk(head,nextHunk),_tail)}return previousHunk}return previousHunk.isPlain?mergeHunk(sliceHunk(previousHunk,previousStart,nextStart),nextHunk):mergeHunk(previousHunk,sliceHunk(nextHunk,previousEnd+1))}(lastHunk,nextHunk);return[].concat(_toConsumableArray(hunks.slice(0,-1)),[mergedHunk])},insertHunk=function(hunks,insertion){var insertionOldLineNumber=computeOldLineNumber(insertion.changes[0]),insertPosition=hunks.findIndex((function(_ref3){var changes=_ref3.changes;return!!changes.length&&computeOldLineNumber(changes[0])>=insertionOldLineNumber}));return(-1===insertPosition?hunks.concat(insertion):[].concat(_toConsumableArray(hunks.slice(0,insertPosition)),[insertion],_toConsumableArray(hunks.slice(insertPosition)))).reduce(appendOrMergeHunk,[])},getCorrespondingNewLineNumber=getCorrespondingLineNumberFactory("old"),computeOldLineNumber$1=computeLineNumberFactory("old"),isOldLineNumberInHunk=isInHunkFactory("oldStart","oldLines"),isOldLineNumberBetweenHunks=isBetweenHunksFactory("oldStart","oldLines"),splitRangeToValidOnes=function splitRangeToValidOnes(hunks,start,end){var correspondingHunkIndex=function(hunks,oldLineNumber){if(!hunks.length)return-1;var firstHunk=first(hunks);if(oldLineNumber<firstHunk.oldStart||isOldLineNumberInHunk(firstHunk,oldLineNumber))return 0;for(var i=1;i<hunks.length;i++){var currentHunk=hunks[i];if(isOldLineNumberInHunk(currentHunk,oldLineNumber))return i;var previousHunk=hunks[i-1];if(isOldLineNumberBetweenHunks(previousHunk,currentHunk,oldLineNumber))return i}return-1}(hunks,start);if(-1===correspondingHunkIndex)return[[start,end]];var correspondingHunk=hunks[correspondingHunkIndex];if(start<correspondingHunk.oldStart){var headingChangesCount=correspondingHunk.changes.findIndex((function(change){return!change.isNormal})),_validEnd=correspondingHunk.oldStart+Math.max(headingChangesCount,0);return _validEnd>=end?[[start,end]]:[[start,_validEnd]].concat(_toConsumableArray(splitRangeToValidOnes(hunks,_validEnd+1,end)))}var changes=correspondingHunk.changes,nearestNormalChangeIndex=function(_ref,start){for(var changes=_ref.changes,i=changes.findIndex((function(change){return computeOldLineNumber$1(change)===start}));i<changes.length;i++){if(changes[i].isNormal)return i}return-1}(correspondingHunk,start);if(-1===nearestNormalChangeIndex)return[];var validStartChange=changes[nearestNormalChangeIndex],validStart=computeOldLineNumber$1(validStartChange),adjacentChangesCount=changes.slice(nearestNormalChangeIndex+1).findIndex((function(change){return!change.isNormal})),validEnd=computeOldLineNumber$1(validStartChange)+Math.max(adjacentChangesCount,0);return validEnd>=end?[[validStart,end]]:[[validStart,validEnd]].concat(_toConsumableArray(splitRangeToValidOnes(hunks,validEnd+1,end)))},expandFromRawCode=function(hunks,rawCodeOrLines,start,end){return splitRangeToValidOnes(hunks,start,end).reduce((function(hunks,range){return function(hunks,rawCodeOrLines,_ref2){var _ref3=_slicedToArray(_ref2,2),start=_ref3[0],end=_ref3[1],slicedLines=("string"==typeof rawCodeOrLines?rawCodeOrLines.split("\n"):rawCodeOrLines).slice(Math.max(start,1)-1,end-1);if(!slicedLines.length)return hunks;var slicedHunk=textLinesToHunk(slicedLines,start,getCorrespondingNewLineNumber(hunks,start));return insertHunk(hunks,slicedHunk)}(hunks,rawCodeOrLines,range)}),hunks)},getCollapsedLinesCountBetween=function(previousHunk,nextHunk){if(!previousHunk)return nextHunk.oldStart-1;if(!nextHunk)throw new Error("Unable to compute lines count after the last hunk");var previousEnd=previousHunk.oldStart+previousHunk.oldLines;return nextHunk.oldStart-previousEnd},expandCollapsedBlockBy=function(hunks,rawCodeOrLines,predicate){var linesOfCode="string"==typeof rawCodeOrLines?rawCodeOrLines.split("\n"):rawCodeOrLines,firstHunk=first(hunks),initialExpandingBlocks=predicate(firstHunk.oldStart-1,1,1)?[[1,firstHunk.oldStart]]:[];return hunks.reduce((function(expandingBlocks,currentHunk,index,hunks){var nextHunk=hunks[index+1],oldStart=currentHunk.oldStart+currentHunk.oldLines,newStart=currentHunk.newStart+currentHunk.newLines,lines=nextHunk?getCollapsedLinesCountBetween(currentHunk,nextHunk):linesOfCode.length-oldStart+1;return predicate(lines,oldStart,newStart)&&expandingBlocks.push([oldStart,oldStart+lines]),expandingBlocks}),initialExpandingBlocks).reduce((function(hunks,_ref4){var _ref5=_slicedToArray(_ref4,2),start=_ref5[0],end=_ref5[1];return expandFromRawCode(hunks,linesOfCode,start,end)}),hunks)},getChangeKey=function(change){if(!change)throw new Error("change is not provided");var isNormal=change.isNormal,isInsert=change.isInsert,lineNumber=change.lineNumber,oldLineNumber=change.oldLineNumber;return isNormal?"N"+oldLineNumber:(isInsert?"I":"D")+lineNumber},computeOldLineNumber$2=computeLineNumberFactory("old"),computeNewLineNumber$1=computeLineNumberFactory("new"),findChangeByOldLineNumber=findChangeByLineNumberFactory("old"),findChangeByNewLineNumber=findChangeByLineNumberFactory("new"),getCorrespondingOldLineNumber=getCorrespondingLineNumberFactory("new"),getCorrespondingNewLineNumber$1=getCorrespondingLineNumberFactory("old"),gitdiffParser=createCommonjsModule((function(module,exports){var parser;parser={parse:function(source){for(var currentInfo,currentHunk,changeOldLine,changeNewLine,infos=[],stat=2,lines=source.split("\n"),linesLen=lines.length,i=0;i<linesLen;){var line=lines[i];if(0===line.indexOf("diff --git")){currentInfo={hunks:[],oldEndingNewLine:!0,newEndingNewLine:!0},infos.push(currentInfo);var simiLine,currentInfoType=null,nextLine=lines[i+1];0===nextLine.indexOf("old")&&(currentInfo.oldMode=nextLine.slice(9,16),currentInfo.newMode=lines[i+2].slice(9,16),nextLine=lines[(i+=2)+1]),0===nextLine.indexOf("similarity")&&(currentInfo.similarity=parseInt(nextLine.split(" ")[2],10),i+=1);simiLoop:for(;simiLine=lines[++i];){var spaceIndex=simiLine.indexOf(" "),infoType=spaceIndex>-1?simiLine.slice(0,spaceIndex):infoType;switch(infoType){case"diff":i--;break simiLoop;case"index":var segs=simiLine.slice(spaceIndex+1).split(" "),revs=segs[0].split("..");currentInfo.oldRevision=revs[0],currentInfo.newRevision=revs[1],segs[1]&&(currentInfo.oldMode=currentInfo.newMode=segs[1]);break;case"copy":case"rename":var infoStr=simiLine.slice(spaceIndex+1);0===infoStr.indexOf("from")?currentInfo.oldPath=infoStr.slice(5):currentInfo.newPath=infoStr.slice(3);break;case"---":var oldPath=simiLine.slice(spaceIndex+1),newPath=lines[++i].slice(4);"/dev/null"===oldPath?(newPath=newPath.slice(2),currentInfoType="add"):"/dev/null"===newPath?(oldPath=oldPath.slice(2),currentInfoType="delete"):(currentInfoType="modify",oldPath=oldPath.slice(2),newPath=newPath.slice(2)),currentInfo.oldPath=oldPath,currentInfo.newPath=newPath,stat=5;break simiLoop}currentInfoType||(currentInfoType=infoType)}currentInfo.type=currentInfoType||"modify"}else if(0===line.indexOf("Binary"))currentInfo.isBinary=!0,currentInfo.type=line.indexOf("/dev/null and")>=0?"add":line.indexOf("and /dev/null")>=0?"delete":"modify",stat=2,currentInfo=null;else if(5===stat)if(0===line.indexOf("@@")){var match=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(line);currentHunk={content:line,oldStart:match[1]-0,newStart:match[4]-0,oldLines:match[3]-0||1,newLines:match[6]-0||1,changes:[]},currentInfo.hunks.push(currentHunk),changeOldLine=currentHunk.oldStart,changeNewLine=currentHunk.newStart}else{var typeChar=line.slice(0,1),change={content:line.slice(1)};switch(typeChar){case"+":change.type="insert",change.isInsert=!0,change.lineNumber=changeNewLine,changeNewLine++;break;case"-":change.type="delete",change.isDelete=!0,change.lineNumber=changeOldLine,changeOldLine++;break;case" ":change.type="normal",change.isNormal=!0,change.oldLineNumber=changeOldLine,change.newLineNumber=changeNewLine,changeOldLine++,changeNewLine++;break;case"\\":var lastChange=currentHunk.changes[currentHunk.changes.length-1];lastChange.isDelete||(currentInfo.newEndingNewLine=!1),lastChange.isInsert||(currentInfo.oldEndingNewLine=!1)}change.type&&currentHunk.changes.push(change)}i++}return infos}},module.exports=parser})),mapHunk=function(hunk,options){return _objectSpread2({},hunk,{isPlain:!1,changes:"zip"===options.nearbySequences?function(changes){var _changes$reduce=changes.reduce((function(_ref,current,i){var _ref2=_slicedToArray(_ref,3),result=_ref2[0],last=_ref2[1],lastDeletionIndex=_ref2[2];return last?current.isInsert&&lastDeletionIndex>=0?(result.splice(lastDeletionIndex+1,0,current),[result,current,lastDeletionIndex+2]):(result.push(current),[result,current,current.isDelete&&last.isDelete?lastDeletionIndex:i]):(result.push(current),[result,current,current.isDelete?i:-1])}),[[],null,-1]);return _slicedToArray(_changes$reduce,1)[0]}(hunk.changes):hunk.changes})},mapFile=function(file,options){var hunks=file.hunks.map((function(hunk){return mapHunk(hunk,options)}));return _objectSpread2({},file,{hunks:hunks})},normalizeDiffText=function(text){if(0===text.indexOf("diff --git"))return text;var indexOfFirstLineBreak=text.indexOf("\n"),indexOfSecondLineBreak=text.indexOf("\n",indexOfFirstLineBreak+1),firstLine=text.slice(0,indexOfFirstLineBreak),secondLine=text.slice(indexOfFirstLineBreak+1,indexOfSecondLineBreak),oldPath=firstLine.split(" ").slice(1,-3).join(" "),newPath=secondLine.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(oldPath," b/").concat(newPath),"index 1111111..2222222 100644","--- a/".concat(oldPath),"+++ b/".concat(newPath),text.slice(indexOfSecondLineBreak+1)].join("\n")},parseDiff=function(text){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},diffText=normalizeDiffText(text.trim()),files=gitdiffParser.parse(diffText);return files.map((function(file){return mapFile(file,options)}))},_defineProperty$1=function(){try{var func=_getNative(Object,"defineProperty");return func({},"",{}),func}catch(e){}}();var _baseAssignValue=function(object,key,value){"__proto__"==key&&_defineProperty$1?_defineProperty$1(object,key,{configurable:!0,enumerable:!0,value:value,writable:!0}):object[key]=value};var _baseFor=function(fromRight){return function(object,iteratee,keysFunc){for(var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;length--;){var key=props[fromRight?length:++index];if(!1===iteratee(iterable[key],key,iterable))break}return object}}();var _baseForOwn=function(object,iteratee){return object&&_baseFor(object,iteratee,keys_1)};var mapValues_1=function(object,iteratee){var result={};return iteratee=_baseIteratee(iteratee),_baseForOwn(object,(function(value,key,object){_baseAssignValue(result,key,iteratee(value,key,object))})),result},defaultRenderToken=function defaultRenderToken(_ref,i){var type=_ref.type,value=_ref.value,markType=_ref.markType,properties=_ref.properties,className=_ref.className,children=_ref.children,renderWithClassName=function(className){return React.createElement("span",{key:i,className:className},value||children&&children.map(defaultRenderToken))};switch(type){case"text":return value;case"mark":return renderWithClassName("diff-code-mark diff-code-mark-".concat(markType));case"edit":return renderWithClassName("diff-code-edit");default:var legacyClassName=properties&&properties.className;return renderWithClassName(classnames(className||legacyClassName))}},CodeCell=function(props){var text=props.text,tokens=props.tokens,renderToken=props.renderToken,attributes=_objectWithoutProperties(props,["text","tokens","renderToken"]),actualRenderToken=renderToken?function(token,i){return renderToken(token,defaultRenderToken,i)}:defaultRenderToken;return React.createElement("td",attributes,tokens?tokens.length?tokens.map(actualRenderToken):" ":text||" ")};CodeCell.displayName="CodeCell",CodeCell.propTypes={text:PropTypes.string.isRequired,tokens:PropTypes.arrayOf(PropTypes.object)},CodeCell.defaultProps={tokens:null};var CodeCell$1=memo(CodeCell),renderDefaultBy=function(change,side){return function(){var lineNumber="old"===side?computeOldLineNumber$2(change):computeNewLineNumber$1(change);return-1===lineNumber?void 0:lineNumber}},wrapInAnchorBy=function(gutterAnchor,anchorTarget){return function(element){return gutterAnchor&&element?React.createElement("a",{href:"#"+anchorTarget},element):element}},composeCallback=function(own,custom){return custom?function(e){own(e),custom()}:own},useBoundCallbacks=function(callbacks,arg,hoverOn,hoverOff){return useMemo((function(){var output=mapValues_1(callbacks,(function(fn){return function(){return fn(arg)}}));return output.onMouseEnter=composeCallback(hoverOn,output.onMouseEnter),output.onMouseLeave=composeCallback(hoverOff,output.onMouseLeave),output}),[callbacks,hoverOn,hoverOff,arg])},renderGutterCell=function(className,change,side,gutterAnchor,anchorTarget,events,inHoverState,renderGutter){var gutterOptions={change:change,side:side,inHoverState:inHoverState,renderDefault:renderDefaultBy(change,side),wrapInAnchor:wrapInAnchorBy(gutterAnchor,anchorTarget)};return React.createElement("td",_extends({className:className},events),renderGutter(gutterOptions))};renderGutterCell.displayName="renderGutterCell";var UnifiedChange=function(props){var _useState2,value,setValue,change=props.change,selected=props.selected,tokens=props.tokens,className=props.className,gutterClassName=props.gutterClassName,codeClassName=props.codeClassName,gutterEvents=props.gutterEvents,codeEvents=props.codeEvents,hideGutter=props.hideGutter,gutterAnchor=props.gutterAnchor,generateAnchorID=props.generateAnchorID,renderToken=props.renderToken,renderGutter=props.renderGutter,type=change.type,content=change.content,_useBoolean=(_useState2=_slicedToArray(useState(!1),2),value=_useState2[0],setValue=_useState2[1],[value,useCallback((function(){return setValue(!0)}),[]),useCallback((function(){return setValue(!1)}),[])]),_useBoolean2=_slicedToArray(_useBoolean,3),hover=_useBoolean2[0],hoverOn=_useBoolean2[1],hoverOff=_useBoolean2[2],eventArg=useMemo((function(){return{change:change}}),[change]),boundGutterEvents=useBoundCallbacks(gutterEvents,eventArg,hoverOn,hoverOff),boundCodeEvents=useBoundCallbacks(codeEvents,eventArg,hoverOn,hoverOff),anchorID=generateAnchorID(change),gutterClassNameValue=classnames("diff-gutter","diff-gutter-".concat(type),gutterClassName,{"diff-gutter-selected":selected}),codeClassNameValue=classnames("diff-code","diff-code-".concat(type),codeClassName,{"diff-code-selected":selected});return React.createElement("tr",{id:anchorID,className:classnames("diff-line",className)},!hideGutter&&renderGutterCell(gutterClassNameValue,change,"old",gutterAnchor,anchorID,boundGutterEvents,hover,renderGutter),!hideGutter&&renderGutterCell(gutterClassNameValue,change,"new",gutterAnchor,anchorID,boundGutterEvents,hover,renderGutter),React.createElement(CodeCell$1,_extends({className:codeClassNameValue,text:content,tokens:tokens,renderToken:renderToken},boundCodeEvents)))};UnifiedChange.displayName="UnifiedChange",UnifiedChange.propTypes={selected:PropTypes.bool.isRequired,tokens:PropTypes.arrayOf(PropTypes.object)},UnifiedChange.defaultProps={tokens:null};var UnifiedChange$1=memo(UnifiedChange),UnifiedWidget=function(_ref){var hideGutter=_ref.hideGutter,element=_ref.element;return React.createElement("tr",{className:"diff-widget"},React.createElement("td",{colSpan:hideGutter?1:3,className:"diff-widget-content"},element))};UnifiedWidget.displayName="UnifiedWidget";var UnifiedHunk=function(props){var hunk=props.hunk,widgets=props.widgets,className=props.className,childrenProps=_objectWithoutProperties(props,["hunk","widgets","className"]),elements=function(changes,widgets){return changes.reduce((function(elements,change){var key=getChangeKey(change);elements.push(["change",key,change]);var widget=widgets[key];return widget&&elements.push(["widget",key,widget]),elements}),[])}(hunk.changes,widgets);return React.createElement("tbody",{className:classnames("diff-hunk",className)},elements.map((function(element){return function(_ref,props){var _ref2=_slicedToArray(_ref,3),type=_ref2[0],key=_ref2[1],value=_ref2[2],hideGutter=props.hideGutter,selectedChanges=props.selectedChanges,tokens=props.tokens,lineClassName=props.lineClassName,changeProps=_objectWithoutProperties(props,["hideGutter","selectedChanges","tokens","lineClassName"]);if("change"===type){var side=value.isDelete?"old":"new",lineNumber=value.isDelete?computeOldLineNumber$2(value):computeNewLineNumber$1(value),tokensOfLine=tokens?tokens[side][lineNumber-1]:null;return React.createElement(UnifiedChange$1,_extends({key:"change".concat(key),className:lineClassName,change:value,hideGutter:hideGutter,selected:selectedChanges.includes(key),tokens:tokensOfLine},changeProps))}return"widget"===type?React.createElement(UnifiedWidget,{key:"widget".concat(key),hideGutter:hideGutter,element:value}):null}(element,childrenProps)})))};UnifiedHunk.displayName="UnifiedHunk";var useCallbackOnSide=function(side,setHover,change,customCallbacks){var markHover=useCallback((function(){return setHover(side)}),[side,setHover]),unmarkHover=useCallback((function(){return setHover("")}),[setHover]);return useMemo((function(){var callbacks=mapValues_1(customCallbacks,(function(fn){return function(){return fn({side:side,change:change})}}));return callbacks.onMouseEnter=composeCallback(markHover,callbacks.onMouseEnter),callbacks.onMouseLeave=composeCallback(unmarkHover,callbacks.onMouseLeave),callbacks}),[change,customCallbacks,markHover,side,unmarkHover])},renderCells=function(args){var change=args.change,side=args.side,selected=args.selected,tokens=args.tokens,gutterClassName=args.gutterClassName,codeClassName=args.codeClassName,gutterEvents=args.gutterEvents,codeEvents=args.codeEvents,anchorID=args.anchorID,gutterAnchor=args.gutterAnchor,gutterAnchorTarget=args.gutterAnchorTarget,hideGutter=args.hideGutter,hover=args.hover,renderToken=args.renderToken,renderGutter=args.renderGutter;if(!change){var _gutterClassNameValue=classnames("diff-gutter","diff-gutter-omit",gutterClassName),_codeClassNameValue=classnames("diff-code","diff-code-omit",codeClassName);return[!hideGutter&&React.createElement("td",{key:"gutter",className:_gutterClassNameValue}),React.createElement("td",{key:"code",className:_codeClassNameValue})]}var type=change.type,content=change.content,sideName=0===side?"old":"new",gutterProps=_objectSpread2({id:anchorID,className:classnames("diff-gutter","diff-gutter-".concat(type),_defineProperty({"diff-gutter-selected":selected},"diff-line-hover-"+sideName,hover),gutterClassName),children:renderGutter({change:change,side:sideName,inHoverState:hover,renderDefault:renderDefaultBy(change,sideName),wrapInAnchor:wrapInAnchorBy(gutterAnchor,gutterAnchorTarget)})},gutterEvents),codeClassNameValue=classnames("diff-code","diff-code-".concat(type),_defineProperty({"diff-code-selected":selected},"diff-line-hover-"+sideName,hover),codeClassName);return[!hideGutter&&React.createElement("td",_extends({key:"gutter"},gutterProps)),React.createElement(CodeCell$1,_extends({key:"code",className:codeClassNameValue,text:content,tokens:tokens,renderToken:renderToken},codeEvents))]},SplitChange=function(props){var className=props.className,gutterClassName=props.gutterClassName,codeClassName=props.codeClassName,gutterEvents=props.gutterEvents,codeEvents=props.codeEvents,oldChange=props.oldChange,newChange=props.newChange,oldSelected=props.oldSelected,newSelected=props.newSelected,oldTokens=props.oldTokens,newTokens=props.newTokens,monotonous=props.monotonous,hideGutter=props.hideGutter,generateAnchorID=props.generateAnchorID,gutterAnchor=props.gutterAnchor,renderToken=props.renderToken,renderGutter=props.renderGutter,_useState2=_slicedToArray(useState(""),2),hover=_useState2[0],setHover=_useState2[1],oldGutterEvents=useCallbackOnSide("old",setHover,oldChange,gutterEvents),newGutterEvents=useCallbackOnSide("new",setHover,newChange,gutterEvents),oldCodeEvents=useCallbackOnSide("old",setHover,oldChange,codeEvents),newCodeEvents=useCallbackOnSide("new",setHover,newChange,codeEvents),oldAnchorID=oldChange&&generateAnchorID(oldChange),newAnchorID=newChange&&generateAnchorID(newChange),commons={monotonous:monotonous,hideGutter:hideGutter,gutterClassName:gutterClassName,codeClassName:codeClassName,gutterEvents:gutterEvents,codeEvents:codeEvents,renderToken:renderToken,renderGutter:renderGutter},oldArgs=_objectSpread2({},commons,{change:oldChange,side:0,selected:oldSelected,tokens:oldTokens,gutterEvents:oldGutterEvents,codeEvents:oldCodeEvents,anchorID:oldAnchorID,gutterAnchor:gutterAnchor,gutterAnchorTarget:oldAnchorID,hover:"old"===hover}),newArgs=_objectSpread2({},commons,{change:newChange,side:1,selected:newSelected,tokens:newTokens,gutterEvents:newGutterEvents,codeEvents:newCodeEvents,anchorID:oldChange===newChange?void 0:newAnchorID,gutterAnchor:gutterAnchor,gutterAnchorTarget:oldChange===newChange?oldAnchorID:newAnchorID,hover:"new"===hover});if(monotonous)return React.createElement("tr",{className:classnames("diff-line",className)},renderCells(oldChange?oldArgs:newArgs));var lineTypeClassName=function(oldChange,newChange){return oldChange&&!newChange?"diff-line-old-only":!oldChange&&newChange?"diff-line-new-only":oldChange===newChange?"diff-line-normal":"diff-line-compare"}(oldChange,newChange);return React.createElement("tr",{className:classnames("diff-line",lineTypeClassName,className)},renderCells(oldArgs),renderCells(newArgs))};SplitChange.displayName="SplitChange",SplitChange.propTypes={oldSelected:PropTypes.bool.isRequired,newSelected:PropTypes.bool.isRequired,oldTokens:PropTypes.arrayOf(PropTypes.object),newTokens:PropTypes.arrayOf(PropTypes.object)},SplitChange.defaultProps={oldTokens:null,newTokens:null};var SplitChange$1=memo(SplitChange),SplitWidget=function(_ref){var oldElement=_ref.oldElement,newElement=_ref.newElement,monotonous=_ref.monotonous,hideGutter=_ref.hideGutter;return monotonous?React.createElement("tr",{className:"diff-widget"},React.createElement("td",{colSpan:hideGutter?1:2,className:"diff-widget-content"},oldElement||newElement)):oldElement===newElement?React.createElement("tr",{className:"diff-widget"},React.createElement("td",{colSpan:hideGutter?2:4,className:"diff-widget-content"},oldElement)):React.createElement("tr",{className:"diff-widget"},React.createElement("td",{colSpan:hideGutter?1:2,className:"diff-widget-content"},oldElement),React.createElement("td",{colSpan:hideGutter?1:2,className:"diff-widget-content"},newElement))};SplitWidget.displayName="SplitWidget";var keyForPair=function(x,y){return(x?getChangeKey(x):"00")+(y?getChangeKey(y):"00")},SplitHunk=function(props){var hunk=props.hunk,widgets=props.widgets,className=props.className,childrenProps=_objectWithoutProperties(props,["hunk","widgets","className"]),elements=function(changes,widgets){for(var findWidget=function(change){if(!change)return null;var key=getChangeKey(change);return widgets[key]||null},elements=[],i=0;i<changes.length;i++){var current=changes[i];if(current.isNormal)elements.push(["change",keyForPair(current,current),current,current]);else if(current.isDelete){var next=changes[i+1];next&&next.isInsert?(i+=1,elements.push(["change",keyForPair(current,next),current,next])):elements.push(["change",keyForPair(current,null),current,null])}else elements.push(["change",keyForPair(null,current),null,current]);var rowChanges=elements[elements.length-1],_rowChanges$slice$map2=_slicedToArray(rowChanges.slice(2).map(findWidget),2),oldWidget=_rowChanges$slice$map2[0],newWidget=_rowChanges$slice$map2[1];if(oldWidget||newWidget){var key=rowChanges[1];elements.push(["widget",key,oldWidget,newWidget])}}return elements}(hunk.changes,widgets);return React.createElement("tbody",{className:classnames("diff-hunk",className)},elements.map((function(item){return function(_ref,props){var _ref2=_slicedToArray(_ref,4),type=_ref2[0],key=_ref2[1],oldValue=_ref2[2],newValue=_ref2[3],selectedChanges=props.selectedChanges,monotonous=props.monotonous,hideGutter=props.hideGutter,tokens=props.tokens,lineClassName=props.lineClassName,changeProps=_objectWithoutProperties(props,["selectedChanges","monotonous","hideGutter","tokens","lineClassName"]);if("change"===type){var oldSelected=!!oldValue&&selectedChanges.includes(getChangeKey(oldValue)),newSelected=!!newValue&&selectedChanges.includes(getChangeKey(newValue)),oldTokens=oldValue&&tokens?tokens.old[computeOldLineNumber$2(oldValue)-1]:null,newTokens=newValue&&tokens?tokens.new[computeNewLineNumber$1(newValue)-1]:null;return React.createElement(SplitChange$1,_extends({key:"change".concat(key),className:lineClassName,oldChange:oldValue,newChange:newValue,monotonous:monotonous,hideGutter:hideGutter,oldSelected:oldSelected,newSelected:newSelected,oldTokens:oldTokens,newTokens:newTokens},changeProps))}return"widget"===type?React.createElement(SplitWidget,{key:"widget".concat(key),monotonous:monotonous,hideGutter:hideGutter,oldElement:oldValue,newElement:newValue}):null}(item,childrenProps)})))};SplitHunk.displayName="SplitHunk";var change,hunk,Hunk=function(_ref){var hunk=_ref.hunk,className=_ref.className,props=_objectWithoutProperties(_ref,["hunk","className"]),_useDiffSettings=useDiffSettings(),gutterType=_useDiffSettings.gutterType,context=_objectWithoutProperties(_useDiffSettings,["gutterType"]),hideGutter="none"===gutterType,gutterAnchor="anchor"===gutterType,RenderingHunk="unified"===context.viewType?UnifiedHunk:SplitHunk;return React.createElement(RenderingHunk,_extends({},context,props,{hunk:hunk,hideGutter:hideGutter,gutterAnchor:gutterAnchor,className:className}))};Hunk.displayName="Hunk",Hunk.propTypes=(change={type:PropTypes.oneOf(["delete","insert","normal"]).isRequired,content:PropTypes.string.isRequired,isNormal:PropTypes.bool,isInsert:PropTypes.bool,isDelete:PropTypes.bool,lineNumber:PropTypes.number,oldLineNumber:PropTypes.number,newLineNumber:PropTypes.number},hunk={oldStart:PropTypes.number.isRequired,oldLines:PropTypes.number.isRequired,newStart:PropTypes.number.isRequired,newLines:PropTypes.number.isRequired,content:PropTypes.string.isRequired,changes:PropTypes.arrayOf(PropTypes.shape(change)).isRequired},{hunk:PropTypes.shape(hunk).isRequired,className:PropTypes.string,lineClassName:PropTypes.string,gutterClassName:PropTypes.string,contentClassName:PropTypes.string,gutterEvents:PropTypes.object,codeEvents:PropTypes.object}),Hunk.defaultProps={className:"",lineClassName:"",gutterClassName:"",contentClassName:"",gutterEvents:{},codeEvents:{}};var noop=function(){},setUserSelectStyle=function(element,selectable){var value=selectable?"auto":"none";element.style.userSelect!==value&&(element.style.userSelect=value)},Diff=function(props){var root=useRef(null),enableColumnSelection=useCallback((function(_ref){var target=_ref.target;if(0===_ref.button){var closestCell=function(target,className){for(;target&&target!==document&&!target.classList.contains(className);)target=target.parentNode;return target===document?null:target}(target,"diff-code");if(closestCell){window.getSelection().removeAllRanges();var index=_toConsumableArray(closestCell.parentNode.children).indexOf(closestCell);if(1===index||3===index){var lines=root.current.querySelectorAll(".diff-line"),_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=lines[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var cells=_step.value.children;setUserSelectStyle(cells[1],1===index),setUserSelectStyle(cells[3],3===index)}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}}}}}),[]),diffType=props.diffType,children=props.children,className=props.className,optimizeSelection=props.optimizeSelection,hunks=props.hunks,remainings=_objectWithoutProperties(props,["diffType","children","className","optimizeSelection","hunks"]),gutterType=remainings.gutterType,viewType=remainings.viewType,hideGutter="none"===gutterType,monotonous="add"===diffType||"delete"===diffType,onTableMouseDown="split"===viewType&&!monotonous&&optimizeSelection?enableColumnSelection:noop,cols=function(viewType,monotonous){return"unified"===viewType?React.createElement("colgroup",null,!hideGutter&&React.createElement("col",{className:"diff-gutter-col"}),!hideGutter&&React.createElement("col",{className:"diff-gutter-col"}),React.createElement("col",null)):monotonous?React.createElement("colgroup",null,!hideGutter&&React.createElement("col",{className:"diff-gutter-col"}),React.createElement("col",null)):React.createElement("colgroup",null,!hideGutter&&React.createElement("col",{className:"diff-gutter-col"}),React.createElement("col",null),!hideGutter&&React.createElement("col",{className:"diff-gutter-col"}),React.createElement("col",null))}(props.viewType,monotonous);return React.createElement(Provider,{value:_objectSpread2({},remainings,{monotonous:monotonous})},React.createElement("table",{ref:root,className:classnames("diff","diff-".concat(viewType),className),onMouseDown:onTableMouseDown},cols,children(hunks)))};Diff.displayName="Diff",Diff.propTypes={diffType:PropTypes.oneOf(["add","delete","modify","rename","copy"]).isRequired,viewType:PropTypes.oneOf(["unified","split"]).isRequired,hunks:PropTypes.arrayOf(PropTypes.object).isRequired,gutterType:PropTypes.oneOf(["default","none","anchor"]),generateAnchorID:PropTypes.func,selectedChanges:PropTypes.arrayOf(PropTypes.string),widgets:PropTypes.objectOf(PropTypes.node),optimizeSelection:PropTypes.bool,className:PropTypes.string,renderToken:PropTypes.func,renderGutter:PropTypes.func,children:PropTypes.func},Diff.defaultProps={gutterType:"default",optimizeSelection:!1,selectedChanges:[],widgets:{},className:"",renderToken:void 0,renderGutter:function(_ref2){var renderDefault=_ref2.renderDefault;return(0,_ref2.wrapInAnchor)(renderDefault())},generateAnchorID:function(){},children:function(hunks){var key=function(hunk){return"-".concat(hunk.oldStart,",").concat(hunk.oldLines," +").concat(hunk.newStart,",").concat(hunk.newLines)};return hunks.map((function(hunk){return React.createElement(Hunk,{key:key(hunk),hunk:hunk})}))}};var index=memo(Diff),warning=function(){};if("production"!==process.env.NODE_ENV){var printWarning=function(format,args){var len=arguments.length;args=new Array(len>1?len-1:0);for(var key=1;key<len;key++)args[key-1]=arguments[key];var argIndex=0,message="Warning: "+format.replace(/%s/g,(function(){return args[argIndex++]}));"undefined"!=typeof console&&console.error(message);try{throw new Error(message)}catch(x){}};warning=function(condition,format,args){var len=arguments.length;args=new Array(len>2?len-2:0);for(var key=2;key<len;key++)args[key-2]=arguments[key];if(void 0===format)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");condition||printWarning.apply(null,[format].concat(args))}}var warning_1=warning,SplitDecoration=function(_ref){var hideGutter=_ref.hideGutter,monotonous=_ref.monotonous,className=_ref.className,gutterClassName=_ref.gutterClassName,contentClassName=_ref.contentClassName,children=_ref.children,computedClassName=classnames("diff-decoration",className),computedGutterClassName=classnames("diff-decoration-gutter",gutterClassName),computedContentClassName=classnames("diff-decoration-content",contentClassName),columnCount=(hideGutter?2:4)/(monotonous?2:1),headerContentColSpan=columnCount-(hideGutter?0:1);if(1===Children.count(children))return React.createElement("tbody",{className:computedClassName},React.createElement("tr",null,React.createElement("td",{colSpan:columnCount,className:computedContentClassName},children)));var _children=_slicedToArray(children,2),gutter=_children[0],content=_children[1];return React.createElement("tbody",{className:computedClassName},React.createElement("tr",null,!hideGutter&&React.createElement("td",{className:computedGutterClassName},gutter),React.createElement("td",{colSpan:headerContentColSpan,className:computedContentClassName},content)))};SplitDecoration.displayName="SplitDecoration";var UnifiedDecoration=function(_ref){var hideGutter=_ref.hideGutter,className=_ref.className,gutterClassName=_ref.gutterClassName,contentClassName=_ref.contentClassName,children=_ref.children,computedClassName=classnames("diff-decoration",className),computedGutterClassName=classnames("diff-decoration-gutter",gutterClassName),computedContentClassName=classnames("diff-decoration-content",contentClassName);if(1===Children.count(children))return React.createElement("tbody",{className:computedClassName},React.createElement("tr",null,React.createElement("td",{colSpan:hideGutter?1:3,className:computedContentClassName},children)));var _children=_slicedToArray(children,2),gutter=_children[0],content=_children[1];return React.createElement("tbody",{className:computedClassName},React.createElement("tr",null,!hideGutter&&React.createElement("td",{colSpan:2,className:computedGutterClassName},gutter),React.createElement("td",{className:computedContentClassName},content)))};UnifiedDecoration.displayName="UnifiedDecoration";var Decoration=function(props){var childrenCount=Children.count(props.children);warning_1(childrenCount<=2,"Decoration only accepts a maxium of 2 children"),warning_1(childrenCount<2||!props.hideGutter,"Gutter element in decoration will not be rendered since hideGutter prop is set to true");var _useDiffSettings=useDiffSettings(),viewType=_useDiffSettings.viewType,gutterType=_useDiffSettings.gutterType,monotonous=_useDiffSettings.monotonous,RenderingDecoration="split"===viewType?SplitDecoration:UnifiedDecoration;return React.createElement(RenderingDecoration,_extends({hideGutter:"none"===gutterType,monotonous:monotonous},props))};Decoration.displayName="Decoration",Decoration.propTypes={className:PropTypes.string,gutterClassName:PropTypes.string,contentClassName:PropTypes.string,children:PropTypes.node.isRequired},Decoration.defaultProps={className:"",gutterClassName:"",contentClassName:""};var objectCreate=Object.create,_baseCreate=function(){function object(){}return function(proto){if(!isObject_1(proto))return{};if(objectCreate)return objectCreate(proto);object.prototype=proto;var result=new object;return object.prototype=void 0,result}}();var _baseLodash=function(){};function LodashWrapper(value,chainAll){this.__wrapped__=value,this.__actions__=[],this.__chain__=!!chainAll,this.__index__=0,this.__values__=void 0}LodashWrapper.prototype=_baseCreate(_baseLodash.prototype),LodashWrapper.prototype.constructor=LodashWrapper;var _LodashWrapper=LodashWrapper,spreadableSymbol=_Symbol?_Symbol.isConcatSpreadable:void 0;var _isFlattenable=function(value){return isArray_1(value)||isArguments_1(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])};var _baseFlatten=function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=_isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):_arrayPush(result,value):isStrict||(result[result.length]=value)}return result};var flatten_1=function(array){return(null==array?0:array.length)?_baseFlatten(array,1):[]};var _apply=function(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)},nativeMax$1=Math.max;var _overRest=function(func,start,transform){return start=nativeMax$1(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax$1(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=transform(array),_apply(func,this,otherArgs)}};var constant_1=function(value){return function(){return value}},_baseSetToString=_defineProperty$1?function(func,string){return _defineProperty$1(func,"toString",{configurable:!0,enumerable:!1,value:constant_1(string),writable:!0})}:identity_1,HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;var _setToString=function(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);if(lastCalled=stamp,remaining>0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(void 0,arguments)}}(_baseSetToString);var _flatRest=function(func){return _setToString(_overRest(func,void 0,flatten_1),func+"")},_metaMap=_WeakMap&&new _WeakMap;var _getData=_metaMap?function(func){return _metaMap.get(func)}:function(){},_realNames={},hasOwnProperty$9=Object.prototype.hasOwnProperty;var _getFuncName=function(func){for(var result=func.name+"",array=_realNames[result],length=hasOwnProperty$9.call(_realNames,result)?array.length:0;length--;){var data=array[length],otherFunc=data.func;if(null==otherFunc||otherFunc==func)return data.name}return result},MAX_ARRAY_LENGTH=4294967295;function LazyWrapper(value){this.__wrapped__=value,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=MAX_ARRAY_LENGTH,this.__views__=[]}LazyWrapper.prototype=_baseCreate(_baseLodash.prototype),LazyWrapper.prototype.constructor=LazyWrapper;var _LazyWrapper=LazyWrapper;var _copyArray=function(source,array){var index=-1,length=source.length;for(array||(array=Array(length));++index<length;)array[index]=source[index];return array};var _wrapperClone=function(wrapper){if(wrapper instanceof _LazyWrapper)return wrapper.clone();var result=new _LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);return result.__actions__=_copyArray(wrapper.__actions__),result.__index__=wrapper.__index__,result.__values__=wrapper.__values__,result},hasOwnProperty$a=Object.prototype.hasOwnProperty;function lodash(value){if(isObjectLike_1(value)&&!isArray_1(value)&&!(value instanceof _LazyWrapper)){if(value instanceof _LodashWrapper)return value;if(hasOwnProperty$a.call(value,"__wrapped__"))return _wrapperClone(value)}return new _LodashWrapper(value)}lodash.prototype=_baseLodash.prototype,lodash.prototype.constructor=lodash;var wrapperLodash=lodash;var _isLaziable=function(func){var funcName=_getFuncName(func),other=wrapperLodash[funcName];if("function"!=typeof other||!(funcName in _LazyWrapper.prototype))return!1;if(func===other)return!0;var data=_getData(other);return!!data&&func===data[0]},FUNC_ERROR_TEXT$1="Expected a function",WRAP_CURRY_FLAG=8,WRAP_PARTIAL_FLAG=32,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256;var flow_1=function(fromRight){return _flatRest((function(funcs){var length=funcs.length,index=length,prereq=_LodashWrapper.prototype.thru;for(fromRight&&funcs.reverse();index--;){var func=funcs[index];if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT$1);if(prereq&&!wrapper&&"wrapper"==_getFuncName(func))var wrapper=new _LodashWrapper([],!0)}for(index=wrapper?index:length;++index<length;){func=funcs[index];var funcName=_getFuncName(func),data="wrapper"==funcName?_getData(func):void 0;wrapper=data&&_isLaziable(data[0])&&data[1]==(WRAP_ARY_FLAG|WRAP_CURRY_FLAG|WRAP_PARTIAL_FLAG|WRAP_REARG_FLAG)&&!data[4].length&&1==data[9]?wrapper[_getFuncName(data[0])].apply(wrapper,data[3]):1==func.length&&_isLaziable(func)?wrapper[funcName]():wrapper.thru(func)}return function(){var args=arguments,value=args[0];if(wrapper&&1==args.length&&isArray_1(value))return wrapper.plant(value).value();for(var index=0,result=length?funcs[index].apply(this,args):value;++index<length;)result=funcs[index].call(this,result);return result}}))}();var _arrayAggregator=function(array,setter,iteratee,accumulator){for(var index=-1,length=null==array?0:array.length;++index<length;){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator};var _baseEach=function(eachFunc,fromRight){return function(collection,iteratee){if(null==collection)return collection;if(!isArrayLike_1(collection))return eachFunc(collection,iteratee);for(var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);(fromRight?index--:++index<length)&&!1!==iteratee(iterable[index],index,iterable););return collection}}(_baseForOwn);var _baseAggregator=function(collection,setter,iteratee,accumulator){return _baseEach(collection,(function(value,key,collection){setter(accumulator,value,iteratee(value),collection)})),accumulator};var _createAggregator=function(setter,initializer){return function(collection,iteratee){var func=isArray_1(collection)?_arrayAggregator:_baseAggregator,accumulator=initializer?initializer():{};return func(collection,setter,_baseIteratee(iteratee),accumulator)}},keyBy_1=_createAggregator((function(result,value,key){_baseAssignValue(result,key,value)}));var last_1=function(array){var length=null==array?0:array.length;return length?array[length-1]:void 0};var _baseMap=function(collection,iteratee){var index=-1,result=isArrayLike_1(collection)?Array(collection.length):[];return _baseEach(collection,(function(value,key,collection){result[++index]=iteratee(value,key,collection)})),result};var map_1=function(collection,iteratee){return(isArray_1(collection)?_arrayMap:_baseMap)(collection,_baseIteratee(iteratee))};var flatMap_1=function(collection,iteratee){return _baseFlatten(map_1(collection,iteratee),1)},applyHunk=function(linesOfCode,_ref){var newStart=_ref.newStart,_changes$reduce=_ref.changes.reduce((function(_ref2,_ref3){var _ref4=_slicedToArray(_ref2,2),lines=_ref4[0],cursor=_ref4[1],content=_ref3.content,isInsert=_ref3.isInsert;return _ref3.isDelete?(lines.splice(cursor,1),[lines,cursor]):(isInsert&&lines.splice(cursor,0,content),[lines,cursor+1])}),[linesOfCode,newStart-1]);return _slicedToArray(_changes$reduce,1)[0]},mapChanges=function(changes,side,toValue){if(!changes.length)return[];var computeLineNumber="old"===side?computeOldLineNumber$2:computeNewLineNumber$1,changesByLineNumber=keyBy_1(changes,computeLineNumber),maxLineNumber=computeLineNumber(last_1(changes));return Array.from({length:maxLineNumber}).map((function(value,i){return toValue(changesByLineNumber[i+1])}))},toTextPair=function(hunks){var _groupChanges=function(hunks){return flatMap_1(hunks,(function(hunk){return hunk.changes})).reduce((function(_ref5,change){var _ref6=_slicedToArray(_ref5,2),oldChanges=_ref6[0],newChanges=_ref6[1];return change.isNormal?(oldChanges.push(change),newChanges.push(change)):change.isDelete?oldChanges.push(change):newChanges.push(change),[oldChanges,newChanges]}),[[],[]])}(hunks),_groupChanges2=_slicedToArray(_groupChanges,2),oldChanges=_groupChanges2[0],newChanges=_groupChanges2[1],toText=function(change){return change?change.content:""};return[mapChanges(oldChanges,"old",toText).join("\n"),mapChanges(newChanges,"new",toText).join("\n")]},createRoot=function(children){return{type:"root",children:children}},toTokenTrees=function(hunks,_ref7){var highlight=_ref7.highlight,refractor=_ref7.refractor,oldSource=_ref7.oldSource,language=_ref7.language;if(oldSource){var newSource=function(oldSource,hunks){return hunks.reduce(applyHunk,oldSource.split("\n")).join("\n")}(oldSource,hunks),highlightText=highlight?function(text,language){return refractor.highlight(text,language)}:function(text){return[{type:"text",value:text}]};return[createRoot(highlightText(oldSource,language)),createRoot(highlightText(newSource,language))]}var toTree=highlight?function(text){return createRoot(refractor.highlight(text,language))}:function(text){return createRoot([{type:"text",value:text}])};return toTextPair(hunks).map(toTree)};var _arrayEach=function(array,iteratee){for(var index=-1,length=null==array?0:array.length;++index<length&&!1!==iteratee(array[index],index,array););return array},hasOwnProperty$b=Object.prototype.hasOwnProperty;var _assignValue=function(object,key,value){var objValue=object[key];hasOwnProperty$b.call(object,key)&&eq_1(objValue,value)&&(void 0!==value||key in object)||_baseAssignValue(object,key,value)};var _copyObject=function(source,props,object,customizer){var isNew=!object;object||(object={});for(var index=-1,length=props.length;++index<length;){var key=props[index],newValue=customizer?customizer(object[key],source[key],key,object,source):void 0;void 0===newValue&&(newValue=source[key]),isNew?_baseAssignValue(object,key,newValue):_assignValue(object,key,newValue)}return object};var _baseAssign=function(object,source){return object&&_copyObject(source,keys_1(source),object)};var _nativeKeysIn=function(object){var result=[];if(null!=object)for(var key in Object(object))result.push(key);return result},hasOwnProperty$c=Object.prototype.hasOwnProperty;var _baseKeysIn=function(object){if(!isObject_1(object))return _nativeKeysIn(object);var isProto=_isPrototype(object),result=[];for(var key in object)("constructor"!=key||!isProto&&hasOwnProperty$c.call(object,key))&&result.push(key);return result};var keysIn_1=function(object){return isArrayLike_1(object)?_arrayLikeKeys(object,!0):_baseKeysIn(object)};var _baseAssignIn=function(object,source){return object&&_copyObject(source,keysIn_1(source),object)},_cloneBuffer=createCommonjsModule((function(module,exports){var freeExports=exports&&!exports.nodeType&&exports,freeModule=freeExports&&module&&!module.nodeType&&module,Buffer=freeModule&&freeModule.exports===freeExports?_root.Buffer:void 0,allocUnsafe=Buffer?Buffer.allocUnsafe:void 0;module.exports=function(buffer,isDeep){if(isDeep)return buffer.slice();var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);return buffer.copy(result),result}}));var _copySymbols=function(source,object){return _copyObject(source,_getSymbols(source),object)},_getPrototype=_overArg(Object.getPrototypeOf,Object),_getSymbolsIn=Object.getOwnPropertySymbols?function(object){for(var result=[];object;)_arrayPush(result,_getSymbols(object)),object=_getPrototype(object);return result}:stubArray_1;var _copySymbolsIn=function(source,object){return _copyObject(source,_getSymbolsIn(source),object)};var _getAllKeysIn=function(object){return _baseGetAllKeys(object,keysIn_1,_getSymbolsIn)},hasOwnProperty$d=Object.prototype.hasOwnProperty;var _initCloneArray=function(array){var length=array.length,result=new array.constructor(length);return length&&"string"==typeof array[0]&&hasOwnProperty$d.call(array,"index")&&(result.index=array.index,result.input=array.input),result};var _cloneArrayBuffer=function(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);return new _Uint8Array(result).set(new _Uint8Array(arrayBuffer)),result};var _cloneDataView=function(dataView,isDeep){var buffer=isDeep?_cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)},reFlags=/\w*$/;var _cloneRegExp=function(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));return result.lastIndex=regexp.lastIndex,result},symbolProto$2=_Symbol?_Symbol.prototype:void 0,symbolValueOf$1=symbolProto$2?symbolProto$2.valueOf:void 0;var _cloneSymbol=function(symbol){return symbolValueOf$1?Object(symbolValueOf$1.call(symbol)):{}};var _cloneTypedArray=function(typedArray,isDeep){var buffer=isDeep?_cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)},boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";var _initCloneByTag=function(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag$2:return _cloneArrayBuffer(object);case boolTag$2:case dateTag$2:return new Ctor(+object);case dataViewTag$3:return _cloneDataView(object,isDeep);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return _cloneTypedArray(object,isDeep);case mapTag$3:return new Ctor;case numberTag$2:case stringTag$2:return new Ctor(object);case regexpTag$2:return _cloneRegExp(object);case setTag$3:return new Ctor;case symbolTag$2:return _cloneSymbol(object)}};var _initCloneObject=function(object){return"function"!=typeof object.constructor||_isPrototype(object)?{}:_baseCreate(_getPrototype(object))},mapTag$4="[object Map]";var _baseIsMap=function(value){return isObjectLike_1(value)&&_getTag(value)==mapTag$4},nodeIsMap=_nodeUtil&&_nodeUtil.isMap,isMap_1=nodeIsMap?_baseUnary(nodeIsMap):_baseIsMap,setTag$4="[object Set]";var _baseIsSet=function(value){return isObjectLike_1(value)&&_getTag(value)==setTag$4},nodeIsSet=_nodeUtil&&_nodeUtil.isSet,isSet_1=nodeIsSet?_baseUnary(nodeIsSet):_baseIsSet,CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4,argsTag$3="[object Arguments]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",objectTag$3="[object Object]",cloneableTags={};cloneableTags[argsTag$3]=cloneableTags["[object Array]"]=cloneableTags["[object ArrayBuffer]"]=cloneableTags["[object DataView]"]=cloneableTags["[object Boolean]"]=cloneableTags["[object Date]"]=cloneableTags["[object Float32Array]"]=cloneableTags["[object Float64Array]"]=cloneableTags["[object Int8Array]"]=cloneableTags["[object Int16Array]"]=cloneableTags["[object Int32Array]"]=cloneableTags["[object Map]"]=cloneableTags["[object Number]"]=cloneableTags[objectTag$3]=cloneableTags["[object RegExp]"]=cloneableTags["[object Set]"]=cloneableTags["[object String]"]=cloneableTags["[object Symbol]"]=cloneableTags["[object Uint8Array]"]=cloneableTags["[object Uint8ClampedArray]"]=cloneableTags["[object Uint16Array]"]=cloneableTags["[object Uint32Array]"]=!0,cloneableTags["[object Error]"]=cloneableTags[funcTag$2]=cloneableTags["[object WeakMap]"]=!1;var _baseClone=function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer&&(result=object?customizer(value,key,object,stack):customizer(value)),void 0!==result)return result;if(!isObject_1(value))return value;var isArr=isArray_1(value);if(isArr){if(result=_initCloneArray(value),!isDeep)return _copyArray(value,result)}else{var tag=_getTag(value),isFunc=tag==funcTag$2||tag==genTag$1;if(isBuffer_1(value))return _cloneBuffer(value,isDeep);if(tag==objectTag$3||tag==argsTag$3||isFunc&&!object){if(result=isFlat||isFunc?{}:_initCloneObject(value),!isDeep)return isFlat?_copySymbolsIn(value,_baseAssignIn(result,value)):_copySymbols(value,_baseAssign(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=_initCloneByTag(value,tag,isDeep)}}stack||(stack=new _Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result),isSet_1(value)?value.forEach((function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))})):isMap_1(value)&&value.forEach((function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,stack))}));var keysFunc=isFull?isFlat?_getAllKeysIn:_getAllKeys:isFlat?keysIn:keys_1,props=isArr?void 0:keysFunc(value);return _arrayEach(props||value,(function(subValue,key){props&&(subValue=value[key=subValue]),_assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))})),result};var _baseSlice=function(array,start,end){var index=-1,length=array.length;start<0&&(start=-start>length?0:length+start),(end=end>length?length:end)<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index<length;)result[index]=array[index+start];return result};var _parent=function(object,path){return path.length<2?object:_baseGet(object,_baseSlice(path,0,-1))};var _baseUnset=function(object,path){return path=_castPath(path,object),null==(object=_parent(object,path))||delete object[_toKey(last_1(path))]},objectTag$4="[object Object]",funcProto$2=Function.prototype,objectProto$h=Object.prototype,funcToString$2=funcProto$2.toString,hasOwnProperty$e=objectProto$h.hasOwnProperty,objectCtorString=funcToString$2.call(Object);var isPlainObject_1=function(value){if(!isObjectLike_1(value)||_baseGetTag(value)!=objectTag$4)return!1;var proto=_getPrototype(value);if(null===proto)return!0;var Ctor=hasOwnProperty$e.call(proto,"constructor")&&proto.constructor;return"function"==typeof Ctor&&Ctor instanceof Ctor&&funcToString$2.call(Ctor)==objectCtorString};var _customOmitClone=function(value){return isPlainObject_1(value)?void 0:value},omit_1=_flatRest((function(object,paths){var result={};if(null==object)return result;var isDeep=!1;paths=_arrayMap(paths,(function(path){return path=_castPath(path,object),isDeep||(isDeep=path.length>1),path})),_copyObject(object,_getAllKeysIn(object),result),isDeep&&(result=_baseClone(result,7,_customOmitClone));for(var length=paths.length;length--;)_baseUnset(result,paths[length]);return result})),clone=function(path){return path.map((function(node){return _objectSpread2({},node)}))},replace=function(path,leaf){return[].concat(_toConsumableArray(clone(path.slice(0,-1))),[leaf])},split=function(path,splitStart,splitEnd,wrapSplitNode){var parents=path.slice(0,-1),leaf=last_1(path),output=[];if(splitEnd<=0||splitStart>=leaf.value.length)return[path];var split=function(start,end){var value=leaf.value.slice(start,end);return[].concat(_toConsumableArray(parents),[_objectSpread2({},leaf,{value:value})])};if(splitStart>0){var head=split(0,splitStart);output.push(clone(head))}var body=split(Math.max(splitStart,0),splitEnd);if(output.push(wrapSplitNode?function(path,parent){return[parent].concat(_toConsumableArray(clone(path)))}(body,wrapSplitNode):clone(body)),splitEnd<leaf.value.length){var tail=split(splitEnd);output.push(clone(tail))}return output},splitByLineBreak=function(paths){return paths.reduce((function(lines,path){var currentLine=last_1(lines),_splitPathToLines2=_toArray(function(path){var leaf=last_1(path);return leaf.value.includes("\n")?leaf.value.split("\n").map((function(line){return replace(path,_objectSpread2({},leaf,{value:line}))})):[path]}(path)),currentRemaining=_splitPathToLines2[0],nextLines=_splitPathToLines2.slice(1);return[].concat(_toConsumableArray(lines.slice(0,-1)),[[].concat(_toConsumableArray(currentLine),[currentRemaining])],_toConsumableArray(nextLines.map((function(path){return[path]}))))}),[[]])},normalizeToLines=function(tree){var paths=function treeToPathList(node){var output=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],path=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],nodeToUse=omit_1(node,"children");if(node.children){path.push(nodeToUse);var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=node.children[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var child=_step.value;treeToPathList(child,output,path)}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}path.pop()}else output.push(clone([].concat(_toConsumableArray(path.slice(1)),[nodeToUse])));return output}(tree);return splitByLineBreak(paths)};var isEqual_1=function(value,other){return _baseIsEqual(value,other)},attachNode=function(parent,node){var x,y,previousSibling=last_1(parent.children);return previousSibling&&function(x,y){if(x.type!==y.type)return!1;if("text"===x.type)return!0;if(!x.children||!y.children)return!1;var xBase="children"in x?omit_1(x,"children"):x,yBase="children"in y?omit_1(y,"children"):y;return isEqual_1(xBase,yBase)}(previousSibling,node)?parent.children[parent.children.length-1]=(y=node,"value"in(x=previousSibling)?_objectSpread2({},x,{value:x.value+y.value}):x):parent.children.push(node),last_1(parent.children)},backToTree=function(pathList){var root={type:"root",children:[]},_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_loop=function(){var path=_step.value;path.reduce((function(parent,node,i){var nodeToUse=i===path.length-1?_objectSpread2({},node):_objectSpread2({},node,{children:[]});return attachNode(parent,nodeToUse)}),root)},_iterator=pathList[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0)_loop()}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return root},hasOwnProperty$f=Object.prototype.hasOwnProperty,groupBy_1=_createAggregator((function(result,value,key){hasOwnProperty$f.call(result,key)?result[key].push(value):_baseAssignValue(result,key,[value])})),mapTag$6="[object Map]",setTag$6="[object Set]",hasOwnProperty$g=Object.prototype.hasOwnProperty;var isEmpty_1=function(value){if(null==value)return!0;if(isArrayLike_1(value)&&(isArray_1(value)||"string"==typeof value||"function"==typeof value.splice||isBuffer_1(value)||isTypedArray_1(value)||isArguments_1(value)))return!value.length;var tag=_getTag(value);if(tag==mapTag$6||tag==setTag$6)return!value.size;if(_isPrototype(value))return!_baseKeys(value).length;for(var key in value)if(hasOwnProperty$g.call(value,key))return!1;return!0},splitPathToEncloseRange=function(paths,node){var start=node.start,length=node.length,properties=node.properties,rangeEnd=start+length,_paths$reduce=paths.reduce((function(_ref,path){var _ref2=_slicedToArray(_ref,2),output=_ref2[0],nodeStart=_ref2[1],nodeEnd=nodeStart+last_1(path).value.length;if(nodeStart>rangeEnd||nodeEnd<start)output.push(path);else{var wrapNode=_objectSpread2({},node,{},properties),segments=split(path,start-nodeStart,rangeEnd-nodeStart,wrapNode);output.push.apply(output,_toConsumableArray(segments))}return[output,nodeEnd]}),[[],0]);return _slicedToArray(_paths$reduce,1)[0]},process$1=function(linesOfPaths,ranges){var rangesByLine=groupBy_1(ranges,"lineNumber");return linesOfPaths.map((function(line,i){return function(paths,ranges){return isEmpty_1(ranges)?paths:ranges.reduce(splitPathToEncloseRange,paths)}(line,rangesByLine[i+1])}))},pickRanges=function(oldRanges,newRanges){return function(_ref3){var _ref4=_slicedToArray(_ref3,2),oldLinesOfPaths=_ref4[0],newLinesOfPaths=_ref4[1];return[process$1(oldLinesOfPaths,oldRanges),process$1(newLinesOfPaths,newRanges)]}},nativeMax$2=Math.max;var x,findIndex_1=function(array,predicate,fromIndex){var length=null==array?0:array.length;if(!length)return-1;var index=null==fromIndex?0:toInteger_1(fromIndex);return index<0&&(index=nativeMax$2(length+index,0)),_baseFindIndex(array,_baseIteratee(predicate),index)},diffMatchPatch=createCommonjsModule((function(module){function diff_match_patch(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32}diff_match_patch.prototype.diff_main=function(text1,text2,opt_checklines,opt_deadline){void 0===opt_deadline&&(opt_deadline=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var deadline=opt_deadline;if(null==text1||null==text2)throw new Error("Null input. (diff_main)");if(text1==text2)return text1?[[0,text1]]:[];void 0===opt_checklines&&(opt_checklines=!0);var checklines=opt_checklines,commonlength=this.diff_commonPrefix(text1,text2),commonprefix=text1.substring(0,commonlength);text1=text1.substring(commonlength),text2=text2.substring(commonlength),commonlength=this.diff_commonSuffix(text1,text2);var commonsuffix=text1.substring(text1.length-commonlength);text1=text1.substring(0,text1.length-commonlength),text2=text2.substring(0,text2.length-commonlength);var diffs=this.diff_compute_(text1,text2,checklines,deadline);return commonprefix&&diffs.unshift([0,commonprefix]),commonsuffix&&diffs.push([0,commonsuffix]),this.diff_cleanupMerge(diffs),diffs},diff_match_patch.prototype.diff_compute_=function(text1,text2,checklines,deadline){var diffs;if(!text1)return[[1,text2]];if(!text2)return[[-1,text1]];var longtext=text1.length>text2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1,i=longtext.indexOf(shorttext);if(-1!=i)return diffs=[[1,longtext.substring(0,i)],[0,shorttext],[1,longtext.substring(i+shorttext.length)]],text1.length>text2.length&&(diffs[0][0]=diffs[2][0]=-1),diffs;if(1==shorttext.length)return[[-1,text1],[1,text2]];var hm=this.diff_halfMatch_(text1,text2);if(hm){var text1_a=hm[0],text1_b=hm[1],text2_a=hm[2],text2_b=hm[3],mid_common=hm[4],diffs_a=this.diff_main(text1_a,text2_a,checklines,deadline),diffs_b=this.diff_main(text1_b,text2_b,checklines,deadline);return diffs_a.concat([[0,mid_common]],diffs_b)}return checklines&&text1.length>100&&text2.length>100?this.diff_lineMode_(text1,text2,deadline):this.diff_bisect_(text1,text2,deadline)},diff_match_patch.prototype.diff_lineMode_=function(text1,text2,deadline){text1=(a=this.diff_linesToChars_(text1,text2)).chars1,text2=a.chars2;var linearray=a.lineArray,diffs=this.diff_main(text1,text2,!1,deadline);this.diff_charsToLines_(diffs,linearray),this.diff_cleanupSemantic(diffs),diffs.push([0,""]);for(var pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="";pointer<diffs.length;){switch(diffs[pointer][0]){case 1:count_insert++,text_insert+=diffs[pointer][1];break;case-1:count_delete++,text_delete+=diffs[pointer][1];break;case 0:if(count_delete>=1&&count_insert>=1){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert),pointer=pointer-count_delete-count_insert;for(var a,j=(a=this.diff_main(text_delete,text_insert,!1,deadline)).length-1;j>=0;j--)diffs.splice(pointer,0,a[j]);pointer+=a.length}count_insert=0,count_delete=0,text_delete="",text_insert=""}pointer++}return diffs.pop(),diffs},diff_match_patch.prototype.diff_bisect_=function(text1,text2,deadline){for(var text1_length=text1.length,text2_length=text2.length,max_d=Math.ceil((text1_length+text2_length)/2),v_offset=max_d,v_length=2*max_d,v1=new Array(v_length),v2=new Array(v_length),x=0;x<v_length;x++)v1[x]=-1,v2[x]=-1;v1[v_offset+1]=0,v2[v_offset+1]=0;for(var delta=text1_length-text2_length,front=delta%2!=0,k1start=0,k1end=0,k2start=0,k2end=0,d=0;d<max_d&&!((new Date).getTime()>deadline);d++){for(var k1=-d+k1start;k1<=d-k1end;k1+=2){for(var k1_offset=v_offset+k1,y1=(x1=k1==-d||k1!=d&&v1[k1_offset-1]<v1[k1_offset+1]?v1[k1_offset+1]:v1[k1_offset-1]+1)-k1;x1<text1_length&&y1<text2_length&&text1.charAt(x1)==text2.charAt(y1);)x1++,y1++;if(v1[k1_offset]=x1,x1>text1_length)k1end+=2;else if(y1>text2_length)k1start+=2;else if(front){if((k2_offset=v_offset+delta-k1)>=0&&k2_offset<v_length&&-1!=v2[k2_offset])if(x1>=(x2=text1_length-v2[k2_offset]))return this.diff_bisectSplit_(text1,text2,x1,y1,deadline)}}for(var k2=-d+k2start;k2<=d-k2end;k2+=2){for(var x2,k2_offset=v_offset+k2,y2=(x2=k2==-d||k2!=d&&v2[k2_offset-1]<v2[k2_offset+1]?v2[k2_offset+1]:v2[k2_offset-1]+1)-k2;x2<text1_length&&y2<text2_length&&text1.charAt(text1_length-x2-1)==text2.charAt(text2_length-y2-1);)x2++,y2++;if(v2[k2_offset]=x2,x2>text1_length)k2end+=2;else if(y2>text2_length)k2start+=2;else if(!front){if((k1_offset=v_offset+delta-k2)>=0&&k1_offset<v_length&&-1!=v1[k1_offset]){var x1;y1=v_offset+(x1=v1[k1_offset])-k1_offset;if(x1>=(x2=text1_length-x2))return this.diff_bisectSplit_(text1,text2,x1,y1,deadline)}}}}return[[-1,text1],[1,text2]]},diff_match_patch.prototype.diff_bisectSplit_=function(text1,text2,x,y,deadline){var text1a=text1.substring(0,x),text2a=text2.substring(0,y),text1b=text1.substring(x),text2b=text2.substring(y),diffs=this.diff_main(text1a,text2a,!1,deadline),diffsb=this.diff_main(text1b,text2b,!1,deadline);return diffs.concat(diffsb)},diff_match_patch.prototype.diff_linesToChars_=function(text1,text2){var lineArray=[],lineHash={};function diff_linesToCharsMunge_(text){for(var chars="",lineStart=0,lineEnd=-1,lineArrayLength=lineArray.length;lineEnd<text.length-1;){-1==(lineEnd=text.indexOf("\n",lineStart))&&(lineEnd=text.length-1);var line=text.substring(lineStart,lineEnd+1);lineStart=lineEnd+1,(lineHash.hasOwnProperty?lineHash.hasOwnProperty(line):void 0!==lineHash[line])?chars+=String.fromCharCode(lineHash[line]):(chars+=String.fromCharCode(lineArrayLength),lineHash[line]=lineArrayLength,lineArray[lineArrayLength++]=line)}return chars}return lineArray[0]="",{chars1:diff_linesToCharsMunge_(text1),chars2:diff_linesToCharsMunge_(text2),lineArray:lineArray}},diff_match_patch.prototype.diff_charsToLines_=function(diffs,lineArray){for(var x=0;x<diffs.length;x++){for(var chars=diffs[x][1],text=[],y=0;y<chars.length;y++)text[y]=lineArray[chars.charCodeAt(y)];diffs[x][1]=text.join("")}},diff_match_patch.prototype.diff_commonPrefix=function(text1,text2){if(!text1||!text2||text1.charAt(0)!=text2.charAt(0))return 0;for(var pointermin=0,pointermax=Math.min(text1.length,text2.length),pointermid=pointermax,pointerstart=0;pointermin<pointermid;)text1.substring(pointerstart,pointermid)==text2.substring(pointerstart,pointermid)?pointerstart=pointermin=pointermid:pointermax=pointermid,pointermid=Math.floor((pointermax-pointermin)/2+pointermin);return pointermid},diff_match_patch.prototype.diff_commonSuffix=function(text1,text2){if(!text1||!text2||text1.charAt(text1.length-1)!=text2.charAt(text2.length-1))return 0;for(var pointermin=0,pointermax=Math.min(text1.length,text2.length),pointermid=pointermax,pointerend=0;pointermin<pointermid;)text1.substring(text1.length-pointermid,text1.length-pointerend)==text2.substring(text2.length-pointermid,text2.length-pointerend)?pointerend=pointermin=pointermid:pointermax=pointermid,pointermid=Math.floor((pointermax-pointermin)/2+pointermin);return pointermid},diff_match_patch.prototype.diff_commonOverlap_=function(text1,text2){var text1_length=text1.length,text2_length=text2.length;if(0==text1_length||0==text2_length)return 0;text1_length>text2_length?text1=text1.substring(text1_length-text2_length):text1_length<text2_length&&(text2=text2.substring(0,text1_length));var text_length=Math.min(text1_length,text2_length);if(text1==text2)return text_length;for(var best=0,length=1;;){var pattern=text1.substring(text_length-length),found=text2.indexOf(pattern);if(-1==found)return best;length+=found,0!=found&&text1.substring(text_length-length)!=text2.substring(0,length)||(best=length,length++)}},diff_match_patch.prototype.diff_halfMatch_=function(text1,text2){if(this.Diff_Timeout<=0)return null;var longtext=text1.length>text2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1;if(longtext.length<4||2*shorttext.length<longtext.length)return null;var dmp=this;function diff_halfMatchI_(longtext,shorttext,i){for(var best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,seed=longtext.substring(i,i+Math.floor(longtext.length/4)),j=-1,best_common="";-1!=(j=shorttext.indexOf(seed,j+1));){var prefixLength=dmp.diff_commonPrefix(longtext.substring(i),shorttext.substring(j)),suffixLength=dmp.diff_commonSuffix(longtext.substring(0,i),shorttext.substring(0,j));best_common.length<suffixLength+prefixLength&&(best_common=shorttext.substring(j-suffixLength,j)+shorttext.substring(j,j+prefixLength),best_longtext_a=longtext.substring(0,i-suffixLength),best_longtext_b=longtext.substring(i+prefixLength),best_shorttext_a=shorttext.substring(0,j-suffixLength),best_shorttext_b=shorttext.substring(j+prefixLength))}return 2*best_common.length>=longtext.length?[best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,best_common]:null}var hm,text1_a,text1_b,text2_a,text2_b,hm1=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/4)),hm2=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/2));return hm1||hm2?(hm=hm2?hm1&&hm1[4].length>hm2[4].length?hm1:hm2:hm1,text1.length>text2.length?(text1_a=hm[0],text1_b=hm[1],text2_a=hm[2],text2_b=hm[3]):(text2_a=hm[0],text2_b=hm[1],text1_a=hm[2],text1_b=hm[3]),[text1_a,text1_b,text2_a,text2_b,hm[4]]):null},diff_match_patch.prototype.diff_cleanupSemantic=function(diffs){for(var changes=!1,equalities=[],equalitiesLength=0,lastequality=null,pointer=0,length_insertions1=0,length_deletions1=0,length_insertions2=0,length_deletions2=0;pointer<diffs.length;)0==diffs[pointer][0]?(equalities[equalitiesLength++]=pointer,length_insertions1=length_insertions2,length_deletions1=length_deletions2,length_insertions2=0,length_deletions2=0,lastequality=diffs[pointer][1]):(1==diffs[pointer][0]?length_insertions2+=diffs[pointer][1].length:length_deletions2+=diffs[pointer][1].length,lastequality&&lastequality.length<=Math.max(length_insertions1,length_deletions1)&&lastequality.length<=Math.max(length_insertions2,length_deletions2)&&(diffs.splice(equalities[equalitiesLength-1],0,[-1,lastequality]),diffs[equalities[equalitiesLength-1]+1][0]=1,equalitiesLength--,pointer=--equalitiesLength>0?equalities[equalitiesLength-1]:-1,length_insertions1=0,length_deletions1=0,length_insertions2=0,length_deletions2=0,lastequality=null,changes=!0)),pointer++;for(changes&&this.diff_cleanupMerge(diffs),this.diff_cleanupSemanticLossless(diffs),pointer=1;pointer<diffs.length;){if(-1==diffs[pointer-1][0]&&1==diffs[pointer][0]){var deletion=diffs[pointer-1][1],insertion=diffs[pointer][1],overlap_length1=this.diff_commonOverlap_(deletion,insertion),overlap_length2=this.diff_commonOverlap_(insertion,deletion);overlap_length1>=overlap_length2?(overlap_length1>=deletion.length/2||overlap_length1>=insertion.length/2)&&(diffs.splice(pointer,0,[0,insertion.substring(0,overlap_length1)]),diffs[pointer-1][1]=deletion.substring(0,deletion.length-overlap_length1),diffs[pointer+1][1]=insertion.substring(overlap_length1),pointer++):(overlap_length2>=deletion.length/2||overlap_length2>=insertion.length/2)&&(diffs.splice(pointer,0,[0,deletion.substring(0,overlap_length2)]),diffs[pointer-1][0]=1,diffs[pointer-1][1]=insertion.substring(0,insertion.length-overlap_length2),diffs[pointer+1][0]=-1,diffs[pointer+1][1]=deletion.substring(overlap_length2),pointer++),pointer++}pointer++}},diff_match_patch.prototype.diff_cleanupSemanticLossless=function(diffs){function diff_cleanupSemanticScore_(one,two){if(!one||!two)return 6;var char1=one.charAt(one.length-1),char2=two.charAt(0),nonAlphaNumeric1=char1.match(diff_match_patch.nonAlphaNumericRegex_),nonAlphaNumeric2=char2.match(diff_match_patch.nonAlphaNumericRegex_),whitespace1=nonAlphaNumeric1&&char1.match(diff_match_patch.whitespaceRegex_),whitespace2=nonAlphaNumeric2&&char2.match(diff_match_patch.whitespaceRegex_),lineBreak1=whitespace1&&char1.match(diff_match_patch.linebreakRegex_),lineBreak2=whitespace2&&char2.match(diff_match_patch.linebreakRegex_),blankLine1=lineBreak1&&one.match(diff_match_patch.blanklineEndRegex_),blankLine2=lineBreak2&&two.match(diff_match_patch.blanklineStartRegex_);return blankLine1||blankLine2?5:lineBreak1||lineBreak2?4:nonAlphaNumeric1&&!whitespace1&&whitespace2?3:whitespace1||whitespace2?2:nonAlphaNumeric1||nonAlphaNumeric2?1:0}for(var pointer=1;pointer<diffs.length-1;){if(0==diffs[pointer-1][0]&&0==diffs[pointer+1][0]){var equality1=diffs[pointer-1][1],edit=diffs[pointer][1],equality2=diffs[pointer+1][1],commonOffset=this.diff_commonSuffix(equality1,edit);if(commonOffset){var commonString=edit.substring(edit.length-commonOffset);equality1=equality1.substring(0,equality1.length-commonOffset),edit=commonString+edit.substring(0,edit.length-commonOffset),equality2=commonString+equality2}for(var bestEquality1=equality1,bestEdit=edit,bestEquality2=equality2,bestScore=diff_cleanupSemanticScore_(equality1,edit)+diff_cleanupSemanticScore_(edit,equality2);edit.charAt(0)===equality2.charAt(0);){equality1+=edit.charAt(0),edit=edit.substring(1)+equality2.charAt(0),equality2=equality2.substring(1);var score=diff_cleanupSemanticScore_(equality1,edit)+diff_cleanupSemanticScore_(edit,equality2);score>=bestScore&&(bestScore=score,bestEquality1=equality1,bestEdit=edit,bestEquality2=equality2)}diffs[pointer-1][1]!=bestEquality1&&(bestEquality1?diffs[pointer-1][1]=bestEquality1:(diffs.splice(pointer-1,1),pointer--),diffs[pointer][1]=bestEdit,bestEquality2?diffs[pointer+1][1]=bestEquality2:(diffs.splice(pointer+1,1),pointer--))}pointer++}},diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,diff_match_patch.whitespaceRegex_=/\s/,diff_match_patch.linebreakRegex_=/[\r\n]/,diff_match_patch.blanklineEndRegex_=/\n\r?\n$/,diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/,diff_match_patch.prototype.diff_cleanupEfficiency=function(diffs){for(var changes=!1,equalities=[],equalitiesLength=0,lastequality=null,pointer=0,pre_ins=!1,pre_del=!1,post_ins=!1,post_del=!1;pointer<diffs.length;)0==diffs[pointer][0]?(diffs[pointer][1].length<this.Diff_EditCost&&(post_ins||post_del)?(equalities[equalitiesLength++]=pointer,pre_ins=post_ins,pre_del=post_del,lastequality=diffs[pointer][1]):(equalitiesLength=0,lastequality=null),post_ins=post_del=!1):(-1==diffs[pointer][0]?post_del=!0:post_ins=!0,lastequality&&(pre_ins&&pre_del&&post_ins&&post_del||lastequality.length<this.Diff_EditCost/2&&pre_ins+pre_del+post_ins+post_del==3)&&(diffs.splice(equalities[equalitiesLength-1],0,[-1,lastequality]),diffs[equalities[equalitiesLength-1]+1][0]=1,equalitiesLength--,lastequality=null,pre_ins&&pre_del?(post_ins=post_del=!0,equalitiesLength=0):(pointer=--equalitiesLength>0?equalities[equalitiesLength-1]:-1,post_ins=post_del=!1),changes=!0)),pointer++;changes&&this.diff_cleanupMerge(diffs)},diff_match_patch.prototype.diff_cleanupMerge=function(diffs){diffs.push([0,""]);for(var commonlength,pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="";pointer<diffs.length;)switch(diffs[pointer][0]){case 1:count_insert++,text_insert+=diffs[pointer][1],pointer++;break;case-1:count_delete++,text_delete+=diffs[pointer][1],pointer++;break;case 0:count_delete+count_insert>1?(0!==count_delete&&0!==count_insert&&(0!==(commonlength=this.diff_commonPrefix(text_insert,text_delete))&&(pointer-count_delete-count_insert>0&&0==diffs[pointer-count_delete-count_insert-1][0]?diffs[pointer-count_delete-count_insert-1][1]+=text_insert.substring(0,commonlength):(diffs.splice(0,0,[0,text_insert.substring(0,commonlength)]),pointer++),text_insert=text_insert.substring(commonlength),text_delete=text_delete.substring(commonlength)),0!==(commonlength=this.diff_commonSuffix(text_insert,text_delete))&&(diffs[pointer][1]=text_insert.substring(text_insert.length-commonlength)+diffs[pointer][1],text_insert=text_insert.substring(0,text_insert.length-commonlength),text_delete=text_delete.substring(0,text_delete.length-commonlength))),0===count_delete?diffs.splice(pointer-count_insert,count_delete+count_insert,[1,text_insert]):0===count_insert?diffs.splice(pointer-count_delete,count_delete+count_insert,[-1,text_delete]):diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[-1,text_delete],[1,text_insert]),pointer=pointer-count_delete-count_insert+(count_delete?1:0)+(count_insert?1:0)+1):0!==pointer&&0==diffs[pointer-1][0]?(diffs[pointer-1][1]+=diffs[pointer][1],diffs.splice(pointer,1)):pointer++,count_insert=0,count_delete=0,text_delete="",text_insert=""}""===diffs[diffs.length-1][1]&&diffs.pop();var changes=!1;for(pointer=1;pointer<diffs.length-1;)0==diffs[pointer-1][0]&&0==diffs[pointer+1][0]&&(diffs[pointer][1].substring(diffs[pointer][1].length-diffs[pointer-1][1].length)==diffs[pointer-1][1]?(diffs[pointer][1]=diffs[pointer-1][1]+diffs[pointer][1].substring(0,diffs[pointer][1].length-diffs[pointer-1][1].length),diffs[pointer+1][1]=diffs[pointer-1][1]+diffs[pointer+1][1],diffs.splice(pointer-1,1),changes=!0):diffs[pointer][1].substring(0,diffs[pointer+1][1].length)==diffs[pointer+1][1]&&(diffs[pointer-1][1]+=diffs[pointer+1][1],diffs[pointer][1]=diffs[pointer][1].substring(diffs[pointer+1][1].length)+diffs[pointer+1][1],diffs.splice(pointer+1,1),changes=!0)),pointer++;changes&&this.diff_cleanupMerge(diffs)},diff_match_patch.prototype.diff_xIndex=function(diffs,loc){var x,chars1=0,chars2=0,last_chars1=0,last_chars2=0;for(x=0;x<diffs.length&&(1!==diffs[x][0]&&(chars1+=diffs[x][1].length),-1!==diffs[x][0]&&(chars2+=diffs[x][1].length),!(chars1>loc));x++)last_chars1=chars1,last_chars2=chars2;return diffs.length!=x&&-1===diffs[x][0]?last_chars2:last_chars2+(loc-last_chars1)},diff_match_patch.prototype.diff_prettyHtml=function(diffs){for(var html=[],pattern_amp=/&/g,pattern_lt=/</g,pattern_gt=/>/g,pattern_para=/\n/g,x=0;x<diffs.length;x++){var op=diffs[x][0],text=diffs[x][1].replace(pattern_amp,"&amp;").replace(pattern_lt,"&lt;").replace(pattern_gt,"&gt;").replace(pattern_para,"&para;<br>");switch(op){case 1:html[x]='<ins style="background:#e6ffe6;">'+text+"</ins>";break;case-1:html[x]='<del style="background:#ffe6e6;">'+text+"</del>";break;case 0:html[x]="<span>"+text+"</span>"}}return html.join("")},diff_match_patch.prototype.diff_text1=function(diffs){for(var text=[],x=0;x<diffs.length;x++)1!==diffs[x][0]&&(text[x]=diffs[x][1]);return text.join("")},diff_match_patch.prototype.diff_text2=function(diffs){for(var text=[],x=0;x<diffs.length;x++)-1!==diffs[x][0]&&(text[x]=diffs[x][1]);return text.join("")},diff_match_patch.prototype.diff_levenshtein=function(diffs){for(var levenshtein=0,insertions=0,deletions=0,x=0;x<diffs.length;x++){var op=diffs[x][0],data=diffs[x][1];switch(op){case 1:insertions+=data.length;break;case-1:deletions+=data.length;break;case 0:levenshtein+=Math.max(insertions,deletions),insertions=0,deletions=0}}return levenshtein+=Math.max(insertions,deletions)},diff_match_patch.prototype.diff_toDelta=function(diffs){for(var text=[],x=0;x<diffs.length;x++)switch(diffs[x][0]){case 1:text[x]="+"+encodeURI(diffs[x][1]);break;case-1:text[x]="-"+diffs[x][1].length;break;case 0:text[x]="="+diffs[x][1].length}return text.join("\t").replace(/%20/g," ")},diff_match_patch.prototype.diff_fromDelta=function(text1,delta){for(var diffs=[],diffsLength=0,pointer=0,tokens=delta.split(/\t/g),x=0;x<tokens.length;x++){var param=tokens[x].substring(1);switch(tokens[x].charAt(0)){case"+":try{diffs[diffsLength++]=[1,decodeURI(param)]}catch(ex){throw new Error("Illegal escape in diff_fromDelta: "+param)}break;case"-":case"=":var n=parseInt(param,10);if(isNaN(n)||n<0)throw new Error("Invalid number in diff_fromDelta: "+param);var text=text1.substring(pointer,pointer+=n);"="==tokens[x].charAt(0)?diffs[diffsLength++]=[0,text]:diffs[diffsLength++]=[-1,text];break;default:if(tokens[x])throw new Error("Invalid diff operation in diff_fromDelta: "+tokens[x])}}if(pointer!=text1.length)throw new Error("Delta length ("+pointer+") does not equal source text length ("+text1.length+").");return diffs},diff_match_patch.prototype.match_main=function(text,pattern,loc){if(null==text||null==pattern||null==loc)throw new Error("Null input. (match_main)");return loc=Math.max(0,Math.min(loc,text.length)),text==pattern?0:text.length?text.substring(loc,loc+pattern.length)==pattern?loc:this.match_bitap_(text,pattern,loc):-1},diff_match_patch.prototype.match_bitap_=function(text,pattern,loc){if(pattern.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var s=this.match_alphabet_(pattern),dmp=this;function match_bitapScore_(e,x){var accuracy=e/pattern.length,proximity=Math.abs(loc-x);return dmp.Match_Distance?accuracy+proximity/dmp.Match_Distance:proximity?1:accuracy}var score_threshold=this.Match_Threshold,best_loc=text.indexOf(pattern,loc);-1!=best_loc&&(score_threshold=Math.min(match_bitapScore_(0,best_loc),score_threshold),-1!=(best_loc=text.lastIndexOf(pattern,loc+pattern.length))&&(score_threshold=Math.min(match_bitapScore_(0,best_loc),score_threshold)));var bin_min,bin_mid,matchmask=1<<pattern.length-1;best_loc=-1;for(var last_rd,bin_max=pattern.length+text.length,d=0;d<pattern.length;d++){for(bin_min=0,bin_mid=bin_max;bin_min<bin_mid;)match_bitapScore_(d,loc+bin_mid)<=score_threshold?bin_min=bin_mid:bin_max=bin_mid,bin_mid=Math.floor((bin_max-bin_min)/2+bin_min);bin_max=bin_mid;var start=Math.max(1,loc-bin_mid+1),finish=Math.min(loc+bin_mid,text.length)+pattern.length,rd=Array(finish+2);rd[finish+1]=(1<<d)-1;for(var j=finish;j>=start;j--){var charMatch=s[text.charAt(j-1)];if(rd[j]=0===d?(rd[j+1]<<1|1)&charMatch:(rd[j+1]<<1|1)&charMatch|(last_rd[j+1]|last_rd[j])<<1|1|last_rd[j+1],rd[j]&matchmask){var score=match_bitapScore_(d,j-1);if(score<=score_threshold){if(score_threshold=score,!((best_loc=j-1)>loc))break;start=Math.max(1,2*loc-best_loc)}}}if(match_bitapScore_(d+1,loc)>score_threshold)break;last_rd=rd}return best_loc},diff_match_patch.prototype.match_alphabet_=function(pattern){for(var s={},i=0;i<pattern.length;i++)s[pattern.charAt(i)]=0;for(i=0;i<pattern.length;i++)s[pattern.charAt(i)]|=1<<pattern.length-i-1;return s},diff_match_patch.prototype.patch_addContext_=function(patch,text){if(0!=text.length){for(var pattern=text.substring(patch.start2,patch.start2+patch.length1),padding=0;text.indexOf(pattern)!=text.lastIndexOf(pattern)&&pattern.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)padding+=this.Patch_Margin,pattern=text.substring(patch.start2-padding,patch.start2+patch.length1+padding);padding+=this.Patch_Margin;var prefix=text.substring(patch.start2-padding,patch.start2);prefix&&patch.diffs.unshift([0,prefix]);var suffix=text.substring(patch.start2+patch.length1,patch.start2+patch.length1+padding);suffix&&patch.diffs.push([0,suffix]),patch.start1-=prefix.length,patch.start2-=prefix.length,patch.length1+=prefix.length+suffix.length,patch.length2+=prefix.length+suffix.length}},diff_match_patch.prototype.patch_make=function(a,opt_b,opt_c){var text1,diffs;if("string"==typeof a&&"string"==typeof opt_b&&void 0===opt_c)text1=a,(diffs=this.diff_main(text1,opt_b,!0)).length>2&&(this.diff_cleanupSemantic(diffs),this.diff_cleanupEfficiency(diffs));else if(a&&"object"==typeof a&&void 0===opt_b&&void 0===opt_c)diffs=a,text1=this.diff_text1(diffs);else if("string"==typeof a&&opt_b&&"object"==typeof opt_b&&void 0===opt_c)text1=a,diffs=opt_b;else{if("string"!=typeof a||"string"!=typeof opt_b||!opt_c||"object"!=typeof opt_c)throw new Error("Unknown call format to patch_make.");text1=a,diffs=opt_c}if(0===diffs.length)return[];for(var patches=[],patch=new diff_match_patch.patch_obj,patchDiffLength=0,char_count1=0,char_count2=0,prepatch_text=text1,postpatch_text=text1,x=0;x<diffs.length;x++){var diff_type=diffs[x][0],diff_text=diffs[x][1];switch(patchDiffLength||0===diff_type||(patch.start1=char_count1,patch.start2=char_count2),diff_type){case 1:patch.diffs[patchDiffLength++]=diffs[x],patch.length2+=diff_text.length,postpatch_text=postpatch_text.substring(0,char_count2)+diff_text+postpatch_text.substring(char_count2);break;case-1:patch.length1+=diff_text.length,patch.diffs[patchDiffLength++]=diffs[x],postpatch_text=postpatch_text.substring(0,char_count2)+postpatch_text.substring(char_count2+diff_text.length);break;case 0:diff_text.length<=2*this.Patch_Margin&&patchDiffLength&&diffs.length!=x+1?(patch.diffs[patchDiffLength++]=diffs[x],patch.length1+=diff_text.length,patch.length2+=diff_text.length):diff_text.length>=2*this.Patch_Margin&&patchDiffLength&&(this.patch_addContext_(patch,prepatch_text),patches.push(patch),patch=new diff_match_patch.patch_obj,patchDiffLength=0,prepatch_text=postpatch_text,char_count1=char_count2)}1!==diff_type&&(char_count1+=diff_text.length),-1!==diff_type&&(char_count2+=diff_text.length)}return patchDiffLength&&(this.patch_addContext_(patch,prepatch_text),patches.push(patch)),patches},diff_match_patch.prototype.patch_deepCopy=function(patches){for(var patchesCopy=[],x=0;x<patches.length;x++){var patch=patches[x],patchCopy=new diff_match_patch.patch_obj;patchCopy.diffs=[];for(var y=0;y<patch.diffs.length;y++)patchCopy.diffs[y]=patch.diffs[y].slice();patchCopy.start1=patch.start1,patchCopy.start2=patch.start2,patchCopy.length1=patch.length1,patchCopy.length2=patch.length2,patchesCopy[x]=patchCopy}return patchesCopy},diff_match_patch.prototype.patch_apply=function(patches,text){if(0==patches.length)return[text,[]];patches=this.patch_deepCopy(patches);var nullPadding=this.patch_addPadding(patches);text=nullPadding+text+nullPadding,this.patch_splitMax(patches);for(var delta=0,results=[],x=0;x<patches.length;x++){var start_loc,text2,expected_loc=patches[x].start2+delta,text1=this.diff_text1(patches[x].diffs),end_loc=-1;if(text1.length>this.Match_MaxBits?-1!=(start_loc=this.match_main(text,text1.substring(0,this.Match_MaxBits),expected_loc))&&(-1==(end_loc=this.match_main(text,text1.substring(text1.length-this.Match_MaxBits),expected_loc+text1.length-this.Match_MaxBits))||start_loc>=end_loc)&&(start_loc=-1):start_loc=this.match_main(text,text1,expected_loc),-1==start_loc)results[x]=!1,delta-=patches[x].length2-patches[x].length1;else if(results[x]=!0,delta=start_loc-expected_loc,text1==(text2=-1==end_loc?text.substring(start_loc,start_loc+text1.length):text.substring(start_loc,end_loc+this.Match_MaxBits)))text=text.substring(0,start_loc)+this.diff_text2(patches[x].diffs)+text.substring(start_loc+text1.length);else{var diffs=this.diff_main(text1,text2,!1);if(text1.length>this.Match_MaxBits&&this.diff_levenshtein(diffs)/text1.length>this.Patch_DeleteThreshold)results[x]=!1;else{this.diff_cleanupSemanticLossless(diffs);for(var index2,index1=0,y=0;y<patches[x].diffs.length;y++){var mod=patches[x].diffs[y];0!==mod[0]&&(index2=this.diff_xIndex(diffs,index1)),1===mod[0]?text=text.substring(0,start_loc+index2)+mod[1]+text.substring(start_loc+index2):-1===mod[0]&&(text=text.substring(0,start_loc+index2)+text.substring(start_loc+this.diff_xIndex(diffs,index1+mod[1].length))),-1!==mod[0]&&(index1+=mod[1].length)}}}}return[text=text.substring(nullPadding.length,text.length-nullPadding.length),results]},diff_match_patch.prototype.patch_addPadding=function(patches){for(var paddingLength=this.Patch_Margin,nullPadding="",x=1;x<=paddingLength;x++)nullPadding+=String.fromCharCode(x);for(x=0;x<patches.length;x++)patches[x].start1+=paddingLength,patches[x].start2+=paddingLength;var patch=patches[0],diffs=patch.diffs;if(0==diffs.length||0!=diffs[0][0])diffs.unshift([0,nullPadding]),patch.start1-=paddingLength,patch.start2-=paddingLength,patch.length1+=paddingLength,patch.length2+=paddingLength;else if(paddingLength>diffs[0][1].length){var extraLength=paddingLength-diffs[0][1].length;diffs[0][1]=nullPadding.substring(diffs[0][1].length)+diffs[0][1],patch.start1-=extraLength,patch.start2-=extraLength,patch.length1+=extraLength,patch.length2+=extraLength}if(0==(diffs=(patch=patches[patches.length-1]).diffs).length||0!=diffs[diffs.length-1][0])diffs.push([0,nullPadding]),patch.length1+=paddingLength,patch.length2+=paddingLength;else if(paddingLength>diffs[diffs.length-1][1].length){extraLength=paddingLength-diffs[diffs.length-1][1].length;diffs[diffs.length-1][1]+=nullPadding.substring(0,extraLength),patch.length1+=extraLength,patch.length2+=extraLength}return nullPadding},diff_match_patch.prototype.patch_splitMax=function(patches){for(var patch_size=this.Match_MaxBits,x=0;x<patches.length;x++)if(!(patches[x].length1<=patch_size)){var bigpatch=patches[x];patches.splice(x--,1);for(var start1=bigpatch.start1,start2=bigpatch.start2,precontext="";0!==bigpatch.diffs.length;){var patch=new diff_match_patch.patch_obj,empty=!0;for(patch.start1=start1-precontext.length,patch.start2=start2-precontext.length,""!==precontext&&(patch.length1=patch.length2=precontext.length,patch.diffs.push([0,precontext]));0!==bigpatch.diffs.length&&patch.length1<patch_size-this.Patch_Margin;){var diff_type=bigpatch.diffs[0][0],diff_text=bigpatch.diffs[0][1];1===diff_type?(patch.length2+=diff_text.length,start2+=diff_text.length,patch.diffs.push(bigpatch.diffs.shift()),empty=!1):-1===diff_type&&1==patch.diffs.length&&0==patch.diffs[0][0]&&diff_text.length>2*patch_size?(patch.length1+=diff_text.length,start1+=diff_text.length,empty=!1,patch.diffs.push([diff_type,diff_text]),bigpatch.diffs.shift()):(diff_text=diff_text.substring(0,patch_size-patch.length1-this.Patch_Margin),patch.length1+=diff_text.length,start1+=diff_text.length,0===diff_type?(patch.length2+=diff_text.length,start2+=diff_text.length):empty=!1,patch.diffs.push([diff_type,diff_text]),diff_text==bigpatch.diffs[0][1]?bigpatch.diffs.shift():bigpatch.diffs[0][1]=bigpatch.diffs[0][1].substring(diff_text.length))}precontext=(precontext=this.diff_text2(patch.diffs)).substring(precontext.length-this.Patch_Margin);var postcontext=this.diff_text1(bigpatch.diffs).substring(0,this.Patch_Margin);""!==postcontext&&(patch.length1+=postcontext.length,patch.length2+=postcontext.length,0!==patch.diffs.length&&0===patch.diffs[patch.diffs.length-1][0]?patch.diffs[patch.diffs.length-1][1]+=postcontext:patch.diffs.push([0,postcontext])),empty||patches.splice(++x,0,patch)}}},diff_match_patch.prototype.patch_toText=function(patches){for(var text=[],x=0;x<patches.length;x++)text[x]=patches[x];return text.join("")},diff_match_patch.prototype.patch_fromText=function(textline){var patches=[];if(!textline)return patches;for(var text=textline.split("\n"),textPointer=0,patchHeader=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;textPointer<text.length;){var m=text[textPointer].match(patchHeader);if(!m)throw new Error("Invalid patch string: "+text[textPointer]);var patch=new diff_match_patch.patch_obj;for(patches.push(patch),patch.start1=parseInt(m[1],10),""===m[2]?(patch.start1--,patch.length1=1):"0"==m[2]?patch.length1=0:(patch.start1--,patch.length1=parseInt(m[2],10)),patch.start2=parseInt(m[3],10),""===m[4]?(patch.start2--,patch.length2=1):"0"==m[4]?patch.length2=0:(patch.start2--,patch.length2=parseInt(m[4],10)),textPointer++;textPointer<text.length;){var sign=text[textPointer].charAt(0);try{var line=decodeURI(text[textPointer].substring(1))}catch(ex){throw new Error("Illegal escape in patch_fromText: "+line)}if("-"==sign)patch.diffs.push([-1,line]);else if("+"==sign)patch.diffs.push([1,line]);else if(" "==sign)patch.diffs.push([0,line]);else{if("@"==sign)break;if(""!==sign)throw new Error('Invalid patch mode "'+sign+'" in: '+line)}textPointer++}}return patches},diff_match_patch.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},diff_match_patch.patch_obj.prototype.toString=function(){for(var op,text=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],x=0;x<this.diffs.length;x++){switch(this.diffs[x][0]){case 1:op="+";break;case-1:op="-";break;case 0:op=" "}text[x+1]=op+encodeURI(this.diffs[x][1])+"\n"}return text.join("").replace(/%20/g," ")},module.exports=diff_match_patch,module.exports.diff_match_patch=diff_match_patch,module.exports.DIFF_DELETE=-1,module.exports.DIFF_INSERT=1,module.exports.DIFF_EQUAL=0})),DIFF_EQUAL=diffMatchPatch.DIFF_EQUAL,DIFF_DELETE=diffMatchPatch.DIFF_DELETE,DIFF_INSERT=diffMatchPatch.DIFF_INSERT,findChangeBlocks=function findChangeBlocks(changes){var start=findIndex_1(changes,(function(change){return!change.isNormal}));if(-1===start)return[];var end=findIndex_1(changes,(function(change){return change.isNormal}),start);return-1===end?[changes.slice(start)]:[changes.slice(start,end)].concat(_toConsumableArray(findChangeBlocks(changes.slice(end))))},splitDiffToLines=function(diffs){return diffs.reduce((function(lines,_ref3){var _ref4=_slicedToArray(_ref3,2),type=_ref4[0],_currentLines$map2=_toArray(_ref4[1].split("\n").map((function(line){return[type,line]}))),currentLineRemaining=_currentLines$map2[0],nextLines=_currentLines$map2.slice(1);return[].concat(_toConsumableArray(lines.slice(0,-1)),[[].concat(_toConsumableArray(last_1(lines)),[currentLineRemaining])],_toConsumableArray(nextLines.map((function(line){return[line]}))))}),[[]])},diffsToEdits=function(diffs,lineNumber){return diffs.reduce((function(output,diff){var _output=_slicedToArray(output,2),edits=_output[0],start=_output[1],_diff2=_slicedToArray(diff,2),type=_diff2[0],value=_diff2[1];if(type!==DIFF_EQUAL){var edit={type:"edit",lineNumber:lineNumber,start:start,length:value.length};edits.push(edit)}return[edits,start+value.length]}),[[],0])[0]},convertToLinesOfEdits=function(linesOfDiffs,startLineNumber){return flatMap_1(linesOfDiffs,(function(diffs,i){return diffsToEdits(diffs,startLineNumber+i)}))},diffText=function(x,y){var dmp=new diffMatchPatch,diffs=dmp.diff_main(x,y);return dmp.diff_cleanupSemantic(diffs),diffs.length<=1?[[],[]]:function(diffs){return diffs.reduce((function(_ref,diff){var _ref2=_slicedToArray(_ref,2),oldDiffs=_ref2[0],newDiffs=_ref2[1];switch(_slicedToArray(diff,1)[0]){case DIFF_INSERT:newDiffs.push(diff);break;case DIFF_DELETE:oldDiffs.push(diff);break;default:oldDiffs.push(diff),newDiffs.push(diff)}return[oldDiffs,newDiffs]}),[[],[]])}(diffs)},diffChangeBlock=function(changes){var _changes$reduce=changes.reduce((function(_ref5,_ref6){var _ref7=_slicedToArray(_ref5,2),oldSource=_ref7[0],newSource=_ref7[1],isDelete=_ref6.isDelete,content=_ref6.content;return isDelete?[oldSource+(oldSource?"\n":"")+content,newSource]:[oldSource,newSource+(newSource?"\n":"")+content]}),["",""]),_changes$reduce2=_slicedToArray(_changes$reduce,2),oldSource=_changes$reduce2[0],newSource=_changes$reduce2[1],_diffText2=_slicedToArray(diffText(oldSource,newSource),2),oldDiffs=_diffText2[0],newDiffs=_diffText2[1];if(0===oldDiffs.length&&0===newDiffs.length)return[oldDiffs,newDiffs];var getLineNumber=function(change){return change&&change.lineNumber},oldStartLineNumber=getLineNumber(changes.find((function(change){return change.isDelete}))),newStartLineNumber=getLineNumber(changes.find((function(change){return change.isInsert})));return[convertToLinesOfEdits(splitDiffToLines(oldDiffs),oldStartLineNumber),convertToLinesOfEdits(splitDiffToLines(newDiffs),newStartLineNumber)]},diffByLine=function(changes){return changes.reduce((function(_ref8,currentChange){var _ref9=_slicedToArray(_ref8,3),oldEdits=_ref9[0],newEdits=_ref9[1],previousChange=_ref9[2];if(!previousChange.isDelete||!currentChange.isInsert)return[oldEdits,newEdits,currentChange];var _diffText4=_slicedToArray(diffText(previousChange.content,currentChange.content),2),oldDiffs=_diffText4[0],newDiffs=_diffText4[1];return[oldEdits.concat(diffsToEdits(oldDiffs,previousChange.lineNumber)),newEdits.concat(diffsToEdits(newDiffs,currentChange.lineNumber)),currentChange]}),[[],[],{}])},markEdits=function(hunks){var _ref10=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},_ref10$type=_ref10.type,type=void 0===_ref10$type?"block":_ref10$type,changeBlocks=flatMap_1(hunks.map((function(hunk){return hunk.changes})),findChangeBlocks),findEdits="block"===type?diffChangeBlock:diffByLine,_changeBlocks$map$red=changeBlocks.map(findEdits).reduce((function(_ref11,_ref12){var _ref13=_slicedToArray(_ref11,2),oldEdits=_ref13[0],newEdits=_ref13[1],_ref14=_slicedToArray(_ref12,2),currentOld=_ref14[0],currentNew=_ref14[1];return[oldEdits.concat(currentOld),newEdits.concat(currentNew)]}),[[],[]]),_changeBlocks$map$red2=_slicedToArray(_changeBlocks$map$red,2),oldEdits=_changeBlocks$map$red2[0],newEdits=_changeBlocks$map$red2[1];return pickRanges(flatten_1(oldEdits),flatten_1(newEdits))},markInPaths=function(word,name,replacement){return function(paths){return flatMap_1(paths,(function(path){var leaf=last_1(path);return leaf.value.includes(word)?leaf.value.split(word).reduce((function(output,text,i){return 0!==i&&output.push(replace(path,{type:"mark",markType:name,value:replacement})),text&&output.push(replace(path,_objectSpread2({},leaf,{value:text}))),output}),[]):[path]}))}},markWord=function(word,name){var replacement=arguments.length>2&&void 0!==arguments[2]?arguments[2]:word,mark=markInPaths(word,name,replacement);return function(_ref){var _ref2=_slicedToArray(_ref,2),oldLinesOfPaths=_ref2[0],newLinesOfPaths=_ref2[1];return[oldLinesOfPaths.map(mark),newLinesOfPaths.map(mark)]}},tokenize=function(hunks,options){var _options$highlight=options.highlight,highlight=void 0!==_options$highlight&&_options$highlight,refractor=options.refractor,oldSource=options.oldSource,language=options.language,_options$enhancers=options.enhancers,enhancers=void 0===_options$enhancers?[]:_options$enhancers,linesOfPathsPair=toTokenTrees(hunks,{highlight:highlight,refractor:refractor,oldSource:oldSource,language:language}).map(normalizeToLines),_enhancedLinesOfPaths2=_slicedToArray(flow_1(enhancers)(linesOfPathsPair).map((function(paths){return paths.map(backToTree)})),2),oldTrees=_enhancedLinesOfPaths2[0],newTrees=_enhancedLinesOfPaths2[1];return{old:oldTrees.map((function(root){return root.children})),new:newTrees.map((function(root){return root.children}))}},lib=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0});exports.createChangeEmitter=function(){var currentListeners=[],nextListeners=currentListeners;function ensureCanMutateNextListeners(){nextListeners===currentListeners&&(nextListeners=currentListeners.slice())}return{listen:function(listener){if("function"!=typeof listener)throw new Error("Expected listener to be a function.");var isSubscribed=!0;return ensureCanMutateNextListeners(),nextListeners.push(listener),function(){if(isSubscribed){isSubscribed=!1,ensureCanMutateNextListeners();var index=nextListeners.indexOf(listener);nextListeners.splice(index,1)}}},emit:function(){for(var listeners=currentListeners=nextListeners,i=0;i<listeners.length;i++)listeners[i].apply(listeners,arguments)}}}}));(x=lib)&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")&&x.default;lib.createChangeEmitter;!function(root){var result,Symbol=root.Symbol;"function"==typeof Symbol?Symbol.observable?result=Symbol.observable:(result=Symbol("observable"),Symbol.observable=result):result="@@observable"}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")());var wrapDisplayName=function(BaseComponent,hocName){return hocName+"("+("string"==typeof(Component$$1=BaseComponent)?Component$$1:Component$$1?Component$$1.displayName||Component$$1.name||"Component":void 0)+")";var Component$$1},useMinCollapsedLines=function(minLinesExclusive,hunks,oldSource){return oldSource?useMemo((function(){return expandCollapsedBlockBy(hunks,oldSource,(function(lines){return lines<minLinesExclusive}))}),[minLinesExclusive,hunks,oldSource]):hunks},updateCollection=function(collection,_ref){var type=_ref.type,value=_ref.value;switch(type){case"push":return[].concat(_toConsumableArray(collection),[value]);case"clear":return collection.length?[]:collection;case"toggle":return collection.includes(value)?collection.filter((function(item){return item!==value})):collection.concat(value);case"only":return[value];default:return collection}},useCollection=function(){var _useReducer2=_slicedToArray(useReducer(updateCollection,[]),2),collection=_useReducer2[0],dispatch=_useReducer2[1];return{collection:collection,clear:function(){dispatch({type:"clear"})},push:function(value){dispatch({value:value,type:"push"})},toggle:function(value){dispatch({value:value,type:"toggle"})},only:function(value){dispatch({value:value,type:"only"})}}},useCustomEqualIdentifier=function(value,equals){var cache=useRef({}),identifier=useRef(0);return equals(value,cache.current)||(cache.current=value,identifier.current=identifier.current+1),identifier.current},useChangeSelect=function(hunks){var _ref=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},_ref$multiple=_ref.multiple,multiple=void 0!==_ref$multiple&&_ref$multiple,_useCollection=useCollection(),collection=_useCollection.collection,clear=_useCollection.clear,toggle=_useCollection.toggle,only=_useCollection.only;return useEffect(clear,[hunks]),[collection,function(_ref2){var change=_ref2.change,changeKey=getChangeKey(change);multiple?toggle(changeKey):only(changeKey)}]},useSourceExpansion=function(hunks,oldSource){var _useCollection=useCollection(),expandedRanges=_useCollection.collection,clear=_useCollection.clear,push=_useCollection.push;useEffect(clear,[hunks,oldSource]);var linesOfOldSource=useMemo((function(){return(oldSource||"").split("\n")}),[oldSource]);return[useMemo((function(){return linesOfOldSource.length?expandedRanges.reduce((function(hunks,_ref){var _ref2=_slicedToArray(_ref,2),start=_ref2[0],end=_ref2[1];return expandFromRawCode(hunks,linesOfOldSource,start,end)}),hunks):hunks}),[linesOfOldSource,hunks,expandedRanges]),function(start,end){return push([start,end])}]};var objects=function(objA,objB){if(objA===objB)return!0;if(!objA||!objB)return!1;var aKeys=Object.keys(objA),bKeys=Object.keys(objB),len=aKeys.length;if(bKeys.length!==len)return!1;for(var i=0;i<len;i++){var key=aKeys[i];if(objA[key]!==objB[key])return!1}return!0};var current,arrays=function(arrA,arrB){if(arrA===arrB)return!0;if(!arrA||!arrB)return!1;var len=arrA.length;if(arrB.length!==len)return!1;for(var i=0;i<len;i++)if(arrA[i]!==arrB[i])return!1;return!0},uid=(current=0,function(){return current+=1}),findAbnormalChanges=function(hunks){return flatMap_1(hunks,(function(hunk){return hunk.changes.filter((function(change){return!change.isNormal}))}))},defaultShouldTokenize=function(_ref,_ref2){var yHunks,xChanges,yChanges,currentHunks=_ref.hunks,currentPayload=_objectWithoutProperties(_ref,["hunks"]),prevHunks=_ref2.hunks,prevPayload=_objectWithoutProperties(_ref2,["hunks"]);return currentPayload.oldSource!==prevPayload.oldSource||(currentPayload.oldSource?!objects(currentPayload,prevPayload)||(yHunks=prevHunks,xChanges=findAbnormalChanges(currentHunks),yChanges=findAbnormalChanges(yHunks),!arrays(xChanges,yChanges)):currentHunks!==prevHunks||!objects(currentPayload,prevPayload))},useTokenizeWorker=function(worker,payload){var options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},_options$shouldTokeni=options.shouldTokenize,shouldTokenize=void 0===_options$shouldTokeni?defaultShouldTokenize:_options$shouldTokeni,payloadIdentifier=useCustomEqualIdentifier(payload,(function(current,previous){return!shouldTokenize(current,previous)})),_useState=useState({tokens:null,tokenizationFailReason:null}),_useState2=_slicedToArray(_useState,2),tokenizeResult=_useState2[0],setTokenizeResult=_useState2[1],job=useRef(null);return useEffect((function(){var receiveTokens=function(_ref3){var _ref3$data=_ref3.data,payload=_ref3$data.payload;_ref3$data.id===job.current&&(payload.success?setTokenizeResult({tokens:payload.tokens,tokenizationFailReason:null}):setTokenizeResult({tokens:null,tokenizationFailReason:payload.reason}))};return worker.addEventListener("message",receiveTokens),function(){return worker.removeEventListener("message",receiveTokens)}}),[worker]),useEffect((function(){job.current=uid();var data={payload:payload,id:job.current,type:"tokenize"};worker.postMessage(data)}),[payloadIdentifier,worker,shouldTokenize]),tokenizeResult},withSourceExpansion=function(){return function(ComponentIn){var ComponentOut=function(props){var _useSourceExpansion2=_slicedToArray(useSourceExpansion(props.hunks,props.oldSource),2),renderingHunks=_useSourceExpansion2[0],expandRange=_useSourceExpansion2[1];return React.createElement(ComponentIn,_extends({},props,{hunks:renderingHunks,onExpandRange:expandRange}))};return ComponentOut.displayName=wrapDisplayName(ComponentIn,"withSourceExpansion"),ComponentOut}},minCollapsedLines=function(minLinesExclusive){return function(ComponentIn){var ComponentOut=function(props){var renderingHunks=useMinCollapsedLines(minLinesExclusive,props.hunks,props.oldSource);return React.createElement(ComponentIn,_extends({},props,{hunks:renderingHunks}))};return ComponentOut.displayName=wrapDisplayName(ComponentIn,"minCollapsedLines"),ComponentOut}},withChangeSelect=function(options){return function(ComponentIn){var ComponentOut=function(props){var _useChangeSelect2=_slicedToArray(useChangeSelect(props.hunks,options),2),selectedChanges=_useChangeSelect2[0],toggleChangeSelection=_useChangeSelect2[1];return React.createElement(ComponentIn,_extends({},props,{selectedChanges:selectedChanges,onToggleChangeSelection:toggleChangeSelection}))};return ComponentOut.displayName=wrapDisplayName(ComponentIn,"withChangeSelect"),ComponentOut}},defaultMapPayload=function(data){return data},withTokenizeWorker=function(worker){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},_options$mapPayload=options.mapPayload,mapPayload=void 0===_options$mapPayload?defaultMapPayload:_options$mapPayload,hookOptions=_objectWithoutProperties(options,["mapPayload"]),resolveMessagePayload=function(props){var hunks=props.hunks,oldSource=props.oldSource,language=props.language;return mapPayload({language:language,oldSource:oldSource,hunks:hunks},props)};return function(ComponentIn){var ComponentOut=function(props){var payload=resolveMessagePayload(props),tokenizationResult=useTokenizeWorker(worker,payload,hookOptions);return React.createElement(ComponentIn,_extends({},props,tokenizationResult))};return ComponentOut.displayName=wrapDisplayName(ComponentIn,"withTokenizeWorker"),ComponentOut}};export{Decoration,index as Diff,Hunk,computeNewLineNumber$1 as computeNewLineNumber,computeOldLineNumber$2 as computeOldLineNumber,expandCollapsedBlockBy,expandFromRawCode,findChangeByNewLineNumber,findChangeByOldLineNumber,getChangeKey,getCollapsedLinesCountBetween,getCorrespondingNewLineNumber$1 as getCorrespondingNewLineNumber,getCorrespondingOldLineNumber,insertHunk,markEdits,markWord,minCollapsedLines,parseDiff,pickRanges,textLinesToHunk,tokenize,useChangeSelect,useMinCollapsedLines,useSourceExpansion,useTokenizeWorker,withChangeSelect,withSourceExpansion,withTokenizeWorker};
  //# sourceMappingURL=index.js.map
  