@tom2012/cc-web 1.5.139 → 1.5.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/backend/dist/routes/update.d.ts.map +1 -1
- package/backend/dist/routes/update.js +192 -2
- package/backend/dist/routes/update.js.map +1 -1
- package/bin/ccweb.js +1 -0
- package/frontend/dist/assets/{GraphPreview-BTgFKSjk.js → GraphPreview-DQ1PWN7Z.js} +2 -2
- package/frontend/dist/assets/{MobilePage-BPNlolS1.js → MobilePage-CkqXiieT.js} +3 -3
- package/frontend/dist/assets/{OfficePreview-D1dhk4ak.js → OfficePreview-BgSC_qJO.js} +2 -2
- package/frontend/dist/assets/{PlanPanel-DpmtjuTA.js → PlanPanel-BuBoxAuW.js} +3 -3
- package/frontend/dist/assets/{ProjectPage-DAUYZ_h2.js → ProjectPage-C2bWnFrt.js} +5 -5
- package/frontend/dist/assets/{SettingsPage-CHIpjrDE.js → SettingsPage-DFpK0P-A.js} +1 -1
- package/frontend/dist/assets/{ShareViewPage-BgdxU8xb.js → ShareViewPage-CsOYTcE7.js} +1 -1
- package/frontend/dist/assets/{SkillHubPage-BnlK4jW9.js → SkillHubPage-CRkrTSe2.js} +2 -2
- package/frontend/dist/assets/{bot-Cnojz41_.js → bot-BmHJEn5T.js} +1 -1
- package/frontend/dist/assets/{chevron-down-B8MXSSmz.js → chevron-down-B6Hw6ZHb.js} +1 -1
- package/frontend/dist/assets/{chevron-up-BCaNtF62.js → chevron-up-kZcJlZXC.js} +1 -1
- package/frontend/dist/assets/{index-Dy6GjUkg.js → index-CZaOAbFH.js} +8 -8
- package/frontend/dist/assets/{index-CSVnSjv3.js → index-CvNl42pp.js} +1 -1
- package/frontend/dist/assets/{index-DwNKstbG.css → index-FX_lB71W.css} +1 -1
- package/frontend/dist/assets/{jszip.min-DZuIcKDF.js → jszip.min-fplwIoHY.js} +1 -1
- package/frontend/dist/assets/{matter-CUKH0JgM.js → matter-B3VPlUf9.js} +1 -1
- package/frontend/dist/assets/{maximize-2-DAuA7iJN.js → maximize-2-CLx3b_Oh.js} +1 -1
- package/frontend/dist/assets/one-light-Cdckudr4.js +13 -0
- package/frontend/dist/assets/{save-Byin3sjn.js → save-BstMg_CY.js} +1 -1
- package/frontend/dist/assets/{search-C4bGyZ-S.js → search-nm4d1lSC.js} +1 -1
- package/frontend/dist/assets/{user-hOtwIuS9.js → user-CuRZCkSo.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/download-CvZuKjOx.js +0 -7
- package/frontend/dist/assets/one-light-DwnbtA48.js +0 -13
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A self-hosted web application (distributed as npm package) that provides a browser-based interface for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI sessions. Create projects, each with a persistent terminal running Claude Code, and interact with them through a real-time terminal UI.
|
|
4
4
|
|
|
5
|
-
**Current version**: v1.5.
|
|
5
|
+
**Current version**: v1.5.141 | [GitHub](https://github.com/zbc0315/cc-web) | MIT License
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/routes/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/routes/update.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,MAAM,4CAAW,CAAC;AAiQxB,eAAe,MAAM,CAAC"}
|
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
const express_1 = require("express");
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
4
41
|
const config_1 = require("../config");
|
|
5
42
|
const terminal_manager_1 = require("../terminal-manager");
|
|
43
|
+
const DATA_DIR = process.env.CCWEB_DATA_DIR || path.join(os.homedir(), '.ccweb');
|
|
44
|
+
const UPDATE_STATUS_FILE = path.join(DATA_DIR, 'update-status.json');
|
|
45
|
+
const UPDATE_AGENT_LOG = path.join(DATA_DIR, 'update-agent.log');
|
|
6
46
|
const router = (0, express_1.Router)();
|
|
7
47
|
const MEMORY_SAVE_COMMAND = '请更新与本项目相关的全部记忆、工作计划、已完成工作、未完成工作和后台任务\r';
|
|
8
48
|
// Idle = no PTY output for this many ms
|
|
@@ -13,7 +53,11 @@ const MAX_WAIT_MS = 120000; // 2 minutes max per project
|
|
|
13
53
|
* GET /api/update/check-running
|
|
14
54
|
* Returns list of running projects so the frontend can warn the user.
|
|
15
55
|
*/
|
|
16
|
-
router.get('/check-running', (
|
|
56
|
+
router.get('/check-running', (req, res) => {
|
|
57
|
+
if (!(0, config_1.isAdminUser)(req.user?.username)) {
|
|
58
|
+
res.status(403).json({ error: 'Admin only' });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
17
61
|
const projects = (0, config_1.getProjects)();
|
|
18
62
|
const running = projects.filter((p) => p.status === 'running' && terminal_manager_1.terminalManager.hasTerminal(p.id));
|
|
19
63
|
res.json({
|
|
@@ -28,7 +72,11 @@ router.get('/check-running', (_req, res) => {
|
|
|
28
72
|
* 2. Wait until Claude goes idle (no PTY output for IDLE_THRESHOLD_MS)
|
|
29
73
|
* Returns per-project status.
|
|
30
74
|
*/
|
|
31
|
-
router.post('/prepare', async (
|
|
75
|
+
router.post('/prepare', async (req, res) => {
|
|
76
|
+
if (!(0, config_1.isAdminUser)(req.user?.username)) {
|
|
77
|
+
res.status(403).json({ error: 'Admin only' });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
32
80
|
const projects = (0, config_1.getProjects)();
|
|
33
81
|
const running = projects.filter((p) => p.status === 'running' && terminal_manager_1.terminalManager.hasTerminal(p.id));
|
|
34
82
|
if (running.length === 0) {
|
|
@@ -105,5 +153,147 @@ function waitForIdle(projectId, idleMs, timeoutMs) {
|
|
|
105
153
|
const safetyTimer = setTimeout(() => done(false), timeoutMs + 100);
|
|
106
154
|
});
|
|
107
155
|
}
|
|
156
|
+
let updateInProgress = false;
|
|
157
|
+
/**
|
|
158
|
+
* POST /api/update/execute
|
|
159
|
+
* Admin-only. Spawns a detached updater agent, then shuts down the server.
|
|
160
|
+
* The agent waits for exit, runs npm install -g, and restarts ccweb.
|
|
161
|
+
*/
|
|
162
|
+
router.post('/execute', (req, res) => {
|
|
163
|
+
if (!(0, config_1.isAdminUser)(req.user?.username)) {
|
|
164
|
+
res.status(403).json({ error: 'Admin only' });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (updateInProgress) {
|
|
168
|
+
res.status(409).json({ error: 'Update already in progress' });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const accessMode = process.env.CCWEB_ACCESS_MODE || 'local';
|
|
172
|
+
const serverPid = process.pid;
|
|
173
|
+
const previousVersion = (() => {
|
|
174
|
+
try {
|
|
175
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));
|
|
176
|
+
return pkg.version || 'unknown';
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return 'unknown';
|
|
180
|
+
}
|
|
181
|
+
})();
|
|
182
|
+
// Clean up any stale status file
|
|
183
|
+
try {
|
|
184
|
+
fs.unlinkSync(UPDATE_STATUS_FILE);
|
|
185
|
+
}
|
|
186
|
+
catch { /**/ }
|
|
187
|
+
// Build the inline agent script — runs in a separate Node process, survives server exit
|
|
188
|
+
const agentScript = `
|
|
189
|
+
const { execSync } = require('child_process');
|
|
190
|
+
const fs = require('fs');
|
|
191
|
+
const path = require('path');
|
|
192
|
+
|
|
193
|
+
const SERVER_PID = ${serverPid};
|
|
194
|
+
const ACCESS_MODE = ${JSON.stringify(accessMode)};
|
|
195
|
+
const STATUS_FILE = ${JSON.stringify(UPDATE_STATUS_FILE)};
|
|
196
|
+
const PREV_VERSION = ${JSON.stringify(previousVersion)};
|
|
197
|
+
const PKG = '@tom2012/cc-web';
|
|
198
|
+
|
|
199
|
+
function writeStatus(obj) {
|
|
200
|
+
try { fs.writeFileSync(STATUS_FILE, JSON.stringify(obj, null, 2)); } catch(e) { console.error('writeStatus failed:', e); }
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 1. Wait for server to exit (max 30s)
|
|
204
|
+
function isAlive(pid) { try { process.kill(pid, 0); return true; } catch { return false; } }
|
|
205
|
+
const { spawnSync: _sleep } = require('child_process');
|
|
206
|
+
let waited = 0;
|
|
207
|
+
while (isAlive(SERVER_PID) && waited < 30000) {
|
|
208
|
+
_sleep('sleep', ['0.5'], { stdio: 'ignore' });
|
|
209
|
+
waited += 500;
|
|
210
|
+
}
|
|
211
|
+
if (isAlive(SERVER_PID)) {
|
|
212
|
+
writeStatus({ success: false, error: 'Server did not exit within 30s', completedAt: Date.now(), previousVersion: PREV_VERSION });
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 2. npm install
|
|
217
|
+
let newVersion = PREV_VERSION;
|
|
218
|
+
let installOk = false;
|
|
219
|
+
try {
|
|
220
|
+
console.log('Running npm install -g ' + PKG + '@latest ...');
|
|
221
|
+
execSync('npm install -g ' + PKG + '@latest --include=dev', { timeout: 300000, stdio: 'inherit' });
|
|
222
|
+
try { newVersion = execSync('npm info ' + PKG + ' version', { encoding: 'utf-8' }).trim(); } catch {}
|
|
223
|
+
console.log('Update complete: ' + PREV_VERSION + ' -> ' + newVersion);
|
|
224
|
+
installOk = true;
|
|
225
|
+
} catch (err) {
|
|
226
|
+
const msg = err.stderr ? err.stderr.toString().slice(0, 500) : String(err);
|
|
227
|
+
writeStatus({ success: false, error: 'npm install failed: ' + msg, completedAt: Date.now(), previousVersion: PREV_VERSION });
|
|
228
|
+
console.error('npm install failed, attempting restart of old version...');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 3. Write success status only if install succeeded
|
|
232
|
+
if (installOk) {
|
|
233
|
+
writeStatus({ success: true, completedAt: Date.now(), previousVersion: PREV_VERSION, newVersion: newVersion });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// 4. Restart (attempt even on failure — old version may still work)
|
|
237
|
+
try {
|
|
238
|
+
var mode = ACCESS_MODE;
|
|
239
|
+
if (['local','lan','public'].indexOf(mode) === -1) mode = 'local';
|
|
240
|
+
console.log('Restarting ccweb with --daemon --' + mode + ' ...');
|
|
241
|
+
var spawnSync = require('child_process').spawnSync;
|
|
242
|
+
spawnSync('npx', ['ccweb', 'start', '--daemon', '--' + mode], { timeout: 30000, stdio: 'inherit' });
|
|
243
|
+
console.log('ccweb restarted successfully');
|
|
244
|
+
} catch (err) {
|
|
245
|
+
console.error('Restart failed:', err.message || err);
|
|
246
|
+
writeStatus({ success: false, error: 'Restart failed: ' + (err.message || err), completedAt: Date.now(), previousVersion: PREV_VERSION, newVersion: newVersion });
|
|
247
|
+
}
|
|
248
|
+
`.trim();
|
|
249
|
+
// Spawn detached agent
|
|
250
|
+
try {
|
|
251
|
+
const logFd = fs.openSync(UPDATE_AGENT_LOG, 'a');
|
|
252
|
+
const child = (0, child_process_1.spawn)(process.execPath, ['-e', agentScript], {
|
|
253
|
+
detached: true,
|
|
254
|
+
stdio: ['ignore', logFd, logFd],
|
|
255
|
+
env: { ...process.env, HOME: os.homedir(), PATH: process.env.PATH },
|
|
256
|
+
});
|
|
257
|
+
child.unref();
|
|
258
|
+
try {
|
|
259
|
+
fs.closeSync(logFd);
|
|
260
|
+
}
|
|
261
|
+
catch { /**/ }
|
|
262
|
+
}
|
|
263
|
+
catch (err) {
|
|
264
|
+
res.status(500).json({ error: `Failed to spawn updater: ${err instanceof Error ? err.message : err}` });
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
updateInProgress = true;
|
|
268
|
+
res.json({ status: 'updating', previousVersion });
|
|
269
|
+
// Trigger graceful shutdown after response is flushed
|
|
270
|
+
setTimeout(() => {
|
|
271
|
+
process.kill(process.pid, 'SIGUSR2');
|
|
272
|
+
}, 500);
|
|
273
|
+
});
|
|
274
|
+
/**
|
|
275
|
+
* GET /api/update/status
|
|
276
|
+
* Returns the update result written by the updater agent.
|
|
277
|
+
*/
|
|
278
|
+
router.get('/status', (_req, res) => {
|
|
279
|
+
try {
|
|
280
|
+
if (!fs.existsSync(UPDATE_STATUS_FILE)) {
|
|
281
|
+
res.json(null);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const content = JSON.parse(fs.readFileSync(UPDATE_STATUS_FILE, 'utf-8'));
|
|
285
|
+
res.json(content);
|
|
286
|
+
// Clean up after reading a terminal state (success or failure)
|
|
287
|
+
if (content && (content.success === true || content.success === false)) {
|
|
288
|
+
try {
|
|
289
|
+
fs.unlinkSync(UPDATE_STATUS_FILE);
|
|
290
|
+
}
|
|
291
|
+
catch { /**/ }
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
res.json(null);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
108
298
|
exports.default = router;
|
|
109
299
|
//# sourceMappingURL=update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/routes/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/routes/update.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA2C;AAC3C,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,sCAAqD;AACrD,0DAAsD;AAEtD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACjF,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AACrE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAEjE,MAAM,MAAM,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,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC;gBAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
package/bin/ccweb.js
CHANGED
|
@@ -436,6 +436,7 @@ async function startServer(opts = {}) {
|
|
|
436
436
|
// Persist state
|
|
437
437
|
fs.writeFileSync(PID_FILE, String(child.pid), 'utf-8');
|
|
438
438
|
fs.writeFileSync(PORT_FILE, String(port), 'utf-8');
|
|
439
|
+
savePrefs({ lastAccessMode: accessMode });
|
|
439
440
|
|
|
440
441
|
const modeLabels = { local: '仅本地 (Local)', lan: '局域网 (LAN)', public: '外部网络 (Public)' };
|
|
441
442
|
console.log(`\nCCWeb running at http://localhost:${port}`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,a as t,j as n,
|
|
2
|
-
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function c(e){return null==e}var u={isNothing:c,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:c(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}};function p(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),i+" "+n):i}function f(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=p(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.toString=function(e){return this.name+": "+p(this,e)};var h=f;function d(e,t,n,i,r){var o="",a="",s=Math.floor(r/2)-1;return i-t>s&&(t=i-s+(o=" ... ").length),n-i>s&&(n=i+s-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function m(e,t){return u.repeat(" ",t-e.length)+e}var g=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,r=[0],o=[],a=-1;n=i.exec(e.buffer);)o.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var s,l,c="",p=Math.min(e.line+t.linesAfter,o.length).toString().length,f=t.maxLength-(t.indent+p+3);for(s=1;s<=t.linesBefore&&!(a-s<0);s++)l=d(e.buffer,r[a-s],o[a-s],e.position-(r[a]-r[a-s]),f),c=u.repeat(" ",t.indent)+m((e.line-s+1).toString(),p)+" | "+l.str+"\n"+c;for(l=d(e.buffer,r[a],o[a],e.position,f),c+=u.repeat(" ",t.indent)+m((e.line+1).toString(),p)+" | "+l.str+"\n",c+=u.repeat("-",t.indent+p+3+l.pos)+"^\n",s=1;s<=t.linesAfter&&!(a+s>=o.length);s++)l=d(e.buffer,r[a+s],o[a+s],e.position-(r[a]-r[a+s]),f),c+=u.repeat(" ",t.indent)+m((e.line+s+1).toString(),p)+" | "+l.str+"\n";return c.replace(/\n$/,"")},b=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],y=["scalar","sequence","mapping"];var x=function(e,t){var n,i;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===b.indexOf(t))throw new h('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){i[String(t)]=e})}),i),-1===y.indexOf(this.kind))throw new h('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function A(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)}),n[t]=e}),n}function v(e){return this.extend(e)}v.prototype.extend=function(e){var t=[],n=[];if(e instanceof x)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new h("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof x))throw new h("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new h("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new h("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof x))throw new h("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(v.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=A(i,"implicit"),i.compiledExplicit=A(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(i.compiledImplicit,i.compiledExplicit),i};var k=new v({explicit:[new x("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new x("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new x("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]});var w=new x("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var C=new x("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function j(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function I(e){return 48<=e&&e<=55}function N(e){return 48<=e&&e<=57}var S=new x("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,i=0,r=!1;if(!n)return!1;if("-"!==(t=e[i])&&"+"!==t||(t=e[++i]),"0"===t){if(i+1===n)return!0;if("b"===(t=e[++i])){for(i++;i<n;i++)if("_"!==(t=e[i])){if("0"!==t&&"1"!==t)return!1;r=!0}return r&&"_"!==t}if("x"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!j(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}if("o"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!I(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}}if("_"===t)return!1;for(;i<n;i++)if("_"!==(t=e[i])){if(!N(e.charCodeAt(i)))return!1;r=!0}return!(!r||"_"===t)},construct:function(e){var t,n=e,i=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return i*parseInt(n.slice(2),2);if("x"===n[1])return i*parseInt(n.slice(2),16);if("o"===n[1])return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!u.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),M=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var O=/^[-+]?[0-9]+e/;var T=new x("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!M.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||u.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(u.isNegativeZero(e))return"-0.0";return n=e.toString(10),O.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),E=k.extend({implicit:[w,C,S,T]}),L=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),F=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var _=new x("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==L.exec(e)||null!==F.exec(e))},construct:function(e){var t,n,i,r,o,a,s,l,c=0,u=null;if(null===(t=L.exec(e))&&(t=F.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),l=new Date(Date.UTC(n,i,r,o,a,s,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(e){return e.toISOString()}});var $=new x("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var D=new x("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=Y;for(n=0;n<r;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=Y,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18===n?(s.push(a>>10&255),s.push(a>>2&255)):12===n&&s.push(a>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=Y;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),U=Object.prototype.hasOwnProperty,q=Object.prototype.toString;var B=new x("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==q.call(i))return!1;for(r in i)if(U.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}}),R=Object.prototype.toString;var z=new x("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==R.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}}),W=Object.prototype.hasOwnProperty;var P=new x("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(W.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),G=E.extend({implicit:[_,$],explicit:[D,B,z,P]}),Z=Object.prototype.hasOwnProperty,V=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,X=/[\x85\u2028\u2029]/,H=/[,\[\]\{\}]/,K=/^(?:!|!!|![a-z\-]+!)$/i,J=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Q(e){return Object.prototype.toString.call(e)}function ee(e){return 10===e||13===e}function te(e){return 9===e||32===e}function ne(e){return 9===e||32===e||10===e||13===e}function ie(e){return 44===e||91===e||93===e||123===e||125===e}function re(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function oe(e){return 120===e?2:117===e?4:85===e?8:0}function ae(e){return 48<=e&&e<=57?e-48:-1}function se(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function le(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function ce(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var ue=new Array(256),pe=new Array(256),fe=0;fe<256;fe++)ue[fe]=se(fe)?1:0,pe[fe]=se(fe);function he(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||G,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function de(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=g(n),new h(t,n)}function me(e,t){throw de(e,t)}function ge(e,t){e.onWarning&&e.onWarning.call(null,de(e,t))}var be={YAML:function(e,t,n){var i,r,o;null!==e.version&&me(e,"duplication of %YAML directive"),1!==n.length&&me(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&me(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&me(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&ge(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&me(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],K.test(i)||me(e,"ill-formed tag handle (first argument) of the TAG directive"),Z.call(e.tagMap,i)&&me(e,'there is a previously declared suffix for "'+i+'" tag handle'),J.test(r)||me(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(o){me(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function ye(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||me(e,"expected valid JSON character");else V.test(s)&&me(e,"the stream contains non-printable characters");e.result+=s}}function xe(e,t,n,i){var r,o,a,s;for(u.isObject(n)||me(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],Z.call(t,o)||(ce(t,o,n[o]),i[o]=!0)}function Ae(e,t,n,i,r,o,a,s,l){var c,u;if(Array.isArray(r))for(c=0,u=(r=Array.prototype.slice.call(r)).length;c<u;c+=1)Array.isArray(r[c])&&me(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===Q(r[c])&&(r[c]="[object Object]");if("object"==typeof r&&"[object Object]"===Q(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)xe(e,t,o[c],n);else xe(e,t,o,n);else e.json||Z.call(n,r)||!Z.call(t,r)||(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,me(e,"duplicated mapping key")),ce(t,r,o),delete n[r];return t}function ve(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):me(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ke(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;te(r);)9===r&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!ee(r))break;for(ve(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&ge(e,"deficient indentation"),i}function we(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!ne(t)))}function Ce(e,t){1===t?e.result+=" ":t>1&&(e.result+=u.repeat("\n",t-1))}function je(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),45===i)&&ne(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,ke(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Se(e,t,3,!1,!0),a.push(e.result),ke(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)me(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function Ie(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&me(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):me(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!ne(r);)33===r&&(a?me(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),K.test(n)||me(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),H.test(i)&&me(e,"tag suffix cannot contain flow indicator characters")}i&&!J.test(i)&&me(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch(s){me(e,"tag name is malformed: "+i)}return o?e.tag=i:Z.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:me(e,'undeclared tag handle "'+n+'"'),!0}function Ne(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&me(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!ne(n)&&!ie(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Se(e,t,n,i,r){var o,a,s,l,c,p,f,h,d,m=1,g=!1,b=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=4===n||3===n,i&&ke(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;Ie(e)||Ne(e);)ke(e,!0,-1)?(g=!0,s=o,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):s=!1;if(s&&(s=g||r),1!==m&&4!==n||(h=1===n||2===n?t:t+1,d=e.position-e.lineStart,1===m?s&&(je(e,d)||function(e,t,n){var i,r,o,a,s,l,c,u=e.tag,p=e.anchor,f={},h=Object.create(null),d=null,m=null,g=null,b=!1,y=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),c=e.input.charCodeAt(e.position);0!==c;){if(b||-1===e.firstTabInLine||(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,63!==c&&58!==c||!ne(i)){if(a=e.line,s=e.lineStart,l=e.position,!Se(e,n,2,!1,!0))break;if(e.line===o){for(c=e.input.charCodeAt(e.position);te(c);)c=e.input.charCodeAt(++e.position);if(58===c)ne(c=e.input.charCodeAt(++e.position))||me(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Ae(e,f,h,d,m,null,a,s,l),d=m=g=null),y=!0,b=!1,r=!1,d=e.tag,m=e.result;else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(b&&(Ae(e,f,h,d,m,null,a,s,l),d=m=g=null),y=!0,b=!0,r=!0):b?(b=!1,r=!0):me(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,c=i;if((e.line===o||e.lineIndent>t)&&(b&&(a=e.line,s=e.lineStart,l=e.position),Se(e,t,4,!0,r)&&(b?m=e.result:g=e.result),b||(Ae(e,f,h,d,m,g,a,s,l),d=m=g=null),ke(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==c)me(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&Ae(e,f,h,d,m,null,a,s,l),y&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),y}(e,d,h))||function(e,t){var n,i,r,o,a,s,l,c,u,p,f,h,d=!0,m=e.tag,g=e.anchor,b=Object.create(null);if(91===(h=e.input.charCodeAt(e.position)))a=93,c=!1,o=[];else{if(123!==h)return!1;a=125,c=!0,o={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),h=e.input.charCodeAt(++e.position);0!==h;){if(ke(e,!0,t),(h=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=m,e.anchor=g,e.kind=c?"mapping":"sequence",e.result=o,!0;d?44===h&&me(e,"expected the node content, but found ','"):me(e,"missed comma between flow collection entries"),f=null,s=l=!1,63===h&&ne(e.input.charCodeAt(e.position+1))&&(s=l=!0,e.position++,ke(e,!0,t)),n=e.line,i=e.lineStart,r=e.position,Se(e,t,1,!1,!0),p=e.tag,u=e.result,ke(e,!0,t),h=e.input.charCodeAt(e.position),!l&&e.line!==n||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),ke(e,!0,t),Se(e,t,1,!1,!0),f=e.result),c?Ae(e,o,b,p,u,f,n,i,r):s?o.push(Ae(e,null,b,p,u,f,n,i,r)):o.push(u),ke(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(d=!0,h=e.input.charCodeAt(++e.position)):d=!1}me(e,"unexpected end of the stream within a flow collection")}(e,h)?b=!0:(a&&function(e,t){var n,i,r,o,a=1,s=!1,l=!1,c=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)1===a?a=43===o?3:2:me(e,"repeat of a chomping mode identifier");else{if(!((r=ae(o))>=0))break;0===r?me(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?me(e,"repeat of an indentation width identifier"):(c=t+r-1,l=!0)}if(te(o)){do{o=e.input.charCodeAt(++e.position)}while(te(o));if(35===o)do{o=e.input.charCodeAt(++e.position)}while(!ee(o)&&0!==o)}for(;0!==o;){for(ve(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!l||e.lineIndent<c)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>c&&(c=e.lineIndent),ee(o))p++;else{if(e.lineIndent<c){3===a?e.result+=u.repeat("\n",s?1+p:p):1===a&&s&&(e.result+="\n");break}for(i?te(o)?(f=!0,e.result+=u.repeat("\n",s?1+p:p)):f?(f=!1,e.result+=u.repeat("\n",p+1)):0===p?s&&(e.result+=" "):e.result+=u.repeat("\n",p):e.result+=u.repeat("\n",s?1+p:p),s=!0,l=!0,p=0,n=e.position;!ee(o)&&0!==o;)o=e.input.charCodeAt(++e.position);ye(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(ye(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else ee(n)?(ye(e,i,r,!0),Ce(e,ke(e,!1,t)),i=r=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);me(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,i,r,o,a,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return ye(e,n,e.position,!0),e.position++,!0;if(92===s){if(ye(e,n,e.position,!0),ee(s=e.input.charCodeAt(++e.position)))ke(e,!1,t);else if(s<256&&ue[s])e.result+=pe[s],e.position++;else if((a=oe(s))>0){for(r=a,o=0;r>0;r--)(a=re(s=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:me(e,"expected hexadecimal character");e.result+=le(o),e.position++}else me(e,"unknown escape sequence");n=i=e.position}else ee(s)?(ye(e,n,i,!0),Ce(e,ke(e,!1,t)),n=i=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}me(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?b=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!ne(i)&&!ie(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Z.call(e.anchorMap,n)||me(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ke(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,l,c,u,p=e.kind,f=e.result;if(ne(u=e.input.charCodeAt(e.position))||ie(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i))break}else if(35===u){if(ne(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&we(e)||n&&ie(u))break;if(ee(u)){if(s=e.line,l=e.lineStart,c=e.lineIndent,ke(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=l,e.lineIndent=c;break}}a&&(ye(e,r,o,!1),Ce(e,e.line-s),r=o=e.position,a=!1),te(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return ye(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,h,1===n)&&(b=!0,null===e.tag&&(e.tag="?")):(b=!0,null===e.tag&&null===e.anchor||me(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(b=s&&je(e,d))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&me(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,c=e.implicitTypes.length;l<c;l+=1)if((f=e.implicitTypes[l]).resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(Z.call(e.typeMap[e.kind||"fallback"],e.tag))f=e.typeMap[e.kind||"fallback"][e.tag];else for(f=null,l=0,c=(p=e.typeMap.multi[e.kind||"fallback"]).length;l<c;l+=1)if(e.tag.slice(0,p[l].tag.length)===p[l].tag){f=p[l];break}f||me(e,"unknown tag !<"+e.tag+">"),null!==e.result&&f.kind!==e.kind&&me(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):me(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||b}function Me(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ke(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&me(e,"directive name must not be less than one character in length");0!==r;){for(;te(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!ee(r));break}if(ee(r))break;for(t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&ve(e),Z.call(be,n)?be[n](e,n,i):ge(e,'unknown document directive "'+n+'"')}ke(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ke(e,!0,-1)):a&&me(e,"directives end mark is expected"),Se(e,e.lineIndent-1,4,!1,!0),ke(e,!0,-1),e.checkLineBreaks&&X.test(e.input.slice(o,e.position))&&ge(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&we(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ke(e,!0,-1)):e.position<e.length-1&&me(e,"end of the stream or a document separator is expected")}var Oe={load:function(e,t){var n=function(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new he(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,me(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Me(n);return n.documents}(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new h("expected a single document in the stream, but found more")}}}.load;function Te(e){var t;const n=e.pages||[],i=e.relations||[];if(0===n.length)return{nodes:[],edges:[]};const r=new Map,o=new Map;for(const h of n)r.set(h.id,[]),o.set(h.id,0);for(const h of i)null==(t=r.get(h.from))||t.push(h.to),o.set(h.to,(o.get(h.to)||0)+1);const a=new Map,s=[];for(const h of n)0===(o.get(h.id)||0)&&(s.push(h.id),a.set(h.id,0));let l=0;for(;s.length>0;){const e=s.shift(),t=a.get(e)||0;for(const n of r.get(e)||[]){const e=t+1;e>(a.get(n)||0)&&(a.set(n,e),e>l&&(l=e));const i=(o.get(n)||1)-1;o.set(n,i),i<=0&&s.push(n)}}for(const h of n)a.has(h.id)||a.set(h.id,l+1);const c=new Map;for(const h of n){const e=a.get(h.id)||0;c.has(e)||c.set(e,[]),c.get(e).push(h.id)}const u=[],p=new Map(n.map(e=>[e.id,e]));for(const[h,d]of c){const e=-(160*d.length+60*(d.length-1))/2;d.forEach((t,n)=>{const i=p.get(t);u.push({id:t,title:(null==i?void 0:i.title)||t,x:e+220*n+80,y:130*h,layer:h})})}const f=i.map(e=>({from:e.from,to:e.to,label:e.label}));return{nodes:u,edges:f}}const Ee=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function Le({folderPath:c}){const[u,p]=e.useState(null),[f,h]=e.useState(!0),[d,m]=e.useState(null),[g,b]=e.useState(1),[y,x]=e.useState({x:0,y:0}),A=e.useRef(!1),v=e.useRef({x:0,y:0}),[,k]=e.useState(0),w=e.useRef(null),C=e.useRef(null),j=`${c}/.notebook/graph.yaml`,I=e.useCallback(async()=>{h(!0),m(null);try{const e=await t(j);if(!e.content)return m("graph.yaml is empty"),void p(null);const n=Oe(e.content);p(n),b(1),x({x:0,y:0})}catch{m("Cannot read .notebook/graph.yaml"),p(null)}finally{h(!1)}},[j]);e.useEffect(()=>{I()},[I]);const N=e.useCallback(e=>{e.preventDefault();const t=e.deltaY>0?-.1:.1;b(e=>Math.max(.2,Math.min(3,e+t)))},[]),S=e.useCallback(e=>{0===e.button&&(A.current=!0,k(e=>e+1),x(t=>(v.current={x:e.clientX-t.x,y:e.clientY-t.y},t)))},[]),M=e.useCallback(e=>{A.current&&x({x:e.clientX-v.current.x,y:e.clientY-v.current.y})},[]),O=e.useCallback(()=>{A.current=!1,k(e=>e+1)},[]),T=e.useCallback(()=>{if(!u||!C.current)return;const{nodes:e}=Te(u);if(0===e.length)return;const t=Math.min(...e.map(e=>e.x))-100,n=Math.max(...e.map(e=>e.x))+100,i=Math.min(...e.map(e=>e.y))-40,r=Math.max(...e.map(e=>e.y))+60,o=n-t,a=r-i,s=C.current.clientWidth,l=C.current.clientHeight,c=.9*Math.min(s/o,l/a,1.5);b(c),x({x:s/2-(t+n)/2*c,y:l/2-(i+r)/2*c})},[u]),{nodes:E,edges:L}=e.useMemo(()=>u?Te(u):{nodes:[],edges:[]},[u]),F=e.useMemo(()=>new Map(E.map(e=>[e.id,e])),[E]);return e.useEffect(()=>{if(u&&!f){const e=setTimeout(T,50);return()=>clearTimeout(e)}},[u,f,T]),f?n.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:n.jsx(o,{className:"h-5 w-5 animate-spin"})}):d||!u?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[n.jsx("p",{children:d||"No graph data"}),n.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>{I()},children:[n.jsx(r,{className:"h-3 w-3 mr-1"})," Retry"]})]}):n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[n.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[E.length," pages, ",L.length," relations"]}),n.jsx(i,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.min(3,e+.2)),children:n.jsx(a,{className:"h-3 w-3"})}),n.jsx(i,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.max(.2,e-.2)),children:n.jsx(s,{className:"h-3 w-3"})}),n.jsx(i,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:T,children:n.jsx(l,{className:"h-3 w-3"})}),n.jsx(i,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{I()},children:n.jsx(r,{className:"h-3 w-3"})})]}),n.jsx("div",{ref:C,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:N,onMouseDown:S,onMouseMove:M,onMouseUp:O,onMouseLeave:O,children:n.jsxs("svg",{ref:w,width:"100%",height:"100%",style:{userSelect:"none"},children:[n.jsx("defs",{children:n.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:n.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),n.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${g})`,children:[L.map((e,t)=>{const i=F.get(e.from),r=F.get(e.to);if(!i||!r)return null;const o=i.y+20,a=r.y-20,s=(o+a)/2;return n.jsxs("g",{children:[n.jsx("path",{d:`M ${i.x} ${o} C ${i.x} ${s}, ${r.x} ${s}, ${r.x} ${a}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),e.label&&n.jsx("text",{x:(i.x+r.x)/2,y:s-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:e.label})]},`edge-${t}`)}),E.map(e=>{const t=Ee[e.layer%Ee.length];return n.jsxs("g",{transform:`translate(${e.x-70}, ${e.y-18})`,children:[n.jsx("rect",{width:140,height:36,rx:8,fill:t,fillOpacity:.15,stroke:t,strokeWidth:1.5}),n.jsx("text",{x:70,y:19,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:e.title.length>14?e.title.slice(0,13)+"…":e.title})]},e.id)})]})]})})]})}export{Le as GraphPreview};
|
|
1
|
+
import{r as e,a as t,j as n,ao as i,B as r,k as o}from"./index-CZaOAbFH.js";import{Z as a,a as s}from"./ProjectPage-C2bWnFrt.js";import{M as l}from"./maximize-2-CLx3b_Oh.js";import"./purify.es-CgRAQgUo.js";import"./one-light-Cdckudr4.js";import"./save-BstMg_CY.js";import"./chevron-down-B6Hw6ZHb.js";import"./bot-BmHJEn5T.js";import"./user-CuRZCkSo.js";import"./search-nm4d1lSC.js";import"./chevron-up-kZcJlZXC.js";
|
|
2
|
+
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function c(e){return null==e}var u={isNothing:c,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:c(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}};function p(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),i+" "+n):i}function f(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=p(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.toString=function(e){return this.name+": "+p(this,e)};var h=f;function d(e,t,n,i,r){var o="",a="",s=Math.floor(r/2)-1;return i-t>s&&(t=i-s+(o=" ... ").length),n-i>s&&(n=i+s-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function m(e,t){return u.repeat(" ",t-e.length)+e}var g=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,r=[0],o=[],a=-1;n=i.exec(e.buffer);)o.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var s,l,c="",p=Math.min(e.line+t.linesAfter,o.length).toString().length,f=t.maxLength-(t.indent+p+3);for(s=1;s<=t.linesBefore&&!(a-s<0);s++)l=d(e.buffer,r[a-s],o[a-s],e.position-(r[a]-r[a-s]),f),c=u.repeat(" ",t.indent)+m((e.line-s+1).toString(),p)+" | "+l.str+"\n"+c;for(l=d(e.buffer,r[a],o[a],e.position,f),c+=u.repeat(" ",t.indent)+m((e.line+1).toString(),p)+" | "+l.str+"\n",c+=u.repeat("-",t.indent+p+3+l.pos)+"^\n",s=1;s<=t.linesAfter&&!(a+s>=o.length);s++)l=d(e.buffer,r[a+s],o[a+s],e.position-(r[a]-r[a+s]),f),c+=u.repeat(" ",t.indent)+m((e.line+s+1).toString(),p)+" | "+l.str+"\n";return c.replace(/\n$/,"")},b=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],y=["scalar","sequence","mapping"];var x=function(e,t){var n,i;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===b.indexOf(t))throw new h('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){i[String(t)]=e})}),i),-1===y.indexOf(this.kind))throw new h('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function A(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)}),n[t]=e}),n}function v(e){return this.extend(e)}v.prototype.extend=function(e){var t=[],n=[];if(e instanceof x)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new h("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof x))throw new h("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new h("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new h("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof x))throw new h("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(v.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=A(i,"implicit"),i.compiledExplicit=A(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(i.compiledImplicit,i.compiledExplicit),i};var k=new v({explicit:[new x("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new x("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new x("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]});var w=new x("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var C=new x("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function j(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function I(e){return 48<=e&&e<=55}function N(e){return 48<=e&&e<=57}var S=new x("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,i=0,r=!1;if(!n)return!1;if("-"!==(t=e[i])&&"+"!==t||(t=e[++i]),"0"===t){if(i+1===n)return!0;if("b"===(t=e[++i])){for(i++;i<n;i++)if("_"!==(t=e[i])){if("0"!==t&&"1"!==t)return!1;r=!0}return r&&"_"!==t}if("x"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!j(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}if("o"===t){for(i++;i<n;i++)if("_"!==(t=e[i])){if(!I(e.charCodeAt(i)))return!1;r=!0}return r&&"_"!==t}}if("_"===t)return!1;for(;i<n;i++)if("_"!==(t=e[i])){if(!N(e.charCodeAt(i)))return!1;r=!0}return!(!r||"_"===t)},construct:function(e){var t,n=e,i=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return i*parseInt(n.slice(2),2);if("x"===n[1])return i*parseInt(n.slice(2),16);if("o"===n[1])return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!u.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),M=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var O=/^[-+]?[0-9]+e/;var T=new x("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!M.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||u.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(u.isNegativeZero(e))return"-0.0";return n=e.toString(10),O.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),E=k.extend({implicit:[w,C,S,T]}),L=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),F=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var _=new x("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==L.exec(e)||null!==F.exec(e))},construct:function(e){var t,n,i,r,o,a,s,l,c=0,u=null;if(null===(t=L.exec(e))&&(t=F.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),l=new Date(Date.UTC(n,i,r,o,a,s,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(e){return e.toISOString()}});var $=new x("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var D=new x("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=Y;for(n=0;n<r;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=Y,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18===n?(s.push(a>>10&255),s.push(a>>2&255)):12===n&&s.push(a>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=Y;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),U=Object.prototype.hasOwnProperty,q=Object.prototype.toString;var B=new x("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==q.call(i))return!1;for(r in i)if(U.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}}),R=Object.prototype.toString;var z=new x("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==R.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}}),W=Object.prototype.hasOwnProperty;var P=new x("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(W.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),G=E.extend({implicit:[_,$],explicit:[D,B,z,P]}),Z=Object.prototype.hasOwnProperty,V=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,X=/[\x85\u2028\u2029]/,H=/[,\[\]\{\}]/,K=/^(?:!|!!|![a-z\-]+!)$/i,J=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Q(e){return Object.prototype.toString.call(e)}function ee(e){return 10===e||13===e}function te(e){return 9===e||32===e}function ne(e){return 9===e||32===e||10===e||13===e}function ie(e){return 44===e||91===e||93===e||123===e||125===e}function re(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function oe(e){return 120===e?2:117===e?4:85===e?8:0}function ae(e){return 48<=e&&e<=57?e-48:-1}function se(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function le(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function ce(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var ue=new Array(256),pe=new Array(256),fe=0;fe<256;fe++)ue[fe]=se(fe)?1:0,pe[fe]=se(fe);function he(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||G,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function de(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=g(n),new h(t,n)}function me(e,t){throw de(e,t)}function ge(e,t){e.onWarning&&e.onWarning.call(null,de(e,t))}var be={YAML:function(e,t,n){var i,r,o;null!==e.version&&me(e,"duplication of %YAML directive"),1!==n.length&&me(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&me(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&me(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&ge(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&me(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],K.test(i)||me(e,"ill-formed tag handle (first argument) of the TAG directive"),Z.call(e.tagMap,i)&&me(e,'there is a previously declared suffix for "'+i+'" tag handle'),J.test(r)||me(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(o){me(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function ye(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||me(e,"expected valid JSON character");else V.test(s)&&me(e,"the stream contains non-printable characters");e.result+=s}}function xe(e,t,n,i){var r,o,a,s;for(u.isObject(n)||me(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],Z.call(t,o)||(ce(t,o,n[o]),i[o]=!0)}function Ae(e,t,n,i,r,o,a,s,l){var c,u;if(Array.isArray(r))for(c=0,u=(r=Array.prototype.slice.call(r)).length;c<u;c+=1)Array.isArray(r[c])&&me(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===Q(r[c])&&(r[c]="[object Object]");if("object"==typeof r&&"[object Object]"===Q(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)xe(e,t,o[c],n);else xe(e,t,o,n);else e.json||Z.call(n,r)||!Z.call(t,r)||(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,me(e,"duplicated mapping key")),ce(t,r,o),delete n[r];return t}function ve(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):me(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ke(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;te(r);)9===r&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!ee(r))break;for(ve(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&ge(e,"deficient indentation"),i}function we(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!ne(t)))}function Ce(e,t){1===t?e.result+=" ":t>1&&(e.result+=u.repeat("\n",t-1))}function je(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),45===i)&&ne(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,ke(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Se(e,t,3,!1,!0),a.push(e.result),ke(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)me(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function Ie(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&me(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):me(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!ne(r);)33===r&&(a?me(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),K.test(n)||me(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),H.test(i)&&me(e,"tag suffix cannot contain flow indicator characters")}i&&!J.test(i)&&me(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch(s){me(e,"tag name is malformed: "+i)}return o?e.tag=i:Z.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:me(e,'undeclared tag handle "'+n+'"'),!0}function Ne(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&me(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!ne(n)&&!ie(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Se(e,t,n,i,r){var o,a,s,l,c,p,f,h,d,m=1,g=!1,b=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=4===n||3===n,i&&ke(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;Ie(e)||Ne(e);)ke(e,!0,-1)?(g=!0,s=o,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):s=!1;if(s&&(s=g||r),1!==m&&4!==n||(h=1===n||2===n?t:t+1,d=e.position-e.lineStart,1===m?s&&(je(e,d)||function(e,t,n){var i,r,o,a,s,l,c,u=e.tag,p=e.anchor,f={},h=Object.create(null),d=null,m=null,g=null,b=!1,y=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),c=e.input.charCodeAt(e.position);0!==c;){if(b||-1===e.firstTabInLine||(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,63!==c&&58!==c||!ne(i)){if(a=e.line,s=e.lineStart,l=e.position,!Se(e,n,2,!1,!0))break;if(e.line===o){for(c=e.input.charCodeAt(e.position);te(c);)c=e.input.charCodeAt(++e.position);if(58===c)ne(c=e.input.charCodeAt(++e.position))||me(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Ae(e,f,h,d,m,null,a,s,l),d=m=g=null),y=!0,b=!1,r=!1,d=e.tag,m=e.result;else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=u,e.anchor=p,!0;me(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(b&&(Ae(e,f,h,d,m,null,a,s,l),d=m=g=null),y=!0,b=!0,r=!0):b?(b=!1,r=!0):me(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,c=i;if((e.line===o||e.lineIndent>t)&&(b&&(a=e.line,s=e.lineStart,l=e.position),Se(e,t,4,!0,r)&&(b?m=e.result:g=e.result),b||(Ae(e,f,h,d,m,g,a,s,l),d=m=g=null),ke(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==c)me(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&Ae(e,f,h,d,m,null,a,s,l),y&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),y}(e,d,h))||function(e,t){var n,i,r,o,a,s,l,c,u,p,f,h,d=!0,m=e.tag,g=e.anchor,b=Object.create(null);if(91===(h=e.input.charCodeAt(e.position)))a=93,c=!1,o=[];else{if(123!==h)return!1;a=125,c=!0,o={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),h=e.input.charCodeAt(++e.position);0!==h;){if(ke(e,!0,t),(h=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=m,e.anchor=g,e.kind=c?"mapping":"sequence",e.result=o,!0;d?44===h&&me(e,"expected the node content, but found ','"):me(e,"missed comma between flow collection entries"),f=null,s=l=!1,63===h&&ne(e.input.charCodeAt(e.position+1))&&(s=l=!0,e.position++,ke(e,!0,t)),n=e.line,i=e.lineStart,r=e.position,Se(e,t,1,!1,!0),p=e.tag,u=e.result,ke(e,!0,t),h=e.input.charCodeAt(e.position),!l&&e.line!==n||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),ke(e,!0,t),Se(e,t,1,!1,!0),f=e.result),c?Ae(e,o,b,p,u,f,n,i,r):s?o.push(Ae(e,null,b,p,u,f,n,i,r)):o.push(u),ke(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(d=!0,h=e.input.charCodeAt(++e.position)):d=!1}me(e,"unexpected end of the stream within a flow collection")}(e,h)?b=!0:(a&&function(e,t){var n,i,r,o,a=1,s=!1,l=!1,c=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)1===a?a=43===o?3:2:me(e,"repeat of a chomping mode identifier");else{if(!((r=ae(o))>=0))break;0===r?me(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?me(e,"repeat of an indentation width identifier"):(c=t+r-1,l=!0)}if(te(o)){do{o=e.input.charCodeAt(++e.position)}while(te(o));if(35===o)do{o=e.input.charCodeAt(++e.position)}while(!ee(o)&&0!==o)}for(;0!==o;){for(ve(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!l||e.lineIndent<c)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>c&&(c=e.lineIndent),ee(o))p++;else{if(e.lineIndent<c){3===a?e.result+=u.repeat("\n",s?1+p:p):1===a&&s&&(e.result+="\n");break}for(i?te(o)?(f=!0,e.result+=u.repeat("\n",s?1+p:p)):f?(f=!1,e.result+=u.repeat("\n",p+1)):0===p?s&&(e.result+=" "):e.result+=u.repeat("\n",p):e.result+=u.repeat("\n",s?1+p:p),s=!0,l=!0,p=0,n=e.position;!ee(o)&&0!==o;)o=e.input.charCodeAt(++e.position);ye(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(ye(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else ee(n)?(ye(e,i,r,!0),Ce(e,ke(e,!1,t)),i=r=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);me(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,i,r,o,a,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return ye(e,n,e.position,!0),e.position++,!0;if(92===s){if(ye(e,n,e.position,!0),ee(s=e.input.charCodeAt(++e.position)))ke(e,!1,t);else if(s<256&&ue[s])e.result+=pe[s],e.position++;else if((a=oe(s))>0){for(r=a,o=0;r>0;r--)(a=re(s=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:me(e,"expected hexadecimal character");e.result+=le(o),e.position++}else me(e,"unknown escape sequence");n=i=e.position}else ee(s)?(ye(e,n,i,!0),Ce(e,ke(e,!1,t)),n=i=e.position):e.position===e.lineStart&&we(e)?me(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}me(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?b=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!ne(i)&&!ie(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Z.call(e.anchorMap,n)||me(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ke(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,l,c,u,p=e.kind,f=e.result;if(ne(u=e.input.charCodeAt(e.position))||ie(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(ne(i=e.input.charCodeAt(e.position+1))||n&&ie(i))break}else if(35===u){if(ne(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&we(e)||n&&ie(u))break;if(ee(u)){if(s=e.line,l=e.lineStart,c=e.lineIndent,ke(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=l,e.lineIndent=c;break}}a&&(ye(e,r,o,!1),Ce(e,e.line-s),r=o=e.position,a=!1),te(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return ye(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,h,1===n)&&(b=!0,null===e.tag&&(e.tag="?")):(b=!0,null===e.tag&&null===e.anchor||me(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(b=s&&je(e,d))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&me(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,c=e.implicitTypes.length;l<c;l+=1)if((f=e.implicitTypes[l]).resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(Z.call(e.typeMap[e.kind||"fallback"],e.tag))f=e.typeMap[e.kind||"fallback"][e.tag];else for(f=null,l=0,c=(p=e.typeMap.multi[e.kind||"fallback"]).length;l<c;l+=1)if(e.tag.slice(0,p[l].tag.length)===p[l].tag){f=p[l];break}f||me(e,"unknown tag !<"+e.tag+">"),null!==e.result&&f.kind!==e.kind&&me(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):me(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||b}function Me(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ke(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&me(e,"directive name must not be less than one character in length");0!==r;){for(;te(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!ee(r));break}if(ee(r))break;for(t=e.position;0!==r&&!ne(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&ve(e),Z.call(be,n)?be[n](e,n,i):ge(e,'unknown document directive "'+n+'"')}ke(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ke(e,!0,-1)):a&&me(e,"directives end mark is expected"),Se(e,e.lineIndent-1,4,!1,!0),ke(e,!0,-1),e.checkLineBreaks&&X.test(e.input.slice(o,e.position))&&ge(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&we(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ke(e,!0,-1)):e.position<e.length-1&&me(e,"end of the stream or a document separator is expected")}var Oe={load:function(e,t){var n=function(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new he(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,me(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Me(n);return n.documents}(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new h("expected a single document in the stream, but found more")}}}.load;function Te(e){var t;const n=e.pages||[],i=e.relations||[];if(0===n.length)return{nodes:[],edges:[]};const r=new Map,o=new Map;for(const h of n)r.set(h.id,[]),o.set(h.id,0);for(const h of i)null==(t=r.get(h.from))||t.push(h.to),o.set(h.to,(o.get(h.to)||0)+1);const a=new Map,s=[];for(const h of n)0===(o.get(h.id)||0)&&(s.push(h.id),a.set(h.id,0));let l=0;for(;s.length>0;){const e=s.shift(),t=a.get(e)||0;for(const n of r.get(e)||[]){const e=t+1;e>(a.get(n)||0)&&(a.set(n,e),e>l&&(l=e));const i=(o.get(n)||1)-1;o.set(n,i),i<=0&&s.push(n)}}for(const h of n)a.has(h.id)||a.set(h.id,l+1);const c=new Map;for(const h of n){const e=a.get(h.id)||0;c.has(e)||c.set(e,[]),c.get(e).push(h.id)}const u=[],p=new Map(n.map(e=>[e.id,e]));for(const[h,d]of c){const e=-(160*d.length+60*(d.length-1))/2;d.forEach((t,n)=>{const i=p.get(t);u.push({id:t,title:(null==i?void 0:i.title)||t,x:e+220*n+80,y:130*h,layer:h})})}const f=i.map(e=>({from:e.from,to:e.to,label:e.label}));return{nodes:u,edges:f}}const Ee=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function Le({folderPath:c}){const[u,p]=e.useState(null),[f,h]=e.useState(!0),[d,m]=e.useState(null),[g,b]=e.useState(1),[y,x]=e.useState({x:0,y:0}),A=e.useRef(!1),v=e.useRef({x:0,y:0}),[,k]=e.useState(0),w=e.useRef(null),C=e.useRef(null),j=`${c}/.notebook/graph.yaml`,I=e.useCallback(async()=>{h(!0),m(null);try{const e=await t(j);if(!e.content)return m("graph.yaml is empty"),void p(null);const n=Oe(e.content);p(n),b(1),x({x:0,y:0})}catch{m("Cannot read .notebook/graph.yaml"),p(null)}finally{h(!1)}},[j]);e.useEffect(()=>{I()},[I]);const N=e.useCallback(e=>{e.preventDefault();const t=e.deltaY>0?-.1:.1;b(e=>Math.max(.2,Math.min(3,e+t)))},[]),S=e.useCallback(e=>{0===e.button&&(A.current=!0,k(e=>e+1),x(t=>(v.current={x:e.clientX-t.x,y:e.clientY-t.y},t)))},[]),M=e.useCallback(e=>{A.current&&x({x:e.clientX-v.current.x,y:e.clientY-v.current.y})},[]),O=e.useCallback(()=>{A.current=!1,k(e=>e+1)},[]),T=e.useCallback(()=>{if(!u||!C.current)return;const{nodes:e}=Te(u);if(0===e.length)return;const t=Math.min(...e.map(e=>e.x))-100,n=Math.max(...e.map(e=>e.x))+100,i=Math.min(...e.map(e=>e.y))-40,r=Math.max(...e.map(e=>e.y))+60,o=n-t,a=r-i,s=C.current.clientWidth,l=C.current.clientHeight,c=.9*Math.min(s/o,l/a,1.5);b(c),x({x:s/2-(t+n)/2*c,y:l/2-(i+r)/2*c})},[u]),{nodes:E,edges:L}=e.useMemo(()=>u?Te(u):{nodes:[],edges:[]},[u]),F=e.useMemo(()=>new Map(E.map(e=>[e.id,e])),[E]);return e.useEffect(()=>{if(u&&!f){const e=setTimeout(T,50);return()=>clearTimeout(e)}},[u,f,T]),f?n.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:n.jsx(i,{className:"h-5 w-5 animate-spin"})}):d||!u?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[n.jsx("p",{children:d||"No graph data"}),n.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>{I()},children:[n.jsx(o,{className:"h-3 w-3 mr-1"})," Retry"]})]}):n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[n.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[E.length," pages, ",L.length," relations"]}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.min(3,e+.2)),children:n.jsx(a,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>b(e=>Math.max(.2,e-.2)),children:n.jsx(s,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:T,children:n.jsx(l,{className:"h-3 w-3"})}),n.jsx(r,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{I()},children:n.jsx(o,{className:"h-3 w-3"})})]}),n.jsx("div",{ref:C,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:N,onMouseDown:S,onMouseMove:M,onMouseUp:O,onMouseLeave:O,children:n.jsxs("svg",{ref:w,width:"100%",height:"100%",style:{userSelect:"none"},children:[n.jsx("defs",{children:n.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:n.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),n.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${g})`,children:[L.map((e,t)=>{const i=F.get(e.from),r=F.get(e.to);if(!i||!r)return null;const o=i.y+20,a=r.y-20,s=(o+a)/2;return n.jsxs("g",{children:[n.jsx("path",{d:`M ${i.x} ${o} C ${i.x} ${s}, ${r.x} ${s}, ${r.x} ${a}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),e.label&&n.jsx("text",{x:(i.x+r.x)/2,y:s-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:e.label})]},`edge-${t}`)}),E.map(e=>{const t=Ee[e.layer%Ee.length];return n.jsxs("g",{transform:`translate(${e.x-70}, ${e.y-18})`,children:[n.jsx("rect",{width:140,height:36,rx:8,fill:t,fillOpacity:.15,stroke:t,strokeWidth:1.5}),n.jsx("text",{x:70,y:19,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:e.title.length>14?e.title.slice(0,13)+"…":e.title})]},e.id)})]})]})})]})}export{Le as GraphPreview};
|