text: define("bitbucket/internal/feature/file-content/text-view/text-view","module exports jquery lodash bitbucket/internal/bbui/widget/widget bitbucket/internal/feature/file-content/stash-codemirror/stash-codemirror bitbucket/internal/feature/file-content/text-view/common-modes bitbucket/internal/feature/file-content/text-view/text-view-api bitbucket/internal/feature/file-content/text-view/text-view-scrolling bitbucket/internal/util/determine-language bitbucket/internal/util/events bitbucket/internal/util/function bitbucket/internal/util/horizontal-keyboard-scrolling bitbucket/internal/util/object bitbucket/internal/util/performance".split(" "),
  function(t,k,l,u,v,w,x,y,z,A,B,C,D,E,F){function d(a,b){m.default.call(this,b);var e=this;n.default.setupAPI(this);this._internalLines={ADDED:{},REMOVED:{},CONTEXT:{}};this._editors=[];this._gutters=[];this._$container=a;this._$fileToolbar=this._$container.siblings(".file-toolbar");this._$container.addClass("text-view");this.registerGutter("CodeMirror-linewidget",{weight:0});this._addDestroyable(function(){e._$container.removeClass("text-view");e._editors.forEach(function(c){c.destroy()});e._editors=
  null;e._gutters=null;e._$container=null});this._addDestroyable(p.default.chain().on("bitbucket.internal.feature.sidebar.*",this.refresh))}function G(a){var b=a.view;a.eachLine(function(a){a.handles.all.forEach(function(c){b.addLineClass(c,"wrap","line")})})}Object.defineProperty(k,"__esModule",{value:!0});var h=babelHelpers.interopRequireDefault(l),f=babelHelpers.interopRequireDefault(u),m=babelHelpers.interopRequireDefault(v),q=babelHelpers.interopRequireDefault(w),H=babelHelpers.interopRequireDefault(x),
  n=babelHelpers.interopRequireDefault(y);l=babelHelpers.interopRequireDefault(z);var I=babelHelpers.interopRequireDefault(A),p=babelHelpers.interopRequireDefault(B);babelHelpers.interopRequireDefault(C);var r=babelHelpers.interopRequireDefault(D),g=babelHelpers.interopRequireDefault(E),J=babelHelpers.interopRequireDefault(F);g.default.inherits(d,m.default);n.default.mixInto(d.prototype);l.default.mixInto(d.prototype);d.defaults={focusPoint:.2};d.DEFAULT_LINE_ENDING=q.default.DEFAULT_LINE_ENDING;d.prototype.init=
  function(){p.default.trigger("bitbucket.internal.feature.fileContent.textViewInitializing",null,this._api,this._options);r.default.init()};d.prototype.markText=function(a,b,e,c){var d=this;return a.handles.all.map(function(a){var f=d._editorForHandle(a);a=f.getLineNumber(a._handle);return f.markText({line:a+b.lineOffset,ch:b.ch},{line:a+e.lineOffset,ch:e.ch},{className:c.className})})};d.prototype.refresh=f.default.debounce(function(){f.default.invokeMap(this._editors,"refresh");this.trigger("resize")},
  50);d.prototype._createEditor=function(a,b){a=a||{};b=new q.default(b&&b.length?b[0]:this._$container[0],h.default.extend({},a,{attachScroll:this._options.attachScroll,autoResizing:this._options.autoResizing,gutters:this._getGutters(a.gutterFilter),scrollStyle:this._options.scrollStyle,value:""}));b._gutterFilter=a.gutterFilter;this._editors.push(b);r.default.setEditors(this._editors);b.on("search.show",this.refresh);b.on("search.hide",this.refresh);this._$firstEditor||(this._$firstEditor=(0,h.default)(b.getWrapperElement()));
  return b};d.prototype._editorForHandle=function(a){throw Error("TextView implementation must define _editorForHandle.");};d.prototype._editorInnerOffset=function(){return this._$firstEditor[0].getBoundingClientRect().top-this._$container[0].getBoundingClientRect().top};d.prototype._getChangeAttributes=function(){return{}};d.prototype._getGutters=function(a){var b=this._gutters;a&&(b=b.filter(a));b=b.sort(function(a,c){return a.weight-c.weight});return f.default.chain(b).map("name").uniq().value()};
  d.prototype._modify=function(a,b,d){var c=this,e=[].slice.call(arguments);f.default.forEach(d,function(a){c._internalLines[a.lineType||"CONTEXT"][a.lineNumber]=a});this.operation(function(){c._acceptModification.apply(c,e);c.trigger("internal.acceptedModification",e);var b=h.default.extend({type:a,linesAdded:d.length,eachLine:function(a){var b=(c._options.asyncDiffModifications?J.default.frameBatchedMap(a,{min:500,initial:200},c.operation.bind(c)):function(b){var c=h.default.Deferred();c.resolve(b.map(a));
  return c})(d);c._addDestroyable(b.reject.bind(b));return b.promise()},view:c._api},c._getChangeAttributes.apply(c,e));f.default.chain(d).map("handles").values().flatten().compact().forEach(g.default.freeze).value();f.default.chain(d).map("handle").compact().forEach(g.default.freeze).value();f.default.chain(d).map("line").compact().forEach(g.default.freeze).value();g.default.deepFreeze(d,!1);g.default.deepFreeze(b,!1);G(b);"INITIAL"===a&&c.trigger("internal-load",b);c.trigger("internal-change",b);
  c.refresh()})};d.prototype._highlight=function(a){this._editors&&this._editors.forEach(function(b){b._highlight(a)})};d.prototype._syntaxHighlighting=function(a,b,d){var c=I.default.fromFileInfo({firstLine:b,path:a});(c.wrmKey?WRM.require("wr!"+c.wrmKey):c.builtIn&&!f.default.includes(H.default,c.mode)?WRM.require("wr!com.atlassian.bitbucket.server.bitbucket-highlight:"+c.mode):h.default.Deferred().resolve()).done(function(){d.setOption("mode",c.mime)})};d.prototype._whenOpDone=function(a){this._opCallbacks?
  this._opCallbacks.push(a):a()};k.default=d;t.exports=k["default"]});