");
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ t.b(" ");
+ t.b(t.t(t.f("lineNumber", c, p, 0)));
+ t.b("\n" + i);
+ t.b(" | ");
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ if (t.s(t.f("prefix", c, p, 1), c, p, 0, 162, 238, "{{ }}")) {
+ t.rs(c, p, function(c2, p2, t2) {
+ t2.b(' ');
+ t2.b(t2.t(t2.f("prefix", c2, p2, 0)));
+ t2.b("");
+ t2.b("\n" + i);
+ });
+ c.pop();
+ }
+ if (!t.s(t.f("prefix", c, p, 1), c, p, 1, 0, 0, "")) {
+ t.b(' ');
+ t.b("\n" + i);
+ }
+ ;
+ if (t.s(t.f("content", c, p, 1), c, p, 0, 371, 445, "{{ }}")) {
+ t.rs(c, p, function(c2, p2, t2) {
+ t2.b(' ');
+ t2.b(t2.t(t2.f("content", c2, p2, 0)));
+ t2.b("");
+ t2.b("\n" + i);
+ });
+ c.pop();
+ }
+ if (!t.s(t.f("content", c, p, 1), c, p, 1, 0, 0, "")) {
+ t.b(' ');
+ t.b("\n" + i);
+ }
+ ;
+ t.b(" ");
+ t.b("\n" + i);
+ t.b(" | ");
+ t.b("\n" + i);
+ t.b("");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["generic-wrapper"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('');
+ t.b("\n" + i);
+ t.b(" ");
+ t.b(t.t(t.f("content", c, p, 0)));
+ t.b("\n" + i);
+ t.b("
");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["icon-file-added"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["icon-file-changed"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["icon-file-deleted"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["icon-file-renamed"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["icon-file"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["line-by-line-file-diff"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('');
+ t.b("\n" + i);
+ t.b(' ");
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ t.b(" ");
+ t.b(t.t(t.f("diffs", c, p, 0)));
+ t.b("\n" + i);
+ t.b(" ");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["line-by-line-numbers"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('');
+ t.b(t.v(t.f("oldNumber", c, p, 0)));
+ t.b("
");
+ t.b("\n" + i);
+ t.b('');
+ t.b(t.v(t.f("newNumber", c, p, 0)));
+ t.b("
");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["side-by-side-file-diff"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('');
+ t.b("\n" + i);
+ t.b(' ");
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ t.b(" ");
+ t.b(t.t(t.d("diffs.left", c, p, 0)));
+ t.b("\n" + i);
+ t.b(" ");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b('
');
+ t.b("\n" + i);
+ t.b(' ');
+ t.b("\n" + i);
+ t.b(" ");
+ t.b(t.t(t.d("diffs.right", c, p, 0)));
+ t.b("\n" + i);
+ t.b(" ");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ t.b("\n" + i);
+ t.b("
");
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["tag-file-added"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('ADDED');
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["tag-file-changed"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('CHANGED');
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["tag-file-deleted"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('DELETED');
+ return t.fl();
+ }, partials: {}, subs: {} });
+ exports.defaultTemplates["tag-file-renamed"] = new Hogan2.Template({ code: function(c, p, i) {
+ var t = this;
+ t.b(i = i || "");
+ t.b('RENAMED');
+ return t.fl();
+ }, partials: {}, subs: {} });
+ }
+});
+
+// node_modules/diff2html/lib/hoganjs-utils.js
+var require_hoganjs_utils = __commonJS({
+ "node_modules/diff2html/lib/hoganjs-utils.js"(exports) {
+ "use strict";
+ var __assign2 = exports && exports.__assign || function() {
+ __assign2 = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s)
+ if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign2.apply(this, arguments);
+ };
+ var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar2 = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule)
+ return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod)
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
+ __createBinding2(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var Hogan2 = __importStar2(require_hogan());
+ var diff2html_templates_1 = require_diff2html_templates();
+ var HoganJsUtils = function() {
+ function HoganJsUtils2(_a2) {
+ var _b = _a2.compiledTemplates, compiledTemplates = _b === void 0 ? {} : _b, _c = _a2.rawTemplates, rawTemplates = _c === void 0 ? {} : _c;
+ var compiledRawTemplates = Object.entries(rawTemplates).reduce(function(previousTemplates, _a3) {
+ var _b2;
+ var name = _a3[0], templateString = _a3[1];
+ var compiledTemplate = Hogan2.compile(templateString, { asString: false });
+ return __assign2(__assign2({}, previousTemplates), (_b2 = {}, _b2[name] = compiledTemplate, _b2));
+ }, {});
+ this.preCompiledTemplates = __assign2(__assign2(__assign2({}, diff2html_templates_1.defaultTemplates), compiledTemplates), compiledRawTemplates);
+ }
+ HoganJsUtils2.compile = function(templateString) {
+ return Hogan2.compile(templateString, { asString: false });
+ };
+ HoganJsUtils2.prototype.render = function(namespace, view, params, partials, indent) {
+ var templateKey = this.templateKey(namespace, view);
+ try {
+ var template = this.preCompiledTemplates[templateKey];
+ return template.render(params, partials, indent);
+ } catch (e) {
+ throw new Error("Could not find template to render '".concat(templateKey, "'"));
+ }
+ };
+ HoganJsUtils2.prototype.template = function(namespace, view) {
+ return this.preCompiledTemplates[this.templateKey(namespace, view)];
+ };
+ HoganJsUtils2.prototype.templateKey = function(namespace, view) {
+ return "".concat(namespace, "-").concat(view);
+ };
+ return HoganJsUtils2;
+ }();
+ exports.default = HoganJsUtils;
+ }
+});
+
+// node_modules/diff2html/lib/diff2html.js
+var require_diff2html = __commonJS({
+ "node_modules/diff2html/lib/diff2html.js"(exports) {
+ "use strict";
+ var __assign2 = exports && exports.__assign || function() {
+ __assign2 = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s)
+ if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign2.apply(this, arguments);
+ };
+ var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar2 = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule)
+ return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod)
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
+ __createBinding2(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault2 = exports && exports.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.html = exports.parse = exports.defaultDiff2HtmlConfig = void 0;
+ var DiffParser = __importStar2(require_diff_parser());
+ var fileListPrinter = __importStar2(require_file_list_renderer());
+ var line_by_line_renderer_1 = __importStar2(require_line_by_line_renderer());
+ var side_by_side_renderer_1 = __importStar2(require_side_by_side_renderer());
+ var types_1 = require_types();
+ var hoganjs_utils_1 = __importDefault2(require_hoganjs_utils());
+ exports.defaultDiff2HtmlConfig = __assign2(__assign2(__assign2({}, line_by_line_renderer_1.defaultLineByLineRendererConfig), side_by_side_renderer_1.defaultSideBySideRendererConfig), { outputFormat: types_1.OutputFormatType.LINE_BY_LINE, drawFileList: true });
+ function parse(diffInput, configuration) {
+ if (configuration === void 0) {
+ configuration = {};
+ }
+ return DiffParser.parse(diffInput, __assign2(__assign2({}, exports.defaultDiff2HtmlConfig), configuration));
+ }
+ exports.parse = parse;
+ function html2(diffInput, configuration) {
+ if (configuration === void 0) {
+ configuration = {};
+ }
+ var config = __assign2(__assign2({}, exports.defaultDiff2HtmlConfig), configuration);
+ var diffJson = typeof diffInput === "string" ? DiffParser.parse(diffInput, config) : diffInput;
+ var hoganUtils = new hoganjs_utils_1.default(config);
+ var fileList = config.drawFileList ? fileListPrinter.render(diffJson, hoganUtils) : "";
+ var diffOutput = config.outputFormat === "side-by-side" ? new side_by_side_renderer_1.default(hoganUtils, config).render(diffJson) : new line_by_line_renderer_1.default(hoganUtils, config).render(diffJson);
+ return fileList + diffOutput;
+ }
+ exports.html = html2;
+ }
+});
+
+// node_modules/tslib/tslib.js
+var require_tslib = __commonJS({
+ "node_modules/tslib/tslib.js"(exports, module2) {
+ var __extends2;
+ var __assign2;
+ var __rest2;
+ var __decorate2;
+ var __param2;
+ var __metadata2;
+ var __awaiter2;
+ var __generator2;
+ var __exportStar2;
+ var __values2;
+ var __read2;
+ var __spread2;
+ var __spreadArrays2;
+ var __spreadArray2;
+ var __await2;
+ var __asyncGenerator2;
+ var __asyncDelegator2;
+ var __asyncValues2;
+ var __makeTemplateObject2;
+ var __importStar2;
+ var __importDefault2;
+ var __classPrivateFieldGet2;
+ var __classPrivateFieldSet2;
+ var __classPrivateFieldIn2;
+ var __createBinding2;
+ (function(factory) {
+ var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
+ if (typeof define === "function" && define.amd) {
+ define("tslib", ["exports"], function(exports2) {
+ factory(createExporter(root, createExporter(exports2)));
+ });
+ } else if (typeof module2 === "object" && typeof module2.exports === "object") {
+ factory(createExporter(root, createExporter(module2.exports)));
+ } else {
+ factory(createExporter(root));
+ }
+ function createExporter(exports2, previous) {
+ if (exports2 !== root) {
+ if (typeof Object.create === "function") {
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ } else {
+ exports2.__esModule = true;
+ }
+ }
+ return function(id, v) {
+ return exports2[id] = previous ? previous(id, v) : v;
+ };
+ }
+ })(function(exporter) {
+ var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
+ d.__proto__ = b;
+ } || function(d, b) {
+ for (var p in b)
+ if (Object.prototype.hasOwnProperty.call(b, p))
+ d[p] = b[p];
+ };
+ __extends2 = function(d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() {
+ this.constructor = d;
+ }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+ __assign2 = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s)
+ if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ __rest2 = function(s, e) {
+ var t = {};
+ for (var p in s)
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
+ t[p[i]] = s[p[i]];
+ }
+ return t;
+ };
+ __decorate2 = function(decorators, target, key2, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ r = Reflect.decorate(decorators, target, key2, desc);
+ else
+ for (var i = decorators.length - 1; i >= 0; i--)
+ if (d = decorators[i])
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key2, r) : d(target, key2)) || r;
+ return c > 3 && r && Object.defineProperty(target, key2, r), r;
+ };
+ __param2 = function(paramIndex, decorator) {
+ return function(target, key2) {
+ decorator(target, key2, paramIndex);
+ };
+ };
+ __metadata2 = function(metadataKey, metadataValue) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(metadataKey, metadataValue);
+ };
+ __awaiter2 = function(thisArg, _arguments, P, generator) {
+ function adopt(value) {
+ return value instanceof P ? value : new P(function(resolve) {
+ resolve(value);
+ });
+ }
+ return new (P || (P = Promise))(function(resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+ __generator2 = function(thisArg, body) {
+ var _ = { label: 0, sent: function() {
+ if (t[0] & 1)
+ throw t[1];
+ return t[1];
+ }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
+ return this;
+ }), g;
+ function verb(n) {
+ return function(v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f)
+ throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
+ return t;
+ if (y = 0, t)
+ op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2])
+ _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5)
+ throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
+ __exportStar2 = function(m, o) {
+ for (var p in m)
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
+ __createBinding2(o, m, p);
+ };
+ __createBinding2 = Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0)
+ k2 = k;
+ o[k2] = m[k];
+ };
+ __values2 = function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m)
+ return m.call(o);
+ if (o && typeof o.length === "number")
+ return {
+ next: function() {
+ if (o && i >= o.length)
+ o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+ };
+ __read2 = function(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m)
+ return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
+ ar.push(r.value);
+ } catch (error) {
+ e = { error };
+ } finally {
+ try {
+ if (r && !r.done && (m = i["return"]))
+ m.call(i);
+ } finally {
+ if (e)
+ throw e.error;
+ }
+ }
+ return ar;
+ };
+ __spread2 = function() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read2(arguments[i]));
+ return ar;
+ };
+ __spreadArrays2 = function() {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
+ s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+ };
+ __spreadArray2 = function(to, from, pack) {
+ if (pack || arguments.length === 2)
+ for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar)
+ ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
+ };
+ __await2 = function(v) {
+ return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
+ };
+ __asyncGenerator2 = function(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator)
+ throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i;
+ function verb(n) {
+ if (g[n])
+ i[n] = function(v) {
+ return new Promise(function(a, b) {
+ q.push([n, v, a, b]) > 1 || resume(n, v);
+ });
+ };
+ }
+ function resume(n, v) {
+ try {
+ step(g[n](v));
+ } catch (e) {
+ settle(q[0][3], e);
+ }
+ }
+ function step(r) {
+ r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
+ }
+ function fulfill(value) {
+ resume("next", value);
+ }
+ function reject(value) {
+ resume("throw", value);
+ }
+ function settle(f, v) {
+ if (f(v), q.shift(), q.length)
+ resume(q[0][0], q[0][1]);
+ }
+ };
+ __asyncDelegator2 = function(o) {
+ var i, p;
+ return i = {}, verb("next"), verb("throw", function(e) {
+ throw e;
+ }), verb("return"), i[Symbol.iterator] = function() {
+ return this;
+ }, i;
+ function verb(n, f) {
+ i[n] = o[n] ? function(v) {
+ return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } : f ? f(v) : v;
+ } : f;
+ }
+ };
+ __asyncValues2 = function(o) {
+ if (!Symbol.asyncIterator)
+ throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i);
+ function verb(n) {
+ i[n] = o[n] && function(v) {
+ return new Promise(function(resolve, reject) {
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
+ });
+ };
+ }
+ function settle(resolve, reject, d, v) {
+ Promise.resolve(v).then(function(v2) {
+ resolve({ value: v2, done: d });
+ }, reject);
+ }
+ };
+ __makeTemplateObject2 = function(cooked, raw) {
+ if (Object.defineProperty) {
+ Object.defineProperty(cooked, "raw", { value: raw });
+ } else {
+ cooked.raw = raw;
+ }
+ return cooked;
+ };
+ var __setModuleDefault = Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ };
+ __importStar2 = function(mod) {
+ if (mod && mod.__esModule)
+ return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod)
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
+ __createBinding2(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ __importDefault2 = function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ __classPrivateFieldGet2 = function(receiver, state, kind, f) {
+ if (kind === "a" && !f)
+ throw new TypeError("Private accessor was defined without a getter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
+ };
+ __classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
+ if (kind === "m")
+ throw new TypeError("Private method is not writable");
+ if (kind === "a" && !f)
+ throw new TypeError("Private accessor was defined without a setter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
+ };
+ __classPrivateFieldIn2 = function(state, receiver) {
+ if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function")
+ throw new TypeError("Cannot use 'in' operator on non-object");
+ return typeof state === "function" ? receiver === state : state.has(receiver);
+ };
+ exporter("__extends", __extends2);
+ exporter("__assign", __assign2);
+ exporter("__rest", __rest2);
+ exporter("__decorate", __decorate2);
+ exporter("__param", __param2);
+ exporter("__metadata", __metadata2);
+ exporter("__awaiter", __awaiter2);
+ exporter("__generator", __generator2);
+ exporter("__exportStar", __exportStar2);
+ exporter("__createBinding", __createBinding2);
+ exporter("__values", __values2);
+ exporter("__read", __read2);
+ exporter("__spread", __spread2);
+ exporter("__spreadArrays", __spreadArrays2);
+ exporter("__spreadArray", __spreadArray2);
+ exporter("__await", __await2);
+ exporter("__asyncGenerator", __asyncGenerator2);
+ exporter("__asyncDelegator", __asyncDelegator2);
+ exporter("__asyncValues", __asyncValues2);
+ exporter("__makeTemplateObject", __makeTemplateObject2);
+ exporter("__importStar", __importStar2);
+ exporter("__importDefault", __importDefault2);
+ exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
+ exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
+ exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
+ });
+ }
+});
+
+// node_modules/feather-icons/dist/feather.js
+var require_feather = __commonJS({
+ "node_modules/feather-icons/dist/feather.js"(exports, module2) {
+ (function webpackUniversalModuleDefinition(root, factory) {
+ if (typeof exports === "object" && typeof module2 === "object")
+ module2.exports = factory();
+ else if (typeof define === "function" && define.amd)
+ define([], factory);
+ else if (typeof exports === "object")
+ exports["feather"] = factory();
+ else
+ root["feather"] = factory();
+ })(typeof self !== "undefined" ? self : exports, function() {
+ return function(modules) {
+ var installedModules = {};
+ function __webpack_require__(moduleId) {
+ if (installedModules[moduleId]) {
+ return installedModules[moduleId].exports;
+ }
+ var module3 = installedModules[moduleId] = {
+ i: moduleId,
+ l: false,
+ exports: {}
+ };
+ modules[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
+ module3.l = true;
+ return module3.exports;
+ }
+ __webpack_require__.m = modules;
+ __webpack_require__.c = installedModules;
+ __webpack_require__.d = function(exports2, name, getter) {
+ if (!__webpack_require__.o(exports2, name)) {
+ Object.defineProperty(exports2, name, {
+ configurable: false,
+ enumerable: true,
+ get: getter
+ });
+ }
+ };
+ __webpack_require__.r = function(exports2) {
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ };
+ __webpack_require__.n = function(module3) {
+ var getter = module3 && module3.__esModule ? function getDefault() {
+ return module3["default"];
+ } : function getModuleExports() {
+ return module3;
+ };
+ __webpack_require__.d(getter, "a", getter);
+ return getter;
+ };
+ __webpack_require__.o = function(object, property) {
+ return Object.prototype.hasOwnProperty.call(object, property);
+ };
+ __webpack_require__.p = "";
+ return __webpack_require__(__webpack_require__.s = 0);
+ }({
+ "./dist/icons.json": function(module3) {
+ module3.exports = { "activity": '', "airplay": '', "alert-circle": '', "alert-octagon": '', "alert-triangle": '', "align-center": '', "align-justify": '', "align-left": '', "align-right": '', "anchor": '', "aperture": '', "archive": '', "arrow-down-circle": '', "arrow-down-left": '', "arrow-down-right": '', "arrow-down": '', "arrow-left-circle": '', "arrow-left": '', "arrow-right-circle": '', "arrow-right": '', "arrow-up-circle": '', "arrow-up-left": '', "arrow-up-right": '', "arrow-up": '', "at-sign": '', "award": '', "bar-chart-2": '', "bar-chart": '', "battery-charging": '', "battery": '', "bell-off": '', "bell": '', "bluetooth": '', "bold": '', "book-open": '', "book": '', "bookmark": '', "box": '', "briefcase": '', "calendar": '', "camera-off": '', "camera": '', "cast": '', "check-circle": '', "check-square": '', "check": '', "chevron-down": '', "chevron-left": '', "chevron-right": '', "chevron-up": '', "chevrons-down": '', "chevrons-left": '', "chevrons-right": '', "chevrons-up": '', "chrome": '', "circle": '', "clipboard": '', "clock": '', "cloud-drizzle": '', "cloud-lightning": '', "cloud-off": '', "cloud-rain": '', "cloud-snow": '', "cloud": '', "code": '', "codepen": '', "codesandbox": '', "coffee": '', "columns": '', "command": '', "compass": '', "copy": '', "corner-down-left": '', "corner-down-right": '', "corner-left-down": '', "corner-left-up": '', "corner-right-down": '', "corner-right-up": '', "corner-up-left": '', "corner-up-right": '', "cpu": '', "credit-card": '', "crop": '', "crosshair": '', "database": '', "delete": '', "disc": '', "divide-circle": '', "divide-square": '', "divide": '', "dollar-sign": '', "download-cloud": '', "download": '', "dribbble": '', "droplet": '', "edit-2": '', "edit-3": '', "edit": '', "external-link": '', "eye-off": '', "eye": '', "facebook": '', "fast-forward": '', "feather": '', "figma": '', "file-minus": '', "file-plus": '', "file-text": '', "file": '', "film": '', "filter": '', "flag": '', "folder-minus": '', "folder-plus": '', "folder": '', "framer": '', "frown": '', "gift": '', "git-branch": '', "git-commit": '', "git-merge": '', "git-pull-request": '', "github": '', "gitlab": '', "globe": '', "grid": '', "hard-drive": '', "hash": '', "headphones": '', "heart": '', "help-circle": '', "hexagon": '', "home": '', "image": '', "inbox": '', "info": '', "instagram": '', "italic": '', "key": '', "layers": '', "layout": '', "life-buoy": '', "link-2": '', "link": '', "linkedin": '', "list": '', "loader": '', "lock": '', "log-in": '', "log-out": '', "mail": '', "map-pin": '', "map": '', "maximize-2": '', "maximize": '', "meh": '', "menu": '', "message-circle": '', "message-square": '', "mic-off": '', "mic": '', "minimize-2": '', "minimize": '', "minus-circle": '', "minus-square": '', "minus": '', "monitor": '', "moon": '', "more-horizontal": '', "more-vertical": '', "mouse-pointer": '', "move": '', "music": '', "navigation-2": '', "navigation": '', "octagon": '', "package": '', "paperclip": '', "pause-circle": '', "pause": '', "pen-tool": '', "percent": '', "phone-call": '', "phone-forwarded": '', "phone-incoming": '', "phone-missed": '', "phone-off": '', "phone-outgoing": '', "phone": '', "pie-chart": '', "play-circle": '', "play": '', "plus-circle": '', "plus-square": '', "plus": '', "pocket": '', "power": '', "printer": '', "radio": '', "refresh-ccw": '', "refresh-cw": '', "repeat": '', "rewind": '', "rotate-ccw": '', "rotate-cw": '', "rss": '', "save": '', "scissors": '', "search": '', "send": '', "server": '', "settings": '', "share-2": '', "share": '', "shield-off": '', "shield": '', "shopping-bag": '', "shopping-cart": '', "shuffle": '', "sidebar": '', "skip-back": '', "skip-forward": '', "slack": '', "slash": '', "sliders": '', "smartphone": '', "smile": '', "speaker": '', "square": '', "star": '', "stop-circle": '', "sun": '', "sunrise": '', "sunset": '', "table": '', "tablet": '', "tag": '', "target": '', "terminal": '', "thermometer": '', "thumbs-down": '', "thumbs-up": '', "toggle-left": '', "toggle-right": '', "tool": '', "trash-2": '', "trash": '', "trello": '', "trending-down": '', "trending-up": '', "triangle": '', "truck": '', "tv": '', "twitch": '', "twitter": '', "type": '', "umbrella": '', "underline": '', "unlock": '', "upload-cloud": '', "upload": '', "user-check": '', "user-minus": '', "user-plus": '', "user-x": '', "user": '', "users": '', "video-off": '', "video": '', "voicemail": '', "volume-1": '', "volume-2": '', "volume-x": '', "volume": '', "watch": '', "wifi-off": '', "wifi": '', "wind": '', "x-circle": '', "x-octagon": '', "x-square": '', "x": '', "youtube": '', "zap-off": '', "zap": '', "zoom-in": '', "zoom-out": '' };
+ },
+ "./node_modules/classnames/dedupe.js": function(module3, exports2, __webpack_require__) {
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
+ (function() {
+ "use strict";
+ var classNames = function() {
+ function StorageObject() {
+ }
+ StorageObject.prototype = Object.create(null);
+ function _parseArray(resultSet, array) {
+ var length = array.length;
+ for (var i = 0; i < length; ++i) {
+ _parse(resultSet, array[i]);
+ }
+ }
+ var hasOwn = {}.hasOwnProperty;
+ function _parseNumber(resultSet, num) {
+ resultSet[num] = true;
+ }
+ function _parseObject(resultSet, object) {
+ for (var k in object) {
+ if (hasOwn.call(object, k)) {
+ resultSet[k] = !!object[k];
+ }
+ }
+ }
+ var SPACE = /\s+/;
+ function _parseString(resultSet, str) {
+ var array = str.split(SPACE);
+ var length = array.length;
+ for (var i = 0; i < length; ++i) {
+ resultSet[array[i]] = true;
+ }
+ }
+ function _parse(resultSet, arg) {
+ if (!arg)
+ return;
+ var argType = typeof arg;
+ if (argType === "string") {
+ _parseString(resultSet, arg);
+ } else if (Array.isArray(arg)) {
+ _parseArray(resultSet, arg);
+ } else if (argType === "object") {
+ _parseObject(resultSet, arg);
+ } else if (argType === "number") {
+ _parseNumber(resultSet, arg);
+ }
+ }
+ function _classNames() {
+ var len = arguments.length;
+ var args = Array(len);
+ for (var i = 0; i < len; i++) {
+ args[i] = arguments[i];
+ }
+ var classSet = new StorageObject();
+ _parseArray(classSet, args);
+ var list = [];
+ for (var k in classSet) {
+ if (classSet[k]) {
+ list.push(k);
+ }
+ }
+ return list.join(" ");
+ }
+ return _classNames;
+ }();
+ if (typeof module3 !== "undefined" && module3.exports) {
+ module3.exports = classNames;
+ } else if (true) {
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
+ return classNames;
+ }.apply(exports2, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== void 0 && (module3.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else {
+ }
+ })();
+ },
+ "./node_modules/core-js/es/array/from.js": function(module3, exports2, __webpack_require__) {
+ __webpack_require__("./node_modules/core-js/modules/es.string.iterator.js");
+ __webpack_require__("./node_modules/core-js/modules/es.array.from.js");
+ var path3 = __webpack_require__("./node_modules/core-js/internals/path.js");
+ module3.exports = path3.Array.from;
+ },
+ "./node_modules/core-js/internals/a-function.js": function(module3, exports2) {
+ module3.exports = function(it) {
+ if (typeof it != "function") {
+ throw TypeError(String(it) + " is not a function");
+ }
+ return it;
+ };
+ },
+ "./node_modules/core-js/internals/an-object.js": function(module3, exports2, __webpack_require__) {
+ var isObject = __webpack_require__("./node_modules/core-js/internals/is-object.js");
+ module3.exports = function(it) {
+ if (!isObject(it)) {
+ throw TypeError(String(it) + " is not an object");
+ }
+ return it;
+ };
+ },
+ "./node_modules/core-js/internals/array-from.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var bind = __webpack_require__("./node_modules/core-js/internals/bind-context.js");
+ var toObject = __webpack_require__("./node_modules/core-js/internals/to-object.js");
+ var callWithSafeIterationClosing = __webpack_require__("./node_modules/core-js/internals/call-with-safe-iteration-closing.js");
+ var isArrayIteratorMethod = __webpack_require__("./node_modules/core-js/internals/is-array-iterator-method.js");
+ var toLength = __webpack_require__("./node_modules/core-js/internals/to-length.js");
+ var createProperty = __webpack_require__("./node_modules/core-js/internals/create-property.js");
+ var getIteratorMethod = __webpack_require__("./node_modules/core-js/internals/get-iterator-method.js");
+ module3.exports = function from(arrayLike) {
+ var O = toObject(arrayLike);
+ var C = typeof this == "function" ? this : Array;
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : void 0;
+ var mapping = mapfn !== void 0;
+ var index = 0;
+ var iteratorMethod = getIteratorMethod(O);
+ var length, result, step, iterator;
+ if (mapping)
+ mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : void 0, 2);
+ if (iteratorMethod != void 0 && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
+ iterator = iteratorMethod.call(O);
+ result = new C();
+ for (; !(step = iterator.next()).done; index++) {
+ createProperty(result, index, mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value);
+ }
+ } else {
+ length = toLength(O.length);
+ result = new C(length);
+ for (; length > index; index++) {
+ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
+ }
+ }
+ result.length = index;
+ return result;
+ };
+ },
+ "./node_modules/core-js/internals/array-includes.js": function(module3, exports2, __webpack_require__) {
+ var toIndexedObject = __webpack_require__("./node_modules/core-js/internals/to-indexed-object.js");
+ var toLength = __webpack_require__("./node_modules/core-js/internals/to-length.js");
+ var toAbsoluteIndex = __webpack_require__("./node_modules/core-js/internals/to-absolute-index.js");
+ module3.exports = function(IS_INCLUDES) {
+ return function($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ if (IS_INCLUDES && el != el)
+ while (length > index) {
+ value = O[index++];
+ if (value != value)
+ return true;
+ }
+ else
+ for (; length > index; index++)
+ if (IS_INCLUDES || index in O) {
+ if (O[index] === el)
+ return IS_INCLUDES || index || 0;
+ }
+ return !IS_INCLUDES && -1;
+ };
+ };
+ },
+ "./node_modules/core-js/internals/bind-context.js": function(module3, exports2, __webpack_require__) {
+ var aFunction = __webpack_require__("./node_modules/core-js/internals/a-function.js");
+ module3.exports = function(fn, that, length) {
+ aFunction(fn);
+ if (that === void 0)
+ return fn;
+ switch (length) {
+ case 0:
+ return function() {
+ return fn.call(that);
+ };
+ case 1:
+ return function(a) {
+ return fn.call(that, a);
+ };
+ case 2:
+ return function(a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3:
+ return function(a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function() {
+ return fn.apply(that, arguments);
+ };
+ };
+ },
+ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js": function(module3, exports2, __webpack_require__) {
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ module3.exports = function(iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ } catch (error) {
+ var returnMethod = iterator["return"];
+ if (returnMethod !== void 0)
+ anObject(returnMethod.call(iterator));
+ throw error;
+ }
+ };
+ },
+ "./node_modules/core-js/internals/check-correctness-of-iteration.js": function(module3, exports2, __webpack_require__) {
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var ITERATOR = wellKnownSymbol("iterator");
+ var SAFE_CLOSING = false;
+ try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function() {
+ return { done: !!called++ };
+ },
+ "return": function() {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR] = function() {
+ return this;
+ };
+ Array.from(iteratorWithReturn, function() {
+ throw 2;
+ });
+ } catch (error) {
+ }
+ module3.exports = function(exec, SKIP_CLOSING) {
+ if (!SKIP_CLOSING && !SAFE_CLOSING)
+ return false;
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR] = function() {
+ return {
+ next: function() {
+ return { done: ITERATION_SUPPORT = true };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) {
+ }
+ return ITERATION_SUPPORT;
+ };
+ },
+ "./node_modules/core-js/internals/classof-raw.js": function(module3, exports2) {
+ var toString = {}.toString;
+ module3.exports = function(it) {
+ return toString.call(it).slice(8, -1);
+ };
+ },
+ "./node_modules/core-js/internals/classof.js": function(module3, exports2, __webpack_require__) {
+ var classofRaw = __webpack_require__("./node_modules/core-js/internals/classof-raw.js");
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ var CORRECT_ARGUMENTS = classofRaw(function() {
+ return arguments;
+ }()) == "Arguments";
+ var tryGet = function(it, key2) {
+ try {
+ return it[key2];
+ } catch (error) {
+ }
+ };
+ module3.exports = function(it) {
+ var O, tag, result;
+ return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && typeof O.callee == "function" ? "Arguments" : result;
+ };
+ },
+ "./node_modules/core-js/internals/copy-constructor-properties.js": function(module3, exports2, __webpack_require__) {
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var ownKeys = __webpack_require__("./node_modules/core-js/internals/own-keys.js");
+ var getOwnPropertyDescriptorModule = __webpack_require__("./node_modules/core-js/internals/object-get-own-property-descriptor.js");
+ var definePropertyModule = __webpack_require__("./node_modules/core-js/internals/object-define-property.js");
+ module3.exports = function(target, source) {
+ var keys = ownKeys(source);
+ var defineProperty = definePropertyModule.f;
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key2 = keys[i];
+ if (!has(target, key2))
+ defineProperty(target, key2, getOwnPropertyDescriptor(source, key2));
+ }
+ };
+ },
+ "./node_modules/core-js/internals/correct-prototype-getter.js": function(module3, exports2, __webpack_require__) {
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ module3.exports = !fails(function() {
+ function F() {
+ }
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F()) !== F.prototype;
+ });
+ },
+ "./node_modules/core-js/internals/create-iterator-constructor.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var IteratorPrototype = __webpack_require__("./node_modules/core-js/internals/iterators-core.js").IteratorPrototype;
+ var create = __webpack_require__("./node_modules/core-js/internals/object-create.js");
+ var createPropertyDescriptor = __webpack_require__("./node_modules/core-js/internals/create-property-descriptor.js");
+ var setToStringTag = __webpack_require__("./node_modules/core-js/internals/set-to-string-tag.js");
+ var Iterators = __webpack_require__("./node_modules/core-js/internals/iterators.js");
+ var returnThis = function() {
+ return this;
+ };
+ module3.exports = function(IteratorConstructor, NAME, next) {
+ var TO_STRING_TAG = NAME + " Iterator";
+ IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
+ Iterators[TO_STRING_TAG] = returnThis;
+ return IteratorConstructor;
+ };
+ },
+ "./node_modules/core-js/internals/create-property-descriptor.js": function(module3, exports2) {
+ module3.exports = function(bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value
+ };
+ };
+ },
+ "./node_modules/core-js/internals/create-property.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var toPrimitive = __webpack_require__("./node_modules/core-js/internals/to-primitive.js");
+ var definePropertyModule = __webpack_require__("./node_modules/core-js/internals/object-define-property.js");
+ var createPropertyDescriptor = __webpack_require__("./node_modules/core-js/internals/create-property-descriptor.js");
+ module3.exports = function(object, key2, value) {
+ var propertyKey = toPrimitive(key2);
+ if (propertyKey in object)
+ definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
+ else
+ object[propertyKey] = value;
+ };
+ },
+ "./node_modules/core-js/internals/define-iterator.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var $ = __webpack_require__("./node_modules/core-js/internals/export.js");
+ var createIteratorConstructor = __webpack_require__("./node_modules/core-js/internals/create-iterator-constructor.js");
+ var getPrototypeOf = __webpack_require__("./node_modules/core-js/internals/object-get-prototype-of.js");
+ var setPrototypeOf = __webpack_require__("./node_modules/core-js/internals/object-set-prototype-of.js");
+ var setToStringTag = __webpack_require__("./node_modules/core-js/internals/set-to-string-tag.js");
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ var redefine = __webpack_require__("./node_modules/core-js/internals/redefine.js");
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var IS_PURE = __webpack_require__("./node_modules/core-js/internals/is-pure.js");
+ var Iterators = __webpack_require__("./node_modules/core-js/internals/iterators.js");
+ var IteratorsCore = __webpack_require__("./node_modules/core-js/internals/iterators-core.js");
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
+ var ITERATOR = wellKnownSymbol("iterator");
+ var KEYS = "keys";
+ var VALUES = "values";
+ var ENTRIES = "entries";
+ var returnThis = function() {
+ return this;
+ };
+ module3.exports = function(Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+ var getIterationMethod = function(KIND) {
+ if (KIND === DEFAULT && defaultIterator)
+ return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
+ return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS:
+ return function keys() {
+ return new IteratorConstructor(this, KIND);
+ };
+ case VALUES:
+ return function values() {
+ return new IteratorConstructor(this, KIND);
+ };
+ case ENTRIES:
+ return function entries() {
+ return new IteratorConstructor(this, KIND);
+ };
+ }
+ return function() {
+ return new IteratorConstructor(this);
+ };
+ };
+ var TO_STRING_TAG = NAME + " Iterator";
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype["@@iterator"] || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME == "Array" ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
+ if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
+ if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
+ if (setPrototypeOf) {
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
+ } else if (typeof CurrentIteratorPrototype[ITERATOR] != "function") {
+ hide(CurrentIteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
+ if (IS_PURE)
+ Iterators[TO_STRING_TAG] = returnThis;
+ }
+ }
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() {
+ return nativeIterator.call(this);
+ };
+ }
+ if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
+ hide(IterablePrototype, ITERATOR, defaultIterator);
+ }
+ Iterators[NAME] = defaultIterator;
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED)
+ for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ redefine(IterablePrototype, KEY, methods[KEY]);
+ }
+ }
+ else
+ $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
+ }
+ return methods;
+ };
+ },
+ "./node_modules/core-js/internals/descriptors.js": function(module3, exports2, __webpack_require__) {
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ module3.exports = !fails(function() {
+ return Object.defineProperty({}, "a", { get: function() {
+ return 7;
+ } }).a != 7;
+ });
+ },
+ "./node_modules/core-js/internals/document-create-element.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var isObject = __webpack_require__("./node_modules/core-js/internals/is-object.js");
+ var document2 = global2.document;
+ var exist = isObject(document2) && isObject(document2.createElement);
+ module3.exports = function(it) {
+ return exist ? document2.createElement(it) : {};
+ };
+ },
+ "./node_modules/core-js/internals/enum-bug-keys.js": function(module3, exports2) {
+ module3.exports = [
+ "constructor",
+ "hasOwnProperty",
+ "isPrototypeOf",
+ "propertyIsEnumerable",
+ "toLocaleString",
+ "toString",
+ "valueOf"
+ ];
+ },
+ "./node_modules/core-js/internals/export.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var getOwnPropertyDescriptor = __webpack_require__("./node_modules/core-js/internals/object-get-own-property-descriptor.js").f;
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ var redefine = __webpack_require__("./node_modules/core-js/internals/redefine.js");
+ var setGlobal = __webpack_require__("./node_modules/core-js/internals/set-global.js");
+ var copyConstructorProperties = __webpack_require__("./node_modules/core-js/internals/copy-constructor-properties.js");
+ var isForced = __webpack_require__("./node_modules/core-js/internals/is-forced.js");
+ module3.exports = function(options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key2, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = global2;
+ } else if (STATIC) {
+ target = global2[TARGET] || setGlobal(TARGET, {});
+ } else {
+ target = (global2[TARGET] || {}).prototype;
+ }
+ if (target)
+ for (key2 in source) {
+ sourceProperty = source[key2];
+ if (options.noTargetGet) {
+ descriptor = getOwnPropertyDescriptor(target, key2);
+ targetProperty = descriptor && descriptor.value;
+ } else
+ targetProperty = target[key2];
+ FORCED = isForced(GLOBAL ? key2 : TARGET + (STATIC ? "." : "#") + key2, options.forced);
+ if (!FORCED && targetProperty !== void 0) {
+ if (typeof sourceProperty === typeof targetProperty)
+ continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ if (options.sham || targetProperty && targetProperty.sham) {
+ hide(sourceProperty, "sham", true);
+ }
+ redefine(target, key2, sourceProperty, options);
+ }
+ };
+ },
+ "./node_modules/core-js/internals/fails.js": function(module3, exports2) {
+ module3.exports = function(exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+ };
+ },
+ "./node_modules/core-js/internals/function-to-string.js": function(module3, exports2, __webpack_require__) {
+ var shared = __webpack_require__("./node_modules/core-js/internals/shared.js");
+ module3.exports = shared("native-function-to-string", Function.toString);
+ },
+ "./node_modules/core-js/internals/get-iterator-method.js": function(module3, exports2, __webpack_require__) {
+ var classof = __webpack_require__("./node_modules/core-js/internals/classof.js");
+ var Iterators = __webpack_require__("./node_modules/core-js/internals/iterators.js");
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var ITERATOR = wellKnownSymbol("iterator");
+ module3.exports = function(it) {
+ if (it != void 0)
+ return it[ITERATOR] || it["@@iterator"] || Iterators[classof(it)];
+ };
+ },
+ "./node_modules/core-js/internals/global.js": function(module3, exports2, __webpack_require__) {
+ (function(global2) {
+ var O = "object";
+ var check = function(it) {
+ return it && it.Math == Math && it;
+ };
+ module3.exports = check(typeof globalThis == O && globalThis) || check(typeof window == O && window) || check(typeof self == O && self) || check(typeof global2 == O && global2) || Function("return this")();
+ }).call(this, __webpack_require__("./node_modules/webpack/buildin/global.js"));
+ },
+ "./node_modules/core-js/internals/has.js": function(module3, exports2) {
+ var hasOwnProperty = {}.hasOwnProperty;
+ module3.exports = function(it, key2) {
+ return hasOwnProperty.call(it, key2);
+ };
+ },
+ "./node_modules/core-js/internals/hidden-keys.js": function(module3, exports2) {
+ module3.exports = {};
+ },
+ "./node_modules/core-js/internals/hide.js": function(module3, exports2, __webpack_require__) {
+ var DESCRIPTORS = __webpack_require__("./node_modules/core-js/internals/descriptors.js");
+ var definePropertyModule = __webpack_require__("./node_modules/core-js/internals/object-define-property.js");
+ var createPropertyDescriptor = __webpack_require__("./node_modules/core-js/internals/create-property-descriptor.js");
+ module3.exports = DESCRIPTORS ? function(object, key2, value) {
+ return definePropertyModule.f(object, key2, createPropertyDescriptor(1, value));
+ } : function(object, key2, value) {
+ object[key2] = value;
+ return object;
+ };
+ },
+ "./node_modules/core-js/internals/html.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var document2 = global2.document;
+ module3.exports = document2 && document2.documentElement;
+ },
+ "./node_modules/core-js/internals/ie8-dom-define.js": function(module3, exports2, __webpack_require__) {
+ var DESCRIPTORS = __webpack_require__("./node_modules/core-js/internals/descriptors.js");
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ var createElement = __webpack_require__("./node_modules/core-js/internals/document-create-element.js");
+ module3.exports = !DESCRIPTORS && !fails(function() {
+ return Object.defineProperty(createElement("div"), "a", {
+ get: function() {
+ return 7;
+ }
+ }).a != 7;
+ });
+ },
+ "./node_modules/core-js/internals/indexed-object.js": function(module3, exports2, __webpack_require__) {
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ var classof = __webpack_require__("./node_modules/core-js/internals/classof-raw.js");
+ var split = "".split;
+ module3.exports = fails(function() {
+ return !Object("z").propertyIsEnumerable(0);
+ }) ? function(it) {
+ return classof(it) == "String" ? split.call(it, "") : Object(it);
+ } : Object;
+ },
+ "./node_modules/core-js/internals/internal-state.js": function(module3, exports2, __webpack_require__) {
+ var NATIVE_WEAK_MAP = __webpack_require__("./node_modules/core-js/internals/native-weak-map.js");
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var isObject = __webpack_require__("./node_modules/core-js/internals/is-object.js");
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ var objectHas = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var sharedKey = __webpack_require__("./node_modules/core-js/internals/shared-key.js");
+ var hiddenKeys = __webpack_require__("./node_modules/core-js/internals/hidden-keys.js");
+ var WeakMap2 = global2.WeakMap;
+ var set, get, has;
+ var enforce = function(it) {
+ return has(it) ? get(it) : set(it, {});
+ };
+ var getterFor = function(TYPE) {
+ return function(it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw TypeError("Incompatible receiver, " + TYPE + " required");
+ }
+ return state;
+ };
+ };
+ if (NATIVE_WEAK_MAP) {
+ var store = new WeakMap2();
+ var wmget = store.get;
+ var wmhas = store.has;
+ var wmset = store.set;
+ set = function(it, metadata) {
+ wmset.call(store, it, metadata);
+ return metadata;
+ };
+ get = function(it) {
+ return wmget.call(store, it) || {};
+ };
+ has = function(it) {
+ return wmhas.call(store, it);
+ };
+ } else {
+ var STATE = sharedKey("state");
+ hiddenKeys[STATE] = true;
+ set = function(it, metadata) {
+ hide(it, STATE, metadata);
+ return metadata;
+ };
+ get = function(it) {
+ return objectHas(it, STATE) ? it[STATE] : {};
+ };
+ has = function(it) {
+ return objectHas(it, STATE);
+ };
+ }
+ module3.exports = {
+ set,
+ get,
+ has,
+ enforce,
+ getterFor
+ };
+ },
+ "./node_modules/core-js/internals/is-array-iterator-method.js": function(module3, exports2, __webpack_require__) {
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var Iterators = __webpack_require__("./node_modules/core-js/internals/iterators.js");
+ var ITERATOR = wellKnownSymbol("iterator");
+ var ArrayPrototype = Array.prototype;
+ module3.exports = function(it) {
+ return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
+ };
+ },
+ "./node_modules/core-js/internals/is-forced.js": function(module3, exports2, __webpack_require__) {
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ var replacement = /#|\.prototype\./;
+ var isForced = function(feature, detection) {
+ var value = data[normalize2(feature)];
+ return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == "function" ? fails(detection) : !!detection;
+ };
+ var normalize2 = isForced.normalize = function(string) {
+ return String(string).replace(replacement, ".").toLowerCase();
+ };
+ var data = isForced.data = {};
+ var NATIVE = isForced.NATIVE = "N";
+ var POLYFILL = isForced.POLYFILL = "P";
+ module3.exports = isForced;
+ },
+ "./node_modules/core-js/internals/is-object.js": function(module3, exports2) {
+ module3.exports = function(it) {
+ return typeof it === "object" ? it !== null : typeof it === "function";
+ };
+ },
+ "./node_modules/core-js/internals/is-pure.js": function(module3, exports2) {
+ module3.exports = false;
+ },
+ "./node_modules/core-js/internals/iterators-core.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var getPrototypeOf = __webpack_require__("./node_modules/core-js/internals/object-get-prototype-of.js");
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var IS_PURE = __webpack_require__("./node_modules/core-js/internals/is-pure.js");
+ var ITERATOR = wellKnownSymbol("iterator");
+ var BUGGY_SAFARI_ITERATORS = false;
+ var returnThis = function() {
+ return this;
+ };
+ var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+ if ([].keys) {
+ arrayIterator = [].keys();
+ if (!("next" in arrayIterator))
+ BUGGY_SAFARI_ITERATORS = true;
+ else {
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
+ IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+ }
+ if (IteratorPrototype == void 0)
+ IteratorPrototype = {};
+ if (!IS_PURE && !has(IteratorPrototype, ITERATOR))
+ hide(IteratorPrototype, ITERATOR, returnThis);
+ module3.exports = {
+ IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS
+ };
+ },
+ "./node_modules/core-js/internals/iterators.js": function(module3, exports2) {
+ module3.exports = {};
+ },
+ "./node_modules/core-js/internals/native-symbol.js": function(module3, exports2, __webpack_require__) {
+ var fails = __webpack_require__("./node_modules/core-js/internals/fails.js");
+ module3.exports = !!Object.getOwnPropertySymbols && !fails(function() {
+ return !String(Symbol());
+ });
+ },
+ "./node_modules/core-js/internals/native-weak-map.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var nativeFunctionToString = __webpack_require__("./node_modules/core-js/internals/function-to-string.js");
+ var WeakMap2 = global2.WeakMap;
+ module3.exports = typeof WeakMap2 === "function" && /native code/.test(nativeFunctionToString.call(WeakMap2));
+ },
+ "./node_modules/core-js/internals/object-create.js": function(module3, exports2, __webpack_require__) {
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ var defineProperties = __webpack_require__("./node_modules/core-js/internals/object-define-properties.js");
+ var enumBugKeys = __webpack_require__("./node_modules/core-js/internals/enum-bug-keys.js");
+ var hiddenKeys = __webpack_require__("./node_modules/core-js/internals/hidden-keys.js");
+ var html2 = __webpack_require__("./node_modules/core-js/internals/html.js");
+ var documentCreateElement = __webpack_require__("./node_modules/core-js/internals/document-create-element.js");
+ var sharedKey = __webpack_require__("./node_modules/core-js/internals/shared-key.js");
+ var IE_PROTO = sharedKey("IE_PROTO");
+ var PROTOTYPE = "prototype";
+ var Empty = function() {
+ };
+ var createDict = function() {
+ var iframe = documentCreateElement("iframe");
+ var length = enumBugKeys.length;
+ var lt = "<";
+ var script = "script";
+ var gt = ">";
+ var js = "java" + script + ":";
+ var iframeDocument;
+ iframe.style.display = "none";
+ html2.appendChild(iframe);
+ iframe.src = String(js);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(lt + script + gt + "document.F=Object" + lt + "/" + script + gt);
+ iframeDocument.close();
+ createDict = iframeDocument.F;
+ while (length--)
+ delete createDict[PROTOTYPE][enumBugKeys[length]];
+ return createDict();
+ };
+ module3.exports = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ Empty[PROTOTYPE] = anObject(O);
+ result = new Empty();
+ Empty[PROTOTYPE] = null;
+ result[IE_PROTO] = O;
+ } else
+ result = createDict();
+ return Properties === void 0 ? result : defineProperties(result, Properties);
+ };
+ hiddenKeys[IE_PROTO] = true;
+ },
+ "./node_modules/core-js/internals/object-define-properties.js": function(module3, exports2, __webpack_require__) {
+ var DESCRIPTORS = __webpack_require__("./node_modules/core-js/internals/descriptors.js");
+ var definePropertyModule = __webpack_require__("./node_modules/core-js/internals/object-define-property.js");
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ var objectKeys = __webpack_require__("./node_modules/core-js/internals/object-keys.js");
+ module3.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var i = 0;
+ var key2;
+ while (length > i)
+ definePropertyModule.f(O, key2 = keys[i++], Properties[key2]);
+ return O;
+ };
+ },
+ "./node_modules/core-js/internals/object-define-property.js": function(module3, exports2, __webpack_require__) {
+ var DESCRIPTORS = __webpack_require__("./node_modules/core-js/internals/descriptors.js");
+ var IE8_DOM_DEFINE = __webpack_require__("./node_modules/core-js/internals/ie8-dom-define.js");
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ var toPrimitive = __webpack_require__("./node_modules/core-js/internals/to-primitive.js");
+ var nativeDefineProperty = Object.defineProperty;
+ exports2.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (IE8_DOM_DEFINE)
+ try {
+ return nativeDefineProperty(O, P, Attributes);
+ } catch (error) {
+ }
+ if ("get" in Attributes || "set" in Attributes)
+ throw TypeError("Accessors not supported");
+ if ("value" in Attributes)
+ O[P] = Attributes.value;
+ return O;
+ };
+ },
+ "./node_modules/core-js/internals/object-get-own-property-descriptor.js": function(module3, exports2, __webpack_require__) {
+ var DESCRIPTORS = __webpack_require__("./node_modules/core-js/internals/descriptors.js");
+ var propertyIsEnumerableModule = __webpack_require__("./node_modules/core-js/internals/object-property-is-enumerable.js");
+ var createPropertyDescriptor = __webpack_require__("./node_modules/core-js/internals/create-property-descriptor.js");
+ var toIndexedObject = __webpack_require__("./node_modules/core-js/internals/to-indexed-object.js");
+ var toPrimitive = __webpack_require__("./node_modules/core-js/internals/to-primitive.js");
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var IE8_DOM_DEFINE = __webpack_require__("./node_modules/core-js/internals/ie8-dom-define.js");
+ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ exports2.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPrimitive(P, true);
+ if (IE8_DOM_DEFINE)
+ try {
+ return nativeGetOwnPropertyDescriptor(O, P);
+ } catch (error) {
+ }
+ if (has(O, P))
+ return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
+ };
+ },
+ "./node_modules/core-js/internals/object-get-own-property-names.js": function(module3, exports2, __webpack_require__) {
+ var internalObjectKeys = __webpack_require__("./node_modules/core-js/internals/object-keys-internal.js");
+ var enumBugKeys = __webpack_require__("./node_modules/core-js/internals/enum-bug-keys.js");
+ var hiddenKeys = enumBugKeys.concat("length", "prototype");
+ exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return internalObjectKeys(O, hiddenKeys);
+ };
+ },
+ "./node_modules/core-js/internals/object-get-own-property-symbols.js": function(module3, exports2) {
+ exports2.f = Object.getOwnPropertySymbols;
+ },
+ "./node_modules/core-js/internals/object-get-prototype-of.js": function(module3, exports2, __webpack_require__) {
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var toObject = __webpack_require__("./node_modules/core-js/internals/to-object.js");
+ var sharedKey = __webpack_require__("./node_modules/core-js/internals/shared-key.js");
+ var CORRECT_PROTOTYPE_GETTER = __webpack_require__("./node_modules/core-js/internals/correct-prototype-getter.js");
+ var IE_PROTO = sharedKey("IE_PROTO");
+ var ObjectPrototype = Object.prototype;
+ module3.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function(O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO))
+ return O[IE_PROTO];
+ if (typeof O.constructor == "function" && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ }
+ return O instanceof Object ? ObjectPrototype : null;
+ };
+ },
+ "./node_modules/core-js/internals/object-keys-internal.js": function(module3, exports2, __webpack_require__) {
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var toIndexedObject = __webpack_require__("./node_modules/core-js/internals/to-indexed-object.js");
+ var arrayIncludes = __webpack_require__("./node_modules/core-js/internals/array-includes.js");
+ var hiddenKeys = __webpack_require__("./node_modules/core-js/internals/hidden-keys.js");
+ var arrayIndexOf = arrayIncludes(false);
+ module3.exports = function(object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key2;
+ for (key2 in O)
+ !has(hiddenKeys, key2) && has(O, key2) && result.push(key2);
+ while (names.length > i)
+ if (has(O, key2 = names[i++])) {
+ ~arrayIndexOf(result, key2) || result.push(key2);
+ }
+ return result;
+ };
+ },
+ "./node_modules/core-js/internals/object-keys.js": function(module3, exports2, __webpack_require__) {
+ var internalObjectKeys = __webpack_require__("./node_modules/core-js/internals/object-keys-internal.js");
+ var enumBugKeys = __webpack_require__("./node_modules/core-js/internals/enum-bug-keys.js");
+ module3.exports = Object.keys || function keys(O) {
+ return internalObjectKeys(O, enumBugKeys);
+ };
+ },
+ "./node_modules/core-js/internals/object-property-is-enumerable.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+ exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+ } : nativePropertyIsEnumerable;
+ },
+ "./node_modules/core-js/internals/object-set-prototype-of.js": function(module3, exports2, __webpack_require__) {
+ var validateSetPrototypeOfArguments = __webpack_require__("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");
+ module3.exports = Object.setPrototypeOf || ("__proto__" in {} ? function() {
+ var correctSetter = false;
+ var test = {};
+ var setter;
+ try {
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set;
+ setter.call(test, []);
+ correctSetter = test instanceof Array;
+ } catch (error) {
+ }
+ return function setPrototypeOf(O, proto) {
+ validateSetPrototypeOfArguments(O, proto);
+ if (correctSetter)
+ setter.call(O, proto);
+ else
+ O.__proto__ = proto;
+ return O;
+ };
+ }() : void 0);
+ },
+ "./node_modules/core-js/internals/own-keys.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var getOwnPropertyNamesModule = __webpack_require__("./node_modules/core-js/internals/object-get-own-property-names.js");
+ var getOwnPropertySymbolsModule = __webpack_require__("./node_modules/core-js/internals/object-get-own-property-symbols.js");
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ var Reflect2 = global2.Reflect;
+ module3.exports = Reflect2 && Reflect2.ownKeys || function ownKeys(it) {
+ var keys = getOwnPropertyNamesModule.f(anObject(it));
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
+ };
+ },
+ "./node_modules/core-js/internals/path.js": function(module3, exports2, __webpack_require__) {
+ module3.exports = __webpack_require__("./node_modules/core-js/internals/global.js");
+ },
+ "./node_modules/core-js/internals/redefine.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var shared = __webpack_require__("./node_modules/core-js/internals/shared.js");
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var setGlobal = __webpack_require__("./node_modules/core-js/internals/set-global.js");
+ var nativeFunctionToString = __webpack_require__("./node_modules/core-js/internals/function-to-string.js");
+ var InternalStateModule = __webpack_require__("./node_modules/core-js/internals/internal-state.js");
+ var getInternalState = InternalStateModule.get;
+ var enforceInternalState = InternalStateModule.enforce;
+ var TEMPLATE = String(nativeFunctionToString).split("toString");
+ shared("inspectSource", function(it) {
+ return nativeFunctionToString.call(it);
+ });
+ (module3.exports = function(O, key2, value, options) {
+ var unsafe = options ? !!options.unsafe : false;
+ var simple = options ? !!options.enumerable : false;
+ var noTargetGet = options ? !!options.noTargetGet : false;
+ if (typeof value == "function") {
+ if (typeof key2 == "string" && !has(value, "name"))
+ hide(value, "name", key2);
+ enforceInternalState(value).source = TEMPLATE.join(typeof key2 == "string" ? key2 : "");
+ }
+ if (O === global2) {
+ if (simple)
+ O[key2] = value;
+ else
+ setGlobal(key2, value);
+ return;
+ } else if (!unsafe) {
+ delete O[key2];
+ } else if (!noTargetGet && O[key2]) {
+ simple = true;
+ }
+ if (simple)
+ O[key2] = value;
+ else
+ hide(O, key2, value);
+ })(Function.prototype, "toString", function toString() {
+ return typeof this == "function" && getInternalState(this).source || nativeFunctionToString.call(this);
+ });
+ },
+ "./node_modules/core-js/internals/require-object-coercible.js": function(module3, exports2) {
+ module3.exports = function(it) {
+ if (it == void 0)
+ throw TypeError("Can't call method on " + it);
+ return it;
+ };
+ },
+ "./node_modules/core-js/internals/set-global.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var hide = __webpack_require__("./node_modules/core-js/internals/hide.js");
+ module3.exports = function(key2, value) {
+ try {
+ hide(global2, key2, value);
+ } catch (error) {
+ global2[key2] = value;
+ }
+ return value;
+ };
+ },
+ "./node_modules/core-js/internals/set-to-string-tag.js": function(module3, exports2, __webpack_require__) {
+ var defineProperty = __webpack_require__("./node_modules/core-js/internals/object-define-property.js").f;
+ var has = __webpack_require__("./node_modules/core-js/internals/has.js");
+ var wellKnownSymbol = __webpack_require__("./node_modules/core-js/internals/well-known-symbol.js");
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ module3.exports = function(it, TAG, STATIC) {
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
+ defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
+ }
+ };
+ },
+ "./node_modules/core-js/internals/shared-key.js": function(module3, exports2, __webpack_require__) {
+ var shared = __webpack_require__("./node_modules/core-js/internals/shared.js");
+ var uid = __webpack_require__("./node_modules/core-js/internals/uid.js");
+ var keys = shared("keys");
+ module3.exports = function(key2) {
+ return keys[key2] || (keys[key2] = uid(key2));
+ };
+ },
+ "./node_modules/core-js/internals/shared.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var setGlobal = __webpack_require__("./node_modules/core-js/internals/set-global.js");
+ var IS_PURE = __webpack_require__("./node_modules/core-js/internals/is-pure.js");
+ var SHARED = "__core-js_shared__";
+ var store = global2[SHARED] || setGlobal(SHARED, {});
+ (module3.exports = function(key2, value) {
+ return store[key2] || (store[key2] = value !== void 0 ? value : {});
+ })("versions", []).push({
+ version: "3.1.3",
+ mode: IS_PURE ? "pure" : "global",
+ copyright: "\xA9 2019 Denis Pushkarev (zloirock.ru)"
+ });
+ },
+ "./node_modules/core-js/internals/string-at.js": function(module3, exports2, __webpack_require__) {
+ var toInteger = __webpack_require__("./node_modules/core-js/internals/to-integer.js");
+ var requireObjectCoercible = __webpack_require__("./node_modules/core-js/internals/require-object-coercible.js");
+ module3.exports = function(that, pos, CONVERT_TO_STRING) {
+ var S = String(requireObjectCoercible(that));
+ var position = toInteger(pos);
+ var size = S.length;
+ var first2, second;
+ if (position < 0 || position >= size)
+ return CONVERT_TO_STRING ? "" : void 0;
+ first2 = S.charCodeAt(position);
+ return first2 < 55296 || first2 > 56319 || position + 1 === size || (second = S.charCodeAt(position + 1)) < 56320 || second > 57343 ? CONVERT_TO_STRING ? S.charAt(position) : first2 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first2 - 55296 << 10) + (second - 56320) + 65536;
+ };
+ },
+ "./node_modules/core-js/internals/to-absolute-index.js": function(module3, exports2, __webpack_require__) {
+ var toInteger = __webpack_require__("./node_modules/core-js/internals/to-integer.js");
+ var max = Math.max;
+ var min = Math.min;
+ module3.exports = function(index, length) {
+ var integer = toInteger(index);
+ return integer < 0 ? max(integer + length, 0) : min(integer, length);
+ };
+ },
+ "./node_modules/core-js/internals/to-indexed-object.js": function(module3, exports2, __webpack_require__) {
+ var IndexedObject = __webpack_require__("./node_modules/core-js/internals/indexed-object.js");
+ var requireObjectCoercible = __webpack_require__("./node_modules/core-js/internals/require-object-coercible.js");
+ module3.exports = function(it) {
+ return IndexedObject(requireObjectCoercible(it));
+ };
+ },
+ "./node_modules/core-js/internals/to-integer.js": function(module3, exports2) {
+ var ceil = Math.ceil;
+ var floor = Math.floor;
+ module3.exports = function(argument) {
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
+ };
+ },
+ "./node_modules/core-js/internals/to-length.js": function(module3, exports2, __webpack_require__) {
+ var toInteger = __webpack_require__("./node_modules/core-js/internals/to-integer.js");
+ var min = Math.min;
+ module3.exports = function(argument) {
+ return argument > 0 ? min(toInteger(argument), 9007199254740991) : 0;
+ };
+ },
+ "./node_modules/core-js/internals/to-object.js": function(module3, exports2, __webpack_require__) {
+ var requireObjectCoercible = __webpack_require__("./node_modules/core-js/internals/require-object-coercible.js");
+ module3.exports = function(argument) {
+ return Object(requireObjectCoercible(argument));
+ };
+ },
+ "./node_modules/core-js/internals/to-primitive.js": function(module3, exports2, __webpack_require__) {
+ var isObject = __webpack_require__("./node_modules/core-js/internals/is-object.js");
+ module3.exports = function(it, S) {
+ if (!isObject(it))
+ return it;
+ var fn, val;
+ if (S && typeof (fn = it.toString) == "function" && !isObject(val = fn.call(it)))
+ return val;
+ if (typeof (fn = it.valueOf) == "function" && !isObject(val = fn.call(it)))
+ return val;
+ if (!S && typeof (fn = it.toString) == "function" && !isObject(val = fn.call(it)))
+ return val;
+ throw TypeError("Can't convert object to primitive value");
+ };
+ },
+ "./node_modules/core-js/internals/uid.js": function(module3, exports2) {
+ var id = 0;
+ var postfix = Math.random();
+ module3.exports = function(key2) {
+ return "Symbol(".concat(key2 === void 0 ? "" : key2, ")_", (++id + postfix).toString(36));
+ };
+ },
+ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js": function(module3, exports2, __webpack_require__) {
+ var isObject = __webpack_require__("./node_modules/core-js/internals/is-object.js");
+ var anObject = __webpack_require__("./node_modules/core-js/internals/an-object.js");
+ module3.exports = function(O, proto) {
+ anObject(O);
+ if (!isObject(proto) && proto !== null) {
+ throw TypeError("Can't set " + String(proto) + " as a prototype");
+ }
+ };
+ },
+ "./node_modules/core-js/internals/well-known-symbol.js": function(module3, exports2, __webpack_require__) {
+ var global2 = __webpack_require__("./node_modules/core-js/internals/global.js");
+ var shared = __webpack_require__("./node_modules/core-js/internals/shared.js");
+ var uid = __webpack_require__("./node_modules/core-js/internals/uid.js");
+ var NATIVE_SYMBOL = __webpack_require__("./node_modules/core-js/internals/native-symbol.js");
+ var Symbol2 = global2.Symbol;
+ var store = shared("wks");
+ module3.exports = function(name) {
+ return store[name] || (store[name] = NATIVE_SYMBOL && Symbol2[name] || (NATIVE_SYMBOL ? Symbol2 : uid)("Symbol." + name));
+ };
+ },
+ "./node_modules/core-js/modules/es.array.from.js": function(module3, exports2, __webpack_require__) {
+ var $ = __webpack_require__("./node_modules/core-js/internals/export.js");
+ var from = __webpack_require__("./node_modules/core-js/internals/array-from.js");
+ var checkCorrectnessOfIteration = __webpack_require__("./node_modules/core-js/internals/check-correctness-of-iteration.js");
+ var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function(iterable) {
+ Array.from(iterable);
+ });
+ $({ target: "Array", stat: true, forced: INCORRECT_ITERATION }, {
+ from
+ });
+ },
+ "./node_modules/core-js/modules/es.string.iterator.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var codePointAt = __webpack_require__("./node_modules/core-js/internals/string-at.js");
+ var InternalStateModule = __webpack_require__("./node_modules/core-js/internals/internal-state.js");
+ var defineIterator = __webpack_require__("./node_modules/core-js/internals/define-iterator.js");
+ var STRING_ITERATOR = "String Iterator";
+ var setInternalState = InternalStateModule.set;
+ var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
+ defineIterator(String, "String", function(iterated) {
+ setInternalState(this, {
+ type: STRING_ITERATOR,
+ string: String(iterated),
+ index: 0
+ });
+ }, function next() {
+ var state = getInternalState(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length)
+ return { value: void 0, done: true };
+ point = codePointAt(string, index, true);
+ state.index += point.length;
+ return { value: point, done: false };
+ });
+ },
+ "./node_modules/webpack/buildin/global.js": function(module3, exports2) {
+ var g;
+ g = function() {
+ return this;
+ }();
+ try {
+ g = g || Function("return this")() || (1, eval)("this");
+ } catch (e) {
+ if (typeof window === "object")
+ g = window;
+ }
+ module3.exports = g;
+ },
+ "./src/default-attrs.json": function(module3) {
+ module3.exports = { "xmlns": "http://www.w3.org/2000/svg", "width": 24, "height": 24, "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round" };
+ },
+ "./src/icon.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", {
+ value: true
+ });
+ var _extends = Object.assign || function(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+ for (var key2 in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
+ target[key2] = source[key2];
+ }
+ }
+ }
+ return target;
+ };
+ var _createClass = function() {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor)
+ descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+ return function(Constructor, protoProps, staticProps) {
+ if (protoProps)
+ defineProperties(Constructor.prototype, protoProps);
+ if (staticProps)
+ defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+ }();
+ var _dedupe = __webpack_require__("./node_modules/classnames/dedupe.js");
+ var _dedupe2 = _interopRequireDefault(_dedupe);
+ var _defaultAttrs = __webpack_require__("./src/default-attrs.json");
+ var _defaultAttrs2 = _interopRequireDefault(_defaultAttrs);
+ function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+ }
+ function _classCallCheck(instance5, Constructor) {
+ if (!(instance5 instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ }
+ var Icon = function() {
+ function Icon2(name, contents) {
+ var tags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
+ _classCallCheck(this, Icon2);
+ this.name = name;
+ this.contents = contents;
+ this.tags = tags;
+ this.attrs = _extends({}, _defaultAttrs2.default, { class: "feather feather-" + name });
+ }
+ _createClass(Icon2, [{
+ key: "toSvg",
+ value: function toSvg() {
+ var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
+ var combinedAttrs = _extends({}, this.attrs, attrs, { class: (0, _dedupe2.default)(this.attrs.class, attrs.class) });
+ return "";
+ }
+ }, {
+ key: "toString",
+ value: function toString() {
+ return this.contents;
+ }
+ }]);
+ return Icon2;
+ }();
+ function attrsToString(attrs) {
+ return Object.keys(attrs).map(function(key2) {
+ return key2 + '="' + attrs[key2] + '"';
+ }).join(" ");
+ }
+ exports2.default = Icon;
+ },
+ "./src/icons.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", {
+ value: true
+ });
+ var _icon = __webpack_require__("./src/icon.js");
+ var _icon2 = _interopRequireDefault(_icon);
+ var _icons = __webpack_require__("./dist/icons.json");
+ var _icons2 = _interopRequireDefault(_icons);
+ var _tags = __webpack_require__("./src/tags.json");
+ var _tags2 = _interopRequireDefault(_tags);
+ function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+ }
+ exports2.default = Object.keys(_icons2.default).map(function(key2) {
+ return new _icon2.default(key2, _icons2.default[key2], _tags2.default[key2]);
+ }).reduce(function(object, icon) {
+ object[icon.name] = icon;
+ return object;
+ }, {});
+ },
+ "./src/index.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ var _icons = __webpack_require__("./src/icons.js");
+ var _icons2 = _interopRequireDefault(_icons);
+ var _toSvg = __webpack_require__("./src/to-svg.js");
+ var _toSvg2 = _interopRequireDefault(_toSvg);
+ var _replace = __webpack_require__("./src/replace.js");
+ var _replace2 = _interopRequireDefault(_replace);
+ function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+ }
+ module3.exports = { icons: _icons2.default, toSvg: _toSvg2.default, replace: _replace2.default };
+ },
+ "./src/replace.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", {
+ value: true
+ });
+ var _extends = Object.assign || function(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+ for (var key2 in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
+ target[key2] = source[key2];
+ }
+ }
+ }
+ return target;
+ };
+ var _dedupe = __webpack_require__("./node_modules/classnames/dedupe.js");
+ var _dedupe2 = _interopRequireDefault(_dedupe);
+ var _icons = __webpack_require__("./src/icons.js");
+ var _icons2 = _interopRequireDefault(_icons);
+ function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+ }
+ function replace() {
+ var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
+ if (typeof document === "undefined") {
+ throw new Error("`feather.replace()` only works in a browser environment.");
+ }
+ var elementsToReplace = document.querySelectorAll("[data-feather]");
+ Array.from(elementsToReplace).forEach(function(element2) {
+ return replaceElement(element2, attrs);
+ });
+ }
+ function replaceElement(element2) {
+ var attrs = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
+ var elementAttrs = getAttrs(element2);
+ var name = elementAttrs["data-feather"];
+ delete elementAttrs["data-feather"];
+ var svgString = _icons2.default[name].toSvg(_extends({}, attrs, elementAttrs, { class: (0, _dedupe2.default)(attrs.class, elementAttrs.class) }));
+ var svgDocument = new DOMParser().parseFromString(svgString, "image/svg+xml");
+ var svgElement = svgDocument.querySelector("svg");
+ element2.parentNode.replaceChild(svgElement, element2);
+ }
+ function getAttrs(element2) {
+ return Array.from(element2.attributes).reduce(function(attrs, attr2) {
+ attrs[attr2.name] = attr2.value;
+ return attrs;
+ }, {});
+ }
+ exports2.default = replace;
+ },
+ "./src/tags.json": function(module3) {
+ module3.exports = { "activity": ["pulse", "health", "action", "motion"], "airplay": ["stream", "cast", "mirroring"], "alert-circle": ["warning", "alert", "danger"], "alert-octagon": ["warning", "alert", "danger"], "alert-triangle": ["warning", "alert", "danger"], "align-center": ["text alignment", "center"], "align-justify": ["text alignment", "justified"], "align-left": ["text alignment", "left"], "align-right": ["text alignment", "right"], "anchor": [], "archive": ["index", "box"], "at-sign": ["mention", "at", "email", "message"], "award": ["achievement", "badge"], "aperture": ["camera", "photo"], "bar-chart": ["statistics", "diagram", "graph"], "bar-chart-2": ["statistics", "diagram", "graph"], "battery": ["power", "electricity"], "battery-charging": ["power", "electricity"], "bell": ["alarm", "notification", "sound"], "bell-off": ["alarm", "notification", "silent"], "bluetooth": ["wireless"], "book-open": ["read", "library"], "book": ["read", "dictionary", "booklet", "magazine", "library"], "bookmark": ["read", "clip", "marker", "tag"], "box": ["cube"], "briefcase": ["work", "bag", "baggage", "folder"], "calendar": ["date"], "camera": ["photo"], "cast": ["chromecast", "airplay"], "chevron-down": ["expand"], "chevron-up": ["collapse"], "circle": ["off", "zero", "record"], "clipboard": ["copy"], "clock": ["time", "watch", "alarm"], "cloud-drizzle": ["weather", "shower"], "cloud-lightning": ["weather", "bolt"], "cloud-rain": ["weather"], "cloud-snow": ["weather", "blizzard"], "cloud": ["weather"], "codepen": ["logo"], "codesandbox": ["logo"], "code": ["source", "programming"], "coffee": ["drink", "cup", "mug", "tea", "cafe", "hot", "beverage"], "columns": ["layout"], "command": ["keyboard", "cmd", "terminal", "prompt"], "compass": ["navigation", "safari", "travel", "direction"], "copy": ["clone", "duplicate"], "corner-down-left": ["arrow", "return"], "corner-down-right": ["arrow"], "corner-left-down": ["arrow"], "corner-left-up": ["arrow"], "corner-right-down": ["arrow"], "corner-right-up": ["arrow"], "corner-up-left": ["arrow"], "corner-up-right": ["arrow"], "cpu": ["processor", "technology"], "credit-card": ["purchase", "payment", "cc"], "crop": ["photo", "image"], "crosshair": ["aim", "target"], "database": ["storage", "memory"], "delete": ["remove"], "disc": ["album", "cd", "dvd", "music"], "dollar-sign": ["currency", "money", "payment"], "droplet": ["water"], "edit": ["pencil", "change"], "edit-2": ["pencil", "change"], "edit-3": ["pencil", "change"], "eye": ["view", "watch"], "eye-off": ["view", "watch", "hide", "hidden"], "external-link": ["outbound"], "facebook": ["logo", "social"], "fast-forward": ["music"], "figma": ["logo", "design", "tool"], "file-minus": ["delete", "remove", "erase"], "file-plus": ["add", "create", "new"], "file-text": ["data", "txt", "pdf"], "film": ["movie", "video"], "filter": ["funnel", "hopper"], "flag": ["report"], "folder-minus": ["directory"], "folder-plus": ["directory"], "folder": ["directory"], "framer": ["logo", "design", "tool"], "frown": ["emoji", "face", "bad", "sad", "emotion"], "gift": ["present", "box", "birthday", "party"], "git-branch": ["code", "version control"], "git-commit": ["code", "version control"], "git-merge": ["code", "version control"], "git-pull-request": ["code", "version control"], "github": ["logo", "version control"], "gitlab": ["logo", "version control"], "globe": ["world", "browser", "language", "translate"], "hard-drive": ["computer", "server", "memory", "data"], "hash": ["hashtag", "number", "pound"], "headphones": ["music", "audio", "sound"], "heart": ["like", "love", "emotion"], "help-circle": ["question mark"], "hexagon": ["shape", "node.js", "logo"], "home": ["house", "living"], "image": ["picture"], "inbox": ["email"], "instagram": ["logo", "camera"], "key": ["password", "login", "authentication", "secure"], "layers": ["stack"], "layout": ["window", "webpage"], "life-bouy": ["help", "life ring", "support"], "link": ["chain", "url"], "link-2": ["chain", "url"], "linkedin": ["logo", "social media"], "list": ["options"], "lock": ["security", "password", "secure"], "log-in": ["sign in", "arrow", "enter"], "log-out": ["sign out", "arrow", "exit"], "mail": ["email", "message"], "map-pin": ["location", "navigation", "travel", "marker"], "map": ["location", "navigation", "travel"], "maximize": ["fullscreen"], "maximize-2": ["fullscreen", "arrows", "expand"], "meh": ["emoji", "face", "neutral", "emotion"], "menu": ["bars", "navigation", "hamburger"], "message-circle": ["comment", "chat"], "message-square": ["comment", "chat"], "mic-off": ["record", "sound", "mute"], "mic": ["record", "sound", "listen"], "minimize": ["exit fullscreen", "close"], "minimize-2": ["exit fullscreen", "arrows", "close"], "minus": ["subtract"], "monitor": ["tv", "screen", "display"], "moon": ["dark", "night"], "more-horizontal": ["ellipsis"], "more-vertical": ["ellipsis"], "mouse-pointer": ["arrow", "cursor"], "move": ["arrows"], "music": ["note"], "navigation": ["location", "travel"], "navigation-2": ["location", "travel"], "octagon": ["stop"], "package": ["box", "container"], "paperclip": ["attachment"], "pause": ["music", "stop"], "pause-circle": ["music", "audio", "stop"], "pen-tool": ["vector", "drawing"], "percent": ["discount"], "phone-call": ["ring"], "phone-forwarded": ["call"], "phone-incoming": ["call"], "phone-missed": ["call"], "phone-off": ["call", "mute"], "phone-outgoing": ["call"], "phone": ["call"], "play": ["music", "start"], "pie-chart": ["statistics", "diagram"], "play-circle": ["music", "start"], "plus": ["add", "new"], "plus-circle": ["add", "new"], "plus-square": ["add", "new"], "pocket": ["logo", "save"], "power": ["on", "off"], "printer": ["fax", "office", "device"], "radio": ["signal"], "refresh-cw": ["synchronise", "arrows"], "refresh-ccw": ["arrows"], "repeat": ["loop", "arrows"], "rewind": ["music"], "rotate-ccw": ["arrow"], "rotate-cw": ["arrow"], "rss": ["feed", "subscribe"], "save": ["floppy disk"], "scissors": ["cut"], "search": ["find", "magnifier", "magnifying glass"], "send": ["message", "mail", "email", "paper airplane", "paper aeroplane"], "settings": ["cog", "edit", "gear", "preferences"], "share-2": ["network", "connections"], "shield": ["security", "secure"], "shield-off": ["security", "insecure"], "shopping-bag": ["ecommerce", "cart", "purchase", "store"], "shopping-cart": ["ecommerce", "cart", "purchase", "store"], "shuffle": ["music"], "skip-back": ["music"], "skip-forward": ["music"], "slack": ["logo"], "slash": ["ban", "no"], "sliders": ["settings", "controls"], "smartphone": ["cellphone", "device"], "smile": ["emoji", "face", "happy", "good", "emotion"], "speaker": ["audio", "music"], "star": ["bookmark", "favorite", "like"], "stop-circle": ["media", "music"], "sun": ["brightness", "weather", "light"], "sunrise": ["weather", "time", "morning", "day"], "sunset": ["weather", "time", "evening", "night"], "tablet": ["device"], "tag": ["label"], "target": ["logo", "bullseye"], "terminal": ["code", "command line", "prompt"], "thermometer": ["temperature", "celsius", "fahrenheit", "weather"], "thumbs-down": ["dislike", "bad", "emotion"], "thumbs-up": ["like", "good", "emotion"], "toggle-left": ["on", "off", "switch"], "toggle-right": ["on", "off", "switch"], "tool": ["settings", "spanner"], "trash": ["garbage", "delete", "remove", "bin"], "trash-2": ["garbage", "delete", "remove", "bin"], "triangle": ["delta"], "truck": ["delivery", "van", "shipping", "transport", "lorry"], "tv": ["television", "stream"], "twitch": ["logo"], "twitter": ["logo", "social"], "type": ["text"], "umbrella": ["rain", "weather"], "unlock": ["security"], "user-check": ["followed", "subscribed"], "user-minus": ["delete", "remove", "unfollow", "unsubscribe"], "user-plus": ["new", "add", "create", "follow", "subscribe"], "user-x": ["delete", "remove", "unfollow", "unsubscribe", "unavailable"], "user": ["person", "account"], "users": ["group"], "video-off": ["camera", "movie", "film"], "video": ["camera", "movie", "film"], "voicemail": ["phone"], "volume": ["music", "sound", "mute"], "volume-1": ["music", "sound"], "volume-2": ["music", "sound"], "volume-x": ["music", "sound", "mute"], "watch": ["clock", "time"], "wifi-off": ["disabled"], "wifi": ["connection", "signal", "wireless"], "wind": ["weather", "air"], "x-circle": ["cancel", "close", "delete", "remove", "times", "clear"], "x-octagon": ["delete", "stop", "alert", "warning", "times", "clear"], "x-square": ["cancel", "close", "delete", "remove", "times", "clear"], "x": ["cancel", "close", "delete", "remove", "times", "clear"], "youtube": ["logo", "video", "play"], "zap-off": ["flash", "camera", "lightning"], "zap": ["flash", "camera", "lightning"], "zoom-in": ["magnifying glass"], "zoom-out": ["magnifying glass"] };
+ },
+ "./src/to-svg.js": function(module3, exports2, __webpack_require__) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", {
+ value: true
+ });
+ var _icons = __webpack_require__("./src/icons.js");
+ var _icons2 = _interopRequireDefault(_icons);
+ function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+ }
+ function toSvg(name) {
+ var attrs = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
+ console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead.");
+ if (!name) {
+ throw new Error("The required `key` (icon name) parameter is missing.");
+ }
+ if (!_icons2.default[name]) {
+ throw new Error("No icon matching '" + name + "'. See the complete list of icons at https://feathericons.com");
+ }
+ return _icons2.default[name].toSvg(attrs);
+ }
+ exports2.default = toSvg;
+ },
+ 0: function(module3, exports2, __webpack_require__) {
+ __webpack_require__("./node_modules/core-js/es/array/from.js");
+ module3.exports = __webpack_require__("./src/index.js");
+ }
+ });
+ });
+ }
+});
+
+// src/main.ts
+__export(exports, {
+ default: () => ObsidianGit
+});
+var import_obsidian15 = __toModule(require("obsidian"));
+var path2 = __toModule(require("path"));
+
+// src/promiseQueue.ts
+var PromiseQueue = class {
+ constructor() {
+ this.tasks = [];
+ }
+ addTask(task) {
+ this.tasks.push(task);
+ if (this.tasks.length === 1) {
+ this.handleTask();
+ }
+ }
+ handleTask() {
+ return __async(this, null, function* () {
+ if (this.tasks.length > 0) {
+ this.tasks[0]().finally(() => {
+ this.tasks.shift();
+ this.handleTask();
+ });
+ }
+ });
+ }
+};
+
+// src/settings.ts
+var import_obsidian = __toModule(require("obsidian"));
+var ObsidianGitSettingsTab = class extends import_obsidian.PluginSettingTab {
+ display() {
+ let { containerEl } = this;
+ const plugin = this.plugin;
+ containerEl.empty();
+ containerEl.createEl("h2", { text: "Git Backup settings" });
+ containerEl.createEl("br");
+ containerEl.createEl("h3", { text: "Automatic" });
+ const commitOrBackup = plugin.settings.differentIntervalCommitAndPush ? "commit" : "backup";
+ new import_obsidian.Setting(containerEl).setName("Split automatic commit and push").setDesc("Enable to use separate timer for commit and push").addToggle((toggle) => toggle.setValue(plugin.settings.differentIntervalCommitAndPush).onChange((value) => {
+ plugin.settings.differentIntervalCommitAndPush = value;
+ plugin.saveSettings();
+ plugin.clearAutoBackup();
+ plugin.clearAutoPush();
+ if (plugin.settings.autoSaveInterval > 0) {
+ plugin.startAutoBackup(plugin.settings.autoSaveInterval);
+ }
+ if (value && plugin.settings.autoPushInterval > 0) {
+ plugin.startAutoPush(plugin.settings.autoPushInterval);
+ }
+ this.display();
+ }));
+ new import_obsidian.Setting(containerEl).setName(`Vault ${commitOrBackup} interval (minutes)`).setDesc(`${plugin.settings.differentIntervalCommitAndPush ? "Commit" : "Commit and push"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText((text2) => text2.setValue(String(plugin.settings.autoSaveInterval)).onChange((value) => {
+ if (!isNaN(Number(value))) {
+ plugin.settings.autoSaveInterval = Number(value);
+ plugin.saveSettings();
+ if (plugin.settings.autoSaveInterval > 0) {
+ plugin.clearAutoBackup();
+ plugin.startAutoBackup(plugin.settings.autoSaveInterval);
+ new import_obsidian.Notice(`Automatic ${commitOrBackup} enabled! Every ${plugin.settings.autoSaveInterval} minutes.`);
+ } else if (plugin.settings.autoSaveInterval <= 0) {
+ plugin.clearAutoBackup() && new import_obsidian.Notice(`Automatic ${commitOrBackup} disabled!`);
+ }
+ } else {
+ new import_obsidian.Notice("Please specify a valid number.");
+ }
+ }));
+ new import_obsidian.Setting(containerEl).setName(`If turned on, do auto ${commitOrBackup} every X minutes after last change. Prevents auto ${commitOrBackup} while editing a file. If turned off, do auto ${commitOrBackup} every X minutes. It's independent from last change.`).addToggle((toggle) => toggle.setValue(plugin.settings.autoBackupAfterFileChange).onChange((value) => {
+ plugin.settings.autoBackupAfterFileChange = value;
+ plugin.saveSettings();
+ plugin.clearAutoBackup();
+ if (plugin.settings.autoSaveInterval > 0) {
+ plugin.startAutoBackup(plugin.settings.autoSaveInterval);
+ }
+ }));
+ if (plugin.settings.differentIntervalCommitAndPush) {
+ new import_obsidian.Setting(containerEl).setName(`Vault push interval (minutes)`).setDesc("Push changes every X minutes. Set to 0 (default) to disable.").addText((text2) => text2.setValue(String(plugin.settings.autoPushInterval)).onChange((value) => {
+ if (!isNaN(Number(value))) {
+ plugin.settings.autoPushInterval = Number(value);
+ plugin.saveSettings();
+ if (plugin.settings.autoPushInterval > 0) {
+ plugin.clearAutoPush();
+ plugin.startAutoPush(plugin.settings.autoPushInterval);
+ new import_obsidian.Notice(`Automatic push enabled! Every ${plugin.settings.autoPushInterval} minutes.`);
+ } else if (plugin.settings.autoPushInterval <= 0) {
+ plugin.clearAutoPush() && new import_obsidian.Notice("Automatic push disabled!");
+ }
+ } else {
+ new import_obsidian.Notice("Please specify a valid number.");
+ }
+ }));
+ }
+ new import_obsidian.Setting(containerEl).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText((text2) => text2.setValue(String(plugin.settings.autoPullInterval)).onChange((value) => {
+ if (!isNaN(Number(value))) {
+ plugin.settings.autoPullInterval = Number(value);
+ plugin.saveSettings();
+ if (plugin.settings.autoPullInterval > 0) {
+ plugin.clearAutoPull();
+ plugin.startAutoPull(plugin.settings.autoPullInterval);
+ new import_obsidian.Notice(`Automatic pull enabled! Every ${plugin.settings.autoPullInterval} minutes.`);
+ } else if (plugin.settings.autoPullInterval <= 0) {
+ plugin.clearAutoPull() && new import_obsidian.Notice("Automatic pull disabled!");
+ }
+ } else {
+ new import_obsidian.Notice("Please specify a valid number.");
+ }
+ }));
+ new import_obsidian.Setting(containerEl).setName("Commit message on manual backup/commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below) and {{numFiles}} (number of changed files in the commit)").addText((text2) => text2.setPlaceholder("vault backup: {{date}}").setValue(plugin.settings.commitMessage ? plugin.settings.commitMessage : "").onChange((value) => {
+ plugin.settings.commitMessage = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Specify custom commit message on auto backup").setDesc("You will get a pop up to specify your message").addToggle((toggle) => toggle.setValue(plugin.settings.customMessageOnAutoBackup).onChange((value) => {
+ plugin.settings.customMessageOnAutoBackup = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Commit message on auto backup/commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below) and {{numFiles}} (number of changed files in the commit)").addText((text2) => text2.setPlaceholder("vault backup: {{date}}").setValue(plugin.settings.autoCommitMessage).onChange((value) => {
+ plugin.settings.autoCommitMessage = value;
+ plugin.saveSettings();
+ }));
+ containerEl.createEl("br");
+ containerEl.createEl("h3", { text: "Commit message" });
+ new import_obsidian.Setting(containerEl).setName("{{date}} placeholder format").setDesc('Specify custom date format. E.g. "YYYY-MM-DD HH:mm:ss"').addText((text2) => text2.setPlaceholder(plugin.settings.commitDateFormat).setValue(plugin.settings.commitDateFormat).onChange((value) => __async(this, null, function* () {
+ plugin.settings.commitDateFormat = value;
+ yield plugin.saveSettings();
+ })));
+ new import_obsidian.Setting(containerEl).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText((text2) => text2.setValue(localStorage.getItem(plugin.manifest.id + ":hostname")).onChange((value) => __async(this, null, function* () {
+ localStorage.setItem(plugin.manifest.id + ":hostname", value);
+ })));
+ new import_obsidian.Setting(containerEl).setName("Preview commit message").addButton((button) => button.setButtonText("Preview").onClick(() => __async(this, null, function* () {
+ let commitMessagePreview = yield plugin.gitManager.formatCommitMessage(plugin.settings.commitMessage);
+ new import_obsidian.Notice(`${commitMessagePreview}`);
+ })));
+ new import_obsidian.Setting(containerEl).setName("List filenames affected by commit in the commit body").addToggle((toggle) => toggle.setValue(plugin.settings.listChangedFilesInMessageBody).onChange((value) => {
+ plugin.settings.listChangedFilesInMessageBody = value;
+ plugin.saveSettings();
+ }));
+ containerEl.createEl("br");
+ containerEl.createEl("h3", { text: "Backup" });
+ new import_obsidian.Setting(containerEl).setName("Sync Method").setDesc("Selects the method used for handling new changes found in your remote git repository.").addDropdown((dropdown) => {
+ const options = {
+ "merge": "Merge",
+ "rebase": "Rebase",
+ "reset": "Other sync service (Only updates the HEAD without touching the working directory)"
+ };
+ dropdown.addOptions(options);
+ dropdown.setValue(plugin.settings.syncMethod);
+ dropdown.onChange((option) => __async(this, null, function* () {
+ plugin.settings.syncMethod = option;
+ plugin.saveSettings();
+ }));
+ });
+ new import_obsidian.Setting(containerEl).setName("Pull updates on startup").setDesc("Automatically pull updates when Obsidian starts").addToggle((toggle) => toggle.setValue(plugin.settings.autoPullOnBoot).onChange((value) => {
+ plugin.settings.autoPullOnBoot = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Push on backup").setDesc("Disable to only commit changes").addToggle((toggle) => toggle.setValue(!plugin.settings.disablePush).onChange((value) => {
+ plugin.settings.disablePush = !value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Pull changes before push").setDesc("Commit -> pull -> push (Only if pushing is enabled)").addToggle((toggle) => toggle.setValue(plugin.settings.pullBeforePush).onChange((value) => {
+ plugin.settings.pullBeforePush = value;
+ plugin.saveSettings();
+ }));
+ containerEl.createEl("br");
+ containerEl.createEl("h3", { text: "Miscellaneous" });
+ new import_obsidian.Setting(containerEl).setName("Current branch").setDesc("Switch to a different branch").addDropdown((dropdown) => __async(this, null, function* () {
+ const branchInfo = yield plugin.gitManager.branchInfo();
+ for (const branch of branchInfo.branches) {
+ dropdown.addOption(branch, branch);
+ }
+ dropdown.setValue(branchInfo.current);
+ dropdown.onChange((option) => __async(this, null, function* () {
+ yield plugin.gitManager.checkout(option);
+ new import_obsidian.Notice(`Checked out to ${option}`);
+ }));
+ }));
+ new import_obsidian.Setting(containerEl).setName("Automatically refresh Source Control View on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option").addToggle((toggle) => toggle.setValue(plugin.settings.refreshSourceControl).onChange((value) => {
+ plugin.settings.refreshSourceControl = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates)").addToggle((toggle) => toggle.setValue(plugin.settings.disablePopups).onChange((value) => {
+ plugin.settings.disablePopups = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect").addToggle((toggle) => toggle.setValue(plugin.settings.showStatusBar).onChange((value) => {
+ plugin.settings.showStatusBar = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Show changes files count in status bar").addToggle((toggle) => toggle.setValue(plugin.settings.changedFilesInStatusBar).onChange((value) => {
+ plugin.settings.changedFilesInStatusBar = value;
+ plugin.saveSettings();
+ }));
+ containerEl.createEl("br");
+ containerEl.createEl("h3", { text: "Advanced" });
+ new import_obsidian.Setting(containerEl).setName("Update submodules").setDesc('"Create backup" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule').addToggle((toggle) => toggle.setValue(plugin.settings.updateSubmodules).onChange((value) => {
+ plugin.settings.updateSubmodules = value;
+ plugin.saveSettings();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Custom Git binary path").addText((cb) => {
+ cb.setValue(plugin.settings.gitPath);
+ cb.setPlaceholder("git");
+ cb.onChange((value) => {
+ plugin.settings.gitPath = value;
+ plugin.saveSettings();
+ plugin.gitManager.updateGitPath(value || "git");
+ });
+ });
+ new import_obsidian.Setting(containerEl).setName("Custom base path (Git repository path)").setDesc(`
+ Sets the relative path to the vault from which the Git binary should be executed.
+ Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
+ `).addText((cb) => {
+ cb.setValue(plugin.settings.basePath);
+ cb.setPlaceholder("directory/directory-with-git-repo");
+ cb.onChange((value) => {
+ plugin.settings.basePath = value;
+ plugin.saveSettings();
+ plugin.gitManager.updateBasePath(value || "");
+ });
+ });
+ const info = containerEl.createDiv();
+ info.setAttr("align", "center");
+ info.setText("Debugging and logging:\nYou can always see the logs of this and every other plugin by opening the console with");
+ const keys = containerEl.createDiv();
+ keys.setAttr("align", "center");
+ keys.addClass("obsidian-git-shortcuts");
+ if (import_obsidian.Platform.isMacOS === true) {
+ keys.createEl("kbd", { text: "CMD (\u2318) + OPTION (\u2325) + I" });
+ } else {
+ keys.createEl("kbd", { text: "CTRL + SHIFT + I" });
+ }
+ }
+};
+
+// src/statusBar.ts
+var import_obsidian2 = __toModule(require("obsidian"));
+
+// src/types.ts
+var PluginState;
+(function(PluginState2) {
+ PluginState2[PluginState2["idle"] = 0] = "idle";
+ PluginState2[PluginState2["status"] = 1] = "status";
+ PluginState2[PluginState2["pull"] = 2] = "pull";
+ PluginState2[PluginState2["add"] = 3] = "add";
+ PluginState2[PluginState2["commit"] = 4] = "commit";
+ PluginState2[PluginState2["push"] = 5] = "push";
+ PluginState2[PluginState2["conflicted"] = 6] = "conflicted";
+})(PluginState || (PluginState = {}));
+
+// src/statusBar.ts
+var StatusBar = class {
+ constructor(statusBarEl, plugin) {
+ this.statusBarEl = statusBarEl;
+ this.plugin = plugin;
+ this.messages = [];
+ this.base = "obsidian-git-statusbar-";
+ this.statusBarEl.setAttribute("aria-label-position", "top");
+ }
+ displayMessage(message, timeout) {
+ this.messages.push({
+ message: `Git: ${message.slice(0, 100)}`,
+ timeout
+ });
+ this.display();
+ }
+ display() {
+ if (this.messages.length > 0 && !this.currentMessage) {
+ this.currentMessage = this.messages.shift();
+ this.statusBarEl.addClass(this.base + "message");
+ this.statusBarEl.ariaLabel = "";
+ this.statusBarEl.setText(this.currentMessage.message);
+ this.lastMessageTimestamp = Date.now();
+ } else if (this.currentMessage) {
+ const messageAge = Date.now() - this.lastMessageTimestamp;
+ if (messageAge >= this.currentMessage.timeout) {
+ this.currentMessage = null;
+ this.lastMessageTimestamp = null;
+ }
+ } else {
+ this.displayState();
+ }
+ }
+ displayState() {
+ if (this.statusBarEl.getText().length > 3 || !this.statusBarEl.hasChildNodes()) {
+ this.statusBarEl.empty();
+ this.iconEl = this.statusBarEl.createDiv();
+ this.textEl = this.statusBarEl.createDiv();
+ this.textEl.style.float = "right";
+ this.textEl.style.marginLeft = "5px";
+ this.iconEl.style.float = "left";
+ }
+ switch (this.plugin.state) {
+ case PluginState.idle:
+ this.displayFromNow(this.plugin.lastUpdate);
+ break;
+ case PluginState.status:
+ this.statusBarEl.ariaLabel = "Checking repository status...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "refresh-cw");
+ this.statusBarEl.addClass(this.base + "status");
+ break;
+ case PluginState.add:
+ this.statusBarEl.ariaLabel = "Adding files...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "refresh-w");
+ this.statusBarEl.addClass(this.base + "add");
+ break;
+ case PluginState.commit:
+ this.statusBarEl.ariaLabel = "Committing changes...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "git-commit");
+ this.statusBarEl.addClass(this.base + "commit");
+ break;
+ case PluginState.push:
+ this.statusBarEl.ariaLabel = "Pushing changes...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "upload");
+ this.statusBarEl.addClass(this.base + "push");
+ break;
+ case PluginState.pull:
+ this.statusBarEl.ariaLabel = "Pulling changes...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "download");
+ this.statusBarEl.addClass(this.base + "pull");
+ break;
+ case PluginState.conflicted:
+ this.statusBarEl.ariaLabel = "You have conflict files...";
+ (0, import_obsidian2.setIcon)(this.iconEl, "alert-circle");
+ this.statusBarEl.addClass(this.base + "conflict");
+ break;
+ default:
+ this.statusBarEl.ariaLabel = "Failed on initialization!";
+ (0, import_obsidian2.setIcon)(this.iconEl, "alert-triangle");
+ this.statusBarEl.addClass(this.base + "failed-init");
+ break;
+ }
+ }
+ displayFromNow(timestamp) {
+ if (timestamp) {
+ const moment = window.moment;
+ const fromNow = moment(timestamp).fromNow();
+ this.statusBarEl.ariaLabel = `${this.plugin.offlineMode ? "Offline: " : ""}Last Git update: ${fromNow}`;
+ } else {
+ this.statusBarEl.ariaLabel = this.plugin.offlineMode ? "Git is offline" : "Git is ready";
+ }
+ if (this.plugin.offlineMode) {
+ (0, import_obsidian2.setIcon)(this.iconEl, "globe");
+ } else {
+ (0, import_obsidian2.setIcon)(this.iconEl, "check");
+ }
+ if (this.plugin.settings.changedFilesInStatusBar && this.plugin.cachedStatus) {
+ this.textEl.setText(this.plugin.cachedStatus.changed.length.toString());
+ }
+ this.statusBarEl.addClass(this.base + "idle");
+ }
+};
+
+// src/ui/modals/changedFilesModal.ts
+var import_obsidian3 = __toModule(require("obsidian"));
+var ChangedFilesModal = class extends import_obsidian3.FuzzySuggestModal {
+ constructor(plugin, changedFiles) {
+ super(plugin.app);
+ this.plugin = plugin;
+ this.changedFiles = changedFiles;
+ this.setPlaceholder("Not supported files will be opened by default app!");
+ }
+ getItems() {
+ return this.changedFiles;
+ }
+ getItemText(item) {
+ if (item.index == "?" && item.working_dir == "U") {
+ return `Untracked | ${item.vault_path}`;
+ }
+ let working_dir = "";
+ let index = "";
+ if (item.working_dir != " ")
+ working_dir = `Working dir: ${item.working_dir} `;
+ if (item.index != " ")
+ index = `Index: ${item.index}`;
+ return `${working_dir}${index} | ${item.vault_path}`;
+ }
+ onChooseItem(item, _) {
+ if (this.plugin.app.metadataCache.getFirstLinkpathDest(item.vault_path, "") == null) {
+ this.app.openWithDefaultApp(item.vault_path);
+ } else {
+ this.plugin.app.workspace.openLinkText(item.vault_path, "/");
+ }
+ }
+};
+
+// src/ui/modals/customMessageModal.ts
+var import_obsidian4 = __toModule(require("obsidian"));
+var CustomMessageModal = class extends import_obsidian4.SuggestModal {
+ constructor(plugin, fromAutoBackup) {
+ super(plugin.app);
+ this.fromAutoBackup = fromAutoBackup;
+ this.resolve = null;
+ this.plugin = plugin;
+ this.setPlaceholder("Type your message and select optional the version with the added date.");
+ }
+ open() {
+ super.open();
+ return new Promise((resolve) => {
+ this.resolve = resolve;
+ });
+ }
+ onClose() {
+ if (this.resolve)
+ this.resolve(void 0);
+ }
+ selectSuggestion(value, evt) {
+ if (this.resolve)
+ this.resolve(value);
+ super.selectSuggestion(value, evt);
+ }
+ getSuggestions(query) {
+ const date = window.moment().format(this.plugin.settings.commitDateFormat);
+ if (query == "")
+ query = "...";
+ return [query, `${date}: ${query}`, `${query}: ${date}`];
+ }
+ renderSuggestion(value, el) {
+ el.innerText = value;
+ }
+ onChooseSuggestion(item, _) {
+ }
+};
+
+// src/constants.ts
+var DEFAULT_SETTINGS = {
+ commitMessage: "vault backup: {{date}}",
+ autoCommitMessage: void 0,
+ commitDateFormat: "YYYY-MM-DD HH:mm:ss",
+ autoSaveInterval: 0,
+ autoPushInterval: 0,
+ autoPullInterval: 0,
+ autoPullOnBoot: false,
+ disablePush: false,
+ pullBeforePush: true,
+ disablePopups: false,
+ listChangedFilesInMessageBody: false,
+ showStatusBar: true,
+ updateSubmodules: false,
+ syncMethod: "merge",
+ gitPath: "",
+ customMessageOnAutoBackup: false,
+ autoBackupAfterFileChange: false,
+ treeStructure: false,
+ refreshSourceControl: true,
+ basePath: "",
+ differentIntervalCommitAndPush: false,
+ changedFilesInStatusBar: false
+};
+var GIT_VIEW_CONFIG = {
+ type: "git-view",
+ name: "Source Control",
+ icon: "git-pull-request"
+};
+var DIFF_VIEW_CONFIG = {
+ type: "diff-view",
+ name: "Diff View",
+ icon: "git-pull-request"
+};
+
+// src/openInGitHub.ts
+var import_electron = __toModule(require("electron"));
+var import_obsidian5 = __toModule(require("obsidian"));
+function openLineInGitHub(editor, file, manager) {
+ return __async(this, null, function* () {
+ const { isGitHub, branch, repo, user } = yield getData(manager);
+ if (isGitHub) {
+ const from = editor.getCursor("from").line + 1;
+ const to = editor.getCursor("to").line + 1;
+ if (from === to) {
+ yield import_electron.shell.openExternal(`https://github.com/${user}/${repo}/blob/${branch}/${file.path}?plain=1#L${from}`);
+ } else {
+ yield import_electron.shell.openExternal(`https://github.com/${user}/${repo}/blob/${branch}/${file.path}?plain=1#L${from}-L${to}`);
+ }
+ } else {
+ new import_obsidian5.Notice("It seems like you are not using GitHub");
+ }
+ });
+}
+function openHistoryInGitHub(file, manager) {
+ return __async(this, null, function* () {
+ const { isGitHub, branch, repo, user } = yield getData(manager);
+ if (isGitHub) {
+ yield import_electron.shell.openExternal(`https://github.com/${user}/${repo}/commits/${branch}/${file.path}`);
+ } else {
+ new import_obsidian5.Notice("It seems like you are not using GitHub");
+ }
+ });
+}
+function getData(manager) {
+ return __async(this, null, function* () {
+ const branchInfo = yield manager.branchInfo();
+ const remoteBranch = branchInfo.tracking;
+ const branch = branchInfo.current;
+ const remote = remoteBranch.substring(0, remoteBranch.indexOf("/"));
+ const remoteUrl = yield manager.getConfig(`remote.${remote}.url`);
+ const [isGitHub, httpsUser, httpsRepo, sshUser, sshRepo] = remoteUrl.match(/(?:^https:\/\/github\.com\/(.*)\/(.*)\.git$)|(?:^git@github\.com:(.*)\/(.*)\.git$)/);
+ return {
+ isGitHub: !!isGitHub,
+ repo: httpsRepo || sshRepo,
+ user: httpsUser || sshUser,
+ branch
+ };
+ });
+}
+
+// src/simpleGit.ts
+var import_child_process2 = __toModule(require("child_process"));
+var import_obsidian6 = __toModule(require("obsidian"));
+var path = __toModule(require("path"));
+var import_path = __toModule(require("path"));
+
+// node_modules/simple-git/dist/esm/index.js
+var import_file_exists = __toModule(require_dist());
+var import_debug = __toModule(require_src());
+var import_child_process = __toModule(require("child_process"));
+var import_promise_deferred = __toModule(require_dist2());
+var import_promise_deferred2 = __toModule(require_dist2());
+var __defProp2 = Object.defineProperty;
+var __defProps2 = Object.defineProperties;
+var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
+var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
+var __getOwnPropNames2 = Object.getOwnPropertyNames;
+var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
+var __hasOwnProp2 = Object.prototype.hasOwnProperty;
+var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
+var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
+var __spreadValues2 = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp2.call(b, prop))
+ __defNormalProp2(a, prop, b[prop]);
+ if (__getOwnPropSymbols2)
+ for (var prop of __getOwnPropSymbols2(b)) {
+ if (__propIsEnum2.call(b, prop))
+ __defNormalProp2(a, prop, b[prop]);
+ }
+ return a;
+};
+var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
+var __markAsModule2 = (target) => __defProp2(target, "__esModule", { value: true });
+var __esm = (fn, res) => function __init() {
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
+};
+var __commonJS2 = (cb, mod) => function __require() {
+ return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __export2 = (target, all) => {
+ for (var name in all)
+ __defProp2(target, name, { get: all[name], enumerable: true });
+};
+var __reExport2 = (target, module2, copyDefault, desc) => {
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
+ for (let key2 of __getOwnPropNames2(module2))
+ if (!__hasOwnProp2.call(target, key2) && (copyDefault || key2 !== "default"))
+ __defProp2(target, key2, { get: () => module2[key2], enumerable: !(desc = __getOwnPropDesc2(module2, key2)) || desc.enumerable });
+ }
+ return target;
+};
+var __toCommonJS = /* @__PURE__ */ ((cache) => {
+ return (module2, temp) => {
+ return cache && cache.get(module2) || (temp = __reExport2(__markAsModule2({}), module2, 1), cache && cache.set(module2, temp), temp);
+ };
+})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
+var __async2 = (__this, __arguments, generator) => {
+ return new Promise((resolve, reject) => {
+ var fulfilled = (value) => {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var rejected = (value) => {
+ try {
+ step(generator.throw(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
+ step((generator = generator.apply(__this, __arguments)).next());
+ });
+};
+var GitError;
+var init_git_error = __esm({
+ "src/lib/errors/git-error.ts"() {
+ GitError = class extends Error {
+ constructor(task, message) {
+ super(message);
+ this.task = task;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+ };
+ }
+});
+var GitResponseError;
+var init_git_response_error = __esm({
+ "src/lib/errors/git-response-error.ts"() {
+ init_git_error();
+ GitResponseError = class extends GitError {
+ constructor(git, message) {
+ super(void 0, message || String(git));
+ this.git = git;
+ }
+ };
+ }
+});
+var TaskConfigurationError;
+var init_task_configuration_error = __esm({
+ "src/lib/errors/task-configuration-error.ts"() {
+ init_git_error();
+ TaskConfigurationError = class extends GitError {
+ constructor(message) {
+ super(void 0, message);
+ }
+ };
+ }
+});
+function asFunction(source) {
+ return typeof source === "function" ? source : NOOP;
+}
+function isUserFunction(source) {
+ return typeof source === "function" && source !== NOOP;
+}
+function splitOn(input, char) {
+ const index = input.indexOf(char);
+ if (index <= 0) {
+ return [input, ""];
+ }
+ return [
+ input.substr(0, index),
+ input.substr(index + 1)
+ ];
+}
+function first(input, offset = 0) {
+ return isArrayLike(input) && input.length > offset ? input[offset] : void 0;
+}
+function last(input, offset = 0) {
+ if (isArrayLike(input) && input.length > offset) {
+ return input[input.length - 1 - offset];
+ }
+}
+function isArrayLike(input) {
+ return !!(input && typeof input.length === "number");
+}
+function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
+ return input.split(separator).reduce((output, line) => {
+ const lineContent = trimmed2 ? line.trim() : line;
+ if (lineContent) {
+ output.push(lineContent);
+ }
+ return output;
+ }, []);
+}
+function forEachLineWithContent(input, callback) {
+ return toLinesWithContent(input, true).map((line) => callback(line));
+}
+function folderExists(path3) {
+ return (0, import_file_exists.exists)(path3, import_file_exists.FOLDER);
+}
+function append(target, item) {
+ if (Array.isArray(target)) {
+ if (!target.includes(item)) {
+ target.push(item);
+ }
+ } else {
+ target.add(item);
+ }
+ return item;
+}
+function including(target, item) {
+ if (Array.isArray(target) && !target.includes(item)) {
+ target.push(item);
+ }
+ return target;
+}
+function remove(target, item) {
+ if (Array.isArray(target)) {
+ const index = target.indexOf(item);
+ if (index >= 0) {
+ target.splice(index, 1);
+ }
+ } else {
+ target.delete(item);
+ }
+ return item;
+}
+function asArray(source) {
+ return Array.isArray(source) ? source : [source];
+}
+function asStringArray(source) {
+ return asArray(source).map(String);
+}
+function asNumber(source, onNaN = 0) {
+ if (source == null) {
+ return onNaN;
+ }
+ const num = parseInt(source, 10);
+ return isNaN(num) ? onNaN : num;
+}
+function prefixedArray(input, prefix) {
+ const output = [];
+ for (let i = 0, max = input.length; i < max; i++) {
+ output.push(prefix, input[i]);
+ }
+ return output;
+}
+function bufferToString(input) {
+ return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
+}
+function pick(source, properties) {
+ return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {}));
+}
+function delay(duration = 0) {
+ return new Promise((done) => setTimeout(done, duration));
+}
+var NULL;
+var NOOP;
+var objectToString;
+var init_util = __esm({
+ "src/lib/utils/util.ts"() {
+ NULL = "\0";
+ NOOP = () => {
+ };
+ objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
+ }
+});
+function filterType(input, filter, def) {
+ if (filter(input)) {
+ return input;
+ }
+ return arguments.length > 2 ? def : void 0;
+}
+function filterPrimitives(input, omit) {
+ return /number|string|boolean/.test(typeof input) && (!omit || !omit.includes(typeof input));
+}
+function filterPlainObject(input) {
+ return !!input && objectToString(input) === "[object Object]";
+}
+function filterFunction(input) {
+ return typeof input === "function";
+}
+var filterArray;
+var filterString;
+var filterStringArray;
+var filterStringOrStringArray;
+var filterHasLength;
+var init_argument_filters = __esm({
+ "src/lib/utils/argument-filters.ts"() {
+ init_util();
+ filterArray = (input) => {
+ return Array.isArray(input);
+ };
+ filterString = (input) => {
+ return typeof input === "string";
+ };
+ filterStringArray = (input) => {
+ return Array.isArray(input) && input.every(filterString);
+ };
+ filterStringOrStringArray = (input) => {
+ return filterString(input) || Array.isArray(input) && input.every(filterString);
+ };
+ filterHasLength = (input) => {
+ if (input == null || "number|boolean|function".includes(typeof input)) {
+ return false;
+ }
+ return Array.isArray(input) || typeof input === "string" || typeof input.length === "number";
+ };
+ }
+});
+var ExitCodes;
+var init_exit_codes = __esm({
+ "src/lib/utils/exit-codes.ts"() {
+ ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
+ ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
+ ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
+ ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
+ return ExitCodes2;
+ })(ExitCodes || {});
+ }
+});
+var GitOutputStreams;
+var init_git_output_streams = __esm({
+ "src/lib/utils/git-output-streams.ts"() {
+ GitOutputStreams = class {
+ constructor(stdOut, stdErr) {
+ this.stdOut = stdOut;
+ this.stdErr = stdErr;
+ }
+ asStrings() {
+ return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
+ }
+ };
+ }
+});
+var LineParser;
+var RemoteLineParser;
+var init_line_parser = __esm({
+ "src/lib/utils/line-parser.ts"() {
+ LineParser = class {
+ constructor(regExp, useMatches) {
+ this.matches = [];
+ this.parse = (line, target) => {
+ this.resetMatches();
+ if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
+ return false;
+ }
+ return this.useMatches(target, this.prepareMatches()) !== false;
+ };
+ this._regExp = Array.isArray(regExp) ? regExp : [regExp];
+ if (useMatches) {
+ this.useMatches = useMatches;
+ }
+ }
+ useMatches(target, match) {
+ throw new Error(`LineParser:useMatches not implemented`);
+ }
+ resetMatches() {
+ this.matches.length = 0;
+ }
+ prepareMatches() {
+ return this.matches;
+ }
+ addMatch(reg, index, line) {
+ const matched = line && reg.exec(line);
+ if (matched) {
+ this.pushMatch(index, matched);
+ }
+ return !!matched;
+ }
+ pushMatch(_index, matched) {
+ this.matches.push(...matched.slice(1));
+ }
+ };
+ RemoteLineParser = class extends LineParser {
+ addMatch(reg, index, line) {
+ return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
+ }
+ pushMatch(index, matched) {
+ if (index > 0 || matched.length > 1) {
+ super.pushMatch(index, matched);
+ }
+ }
+ };
+ }
+});
+function createInstanceConfig(...options) {
+ const baseDir = process.cwd();
+ const config = Object.assign(__spreadValues2({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o));
+ config.baseDir = config.baseDir || baseDir;
+ return config;
+}
+var defaultOptions;
+var init_simple_git_options = __esm({
+ "src/lib/utils/simple-git-options.ts"() {
+ defaultOptions = {
+ binary: "git",
+ maxConcurrentProcesses: 5,
+ config: []
+ };
+ }
+});
+function appendTaskOptions(options, commands = []) {
+ if (!filterPlainObject(options)) {
+ return commands;
+ }
+ return Object.keys(options).reduce((commands2, key2) => {
+ const value = options[key2];
+ if (filterPrimitives(value, ["boolean"])) {
+ commands2.push(key2 + "=" + value);
+ } else {
+ commands2.push(key2);
+ }
+ return commands2;
+ }, commands);
+}
+function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
+ const command = [];
+ for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {
+ if ("string|number".includes(typeof args[i])) {
+ command.push(String(args[i]));
+ }
+ }
+ appendTaskOptions(trailingOptionsArgument(args), command);
+ if (!objectOnly) {
+ command.push(...trailingArrayArgument(args));
+ }
+ return command;
+}
+function trailingArrayArgument(args) {
+ const hasTrailingCallback = typeof last(args) === "function";
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);
+}
+function trailingOptionsArgument(args) {
+ const hasTrailingCallback = filterFunction(last(args));
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);
+}
+function trailingFunctionArgument(args, includeNoop = true) {
+ const callback = asFunction(last(args));
+ return includeNoop || isUserFunction(callback) ? callback : void 0;
+}
+var init_task_options = __esm({
+ "src/lib/utils/task-options.ts"() {
+ init_argument_filters();
+ init_util();
+ }
+});
+function callTaskParser(parser3, streams) {
+ return parser3(streams.stdOut, streams.stdErr);
+}
+function parseStringResponse(result, parsers11, ...texts) {
+ texts.forEach((text2) => {
+ for (let lines = toLinesWithContent(text2), i = 0, max = lines.length; i < max; i++) {
+ const line = (offset = 0) => {
+ if (i + offset >= max) {
+ return;
+ }
+ return lines[i + offset];
+ };
+ parsers11.some(({ parse }) => parse(line, result));
+ }
+ });
+ return result;
+}
+var init_task_parser = __esm({
+ "src/lib/utils/task-parser.ts"() {
+ init_util();
+ }
+});
+var utils_exports = {};
+__export2(utils_exports, {
+ ExitCodes: () => ExitCodes,
+ GitOutputStreams: () => GitOutputStreams,
+ LineParser: () => LineParser,
+ NOOP: () => NOOP,
+ NULL: () => NULL,
+ RemoteLineParser: () => RemoteLineParser,
+ append: () => append,
+ appendTaskOptions: () => appendTaskOptions,
+ asArray: () => asArray,
+ asFunction: () => asFunction,
+ asNumber: () => asNumber,
+ asStringArray: () => asStringArray,
+ bufferToString: () => bufferToString,
+ callTaskParser: () => callTaskParser,
+ createInstanceConfig: () => createInstanceConfig,
+ delay: () => delay,
+ filterArray: () => filterArray,
+ filterFunction: () => filterFunction,
+ filterHasLength: () => filterHasLength,
+ filterPlainObject: () => filterPlainObject,
+ filterPrimitives: () => filterPrimitives,
+ filterString: () => filterString,
+ filterStringArray: () => filterStringArray,
+ filterStringOrStringArray: () => filterStringOrStringArray,
+ filterType: () => filterType,
+ first: () => first,
+ folderExists: () => folderExists,
+ forEachLineWithContent: () => forEachLineWithContent,
+ getTrailingOptions: () => getTrailingOptions,
+ including: () => including,
+ isUserFunction: () => isUserFunction,
+ last: () => last,
+ objectToString: () => objectToString,
+ parseStringResponse: () => parseStringResponse,
+ pick: () => pick,
+ prefixedArray: () => prefixedArray,
+ remove: () => remove,
+ splitOn: () => splitOn,
+ toLinesWithContent: () => toLinesWithContent,
+ trailingFunctionArgument: () => trailingFunctionArgument,
+ trailingOptionsArgument: () => trailingOptionsArgument
+});
+var init_utils = __esm({
+ "src/lib/utils/index.ts"() {
+ init_argument_filters();
+ init_exit_codes();
+ init_git_output_streams();
+ init_line_parser();
+ init_simple_git_options();
+ init_task_options();
+ init_task_parser();
+ init_util();
+ }
+});
+var check_is_repo_exports = {};
+__export2(check_is_repo_exports, {
+ CheckRepoActions: () => CheckRepoActions,
+ checkIsBareRepoTask: () => checkIsBareRepoTask,
+ checkIsRepoRootTask: () => checkIsRepoRootTask,
+ checkIsRepoTask: () => checkIsRepoTask
+});
+function checkIsRepoTask(action) {
+ switch (action) {
+ case "bare":
+ return checkIsBareRepoTask();
+ case "root":
+ return checkIsRepoRootTask();
+ }
+ const commands = ["rev-parse", "--is-inside-work-tree"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function checkIsRepoRootTask() {
+ const commands = ["rev-parse", "--git-dir"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser(path3) {
+ return /^\.(git)?$/.test(path3.trim());
+ }
+ };
+}
+function checkIsBareRepoTask() {
+ const commands = ["rev-parse", "--is-bare-repository"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function isNotRepoMessage(error) {
+ return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
+}
+var CheckRepoActions;
+var onError;
+var parser;
+var init_check_is_repo = __esm({
+ "src/lib/tasks/check-is-repo.ts"() {
+ init_utils();
+ CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
+ CheckRepoActions2["BARE"] = "bare";
+ CheckRepoActions2["IN_TREE"] = "tree";
+ CheckRepoActions2["IS_REPO_ROOT"] = "root";
+ return CheckRepoActions2;
+ })(CheckRepoActions || {});
+ onError = ({ exitCode }, error, done, fail) => {
+ if (exitCode === 128 && isNotRepoMessage(error)) {
+ return done(Buffer.from("false"));
+ }
+ fail(error);
+ };
+ parser = (text2) => {
+ return text2.trim() === "true";
+ };
+ }
+});
+function cleanSummaryParser(dryRun, text2) {
+ const summary = new CleanResponse(dryRun);
+ const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
+ toLinesWithContent(text2).forEach((line) => {
+ const removed = line.replace(regexp, "");
+ summary.paths.push(removed);
+ (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
+ });
+ return summary;
+}
+var CleanResponse;
+var removalRegexp;
+var dryRunRemovalRegexp;
+var isFolderRegexp;
+var init_CleanSummary = __esm({
+ "src/lib/responses/CleanSummary.ts"() {
+ init_utils();
+ CleanResponse = class {
+ constructor(dryRun) {
+ this.dryRun = dryRun;
+ this.paths = [];
+ this.files = [];
+ this.folders = [];
+ }
+ };
+ removalRegexp = /^[a-z]+\s*/i;
+ dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
+ isFolderRegexp = /\/$/;
+ }
+});
+var task_exports = {};
+__export2(task_exports, {
+ EMPTY_COMMANDS: () => EMPTY_COMMANDS,
+ adhocExecTask: () => adhocExecTask,
+ configurationErrorTask: () => configurationErrorTask,
+ isBufferTask: () => isBufferTask,
+ isEmptyTask: () => isEmptyTask,
+ straightThroughBufferTask: () => straightThroughBufferTask,
+ straightThroughStringTask: () => straightThroughStringTask
+});
+function adhocExecTask(parser3) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser: parser3
+ };
+}
+function configurationErrorTask(error) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser() {
+ throw typeof error === "string" ? new TaskConfigurationError(error) : error;
+ }
+ };
+}
+function straightThroughStringTask(commands, trimmed2 = false) {
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return trimmed2 ? String(text2).trim() : text2;
+ }
+ };
+}
+function straightThroughBufferTask(commands) {
+ return {
+ commands,
+ format: "buffer",
+ parser(buffer) {
+ return buffer;
+ }
+ };
+}
+function isBufferTask(task) {
+ return task.format === "buffer";
+}
+function isEmptyTask(task) {
+ return task.format === "empty" || !task.commands.length;
+}
+var EMPTY_COMMANDS;
+var init_task = __esm({
+ "src/lib/tasks/task.ts"() {
+ init_task_configuration_error();
+ EMPTY_COMMANDS = [];
+ }
+});
+var clean_exports = {};
+__export2(clean_exports, {
+ CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
+ CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
+ CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
+ CleanOptions: () => CleanOptions,
+ cleanTask: () => cleanTask,
+ cleanWithOptionsTask: () => cleanWithOptionsTask,
+ isCleanOptionsArray: () => isCleanOptionsArray
+});
+function cleanWithOptionsTask(mode, customArgs) {
+ const { cleanMode, options, valid } = getCleanOptions(mode);
+ if (!cleanMode) {
+ return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
+ }
+ if (!valid.options) {
+ return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
+ }
+ options.push(...customArgs);
+ if (options.some(isInteractiveMode)) {
+ return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
+ }
+ return cleanTask(cleanMode, options);
+}
+function cleanTask(mode, customArgs) {
+ const commands = ["clean", `-${mode}`, ...customArgs];
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return cleanSummaryParser(mode === "n", text2);
+ }
+ };
+}
+function isCleanOptionsArray(input) {
+ return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
+}
+function getCleanOptions(input) {
+ let cleanMode;
+ let options = [];
+ let valid = { cleanMode: false, options: true };
+ input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
+ if (isCleanMode(char)) {
+ cleanMode = char;
+ valid.cleanMode = true;
+ } else {
+ valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
+ }
+ });
+ return {
+ cleanMode,
+ options,
+ valid
+ };
+}
+function isCleanMode(cleanMode) {
+ return cleanMode === "f" || cleanMode === "n";
+}
+function isKnownOption(option) {
+ return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
+}
+function isInteractiveMode(option) {
+ if (/^-[^\-]/.test(option)) {
+ return option.indexOf("i") > 0;
+ }
+ return option === "--interactive";
+}
+var CONFIG_ERROR_INTERACTIVE_MODE;
+var CONFIG_ERROR_MODE_REQUIRED;
+var CONFIG_ERROR_UNKNOWN_OPTION;
+var CleanOptions;
+var CleanOptionValues;
+var init_clean = __esm({
+ "src/lib/tasks/clean.ts"() {
+ init_CleanSummary();
+ init_utils();
+ init_task();
+ CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
+ CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
+ CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
+ CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
+ CleanOptions2["DRY_RUN"] = "n";
+ CleanOptions2["FORCE"] = "f";
+ CleanOptions2["IGNORED_INCLUDED"] = "x";
+ CleanOptions2["IGNORED_ONLY"] = "X";
+ CleanOptions2["EXCLUDING"] = "e";
+ CleanOptions2["QUIET"] = "q";
+ CleanOptions2["RECURSIVE"] = "d";
+ return CleanOptions2;
+ })(CleanOptions || {});
+ CleanOptionValues = /* @__PURE__ */ new Set(["i", ...asStringArray(Object.values(CleanOptions))]);
+ }
+});
+function configListParser(text2) {
+ const config = new ConfigList();
+ for (const item of configParser(text2)) {
+ config.addValue(item.file, String(item.key), item.value);
+ }
+ return config;
+}
+function configGetParser(text2, key2) {
+ let value = null;
+ const values = [];
+ const scopes = /* @__PURE__ */ new Map();
+ for (const item of configParser(text2, key2)) {
+ if (item.key !== key2) {
+ continue;
+ }
+ values.push(value = item.value);
+ if (!scopes.has(item.file)) {
+ scopes.set(item.file, []);
+ }
+ scopes.get(item.file).push(value);
+ }
+ return {
+ key: key2,
+ paths: Array.from(scopes.keys()),
+ scopes,
+ value,
+ values
+ };
+}
+function configFilePath(filePath) {
+ return filePath.replace(/^(file):/, "");
+}
+function* configParser(text2, requestedKey = null) {
+ const lines = text2.split("\0");
+ for (let i = 0, max = lines.length - 1; i < max; ) {
+ const file = configFilePath(lines[i++]);
+ let value = lines[i++];
+ let key2 = requestedKey;
+ if (value.includes("\n")) {
+ const line = splitOn(value, "\n");
+ key2 = line[0];
+ value = line[1];
+ }
+ yield { file, key: key2, value };
+ }
+}
+var ConfigList;
+var init_ConfigList = __esm({
+ "src/lib/responses/ConfigList.ts"() {
+ init_utils();
+ ConfigList = class {
+ constructor() {
+ this.files = [];
+ this.values = /* @__PURE__ */ Object.create(null);
+ }
+ get all() {
+ if (!this._all) {
+ this._all = this.files.reduce((all, file) => {
+ return Object.assign(all, this.values[file]);
+ }, {});
+ }
+ return this._all;
+ }
+ addFile(file) {
+ if (!(file in this.values)) {
+ const latest = last(this.files);
+ this.values[file] = latest ? Object.create(this.values[latest]) : {};
+ this.files.push(file);
+ }
+ return this.values[file];
+ }
+ addValue(file, key2, value) {
+ const values = this.addFile(file);
+ if (!values.hasOwnProperty(key2)) {
+ values[key2] = value;
+ } else if (Array.isArray(values[key2])) {
+ values[key2].push(value);
+ } else {
+ values[key2] = [values[key2], value];
+ }
+ this._all = void 0;
+ }
+ };
+ }
+});
+function asConfigScope(scope, fallback) {
+ if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) {
+ return scope;
+ }
+ return fallback;
+}
+function addConfigTask(key2, value, append22, scope) {
+ const commands = ["config", `--${scope}`];
+ if (append22) {
+ commands.push("--add");
+ }
+ commands.push(key2, value);
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return text2;
+ }
+ };
+}
+function getConfigTask(key2, scope) {
+ const commands = ["config", "--null", "--show-origin", "--get-all", key2];
+ if (scope) {
+ commands.splice(1, 0, `--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return configGetParser(text2, key2);
+ }
+ };
+}
+function listConfigTask(scope) {
+ const commands = ["config", "--list", "--show-origin", "--null"];
+ if (scope) {
+ commands.push(`--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return configListParser(text2);
+ }
+ };
+}
+function config_default() {
+ return {
+ addConfig(key2, value, ...rest) {
+ return this._runTask(addConfigTask(key2, value, rest[0] === true, asConfigScope(rest[1], "local")), trailingFunctionArgument(arguments));
+ },
+ getConfig(key2, scope) {
+ return this._runTask(getConfigTask(key2, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments));
+ },
+ listConfig(...rest) {
+ return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments));
+ }
+ };
+}
+var GitConfigScope;
+var init_config = __esm({
+ "src/lib/tasks/config.ts"() {
+ init_ConfigList();
+ init_utils();
+ GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
+ GitConfigScope2["system"] = "system";
+ GitConfigScope2["global"] = "global";
+ GitConfigScope2["local"] = "local";
+ GitConfigScope2["worktree"] = "worktree";
+ return GitConfigScope2;
+ })(GitConfigScope || {});
+ }
+});
+function grepQueryBuilder(...params) {
+ return new GrepQuery().param(...params);
+}
+function parseGrep(grep) {
+ const paths = /* @__PURE__ */ new Set();
+ const results = {};
+ forEachLineWithContent(grep, (input) => {
+ const [path3, line, preview] = input.split(NULL);
+ paths.add(path3);
+ (results[path3] = results[path3] || []).push({
+ line: asNumber(line),
+ path: path3,
+ preview
+ });
+ });
+ return {
+ paths,
+ results
+ };
+}
+function grep_default() {
+ return {
+ grep(searchTerm) {
+ const then = trailingFunctionArgument(arguments);
+ const options = getTrailingOptions(arguments);
+ for (const option of disallowedOptions) {
+ if (options.includes(option)) {
+ return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then);
+ }
+ }
+ if (typeof searchTerm === "string") {
+ searchTerm = grepQueryBuilder().param(searchTerm);
+ }
+ const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
+ return this._runTask({
+ commands,
+ format: "utf-8",
+ parser(stdOut) {
+ return parseGrep(stdOut);
+ }
+ }, then);
+ }
+ };
+}
+var disallowedOptions;
+var Query;
+var _a;
+var GrepQuery;
+var init_grep = __esm({
+ "src/lib/tasks/grep.ts"() {
+ init_utils();
+ init_task();
+ disallowedOptions = ["-h"];
+ Query = Symbol("grepQuery");
+ GrepQuery = class {
+ constructor() {
+ this[_a] = [];
+ }
+ *[(_a = Query, Symbol.iterator)]() {
+ for (const query of this[Query]) {
+ yield query;
+ }
+ }
+ and(...and) {
+ and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
+ return this;
+ }
+ param(...param) {
+ this[Query].push(...prefixedArray(param, "-e"));
+ return this;
+ }
+ };
+ }
+});
+var reset_exports = {};
+__export2(reset_exports, {
+ ResetMode: () => ResetMode,
+ getResetMode: () => getResetMode,
+ resetTask: () => resetTask
+});
+function resetTask(mode, customArgs) {
+ const commands = ["reset"];
+ if (isValidResetMode(mode)) {
+ commands.push(`--${mode}`);
+ }
+ commands.push(...customArgs);
+ return straightThroughStringTask(commands);
+}
+function getResetMode(mode) {
+ if (isValidResetMode(mode)) {
+ return mode;
+ }
+ switch (typeof mode) {
+ case "string":
+ case "undefined":
+ return "soft";
+ }
+ return;
+}
+function isValidResetMode(mode) {
+ return ResetModes.includes(mode);
+}
+var ResetMode;
+var ResetModes;
+var init_reset = __esm({
+ "src/lib/tasks/reset.ts"() {
+ init_task();
+ ResetMode = /* @__PURE__ */ ((ResetMode2) => {
+ ResetMode2["MIXED"] = "mixed";
+ ResetMode2["SOFT"] = "soft";
+ ResetMode2["HARD"] = "hard";
+ ResetMode2["MERGE"] = "merge";
+ ResetMode2["KEEP"] = "keep";
+ return ResetMode2;
+ })(ResetMode || {});
+ ResetModes = Array.from(Object.values(ResetMode));
+ }
+});
+function createLog() {
+ return (0, import_debug.default)("simple-git");
+}
+function prefixedLogger(to, prefix, forward) {
+ if (!prefix || !String(prefix).replace(/\s*/, "")) {
+ return !forward ? to : (message, ...args) => {
+ to(message, ...args);
+ forward(message, ...args);
+ };
+ }
+ return (message, ...args) => {
+ to(`%s ${message}`, prefix, ...args);
+ if (forward) {
+ forward(message, ...args);
+ }
+ };
+}
+function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
+ if (typeof name === "string") {
+ return name;
+ }
+ const childNamespace = childDebugger && childDebugger.namespace || "";
+ if (childNamespace.startsWith(parentNamespace)) {
+ return childNamespace.substr(parentNamespace.length + 1);
+ }
+ return childNamespace || parentNamespace;
+}
+function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
+ const labelPrefix = label && `[${label}]` || "";
+ const spawned = [];
+ const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
+ const key2 = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
+ return step(initialStep);
+ function sibling(name, initial) {
+ return append(spawned, createLogger(label, key2.replace(/^[^:]+/, name), initial, infoDebugger));
+ }
+ function step(phase) {
+ const stepPrefix = phase && `[${phase}]` || "";
+ const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
+ const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
+ return Object.assign(debugDebugger ? debug2 : info, {
+ label,
+ sibling,
+ info,
+ step
+ });
+ }
+}
+var init_git_logger = __esm({
+ "src/lib/git-logger.ts"() {
+ init_utils();
+ import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
+ import_debug.default.formatters.B = (value) => {
+ if (Buffer.isBuffer(value)) {
+ return value.toString("utf8");
+ }
+ return objectToString(value);
+ };
+ }
+});
+var _TasksPendingQueue;
+var TasksPendingQueue;
+var init_tasks_pending_queue = __esm({
+ "src/lib/runners/tasks-pending-queue.ts"() {
+ init_git_error();
+ init_git_logger();
+ _TasksPendingQueue = class {
+ constructor(logLabel = "GitExecutor") {
+ this.logLabel = logLabel;
+ this._queue = /* @__PURE__ */ new Map();
+ }
+ withProgress(task) {
+ return this._queue.get(task);
+ }
+ createProgress(task) {
+ const name = _TasksPendingQueue.getName(task.commands[0]);
+ const logger = createLogger(this.logLabel, name);
+ return {
+ task,
+ logger,
+ name
+ };
+ }
+ push(task) {
+ const progress = this.createProgress(task);
+ progress.logger("Adding task to the queue, commands = %o", task.commands);
+ this._queue.set(task, progress);
+ return progress;
+ }
+ fatal(err) {
+ for (const [task, { logger }] of Array.from(this._queue.entries())) {
+ if (task === err.task) {
+ logger.info(`Failed %o`, err);
+ logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
+ } else {
+ logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
+ }
+ this.complete(task);
+ }
+ if (this._queue.size !== 0) {
+ throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
+ }
+ }
+ complete(task) {
+ const progress = this.withProgress(task);
+ if (progress) {
+ this._queue.delete(task);
+ }
+ }
+ attempt(task) {
+ const progress = this.withProgress(task);
+ if (!progress) {
+ throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
+ }
+ progress.logger("Starting task");
+ return progress;
+ }
+ static getName(name = "empty") {
+ return `task:${name}:${++_TasksPendingQueue.counter}`;
+ }
+ };
+ TasksPendingQueue = _TasksPendingQueue;
+ TasksPendingQueue.counter = 0;
+ }
+});
+function pluginContext(task, commands) {
+ return {
+ method: first(task.commands) || "",
+ commands
+ };
+}
+function onErrorReceived(target, logger) {
+ return (err) => {
+ logger(`[ERROR] child process exception %o`, err);
+ target.push(Buffer.from(String(err.stack), "ascii"));
+ };
+}
+function onDataReceived(target, name, logger, output) {
+ return (buffer) => {
+ logger(`%s received %L bytes`, name, buffer);
+ output(`%B`, buffer);
+ target.push(buffer);
+ };
+}
+var GitExecutorChain;
+var init_git_executor_chain = __esm({
+ "src/lib/runners/git-executor-chain.ts"() {
+ init_git_error();
+ init_task();
+ init_utils();
+ init_tasks_pending_queue();
+ GitExecutorChain = class {
+ constructor(_executor, _scheduler, _plugins) {
+ this._executor = _executor;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = Promise.resolve();
+ this._queue = new TasksPendingQueue();
+ }
+ get binary() {
+ return this._executor.binary;
+ }
+ get cwd() {
+ return this._cwd || this._executor.cwd;
+ }
+ set cwd(cwd) {
+ this._cwd = cwd;
+ }
+ get env() {
+ return this._executor.env;
+ }
+ get outputHandler() {
+ return this._executor.outputHandler;
+ }
+ chain() {
+ return this;
+ }
+ push(task) {
+ this._queue.push(task);
+ return this._chain = this._chain.then(() => this.attemptTask(task));
+ }
+ attemptTask(task) {
+ return __async2(this, null, function* () {
+ const onScheduleComplete = yield this._scheduler.next();
+ const onQueueComplete = () => this._queue.complete(task);
+ try {
+ const { logger } = this._queue.attempt(task);
+ return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger);
+ } catch (e) {
+ throw this.onFatalException(task, e);
+ } finally {
+ onQueueComplete();
+ onScheduleComplete();
+ }
+ });
+ }
+ onFatalException(task, e) {
+ const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
+ this._chain = Promise.resolve();
+ this._queue.fatal(gitError);
+ return gitError;
+ }
+ attemptRemoteTask(task, logger) {
+ return __async2(this, null, function* () {
+ const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands));
+ const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN"));
+ const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE"));
+ logger(`passing response to task's parser as a %s`, task.format);
+ if (isBufferTask(task)) {
+ return callTaskParser(task.parser, outputStreams);
+ }
+ return callTaskParser(task.parser, outputStreams.asStrings());
+ });
+ }
+ attemptEmptyTask(task, logger) {
+ return __async2(this, null, function* () {
+ logger(`empty task bypassing child process to call to task's parser`);
+ return task.parser(this);
+ });
+ }
+ handleTaskData(task, args, result, logger) {
+ const { exitCode, rejection, stdOut, stdErr } = result;
+ return new Promise((done, fail) => {
+ logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
+ const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues2(__spreadValues2({}, pluginContext(task, args)), result));
+ if (error && task.onError) {
+ logger.info(`exitCode=%s handling with custom error handler`);
+ return task.onError(result, error, (newStdOut) => {
+ logger.info(`custom error handler treated as success`);
+ logger(`custom error returned a %s`, objectToString(newStdOut));
+ done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr)));
+ }, fail);
+ }
+ if (error) {
+ logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);
+ return fail(error);
+ }
+ logger.info(`retrieving task output complete`);
+ done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
+ });
+ }
+ gitResponse(task, command, args, outputHandler, logger) {
+ return __async2(this, null, function* () {
+ const outputLogger = logger.sibling("output");
+ const spawnOptions = this._plugins.exec("spawn.options", {
+ cwd: this.cwd,
+ env: this.env,
+ windowsHide: true
+ }, pluginContext(task, task.commands));
+ return new Promise((done) => {
+ const stdOut = [];
+ const stdErr = [];
+ let rejection;
+ logger.info(`%s %o`, command, args);
+ logger("%O", spawnOptions);
+ const spawned = (0, import_child_process.spawn)(command, args, spawnOptions);
+ spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
+ spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
+ spawned.on("error", onErrorReceived(stdErr, logger));
+ if (outputHandler) {
+ logger(`Passing child process stdOut/stdErr to custom outputHandler`);
+ outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
+ }
+ this._plugins.exec("spawn.after", void 0, __spreadProps2(__spreadValues2({}, pluginContext(task, args)), {
+ spawned,
+ close(exitCode, reason) {
+ done({
+ stdOut,
+ stdErr,
+ exitCode,
+ rejection: rejection || reason
+ });
+ },
+ kill(reason) {
+ if (spawned.killed) {
+ return;
+ }
+ rejection = reason;
+ spawned.kill("SIGINT");
+ }
+ }));
+ });
+ });
+ }
+ };
+ }
+});
+var git_executor_exports = {};
+__export2(git_executor_exports, {
+ GitExecutor: () => GitExecutor
+});
+var GitExecutor;
+var init_git_executor = __esm({
+ "src/lib/runners/git-executor.ts"() {
+ init_git_executor_chain();
+ GitExecutor = class {
+ constructor(binary = "git", cwd, _scheduler, _plugins) {
+ this.binary = binary;
+ this.cwd = cwd;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ chain() {
+ return new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ push(task) {
+ return this._chain.push(task);
+ }
+ };
+ }
+});
+function taskCallback(task, response, callback = NOOP) {
+ const onSuccess = (data) => {
+ callback(null, data);
+ };
+ const onError2 = (err) => {
+ if ((err == null ? void 0 : err.task) === task) {
+ callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0);
+ }
+ };
+ response.then(onSuccess, onError2);
+}
+function addDeprecationNoticeToError(err) {
+ let log = (name) => {
+ console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
+ log = NOOP;
+ };
+ return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
+ function descriptorReducer(all, name) {
+ if (name in err) {
+ return all;
+ }
+ all[name] = {
+ enumerable: false,
+ configurable: false,
+ get() {
+ log(name);
+ return err.git[name];
+ }
+ };
+ return all;
+ }
+}
+var init_task_callback = __esm({
+ "src/lib/task-callback.ts"() {
+ init_git_response_error();
+ init_utils();
+ }
+});
+function changeWorkingDirectoryTask(directory, root) {
+ return adhocExecTask((instance5) => {
+ if (!folderExists(directory)) {
+ throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
+ }
+ return (root || instance5).cwd = directory;
+ });
+}
+var init_change_working_directory = __esm({
+ "src/lib/tasks/change-working-directory.ts"() {
+ init_utils();
+ init_task();
+ }
+});
+function parseCommitResult(stdOut) {
+ const result = {
+ author: null,
+ branch: "",
+ commit: "",
+ root: false,
+ summary: {
+ changes: 0,
+ insertions: 0,
+ deletions: 0
+ }
+ };
+ return parseStringResponse(result, parsers, stdOut);
+}
+var parsers;
+var init_parse_commit = __esm({
+ "src/lib/parsers/parse-commit.ts"() {
+ init_utils();
+ parsers = [
+ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
+ result.branch = branch;
+ result.commit = commit;
+ result.root = !!root;
+ }),
+ new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
+ const parts = author.split("<");
+ const email = parts.pop();
+ if (!email || !email.includes("@")) {
+ return;
+ }
+ result.author = {
+ email: email.substr(0, email.length - 1),
+ name: parts.join("<").trim()
+ };
+ }),
+ new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ result.summary.insertions = parseInt(insertions, 10) || 0;
+ result.summary.deletions = parseInt(deletions, 10) || 0;
+ }),
+ new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ const count = parseInt(lines, 10) || 0;
+ if (direction === "-") {
+ result.summary.deletions = count;
+ } else if (direction === "+") {
+ result.summary.insertions = count;
+ }
+ })
+ ];
+ }
+});
+var commit_exports = {};
+__export2(commit_exports, {
+ commitTask: () => commitTask,
+ default: () => commit_default
+});
+function commitTask(message, files, customArgs) {
+ const commands = [
+ "-c",
+ "core.abbrev=40",
+ "commit",
+ ...prefixedArray(message, "-m"),
+ ...files,
+ ...customArgs
+ ];
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseCommitResult
+ };
+}
+function commit_default() {
+ return {
+ commit(message, ...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]);
+ return this._runTask(task, next);
+ }
+ };
+ function rejectDeprecatedSignatures(message) {
+ return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`);
+ }
+}
+var init_commit = __esm({
+ "src/lib/tasks/commit.ts"() {
+ init_parse_commit();
+ init_utils();
+ init_task();
+ }
+});
+function hashObjectTask(filePath, write) {
+ const commands = ["hash-object", filePath];
+ if (write) {
+ commands.push("-w");
+ }
+ return straightThroughStringTask(commands, true);
+}
+var init_hash_object = __esm({
+ "src/lib/tasks/hash-object.ts"() {
+ init_task();
+ }
+});
+function parseInit(bare, path3, text2) {
+ const response = String(text2).trim();
+ let result;
+ if (result = initResponseRegex.exec(response)) {
+ return new InitSummary(bare, path3, false, result[1]);
+ }
+ if (result = reInitResponseRegex.exec(response)) {
+ return new InitSummary(bare, path3, true, result[1]);
+ }
+ let gitDir = "";
+ const tokens = response.split(" ");
+ while (tokens.length) {
+ const token = tokens.shift();
+ if (token === "in") {
+ gitDir = tokens.join(" ");
+ break;
+ }
+ }
+ return new InitSummary(bare, path3, /^re/i.test(response), gitDir);
+}
+var InitSummary;
+var initResponseRegex;
+var reInitResponseRegex;
+var init_InitSummary = __esm({
+ "src/lib/responses/InitSummary.ts"() {
+ InitSummary = class {
+ constructor(bare, path3, existing, gitDir) {
+ this.bare = bare;
+ this.path = path3;
+ this.existing = existing;
+ this.gitDir = gitDir;
+ }
+ };
+ initResponseRegex = /^Init.+ repository in (.+)$/;
+ reInitResponseRegex = /^Rein.+ in (.+)$/;
+ }
+});
+function hasBareCommand(command) {
+ return command.includes(bareCommand);
+}
+function initTask(bare = false, path3, customArgs) {
+ const commands = ["init", ...customArgs];
+ if (bare && !hasBareCommand(commands)) {
+ commands.splice(1, 0, bareCommand);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text2) {
+ return parseInit(commands.includes("--bare"), path3, text2);
+ }
+ };
+}
+var bareCommand;
+var init_init = __esm({
+ "src/lib/tasks/init.ts"() {
+ init_InitSummary();
+ bareCommand = "--bare";
+ }
+});
+var DiffSummary;
+var init_DiffSummary = __esm({
+ "src/lib/responses/DiffSummary.ts"() {
+ DiffSummary = class {
+ constructor() {
+ this.changed = 0;
+ this.deletions = 0;
+ this.insertions = 0;
+ this.files = [];
+ }
+ };
+ }
+});
+function parseDiffResult(stdOut) {
+ const lines = stdOut.trim().split("\n");
+ const status = new DiffSummary();
+ readSummaryLine(status, lines.pop());
+ for (let i = 0, max = lines.length; i < max; i++) {
+ const line = lines[i];
+ textFileChange(line, status) || binaryFileChange(line, status);
+ }
+ return status;
+}
+function readSummaryLine(status, summary) {
+ (summary || "").trim().split(", ").forEach(function(text2) {
+ const summary2 = /(\d+)\s([a-z]+)/.exec(text2);
+ if (!summary2) {
+ return;
+ }
+ summaryType(status, summary2[2], parseInt(summary2[1], 10));
+ });
+}
+function summaryType(status, key2, value) {
+ const match = /([a-z]+?)s?\b/.exec(key2);
+ if (!match || !statusUpdate[match[1]]) {
+ return;
+ }
+ statusUpdate[match[1]](status, value);
+}
+function textFileChange(input, { files }) {
+ const line = input.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/);
+ if (line) {
+ var alterations = (line[3] || "").trim();
+ files.push({
+ file: line[1].trim(),
+ changes: parseInt(line[2], 10),
+ insertions: alterations.replace(/-/g, "").length,
+ deletions: alterations.replace(/\+/g, "").length,
+ binary: false
+ });
+ return true;
+ }
+ return false;
+}
+function binaryFileChange(input, { files }) {
+ const line = input.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);
+ if (line) {
+ files.push({
+ file: line[1].trim(),
+ before: +line[2],
+ after: +line[3],
+ binary: true
+ });
+ return true;
+ }
+ return false;
+}
+var statusUpdate;
+var init_parse_diff_summary = __esm({
+ "src/lib/parsers/parse-diff-summary.ts"() {
+ init_DiffSummary();
+ statusUpdate = {
+ file(status, value) {
+ status.changed = value;
+ },
+ deletion(status, value) {
+ status.deletions = value;
+ },
+ insertion(status, value) {
+ status.insertions = value;
+ }
+ };
+ }
+});
+function lineBuilder(tokens, fields) {
+ return fields.reduce((line, field, index) => {
+ line[field] = tokens[index] || "";
+ return line;
+ }, /* @__PURE__ */ Object.create({ diff: null }));
+}
+function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames) {
+ return function(stdOut) {
+ const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) {
+ const lineDetail = item.trim().split(COMMIT_BOUNDARY);
+ const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields);
+ if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
+ listLogLine.diff = parseDiffResult(lineDetail[1]);
+ }
+ return listLogLine;
+ });
+ return {
+ all,
+ latest: all.length && all[0] || null,
+ total: all.length
+ };
+ };
+}
+var START_BOUNDARY;
+var COMMIT_BOUNDARY;
+var SPLITTER;
+var defaultFieldNames;
+var init_parse_list_log_summary = __esm({
+ "src/lib/parsers/parse-list-log-summary.ts"() {
+ init_utils();
+ init_parse_diff_summary();
+ START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 ";
+ COMMIT_BOUNDARY = " \xF2\xF2";
+ SPLITTER = " \xF2 ";
+ defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"];
+ }
+});
+function prettyFormat(format, splitter) {
+ const fields = [];
+ const formatStr = [];
+ Object.keys(format).forEach((field) => {
+ fields.push(field);
+ formatStr.push(String(format[field]));
+ });
+ return [
+ fields,
+ formatStr.join(splitter)
+ ];
+}
+function userOptions(input) {
+ return Object.keys(input).reduce((out, key2) => {
+ if (!(key2 in excludeOptions)) {
+ out[key2] = input[key2];
+ }
+ return out;
+ }, {});
+}
+function parseLogOptions(opt = {}, customArgs = []) {
+ const splitter = filterType(opt.splitter, filterString, SPLITTER);
+ const format = !filterPrimitives(opt.format) && opt.format ? opt.format : {
+ hash: "%H",
+ date: opt.strictDate === false ? "%ai" : "%aI",
+ message: "%s",
+ refs: "%D",
+ body: opt.multiLine ? "%B" : "%b",
+ author_name: opt.mailMap !== false ? "%aN" : "%an",
+ author_email: opt.mailMap !== false ? "%aE" : "%ae"
+ };
+ const [fields, formatStr] = prettyFormat(format, splitter);
+ const suffix = [];
+ const command = [
+ `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
+ ...customArgs
+ ];
+ const maxCount = opt.n || opt["max-count"] || opt.maxCount;
+ if (maxCount) {
+ command.push(`--max-count=${maxCount}`);
+ }
+ if (opt.from && opt.to) {
+ const rangeOperator = opt.symmetric !== false ? "..." : "..";
+ suffix.push(`${opt.from}${rangeOperator}${opt.to}`);
+ }
+ if (filterString(opt.file)) {
+ suffix.push("--follow", opt.file);
+ }
+ appendTaskOptions(userOptions(opt), command);
+ return {
+ fields,
+ splitter,
+ commands: [
+ ...command,
+ ...suffix
+ ]
+ };
+}
+function logTask(splitter, fields, customArgs) {
+ return {
+ commands: ["log", ...customArgs],
+ format: "utf-8",
+ parser: createListLogSummaryParser(splitter, fields)
+ };
+}
+function log_default() {
+ return {
+ log(...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const task = rejectDeprecatedSignatures(...rest) || createLogTask(parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)));
+ return this._runTask(task, next);
+ }
+ };
+ function createLogTask(options) {
+ return logTask(options.splitter, options.fields, options.commands);
+ }
+ function rejectDeprecatedSignatures(from, to) {
+ return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`);
+ }
+}
+var excludeOptions;
+var init_log = __esm({
+ "src/lib/tasks/log.ts"() {
+ init_parse_list_log_summary();
+ init_utils();
+ init_task();
+ excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
+ excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
+ excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
+ excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
+ excludeOptions2[excludeOptions2["n"] = 3] = "n";
+ excludeOptions2[excludeOptions2["file"] = 4] = "file";
+ excludeOptions2[excludeOptions2["format"] = 5] = "format";
+ excludeOptions2[excludeOptions2["from"] = 6] = "from";
+ excludeOptions2[excludeOptions2["to"] = 7] = "to";
+ excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
+ excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
+ excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
+ excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
+ excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
+ return excludeOptions2;
+ })(excludeOptions || {});
+ }
+});
+var MergeSummaryConflict;
+var MergeSummaryDetail;
+var init_MergeSummary = __esm({
+ "src/lib/responses/MergeSummary.ts"() {
+ MergeSummaryConflict = class {
+ constructor(reason, file = null, meta) {
+ this.reason = reason;
+ this.file = file;
+ this.meta = meta;
+ }
+ toString() {
+ return `${this.file}:${this.reason}`;
+ }
+ };
+ MergeSummaryDetail = class {
+ constructor() {
+ this.conflicts = [];
+ this.merges = [];
+ this.result = "success";
+ }
+ get failed() {
+ return this.conflicts.length > 0;
+ }
+ get reason() {
+ return this.result;
+ }
+ toString() {
+ if (this.conflicts.length) {
+ return `CONFLICTS: ${this.conflicts.join(", ")}`;
+ }
+ return "OK";
+ }
+ };
+ }
+});
+var PullSummary;
+var PullFailedSummary;
+var init_PullSummary = __esm({
+ "src/lib/responses/PullSummary.ts"() {
+ PullSummary = class {
+ constructor() {
+ this.remoteMessages = {
+ all: []
+ };
+ this.created = [];
+ this.deleted = [];
+ this.files = [];
+ this.deletions = {};
+ this.insertions = {};
+ this.summary = {
+ changes: 0,
+ deletions: 0,
+ insertions: 0
+ };
+ }
+ };
+ PullFailedSummary = class {
+ constructor() {
+ this.remote = "";
+ this.hash = {
+ local: "",
+ remote: ""
+ };
+ this.branch = {
+ local: "",
+ remote: ""
+ };
+ this.message = "";
+ }
+ toString() {
+ return this.message;
+ }
+ };
+ }
+});
+function objectEnumerationResult(remoteMessages) {
+ return remoteMessages.objects = remoteMessages.objects || {
+ compressing: 0,
+ counting: 0,
+ enumerating: 0,
+ packReused: 0,
+ reused: { count: 0, delta: 0 },
+ total: { count: 0, delta: 0 }
+ };
+}
+function asObjectCount(source) {
+ const count = /^\s*(\d+)/.exec(source);
+ const delta = /delta (\d+)/i.exec(source);
+ return {
+ count: asNumber(count && count[1] || "0"),
+ delta: asNumber(delta && delta[1] || "0")
+ };
+}
+var remoteMessagesObjectParsers;
+var init_parse_remote_objects = __esm({
+ "src/lib/parsers/parse-remote-objects.ts"() {
+ init_utils();
+ remoteMessagesObjectParsers = [
+ new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
+ const key2 = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key2]: asNumber(count) });
+ }),
+ new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
+ const key2 = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key2]: asNumber(count) });
+ }),
+ new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
+ const objects = objectEnumerationResult(result.remoteMessages);
+ objects.total = asObjectCount(total);
+ objects.reused = asObjectCount(reused);
+ objects.packReused = asNumber(packReused);
+ })
+ ];
+ }
+});
+function parseRemoteMessages(_stdOut, stdErr) {
+ return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
+}
+var parsers2;
+var RemoteMessageSummary;
+var init_parse_remote_messages = __esm({
+ "src/lib/parsers/parse-remote-messages.ts"() {
+ init_utils();
+ init_parse_remote_objects();
+ parsers2 = [
+ new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text2]) => {
+ result.remoteMessages.all.push(text2.trim());
+ return false;
+ }),
+ ...remoteMessagesObjectParsers,
+ new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
+ result.remoteMessages.pullRequestUrl = pullRequestUrl;
+ }),
+ new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
+ result.remoteMessages.vulnerabilities = {
+ count: asNumber(count),
+ summary,
+ url
+ };
+ })
+ ];
+ RemoteMessageSummary = class {
+ constructor() {
+ this.all = [];
+ }
+ };
+ }
+});
+function parsePullErrorResult(stdOut, stdErr) {
+ const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, stdOut, stdErr);
+ return pullError.message && pullError;
+}
+var FILE_UPDATE_REGEX;
+var SUMMARY_REGEX;
+var ACTION_REGEX;
+var parsers3;
+var errorParsers;
+var parsePullDetail;
+var parsePullResult;
+var init_parse_pull = __esm({
+ "src/lib/parsers/parse-pull.ts"() {
+ init_PullSummary();
+ init_utils();
+ init_parse_remote_messages();
+ FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
+ SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
+ ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
+ parsers3 = [
+ new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
+ result.files.push(file);
+ if (insertions) {
+ result.insertions[file] = insertions.length;
+ }
+ if (deletions) {
+ result.deletions[file] = deletions.length;
+ }
+ }),
+ new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
+ if (insertions !== void 0 || deletions !== void 0) {
+ result.summary.changes = +changes || 0;
+ result.summary.insertions = +insertions || 0;
+ result.summary.deletions = +deletions || 0;
+ return true;
+ }
+ return false;
+ }),
+ new LineParser(ACTION_REGEX, (result, [action, file]) => {
+ append(result.files, file);
+ append(action === "create" ? result.created : result.deleted, file);
+ })
+ ];
+ errorParsers = [
+ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
+ new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
+ new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
+ result.branch.local = branchLocal;
+ result.hash.local = hashLocal;
+ result.branch.remote = branchRemote;
+ result.hash.remote = hashRemote;
+ })
+ ];
+ parsePullDetail = (stdOut, stdErr) => {
+ return parseStringResponse(new PullSummary(), parsers3, stdOut, stdErr);
+ };
+ parsePullResult = (stdOut, stdErr) => {
+ return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr));
+ };
+ }
+});
+var parsers4;
+var parseMergeResult;
+var parseMergeDetail;
+var init_parse_merge = __esm({
+ "src/lib/parsers/parse-merge.ts"() {
+ init_MergeSummary();
+ init_utils();
+ init_parse_pull();
+ parsers4 = [
+ new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
+ summary.merges.push(autoMerge);
+ }),
+ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file));
+ }),
+ new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
+ }),
+ new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, null));
+ }),
+ new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
+ summary.result = result;
+ })
+ ];
+ parseMergeResult = (stdOut, stdErr) => {
+ return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
+ };
+ parseMergeDetail = (stdOut) => {
+ return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
+ };
+ }
+});
+function mergeTask(customArgs) {
+ if (!customArgs.length) {
+ return configurationErrorTask("Git.merge requires at least one option");
+ }
+ return {
+ commands: ["merge", ...customArgs],
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ const merge = parseMergeResult(stdOut, stdErr);
+ if (merge.failed) {
+ throw new GitResponseError(merge);
+ }
+ return merge;
+ }
+ };
+}
+var init_merge = __esm({
+ "src/lib/tasks/merge.ts"() {
+ init_git_response_error();
+ init_parse_merge();
+ init_task();
+ }
+});
+function pushResultPushedItem(local, remote, status) {
+ const deleted = status.includes("deleted");
+ const tag = status.includes("tag") || /^refs\/tags/.test(local);
+ const alreadyUpdated = !status.includes("new");
+ return {
+ deleted,
+ tag,
+ branch: !tag,
+ new: !alreadyUpdated,
+ alreadyUpdated,
+ local,
+ remote
+ };
+}
+var parsers5;
+var parsePushResult;
+var parsePushDetail;
+var init_parse_push = __esm({
+ "src/lib/parsers/parse-push.ts"() {
+ init_utils();
+ init_parse_remote_messages();
+ parsers5 = [
+ new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
+ result.repo = repo;
+ }),
+ new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
+ result.ref = __spreadProps2(__spreadValues2({}, result.ref || {}), {
+ local
+ });
+ }),
+ new LineParser(/^[*-=]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
+ result.pushed.push(pushResultPushedItem(local, remote, type));
+ }),
+ new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
+ result.branch = __spreadProps2(__spreadValues2({}, result.branch || {}), {
+ local,
+ remote,
+ remoteName
+ });
+ }),
+ new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
+ result.update = {
+ head: {
+ local,
+ remote
+ },
+ hash: {
+ from,
+ to
+ }
+ };
+ })
+ ];
+ parsePushResult = (stdOut, stdErr) => {
+ const pushDetail = parsePushDetail(stdOut, stdErr);
+ const responseDetail = parseRemoteMessages(stdOut, stdErr);
+ return __spreadValues2(__spreadValues2({}, pushDetail), responseDetail);
+ };
+ parsePushDetail = (stdOut, stdErr) => {
+ return parseStringResponse({ pushed: [] }, parsers5, stdOut, stdErr);
+ };
+ }
+});
+var push_exports = {};
+__export2(push_exports, {
+ pushTagsTask: () => pushTagsTask,
+ pushTask: () => pushTask
+});
+function pushTagsTask(ref = {}, customArgs) {
+ append(customArgs, "--tags");
+ return pushTask(ref, customArgs);
+}
+function pushTask(ref = {}, customArgs) {
+ const commands = ["push", ...customArgs];
+ if (ref.branch) {
+ commands.splice(1, 0, ref.branch);
+ }
+ if (ref.remote) {
+ commands.splice(1, 0, ref.remote);
+ }
+ remove(commands, "-v");
+ append(commands, "--verbose");
+ append(commands, "--porcelain");
+ return {
+ commands,
+ format: "utf-8",
+ parser: parsePushResult
+ };
+}
+var init_push = __esm({
+ "src/lib/tasks/push.ts"() {
+ init_parse_push();
+ init_utils();
+ }
+});
+var fromPathRegex;
+var FileStatusSummary;
+var init_FileStatusSummary = __esm({
+ "src/lib/responses/FileStatusSummary.ts"() {
+ fromPathRegex = /^(.+) -> (.+)$/;
+ FileStatusSummary = class {
+ constructor(path3, index, working_dir) {
+ this.path = path3;
+ this.index = index;
+ this.working_dir = working_dir;
+ if (index + working_dir === "R") {
+ const detail = fromPathRegex.exec(path3) || [null, path3, path3];
+ this.from = detail[1] || "";
+ this.path = detail[2] || "";
+ }
+ }
+ };
+ }
+});
+function renamedFile(line) {
+ const [to, from] = line.split(NULL);
+ return {
+ from: from || to,
+ to
+ };
+}
+function parser2(indexX, indexY, handler) {
+ return [`${indexX}${indexY}`, handler];
+}
+function conflicts(indexX, ...indexY) {
+ return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file)));
+}
+function splitLine(result, lineStr) {
+ const trimmed2 = lineStr.trim();
+ switch (" ") {
+ case trimmed2.charAt(2):
+ return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
+ case trimmed2.charAt(1):
+ return data(" ", trimmed2.charAt(0), trimmed2.substr(2));
+ default:
+ return;
+ }
+ function data(index, workingDir, path3) {
+ const raw = `${index}${workingDir}`;
+ const handler = parsers6.get(raw);
+ if (handler) {
+ handler(result, path3);
+ }
+ if (raw !== "##" && raw !== "!!") {
+ result.files.push(new FileStatusSummary(path3.replace(/\0.+$/, ""), index, workingDir));
+ }
+ }
+}
+var StatusSummary;
+var parsers6;
+var parseStatusSummary;
+var init_StatusSummary = __esm({
+ "src/lib/responses/StatusSummary.ts"() {
+ init_utils();
+ init_FileStatusSummary();
+ StatusSummary = class {
+ constructor() {
+ this.not_added = [];
+ this.conflicted = [];
+ this.created = [];
+ this.deleted = [];
+ this.ignored = void 0;
+ this.modified = [];
+ this.renamed = [];
+ this.files = [];
+ this.staged = [];
+ this.ahead = 0;
+ this.behind = 0;
+ this.current = null;
+ this.tracking = null;
+ this.detached = false;
+ this.isClean = () => {
+ return !this.files.length;
+ };
+ }
+ };
+ parsers6 = new Map([
+ parser2(" ", "A", (result, file) => append(result.created, file)),
+ parser2(" ", "D", (result, file) => append(result.deleted, file)),
+ parser2(" ", "M", (result, file) => append(result.modified, file)),
+ parser2("A", " ", (result, file) => append(result.created, file) && append(result.staged, file)),
+ parser2("A", "M", (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)),
+ parser2("D", " ", (result, file) => append(result.deleted, file) && append(result.staged, file)),
+ parser2("M", " ", (result, file) => append(result.modified, file) && append(result.staged, file)),
+ parser2("M", "M", (result, file) => append(result.modified, file) && append(result.staged, file)),
+ parser2("R", " ", (result, file) => {
+ append(result.renamed, renamedFile(file));
+ }),
+ parser2("R", "M", (result, file) => {
+ const renamed = renamedFile(file);
+ append(result.renamed, renamed);
+ append(result.modified, renamed.to);
+ }),
+ parser2("!", "!", (_result, _file) => {
+ append(_result.ignored = _result.ignored || [], _file);
+ }),
+ parser2("?", "?", (result, file) => append(result.not_added, file)),
+ ...conflicts("A", "A", "U"),
+ ...conflicts("D", "D", "U"),
+ ...conflicts("U", "A", "D", "U"),
+ ["##", (result, line) => {
+ const aheadReg = /ahead (\d+)/;
+ const behindReg = /behind (\d+)/;
+ const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
+ const trackingReg = /\.{3}(\S*)/;
+ const onEmptyBranchReg = /\son\s([\S]+)$/;
+ let regexResult;
+ regexResult = aheadReg.exec(line);
+ result.ahead = regexResult && +regexResult[1] || 0;
+ regexResult = behindReg.exec(line);
+ result.behind = regexResult && +regexResult[1] || 0;
+ regexResult = currentReg.exec(line);
+ result.current = regexResult && regexResult[1];
+ regexResult = trackingReg.exec(line);
+ result.tracking = regexResult && regexResult[1];
+ regexResult = onEmptyBranchReg.exec(line);
+ result.current = regexResult && regexResult[1] || result.current;
+ result.detached = /\(no branch\)/.test(line);
+ }]
+ ]);
+ parseStatusSummary = function(text2) {
+ const lines = text2.split(NULL);
+ const status = new StatusSummary();
+ for (let i = 0, l = lines.length; i < l; ) {
+ let line = lines[i++].trim();
+ if (!line) {
+ continue;
+ }
+ if (line.charAt(0) === "R") {
+ line += NULL + (lines[i++] || "");
+ }
+ splitLine(status, line);
+ }
+ return status;
+ };
+ }
+});
+function statusTask(customArgs) {
+ const commands = [
+ "status",
+ "--porcelain",
+ "-b",
+ "-u",
+ "--null",
+ ...customArgs.filter((arg) => !ignoredOptions.includes(arg))
+ ];
+ return {
+ format: "utf-8",
+ commands,
+ parser(text2) {
+ return parseStatusSummary(text2);
+ }
+ };
+}
+var ignoredOptions;
+var init_status = __esm({
+ "src/lib/tasks/status.ts"() {
+ init_StatusSummary();
+ ignoredOptions = ["--null", "-z"];
+ }
+});
+var simple_git_api_exports = {};
+__export2(simple_git_api_exports, {
+ SimpleGitApi: () => SimpleGitApi
+});
+var SimpleGitApi;
+var init_simple_git_api = __esm({
+ "src/lib/simple-git-api.ts"() {
+ init_task_callback();
+ init_change_working_directory();
+ init_commit();
+ init_config();
+ init_grep();
+ init_hash_object();
+ init_init();
+ init_log();
+ init_merge();
+ init_push();
+ init_status();
+ init_task();
+ init_utils();
+ SimpleGitApi = class {
+ constructor(_executor) {
+ this._executor = _executor;
+ }
+ _runTask(task, then) {
+ const chain = this._executor.chain();
+ const promise2 = chain.push(task);
+ if (then) {
+ taskCallback(task, promise2, then);
+ }
+ return Object.create(this, {
+ then: { value: promise2.then.bind(promise2) },
+ catch: { value: promise2.catch.bind(promise2) },
+ _executor: { value: chain }
+ });
+ }
+ add(files) {
+ return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments));
+ }
+ cwd(directory) {
+ const next = trailingFunctionArgument(arguments);
+ if (typeof directory === "string") {
+ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
+ }
+ if (typeof (directory == null ? void 0 : directory.path) === "string") {
+ return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next);
+ }
+ return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next);
+ }
+ hashObject(path3, write) {
+ return this._runTask(hashObjectTask(path3, write === true), trailingFunctionArgument(arguments));
+ }
+ init(bare) {
+ return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
+ }
+ merge() {
+ return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
+ }
+ mergeFromTo(remote, branch) {
+ if (!(filterString(remote) && filterString(branch))) {
+ return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`));
+ }
+ return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false));
+ }
+ outputHandler(handler) {
+ this._executor.outputHandler = handler;
+ return this;
+ }
+ push() {
+ const task = pushTask({
+ remote: filterType(arguments[0], filterString),
+ branch: filterType(arguments[1], filterString)
+ }, getTrailingOptions(arguments));
+ return this._runTask(task, trailingFunctionArgument(arguments));
+ }
+ stash() {
+ return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
+ }
+ status() {
+ return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
+ }
+ };
+ Object.assign(SimpleGitApi.prototype, commit_default(), config_default(), grep_default(), log_default());
+ }
+});
+var scheduler_exports = {};
+__export2(scheduler_exports, {
+ Scheduler: () => Scheduler
+});
+var createScheduledTask;
+var Scheduler;
+var init_scheduler = __esm({
+ "src/lib/runners/scheduler.ts"() {
+ init_utils();
+ init_git_logger();
+ createScheduledTask = (() => {
+ let id = 0;
+ return () => {
+ id++;
+ const { promise: promise2, done } = (0, import_promise_deferred.createDeferred)();
+ return {
+ promise: promise2,
+ done,
+ id
+ };
+ };
+ })();
+ Scheduler = class {
+ constructor(concurrency = 2) {
+ this.concurrency = concurrency;
+ this.logger = createLogger("", "scheduler");
+ this.pending = [];
+ this.running = [];
+ this.logger(`Constructed, concurrency=%s`, concurrency);
+ }
+ schedule() {
+ if (!this.pending.length || this.running.length >= this.concurrency) {
+ this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
+ return;
+ }
+ const task = append(this.running, this.pending.shift());
+ this.logger(`Attempting id=%s`, task.id);
+ task.done(() => {
+ this.logger(`Completing id=`, task.id);
+ remove(this.running, task);
+ this.schedule();
+ });
+ }
+ next() {
+ const { promise: promise2, id } = append(this.pending, createScheduledTask());
+ this.logger(`Scheduling id=%s`, id);
+ this.schedule();
+ return promise2;
+ }
+ };
+ }
+});
+var apply_patch_exports = {};
+__export2(apply_patch_exports, {
+ applyPatchTask: () => applyPatchTask
+});
+function applyPatchTask(patches, customArgs) {
+ return straightThroughStringTask(["apply", ...customArgs, ...patches]);
+}
+var init_apply_patch = __esm({
+ "src/lib/tasks/apply-patch.ts"() {
+ init_task();
+ }
+});
+function branchDeletionSuccess(branch, hash2) {
+ return {
+ branch,
+ hash: hash2,
+ success: true
+ };
+}
+function branchDeletionFailure(branch) {
+ return {
+ branch,
+ hash: null,
+ success: false
+ };
+}
+var BranchDeletionBatch;
+var init_BranchDeleteSummary = __esm({
+ "src/lib/responses/BranchDeleteSummary.ts"() {
+ BranchDeletionBatch = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.errors = [];
+ }
+ get success() {
+ return !this.errors.length;
+ }
+ };
+ }
+});
+function hasBranchDeletionError(data, processExitCode) {
+ return processExitCode === 1 && deleteErrorRegex.test(data);
+}
+var deleteSuccessRegex;
+var deleteErrorRegex;
+var parsers7;
+var parseBranchDeletions;
+var init_parse_branch_delete = __esm({
+ "src/lib/parsers/parse-branch-delete.ts"() {
+ init_BranchDeleteSummary();
+ init_utils();
+ deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
+ deleteErrorRegex = /^error[^']+'([^']+)'/m;
+ parsers7 = [
+ new LineParser(deleteSuccessRegex, (result, [branch, hash2]) => {
+ const deletion = branchDeletionSuccess(branch, hash2);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ }),
+ new LineParser(deleteErrorRegex, (result, [branch]) => {
+ const deletion = branchDeletionFailure(branch);
+ result.errors.push(deletion);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ })
+ ];
+ parseBranchDeletions = (stdOut, stdErr) => {
+ return parseStringResponse(new BranchDeletionBatch(), parsers7, stdOut, stdErr);
+ };
+ }
+});
+var BranchSummaryResult;
+var init_BranchSummary = __esm({
+ "src/lib/responses/BranchSummary.ts"() {
+ BranchSummaryResult = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.current = "";
+ this.detached = false;
+ }
+ push(current, detached, name, commit, label) {
+ if (current) {
+ this.detached = detached;
+ this.current = name;
+ }
+ this.all.push(name);
+ this.branches[name] = {
+ current,
+ name,
+ commit,
+ label
+ };
+ }
+ };
+ }
+});
+function parseBranchSummary(stdOut) {
+ return parseStringResponse(new BranchSummaryResult(), parsers8, stdOut);
+}
+var parsers8;
+var init_parse_branch = __esm({
+ "src/lib/parsers/parse-branch.ts"() {
+ init_BranchSummary();
+ init_utils();
+ parsers8 = [
+ new LineParser(/^(\*\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
+ result.push(!!current, true, name, commit, label);
+ }),
+ new LineParser(/^(\*\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
+ result.push(!!current, false, name, commit, label);
+ })
+ ];
+ }
+});
+var branch_exports = {};
+__export2(branch_exports, {
+ branchLocalTask: () => branchLocalTask,
+ branchTask: () => branchTask,
+ containsDeleteBranchCommand: () => containsDeleteBranchCommand,
+ deleteBranchTask: () => deleteBranchTask,
+ deleteBranchesTask: () => deleteBranchesTask
+});
+function containsDeleteBranchCommand(commands) {
+ const deleteCommands = ["-d", "-D", "--delete"];
+ return commands.some((command) => deleteCommands.includes(command));
+}
+function branchTask(customArgs) {
+ const isDelete = containsDeleteBranchCommand(customArgs);
+ const commands = ["branch", ...customArgs];
+ if (commands.length === 1) {
+ commands.push("-a");
+ }
+ if (!commands.includes("-v")) {
+ commands.splice(1, 0, "-v");
+ }
+ return {
+ format: "utf-8",
+ commands,
+ parser(stdOut, stdErr) {
+ if (isDelete) {
+ return parseBranchDeletions(stdOut, stdErr).all[0];
+ }
+ return parseBranchSummary(stdOut);
+ }
+ };
+}
+function branchLocalTask() {
+ const parser3 = parseBranchSummary;
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v"],
+ parser: parser3
+ };
+}
+function deleteBranchesTask(branches, forceDelete = false) {
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr);
+ },
+ onError({ exitCode, stdOut }, error, done, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ done(stdOut);
+ }
+ };
+}
+function deleteBranchTask(branch, forceDelete = false) {
+ const task = {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr).branches[branch];
+ },
+ onError({ exitCode, stdErr, stdOut }, error, _, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error));
+ }
+ };
+ return task;
+}
+var init_branch = __esm({
+ "src/lib/tasks/branch.ts"() {
+ init_git_response_error();
+ init_parse_branch_delete();
+ init_parse_branch();
+ init_utils();
+ }
+});
+var parseCheckIgnore;
+var init_CheckIgnore = __esm({
+ "src/lib/responses/CheckIgnore.ts"() {
+ parseCheckIgnore = (text2) => {
+ return text2.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
+ };
+ }
+});
+var check_ignore_exports = {};
+__export2(check_ignore_exports, {
+ checkIgnoreTask: () => checkIgnoreTask
+});
+function checkIgnoreTask(paths) {
+ return {
+ commands: ["check-ignore", ...paths],
+ format: "utf-8",
+ parser: parseCheckIgnore
+ };
+}
+var init_check_ignore = __esm({
+ "src/lib/tasks/check-ignore.ts"() {
+ init_CheckIgnore();
+ }
+});
+var clone_exports = {};
+__export2(clone_exports, {
+ cloneMirrorTask: () => cloneMirrorTask,
+ cloneTask: () => cloneTask
+});
+function disallowedCommand(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function cloneTask(repo, directory, customArgs) {
+ const commands = ["clone", ...customArgs];
+ filterString(repo) && commands.push(repo);
+ filterString(directory) && commands.push(directory);
+ const banned = commands.find(disallowedCommand);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return straightThroughStringTask(commands);
+}
+function cloneMirrorTask(repo, directory, customArgs) {
+ append(customArgs, "--mirror");
+ return cloneTask(repo, directory, customArgs);
+}
+var init_clone = __esm({
+ "src/lib/tasks/clone.ts"() {
+ init_task();
+ init_utils();
+ }
+});
+var diff_exports = {};
+__export2(diff_exports, {
+ diffSummaryTask: () => diffSummaryTask
+});
+function diffSummaryTask(customArgs) {
+ return {
+ commands: ["diff", "--stat=4096", ...customArgs],
+ format: "utf-8",
+ parser(stdOut) {
+ return parseDiffResult(stdOut);
+ }
+ };
+}
+var init_diff = __esm({
+ "src/lib/tasks/diff.ts"() {
+ init_parse_diff_summary();
+ }
+});
+function parseFetchResult(stdOut, stdErr) {
+ const result = {
+ raw: stdOut,
+ remote: null,
+ branches: [],
+ tags: []
+ };
+ return parseStringResponse(result, parsers9, stdOut, stdErr);
+}
+var parsers9;
+var init_parse_fetch = __esm({
+ "src/lib/parsers/parse-fetch.ts"() {
+ init_utils();
+ parsers9 = [
+ new LineParser(/From (.+)$/, (result, [remote]) => {
+ result.remote = remote;
+ }),
+ new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.branches.push({
+ name,
+ tracking
+ });
+ }),
+ new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.tags.push({
+ name,
+ tracking
+ });
+ })
+ ];
+ }
+});
+var fetch_exports = {};
+__export2(fetch_exports, {
+ fetchTask: () => fetchTask
+});
+function disallowedCommand2(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function fetchTask(remote, branch, customArgs) {
+ const commands = ["fetch", ...customArgs];
+ if (remote && branch) {
+ commands.push(remote, branch);
+ }
+ const banned = commands.find(disallowedCommand2);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseFetchResult
+ };
+}
+var init_fetch = __esm({
+ "src/lib/tasks/fetch.ts"() {
+ init_parse_fetch();
+ init_task();
+ }
+});
+function parseMoveResult(stdOut) {
+ return parseStringResponse({ moves: [] }, parsers10, stdOut);
+}
+var parsers10;
+var init_parse_move = __esm({
+ "src/lib/parsers/parse-move.ts"() {
+ init_utils();
+ parsers10 = [
+ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
+ result.moves.push({ from, to });
+ })
+ ];
+ }
+});
+var move_exports = {};
+__export2(move_exports, {
+ moveTask: () => moveTask
+});
+function moveTask(from, to) {
+ return {
+ commands: ["mv", "-v", ...asArray(from), to],
+ format: "utf-8",
+ parser: parseMoveResult
+ };
+}
+var init_move = __esm({
+ "src/lib/tasks/move.ts"() {
+ init_parse_move();
+ init_utils();
+ }
+});
+var pull_exports = {};
+__export2(pull_exports, {
+ pullTask: () => pullTask
+});
+function pullTask(remote, branch, customArgs) {
+ const commands = ["pull", ...customArgs];
+ if (remote && branch) {
+ commands.splice(1, 0, remote, branch);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ return parsePullResult(stdOut, stdErr);
+ },
+ onError(result, _error, _done, fail) {
+ const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));
+ if (pullError) {
+ return fail(new GitResponseError(pullError));
+ }
+ fail(_error);
+ }
+ };
+}
+var init_pull = __esm({
+ "src/lib/tasks/pull.ts"() {
+ init_git_response_error();
+ init_parse_pull();
+ init_utils();
+ }
+});
+function parseGetRemotes(text2) {
+ const remotes = {};
+ forEach(text2, ([name]) => remotes[name] = { name });
+ return Object.values(remotes);
+}
+function parseGetRemotesVerbose(text2) {
+ const remotes = {};
+ forEach(text2, ([name, url, purpose]) => {
+ if (!remotes.hasOwnProperty(name)) {
+ remotes[name] = {
+ name,
+ refs: { fetch: "", push: "" }
+ };
+ }
+ if (purpose && url) {
+ remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
+ }
+ });
+ return Object.values(remotes);
+}
+function forEach(text2, handler) {
+ forEachLineWithContent(text2, (line) => handler(line.split(/\s+/)));
+}
+var init_GetRemoteSummary = __esm({
+ "src/lib/responses/GetRemoteSummary.ts"() {
+ init_utils();
+ }
+});
+var remote_exports = {};
+__export2(remote_exports, {
+ addRemoteTask: () => addRemoteTask,
+ getRemotesTask: () => getRemotesTask,
+ listRemotesTask: () => listRemotesTask,
+ remoteTask: () => remoteTask,
+ removeRemoteTask: () => removeRemoteTask
+});
+function addRemoteTask(remoteName, remoteRepo, customArgs = []) {
+ return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
+}
+function getRemotesTask(verbose) {
+ const commands = ["remote"];
+ if (verbose) {
+ commands.push("-v");
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
+ };
+}
+function listRemotesTask(customArgs = []) {
+ const commands = [...customArgs];
+ if (commands[0] !== "ls-remote") {
+ commands.unshift("ls-remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function remoteTask(customArgs = []) {
+ const commands = [...customArgs];
+ if (commands[0] !== "remote") {
+ commands.unshift("remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function removeRemoteTask(remoteName) {
+ return straightThroughStringTask(["remote", "remove", remoteName]);
+}
+var init_remote = __esm({
+ "src/lib/tasks/remote.ts"() {
+ init_GetRemoteSummary();
+ init_task();
+ }
+});
+var stash_list_exports = {};
+__export2(stash_list_exports, {
+ stashListTask: () => stashListTask
+});
+function stashListTask(opt = {}, customArgs) {
+ const options = parseLogOptions(opt);
+ const parser3 = createListLogSummaryParser(options.splitter, options.fields);
+ return {
+ commands: ["stash", "list", ...options.commands, ...customArgs],
+ format: "utf-8",
+ parser: parser3
+ };
+}
+var init_stash_list = __esm({
+ "src/lib/tasks/stash-list.ts"() {
+ init_parse_list_log_summary();
+ init_log();
+ }
+});
+var sub_module_exports = {};
+__export2(sub_module_exports, {
+ addSubModuleTask: () => addSubModuleTask,
+ initSubModuleTask: () => initSubModuleTask,
+ subModuleTask: () => subModuleTask,
+ updateSubModuleTask: () => updateSubModuleTask
+});
+function addSubModuleTask(repo, path3) {
+ return subModuleTask(["add", repo, path3]);
+}
+function initSubModuleTask(customArgs) {
+ return subModuleTask(["init", ...customArgs]);
+}
+function subModuleTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "submodule") {
+ commands.unshift("submodule");
+ }
+ return straightThroughStringTask(commands);
+}
+function updateSubModuleTask(customArgs) {
+ return subModuleTask(["update", ...customArgs]);
+}
+var init_sub_module = __esm({
+ "src/lib/tasks/sub-module.ts"() {
+ init_task();
+ }
+});
+function singleSorted(a, b) {
+ const aIsNum = isNaN(a);
+ const bIsNum = isNaN(b);
+ if (aIsNum !== bIsNum) {
+ return aIsNum ? 1 : -1;
+ }
+ return aIsNum ? sorted(a, b) : 0;
+}
+function sorted(a, b) {
+ return a === b ? 0 : a > b ? 1 : -1;
+}
+function trimmed(input) {
+ return input.trim();
+}
+function toNumber(input) {
+ if (typeof input === "string") {
+ return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
+ }
+ return 0;
+}
+var TagList;
+var parseTagList;
+var init_TagList = __esm({
+ "src/lib/responses/TagList.ts"() {
+ TagList = class {
+ constructor(all, latest) {
+ this.all = all;
+ this.latest = latest;
+ }
+ };
+ parseTagList = function(data, customSort = false) {
+ const tags = data.split("\n").map(trimmed).filter(Boolean);
+ if (!customSort) {
+ tags.sort(function(tagA, tagB) {
+ const partsA = tagA.split(".");
+ const partsB = tagB.split(".");
+ if (partsA.length === 1 || partsB.length === 1) {
+ return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
+ }
+ for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
+ const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
+ if (diff) {
+ return diff;
+ }
+ }
+ return 0;
+ });
+ }
+ const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
+ return new TagList(tags, latest);
+ };
+ }
+});
+var tag_exports = {};
+__export2(tag_exports, {
+ addAnnotatedTagTask: () => addAnnotatedTagTask,
+ addTagTask: () => addTagTask,
+ tagListTask: () => tagListTask
+});
+function tagListTask(customArgs = []) {
+ const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
+ return {
+ format: "utf-8",
+ commands: ["tag", "-l", ...customArgs],
+ parser(text2) {
+ return parseTagList(text2, hasCustomSort);
+ }
+ };
+}
+function addTagTask(name) {
+ return {
+ format: "utf-8",
+ commands: ["tag", name],
+ parser() {
+ return { name };
+ }
+ };
+}
+function addAnnotatedTagTask(name, tagMessage) {
+ return {
+ format: "utf-8",
+ commands: ["tag", "-a", "-m", tagMessage, name],
+ parser() {
+ return { name };
+ }
+ };
+}
+var init_tag = __esm({
+ "src/lib/tasks/tag.ts"() {
+ init_TagList();
+ }
+});
+var require_git = __commonJS2({
+ "src/git.js"(exports, module2) {
+ var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
+ var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
+ var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
+ var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
+ var {
+ asArray: asArray2,
+ filterArray: filterArray2,
+ filterPrimitives: filterPrimitives2,
+ filterString: filterString2,
+ filterStringOrStringArray: filterStringOrStringArray2,
+ filterType: filterType2,
+ getTrailingOptions: getTrailingOptions2,
+ trailingFunctionArgument: trailingFunctionArgument2,
+ trailingOptionsArgument: trailingOptionsArgument2
+ } = (init_utils(), __toCommonJS(utils_exports));
+ var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
+ var { branchTask: branchTask2, branchLocalTask: branchLocalTask2, deleteBranchesTask: deleteBranchesTask2, deleteBranchTask: deleteBranchTask2 } = (init_branch(), __toCommonJS(branch_exports));
+ var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
+ var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
+ var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
+ var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
+ var { commitTask: commitTask2 } = (init_commit(), __toCommonJS(commit_exports));
+ var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
+ var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
+ var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
+ var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
+ var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
+ var { addRemoteTask: addRemoteTask2, getRemotesTask: getRemotesTask2, listRemotesTask: listRemotesTask2, remoteTask: remoteTask2, removeRemoteTask: removeRemoteTask2 } = (init_remote(), __toCommonJS(remote_exports));
+ var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
+ var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
+ var { addSubModuleTask: addSubModuleTask2, initSubModuleTask: initSubModuleTask2, subModuleTask: subModuleTask2, updateSubModuleTask: updateSubModuleTask2 } = (init_sub_module(), __toCommonJS(sub_module_exports));
+ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
+ var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
+ function Git2(options, plugins) {
+ this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins);
+ }
+ (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
+ Git2.prototype.customBinary = function(command) {
+ this._executor.binary = command;
+ return this;
+ };
+ Git2.prototype.env = function(name, value) {
+ if (arguments.length === 1 && typeof name === "object") {
+ this._executor.env = name;
+ } else {
+ (this._executor.env = this._executor.env || {})[name] = value;
+ }
+ return this;
+ };
+ Git2.prototype.stashList = function(options) {
+ return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments));
+ };
+ function createCloneTask(api, task, repoPath, localPath) {
+ if (typeof repoPath !== "string") {
+ return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
+ }
+ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
+ }
+ Git2.prototype.clone = function() {
+ return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.mirror = function() {
+ return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.mv = function(from, to) {
+ return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkoutLatestTag = function(then) {
+ var git = this;
+ return this.pull(function() {
+ git.tags(function(err, tags) {
+ git.checkout(tags.latest, then);
+ });
+ });
+ };
+ Git2.prototype.pull = function(remote, branch, options, then) {
+ return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.fetch = function(remote, branch) {
+ return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.silent = function(silence) {
+ console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");
+ return this;
+ };
+ Git2.prototype.tags = function(options, then) {
+ return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.rebase = function() {
+ return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.reset = function(mode) {
+ return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.revert = function(commit) {
+ const next = trailingFunctionArgument2(arguments);
+ if (typeof commit !== "string") {
+ return this._runTask(configurationErrorTask2("Commit must be a string"), next);
+ }
+ return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next);
+ };
+ Git2.prototype.addTag = function(name) {
+ const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
+ return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkout = function() {
+ const commands = ["checkout", ...getTrailingOptions2(arguments, true)];
+ return this._runTask(straightThroughStringTask2(commands), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkoutBranch = function(branchName, startPoint, then) {
+ return this.checkout(["-b", branchName, startPoint], trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkoutLocalBranch = function(branchName, then) {
+ return this.checkout(["-b", branchName], trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
+ return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
+ return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.branch = function(options, then) {
+ return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.branchLocal = function(then) {
+ return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.raw = function(commands) {
+ const createRestCommands = !Array.isArray(commands);
+ const command = [].slice.call(createRestCommands ? arguments : commands, 0);
+ for (let i = 0; i < command.length && createRestCommands; i++) {
+ if (!filterPrimitives2(command[i])) {
+ command.splice(i, command.length - i);
+ break;
+ }
+ }
+ command.push(...getTrailingOptions2(arguments, 0, true));
+ var next = trailingFunctionArgument2(arguments);
+ if (!command.length) {
+ return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next);
+ }
+ return this._runTask(straightThroughStringTask2(command), next);
+ };
+ Git2.prototype.submoduleAdd = function(repo, path3, then) {
+ return this._runTask(addSubModuleTask2(repo, path3), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.submoduleUpdate = function(args, then) {
+ return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.submoduleInit = function(args, then) {
+ return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.subModule = function(options, then) {
+ return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.listRemote = function() {
+ return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
+ return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.removeRemote = function(remoteName, then) {
+ return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.getRemotes = function(verbose, then) {
+ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.remote = function(options, then) {
+ return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.tag = function(options, then) {
+ const command = getTrailingOptions2(arguments);
+ if (command[0] !== "tag") {
+ command.unshift("tag");
+ }
+ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.updateServerInfo = function(then) {
+ return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.pushTags = function(remote, then) {
+ const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments));
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.rm = function(files) {
+ return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.rmKeepLocal = function(files) {
+ return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.catFile = function(options, then) {
+ return this._catFile("utf-8", arguments);
+ };
+ Git2.prototype.binaryCatFile = function() {
+ return this._catFile("buffer", arguments);
+ };
+ Git2.prototype._catFile = function(format, args) {
+ var handler = trailingFunctionArgument2(args);
+ var command = ["cat-file"];
+ var options = args[0];
+ if (typeof options === "string") {
+ return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler);
+ }
+ if (Array.isArray(options)) {
+ command.push.apply(command, options);
+ }
+ const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
+ return this._runTask(task, handler);
+ };
+ Git2.prototype.diff = function(options, then) {
+ const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.diffSummary = function() {
+ return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.applyPatch = function(patches) {
+ const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.revparse = function() {
+ const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
+ return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.show = function(options, then) {
+ return this._runTask(straightThroughStringTask2(["show", ...getTrailingOptions2(arguments, 1)]), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.clean = function(mode, options, then) {
+ const usingCleanOptionsArray = isCleanOptionsArray2(mode);
+ const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
+ const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
+ return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.exec = function(then) {
+ const task = {
+ commands: [],
+ format: "utf-8",
+ parser() {
+ if (typeof then === "function") {
+ then();
+ }
+ }
+ };
+ return this._runTask(task);
+ };
+ Git2.prototype.clearQueue = function() {
+ return this;
+ };
+ Git2.prototype.checkIgnore = function(pathnames, then) {
+ return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkIsRepo = function(checkType, then) {
+ return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments));
+ };
+ module2.exports = Git2;
+ }
+});
+init_git_error();
+var GitConstructError = class extends GitError {
+ constructor(config, message) {
+ super(void 0, message);
+ this.config = config;
+ }
+};
+init_git_error();
+init_git_error();
+var GitPluginError = class extends GitError {
+ constructor(task, plugin, message) {
+ super(task, message);
+ this.task = task;
+ this.plugin = plugin;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+};
+init_git_response_error();
+init_task_configuration_error();
+init_check_is_repo();
+init_clean();
+init_config();
+init_grep();
+init_reset();
+init_utils();
+function commandConfigPrefixingPlugin(configuration) {
+ const prefix = prefixedArray(configuration, "-c");
+ return {
+ type: "spawn.args",
+ action(data) {
+ return [...prefix, ...data];
+ }
+ };
+}
+init_utils();
+var never = (0, import_promise_deferred2.deferred)().promise;
+function completionDetectionPlugin({
+ onClose = true,
+ onExit = 50
+} = {}) {
+ function createEvents() {
+ let exitCode = -1;
+ const events = {
+ close: (0, import_promise_deferred2.deferred)(),
+ closeTimeout: (0, import_promise_deferred2.deferred)(),
+ exit: (0, import_promise_deferred2.deferred)(),
+ exitTimeout: (0, import_promise_deferred2.deferred)()
+ };
+ const result = Promise.race([
+ onClose === false ? never : events.closeTimeout.promise,
+ onExit === false ? never : events.exitTimeout.promise
+ ]);
+ configureTimeout(onClose, events.close, events.closeTimeout);
+ configureTimeout(onExit, events.exit, events.exitTimeout);
+ return {
+ close(code) {
+ exitCode = code;
+ events.close.done();
+ },
+ exit(code) {
+ exitCode = code;
+ events.exit.done();
+ },
+ get exitCode() {
+ return exitCode;
+ },
+ result
+ };
+ }
+ function configureTimeout(flag, event, timeout) {
+ if (flag === false) {
+ return;
+ }
+ (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
+ }
+ return {
+ type: "spawn.after",
+ action(_0, _1) {
+ return __async2(this, arguments, function* (_data, { spawned, close }) {
+ var _a2, _b;
+ const events = createEvents();
+ let deferClose = true;
+ let quickClose = () => void (deferClose = false);
+ (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose);
+ (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose);
+ spawned.on("error", quickClose);
+ spawned.on("close", (code) => events.close(code));
+ spawned.on("exit", (code) => events.exit(code));
+ try {
+ yield events.result;
+ if (deferClose) {
+ yield delay(50);
+ }
+ close(events.exitCode);
+ } catch (err) {
+ close(events.exitCode, err);
+ }
+ });
+ }
+ };
+}
+init_git_error();
+function isTaskError(result) {
+ return !!(result.exitCode && result.stdErr.length);
+}
+function getErrorMessage(result) {
+ return Buffer.concat([...result.stdOut, ...result.stdErr]);
+}
+function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
+ return (error, result) => {
+ if (!overwrite && error || !isError(result)) {
+ return error;
+ }
+ return errorMessage(result);
+ };
+}
+function errorDetectionPlugin(config) {
+ return {
+ type: "task.error",
+ action(data, context) {
+ const error = config(data.error, {
+ stdErr: context.stdErr,
+ stdOut: context.stdOut,
+ exitCode: context.exitCode
+ });
+ if (Buffer.isBuffer(error)) {
+ return { error: new GitError(void 0, error.toString("utf-8")) };
+ }
+ return {
+ error
+ };
+ }
+ };
+}
+init_utils();
+var PluginStore = class {
+ constructor() {
+ this.plugins = /* @__PURE__ */ new Set();
+ }
+ add(plugin) {
+ const plugins = [];
+ asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
+ return () => {
+ plugins.forEach((plugin2) => this.plugins.delete(plugin2));
+ };
+ }
+ exec(type, data, context) {
+ let output = data;
+ const contextual = Object.freeze(Object.create(context));
+ for (const plugin of this.plugins) {
+ if (plugin.type === type) {
+ output = plugin.action(output, contextual);
+ }
+ }
+ return output;
+ }
+};
+init_utils();
+function progressMonitorPlugin(progress) {
+ const progressCommand = "--progress";
+ const progressMethods = ["checkout", "clone", "fetch", "pull", "push"];
+ const onProgress = {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2;
+ if (!context.commands.includes(progressCommand)) {
+ return;
+ }
+ (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => {
+ const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
+ if (!message) {
+ return;
+ }
+ progress({
+ method: context.method,
+ stage: progressEventStage(message[1]),
+ progress: asNumber(message[2]),
+ processed: asNumber(message[3]),
+ total: asNumber(message[4])
+ });
+ });
+ }
+ };
+ const onArgs = {
+ type: "spawn.args",
+ action(args, context) {
+ if (!progressMethods.includes(context.method)) {
+ return args;
+ }
+ return including(args, progressCommand);
+ }
+ };
+ return [onArgs, onProgress];
+}
+function progressEventStage(input) {
+ return String(input.toLowerCase().split(" ", 1)) || "unknown";
+}
+init_utils();
+function spawnOptionsPlugin(spawnOptions) {
+ const options = pick(spawnOptions, ["uid", "gid"]);
+ return {
+ type: "spawn.options",
+ action(data) {
+ return __spreadValues2(__spreadValues2({}, options), data);
+ }
+ };
+}
+function timeoutPlugin({ block }) {
+ if (block > 0) {
+ return {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2, _b;
+ let timeout;
+ function wait3() {
+ timeout && clearTimeout(timeout);
+ timeout = setTimeout(kill, block);
+ }
+ function stop() {
+ var _a3, _b2;
+ (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait3);
+ (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait3);
+ context.spawned.off("exit", stop);
+ context.spawned.off("close", stop);
+ timeout && clearTimeout(timeout);
+ }
+ function kill() {
+ stop();
+ context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
+ }
+ (_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait3);
+ (_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait3);
+ context.spawned.on("exit", stop);
+ context.spawned.on("close", stop);
+ wait3();
+ }
+ };
+ }
+}
+init_utils();
+var Git = require_git();
+function gitInstanceFactory(baseDir, options) {
+ const plugins = new PluginStore();
+ const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options);
+ if (!folderExists(config.baseDir)) {
+ throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
+ }
+ if (Array.isArray(config.config)) {
+ plugins.add(commandConfigPrefixingPlugin(config.config));
+ }
+ plugins.add(completionDetectionPlugin(config.completion));
+ config.progress && plugins.add(progressMonitorPlugin(config.progress));
+ config.timeout && plugins.add(timeoutPlugin(config.timeout));
+ config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
+ plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
+ config.errors && plugins.add(errorDetectionPlugin(config.errors));
+ return new Git(config, plugins);
+}
+init_git_response_error();
+var esm_default = gitInstanceFactory;
+
+// src/gitManager.ts
+var GitManager = class {
+ constructor(plugin) {
+ this.plugin = plugin;
+ this.app = plugin.app;
+ }
+ getTreeStructure(children2, beginLength = 0) {
+ let list = [];
+ children2 = [...children2];
+ while (children2.length > 0) {
+ const first2 = children2.first();
+ const restPath = first2.path.substring(beginLength);
+ if (restPath.contains("/")) {
+ const title = restPath.substring(0, restPath.indexOf("/"));
+ const childrenWithSameTitle = children2.filter((item) => {
+ return item.path.substring(beginLength).startsWith(title + "/");
+ });
+ childrenWithSameTitle.forEach((item) => children2.remove(item));
+ list.push({
+ title,
+ children: this.getTreeStructure(childrenWithSameTitle, (beginLength > 0 ? beginLength + title.length : title.length) + 1)
+ });
+ } else {
+ list.push({ title: restPath, statusResult: first2 });
+ children2.remove(first2);
+ }
+ }
+ return list;
+ }
+ formatCommitMessage(template) {
+ return __async(this, null, function* () {
+ let status;
+ if (template.includes("{{numFiles}}")) {
+ status = yield this.status();
+ let numFiles = status.staged.length;
+ template = template.replace("{{numFiles}}", String(numFiles));
+ }
+ if (template.includes("{{hostname}}")) {
+ const hostname = localStorage.getItem(this.plugin.manifest.id + ":hostname") || "";
+ template = template.replace("{{hostname}}", hostname);
+ }
+ if (template.includes("{{files}}")) {
+ status = status != null ? status : yield this.status();
+ let changeset = {};
+ status.staged.forEach((value) => {
+ if (value.index in changeset) {
+ changeset[value.index].push(value.path);
+ } else {
+ changeset[value.index] = [value.path];
+ }
+ });
+ let chunks = [];
+ for (let [action, files2] of Object.entries(changeset)) {
+ chunks.push(action + " " + files2.join(" "));
+ }
+ let files = chunks.join(", ");
+ template = template.replace("{{files}}", files);
+ }
+ let moment = window.moment;
+ template = template.replace("{{date}}", moment().format(this.plugin.settings.commitDateFormat));
+ if (this.plugin.settings.listChangedFilesInMessageBody) {
+ template = template + "\n\nAffected files:\n" + (status != null ? status : yield this.status()).staged.map((e) => e.path).join("\n");
+ }
+ return template;
+ });
+ }
+};
+
+// src/simpleGit.ts
+var SimpleGit = class extends GitManager {
+ constructor(plugin) {
+ super(plugin);
+ }
+ setGitInstance(ignoreError = false) {
+ return __async(this, null, function* () {
+ if (this.isGitInstalled()) {
+ const adapter = this.app.vault.adapter;
+ const path3 = adapter.getBasePath();
+ let basePath = path3;
+ if (this.plugin.settings.basePath) {
+ const exists2 = yield adapter.exists((0, import_obsidian6.normalizePath)(this.plugin.settings.basePath));
+ if (exists2) {
+ basePath = path3 + import_path.sep + this.plugin.settings.basePath;
+ } else if (!ignoreError) {
+ new import_obsidian6.Notice("ObsidianGit: Base path does not exist");
+ }
+ }
+ this.git = esm_default({
+ baseDir: basePath,
+ binary: this.plugin.settings.gitPath || void 0,
+ config: ["core.quotepath=off"]
+ });
+ this.git.cwd(yield this.git.revparse("--show-toplevel"));
+ }
+ });
+ }
+ status() {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.status);
+ const status = yield this.git.status((err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ return {
+ changed: status.files.filter((e) => e.working_dir !== " ").map((e) => {
+ const res = this.formatPath(e);
+ return {
+ path: res.path,
+ from: res.from,
+ working_dir: e.working_dir === "?" ? "U" : e.working_dir,
+ vault_path: this.getVaultPath(res.path)
+ };
+ }),
+ staged: status.files.filter((e) => e.index !== " " && e.index != "?").map((e) => {
+ const res = this.formatPath(e, e.index === "R");
+ return {
+ path: res.path,
+ from: res.from,
+ index: e.index,
+ vault_path: this.getVaultPath(res.path)
+ };
+ }),
+ conflicted: status.conflicted.map((e) => this.formatPath({
+ path: e,
+ from: void 0,
+ index: void 0,
+ working_dir: void 0
+ }).path)
+ };
+ });
+ }
+ getVaultPath(path3) {
+ if (this.plugin.settings.basePath) {
+ return this.plugin.settings.basePath + "/" + path3;
+ } else {
+ return path3;
+ }
+ }
+ formatPath(path3, renamed = false) {
+ function format(path4) {
+ if (path4 == void 0)
+ return void 0;
+ if (path4.startsWith('"') && path4.endsWith('"')) {
+ return path4.substring(1, path4.length - 1);
+ } else {
+ return path4;
+ }
+ }
+ if (renamed) {
+ return {
+ from: format(path3.from),
+ path: format(path3.path)
+ };
+ } else {
+ return {
+ path: format(path3.path)
+ };
+ }
+ }
+ commitAll(message) {
+ return __async(this, null, function* () {
+ if (this.plugin.settings.updateSubmodules) {
+ this.plugin.setState(PluginState.commit);
+ yield new Promise((resolve, reject) => __async(this, null, function* () {
+ this.git.outputHandler((cmd, stdout, stderr, args) => __async(this, null, function* () {
+ if (!(args.contains("submodule") && args.contains("foreach")))
+ return;
+ let body = "";
+ let root = this.app.vault.adapter.getBasePath() + (this.plugin.settings.basePath ? "/" + this.plugin.settings.basePath : "");
+ stdout.on("data", (chunk) => {
+ body += chunk.toString("utf8");
+ });
+ stdout.on("end", () => __async(this, null, function* () {
+ let submods = body.split("\n");
+ submods = submods.map((i) => {
+ let submod = i.match(/'([^']*)'/);
+ if (submod != void 0) {
+ return root + "/" + submod[1] + import_path.sep;
+ }
+ });
+ submods.reverse();
+ for (const item of submods) {
+ if (item != void 0) {
+ yield this.git.cwd({ path: item, root: false }).add("-A", (err) => this.onError(err));
+ yield this.git.cwd({ path: item, root: false }).commit(yield this.formatCommitMessage(message), (err) => this.onError(err));
+ }
+ }
+ resolve();
+ }));
+ }));
+ yield this.git.subModule(["foreach", "--recursive", ""]);
+ this.git.outputHandler(() => {
+ });
+ }));
+ }
+ this.plugin.setState(PluginState.add);
+ yield this.git.add("-A", (err) => this.onError(err));
+ this.plugin.setState(PluginState.commit);
+ return (yield this.git.commit(yield this.formatCommitMessage(message), (err) => this.onError(err))).summary.changes;
+ });
+ }
+ commit(message) {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.commit);
+ const res = (yield this.git.commit(yield this.formatCommitMessage(message), (err) => this.onError(err))).summary.changes;
+ this.plugin.setState(PluginState.idle);
+ return res;
+ });
+ }
+ stage(filepath) {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.add);
+ yield this.git.add(["--", filepath], (err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ });
+ }
+ stageAll() {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.add);
+ yield this.git.add("-A", (err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ });
+ }
+ unstageAll() {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.add);
+ yield this.git.reset([], (err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ });
+ }
+ unstage(filepath) {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.add);
+ yield this.git.reset(["--", filepath], (err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ });
+ }
+ discard(filepath) {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.add);
+ yield this.git.checkout(["--", filepath], (err) => this.onError(err));
+ this.plugin.setState(PluginState.idle);
+ });
+ }
+ pull() {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.pull);
+ if (this.plugin.settings.updateSubmodules)
+ yield this.git.subModule(["update", "--remote", "--merge", "--recursive"], (err) => this.onError(err));
+ const branchInfo = yield this.branchInfo();
+ const localCommit = yield this.git.revparse([branchInfo.current], (err) => this.onError(err));
+ yield this.git.fetch((err) => this.onError(err));
+ const upstreamCommit = yield this.git.revparse([branchInfo.tracking], (err) => this.onError(err));
+ if (localCommit !== upstreamCommit) {
+ if (this.plugin.settings.syncMethod === "merge" || this.plugin.settings.syncMethod === "rebase") {
+ try {
+ switch (this.plugin.settings.syncMethod) {
+ case "merge":
+ yield this.git.merge([branchInfo.tracking]);
+ break;
+ case "rebase":
+ yield this.git.rebase([branchInfo.tracking]);
+ }
+ } catch (err) {
+ this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${err.message}`);
+ return;
+ }
+ } else if (this.plugin.settings.syncMethod === "reset") {
+ try {
+ yield this.git.raw(["update-ref", `refs/heads/${branchInfo.current}`, upstreamCommit], (err) => this.onError(err));
+ yield this.unstageAll();
+ } catch (err) {
+ this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${err.message}`);
+ }
+ }
+ const afterMergeCommit = yield this.git.revparse([branchInfo.current], (err) => this.onError(err));
+ const filesChanged = yield this.git.diff([`${localCommit}..${afterMergeCommit}`, "--name-only"]);
+ return filesChanged.split(/\r\n|\r|\n/).filter((value) => value.length > 0).length;
+ } else {
+ return 0;
+ }
+ });
+ }
+ push() {
+ return __async(this, null, function* () {
+ this.plugin.setState(PluginState.status);
+ const status = yield this.git.status();
+ const trackingBranch = status.tracking;
+ const currentBranch = status.current;
+ const remoteChangedFiles = (yield this.git.diffSummary([currentBranch, trackingBranch], (err) => this.onError(err))).changed;
+ this.plugin.setState(PluginState.push);
+ if (this.plugin.settings.updateSubmodules) {
+ yield this.git.env(__spreadProps(__spreadValues({}, process.env), { "OBSIDIAN_GIT": 1 })).subModule(["foreach", "--recursive", `tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`], (err) => this.onError(err));
+ }
+ yield this.git.env(__spreadProps(__spreadValues({}, process.env), { "OBSIDIAN_GIT": 1 })).push((err) => this.onError(err));
+ return remoteChangedFiles;
+ });
+ }
+ canPush() {
+ return __async(this, null, function* () {
+ if (this.plugin.settings.updateSubmodules === true) {
+ return true;
+ }
+ const status = yield this.git.status((err) => this.onError(err));
+ const trackingBranch = status.tracking;
+ const currentBranch = status.current;
+ const remoteChangedFiles = (yield this.git.diffSummary([currentBranch, trackingBranch])).changed;
+ return remoteChangedFiles !== 0;
+ });
+ }
+ checkRequirements() {
+ return __async(this, null, function* () {
+ if (!this.isGitInstalled()) {
+ return "missing-git";
+ }
+ if (!(yield this.git.checkIsRepo())) {
+ return "missing-repo";
+ }
+ return "valid";
+ });
+ }
+ branchInfo() {
+ return __async(this, null, function* () {
+ const status = yield this.git.status((err) => this.onError(err));
+ const branches = yield this.git.branch(["--no-color"], (err) => this.onError(err));
+ return {
+ current: status.current,
+ tracking: status.tracking,
+ branches: branches.all
+ };
+ });
+ }
+ log(file, relativeToRepo = false) {
+ return __async(this, null, function* () {
+ const path3 = relativeToRepo && this.plugin.settings.basePath ? file : file == null ? void 0 : file.substring(this.plugin.settings.basePath.length + 1);
+ const res = yield this.git.log({ file: path3 }, (err) => this.onError(err));
+ return res.all;
+ });
+ }
+ show(commitHash, file, relativeToRepo = false) {
+ return __async(this, null, function* () {
+ const path3 = relativeToRepo && this.plugin.settings.basePath ? file : file.substring(this.plugin.settings.basePath.length + 1);
+ return this.git.show([commitHash + ":" + path3], (err) => this.onError(err));
+ });
+ }
+ checkout(branch) {
+ return __async(this, null, function* () {
+ yield this.git.checkout(branch, (err) => this.onError(err));
+ });
+ }
+ init() {
+ return __async(this, null, function* () {
+ yield this.git.init(false, (err) => this.onError(err));
+ });
+ }
+ clone(url, dir) {
+ return __async(this, null, function* () {
+ yield this.git.clone(url, path.join(this.app.vault.adapter.getBasePath(), dir), [], (err) => this.onError(err));
+ });
+ }
+ setConfig(path3, value) {
+ return __async(this, null, function* () {
+ yield this.git.addConfig(path3, value, (err) => this.onError(err));
+ });
+ }
+ getConfig(path3) {
+ return __async(this, null, function* () {
+ const config = yield this.git.listConfig((err) => this.onError(err));
+ return config.all[path3];
+ });
+ }
+ fetch(remote) {
+ return __async(this, null, function* () {
+ yield this.git.fetch(remote != void 0 ? [remote] : [], (err) => this.onError(err));
+ });
+ }
+ setRemote(name, url) {
+ return __async(this, null, function* () {
+ if ((yield this.getRemotes()).includes(name))
+ yield this.git.remote(["set-url", name, url], (err) => this.onError(err));
+ else {
+ yield this.git.remote(["add", name, url], (err) => this.onError(err));
+ }
+ });
+ }
+ getRemoteBranches(remote) {
+ return __async(this, null, function* () {
+ const res = yield this.git.branch(["-r", "--list", `${remote}*`], (err) => this.onError(err));
+ const list = [];
+ for (var item in res.branches) {
+ list.push(res.branches[item].name);
+ }
+ return list;
+ });
+ }
+ getRemotes() {
+ return __async(this, null, function* () {
+ const res = yield this.git.remote([], (err) => this.onError(err));
+ if (res) {
+ return res.trim().split("\n");
+ } else {
+ return [];
+ }
+ });
+ }
+ removeRemote(remoteName) {
+ return __async(this, null, function* () {
+ yield this.git.removeRemote(remoteName);
+ });
+ }
+ updateUpstreamBranch(remoteBranch) {
+ return __async(this, null, function* () {
+ yield this.git.push(["--set-upstream", ...remoteBranch.split("/")], (err) => this.onError(err));
+ });
+ }
+ updateGitPath(gitPath) {
+ this.setGitInstance();
+ }
+ updateBasePath(basePath) {
+ this.setGitInstance(true);
+ }
+ getDiffString(filePath, stagedChanges = false) {
+ return __async(this, null, function* () {
+ if (stagedChanges)
+ return yield this.git.diff(["--cached", "--", filePath]);
+ else
+ return yield this.git.diff(["--", filePath]);
+ });
+ }
+ diff(file, commit1, commit2) {
+ return __async(this, null, function* () {
+ return yield this.git.diff([`${commit1}..${commit2}`, "--", file]);
+ });
+ }
+ isGitInstalled() {
+ const command = (0, import_child_process2.spawnSync)(this.plugin.settings.gitPath || "git", ["--version"], {
+ stdio: "ignore"
+ });
+ if (command.error) {
+ console.error(command.error);
+ return false;
+ }
+ return true;
+ }
+ onError(error) {
+ if (error) {
+ let networkFailure = error.message.contains("Could not resolve host");
+ if (!networkFailure) {
+ this.plugin.displayError(error.message);
+ this.plugin.setState(PluginState.idle);
+ } else if (!this.plugin.offlineMode) {
+ this.plugin.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.", 2e3);
+ }
+ if (networkFailure) {
+ this.plugin.offlineMode = true;
+ this.plugin.setState(PluginState.idle);
+ }
+ }
+ }
+};
+
+// src/ui/diff/diffView.ts
+var import_diff2html = __toModule(require_diff2html());
+var import_obsidian7 = __toModule(require("obsidian"));
+var DiffView = class extends import_obsidian7.ItemView {
+ constructor(leaf, plugin) {
+ super(leaf);
+ this.plugin = plugin;
+ this.gettingDiff = false;
+ this.parser = new DOMParser();
+ addEventListener("git-refresh", this.refresh.bind(this));
+ }
+ getViewType() {
+ return DIFF_VIEW_CONFIG.type;
+ }
+ getDisplayText() {
+ return DIFF_VIEW_CONFIG.name;
+ }
+ getIcon() {
+ return DIFF_VIEW_CONFIG.icon;
+ }
+ setState(state, result) {
+ return __async(this, null, function* () {
+ this.state = state;
+ yield this.refresh();
+ return;
+ });
+ }
+ getState() {
+ return this.state;
+ }
+ onClose() {
+ removeEventListener("git-refresh", this.refresh.bind(this));
+ return super.onClose();
+ }
+ onOpen() {
+ this.refresh();
+ return super.onOpen();
+ }
+ refresh() {
+ return __async(this, null, function* () {
+ var _a2;
+ if (((_a2 = this.state) == null ? void 0 : _a2.file) && !this.gettingDiff && this.plugin.gitManager) {
+ this.gettingDiff = true;
+ const diff = this.parser.parseFromString((0, import_diff2html.html)(yield this.plugin.gitManager.getDiffString(this.state.file, this.state.staged)), "text/html").querySelector(".d2h-file-diff");
+ this.contentEl.empty();
+ if (diff) {
+ this.contentEl.append(diff);
+ } else {
+ const div = this.contentEl.createDiv({ cls: "diff-err" });
+ div.createSpan({ text: "\u26A0\uFE0F", cls: "diff-err-sign" });
+ div.createEl("br");
+ div.createSpan({ text: "No changes to " + this.state.file });
+ }
+ this.gettingDiff = false;
+ }
+ });
+ }
+};
+
+// src/ui/modals/generalModal.ts
+var import_obsidian8 = __toModule(require("obsidian"));
+var GeneralModal = class extends import_obsidian8.SuggestModal {
+ constructor(app2, remotes, placeholder) {
+ super(app2);
+ this.resolve = null;
+ this.list = remotes;
+ this.setPlaceholder(placeholder);
+ }
+ open() {
+ super.open();
+ return new Promise((resolve) => {
+ this.resolve = resolve;
+ });
+ }
+ selectSuggestion(value, evt) {
+ if (this.resolve)
+ this.resolve(value);
+ super.selectSuggestion(value, evt);
+ }
+ onClose() {
+ if (this.resolve)
+ this.resolve(void 0);
+ }
+ getSuggestions(query) {
+ return [query.length > 0 ? query : "...", ...this.list];
+ }
+ renderSuggestion(value, el) {
+ el.innerText = value;
+ }
+ onChooseSuggestion(item, _) {
+ }
+};
+
+// src/ui/sidebar/sidebarView.ts
+var import_obsidian14 = __toModule(require("obsidian"));
+
+// node_modules/svelte/internal/index.mjs
+function noop() {
+}
+var identity = (x) => x;
+function run(fn) {
+ return fn();
+}
+function blank_object() {
+ return Object.create(null);
+}
+function run_all(fns) {
+ fns.forEach(run);
+}
+function is_function(thing) {
+ return typeof thing === "function";
+}
+function safe_not_equal(a, b) {
+ return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");
+}
+function is_empty(obj) {
+ return Object.keys(obj).length === 0;
+}
+var is_client = typeof window !== "undefined";
+var now = is_client ? () => window.performance.now() : () => Date.now();
+var raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;
+var tasks = new Set();
+function run_tasks(now2) {
+ tasks.forEach((task) => {
+ if (!task.c(now2)) {
+ tasks.delete(task);
+ task.f();
+ }
+ });
+ if (tasks.size !== 0)
+ raf(run_tasks);
+}
+function loop(callback) {
+ let task;
+ if (tasks.size === 0)
+ raf(run_tasks);
+ return {
+ promise: new Promise((fulfill) => {
+ tasks.add(task = { c: callback, f: fulfill });
+ }),
+ abort() {
+ tasks.delete(task);
+ }
+ };
+}
+var is_hydrating = false;
+function start_hydrating() {
+ is_hydrating = true;
+}
+function end_hydrating() {
+ is_hydrating = false;
+}
+function append2(target, node) {
+ target.appendChild(node);
+}
+function append_styles(target, style_sheet_id, styles) {
+ const append_styles_to = get_root_for_style(target);
+ if (!append_styles_to.getElementById(style_sheet_id)) {
+ const style = element("style");
+ style.id = style_sheet_id;
+ style.textContent = styles;
+ append_stylesheet(append_styles_to, style);
+ }
+}
+function get_root_for_style(node) {
+ if (!node)
+ return document;
+ const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
+ if (root && root.host) {
+ return root;
+ }
+ return node.ownerDocument;
+}
+function append_empty_stylesheet(node) {
+ const style_element = element("style");
+ append_stylesheet(get_root_for_style(node), style_element);
+ return style_element.sheet;
+}
+function append_stylesheet(node, style) {
+ append2(node.head || node, style);
+}
+function insert(target, node, anchor) {
+ target.insertBefore(node, anchor || null);
+}
+function detach(node) {
+ node.parentNode.removeChild(node);
+}
+function destroy_each(iterations, detaching) {
+ for (let i = 0; i < iterations.length; i += 1) {
+ if (iterations[i])
+ iterations[i].d(detaching);
+ }
+}
+function element(name) {
+ return document.createElement(name);
+}
+function text(data) {
+ return document.createTextNode(data);
+}
+function space() {
+ return text(" ");
+}
+function empty() {
+ return text("");
+}
+function listen(node, event, handler, options) {
+ node.addEventListener(event, handler, options);
+ return () => node.removeEventListener(event, handler, options);
+}
+function self2(fn) {
+ return function(event) {
+ if (event.target === this)
+ fn.call(this, event);
+ };
+}
+function attr(node, attribute, value) {
+ if (value == null)
+ node.removeAttribute(attribute);
+ else if (node.getAttribute(attribute) !== value)
+ node.setAttribute(attribute, value);
+}
+function children(element2) {
+ return Array.from(element2.childNodes);
+}
+function set_data(text2, data) {
+ data = "" + data;
+ if (text2.wholeText !== data)
+ text2.data = data;
+}
+function set_input_value(input, value) {
+ input.value = value == null ? "" : value;
+}
+function toggle_class(element2, name, toggle) {
+ element2.classList[toggle ? "add" : "remove"](name);
+}
+function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
+ const e = document.createEvent("CustomEvent");
+ e.initCustomEvent(type, bubbles, cancelable, detail);
+ return e;
+}
+var managed_styles = new Map();
+var active = 0;
+function hash(str) {
+ let hash2 = 5381;
+ let i = str.length;
+ while (i--)
+ hash2 = (hash2 << 5) - hash2 ^ str.charCodeAt(i);
+ return hash2 >>> 0;
+}
+function create_style_information(doc, node) {
+ const info = { stylesheet: append_empty_stylesheet(node), rules: {} };
+ managed_styles.set(doc, info);
+ return info;
+}
+function create_rule(node, a, b, duration, delay2, ease, fn, uid = 0) {
+ const step = 16.666 / duration;
+ let keyframes = "{\n";
+ for (let p = 0; p <= 1; p += step) {
+ const t = a + (b - a) * ease(p);
+ keyframes += p * 100 + `%{${fn(t, 1 - t)}}
+`;
+ }
+ const rule = keyframes + `100% {${fn(b, 1 - b)}}
+}`;
+ const name = `__svelte_${hash(rule)}_${uid}`;
+ const doc = get_root_for_style(node);
+ const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);
+ if (!rules[name]) {
+ rules[name] = true;
+ stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);
+ }
+ const animation = node.style.animation || "";
+ node.style.animation = `${animation ? `${animation}, ` : ""}${name} ${duration}ms linear ${delay2}ms 1 both`;
+ active += 1;
+ return name;
+}
+function delete_rule(node, name) {
+ const previous = (node.style.animation || "").split(", ");
+ const next = previous.filter(name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1);
+ const deleted = previous.length - next.length;
+ if (deleted) {
+ node.style.animation = next.join(", ");
+ active -= deleted;
+ if (!active)
+ clear_rules();
+ }
+}
+function clear_rules() {
+ raf(() => {
+ if (active)
+ return;
+ managed_styles.forEach((info) => {
+ const { stylesheet } = info;
+ let i = stylesheet.cssRules.length;
+ while (i--)
+ stylesheet.deleteRule(i);
+ info.rules = {};
+ });
+ managed_styles.clear();
+ });
+}
+var current_component;
+function set_current_component(component) {
+ current_component = component;
+}
+function get_current_component() {
+ if (!current_component)
+ throw new Error("Function called outside component initialization");
+ return current_component;
+}
+function onDestroy(fn) {
+ get_current_component().$$.on_destroy.push(fn);
+}
+function bubble(component, event) {
+ const callbacks = component.$$.callbacks[event.type];
+ if (callbacks) {
+ callbacks.slice().forEach((fn) => fn.call(this, event));
+ }
+}
+var dirty_components = [];
+var binding_callbacks = [];
+var render_callbacks = [];
+var flush_callbacks = [];
+var resolved_promise = Promise.resolve();
+var update_scheduled = false;
+function schedule_update() {
+ if (!update_scheduled) {
+ update_scheduled = true;
+ resolved_promise.then(flush);
+ }
+}
+function add_render_callback(fn) {
+ render_callbacks.push(fn);
+}
+var seen_callbacks = new Set();
+var flushidx = 0;
+function flush() {
+ const saved_component = current_component;
+ do {
+ while (flushidx < dirty_components.length) {
+ const component = dirty_components[flushidx];
+ flushidx++;
+ set_current_component(component);
+ update(component.$$);
+ }
+ set_current_component(null);
+ dirty_components.length = 0;
+ flushidx = 0;
+ while (binding_callbacks.length)
+ binding_callbacks.pop()();
+ for (let i = 0; i < render_callbacks.length; i += 1) {
+ const callback = render_callbacks[i];
+ if (!seen_callbacks.has(callback)) {
+ seen_callbacks.add(callback);
+ callback();
+ }
+ }
+ render_callbacks.length = 0;
+ } while (dirty_components.length);
+ while (flush_callbacks.length) {
+ flush_callbacks.pop()();
+ }
+ update_scheduled = false;
+ seen_callbacks.clear();
+ set_current_component(saved_component);
+}
+function update($$) {
+ if ($$.fragment !== null) {
+ $$.update();
+ run_all($$.before_update);
+ const dirty = $$.dirty;
+ $$.dirty = [-1];
+ $$.fragment && $$.fragment.p($$.ctx, dirty);
+ $$.after_update.forEach(add_render_callback);
+ }
+}
+var promise;
+function wait() {
+ if (!promise) {
+ promise = Promise.resolve();
+ promise.then(() => {
+ promise = null;
+ });
+ }
+ return promise;
+}
+function dispatch(node, direction, kind) {
+ node.dispatchEvent(custom_event(`${direction ? "intro" : "outro"}${kind}`));
+}
+var outroing = new Set();
+var outros;
+function group_outros() {
+ outros = {
+ r: 0,
+ c: [],
+ p: outros
+ };
+}
+function check_outros() {
+ if (!outros.r) {
+ run_all(outros.c);
+ }
+ outros = outros.p;
+}
+function transition_in(block, local) {
+ if (block && block.i) {
+ outroing.delete(block);
+ block.i(local);
+ }
+}
+function transition_out(block, local, detach2, callback) {
+ if (block && block.o) {
+ if (outroing.has(block))
+ return;
+ outroing.add(block);
+ outros.c.push(() => {
+ outroing.delete(block);
+ if (callback) {
+ if (detach2)
+ block.d(1);
+ callback();
+ }
+ });
+ block.o(local);
+ }
+}
+var null_transition = { duration: 0 };
+function create_bidirectional_transition(node, fn, params, intro) {
+ let config = fn(node, params);
+ let t = intro ? 0 : 1;
+ let running_program = null;
+ let pending_program = null;
+ let animation_name = null;
+ function clear_animation() {
+ if (animation_name)
+ delete_rule(node, animation_name);
+ }
+ function init2(program, duration) {
+ const d = program.b - t;
+ duration *= Math.abs(d);
+ return {
+ a: t,
+ b: program.b,
+ d,
+ duration,
+ start: program.start,
+ end: program.start + duration,
+ group: program.group
+ };
+ }
+ function go(b) {
+ const { delay: delay2 = 0, duration = 300, easing = identity, tick: tick2 = noop, css } = config || null_transition;
+ const program = {
+ start: now() + delay2,
+ b
+ };
+ if (!b) {
+ program.group = outros;
+ outros.r += 1;
+ }
+ if (running_program || pending_program) {
+ pending_program = program;
+ } else {
+ if (css) {
+ clear_animation();
+ animation_name = create_rule(node, t, b, duration, delay2, easing, css);
+ }
+ if (b)
+ tick2(0, 1);
+ running_program = init2(program, duration);
+ add_render_callback(() => dispatch(node, b, "start"));
+ loop((now2) => {
+ if (pending_program && now2 > pending_program.start) {
+ running_program = init2(pending_program, duration);
+ pending_program = null;
+ dispatch(node, running_program.b, "start");
+ if (css) {
+ clear_animation();
+ animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);
+ }
+ }
+ if (running_program) {
+ if (now2 >= running_program.end) {
+ tick2(t = running_program.b, 1 - t);
+ dispatch(node, running_program.b, "end");
+ if (!pending_program) {
+ if (running_program.b) {
+ clear_animation();
+ } else {
+ if (!--running_program.group.r)
+ run_all(running_program.group.c);
+ }
+ }
+ running_program = null;
+ } else if (now2 >= running_program.start) {
+ const p = now2 - running_program.start;
+ t = running_program.a + running_program.d * easing(p / running_program.duration);
+ tick2(t, 1 - t);
+ }
+ }
+ return !!(running_program || pending_program);
+ });
+ }
+ }
+ return {
+ run(b) {
+ if (is_function(config)) {
+ wait().then(() => {
+ config = config();
+ go(b);
+ });
+ } else {
+ go(b);
+ }
+ },
+ end() {
+ clear_animation();
+ running_program = pending_program = null;
+ }
+ };
+}
+var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : global;
+var boolean_attributes = new Set([
+ "allowfullscreen",
+ "allowpaymentrequest",
+ "async",
+ "autofocus",
+ "autoplay",
+ "checked",
+ "controls",
+ "default",
+ "defer",
+ "disabled",
+ "formnovalidate",
+ "hidden",
+ "ismap",
+ "loop",
+ "multiple",
+ "muted",
+ "nomodule",
+ "novalidate",
+ "open",
+ "playsinline",
+ "readonly",
+ "required",
+ "reversed",
+ "selected"
+]);
+function create_component(block) {
+ block && block.c();
+}
+function mount_component(component, target, anchor, customElement) {
+ const { fragment, on_mount, on_destroy, after_update } = component.$$;
+ fragment && fragment.m(target, anchor);
+ if (!customElement) {
+ add_render_callback(() => {
+ const new_on_destroy = on_mount.map(run).filter(is_function);
+ if (on_destroy) {
+ on_destroy.push(...new_on_destroy);
+ } else {
+ run_all(new_on_destroy);
+ }
+ component.$$.on_mount = [];
+ });
+ }
+ after_update.forEach(add_render_callback);
+}
+function destroy_component(component, detaching) {
+ const $$ = component.$$;
+ if ($$.fragment !== null) {
+ run_all($$.on_destroy);
+ $$.fragment && $$.fragment.d(detaching);
+ $$.on_destroy = $$.fragment = null;
+ $$.ctx = [];
+ }
+}
+function make_dirty(component, i) {
+ if (component.$$.dirty[0] === -1) {
+ dirty_components.push(component);
+ schedule_update();
+ component.$$.dirty.fill(0);
+ }
+ component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
+}
+function init(component, options, instance5, create_fragment5, not_equal, props, append_styles2, dirty = [-1]) {
+ const parent_component = current_component;
+ set_current_component(component);
+ const $$ = component.$$ = {
+ fragment: null,
+ ctx: null,
+ props,
+ update: noop,
+ not_equal,
+ bound: blank_object(),
+ on_mount: [],
+ on_destroy: [],
+ on_disconnect: [],
+ before_update: [],
+ after_update: [],
+ context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
+ callbacks: blank_object(),
+ dirty,
+ skip_bound: false,
+ root: options.target || parent_component.$$.root
+ };
+ append_styles2 && append_styles2($$.root);
+ let ready2 = false;
+ $$.ctx = instance5 ? instance5(component, options.props || {}, (i, ret, ...rest) => {
+ const value = rest.length ? rest[0] : ret;
+ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
+ if (!$$.skip_bound && $$.bound[i])
+ $$.bound[i](value);
+ if (ready2)
+ make_dirty(component, i);
+ }
+ return ret;
+ }) : [];
+ $$.update();
+ ready2 = true;
+ run_all($$.before_update);
+ $$.fragment = create_fragment5 ? create_fragment5($$.ctx) : false;
+ if (options.target) {
+ if (options.hydrate) {
+ start_hydrating();
+ const nodes = children(options.target);
+ $$.fragment && $$.fragment.l(nodes);
+ nodes.forEach(detach);
+ } else {
+ $$.fragment && $$.fragment.c();
+ }
+ if (options.intro)
+ transition_in(component.$$.fragment);
+ mount_component(component, options.target, options.anchor, options.customElement);
+ end_hydrating();
+ flush();
+ }
+ set_current_component(parent_component);
+}
+var SvelteElement;
+if (typeof HTMLElement === "function") {
+ SvelteElement = class extends HTMLElement {
+ constructor() {
+ super();
+ this.attachShadow({ mode: "open" });
+ }
+ connectedCallback() {
+ const { on_mount } = this.$$;
+ this.$$.on_disconnect = on_mount.map(run).filter(is_function);
+ for (const key2 in this.$$.slotted) {
+ this.appendChild(this.$$.slotted[key2]);
+ }
+ }
+ attributeChangedCallback(attr2, _oldValue, newValue) {
+ this[attr2] = newValue;
+ }
+ disconnectedCallback() {
+ run_all(this.$$.on_disconnect);
+ }
+ $destroy() {
+ destroy_component(this, 1);
+ this.$destroy = noop;
+ }
+ $on(type, callback) {
+ const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
+ callbacks.push(callback);
+ return () => {
+ const index = callbacks.indexOf(callback);
+ if (index !== -1)
+ callbacks.splice(index, 1);
+ };
+ }
+ $set($$props) {
+ if (this.$$set && !is_empty($$props)) {
+ this.$$.skip_bound = true;
+ this.$$set($$props);
+ this.$$.skip_bound = false;
+ }
+ }
+ };
+}
+var SvelteComponent = class {
+ $destroy() {
+ destroy_component(this, 1);
+ this.$destroy = noop;
+ }
+ $on(type, callback) {
+ const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
+ callbacks.push(callback);
+ return () => {
+ const index = callbacks.indexOf(callback);
+ if (index !== -1)
+ callbacks.splice(index, 1);
+ };
+ }
+ $set($$props) {
+ if (this.$$set && !is_empty($$props)) {
+ this.$$.skip_bound = true;
+ this.$$set($$props);
+ this.$$.skip_bound = false;
+ }
+ }
+};
+
+// node_modules/tslib/modules/index.js
+var import_tslib = __toModule(require_tslib());
+var {
+ __extends,
+ __assign,
+ __rest,
+ __decorate,
+ __param,
+ __metadata,
+ __awaiter,
+ __generator,
+ __exportStar,
+ __createBinding,
+ __values,
+ __read,
+ __spread,
+ __spreadArrays,
+ __spreadArray,
+ __await,
+ __asyncGenerator,
+ __asyncDelegator,
+ __asyncValues,
+ __makeTemplateObject,
+ __importStar,
+ __importDefault,
+ __classPrivateFieldGet,
+ __classPrivateFieldSet,
+ __classPrivateFieldIn
+} = import_tslib.default;
+
+// src/ui/sidebar/gitView.svelte
+var import_obsidian13 = __toModule(require("obsidian"));
+
+// node_modules/svelte/easing/index.mjs
+function cubicOut(t) {
+ const f = t - 1;
+ return f * f * f + 1;
+}
+
+// node_modules/svelte/transition/index.mjs
+function slide(node, { delay: delay2 = 0, duration = 400, easing = cubicOut } = {}) {
+ const style = getComputedStyle(node);
+ const opacity = +style.opacity;
+ const height = parseFloat(style.height);
+ const padding_top = parseFloat(style.paddingTop);
+ const padding_bottom = parseFloat(style.paddingBottom);
+ const margin_top = parseFloat(style.marginTop);
+ const margin_bottom = parseFloat(style.marginBottom);
+ const border_top_width = parseFloat(style.borderTopWidth);
+ const border_bottom_width = parseFloat(style.borderBottomWidth);
+ return {
+ delay: delay2,
+ duration,
+ easing,
+ css: (t) => `overflow: hidden;opacity: ${Math.min(t * 20, 1) * opacity};height: ${t * height}px;padding-top: ${t * padding_top}px;padding-bottom: ${t * padding_bottom}px;margin-top: ${t * margin_top}px;margin-bottom: ${t * margin_bottom}px;border-top-width: ${t * border_top_width}px;border-bottom-width: ${t * border_bottom_width}px;`
+ };
+}
+
+// src/ui/sidebar/components/fileComponent.svelte
+var import_obsidian11 = __toModule(require("obsidian"));
+
+// node_modules/obsidian-community-lib/dist/utils.js
+var feather = __toModule(require_feather());
+var import_obsidian9 = __toModule(require("obsidian"));
+function hoverPreview(event, view, to) {
+ const targetEl = event.target;
+ app.workspace.trigger("hover-link", {
+ event,
+ source: view.getViewType(),
+ hoverParent: view,
+ targetEl,
+ linktext: to
+ });
+}
+function createNewMDNote(newName, currFilePath = "") {
+ return __async(this, null, function* () {
+ const newFileFolder = app.fileManager.getNewFileParent(currFilePath).path;
+ const newFilePath = (0, import_obsidian9.normalizePath)(`${newFileFolder}${newFileFolder === "/" ? "" : "/"}${addMD(newName)}`);
+ return yield app.vault.create(newFilePath, "");
+ });
+}
+var addMD = (noteName) => {
+ return noteName.match(/\.MD$|\.md$/m) ? noteName : noteName + ".md";
+};
+function openOrSwitch(_0, _1) {
+ return __async(this, arguments, function* (dest, event, options = { createNewFile: true }) {
+ const { workspace } = app;
+ let destFile = app.metadataCache.getFirstLinkpathDest(dest, "");
+ if (!destFile && options.createNewFile) {
+ destFile = yield createNewMDNote(dest);
+ } else if (!destFile && !options.createNewFile)
+ return;
+ const leavesWithDestAlreadyOpen = [];
+ workspace.iterateAllLeaves((leaf) => {
+ var _a2;
+ if (leaf.view instanceof import_obsidian9.MarkdownView) {
+ const file = (_a2 = leaf.view) === null || _a2 === void 0 ? void 0 : _a2.file;
+ if (file && file.basename + "." + file.extension === dest) {
+ leavesWithDestAlreadyOpen.push(leaf);
+ }
+ }
+ });
+ if (leavesWithDestAlreadyOpen.length > 0) {
+ workspace.setActiveLeaf(leavesWithDestAlreadyOpen[0]);
+ } else {
+ const mode = app.vault.getConfig("defaultViewMode");
+ const leaf = event.ctrlKey || event.getModifierState("Meta") ? workspace.splitActiveLeaf() : workspace.getUnpinnedLeaf();
+ yield leaf.openFile(destFile, { active: true, mode });
+ }
+ });
+}
+
+// src/ui/modals/discardModal.ts
+var import_obsidian10 = __toModule(require("obsidian"));
+var DiscardModal = class extends import_obsidian10.Modal {
+ constructor(app2, deletion, filename) {
+ super(app2);
+ this.deletion = deletion;
+ this.filename = filename;
+ this.resolve = null;
+ }
+ myOpen() {
+ this.open();
+ return new Promise((resolve) => {
+ this.resolve = resolve;
+ });
+ }
+ onOpen() {
+ let { contentEl, titleEl } = this;
+ titleEl.setText(`${this.deletion ? "Delete" : "Discard"} this file?`);
+ contentEl.createEl("h4").setText(`Do you really want to ${this.deletion ? "delete" : "discard the changes of"} "${this.filename}"`);
+ const div = contentEl.createDiv();
+ div.addClass("obsidian-git-center");
+ div.createEl("button", { text: "Cancel" }).addEventListener("click", () => {
+ if (this.resolve)
+ this.resolve(false);
+ return this.close();
+ });
+ div.createEl("button", {
+ cls: "mod-cta",
+ text: "Confirm"
+ }).addEventListener("click", () => __async(this, null, function* () {
+ if (this.resolve)
+ this.resolve(true);
+ this.close();
+ }));
+ }
+ onClose() {
+ let { contentEl } = this;
+ contentEl.empty();
+ }
+};
+
+// src/ui/sidebar/components/fileComponent.svelte
+function add_css(target) {
+ append_styles(target, "svelte-1furf50", "main.svelte-1furf50.svelte-1furf50.svelte-1furf50{cursor:pointer;background-color:var(--background-secondary);border-radius:4px;width:98%;display:flex;justify-content:space-between;font-size:0.8rem;margin-bottom:2px}main.svelte-1furf50 .path.svelte-1furf50.svelte-1furf50{color:var(--text-muted);white-space:nowrap;max-width:75%;overflow:hidden;text-overflow:ellipsis}main.svelte-1furf50:hover .path.svelte-1furf50.svelte-1furf50{color:var(--text-normal);transition:all 200ms}main.svelte-1furf50 .tools.svelte-1furf50.svelte-1furf50{display:flex;align-items:center}main.svelte-1furf50 .tools .type.svelte-1furf50.svelte-1furf50{height:16px;width:16px;margin:0;display:flex;align-items:center;justify-content:center}main.svelte-1furf50 .tools .type[data-type=M].svelte-1furf50.svelte-1furf50{color:orange}main.svelte-1furf50 .tools .type[data-type=D].svelte-1furf50.svelte-1furf50{color:red}main.svelte-1furf50 .tools .buttons.svelte-1furf50.svelte-1furf50{display:flex}main.svelte-1furf50 .tools .buttons.svelte-1furf50>.svelte-1furf50{color:var(--text-faint);height:16px;width:16px;margin:0;transition:all 0.2s;border-radius:2px;margin-right:1px}main.svelte-1furf50 .tools .buttons.svelte-1furf50>.svelte-1furf50:hover{color:var(--text-normal);background-color:var(--interactive-accent)}");
+}
+function create_if_block(ctx) {
+ let div;
+ let mounted;
+ let dispose;
+ return {
+ c() {
+ div = element("div");
+ attr(div, "data-icon", "go-to-file");
+ attr(div, "aria-label", "Open File");
+ attr(div, "class", "svelte-1furf50");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ ctx[12](div);
+ if (!mounted) {
+ dispose = listen(div, "click", ctx[5]);
+ mounted = true;
+ }
+ },
+ p: noop,
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ ctx[12](null);
+ mounted = false;
+ dispose();
+ }
+ };
+}
+function create_fragment(ctx) {
+ let main;
+ let span0;
+ let t0_value = ctx[0].vault_path.split("/").last().replace(".md", "") + "";
+ let t0;
+ let span0_aria_label_value;
+ let t1;
+ let div3;
+ let div2;
+ let show_if = ctx[1].app.vault.getAbstractFileByPath(ctx[0].vault_path);
+ let t2;
+ let div0;
+ let t3;
+ let div1;
+ let t4;
+ let span1;
+ let t5_value = ctx[0].working_dir + "";
+ let t5;
+ let span1_data_type_value;
+ let mounted;
+ let dispose;
+ let if_block = show_if && create_if_block(ctx);
+ return {
+ c() {
+ main = element("main");
+ span0 = element("span");
+ t0 = text(t0_value);
+ t1 = space();
+ div3 = element("div");
+ div2 = element("div");
+ if (if_block)
+ if_block.c();
+ t2 = space();
+ div0 = element("div");
+ t3 = space();
+ div1 = element("div");
+ t4 = space();
+ span1 = element("span");
+ t5 = text(t5_value);
+ attr(span0, "class", "path svelte-1furf50");
+ attr(span0, "aria-label-position", ctx[3]);
+ attr(span0, "aria-label", span0_aria_label_value = ctx[0].vault_path.split("/").last() != ctx[0].vault_path ? ctx[0].vault_path : "");
+ attr(div0, "data-icon", "skip-back");
+ attr(div0, "aria-label", "Discard");
+ attr(div0, "class", "svelte-1furf50");
+ attr(div1, "data-icon", "plus");
+ attr(div1, "aria-label", "Stage");
+ attr(div1, "class", "svelte-1furf50");
+ attr(div2, "class", "buttons svelte-1furf50");
+ attr(span1, "class", "type svelte-1furf50");
+ attr(span1, "data-type", span1_data_type_value = ctx[0].working_dir);
+ attr(div3, "class", "tools svelte-1furf50");
+ attr(main, "class", "svelte-1furf50");
+ },
+ m(target, anchor) {
+ insert(target, main, anchor);
+ append2(main, span0);
+ append2(span0, t0);
+ append2(main, t1);
+ append2(main, div3);
+ append2(div3, div2);
+ if (if_block)
+ if_block.m(div2, null);
+ append2(div2, t2);
+ append2(div2, div0);
+ ctx[13](div0);
+ append2(div2, t3);
+ append2(div2, div1);
+ ctx[14](div1);
+ append2(div3, t4);
+ append2(div3, span1);
+ append2(span1, t5);
+ if (!mounted) {
+ dispose = [
+ listen(span0, "click", self2(ctx[7])),
+ listen(div0, "click", ctx[8]),
+ listen(div1, "click", ctx[6]),
+ listen(main, "mouseover", ctx[4]),
+ listen(main, "click", self2(ctx[7])),
+ listen(main, "focus", ctx[11])
+ ];
+ mounted = true;
+ }
+ },
+ p(ctx2, [dirty]) {
+ if (dirty & 1 && t0_value !== (t0_value = ctx2[0].vault_path.split("/").last().replace(".md", "") + ""))
+ set_data(t0, t0_value);
+ if (dirty & 8) {
+ attr(span0, "aria-label-position", ctx2[3]);
+ }
+ if (dirty & 1 && span0_aria_label_value !== (span0_aria_label_value = ctx2[0].vault_path.split("/").last() != ctx2[0].vault_path ? ctx2[0].vault_path : "")) {
+ attr(span0, "aria-label", span0_aria_label_value);
+ }
+ if (dirty & 3)
+ show_if = ctx2[1].app.vault.getAbstractFileByPath(ctx2[0].vault_path);
+ if (show_if) {
+ if (if_block) {
+ if_block.p(ctx2, dirty);
+ } else {
+ if_block = create_if_block(ctx2);
+ if_block.c();
+ if_block.m(div2, t2);
+ }
+ } else if (if_block) {
+ if_block.d(1);
+ if_block = null;
+ }
+ if (dirty & 1 && t5_value !== (t5_value = ctx2[0].working_dir + ""))
+ set_data(t5, t5_value);
+ if (dirty & 1 && span1_data_type_value !== (span1_data_type_value = ctx2[0].working_dir)) {
+ attr(span1, "data-type", span1_data_type_value);
+ }
+ },
+ i: noop,
+ o: noop,
+ d(detaching) {
+ if (detaching)
+ detach(main);
+ if (if_block)
+ if_block.d();
+ ctx[13](null);
+ ctx[14](null);
+ mounted = false;
+ run_all(dispose);
+ }
+ };
+}
+function instance($$self, $$props, $$invalidate) {
+ let side;
+ let { change } = $$props;
+ let { view } = $$props;
+ let { manager } = $$props;
+ let { workspace } = $$props;
+ let buttons = [];
+ setImmediate(() => buttons.forEach((b) => (0, import_obsidian11.setIcon)(b, b.getAttr("data-icon"), 16)));
+ function hover(event) {
+ if (!change.path.startsWith(view.app.vault.configDir) || !change.path.startsWith(".")) {
+ hoverPreview(event, view, change.vault_path.split("/").last().replace(".md", ""));
+ }
+ }
+ function open(event) {
+ if (!(change.path.startsWith(view.app.vault.configDir) || change.path.startsWith(".") || change.working_dir === "D")) {
+ openOrSwitch(view.app, change.vault_path, event);
+ }
+ }
+ function stage() {
+ manager.stage(change.path).finally(() => {
+ dispatchEvent(new CustomEvent("git-refresh"));
+ });
+ }
+ function showDiff(event) {
+ const leaf = workspace.activeLeaf;
+ if (leaf && !leaf.getViewState().pinned && !(event.ctrlKey || event.getModifierState("Meta"))) {
+ leaf.setViewState({
+ type: DIFF_VIEW_CONFIG.type,
+ state: { file: change.path, staged: false }
+ });
+ } else {
+ workspace.createLeafInParent(workspace.rootSplit, 0).setViewState({
+ type: DIFF_VIEW_CONFIG.type,
+ active: true,
+ state: { file: change.path, staged: false }
+ });
+ }
+ }
+ function discard() {
+ const deleteFile = change.working_dir == "U";
+ new DiscardModal(view.app, deleteFile, change.vault_path).myOpen().then((shouldDiscard) => {
+ if (shouldDiscard === true) {
+ if (deleteFile) {
+ view.app.vault.adapter.remove(change.vault_path).finally(() => {
+ dispatchEvent(new CustomEvent("git-refresh"));
+ });
+ } else {
+ manager.discard(change.path).finally(() => {
+ dispatchEvent(new CustomEvent("git-refresh"));
+ });
+ }
+ }
+ });
+ }
+ function focus_handler(event) {
+ bubble.call(this, $$self, event);
+ }
+ function div_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[1] = $$value;
+ $$invalidate(2, buttons);
+ });
+ }
+ function div0_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[0] = $$value;
+ $$invalidate(2, buttons);
+ });
+ }
+ function div1_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[2] = $$value;
+ $$invalidate(2, buttons);
+ });
+ }
+ $$self.$$set = ($$props2) => {
+ if ("change" in $$props2)
+ $$invalidate(0, change = $$props2.change);
+ if ("view" in $$props2)
+ $$invalidate(1, view = $$props2.view);
+ if ("manager" in $$props2)
+ $$invalidate(9, manager = $$props2.manager);
+ if ("workspace" in $$props2)
+ $$invalidate(10, workspace = $$props2.workspace);
+ };
+ $$self.$$.update = () => {
+ if ($$self.$$.dirty & 2) {
+ $:
+ $$invalidate(3, side = view.leaf.getRoot().side == "left" ? "right" : "left");
+ }
+ };
+ return [
+ change,
+ view,
+ buttons,
+ side,
+ hover,
+ open,
+ stage,
+ showDiff,
+ discard,
+ manager,
+ workspace,
+ focus_handler,
+ div_binding,
+ div0_binding,
+ div1_binding
+ ];
+}
+var FileComponent = class extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, {
+ change: 0,
+ view: 1,
+ manager: 9,
+ workspace: 10
+ }, add_css);
+ }
+};
+var fileComponent_default = FileComponent;
+
+// src/ui/sidebar/components/stagedFileComponent.svelte
+var import_obsidian12 = __toModule(require("obsidian"));
+var import_path2 = __toModule(require("path"));
+function add_css2(target) {
+ append_styles(target, "svelte-15heedx", "main.svelte-15heedx.svelte-15heedx.svelte-15heedx{cursor:pointer;background-color:var(--background-secondary);border-radius:4px;width:98%;display:flex;justify-content:space-between;font-size:0.8rem;margin-bottom:2px}main.svelte-15heedx .path.svelte-15heedx.svelte-15heedx{color:var(--text-muted);white-space:nowrap;max-width:75%;overflow:hidden;text-overflow:ellipsis}main.svelte-15heedx:hover .path.svelte-15heedx.svelte-15heedx{color:var(--text-normal);transition:all 200ms}main.svelte-15heedx .tools.svelte-15heedx.svelte-15heedx{display:flex;align-items:center}main.svelte-15heedx .tools .type.svelte-15heedx.svelte-15heedx{height:16px;width:16px;margin:0;display:flex;align-items:center;justify-content:center}main.svelte-15heedx .tools .type[data-type=M].svelte-15heedx.svelte-15heedx{color:orange}main.svelte-15heedx .tools .type[data-type=D].svelte-15heedx.svelte-15heedx{color:red}main.svelte-15heedx .tools .type[data-type=A].svelte-15heedx.svelte-15heedx{color:yellowgreen}main.svelte-15heedx .tools .type[data-type=R].svelte-15heedx.svelte-15heedx{color:violet}main.svelte-15heedx .tools .buttons.svelte-15heedx.svelte-15heedx{display:flex}main.svelte-15heedx .tools .buttons.svelte-15heedx>.svelte-15heedx{color:var(--text-faint);height:16px;width:16px;margin:0;transition:all 0.2s;border-radius:2px;margin-right:1px}main.svelte-15heedx .tools .buttons.svelte-15heedx>.svelte-15heedx:hover{color:var(--text-normal);background-color:var(--interactive-accent)}");
+}
+function create_if_block2(ctx) {
+ let div;
+ let mounted;
+ let dispose;
+ return {
+ c() {
+ div = element("div");
+ attr(div, "data-icon", "go-to-file");
+ attr(div, "aria-label", "Open File");
+ attr(div, "class", "svelte-15heedx");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ ctx[11](div);
+ if (!mounted) {
+ dispose = listen(div, "click", ctx[6]);
+ mounted = true;
+ }
+ },
+ p: noop,
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ ctx[11](null);
+ mounted = false;
+ dispose();
+ }
+ };
+}
+function create_fragment2(ctx) {
+ let main;
+ let span0;
+ let t0_value = ctx[3].split("/").last().replace(".md", "") + "";
+ let t0;
+ let span0_aria_label_value;
+ let t1;
+ let div2;
+ let div1;
+ let show_if = ctx[1].app.vault.getAbstractFileByPath(ctx[3]);
+ let t2;
+ let div0;
+ let t3;
+ let span1;
+ let t4_value = ctx[0].index + "";
+ let t4;
+ let span1_data_type_value;
+ let mounted;
+ let dispose;
+ let if_block = show_if && create_if_block2(ctx);
+ return {
+ c() {
+ main = element("main");
+ span0 = element("span");
+ t0 = text(t0_value);
+ t1 = space();
+ div2 = element("div");
+ div1 = element("div");
+ if (if_block)
+ if_block.c();
+ t2 = space();
+ div0 = element("div");
+ t3 = space();
+ span1 = element("span");
+ t4 = text(t4_value);
+ attr(span0, "class", "path svelte-15heedx");
+ attr(span0, "aria-label-position", ctx[4]);
+ attr(span0, "aria-label", span0_aria_label_value = ctx[3].split("/").last() != ctx[3] ? ctx[3] : "");
+ attr(div0, "data-icon", "minus");
+ attr(div0, "aria-label", "Unstage");
+ attr(div0, "class", "svelte-15heedx");
+ attr(div1, "class", "buttons svelte-15heedx");
+ attr(span1, "class", "type svelte-15heedx");
+ attr(span1, "data-type", span1_data_type_value = ctx[0].index);
+ attr(div2, "class", "tools svelte-15heedx");
+ attr(main, "class", "svelte-15heedx");
+ },
+ m(target, anchor) {
+ insert(target, main, anchor);
+ append2(main, span0);
+ append2(span0, t0);
+ append2(main, t1);
+ append2(main, div2);
+ append2(div2, div1);
+ if (if_block)
+ if_block.m(div1, null);
+ append2(div1, t2);
+ append2(div1, div0);
+ ctx[12](div0);
+ append2(div2, t3);
+ append2(div2, span1);
+ append2(span1, t4);
+ if (!mounted) {
+ dispose = [
+ listen(span0, "click", ctx[7]),
+ listen(div0, "click", ctx[8]),
+ listen(main, "mouseover", ctx[5]),
+ listen(main, "focus", ctx[10]),
+ listen(main, "click", self2(ctx[7]))
+ ];
+ mounted = true;
+ }
+ },
+ p(ctx2, [dirty]) {
+ if (dirty & 8 && t0_value !== (t0_value = ctx2[3].split("/").last().replace(".md", "") + ""))
+ set_data(t0, t0_value);
+ if (dirty & 16) {
+ attr(span0, "aria-label-position", ctx2[4]);
+ }
+ if (dirty & 8 && span0_aria_label_value !== (span0_aria_label_value = ctx2[3].split("/").last() != ctx2[3] ? ctx2[3] : "")) {
+ attr(span0, "aria-label", span0_aria_label_value);
+ }
+ if (dirty & 10)
+ show_if = ctx2[1].app.vault.getAbstractFileByPath(ctx2[3]);
+ if (show_if) {
+ if (if_block) {
+ if_block.p(ctx2, dirty);
+ } else {
+ if_block = create_if_block2(ctx2);
+ if_block.c();
+ if_block.m(div1, t2);
+ }
+ } else if (if_block) {
+ if_block.d(1);
+ if_block = null;
+ }
+ if (dirty & 1 && t4_value !== (t4_value = ctx2[0].index + ""))
+ set_data(t4, t4_value);
+ if (dirty & 1 && span1_data_type_value !== (span1_data_type_value = ctx2[0].index)) {
+ attr(span1, "data-type", span1_data_type_value);
+ }
+ },
+ i: noop,
+ o: noop,
+ d(detaching) {
+ if (detaching)
+ detach(main);
+ if (if_block)
+ if_block.d();
+ ctx[12](null);
+ mounted = false;
+ run_all(dispose);
+ }
+ };
+}
+function instance2($$self, $$props, $$invalidate) {
+ let formattedPath;
+ let side;
+ let { change } = $$props;
+ let { view } = $$props;
+ let { manager } = $$props;
+ let buttons = [];
+ setImmediate(() => buttons.forEach((b) => (0, import_obsidian12.setIcon)(b, b.getAttr("data-icon"), 16)));
+ function hover(event) {
+ if (!change.path.startsWith(view.app.vault.configDir) || !change.path.startsWith(".")) {
+ hoverPreview(event, view, formattedPath.split("/").last().replace(".md", ""));
+ }
+ }
+ function open(event) {
+ if (!(change.path.startsWith(view.app.vault.configDir) || change.path.startsWith(".") || change.index === "D")) {
+ openOrSwitch(view.app, formattedPath, event);
+ }
+ }
+ function showDiff(event) {
+ const leaf = view.app.workspace.activeLeaf;
+ if (leaf && !leaf.getViewState().pinned && !(event.ctrlKey || event.getModifierState("Meta"))) {
+ leaf.setViewState({
+ type: DIFF_VIEW_CONFIG.type,
+ state: { file: change.path, staged: true }
+ });
+ } else {
+ view.app.workspace.createLeafInParent(view.app.workspace.rootSplit, 0).setViewState({
+ type: DIFF_VIEW_CONFIG.type,
+ active: true,
+ state: { file: change.path, staged: true }
+ });
+ }
+ }
+ function unstage() {
+ manager.unstage(change.path).finally(() => {
+ dispatchEvent(new CustomEvent("git-refresh"));
+ });
+ }
+ function focus_handler(event) {
+ bubble.call(this, $$self, event);
+ }
+ function div_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[1] = $$value;
+ $$invalidate(2, buttons);
+ });
+ }
+ function div0_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[0] = $$value;
+ $$invalidate(2, buttons);
+ });
+ }
+ $$self.$$set = ($$props2) => {
+ if ("change" in $$props2)
+ $$invalidate(0, change = $$props2.change);
+ if ("view" in $$props2)
+ $$invalidate(1, view = $$props2.view);
+ if ("manager" in $$props2)
+ $$invalidate(9, manager = $$props2.manager);
+ };
+ $$self.$$.update = () => {
+ if ($$self.$$.dirty & 1) {
+ $:
+ $$invalidate(3, formattedPath = change.vault_path);
+ }
+ if ($$self.$$.dirty & 2) {
+ $:
+ $$invalidate(4, side = view.leaf.getRoot().side == "left" ? "right" : "left");
+ }
+ };
+ return [
+ change,
+ view,
+ buttons,
+ formattedPath,
+ side,
+ hover,
+ open,
+ showDiff,
+ unstage,
+ manager,
+ focus_handler,
+ div_binding,
+ div0_binding
+ ];
+}
+var StagedFileComponent = class extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance2, create_fragment2, safe_not_equal, { change: 0, view: 1, manager: 9 }, add_css2);
+ }
+};
+var stagedFileComponent_default = StagedFileComponent;
+
+// src/ui/sidebar/components/treeComponent.svelte
+function add_css3(target) {
+ append_styles(target, "svelte-pgmdei", '@charset "UTF-8";main.svelte-pgmdei.svelte-pgmdei:not(.topLevel){margin-left:5px}.opener.svelte-pgmdei.svelte-pgmdei{display:flex;justify-content:space-between;align-items:center;padding:0 4px}.opener.svelte-pgmdei .collapse-icon.svelte-pgmdei::after{content:"\xA0"}.opener.svelte-pgmdei div.svelte-pgmdei{display:flex}.opener.svelte-pgmdei svg.svelte-pgmdei{transform:rotate(-90deg)}.opener.open.svelte-pgmdei svg.svelte-pgmdei{transform:rotate(0)}.opener.svelte-pgmdei span.svelte-pgmdei{font-size:0.8rem}.file-view.svelte-pgmdei.svelte-pgmdei{margin-left:5px}');
+}
+function get_each_context(ctx, list, i) {
+ const child_ctx = ctx.slice();
+ child_ctx[7] = list[i];
+ return child_ctx;
+}
+function create_else_block_1(ctx) {
+ let div2;
+ let div1;
+ let div0;
+ let t0;
+ let span;
+ let t1_value = ctx[7].title + "";
+ let t1;
+ let t2;
+ let if_block_anchor;
+ let current;
+ let mounted;
+ let dispose;
+ function click_handler() {
+ return ctx[6](ctx[7]);
+ }
+ let if_block = !ctx[5][ctx[7].title] && create_if_block_2(ctx);
+ return {
+ c() {
+ div2 = element("div");
+ div1 = element("div");
+ div0 = element("div");
+ div0.innerHTML = ``;
+ t0 = space();
+ span = element("span");
+ t1 = text(t1_value);
+ t2 = space();
+ if (if_block)
+ if_block.c();
+ if_block_anchor = empty();
+ attr(div0, "class", "tree-item-icon collapse-icon svelte-pgmdei");
+ attr(div0, "style", "");
+ attr(span, "class", "svelte-pgmdei");
+ attr(div1, "class", "svelte-pgmdei");
+ attr(div2, "class", "opener tree-item-self is-clickable svelte-pgmdei");
+ toggle_class(div2, "open", !ctx[5][ctx[7].title]);
+ },
+ m(target, anchor) {
+ insert(target, div2, anchor);
+ append2(div2, div1);
+ append2(div1, div0);
+ append2(div1, t0);
+ append2(div1, span);
+ append2(span, t1);
+ insert(target, t2, anchor);
+ if (if_block)
+ if_block.m(target, anchor);
+ insert(target, if_block_anchor, anchor);
+ current = true;
+ if (!mounted) {
+ dispose = listen(div2, "click", click_handler);
+ mounted = true;
+ }
+ },
+ p(new_ctx, dirty) {
+ ctx = new_ctx;
+ if ((!current || dirty & 1) && t1_value !== (t1_value = ctx[7].title + ""))
+ set_data(t1, t1_value);
+ if (dirty & 33) {
+ toggle_class(div2, "open", !ctx[5][ctx[7].title]);
+ }
+ if (!ctx[5][ctx[7].title]) {
+ if (if_block) {
+ if_block.p(ctx, dirty);
+ if (dirty & 33) {
+ transition_in(if_block, 1);
+ }
+ } else {
+ if_block = create_if_block_2(ctx);
+ if_block.c();
+ transition_in(if_block, 1);
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
+ }
+ } else if (if_block) {
+ group_outros();
+ transition_out(if_block, 1, 1, () => {
+ if_block = null;
+ });
+ check_outros();
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block);
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div2);
+ if (detaching)
+ detach(t2);
+ if (if_block)
+ if_block.d(detaching);
+ if (detaching)
+ detach(if_block_anchor);
+ mounted = false;
+ dispose();
+ }
+ };
+}
+function create_if_block3(ctx) {
+ let div;
+ let current_block_type_index;
+ let if_block;
+ let t;
+ let current;
+ const if_block_creators = [create_if_block_1, create_else_block];
+ const if_blocks = [];
+ function select_block_type_1(ctx2, dirty) {
+ if (ctx2[3])
+ return 0;
+ return 1;
+ }
+ current_block_type_index = select_block_type_1(ctx, -1);
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
+ return {
+ c() {
+ div = element("div");
+ if_block.c();
+ t = space();
+ attr(div, "class", "file-view svelte-pgmdei");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ if_blocks[current_block_type_index].m(div, null);
+ append2(div, t);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ let previous_block_index = current_block_type_index;
+ current_block_type_index = select_block_type_1(ctx2, dirty);
+ if (current_block_type_index === previous_block_index) {
+ if_blocks[current_block_type_index].p(ctx2, dirty);
+ } else {
+ group_outros();
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
+ if_blocks[previous_block_index] = null;
+ });
+ check_outros();
+ if_block = if_blocks[current_block_type_index];
+ if (!if_block) {
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
+ if_block.c();
+ } else {
+ if_block.p(ctx2, dirty);
+ }
+ transition_in(if_block, 1);
+ if_block.m(div, t);
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block);
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ if_blocks[current_block_type_index].d();
+ }
+ };
+}
+function create_if_block_2(ctx) {
+ let div;
+ let treecomponent;
+ let t;
+ let div_transition;
+ let current;
+ treecomponent = new TreeComponent({
+ props: {
+ hierarchy: ctx[7],
+ plugin: ctx[1],
+ view: ctx[2],
+ staged: ctx[3]
+ }
+ });
+ return {
+ c() {
+ div = element("div");
+ create_component(treecomponent.$$.fragment);
+ t = space();
+ attr(div, "class", "file-view svelte-pgmdei");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ mount_component(treecomponent, div, null);
+ append2(div, t);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const treecomponent_changes = {};
+ if (dirty & 1)
+ treecomponent_changes.hierarchy = ctx2[7];
+ if (dirty & 2)
+ treecomponent_changes.plugin = ctx2[1];
+ if (dirty & 4)
+ treecomponent_changes.view = ctx2[2];
+ if (dirty & 8)
+ treecomponent_changes.staged = ctx2[3];
+ treecomponent.$set(treecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(treecomponent.$$.fragment, local);
+ if (local) {
+ add_render_callback(() => {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 75 }, true);
+ div_transition.run(1);
+ });
+ }
+ current = true;
+ },
+ o(local) {
+ transition_out(treecomponent.$$.fragment, local);
+ if (local) {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 75 }, false);
+ div_transition.run(0);
+ }
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ destroy_component(treecomponent);
+ if (detaching && div_transition)
+ div_transition.end();
+ }
+ };
+}
+function create_else_block(ctx) {
+ let filecomponent;
+ let current;
+ filecomponent = new fileComponent_default({
+ props: {
+ change: ctx[7].statusResult,
+ manager: ctx[1].gitManager,
+ view: ctx[2],
+ workspace: ctx[1].app.workspace
+ }
+ });
+ return {
+ c() {
+ create_component(filecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(filecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const filecomponent_changes = {};
+ if (dirty & 1)
+ filecomponent_changes.change = ctx2[7].statusResult;
+ if (dirty & 2)
+ filecomponent_changes.manager = ctx2[1].gitManager;
+ if (dirty & 4)
+ filecomponent_changes.view = ctx2[2];
+ if (dirty & 2)
+ filecomponent_changes.workspace = ctx2[1].app.workspace;
+ filecomponent.$set(filecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(filecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(filecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(filecomponent, detaching);
+ }
+ };
+}
+function create_if_block_1(ctx) {
+ let stagedfilecomponent;
+ let current;
+ stagedfilecomponent = new stagedFileComponent_default({
+ props: {
+ change: ctx[7].statusResult,
+ manager: ctx[1].gitManager,
+ view: ctx[2]
+ }
+ });
+ return {
+ c() {
+ create_component(stagedfilecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(stagedfilecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const stagedfilecomponent_changes = {};
+ if (dirty & 1)
+ stagedfilecomponent_changes.change = ctx2[7].statusResult;
+ if (dirty & 2)
+ stagedfilecomponent_changes.manager = ctx2[1].gitManager;
+ if (dirty & 4)
+ stagedfilecomponent_changes.view = ctx2[2];
+ stagedfilecomponent.$set(stagedfilecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(stagedfilecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(stagedfilecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(stagedfilecomponent, detaching);
+ }
+ };
+}
+function create_each_block(ctx) {
+ let current_block_type_index;
+ let if_block;
+ let if_block_anchor;
+ let current;
+ const if_block_creators = [create_if_block3, create_else_block_1];
+ const if_blocks = [];
+ function select_block_type(ctx2, dirty) {
+ if (ctx2[7].statusResult)
+ return 0;
+ return 1;
+ }
+ current_block_type_index = select_block_type(ctx, -1);
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
+ return {
+ c() {
+ if_block.c();
+ if_block_anchor = empty();
+ },
+ m(target, anchor) {
+ if_blocks[current_block_type_index].m(target, anchor);
+ insert(target, if_block_anchor, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ let previous_block_index = current_block_type_index;
+ current_block_type_index = select_block_type(ctx2, dirty);
+ if (current_block_type_index === previous_block_index) {
+ if_blocks[current_block_type_index].p(ctx2, dirty);
+ } else {
+ group_outros();
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
+ if_blocks[previous_block_index] = null;
+ });
+ check_outros();
+ if_block = if_blocks[current_block_type_index];
+ if (!if_block) {
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
+ if_block.c();
+ } else {
+ if_block.p(ctx2, dirty);
+ }
+ transition_in(if_block, 1);
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block);
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block);
+ current = false;
+ },
+ d(detaching) {
+ if_blocks[current_block_type_index].d(detaching);
+ if (detaching)
+ detach(if_block_anchor);
+ }
+ };
+}
+function create_fragment3(ctx) {
+ let main;
+ let current;
+ let each_value = ctx[0].children;
+ let each_blocks = [];
+ for (let i = 0; i < each_value.length; i += 1) {
+ each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
+ }
+ const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
+ each_blocks[i] = null;
+ });
+ return {
+ c() {
+ main = element("main");
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].c();
+ }
+ attr(main, "class", "svelte-pgmdei");
+ toggle_class(main, "topLevel", ctx[4]);
+ },
+ m(target, anchor) {
+ insert(target, main, anchor);
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].m(main, null);
+ }
+ current = true;
+ },
+ p(ctx2, [dirty]) {
+ if (dirty & 47) {
+ each_value = ctx2[0].children;
+ let i;
+ for (i = 0; i < each_value.length; i += 1) {
+ const child_ctx = get_each_context(ctx2, each_value, i);
+ if (each_blocks[i]) {
+ each_blocks[i].p(child_ctx, dirty);
+ transition_in(each_blocks[i], 1);
+ } else {
+ each_blocks[i] = create_each_block(child_ctx);
+ each_blocks[i].c();
+ transition_in(each_blocks[i], 1);
+ each_blocks[i].m(main, null);
+ }
+ }
+ group_outros();
+ for (i = each_value.length; i < each_blocks.length; i += 1) {
+ out(i);
+ }
+ check_outros();
+ }
+ if (dirty & 16) {
+ toggle_class(main, "topLevel", ctx2[4]);
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ for (let i = 0; i < each_value.length; i += 1) {
+ transition_in(each_blocks[i]);
+ }
+ current = true;
+ },
+ o(local) {
+ each_blocks = each_blocks.filter(Boolean);
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ transition_out(each_blocks[i]);
+ }
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(main);
+ destroy_each(each_blocks, detaching);
+ }
+ };
+}
+function instance3($$self, $$props, $$invalidate) {
+ let { hierarchy } = $$props;
+ let { plugin } = $$props;
+ let { view } = $$props;
+ let { staged } = $$props;
+ let { topLevel = false } = $$props;
+ const closed = {};
+ const click_handler = (entity) => {
+ $$invalidate(5, closed[entity.title] = !closed[entity.title], closed);
+ };
+ $$self.$$set = ($$props2) => {
+ if ("hierarchy" in $$props2)
+ $$invalidate(0, hierarchy = $$props2.hierarchy);
+ if ("plugin" in $$props2)
+ $$invalidate(1, plugin = $$props2.plugin);
+ if ("view" in $$props2)
+ $$invalidate(2, view = $$props2.view);
+ if ("staged" in $$props2)
+ $$invalidate(3, staged = $$props2.staged);
+ if ("topLevel" in $$props2)
+ $$invalidate(4, topLevel = $$props2.topLevel);
+ };
+ return [hierarchy, plugin, view, staged, topLevel, closed, click_handler];
+}
+var TreeComponent = class extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance3, create_fragment3, safe_not_equal, {
+ hierarchy: 0,
+ plugin: 1,
+ view: 2,
+ staged: 3,
+ topLevel: 4
+ }, add_css3);
+ }
+};
+var treeComponent_default = TreeComponent;
+
+// src/ui/sidebar/gitView.svelte
+function add_css4(target) {
+ append_styles(target, "svelte-1f0ksxd", '@charset "UTF-8";.commit-msg.svelte-1f0ksxd.svelte-1f0ksxd{width:100%;min-height:1.9em;height:1.9em;resize:vertical;padding:2px 5px;background-color:var(--background-modifier-form-field)}.search-input-container.svelte-1f0ksxd.svelte-1f0ksxd{width:100%}.file-view.svelte-1f0ksxd.svelte-1f0ksxd{margin-left:5px}.opener.svelte-1f0ksxd.svelte-1f0ksxd{display:flex;justify-content:space-between;align-items:center;padding:0 4px}.opener.svelte-1f0ksxd .collapse-icon.svelte-1f0ksxd::after{content:"\xA0"}.opener.svelte-1f0ksxd div.svelte-1f0ksxd{display:flex}.opener.svelte-1f0ksxd svg.svelte-1f0ksxd{transform:rotate(-90deg)}.opener.open.svelte-1f0ksxd svg.svelte-1f0ksxd{transform:rotate(0)}.git-view-body.svelte-1f0ksxd.svelte-1f0ksxd{overflow-y:auto;padding-left:10px}main.svelte-1f0ksxd.svelte-1f0ksxd{display:flex;flex-direction:column;height:100%;overflow-y:hidden}.nav-buttons-container.svelte-1f0ksxd.svelte-1f0ksxd{justify-content:space-between}.group.svelte-1f0ksxd.svelte-1f0ksxd{display:flex}');
+}
+function get_each_context2(ctx, list, i) {
+ const child_ctx = ctx.slice();
+ child_ctx[30] = list[i];
+ return child_ctx;
+}
+function get_each_context_1(ctx, list, i) {
+ const child_ctx = ctx.slice();
+ child_ctx[33] = list[i];
+ return child_ctx;
+}
+function create_if_block_5(ctx) {
+ let div;
+ let div_aria_label_value;
+ let mounted;
+ let dispose;
+ return {
+ c() {
+ div = element("div");
+ attr(div, "class", "search-input-clear-button");
+ attr(div, "aria-label", div_aria_label_value = "Clear");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ if (!mounted) {
+ dispose = listen(div, "click", ctx[26]);
+ mounted = true;
+ }
+ },
+ p: noop,
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ mounted = false;
+ dispose();
+ }
+ };
+}
+function create_if_block4(ctx) {
+ let div3;
+ let div2;
+ let div1;
+ let t2;
+ let span1;
+ let t3_value = ctx[5].staged.length + "";
+ let t3;
+ let t4;
+ let t5;
+ let div7;
+ let div6;
+ let div5;
+ let t8;
+ let span3;
+ let t9_value = ctx[5].changed.length + "";
+ let t9;
+ let t10;
+ let current;
+ let mounted;
+ let dispose;
+ let if_block0 = ctx[11] && create_if_block_3(ctx);
+ let if_block1 = ctx[10] && create_if_block_12(ctx);
+ return {
+ c() {
+ div3 = element("div");
+ div2 = element("div");
+ div1 = element("div");
+ div1.innerHTML = `
+ Staged Changes`;
+ t2 = space();
+ span1 = element("span");
+ t3 = text(t3_value);
+ t4 = space();
+ if (if_block0)
+ if_block0.c();
+ t5 = space();
+ div7 = element("div");
+ div6 = element("div");
+ div5 = element("div");
+ div5.innerHTML = `
+ Changes`;
+ t8 = space();
+ span3 = element("span");
+ t9 = text(t9_value);
+ t10 = space();
+ if (if_block1)
+ if_block1.c();
+ attr(div1, "class", "svelte-1f0ksxd");
+ attr(span1, "class", "tree-item-flair");
+ attr(div2, "class", "opener tree-item-self is-clickable svelte-1f0ksxd");
+ toggle_class(div2, "open", ctx[11]);
+ attr(div3, "class", "staged");
+ attr(div5, "class", "svelte-1f0ksxd");
+ attr(span3, "class", "tree-item-flair");
+ attr(div6, "class", "opener tree-item-self is-clickable svelte-1f0ksxd");
+ toggle_class(div6, "open", ctx[10]);
+ attr(div7, "class", "changes");
+ },
+ m(target, anchor) {
+ insert(target, div3, anchor);
+ append2(div3, div2);
+ append2(div2, div1);
+ append2(div2, t2);
+ append2(div2, span1);
+ append2(span1, t3);
+ append2(div3, t4);
+ if (if_block0)
+ if_block0.m(div3, null);
+ insert(target, t5, anchor);
+ insert(target, div7, anchor);
+ append2(div7, div6);
+ append2(div6, div5);
+ append2(div6, t8);
+ append2(div6, span3);
+ append2(span3, t9);
+ append2(div7, t10);
+ if (if_block1)
+ if_block1.m(div7, null);
+ current = true;
+ if (!mounted) {
+ dispose = [
+ listen(div2, "click", ctx[27]),
+ listen(div6, "click", ctx[28])
+ ];
+ mounted = true;
+ }
+ },
+ p(ctx2, dirty) {
+ if ((!current || dirty[0] & 32) && t3_value !== (t3_value = ctx2[5].staged.length + ""))
+ set_data(t3, t3_value);
+ if (dirty[0] & 2048) {
+ toggle_class(div2, "open", ctx2[11]);
+ }
+ if (ctx2[11]) {
+ if (if_block0) {
+ if_block0.p(ctx2, dirty);
+ if (dirty[0] & 2048) {
+ transition_in(if_block0, 1);
+ }
+ } else {
+ if_block0 = create_if_block_3(ctx2);
+ if_block0.c();
+ transition_in(if_block0, 1);
+ if_block0.m(div3, null);
+ }
+ } else if (if_block0) {
+ group_outros();
+ transition_out(if_block0, 1, 1, () => {
+ if_block0 = null;
+ });
+ check_outros();
+ }
+ if ((!current || dirty[0] & 32) && t9_value !== (t9_value = ctx2[5].changed.length + ""))
+ set_data(t9, t9_value);
+ if (dirty[0] & 1024) {
+ toggle_class(div6, "open", ctx2[10]);
+ }
+ if (ctx2[10]) {
+ if (if_block1) {
+ if_block1.p(ctx2, dirty);
+ if (dirty[0] & 1024) {
+ transition_in(if_block1, 1);
+ }
+ } else {
+ if_block1 = create_if_block_12(ctx2);
+ if_block1.c();
+ transition_in(if_block1, 1);
+ if_block1.m(div7, null);
+ }
+ } else if (if_block1) {
+ group_outros();
+ transition_out(if_block1, 1, 1, () => {
+ if_block1 = null;
+ });
+ check_outros();
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block0);
+ transition_in(if_block1);
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block0);
+ transition_out(if_block1);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div3);
+ if (if_block0)
+ if_block0.d();
+ if (detaching)
+ detach(t5);
+ if (detaching)
+ detach(div7);
+ if (if_block1)
+ if_block1.d();
+ mounted = false;
+ run_all(dispose);
+ }
+ };
+}
+function create_if_block_3(ctx) {
+ let div;
+ let current_block_type_index;
+ let if_block;
+ let div_transition;
+ let current;
+ const if_block_creators = [create_if_block_4, create_else_block_12];
+ const if_blocks = [];
+ function select_block_type(ctx2, dirty) {
+ if (ctx2[2])
+ return 0;
+ return 1;
+ }
+ current_block_type_index = select_block_type(ctx, [-1, -1]);
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
+ return {
+ c() {
+ div = element("div");
+ if_block.c();
+ attr(div, "class", "file-view svelte-1f0ksxd");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ if_blocks[current_block_type_index].m(div, null);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ let previous_block_index = current_block_type_index;
+ current_block_type_index = select_block_type(ctx2, dirty);
+ if (current_block_type_index === previous_block_index) {
+ if_blocks[current_block_type_index].p(ctx2, dirty);
+ } else {
+ group_outros();
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
+ if_blocks[previous_block_index] = null;
+ });
+ check_outros();
+ if_block = if_blocks[current_block_type_index];
+ if (!if_block) {
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
+ if_block.c();
+ } else {
+ if_block.p(ctx2, dirty);
+ }
+ transition_in(if_block, 1);
+ if_block.m(div, null);
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block);
+ if (local) {
+ add_render_callback(() => {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true);
+ div_transition.run(1);
+ });
+ }
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block);
+ if (local) {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false);
+ div_transition.run(0);
+ }
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ if_blocks[current_block_type_index].d();
+ if (detaching && div_transition)
+ div_transition.end();
+ }
+ };
+}
+function create_else_block_12(ctx) {
+ let each_1_anchor;
+ let current;
+ let each_value_1 = ctx[5].staged;
+ let each_blocks = [];
+ for (let i = 0; i < each_value_1.length; i += 1) {
+ each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
+ }
+ const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
+ each_blocks[i] = null;
+ });
+ return {
+ c() {
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].c();
+ }
+ each_1_anchor = empty();
+ },
+ m(target, anchor) {
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].m(target, anchor);
+ }
+ insert(target, each_1_anchor, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ if (dirty[0] & 35) {
+ each_value_1 = ctx2[5].staged;
+ let i;
+ for (i = 0; i < each_value_1.length; i += 1) {
+ const child_ctx = get_each_context_1(ctx2, each_value_1, i);
+ if (each_blocks[i]) {
+ each_blocks[i].p(child_ctx, dirty);
+ transition_in(each_blocks[i], 1);
+ } else {
+ each_blocks[i] = create_each_block_1(child_ctx);
+ each_blocks[i].c();
+ transition_in(each_blocks[i], 1);
+ each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
+ }
+ }
+ group_outros();
+ for (i = each_value_1.length; i < each_blocks.length; i += 1) {
+ out(i);
+ }
+ check_outros();
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ for (let i = 0; i < each_value_1.length; i += 1) {
+ transition_in(each_blocks[i]);
+ }
+ current = true;
+ },
+ o(local) {
+ each_blocks = each_blocks.filter(Boolean);
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ transition_out(each_blocks[i]);
+ }
+ current = false;
+ },
+ d(detaching) {
+ destroy_each(each_blocks, detaching);
+ if (detaching)
+ detach(each_1_anchor);
+ }
+ };
+}
+function create_if_block_4(ctx) {
+ let treecomponent;
+ let current;
+ treecomponent = new treeComponent_default({
+ props: {
+ hierarchy: ctx[9],
+ plugin: ctx[0],
+ view: ctx[1],
+ staged: true,
+ topLevel: true
+ }
+ });
+ return {
+ c() {
+ create_component(treecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(treecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const treecomponent_changes = {};
+ if (dirty[0] & 512)
+ treecomponent_changes.hierarchy = ctx2[9];
+ if (dirty[0] & 1)
+ treecomponent_changes.plugin = ctx2[0];
+ if (dirty[0] & 2)
+ treecomponent_changes.view = ctx2[1];
+ treecomponent.$set(treecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(treecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(treecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(treecomponent, detaching);
+ }
+ };
+}
+function create_each_block_1(ctx) {
+ let stagedfilecomponent;
+ let current;
+ stagedfilecomponent = new stagedFileComponent_default({
+ props: {
+ change: ctx[33],
+ view: ctx[1],
+ manager: ctx[0].gitManager
+ }
+ });
+ return {
+ c() {
+ create_component(stagedfilecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(stagedfilecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const stagedfilecomponent_changes = {};
+ if (dirty[0] & 32)
+ stagedfilecomponent_changes.change = ctx2[33];
+ if (dirty[0] & 2)
+ stagedfilecomponent_changes.view = ctx2[1];
+ if (dirty[0] & 1)
+ stagedfilecomponent_changes.manager = ctx2[0].gitManager;
+ stagedfilecomponent.$set(stagedfilecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(stagedfilecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(stagedfilecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(stagedfilecomponent, detaching);
+ }
+ };
+}
+function create_if_block_12(ctx) {
+ let div;
+ let current_block_type_index;
+ let if_block;
+ let div_transition;
+ let current;
+ const if_block_creators = [create_if_block_22, create_else_block2];
+ const if_blocks = [];
+ function select_block_type_1(ctx2, dirty) {
+ if (ctx2[2])
+ return 0;
+ return 1;
+ }
+ current_block_type_index = select_block_type_1(ctx, [-1, -1]);
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
+ return {
+ c() {
+ div = element("div");
+ if_block.c();
+ attr(div, "class", "file-view svelte-1f0ksxd");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ if_blocks[current_block_type_index].m(div, null);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ let previous_block_index = current_block_type_index;
+ current_block_type_index = select_block_type_1(ctx2, dirty);
+ if (current_block_type_index === previous_block_index) {
+ if_blocks[current_block_type_index].p(ctx2, dirty);
+ } else {
+ group_outros();
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
+ if_blocks[previous_block_index] = null;
+ });
+ check_outros();
+ if_block = if_blocks[current_block_type_index];
+ if (!if_block) {
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
+ if_block.c();
+ } else {
+ if_block.p(ctx2, dirty);
+ }
+ transition_in(if_block, 1);
+ if_block.m(div, null);
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block);
+ if (local) {
+ add_render_callback(() => {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true);
+ div_transition.run(1);
+ });
+ }
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block);
+ if (local) {
+ if (!div_transition)
+ div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false);
+ div_transition.run(0);
+ }
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ if_blocks[current_block_type_index].d();
+ if (detaching && div_transition)
+ div_transition.end();
+ }
+ };
+}
+function create_else_block2(ctx) {
+ let each_1_anchor;
+ let current;
+ let each_value = ctx[5].changed;
+ let each_blocks = [];
+ for (let i = 0; i < each_value.length; i += 1) {
+ each_blocks[i] = create_each_block2(get_each_context2(ctx, each_value, i));
+ }
+ const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
+ each_blocks[i] = null;
+ });
+ return {
+ c() {
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].c();
+ }
+ each_1_anchor = empty();
+ },
+ m(target, anchor) {
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].m(target, anchor);
+ }
+ insert(target, each_1_anchor, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ if (dirty[0] & 35) {
+ each_value = ctx2[5].changed;
+ let i;
+ for (i = 0; i < each_value.length; i += 1) {
+ const child_ctx = get_each_context2(ctx2, each_value, i);
+ if (each_blocks[i]) {
+ each_blocks[i].p(child_ctx, dirty);
+ transition_in(each_blocks[i], 1);
+ } else {
+ each_blocks[i] = create_each_block2(child_ctx);
+ each_blocks[i].c();
+ transition_in(each_blocks[i], 1);
+ each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
+ }
+ }
+ group_outros();
+ for (i = each_value.length; i < each_blocks.length; i += 1) {
+ out(i);
+ }
+ check_outros();
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ for (let i = 0; i < each_value.length; i += 1) {
+ transition_in(each_blocks[i]);
+ }
+ current = true;
+ },
+ o(local) {
+ each_blocks = each_blocks.filter(Boolean);
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ transition_out(each_blocks[i]);
+ }
+ current = false;
+ },
+ d(detaching) {
+ destroy_each(each_blocks, detaching);
+ if (detaching)
+ detach(each_1_anchor);
+ }
+ };
+}
+function create_if_block_22(ctx) {
+ let treecomponent;
+ let current;
+ treecomponent = new treeComponent_default({
+ props: {
+ hierarchy: ctx[8],
+ plugin: ctx[0],
+ view: ctx[1],
+ staged: false,
+ topLevel: true
+ }
+ });
+ return {
+ c() {
+ create_component(treecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(treecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const treecomponent_changes = {};
+ if (dirty[0] & 256)
+ treecomponent_changes.hierarchy = ctx2[8];
+ if (dirty[0] & 1)
+ treecomponent_changes.plugin = ctx2[0];
+ if (dirty[0] & 2)
+ treecomponent_changes.view = ctx2[1];
+ treecomponent.$set(treecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(treecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(treecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(treecomponent, detaching);
+ }
+ };
+}
+function create_each_block2(ctx) {
+ let filecomponent;
+ let current;
+ filecomponent = new fileComponent_default({
+ props: {
+ change: ctx[30],
+ view: ctx[1],
+ manager: ctx[0].gitManager,
+ workspace: ctx[0].app.workspace
+ }
+ });
+ filecomponent.$on("git-refresh", triggerRefresh);
+ return {
+ c() {
+ create_component(filecomponent.$$.fragment);
+ },
+ m(target, anchor) {
+ mount_component(filecomponent, target, anchor);
+ current = true;
+ },
+ p(ctx2, dirty) {
+ const filecomponent_changes = {};
+ if (dirty[0] & 32)
+ filecomponent_changes.change = ctx2[30];
+ if (dirty[0] & 2)
+ filecomponent_changes.view = ctx2[1];
+ if (dirty[0] & 1)
+ filecomponent_changes.manager = ctx2[0].gitManager;
+ if (dirty[0] & 1)
+ filecomponent_changes.workspace = ctx2[0].app.workspace;
+ filecomponent.$set(filecomponent_changes);
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(filecomponent.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(filecomponent.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ destroy_component(filecomponent, detaching);
+ }
+ };
+}
+function create_fragment4(ctx) {
+ let main;
+ let div9;
+ let div6;
+ let div0;
+ let t0;
+ let div1;
+ let t1;
+ let div2;
+ let t2;
+ let div3;
+ let t3;
+ let div4;
+ let t4;
+ let div5;
+ let t5;
+ let div7;
+ let t6;
+ let div8;
+ let textarea;
+ let t7;
+ let t8;
+ let div10;
+ let current;
+ let mounted;
+ let dispose;
+ let if_block0 = ctx[6] && create_if_block_5(ctx);
+ let if_block1 = ctx[5] && create_if_block4(ctx);
+ return {
+ c() {
+ main = element("main");
+ div9 = element("div");
+ div6 = element("div");
+ div0 = element("div");
+ t0 = space();
+ div1 = element("div");
+ t1 = space();
+ div2 = element("div");
+ t2 = space();
+ div3 = element("div");
+ t3 = space();
+ div4 = element("div");
+ t4 = space();
+ div5 = element("div");
+ t5 = space();
+ div7 = element("div");
+ t6 = space();
+ div8 = element("div");
+ textarea = element("textarea");
+ t7 = space();
+ if (if_block0)
+ if_block0.c();
+ t8 = space();
+ div10 = element("div");
+ if (if_block1)
+ if_block1.c();
+ attr(div0, "id", "commit-btn");
+ attr(div0, "data-icon", "check");
+ attr(div0, "class", "nav-action-button");
+ attr(div0, "aria-label", "Commit");
+ attr(div1, "id", "stage-all");
+ attr(div1, "class", "nav-action-button");
+ attr(div1, "data-icon", "plus-circle");
+ attr(div1, "aria-label", "Stage all");
+ attr(div2, "id", "unstage-all");
+ attr(div2, "class", "nav-action-button");
+ attr(div2, "data-icon", "minus-circle");
+ attr(div2, "aria-label", "Unstage all");
+ attr(div3, "id", "push");
+ attr(div3, "class", "nav-action-button");
+ attr(div3, "data-icon", "upload");
+ attr(div3, "aria-label", "Push");
+ attr(div4, "id", "pull");
+ attr(div4, "class", "nav-action-button");
+ attr(div4, "data-icon", "download");
+ attr(div4, "aria-label", "Pull");
+ attr(div5, "id", "layoutChange");
+ attr(div5, "class", "nav-action-button");
+ attr(div5, "aria-label", "Change Layout");
+ attr(div6, "class", "group svelte-1f0ksxd");
+ attr(div7, "id", "refresh");
+ attr(div7, "class", "nav-action-button");
+ attr(div7, "data-icon", "refresh-cw");
+ attr(div7, "aria-label", "Refresh");
+ toggle_class(div7, "loading", ctx[4]);
+ attr(textarea, "class", "commit-msg svelte-1f0ksxd");
+ attr(textarea, "type", "text");
+ attr(textarea, "spellcheck", "true");
+ attr(textarea, "placeholder", "Commit Message");
+ attr(div8, "class", "search-input-container svelte-1f0ksxd");
+ attr(div9, "class", "nav-buttons-container svelte-1f0ksxd");
+ attr(div10, "class", "git-view-body svelte-1f0ksxd");
+ attr(main, "class", "svelte-1f0ksxd");
+ },
+ m(target, anchor) {
+ insert(target, main, anchor);
+ append2(main, div9);
+ append2(div9, div6);
+ append2(div6, div0);
+ ctx[17](div0);
+ append2(div6, t0);
+ append2(div6, div1);
+ ctx[18](div1);
+ append2(div6, t1);
+ append2(div6, div2);
+ ctx[19](div2);
+ append2(div6, t2);
+ append2(div6, div3);
+ ctx[20](div3);
+ append2(div6, t3);
+ append2(div6, div4);
+ ctx[21](div4);
+ append2(div6, t4);
+ append2(div6, div5);
+ ctx[22](div5);
+ append2(div9, t5);
+ append2(div9, div7);
+ ctx[24](div7);
+ append2(div9, t6);
+ append2(div9, div8);
+ append2(div8, textarea);
+ set_input_value(textarea, ctx[6]);
+ append2(div8, t7);
+ if (if_block0)
+ if_block0.m(div8, null);
+ append2(main, t8);
+ append2(main, div10);
+ if (if_block1)
+ if_block1.m(div10, null);
+ current = true;
+ if (!mounted) {
+ dispose = [
+ listen(div0, "click", ctx[12]),
+ listen(div1, "click", ctx[13]),
+ listen(div2, "click", ctx[14]),
+ listen(div3, "click", ctx[15]),
+ listen(div4, "click", ctx[16]),
+ listen(div5, "click", ctx[23]),
+ listen(div7, "click", triggerRefresh),
+ listen(textarea, "input", ctx[25])
+ ];
+ mounted = true;
+ }
+ },
+ p(ctx2, dirty) {
+ if (dirty[0] & 16) {
+ toggle_class(div7, "loading", ctx2[4]);
+ }
+ if (dirty[0] & 64) {
+ set_input_value(textarea, ctx2[6]);
+ }
+ if (ctx2[6]) {
+ if (if_block0) {
+ if_block0.p(ctx2, dirty);
+ } else {
+ if_block0 = create_if_block_5(ctx2);
+ if_block0.c();
+ if_block0.m(div8, null);
+ }
+ } else if (if_block0) {
+ if_block0.d(1);
+ if_block0 = null;
+ }
+ if (ctx2[5]) {
+ if (if_block1) {
+ if_block1.p(ctx2, dirty);
+ if (dirty[0] & 32) {
+ transition_in(if_block1, 1);
+ }
+ } else {
+ if_block1 = create_if_block4(ctx2);
+ if_block1.c();
+ transition_in(if_block1, 1);
+ if_block1.m(div10, null);
+ }
+ } else if (if_block1) {
+ group_outros();
+ transition_out(if_block1, 1, 1, () => {
+ if_block1 = null;
+ });
+ check_outros();
+ }
+ },
+ i(local) {
+ if (current)
+ return;
+ transition_in(if_block1);
+ current = true;
+ },
+ o(local) {
+ transition_out(if_block1);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching)
+ detach(main);
+ ctx[17](null);
+ ctx[18](null);
+ ctx[19](null);
+ ctx[20](null);
+ ctx[21](null);
+ ctx[22](null);
+ ctx[24](null);
+ if (if_block0)
+ if_block0.d();
+ if (if_block1)
+ if_block1.d();
+ mounted = false;
+ run_all(dispose);
+ }
+ };
+}
+function triggerRefresh() {
+ dispatchEvent(new CustomEvent("git-refresh"));
+}
+function instance4($$self, $$props, $$invalidate) {
+ let { plugin } = $$props;
+ let { view } = $$props;
+ let loading;
+ let status;
+ let commitMessage = plugin.settings.commitMessage;
+ let buttons = [];
+ let changeHierarchy;
+ let stagedHierarchy;
+ let changesOpen = true;
+ let stagedOpen = true;
+ let showTree = plugin.settings.treeStructure;
+ let layoutBtn;
+ addEventListener("git-view-refresh", refresh);
+ plugin.app.workspace.onLayoutReady(() => setImmediate(() => {
+ buttons.forEach((btn) => (0, import_obsidian13.setIcon)(btn, btn.getAttr("data-icon"), 16));
+ (0, import_obsidian13.setIcon)(layoutBtn, showTree ? "list" : "folder", 16);
+ }));
+ onDestroy(() => {
+ removeEventListener("git-view-refresh", refresh);
+ });
+ function commit() {
+ $$invalidate(4, loading = true);
+ plugin.gitManager.commit(commitMessage).then(() => {
+ if (commitMessage !== plugin.settings.commitMessage) {
+ $$invalidate(6, commitMessage = "");
+ }
+ }).finally(triggerRefresh);
+ }
+ function refresh() {
+ return __awaiter(this, void 0, void 0, function* () {
+ $$invalidate(5, status = plugin.cachedStatus);
+ if (status) {
+ $$invalidate(8, changeHierarchy = {
+ title: "",
+ children: plugin.gitManager.getTreeStructure(status.changed)
+ });
+ $$invalidate(9, stagedHierarchy = {
+ title: "",
+ children: plugin.gitManager.getTreeStructure(status.staged)
+ });
+ }
+ $$invalidate(4, loading = plugin.loading);
+ });
+ }
+ function stageAll() {
+ $$invalidate(4, loading = true);
+ plugin.gitManager.stageAll().finally(triggerRefresh);
+ }
+ function unstageAll() {
+ $$invalidate(4, loading = true);
+ plugin.gitManager.unstageAll().finally(triggerRefresh);
+ }
+ function push() {
+ $$invalidate(4, loading = true);
+ if (ready) {
+ plugin.push().finally(triggerRefresh);
+ }
+ }
+ function pull() {
+ $$invalidate(4, loading = true);
+ plugin.pullChangesFromRemote().finally(triggerRefresh);
+ }
+ function div0_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[0] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function div1_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[1] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function div2_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[2] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function div3_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[3] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function div4_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[4] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function div5_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ layoutBtn = $$value;
+ $$invalidate(3, layoutBtn);
+ });
+ }
+ const click_handler = () => {
+ $$invalidate(2, showTree = !showTree);
+ $$invalidate(0, plugin.settings.treeStructure = showTree, plugin);
+ plugin.saveSettings();
+ };
+ function div7_binding($$value) {
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
+ buttons[6] = $$value;
+ $$invalidate(7, buttons);
+ });
+ }
+ function textarea_input_handler() {
+ commitMessage = this.value;
+ $$invalidate(6, commitMessage);
+ }
+ const click_handler_1 = () => $$invalidate(6, commitMessage = "");
+ const click_handler_2 = () => $$invalidate(11, stagedOpen = !stagedOpen);
+ const click_handler_3 = () => $$invalidate(10, changesOpen = !changesOpen);
+ $$self.$$set = ($$props2) => {
+ if ("plugin" in $$props2)
+ $$invalidate(0, plugin = $$props2.plugin);
+ if ("view" in $$props2)
+ $$invalidate(1, view = $$props2.view);
+ };
+ $$self.$$.update = () => {
+ if ($$self.$$.dirty[0] & 12) {
+ $: {
+ if (layoutBtn) {
+ layoutBtn.empty();
+ (0, import_obsidian13.setIcon)(layoutBtn, showTree ? "list" : "folder", 16);
+ }
+ }
+ }
+ };
+ return [
+ plugin,
+ view,
+ showTree,
+ layoutBtn,
+ loading,
+ status,
+ commitMessage,
+ buttons,
+ changeHierarchy,
+ stagedHierarchy,
+ changesOpen,
+ stagedOpen,
+ commit,
+ stageAll,
+ unstageAll,
+ push,
+ pull,
+ div0_binding,
+ div1_binding,
+ div2_binding,
+ div3_binding,
+ div4_binding,
+ div5_binding,
+ click_handler,
+ div7_binding,
+ textarea_input_handler,
+ click_handler_1,
+ click_handler_2,
+ click_handler_3
+ ];
+}
+var GitView = class extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance4, create_fragment4, safe_not_equal, { plugin: 0, view: 1 }, add_css4, [-1, -1]);
+ }
+};
+var gitView_default = GitView;
+
+// src/ui/sidebar/sidebarView.ts
+var GitView2 = class extends import_obsidian14.ItemView {
+ constructor(leaf, plugin) {
+ super(leaf);
+ this.plugin = plugin;
+ this.hoverPopover = null;
+ }
+ getViewType() {
+ return GIT_VIEW_CONFIG.type;
+ }
+ getDisplayText() {
+ return GIT_VIEW_CONFIG.name;
+ }
+ getIcon() {
+ return GIT_VIEW_CONFIG.icon;
+ }
+ onClose() {
+ this._view.$destroy();
+ return super.onClose();
+ }
+ onOpen() {
+ this._view = new gitView_default({
+ target: this.contentEl,
+ props: {
+ plugin: this.plugin,
+ view: this
+ }
+ });
+ return super.onOpen();
+ }
+};
+
+// src/main.ts
+var ObsidianGit = class extends import_obsidian15.Plugin {
+ constructor() {
+ super(...arguments);
+ this.gitReady = false;
+ this.promiseQueue = new PromiseQueue();
+ this.conflictOutputFile = "conflict-files-obsidian-git.md";
+ this.offlineMode = false;
+ this.loading = false;
+ this.debRefresh = (0, import_obsidian15.debounce)(() => {
+ if (this.settings.refreshSourceControl) {
+ this.refresh();
+ }
+ }, 7e3, true);
+ }
+ setState(state) {
+ var _a2;
+ this.state = state;
+ (_a2 = this.statusBar) == null ? void 0 : _a2.display();
+ }
+ updateCachedStatus() {
+ return __async(this, null, function* () {
+ this.cachedStatus = yield this.gitManager.status();
+ return this.cachedStatus;
+ });
+ }
+ refresh() {
+ return __async(this, null, function* () {
+ const gitView = this.app.workspace.getLeavesOfType(GIT_VIEW_CONFIG.type);
+ if (this.settings.changedFilesInStatusBar || gitView.length > 0) {
+ this.loading = true;
+ dispatchEvent(new CustomEvent("git-view-refresh"));
+ yield this.updateCachedStatus();
+ this.loading = false;
+ dispatchEvent(new CustomEvent("git-view-refresh"));
+ }
+ });
+ }
+ onload() {
+ return __async(this, null, function* () {
+ console.log("loading " + this.manifest.name + " plugin");
+ yield this.loadSettings();
+ this.migrateSettings();
+ this.modifyEvent = this.app.vault.on("modify", () => {
+ this.debRefresh();
+ });
+ this.deleteEvent = this.app.vault.on("delete", () => {
+ this.debRefresh();
+ });
+ this.createEvent = this.app.vault.on("create", () => {
+ this.debRefresh();
+ });
+ this.renameEvent = this.app.vault.on("rename", () => {
+ this.debRefresh();
+ });
+ this.registerEvent(this.modifyEvent);
+ this.registerEvent(this.deleteEvent);
+ this.registerEvent(this.createEvent);
+ this.registerEvent(this.renameEvent);
+ addEventListener("git-refresh", this.refresh.bind(this));
+ this.registerView(GIT_VIEW_CONFIG.type, (leaf) => {
+ return new GitView2(leaf, this);
+ });
+ this.registerView(DIFF_VIEW_CONFIG.type, (leaf) => {
+ return new DiffView(leaf, this);
+ });
+ this.app.workspace.registerHoverLinkSource(GIT_VIEW_CONFIG.type, {
+ display: "Git View",
+ defaultMod: true
+ });
+ this.addSettingTab(new ObsidianGitSettingsTab(this.app, this));
+ this.addCommand({
+ id: "open-git-view",
+ name: "Open source control view",
+ callback: () => __async(this, null, function* () {
+ if (this.app.workspace.getLeavesOfType(GIT_VIEW_CONFIG.type).length === 0) {
+ yield this.app.workspace.getRightLeaf(false).setViewState({
+ type: GIT_VIEW_CONFIG.type
+ });
+ }
+ this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(GIT_VIEW_CONFIG.type).first());
+ dispatchEvent(new CustomEvent("git-refresh"));
+ })
+ });
+ this.addCommand({
+ id: "open-diff-view",
+ name: "Open diff view",
+ editorCallback: (editor, view) => __async(this, null, function* () {
+ this.app.workspace.createLeafBySplit(view.leaf).setViewState({ type: DIFF_VIEW_CONFIG.type, state: { staged: false, file: view.file.path } });
+ })
+ });
+ this.addCommand({
+ id: "view-file-on-github",
+ name: "Open file on GitHub",
+ editorCallback: (editor, { file }) => openLineInGitHub(editor, file, this.gitManager)
+ });
+ this.addCommand({
+ id: "view-history-on-github",
+ name: "Open file history on GitHub",
+ editorCallback: (_, { file }) => openHistoryInGitHub(file, this.gitManager)
+ });
+ this.addCommand({
+ id: "pull",
+ name: "Pull",
+ callback: () => this.promiseQueue.addTask(() => this.pullChangesFromRemote())
+ });
+ this.addCommand({
+ id: "push",
+ name: "Create backup",
+ callback: () => this.promiseQueue.addTask(() => this.createBackup(false))
+ });
+ this.addCommand({
+ id: "commit-push-specified-message",
+ name: "Create backup with specific message",
+ callback: () => this.promiseQueue.addTask(() => this.createBackup(false, true))
+ });
+ this.addCommand({
+ id: "commit",
+ name: "Commit all changes",
+ callback: () => this.promiseQueue.addTask(() => this.commit(false))
+ });
+ this.addCommand({
+ id: "commit-specified-message",
+ name: "Commit all changes with specific message",
+ callback: () => this.promiseQueue.addTask(() => this.commit(false, true))
+ });
+ this.addCommand({
+ id: "push2",
+ name: "Push",
+ callback: () => this.promiseQueue.addTask(() => this.push())
+ });
+ this.addCommand({
+ id: "edit-remotes",
+ name: "Edit remotes",
+ callback: () => __async(this, null, function* () {
+ return this.editRemotes();
+ })
+ });
+ this.addCommand({
+ id: "remove-remote",
+ name: "Remove remote",
+ callback: () => __async(this, null, function* () {
+ return this.removeRemote();
+ })
+ });
+ this.addCommand({
+ id: "init-repo",
+ name: "Initialize a new repo",
+ callback: () => __async(this, null, function* () {
+ return this.createNewRepo();
+ })
+ });
+ this.addCommand({
+ id: "clone-repo",
+ name: "Clone an existing remote repo",
+ callback: () => __async(this, null, function* () {
+ return this.cloneNewRepo();
+ })
+ });
+ this.addCommand({
+ id: "list-changed-files",
+ name: "List changed files",
+ callback: () => __async(this, null, function* () {
+ const status = yield this.gitManager.status();
+ this.setState(PluginState.idle);
+ new ChangedFilesModal(this, status.changed).open();
+ })
+ });
+ if (this.settings.showStatusBar) {
+ let statusBarEl = this.addStatusBarItem();
+ this.statusBar = new StatusBar(statusBarEl, this);
+ this.registerInterval(window.setInterval(() => this.statusBar.display(), 1e3));
+ }
+ this.app.workspace.onLayoutReady(() => this.init());
+ });
+ }
+ migrateSettings() {
+ if (this.settings.mergeOnPull != void 0) {
+ this.settings.syncMethod = this.settings.mergeOnPull ? "merge" : "rebase";
+ this.settings.mergeOnPull = void 0;
+ return this.saveSettings();
+ }
+ if (this.settings.autoCommitMessage === void 0) {
+ this.settings.autoCommitMessage = this.settings.commitMessage;
+ this.saveSettings();
+ }
+ }
+ onunload() {
+ return __async(this, null, function* () {
+ this.app.workspace.unregisterHoverLinkSource(GIT_VIEW_CONFIG.type);
+ this.app.workspace.detachLeavesOfType(GIT_VIEW_CONFIG.type);
+ this.app.workspace.detachLeavesOfType(DIFF_VIEW_CONFIG.type);
+ this.clearAutoPull();
+ this.clearAutoBackup();
+ removeEventListener("git-refresh", this.refresh.bind(this));
+ this.app.metadataCache.offref(this.modifyEvent);
+ this.app.metadataCache.offref(this.deleteEvent);
+ this.app.metadataCache.offref(this.createEvent);
+ this.app.metadataCache.offref(this.renameEvent);
+ console.log("unloading " + this.manifest.name + " plugin");
+ });
+ }
+ loadSettings() {
+ return __async(this, null, function* () {
+ this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
+ });
+ }
+ saveSettings() {
+ return __async(this, null, function* () {
+ yield this.saveData(this.settings);
+ });
+ }
+ saveLastAuto(date, mode) {
+ return __async(this, null, function* () {
+ if (mode === "backup") {
+ window.localStorage.setItem(this.manifest.id + ":lastAutoBackup", date.toString());
+ } else if (mode === "pull") {
+ window.localStorage.setItem(this.manifest.id + ":lastAutoPull", date.toString());
+ } else if (mode === "push") {
+ window.localStorage.setItem(this.manifest.id + ":lastAutoPush", date.toString());
+ }
+ });
+ }
+ loadLastAuto() {
+ return __async(this, null, function* () {
+ var _a2, _b, _c;
+ return {
+ "backup": new Date((_a2 = window.localStorage.getItem(this.manifest.id + ":lastAutoBackup")) != null ? _a2 : ""),
+ "pull": new Date((_b = window.localStorage.getItem(this.manifest.id + ":lastAutoPull")) != null ? _b : ""),
+ "push": new Date((_c = window.localStorage.getItem(this.manifest.id + ":lastAutoPush")) != null ? _c : "")
+ };
+ });
+ }
+ init() {
+ return __async(this, null, function* () {
+ try {
+ this.gitManager = new SimpleGit(this);
+ if (this.gitManager instanceof SimpleGit) {
+ yield this.gitManager.setGitInstance();
+ }
+ const result = yield this.gitManager.checkRequirements();
+ switch (result) {
+ case "missing-git":
+ this.displayError("Cannot run git command");
+ break;
+ case "missing-repo":
+ new import_obsidian15.Notice("Can't find a valid git repository. Please create one via the given command.");
+ break;
+ case "valid":
+ this.gitReady = true;
+ this.setState(PluginState.idle);
+ dispatchEvent(new CustomEvent("git-refresh"));
+ if (this.settings.autoPullOnBoot) {
+ this.promiseQueue.addTask(() => this.pullChangesFromRemote());
+ }
+ const lastAutos = yield this.loadLastAuto();
+ if (this.settings.autoSaveInterval > 0) {
+ const now2 = new Date();
+ const diff = this.settings.autoSaveInterval - Math.round((now2.getTime() - lastAutos.backup.getTime()) / 1e3 / 60);
+ this.startAutoBackup(diff <= 0 ? 0 : diff);
+ }
+ if (this.settings.differentIntervalCommitAndPush && this.settings.autoPushInterval > 0) {
+ const now2 = new Date();
+ const diff = this.settings.autoPushInterval - Math.round((now2.getTime() - lastAutos.push.getTime()) / 1e3 / 60);
+ this.startAutoPush(diff <= 0 ? 0 : diff);
+ }
+ if (this.settings.autoPullInterval > 0) {
+ const now2 = new Date();
+ const diff = this.settings.autoPullInterval - Math.round((now2.getTime() - lastAutos.pull.getTime()) / 1e3 / 60);
+ this.startAutoPull(diff <= 0 ? 0 : diff);
+ }
+ break;
+ default:
+ console.log("Something weird happened. The 'checkRequirements' result is " + result);
+ }
+ } catch (error) {
+ this.displayError(error);
+ console.error(error);
+ }
+ });
+ }
+ createNewRepo() {
+ return __async(this, null, function* () {
+ yield this.gitManager.init();
+ new import_obsidian15.Notice("Initialized new repo");
+ });
+ }
+ cloneNewRepo() {
+ return __async(this, null, function* () {
+ const modal = new GeneralModal(this.app, [], "Enter remote URL");
+ const url = yield modal.open();
+ if (url) {
+ let dir = yield new GeneralModal(this.app, [], "Enter directory for clone. It needs to be empty or not existent.").open();
+ if (dir) {
+ dir = path2.normalize(dir);
+ new import_obsidian15.Notice(`Cloning new repo into "${dir}"`);
+ yield this.gitManager.clone(url, dir);
+ new import_obsidian15.Notice("Cloned new repo");
+ }
+ }
+ });
+ }
+ isAllInitialized() {
+ return __async(this, null, function* () {
+ if (!this.gitReady) {
+ yield this.init();
+ }
+ return this.gitReady;
+ });
+ }
+ pullChangesFromRemote() {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return;
+ const filesUpdated = yield this.pull();
+ if (!filesUpdated) {
+ this.displayMessage("Everything is up-to-date");
+ }
+ if (this.gitManager instanceof SimpleGit) {
+ const status = yield this.gitManager.status();
+ if (status.conflicted.length > 0) {
+ this.displayError(`You have ${status.conflicted.length} conflict ${status.conflicted.length > 1 ? "files" : "file"}`);
+ this.handleConflict(status.conflicted);
+ }
+ }
+ dispatchEvent(new CustomEvent("git-refresh"));
+ this.lastUpdate = Date.now();
+ this.setState(PluginState.idle);
+ });
+ }
+ createBackup(fromAutoBackup, requestCustomMessage = false) {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return;
+ if (!(yield this.commit(fromAutoBackup, requestCustomMessage)))
+ return;
+ if (!this.settings.disablePush) {
+ if (yield this.gitManager.canPush()) {
+ if (this.settings.pullBeforePush) {
+ yield this.pull();
+ }
+ yield this.push();
+ } else {
+ this.displayMessage("No changes to push");
+ }
+ }
+ this.setState(PluginState.idle);
+ });
+ }
+ commit(fromAutoBackup, requestCustomMessage = false) {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return false;
+ const file = this.app.vault.getAbstractFileByPath(this.conflictOutputFile);
+ if (file)
+ yield this.app.vault.delete(file);
+ let status;
+ if (this.gitManager instanceof SimpleGit) {
+ status = yield this.gitManager.status();
+ if (fromAutoBackup && status.conflicted.length > 0) {
+ this.displayError(`Did not commit, because you have ${status.conflicted.length} conflict ${status.conflicted.length > 1 ? "files" : "file"}. Please resolve them and commit per command.`);
+ this.handleConflict(status.conflicted);
+ return;
+ }
+ } else {
+ status = yield this.gitManager.status();
+ }
+ const changedFiles = status.changed;
+ if (changedFiles.length !== 0) {
+ let commitMessage = fromAutoBackup ? this.settings.autoCommitMessage : this.settings.commitMessage;
+ if (fromAutoBackup && this.settings.customMessageOnAutoBackup || requestCustomMessage) {
+ if (!this.settings.disablePopups && fromAutoBackup) {
+ new import_obsidian15.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");
+ }
+ const tempMessage = yield new CustomMessageModal(this, true).open();
+ if (tempMessage != void 0 && tempMessage != "" && tempMessage != "...") {
+ commitMessage = tempMessage;
+ } else {
+ this.setState(PluginState.idle);
+ return false;
+ }
+ }
+ const committedFiles = yield this.gitManager.commitAll(commitMessage);
+ this.displayMessage(`Committed ${committedFiles} ${committedFiles > 1 ? "files" : "file"}`);
+ } else {
+ this.displayMessage("No changes to commit");
+ }
+ dispatchEvent(new CustomEvent("git-refresh"));
+ this.setState(PluginState.idle);
+ return true;
+ });
+ }
+ push() {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return false;
+ if (!this.remotesAreSet()) {
+ return false;
+ }
+ const file = this.app.vault.getAbstractFileByPath(this.conflictOutputFile);
+ if (file)
+ yield this.app.vault.delete(file);
+ let status;
+ if (this.gitManager instanceof SimpleGit && (status = yield this.gitManager.status()).conflicted.length > 0) {
+ this.displayError(`Cannot push. You have ${status.conflicted.length} conflict ${status.conflicted.length > 1 ? "files" : "file"}`);
+ this.handleConflict(status.conflicted);
+ return false;
+ } else {
+ const pushedFiles = yield this.gitManager.push();
+ this.lastUpdate = Date.now();
+ if (pushedFiles > 0) {
+ this.displayMessage(`Pushed ${pushedFiles} ${pushedFiles > 1 ? "files" : "file"} to remote`);
+ } else {
+ this.displayMessage(`No changes to push`);
+ }
+ this.offlineMode = false;
+ this.setState(PluginState.idle);
+ return true;
+ }
+ });
+ }
+ pull() {
+ return __async(this, null, function* () {
+ const pulledFilesLength = yield this.gitManager.pull();
+ this.offlineMode = false;
+ if (pulledFilesLength > 0) {
+ this.displayMessage(`Pulled ${pulledFilesLength} ${pulledFilesLength > 1 ? "files" : "file"} from remote`);
+ }
+ return pulledFilesLength != 0;
+ });
+ }
+ remotesAreSet() {
+ return __async(this, null, function* () {
+ if (!(yield this.gitManager.branchInfo()).tracking) {
+ new import_obsidian15.Notice("No upstream branch is set. Please select one.");
+ const remoteBranch = yield this.selectRemoteBranch();
+ if (remoteBranch == void 0) {
+ this.displayError("Did not push. No upstream-branch is set!", 1e4);
+ this.setState(PluginState.idle);
+ return false;
+ } else {
+ yield this.gitManager.updateUpstreamBranch(remoteBranch);
+ return true;
+ }
+ }
+ return true;
+ });
+ }
+ startAutoBackup(minutes) {
+ const time = (minutes != null ? minutes : this.settings.autoSaveInterval) * 6e4;
+ if (this.settings.autoBackupAfterFileChange) {
+ if (minutes === 0) {
+ this.doAutoBackup();
+ } else {
+ this.onFileModifyEventRef = this.app.vault.on("modify", () => this.autoBackupDebouncer());
+ this.autoBackupDebouncer = (0, import_obsidian15.debounce)(() => this.doAutoBackup(), time, true);
+ }
+ } else {
+ this.timeoutIDBackup = window.setTimeout(() => this.doAutoBackup(), time);
+ }
+ }
+ doAutoBackup() {
+ this.promiseQueue.addTask(() => {
+ if (this.settings.differentIntervalCommitAndPush) {
+ return this.commit(true);
+ } else {
+ return this.createBackup(true);
+ }
+ });
+ this.saveLastAuto(new Date(), "backup");
+ this.saveSettings();
+ this.startAutoBackup();
+ }
+ startAutoPull(minutes) {
+ this.timeoutIDPull = window.setTimeout(() => {
+ this.promiseQueue.addTask(() => this.pullChangesFromRemote());
+ this.saveLastAuto(new Date(), "pull");
+ this.saveSettings();
+ this.startAutoPull();
+ }, (minutes != null ? minutes : this.settings.autoPullInterval) * 6e4);
+ }
+ startAutoPush(minutes) {
+ this.timeoutIDPush = window.setTimeout(() => {
+ this.promiseQueue.addTask(() => this.push());
+ this.saveLastAuto(new Date(), "push");
+ this.saveSettings();
+ this.startAutoPush();
+ }, (minutes != null ? minutes : this.settings.autoPushInterval) * 6e4);
+ }
+ clearAutoBackup() {
+ var _a2;
+ let wasActive = false;
+ if (this.timeoutIDBackup) {
+ window.clearTimeout(this.timeoutIDBackup);
+ this.timeoutIDBackup = void 0;
+ wasActive = true;
+ }
+ if (this.onFileModifyEventRef) {
+ (_a2 = this.autoBackupDebouncer) == null ? void 0 : _a2.cancel();
+ this.app.vault.offref(this.onFileModifyEventRef);
+ this.onFileModifyEventRef = void 0;
+ wasActive = true;
+ }
+ return wasActive;
+ }
+ clearAutoPull() {
+ if (this.timeoutIDPull) {
+ window.clearTimeout(this.timeoutIDPull);
+ this.timeoutIDPull = void 0;
+ return true;
+ }
+ return false;
+ }
+ clearAutoPush() {
+ if (this.timeoutIDPush) {
+ window.clearTimeout(this.timeoutIDPush);
+ this.timeoutIDPush = void 0;
+ return true;
+ }
+ return false;
+ }
+ handleConflict(conflicted) {
+ return __async(this, null, function* () {
+ this.setState(PluginState.conflicted);
+ const lines = [
+ "# Conflict files",
+ "Please resolve them and commit per command (This file will be deleted before the commit).",
+ ...conflicted.map((e) => {
+ const file = this.app.vault.getAbstractFileByPath(e);
+ if (file instanceof import_obsidian15.TFile) {
+ const link = this.app.metadataCache.fileToLinktext(file, "/");
+ return `- [[${link}]]`;
+ } else {
+ return `- Not a file: ${e}`;
+ }
+ })
+ ];
+ this.writeAndOpenFile(lines.join("\n"));
+ });
+ }
+ editRemotes() {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return;
+ const remotes = yield this.gitManager.getRemotes();
+ const nameModal = new GeneralModal(this.app, remotes, "Select or create a new remote by typing its name and selecting it");
+ const remoteName = yield nameModal.open();
+ if (remoteName) {
+ const urlModal = new GeneralModal(this.app, [], "Enter the remote URL");
+ const remoteURL = yield urlModal.open();
+ yield this.gitManager.setRemote(remoteName, remoteURL);
+ return remoteName;
+ }
+ });
+ }
+ selectRemoteBranch() {
+ return __async(this, null, function* () {
+ let remotes = yield this.gitManager.getRemotes();
+ let selectedRemote;
+ if (remotes.length === 0) {
+ selectedRemote = yield this.editRemotes();
+ if (selectedRemote == void 0) {
+ remotes = yield this.gitManager.getRemotes();
+ }
+ }
+ const nameModal = new GeneralModal(this.app, remotes, "Select or create a new remote by typing its name and selecting it");
+ const remoteName = selectedRemote != null ? selectedRemote : yield nameModal.open();
+ if (remoteName) {
+ this.displayMessage("Fetching remote branches");
+ yield this.gitManager.fetch(remoteName);
+ const branches = yield this.gitManager.getRemoteBranches(remoteName);
+ const branchModal = new GeneralModal(this.app, branches, "Select or create a new remote branch by typing its name and selecting it");
+ return yield branchModal.open();
+ }
+ });
+ }
+ removeRemote() {
+ return __async(this, null, function* () {
+ if (!(yield this.isAllInitialized()))
+ return;
+ const remotes = yield this.gitManager.getRemotes();
+ const nameModal = new GeneralModal(this.app, remotes, "Select a remote");
+ const remoteName = yield nameModal.open();
+ if (remoteName) {
+ this.gitManager.removeRemote(remoteName);
+ }
+ });
+ }
+ writeAndOpenFile(text2) {
+ return __async(this, null, function* () {
+ yield this.app.vault.adapter.write(this.conflictOutputFile, text2);
+ let fileIsAlreadyOpened = false;
+ this.app.workspace.iterateAllLeaves((leaf) => {
+ if (leaf.getDisplayText() != "" && this.conflictOutputFile.startsWith(leaf.getDisplayText())) {
+ fileIsAlreadyOpened = true;
+ }
+ });
+ if (!fileIsAlreadyOpened) {
+ this.app.workspace.openLinkText(this.conflictOutputFile, "/", true);
+ }
+ });
+ }
+ displayMessage(message, timeout = 4 * 1e3) {
+ var _a2;
+ (_a2 = this.statusBar) == null ? void 0 : _a2.displayMessage(message.toLowerCase(), timeout);
+ if (!this.settings.disablePopups) {
+ new import_obsidian15.Notice(message, 5 * 1e3);
+ }
+ console.log(`git obsidian message: ${message}`);
+ }
+ displayError(message, timeout = 10 * 1e3) {
+ var _a2;
+ message = message.toString();
+ new import_obsidian15.Notice(message, timeout);
+ console.log(`git obsidian error: ${message}`);
+ (_a2 = this.statusBar) == null ? void 0 : _a2.displayMessage(message.toLowerCase(), timeout);
+ }
+};
+// Annotate the CommonJS export names for ESM import in node:
+0 && (module.exports = {});
+/*!
+ Copyright (c) 2016 Jed Watson.
+ Licensed under the MIT License (MIT), see
+ http://jedwatson.github.io/classnames
+*/
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json
new file mode 100644
index 0000000..f09ed67
--- /dev/null
+++ b/.obsidian/plugins/obsidian-git/manifest.json
@@ -0,0 +1,8 @@
+{
+ "id": "obsidian-git",
+ "name": "Obsidian Git",
+ "description": "Backup your vault with git.",
+ "isDesktopOnly": true,
+ "js": "main.js",
+ "version": "1.26.1"
+}
diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css
new file mode 100644
index 0000000..68a06f0
--- /dev/null
+++ b/.obsidian/plugins/obsidian-git/styles.css
@@ -0,0 +1,413 @@
+@keyframes loading {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+}
+.loading > svg {
+ animation: 2s linear infinite loading;
+ transform-origin: 50% 50%;
+ display: inline-block;
+}
+
+.obsidian-git-center {
+ margin: auto;
+ width: 50%;
+}
+
+.tooltip.mod-left {
+ overflow-wrap: break-word;
+}
+
+.tooltip.mod-right {
+ overflow-wrap: break-word;
+}
+
+.obsidian-git-shortcuts {
+ margin: 10px;
+}
+
+.diff-err {
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ flex-direction: column;
+ align-items: center;
+}
+
+.diff-err-sign {
+ font-size: 2em;
+}
+
+.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
+ display: none;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
+ text-align: left;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
+ background-color: var(--background-primary);
+ border-bottom: 1px solid var(--interactive-accent);
+ font-family: var(--font-monospace);
+ height: 35px;
+ padding: 5px 10px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
+ font-size: 14px;
+ margin-left: auto;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
+ border: 1px solid #b4e2b4;
+ border-radius: 5px 0 0 5px;
+ color: #399839;
+ padding: 2px;
+ text-align: right;
+ vertical-align: middle;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
+ border: 1px solid #e9aeae;
+ border-radius: 0 5px 5px 0;
+ color: #c33;
+ margin-left: 1px;
+ padding: 2px;
+ text-align: left;
+ vertical-align: middle;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ font-size: 15px;
+ width: 100%;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
+ overflow-x: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
+ border: 1px solid var(--background-modifier-border);
+ border-radius: 3px;
+ margin-bottom: 1em;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
+ -webkit-box-pack: end;
+ -ms-flex-pack: end;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ border: 1px solid var(--background-modifier-border);
+ border-radius: 3px;
+ cursor: pointer;
+ display: none;
+ font-size: 12px;
+ justify-content: flex-end;
+ padding: 4px 8px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
+ background-color: #c8e1ff;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
+ margin: 0 4px 0 0;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
+ border-collapse: collapse;
+ font-family: Menlo, Consolas, monospace;
+ font-size: 13px;
+ width: 100%;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
+ width: 100%;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
+ overflow-y: hidden;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
+ display: inline-block;
+ margin-bottom: -8px;
+ margin-right: -4px;
+ overflow-x: scroll;
+ overflow-y: hidden;
+ width: 50%;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
+ padding: 0 8em;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
+ display: inline-block;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ white-space: nowrap;
+ width: 100%;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
+ padding: 0 4.5em;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
+ word-wrap: normal;
+ background: none;
+ display: inline-block;
+ padding: 0;
+ -webkit-user-select: text;
+ -moz-user-select: text;
+ -ms-user-select: text;
+ user-select: text;
+ vertical-align: middle;
+ white-space: pre;
+ width: 100%;
+}
+.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
+.theme-light
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-code-side-line
+ del {
+ background-color: #ffb6ba;
+}
+.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
+.theme-dark
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-code-side-line
+ del {
+ background-color: #8d232881;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
+ border-radius: 0.2em;
+ display: inline-block;
+ margin-top: -1px;
+ text-decoration: none;
+ vertical-align: middle;
+}
+.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
+.theme-light
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-code-side-line
+ ins {
+ background-color: #97f295;
+ text-align: left;
+}
+.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
+.theme-dark
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-code-side-line
+ ins {
+ background-color: #1d921996;
+ text-align: left;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
+ word-wrap: normal;
+ background: none;
+ display: inline;
+ padding: 0;
+ white-space: pre;
+}
+.workspace-leaf-content[data-type="diff-view"] .line-num1 {
+ float: left;
+}
+.workspace-leaf-content[data-type="diff-view"] .line-num1,
+.workspace-leaf-content[data-type="diff-view"] .line-num2 {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ overflow: hidden;
+ padding: 0 0.5em;
+ text-overflow: ellipsis;
+ width: 3.5em;
+}
+.workspace-leaf-content[data-type="diff-view"] .line-num2 {
+ float: right;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
+ background-color: var(--background-primary);
+ border: solid var(--background-modifier-border);
+ border-width: 0 1px;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ color: var(--text-muted);
+ cursor: pointer;
+ display: inline-block;
+ position: absolute;
+ text-align: right;
+ width: 7.5em;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
+ content: "\200b";
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
+ background-color: var(--background-primary);
+ border: solid var(--background-modifier-border);
+ border-width: 0 1px;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ color: var(--text-muted);
+ cursor: pointer;
+ display: inline-block;
+ overflow: hidden;
+ padding: 0 0.5em;
+ position: absolute;
+ text-align: right;
+ text-overflow: ellipsis;
+ width: 4em;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
+ content: "\200b";
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
+.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
+ background-color: var(--background-primary);
+ border-color: var(--background-modifier-border);
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
+.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
+.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
+ direction: rtl;
+}
+.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
+ background-color: #fee8e9;
+ border-color: #e9aeae;
+}
+.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
+ background-color: #dfd;
+ border-color: #b4e2b4;
+}
+.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
+ background-color: #521b1d83;
+ border-color: #691d1d73;
+}
+.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
+ background-color: rgba(30, 71, 30, 0.5);
+ border-color: #13501381;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-info {
+ background-color: var(--background-primary);
+ border-color: var(--background-modifier-border);
+ color: var(--text-normal);
+}
+.theme-light
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-file-diff
+ .d2h-del.d2h-change {
+ background-color: #fdf2d0;
+}
+.theme-dark
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-file-diff
+ .d2h-del.d2h-change {
+ background-color: #55492480;
+}
+.theme-light
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-file-diff
+ .d2h-ins.d2h-change {
+ background-color: #ded;
+}
+.theme-dark
+ .workspace-leaf-content[data-type="diff-view"]
+ .d2h-file-diff
+ .d2h-ins.d2h-change {
+ background-color: rgba(37, 78, 37, 0.418);
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
+ margin-bottom: 10px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
+ color: #3572b0;
+ text-decoration: none;
+}
+.workspace-leaf-content[data-type="diff-view"]
+ .d2h-file-list-wrapper
+ a:visited {
+ color: #3572b0;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
+ text-align: left;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
+ font-weight: 700;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ text-align: left;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
+ display: block;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
+ border-bottom: 1px solid var(--background-modifier-border);
+ margin: 0;
+ padding: 5px 10px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
+ border-bottom: none;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
+ cursor: pointer;
+ display: none;
+ font-size: 10px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
+ fill: currentColor;
+ margin-right: 10px;
+ vertical-align: middle;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
+ color: #c33;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-added {
+ color: #399839;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
+ color: #d0b44c;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
+ color: #3572b0;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
+ background-color: var(--background-primary);
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ font-size: 10px;
+ margin-left: 5px;
+ padding: 0 2px;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
+ border: 2px solid #c33;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
+ border: 1px solid #399839;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
+ border: 1px solid #d0b44c;
+}
+.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
+ border: 1px solid #3572b0;
+}