@checkly/playwright-core 1.48.24 → 1.48.25-beta.0
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/lib/generated/bindingsControllerSource.js +7 -0
- package/lib/generated/storageScriptSource.js +7 -0
- package/lib/server/har/harRecorder.js +3 -1
- package/lib/server/trace/recorder/tracing.js +9 -20
- package/lib/utils/fileUtils.js +65 -2
- package/lib/vite/{traceViewer/assets/codeMirrorModule-Bh1rfd2w.js → recorder/assets/codeMirrorModule-baozm8ur.js} +1 -1
- package/lib/vite/recorder/assets/{index-BcaUAUCW.js → index-2ElAIWFB.js} +2 -2
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DblsdhjA.js +16449 -0
- package/lib/vite/traceViewer/assets/inspectorTab-DOc4D3cX.js +17361 -0
- package/lib/vite/traceViewer/assets/testServerConnection-D-tXL3sj.js +224 -0
- package/lib/vite/traceViewer/assets/workbench-DNolpp3y.js +1473 -0
- package/lib/vite/traceViewer/assets/xtermModule-DZP0glxx.js +5982 -0
- package/lib/vite/traceViewer/codeMirrorModule.Cy8X9Wtw.css +344 -0
- package/lib/vite/traceViewer/embedded.DeCrOtlO.js +106 -0
- package/lib/vite/traceViewer/embedded.DjZq4InJ.css +68 -0
- package/lib/vite/traceViewer/embedded.html +3 -3
- package/lib/vite/traceViewer/index.CM_h9lHr.js +197 -0
- package/lib/vite/traceViewer/index.QanXxRUb.css +131 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/inspectorTab.DGJWXOSd.css +3145 -0
- package/lib/vite/traceViewer/recorder.DBDpiNOK.css +15 -0
- package/lib/vite/traceViewer/recorder.Fwf59ZKh.js +551 -0
- package/lib/vite/traceViewer/recorder.html +2 -2
- package/lib/vite/traceViewer/uiMode.CYBsUhm_.js +1724 -0
- package/lib/vite/traceViewer/uiMode.DRmgrHSk.css +1462 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/vite/traceViewer/workbench.BQNDbcQ0.css +550 -0
- package/lib/vite/traceViewer/xtermModule.4oRVGWQ-.css +209 -0
- package/package.json +1 -1
- package/lib/vite/recorder/assets/codeMirrorModule-CR6kB851.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-DZoSgqUd.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-xvopPhZ4.js +0 -24
- package/lib/vite/traceViewer/assets/inspectorTab-7GHnKvSD.js +0 -64
- package/lib/vite/traceViewer/assets/inspectorTab-BHcfR9dD.js +0 -64
- package/lib/vite/traceViewer/assets/inspectorTab-wfvwpMHs.js +0 -64
- package/lib/vite/traceViewer/assets/workbench-C6nMfKVy.js +0 -9
- package/lib/vite/traceViewer/assets/workbench-DZqNXdoV.js +0 -9
- package/lib/vite/traceViewer/assets/workbench-LKskf2Iy.js +0 -9
- package/lib/vite/traceViewer/embedded.BXYl5zRv.js +0 -2
- package/lib/vite/traceViewer/embedded.CShPz96b.js +0 -2
- package/lib/vite/traceViewer/embedded.Dxe2heQk.js +0 -2
- package/lib/vite/traceViewer/index.BZ9CE8t3.js +0 -2
- package/lib/vite/traceViewer/index.CB297BuW.js +0 -2
- package/lib/vite/traceViewer/index.DZkJsFod.js +0 -2
- package/lib/vite/traceViewer/recorder.BVExlUUk.js +0 -2
- package/lib/vite/traceViewer/recorder.C4zxcvd2.js +0 -2
- package/lib/vite/traceViewer/recorder.C88JDknq.js +0 -2
- package/lib/vite/traceViewer/uiMode.2tr9k625.js +0 -5
- package/lib/vite/traceViewer/uiMode.DXa41vt9.js +0 -5
- package/lib/vite/traceViewer/uiMode.DjTS7tqC.js +0 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.source = void 0;
|
|
7
|
+
const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/injected/src/bindingsController.ts\nvar bindingsController_exports = {};\n__export(bindingsController_exports, {\n BindingsController: () => BindingsController\n});\nmodule.exports = __toCommonJS(bindingsController_exports);\n\n// packages/playwright-core/src/utils/isomorphic/utilityScriptSerializers.ts\nfunction isRegExp(obj) {\n try {\n return obj instanceof RegExp || Object.prototype.toString.call(obj) === \"[object RegExp]\";\n } catch (error) {\n return false;\n }\n}\nfunction isDate(obj) {\n try {\n return obj instanceof Date || Object.prototype.toString.call(obj) === \"[object Date]\";\n } catch (error) {\n return false;\n }\n}\nfunction isURL(obj) {\n try {\n return obj instanceof URL || Object.prototype.toString.call(obj) === \"[object URL]\";\n } catch (error) {\n return false;\n }\n}\nfunction isError(obj) {\n var _a;\n try {\n return obj instanceof Error || obj && ((_a = Object.getPrototypeOf(obj)) == null ? void 0 : _a.name) === \"Error\";\n } catch (error) {\n return false;\n }\n}\nfunction isTypedArray(obj, constructor) {\n try {\n return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;\n } catch (error) {\n return false;\n }\n}\nvar typedArrayConstructors = {\n i8: Int8Array,\n ui8: Uint8Array,\n ui8c: Uint8ClampedArray,\n i16: Int16Array,\n ui16: Uint16Array,\n i32: Int32Array,\n ui32: Uint32Array,\n // TODO: add Float16Array once it's in baseline\n f32: Float32Array,\n f64: Float64Array,\n bi64: BigInt64Array,\n bui64: BigUint64Array\n};\nfunction typedArrayToBase64(array) {\n if (\"toBase64\" in array)\n return array.toBase64();\n const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join(\"\");\n return btoa(binary);\n}\nfunction serializeAsCallArgument(value, handleSerializer) {\n return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });\n}\nfunction serialize(value, handleSerializer, visitorInfo) {\n if (value && typeof value === \"object\") {\n if (typeof globalThis.Window === \"function\" && value instanceof globalThis.Window)\n return \"ref: <Window>\";\n if (typeof globalThis.Document === \"function\" && value instanceof globalThis.Document)\n return \"ref: <Document>\";\n if (typeof globalThis.Node === \"function\" && value instanceof globalThis.Node)\n return \"ref: <Node>\";\n }\n return innerSerialize(value, handleSerializer, visitorInfo);\n}\nfunction innerSerialize(value, handleSerializer, visitorInfo) {\n var _a;\n const result = handleSerializer(value);\n if (\"fallThrough\" in result)\n value = result.fallThrough;\n else\n return result;\n if (typeof value === \"symbol\")\n return { v: \"undefined\" };\n if (Object.is(value, void 0))\n return { v: \"undefined\" };\n if (Object.is(value, null))\n return { v: \"null\" };\n if (Object.is(value, NaN))\n return { v: \"NaN\" };\n if (Object.is(value, Infinity))\n return { v: \"Infinity\" };\n if (Object.is(value, -Infinity))\n return { v: \"-Infinity\" };\n if (Object.is(value, -0))\n return { v: \"-0\" };\n if (typeof value === \"boolean\")\n return value;\n if (typeof value === \"number\")\n return value;\n if (typeof value === \"string\")\n return value;\n if (typeof value === \"bigint\")\n return { bi: value.toString() };\n if (isError(value)) {\n let stack;\n if ((_a = value.stack) == null ? void 0 : _a.startsWith(value.name + \": \" + value.message)) {\n stack = value.stack;\n } else {\n stack = `${value.name}: ${value.message}\n${value.stack}`;\n }\n return { e: { n: value.name, m: value.message, s: stack } };\n }\n if (isDate(value))\n return { d: value.toJSON() };\n if (isURL(value))\n return { u: value.toJSON() };\n if (isRegExp(value))\n return { r: { p: value.source, f: value.flags } };\n for (const [k, ctor] of Object.entries(typedArrayConstructors)) {\n if (isTypedArray(value, ctor))\n return { ta: { b: typedArrayToBase64(value), k } };\n }\n const id = visitorInfo.visited.get(value);\n if (id)\n return { ref: id };\n if (Array.isArray(value)) {\n const a = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (let i = 0; i < value.length; ++i)\n a.push(serialize(value[i], handleSerializer, visitorInfo));\n return { a, id: id2 };\n }\n if (typeof value === \"object\") {\n const o = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (const name of Object.keys(value)) {\n let item;\n try {\n item = value[name];\n } catch (e) {\n continue;\n }\n if (name === \"toJSON\" && typeof item === \"function\")\n o.push({ k: name, v: { o: [], id: 0 } });\n else\n o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });\n }\n let jsonWrapper;\n try {\n if (o.length === 0 && value.toJSON && typeof value.toJSON === \"function\")\n jsonWrapper = { value: value.toJSON() };\n } catch (e) {\n }\n if (jsonWrapper)\n return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);\n return { o, id: id2 };\n }\n}\n\n// packages/injected/src/bindingsController.ts\nvar BindingsController = class {\n // eslint-disable-next-line no-restricted-globals\n constructor(global, globalBindingName) {\n this._bindings = /* @__PURE__ */ new Map();\n this._global = global;\n this._globalBindingName = globalBindingName;\n }\n addBinding(bindingName, needsHandle) {\n const data = {\n callbacks: /* @__PURE__ */ new Map(),\n lastSeq: 0,\n handles: /* @__PURE__ */ new Map(),\n removed: false\n };\n this._bindings.set(bindingName, data);\n this._global[bindingName] = (...args) => {\n if (data.removed)\n throw new Error(`binding \"${bindingName}\" has been removed`);\n if (needsHandle && args.slice(1).some((arg) => arg !== void 0))\n throw new Error(`exposeBindingHandle supports a single argument, ${args.length} received`);\n const seq = ++data.lastSeq;\n const promise = new Promise((resolve, reject) => data.callbacks.set(seq, { resolve, reject }));\n let payload;\n if (needsHandle) {\n data.handles.set(seq, args[0]);\n payload = { name: bindingName, seq };\n } else {\n const serializedArgs = [];\n for (let i = 0; i < args.length; i++) {\n serializedArgs[i] = serializeAsCallArgument(args[i], (v) => {\n return { fallThrough: v };\n });\n }\n payload = { name: bindingName, seq, serializedArgs };\n }\n this._global[this._globalBindingName](JSON.stringify(payload));\n return promise;\n };\n }\n removeBinding(bindingName) {\n const data = this._bindings.get(bindingName);\n if (data)\n data.removed = true;\n this._bindings.delete(bindingName);\n delete this._global[bindingName];\n }\n takeBindingHandle(arg) {\n const handles = this._bindings.get(arg.name).handles;\n const handle = handles.get(arg.seq);\n handles.delete(arg.seq);\n return handle;\n }\n deliverBindingResult(arg) {\n const callbacks = this._bindings.get(arg.name).callbacks;\n if (\"error\" in arg)\n callbacks.get(arg.seq).reject(arg.error);\n else\n callbacks.get(arg.seq).resolve(arg.result);\n callbacks.delete(arg.seq);\n }\n};\n";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.source = void 0;
|
|
7
|
+
const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/injected/src/storageScript.ts\nvar storageScript_exports = {};\n__export(storageScript_exports, {\n StorageScript: () => StorageScript\n});\nmodule.exports = __toCommonJS(storageScript_exports);\n\n// packages/playwright-core/src/utils/isomorphic/utilityScriptSerializers.ts\nfunction isRegExp(obj) {\n try {\n return obj instanceof RegExp || Object.prototype.toString.call(obj) === \"[object RegExp]\";\n } catch (error) {\n return false;\n }\n}\nfunction isDate(obj) {\n try {\n return obj instanceof Date || Object.prototype.toString.call(obj) === \"[object Date]\";\n } catch (error) {\n return false;\n }\n}\nfunction isURL(obj) {\n try {\n return obj instanceof URL || Object.prototype.toString.call(obj) === \"[object URL]\";\n } catch (error) {\n return false;\n }\n}\nfunction isError(obj) {\n var _a;\n try {\n return obj instanceof Error || obj && ((_a = Object.getPrototypeOf(obj)) == null ? void 0 : _a.name) === \"Error\";\n } catch (error) {\n return false;\n }\n}\nfunction isTypedArray(obj, constructor) {\n try {\n return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;\n } catch (error) {\n return false;\n }\n}\nvar typedArrayConstructors = {\n i8: Int8Array,\n ui8: Uint8Array,\n ui8c: Uint8ClampedArray,\n i16: Int16Array,\n ui16: Uint16Array,\n i32: Int32Array,\n ui32: Uint32Array,\n // TODO: add Float16Array once it's in baseline\n f32: Float32Array,\n f64: Float64Array,\n bi64: BigInt64Array,\n bui64: BigUint64Array\n};\nfunction typedArrayToBase64(array) {\n if (\"toBase64\" in array)\n return array.toBase64();\n const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join(\"\");\n return btoa(binary);\n}\nfunction base64ToTypedArray(base64, TypedArrayConstructor) {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++)\n bytes[i] = binary.charCodeAt(i);\n return new TypedArrayConstructor(bytes.buffer);\n}\nfunction parseEvaluationResultValue(value, handles = [], refs = /* @__PURE__ */ new Map()) {\n if (Object.is(value, void 0))\n return void 0;\n if (typeof value === \"object\" && value) {\n if (\"ref\" in value)\n return refs.get(value.ref);\n if (\"v\" in value) {\n if (value.v === \"undefined\")\n return void 0;\n if (value.v === \"null\")\n return null;\n if (value.v === \"NaN\")\n return NaN;\n if (value.v === \"Infinity\")\n return Infinity;\n if (value.v === \"-Infinity\")\n return -Infinity;\n if (value.v === \"-0\")\n return -0;\n return void 0;\n }\n if (\"d\" in value) {\n return new Date(value.d);\n }\n if (\"u\" in value)\n return new URL(value.u);\n if (\"bi\" in value)\n return BigInt(value.bi);\n if (\"e\" in value) {\n const error = new Error(value.e.m);\n error.name = value.e.n;\n error.stack = value.e.s;\n return error;\n }\n if (\"r\" in value)\n return new RegExp(value.r.p, value.r.f);\n if (\"a\" in value) {\n const result = [];\n refs.set(value.id, result);\n for (const a of value.a)\n result.push(parseEvaluationResultValue(a, handles, refs));\n return result;\n }\n if (\"o\" in value) {\n const result = {};\n refs.set(value.id, result);\n for (const { k, v } of value.o) {\n if (k === \"__proto__\")\n continue;\n result[k] = parseEvaluationResultValue(v, handles, refs);\n }\n return result;\n }\n if (\"h\" in value)\n return handles[value.h];\n if (\"ta\" in value)\n return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);\n }\n return value;\n}\nfunction serializeAsCallArgument(value, handleSerializer) {\n return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });\n}\nfunction serialize(value, handleSerializer, visitorInfo) {\n if (value && typeof value === \"object\") {\n if (typeof globalThis.Window === \"function\" && value instanceof globalThis.Window)\n return \"ref: <Window>\";\n if (typeof globalThis.Document === \"function\" && value instanceof globalThis.Document)\n return \"ref: <Document>\";\n if (typeof globalThis.Node === \"function\" && value instanceof globalThis.Node)\n return \"ref: <Node>\";\n }\n return innerSerialize(value, handleSerializer, visitorInfo);\n}\nfunction innerSerialize(value, handleSerializer, visitorInfo) {\n var _a;\n const result = handleSerializer(value);\n if (\"fallThrough\" in result)\n value = result.fallThrough;\n else\n return result;\n if (typeof value === \"symbol\")\n return { v: \"undefined\" };\n if (Object.is(value, void 0))\n return { v: \"undefined\" };\n if (Object.is(value, null))\n return { v: \"null\" };\n if (Object.is(value, NaN))\n return { v: \"NaN\" };\n if (Object.is(value, Infinity))\n return { v: \"Infinity\" };\n if (Object.is(value, -Infinity))\n return { v: \"-Infinity\" };\n if (Object.is(value, -0))\n return { v: \"-0\" };\n if (typeof value === \"boolean\")\n return value;\n if (typeof value === \"number\")\n return value;\n if (typeof value === \"string\")\n return value;\n if (typeof value === \"bigint\")\n return { bi: value.toString() };\n if (isError(value)) {\n let stack;\n if ((_a = value.stack) == null ? void 0 : _a.startsWith(value.name + \": \" + value.message)) {\n stack = value.stack;\n } else {\n stack = `${value.name}: ${value.message}\n${value.stack}`;\n }\n return { e: { n: value.name, m: value.message, s: stack } };\n }\n if (isDate(value))\n return { d: value.toJSON() };\n if (isURL(value))\n return { u: value.toJSON() };\n if (isRegExp(value))\n return { r: { p: value.source, f: value.flags } };\n for (const [k, ctor] of Object.entries(typedArrayConstructors)) {\n if (isTypedArray(value, ctor))\n return { ta: { b: typedArrayToBase64(value), k } };\n }\n const id = visitorInfo.visited.get(value);\n if (id)\n return { ref: id };\n if (Array.isArray(value)) {\n const a = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (let i = 0; i < value.length; ++i)\n a.push(serialize(value[i], handleSerializer, visitorInfo));\n return { a, id: id2 };\n }\n if (typeof value === \"object\") {\n const o = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (const name of Object.keys(value)) {\n let item;\n try {\n item = value[name];\n } catch (e) {\n continue;\n }\n if (name === \"toJSON\" && typeof item === \"function\")\n o.push({ k: name, v: { o: [], id: 0 } });\n else\n o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });\n }\n let jsonWrapper;\n try {\n if (o.length === 0 && value.toJSON && typeof value.toJSON === \"function\")\n jsonWrapper = { value: value.toJSON() };\n } catch (e) {\n }\n if (jsonWrapper)\n return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);\n return { o, id: id2 };\n }\n}\n\n// packages/injected/src/storageScript.ts\nvar StorageScript = class {\n constructor(isFirefox) {\n this._isFirefox = isFirefox;\n this._global = globalThis;\n }\n _idbRequestToPromise(request) {\n return new Promise((resolve, reject) => {\n request.addEventListener(\"success\", () => resolve(request.result));\n request.addEventListener(\"error\", () => reject(request.error));\n });\n }\n _isPlainObject(v) {\n const ctor = v == null ? void 0 : v.constructor;\n if (this._isFirefox) {\n const constructorImpl = ctor == null ? void 0 : ctor.toString();\n if ((constructorImpl == null ? void 0 : constructorImpl.startsWith(\"function Object() {\")) && (constructorImpl == null ? void 0 : constructorImpl.includes(\"[native code]\")))\n return true;\n }\n return ctor === Object;\n }\n _trySerialize(value) {\n let trivial = true;\n const encoded = serializeAsCallArgument(value, (v) => {\n const isTrivial = this._isPlainObject(v) || Array.isArray(v) || typeof v === \"string\" || typeof v === \"number\" || typeof v === \"boolean\" || Object.is(v, null);\n if (!isTrivial)\n trivial = false;\n return { fallThrough: v };\n });\n if (trivial)\n return { trivial: value };\n return { encoded };\n }\n async _collectDB(dbInfo) {\n if (!dbInfo.name)\n throw new Error(\"Database name is empty\");\n if (!dbInfo.version)\n throw new Error(\"Database version is unset\");\n const db = await this._idbRequestToPromise(indexedDB.open(dbInfo.name));\n if (db.objectStoreNames.length === 0)\n return { name: dbInfo.name, version: dbInfo.version, stores: [] };\n const transaction = db.transaction(db.objectStoreNames, \"readonly\");\n const stores = await Promise.all([...db.objectStoreNames].map(async (storeName) => {\n const objectStore = transaction.objectStore(storeName);\n const keys = await this._idbRequestToPromise(objectStore.getAllKeys());\n const records = await Promise.all(keys.map(async (key) => {\n const record = {};\n if (objectStore.keyPath === null) {\n const { encoded: encoded2, trivial: trivial2 } = this._trySerialize(key);\n if (trivial2)\n record.key = trivial2;\n else\n record.keyEncoded = encoded2;\n }\n const value = await this._idbRequestToPromise(objectStore.get(key));\n const { encoded, trivial } = this._trySerialize(value);\n if (trivial)\n record.value = trivial;\n else\n record.valueEncoded = encoded;\n return record;\n }));\n const indexes = [...objectStore.indexNames].map((indexName) => {\n const index = objectStore.index(indexName);\n return {\n name: index.name,\n keyPath: typeof index.keyPath === \"string\" ? index.keyPath : void 0,\n keyPathArray: Array.isArray(index.keyPath) ? index.keyPath : void 0,\n multiEntry: index.multiEntry,\n unique: index.unique\n };\n });\n return {\n name: storeName,\n records,\n indexes,\n autoIncrement: objectStore.autoIncrement,\n keyPath: typeof objectStore.keyPath === \"string\" ? objectStore.keyPath : void 0,\n keyPathArray: Array.isArray(objectStore.keyPath) ? objectStore.keyPath : void 0\n };\n }));\n return {\n name: dbInfo.name,\n version: dbInfo.version,\n stores\n };\n }\n async collect(recordIndexedDB) {\n const localStorage = Object.keys(this._global.localStorage).map((name) => ({ name, value: this._global.localStorage.getItem(name) }));\n if (!recordIndexedDB)\n return { localStorage };\n try {\n const databases = await this._global.indexedDB.databases();\n const indexedDB2 = await Promise.all(databases.map((db) => this._collectDB(db)));\n return { localStorage, indexedDB: indexedDB2 };\n } catch (e) {\n throw new Error(\"Unable to serialize IndexedDB: \" + e.message);\n }\n }\n async _restoreDB(dbInfo) {\n const openRequest = this._global.indexedDB.open(dbInfo.name, dbInfo.version);\n openRequest.addEventListener(\"upgradeneeded\", () => {\n var _a, _b;\n const db2 = openRequest.result;\n for (const store of dbInfo.stores) {\n const objectStore = db2.createObjectStore(store.name, { autoIncrement: store.autoIncrement, keyPath: (_a = store.keyPathArray) != null ? _a : store.keyPath });\n for (const index of store.indexes)\n objectStore.createIndex(index.name, (_b = index.keyPathArray) != null ? _b : index.keyPath, { unique: index.unique, multiEntry: index.multiEntry });\n }\n });\n const db = await this._idbRequestToPromise(openRequest);\n if (db.objectStoreNames.length === 0)\n return;\n const transaction = db.transaction(db.objectStoreNames, \"readwrite\");\n await Promise.all(dbInfo.stores.map(async (store) => {\n const objectStore = transaction.objectStore(store.name);\n await Promise.all(store.records.map(async (record) => {\n var _a, _b;\n await this._idbRequestToPromise(\n objectStore.add(\n (_a = record.value) != null ? _a : parseEvaluationResultValue(record.valueEncoded),\n (_b = record.key) != null ? _b : parseEvaluationResultValue(record.keyEncoded)\n )\n );\n }));\n }));\n }\n async restore(originState) {\n var _a;\n try {\n await Promise.all(((_a = originState.indexedDB) != null ? _a : []).map((dbInfo) => this._restoreDB(dbInfo)));\n } catch (e) {\n throw new Error(\"Unable to restore IndexedDB: \" + e.message);\n }\n for (const { name, value } of originState.localStorage || [])\n this._global.localStorage.setItem(name, value);\n }\n};\n";
|
|
@@ -7,6 +7,8 @@ exports.HarRecorder = void 0;
|
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _artifact = require("../artifact");
|
|
10
|
+
var _fileUtils = require("../../utils/fileUtils");
|
|
11
|
+
var _secretsFilter = require("../../checkly/secretsFilter");
|
|
10
12
|
var _harTracer = require("./harTracer");
|
|
11
13
|
var _zipBundle = require("../../zipBundle");
|
|
12
14
|
var _manualPromise = require("../../utils/manualPromise");
|
|
@@ -48,7 +50,7 @@ class HarRecorder {
|
|
|
48
50
|
waitForContentOnStop: true,
|
|
49
51
|
urlFilter: urlFilterRe !== null && urlFilterRe !== void 0 ? urlFilterRe : options.urlGlob
|
|
50
52
|
});
|
|
51
|
-
this._zipFile = content === 'attach' || expectsZip ? new _zipBundle.yazl.ZipFile() : null;
|
|
53
|
+
this._zipFile = content === 'attach' || expectsZip ? new (new _fileUtils.SecretSerializedFS((0, _secretsFilter.secretsFilter)()).createScrubbingZipFile(_zipBundle.yazl.ZipFile))() : null;
|
|
52
54
|
this._tracer.start({
|
|
53
55
|
omitScripts: false
|
|
54
56
|
});
|
|
@@ -45,7 +45,7 @@ const kScreencastOptions = {
|
|
|
45
45
|
class Tracing extends _instrumentation.SdkObject {
|
|
46
46
|
constructor(context, tracesDir) {
|
|
47
47
|
super(context, 'tracing');
|
|
48
|
-
this._fs =
|
|
48
|
+
this._fs = void 0;
|
|
49
49
|
this._snapshotter = void 0;
|
|
50
50
|
this._harTracer = void 0;
|
|
51
51
|
this._screencastListeners = [];
|
|
@@ -59,10 +59,10 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
59
59
|
this._allResources = new Set();
|
|
60
60
|
this._contextCreatedEvent = void 0;
|
|
61
61
|
this._pendingHarEntries = new Set();
|
|
62
|
-
this._secretsFilter = void 0;
|
|
63
62
|
this._context = context;
|
|
64
63
|
this._precreatedTracesDir = tracesDir;
|
|
65
|
-
|
|
64
|
+
// [Checkly] We use SecretSerializedFS to handle secret scrubbing before writing to files.
|
|
65
|
+
this._fs = new _utils.SecretSerializedFS((0, _secretsFilter.secretsFilter)());
|
|
66
66
|
this._harTracer = new _harTracer.HarTracer(context, null, this, {
|
|
67
67
|
content: 'attach',
|
|
68
68
|
includeTraceInfo: true,
|
|
@@ -333,7 +333,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
333
333
|
type: 'resource-snapshot',
|
|
334
334
|
snapshot: entry
|
|
335
335
|
};
|
|
336
|
-
const visited = visitTraceEvent(event, this._state.networkSha1s
|
|
336
|
+
const visited = visitTraceEvent(event, this._state.networkSha1s);
|
|
337
337
|
this._fs.appendFile(this._state.networkFile, JSON.stringify(visited) + '\n', true /* flush */);
|
|
338
338
|
}
|
|
339
339
|
flushHarEntries() {
|
|
@@ -343,7 +343,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
343
343
|
type: 'resource-snapshot',
|
|
344
344
|
snapshot: entry
|
|
345
345
|
};
|
|
346
|
-
const visited = visitTraceEvent(event, this._state.networkSha1s
|
|
346
|
+
const visited = visitTraceEvent(event, this._state.networkSha1s);
|
|
347
347
|
harLines.push(JSON.stringify(visited));
|
|
348
348
|
}
|
|
349
349
|
this._pendingHarEntries.clear();
|
|
@@ -466,7 +466,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
468
|
_appendTraceEvent(event) {
|
|
469
|
-
const visited = visitTraceEvent(event, this._state.traceSha1s
|
|
469
|
+
const visited = visitTraceEvent(event, this._state.traceSha1s);
|
|
470
470
|
// Do not flush (console) events, they are too noisy, unless we are in ui mode (live).
|
|
471
471
|
const flush = this._state.options.live || event.type !== 'event' && event.type !== 'console' && event.type !== 'log';
|
|
472
472
|
this._fs.appendFile(this._state.traceFile, JSON.stringify(visited) + '\n', flush);
|
|
@@ -479,13 +479,8 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
exports.Tracing = Tracing;
|
|
482
|
-
function visitTraceEvent(object, sha1s
|
|
483
|
-
if (Array.isArray(object)) return object.map(o =>
|
|
484
|
-
if (typeof o === 'string' && new Date(o).toString() === 'Invalid Date') {
|
|
485
|
-
return secretsFilter(o);
|
|
486
|
-
}
|
|
487
|
-
return visitTraceEvent(o, sha1s, secretsFilter);
|
|
488
|
-
});
|
|
482
|
+
function visitTraceEvent(object, sha1s) {
|
|
483
|
+
if (Array.isArray(object)) return object.map(o => visitTraceEvent(o, sha1s));
|
|
489
484
|
if (object instanceof _dispatcher.Dispatcher) return `<${object._type}>`;
|
|
490
485
|
if (object instanceof Buffer) return `<Buffer>`;
|
|
491
486
|
if (object instanceof Date) return object;
|
|
@@ -496,13 +491,7 @@ function visitTraceEvent(object, sha1s, secretsFilter) {
|
|
|
496
491
|
if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {
|
|
497
492
|
if (value) sha1s.add(value);
|
|
498
493
|
}
|
|
499
|
-
|
|
500
|
-
// Some values like numbers or certain strings shouldn't be scrubbed,
|
|
501
|
-
// Otherwise parts of the trace will be unreadable.
|
|
502
|
-
result[key] = key.endsWith('Sha1') || ['pageref', '_sha1', 'downloadsPath', 'tracesDir', 'pageId', 'sha1'].includes(key) ? value : secretsFilter(value);
|
|
503
|
-
} else {
|
|
504
|
-
result[key] = visitTraceEvent(value, sha1s, secretsFilter);
|
|
505
|
-
}
|
|
494
|
+
result[key] = visitTraceEvent(value, sha1s);
|
|
506
495
|
}
|
|
507
496
|
return result;
|
|
508
497
|
}
|
package/lib/utils/fileUtils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SerializedFS = void 0;
|
|
6
|
+
exports.SerializedFS = exports.SecretSerializedFS = void 0;
|
|
7
7
|
exports.canAccessFile = canAccessFile;
|
|
8
8
|
exports.copyFileAndMakeWritable = copyFileAndMakeWritable;
|
|
9
9
|
exports.fileUploadSizeLimit = exports.existsAsync = void 0;
|
|
@@ -202,4 +202,67 @@ class SerializedFS {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
|
|
206
|
+
// [Checkly] SecretSerializedFS extends SerializedFS to apply secret scrubbing to all file writes
|
|
207
|
+
exports.SerializedFS = SerializedFS;
|
|
208
|
+
class SecretSerializedFS extends SerializedFS {
|
|
209
|
+
constructor(secretsFilter) {
|
|
210
|
+
super();
|
|
211
|
+
this._secretsFilter = void 0;
|
|
212
|
+
this._secretsFilter = secretsFilter;
|
|
213
|
+
}
|
|
214
|
+
writeFile(file, content, skipIfExists) {
|
|
215
|
+
const scrubbedContent = this._scrubContent(content);
|
|
216
|
+
super.writeFile(file, scrubbedContent, skipIfExists);
|
|
217
|
+
}
|
|
218
|
+
appendFile(file, text, flush) {
|
|
219
|
+
const scrubbedText = this._scrubContent(text);
|
|
220
|
+
super.appendFile(file, scrubbedText, flush);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// [Checkly] Create a scrubbing-enabled zip file wrapper
|
|
224
|
+
createScrubbingZipFile(ZipFileClass) {
|
|
225
|
+
const scrubContent = this._scrubContent.bind(this);
|
|
226
|
+
return class ScrubbingZipFile extends ZipFileClass {
|
|
227
|
+
addBuffer(buffer, metadataPath) {
|
|
228
|
+
const scrubbedBuffer = scrubContent(buffer);
|
|
229
|
+
super.addBuffer(scrubbedBuffer, metadataPath);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// [Checkly] Apply secret scrubbing to any content being written
|
|
235
|
+
_scrubContent(content) {
|
|
236
|
+
if (Buffer.isBuffer(content)) {
|
|
237
|
+
// Handle buffer content - only scrub if it looks like text
|
|
238
|
+
try {
|
|
239
|
+
const text = content.toString('utf8');
|
|
240
|
+
if (this._isLikelyTextContent(text)) {
|
|
241
|
+
const scrubbedText = this._secretsFilter(text);
|
|
242
|
+
return Buffer.from(scrubbedText, 'utf8');
|
|
243
|
+
}
|
|
244
|
+
return content; // Return original buffer for non-text content
|
|
245
|
+
} catch {
|
|
246
|
+
return content; // Return original if can't decode as UTF-8
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
// Handle string content
|
|
250
|
+
return this._secretsFilter(content);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// [Checkly] Check if content looks like text that could contain secrets
|
|
255
|
+
_isLikelyTextContent(text) {
|
|
256
|
+
if (text.length === 0) return false;
|
|
257
|
+
|
|
258
|
+
// Check if the string contains mostly printable characters, but only sample the first 1000 chars
|
|
259
|
+
const sampleSize = Math.min(1000, text.length);
|
|
260
|
+
let printableCount = 0;
|
|
261
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
262
|
+
const code = text.charCodeAt(i);
|
|
263
|
+
if (code >= 32 && code <= 126 || code === 9 || code === 10 || code === 13) printableCount++;
|
|
264
|
+
}
|
|
265
|
+
return printableCount / sampleSize > 0.8;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.SecretSerializedFS = SecretSerializedFS;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{U as bu,V as ku}from"./inspectorTab-7GHnKvSD.js";var ya={exports:{}};(function(jt,Jt){(function(F,Pe){jt.exports=Pe()})(ku,function(){var F=navigator.userAgent,Pe=navigator.platform,I=/gecko\/\d/i.test(F),de=/MSIE \d/.test(F),Me=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(F),se=/Edge\/(\d+)/.exec(F),k=de||Me||se,ee=k&&(de?document.documentMode||6:+(se||Me)[1]),U=!se&&/WebKit\//.test(F),ve=U&&/Qt\/\d+\.\d+/.test(F),O=!se&&/Chrome\/(\d+)/.exec(F),H=O&&+O[1],P=/Opera\//.test(F),K=/Apple Computer/.test(navigator.vendor),be=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(F),ke=/PhantomJS/.test(F),Q=K&&(/Mobile\/\w+/.test(F)||navigator.maxTouchPoints>2),V=/Android/.test(F),$=Q||V||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(F),ie=Q||/Mac/.test(Pe),Fe=/\bCrOS\b/.test(F),me=/win/i.test(Pe),ue=P&&F.match(/Version\/(\d*\.\d*)/);ue&&(ue=Number(ue[1])),ue&&ue>=15&&(P=!1,U=!0);var ze=ie&&(ve||P&&(ue==null||ue<12.11)),le=I||k&&ee>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Ae=function(e,t){var n=e.className,r=W(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return C(e).appendChild(t)}function d(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function S(e,t,n,r){var i=d(e,t,n,r);return i.setAttribute("role","presentation"),i}var w;document.createRange?w=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:w=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function m(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function y(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function N(e,t){var n=e.className;W(t).test(n)||(e.className+=(n?" ":"")+t)}function re(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!W(n[r]).test(t)&&(t+=" "+n[r]);return t}var p=function(e){e.select()};Q?p=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(p=function(e){try{e.select()}catch{}});function c(e){return e.display.wrapper.ownerDocument}function G(e){return ye(e.display.wrapper)}function ye(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function R(e){return c(e).defaultView}function oe(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Se(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Te(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf(" ",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var xe=function(){this.id=null,this.f=null,this.time=0,this.handler=oe(this.onTimeout,this)};xe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},xe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function te(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Ee=50,qe={toString:function(){return"CodeMirror.Pass"}},Ve={scroll:!1},ct={origin:"*mouse"},Ne={origin:"+move"};function Re(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Ue=[""];function et(e){for(;Ue.length<=e;)Ue.push(he(Ue)+" ");return Ue[e]}function he(e){return e[e.length-1]}function Oe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function T(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function z(){}function M(e,t){var n;return Object.create?n=Object.create(e):(z.prototype=e,n=new z),t&&Se(t,n),n}var Ie=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ne(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ie.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ne(e)?!0:t.test(e):ne(e)}function fe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ce(e){return e.charCodeAt(0)>=768&&Be.test(e)}function Lt(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=n;return t}function Et(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function or(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),l.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var br=null;function lr(e,t,n){var r;br=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:br=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:br=i)}return r??br}var vi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(u,h,v){this.level=u,this.from=h,this.to=v}return function(u,h){var v=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var b=u.length,x=[],D=0;D<b;++D)x.push(n(u.charCodeAt(D)));for(var E=0,_=v;E<b;++E){var q=x[E];q=="m"?x[E]=_:_=q}for(var Z=0,j=v;Z<b;++Z){var J=x[Z];J=="1"&&j=="r"?x[Z]="n":o.test(J)&&(j=J,J=="r"&&(x[Z]="R"))}for(var ge=1,ce=x[0];ge<b-1;++ge){var De=x[ge];De=="+"&&ce=="1"&&x[ge+1]=="1"?x[ge]="1":De==","&&ce==x[ge+1]&&(ce=="1"||ce=="n")&&(x[ge]=ce),ce=De}for(var Ke=0;Ke<b;++Ke){var st=x[Ke];if(st==",")x[Ke]="N";else if(st=="%"){var Xe=void 0;for(Xe=Ke+1;Xe<b&&x[Xe]=="%";++Xe);for(var Mt=Ke&&x[Ke-1]=="!"||Xe<b&&x[Xe]=="1"?"1":"N",wt=Ke;wt<Xe;++wt)x[wt]=Mt;Ke=Xe-1}}for(var tt=0,St=v;tt<b;++tt){var ft=x[tt];St=="L"&&ft=="1"?x[tt]="L":o.test(ft)&&(St=ft)}for(var nt=0;nt<b;++nt)if(i.test(x[nt])){var rt=void 0;for(rt=nt+1;rt<b&&i.test(x[rt]);++rt);for(var Qe=(nt?x[nt-1]:v)=="L",Tt=(rt<b?x[rt]:v)=="L",nn=Qe==Tt?Qe?"L":"R":v,xr=nt;xr<rt;++xr)x[xr]=nn;nt=rt-1}for(var gt=[],Yt,ut=0;ut<b;)if(l.test(x[ut])){var fo=ut;for(++ut;ut<b&&l.test(x[ut]);++ut);gt.push(new s(0,fo,ut))}else{var ir=ut,Ar=gt.length,Er=h=="rtl"?1:0;for(++ut;ut<b&&x[ut]!="L";++ut);for(var mt=ir;mt<ut;)if(a.test(x[mt])){ir<mt&&(gt.splice(Ar,0,new s(1,ir,mt)),Ar+=Er);var on=mt;for(++mt;mt<ut&&a.test(x[mt]);++mt);gt.splice(Ar,0,new s(2,on,mt)),Ar+=Er,ir=mt}else++mt;ir<ut&>.splice(Ar,0,new s(1,ir,ut))}return h=="ltr"&&(gt[0].level==1&&(Yt=u.match(/^\s+/))&&(gt[0].from=Yt[0].length,gt.unshift(new s(0,0,Yt[0].length))),he(gt).level==1&&(Yt=u.match(/\s+$/))&&(he(gt).to-=Yt[0].length,gt.push(new s(0,b-Yt[0].length,b)))),h=="rtl"?gt.reverse():gt}}();function We(e,t){var n=e.order;return n==null&&(n=e.order=vi(e.text,t)),n}var Bn=[],pe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Qt(e,t){return e._handlers&&e._handlers[t]||Bn}function dt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=te(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ye(e,t){var n=Qt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ye(e,n||t.type,e,t),yt(t)||t.codemirrorIgnore}function Nt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)te(n,t[r])==-1&&n.push(t[r])}function Ct(e,t){return Qt(e,t).length>0}function Pt(e){e.prototype.on=function(t,n){pe(this,t,n)},e.prototype.off=function(t,n){dt(this,t,n)}}function ht(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Nr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function yt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ar(e){ht(e),Nr(e)}function ln(e){return e.target||e.srcElement}function It(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ie&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(k&&ee<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),Or;function Wn(e){if(Or==null){var t=d("span","");Y(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Or=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&ee<8))}var n=Or?d("span",""):d("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var an;function sr(e){if(an!=null)return an;var t=Y(e,document.createTextNode("AخA")),n=w(t,0,1).getBoundingClientRect(),r=w(t,1,2).getBoundingClientRect();return C(e),!n||n.left==n.right?!1:an=r.right-n.right<3}var Ot=`
|
|
1
|
+
import{g as bu,c as ku}from"./index-2ElAIWFB.js";var ya={exports:{}};(function(jt,Jt){(function(F,Pe){jt.exports=Pe()})(ku,function(){var F=navigator.userAgent,Pe=navigator.platform,I=/gecko\/\d/i.test(F),de=/MSIE \d/.test(F),Me=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(F),se=/Edge\/(\d+)/.exec(F),k=de||Me||se,ee=k&&(de?document.documentMode||6:+(se||Me)[1]),U=!se&&/WebKit\//.test(F),ve=U&&/Qt\/\d+\.\d+/.test(F),O=!se&&/Chrome\/(\d+)/.exec(F),H=O&&+O[1],P=/Opera\//.test(F),K=/Apple Computer/.test(navigator.vendor),be=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(F),ke=/PhantomJS/.test(F),Q=K&&(/Mobile\/\w+/.test(F)||navigator.maxTouchPoints>2),V=/Android/.test(F),$=Q||V||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(F),ie=Q||/Mac/.test(Pe),Fe=/\bCrOS\b/.test(F),me=/win/i.test(Pe),ue=P&&F.match(/Version\/(\d*\.\d*)/);ue&&(ue=Number(ue[1])),ue&&ue>=15&&(P=!1,U=!0);var ze=ie&&(ve||P&&(ue==null||ue<12.11)),le=I||k&&ee>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Ae=function(e,t){var n=e.className,r=W(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return C(e).appendChild(t)}function d(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function S(e,t,n,r){var i=d(e,t,n,r);return i.setAttribute("role","presentation"),i}var w;document.createRange?w=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:w=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function m(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function y(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function N(e,t){var n=e.className;W(t).test(n)||(e.className+=(n?" ":"")+t)}function re(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!W(n[r]).test(t)&&(t+=" "+n[r]);return t}var p=function(e){e.select()};Q?p=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(p=function(e){try{e.select()}catch{}});function c(e){return e.display.wrapper.ownerDocument}function G(e){return ye(e.display.wrapper)}function ye(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function R(e){return c(e).defaultView}function oe(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Se(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Te(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf(" ",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var xe=function(){this.id=null,this.f=null,this.time=0,this.handler=oe(this.onTimeout,this)};xe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},xe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function te(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Ee=50,qe={toString:function(){return"CodeMirror.Pass"}},Ve={scroll:!1},ct={origin:"*mouse"},Ne={origin:"+move"};function Re(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Ue=[""];function et(e){for(;Ue.length<=e;)Ue.push(he(Ue)+" ");return Ue[e]}function he(e){return e[e.length-1]}function Oe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function T(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function z(){}function M(e,t){var n;return Object.create?n=Object.create(e):(z.prototype=e,n=new z),t&&Se(t,n),n}var Ie=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ne(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ie.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ne(e)?!0:t.test(e):ne(e)}function fe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ce(e){return e.charCodeAt(0)>=768&&Be.test(e)}function Lt(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=n;return t}function Et(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function or(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),l.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var br=null;function lr(e,t,n){var r;br=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:br=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:br=i)}return r??br}var vi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(u,h,v){this.level=u,this.from=h,this.to=v}return function(u,h){var v=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var b=u.length,x=[],D=0;D<b;++D)x.push(n(u.charCodeAt(D)));for(var E=0,_=v;E<b;++E){var q=x[E];q=="m"?x[E]=_:_=q}for(var Z=0,j=v;Z<b;++Z){var J=x[Z];J=="1"&&j=="r"?x[Z]="n":o.test(J)&&(j=J,J=="r"&&(x[Z]="R"))}for(var ge=1,ce=x[0];ge<b-1;++ge){var De=x[ge];De=="+"&&ce=="1"&&x[ge+1]=="1"?x[ge]="1":De==","&&ce==x[ge+1]&&(ce=="1"||ce=="n")&&(x[ge]=ce),ce=De}for(var Ke=0;Ke<b;++Ke){var st=x[Ke];if(st==",")x[Ke]="N";else if(st=="%"){var Xe=void 0;for(Xe=Ke+1;Xe<b&&x[Xe]=="%";++Xe);for(var Mt=Ke&&x[Ke-1]=="!"||Xe<b&&x[Xe]=="1"?"1":"N",wt=Ke;wt<Xe;++wt)x[wt]=Mt;Ke=Xe-1}}for(var tt=0,St=v;tt<b;++tt){var ft=x[tt];St=="L"&&ft=="1"?x[tt]="L":o.test(ft)&&(St=ft)}for(var nt=0;nt<b;++nt)if(i.test(x[nt])){var rt=void 0;for(rt=nt+1;rt<b&&i.test(x[rt]);++rt);for(var Qe=(nt?x[nt-1]:v)=="L",Tt=(rt<b?x[rt]:v)=="L",nn=Qe==Tt?Qe?"L":"R":v,xr=nt;xr<rt;++xr)x[xr]=nn;nt=rt-1}for(var gt=[],Yt,ut=0;ut<b;)if(l.test(x[ut])){var fo=ut;for(++ut;ut<b&&l.test(x[ut]);++ut);gt.push(new s(0,fo,ut))}else{var ir=ut,Ar=gt.length,Er=h=="rtl"?1:0;for(++ut;ut<b&&x[ut]!="L";++ut);for(var mt=ir;mt<ut;)if(a.test(x[mt])){ir<mt&&(gt.splice(Ar,0,new s(1,ir,mt)),Ar+=Er);var on=mt;for(++mt;mt<ut&&a.test(x[mt]);++mt);gt.splice(Ar,0,new s(2,on,mt)),Ar+=Er,ir=mt}else++mt;ir<ut&>.splice(Ar,0,new s(1,ir,ut))}return h=="ltr"&&(gt[0].level==1&&(Yt=u.match(/^\s+/))&&(gt[0].from=Yt[0].length,gt.unshift(new s(0,0,Yt[0].length))),he(gt).level==1&&(Yt=u.match(/\s+$/))&&(he(gt).to-=Yt[0].length,gt.push(new s(0,b-Yt[0].length,b)))),h=="rtl"?gt.reverse():gt}}();function We(e,t){var n=e.order;return n==null&&(n=e.order=vi(e.text,t)),n}var Bn=[],pe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Qt(e,t){return e._handlers&&e._handlers[t]||Bn}function dt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=te(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ye(e,t){var n=Qt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ye(e,n||t.type,e,t),yt(t)||t.codemirrorIgnore}function Nt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)te(n,t[r])==-1&&n.push(t[r])}function Ct(e,t){return Qt(e,t).length>0}function Pt(e){e.prototype.on=function(t,n){pe(this,t,n)},e.prototype.off=function(t,n){dt(this,t,n)}}function ht(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Nr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function yt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ar(e){ht(e),Nr(e)}function ln(e){return e.target||e.srcElement}function It(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ie&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(k&&ee<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),Or;function Wn(e){if(Or==null){var t=d("span","");Y(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Or=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&ee<8))}var n=Or?d("span",""):d("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var an;function sr(e){if(an!=null)return an;var t=Y(e,document.createTextNode("AخA")),n=w(t,0,1).getBoundingClientRect(),r=w(t,1,2).getBoundingClientRect();return C(e),!n||n.left==n.right?!1:an=r.right-n.right<3}var Ot=`
|
|
2
2
|
|
|
3
3
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
4
4
|
`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),l=o.indexOf("\r");l!=-1?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ur=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},_n=function(){var e=d("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),zt=null;function yi(e){if(zt!=null)return zt;var t=Y(e,d("span","x")),n=t.getBoundingClientRect(),r=w(t,0,1).getBoundingClientRect();return zt=Math.abs(n.left-r.left)>1}var Pr={},Bt={};function Wt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pr[e]=t}function kr(e,t){Bt[e]=t}function Ir(e){if(typeof e=="string"&&Bt.hasOwnProperty(e))e=Bt[e];else if(e&&typeof e.name=="string"&&Bt.hasOwnProperty(e.name)){var t=Bt[e.name];typeof t=="string"&&(t={name:t}),e=M(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ir("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ir("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function zr(e,t){t=Ir(t);var n=Pr[t.name];if(!n)return zr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var fr={};function Br(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};Se(t,n)}function Kt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function sn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Wr(e,t,n){return e.startState?e.startState(t,n):!0}var Je=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Je.prototype.eol=function(){return this.pos>=this.string.length},Je.prototype.sol=function(){return this.pos==this.lineStart},Je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Je.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Je.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Je.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Je.prototype.skipToEnd=function(){this.pos=this.string.length},Je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Je.prototype.backUp=function(e){this.pos-=e},Je.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Te(this.string,this.lineStart,this.tabSize):0)},Je.prototype.indentation=function(){return Te(this.string,null,this.tabSize)-(this.lineStart?Te(this.string,this.lineStart,this.tabSize):0)},Je.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(l){return n?l.toLowerCase():l},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Je.prototype.current=function(){return this.string.slice(this.start,this.pos)},Je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Je.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function Vt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(o){var l=o.text;i==n.line&&(l=l.slice(0,n.ch)),i==t.line&&(l=l.slice(t.ch)),r.push(l),++i}),r}function un(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Ft(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function f(e){if(e.parent==null)return null;for(var t=e.parent,n=te(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function g(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return n+l}function A(e,t){return t>=e.first&&t<e.first+e.size}function B(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function L(e,t,n){if(n===void 0&&(n=null),!(this instanceof L))return new L(e,t,n);this.line=e,this.ch=t,this.sticky=n}function X(e,t){return e.line-t.line||e.ch-t.ch}function _e(e,t){return e.sticky==t.sticky&&X(e,t)==0}function it(e){return L(e.line,e.ch)}function xt(e,t){return X(e,t)<0?t:e}function _r(e,t){return X(e,t)<0?e:t}function ho(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Le(e,t){if(t.line<e.first)return L(e.first,0);var n=e.first+e.size-1;return t.line>n?L(n,ae(e,n).text.length):ka(t,ae(e,t.line).text.length)}function ka(e,t){var n=e.ch;return n==null||n>t?L(e.line,t):n<0?L(e.line,0):e}function po(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Le(e,t[r]);return n}var Hn=function(e,t){this.state=e,this.lookAhead=t},Ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ut.fromSaved=function(e,t,n){return t instanceof Hn?new Ut(e,Kt(e.mode,t.state),n,t.lookAhead):new Ut(e,Kt(e.mode,t),n)},Ut.prototype.save=function(e){var t=e!==!1?Kt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Hn(t,this.maxLookAhead):t};function go(e,t,n,r){var i=[e.state.modeGen],o={};ko(e,t.text,e.doc.mode,n,function(u,h){return i.push(u,h)},o,r);for(var l=n.state,a=function(u){n.baseTokens=i;var h=e.state.overlays[u],v=1,b=0;n.state=!0,ko(e,t.text,h.mode,n,function(x,D){for(var E=v;b<x;){var _=i[v];_>x&&i.splice(v,1,x,i[v+1],_),v+=2,b=Math.min(x,_)}if(D)if(h.opaque)i.splice(E,v-E,x,"overlay "+D),v=E+2;else for(;E<v;E+=2){var q=i[E+1];i[E+1]=(q?q+" ":"")+"overlay "+D}},o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function vo(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=fn(e,f(t)),i=t.text.length>e.options.maxHighlightLength&&Kt(e.doc.mode,r.state),o=go(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function fn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Ut(r,!0,t);var o=wa(e,t,n),l=o>r.first&&ae(r,o-1).stateAfter,a=l?Ut.fromSaved(r,l,o):new Ut(r,Wr(r.mode),o);return r.iter(o,t,function(s){xi(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&u<i.viewTo?a.save():null,a.nextLine()}),n&&(r.modeFrontier=a.line),a}function xi(e,t,n,r){var i=e.doc.mode,o=new Je(t,e.options.tabSize,n);for(o.start=o.pos=r||0,t==""&&mo(i,n.state);!o.eol();)bi(i,o,n.state),o.start=o.pos}function mo(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=sn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function bi(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=sn(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var yo=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function xo(e,t,n,r){var i=e.doc,o=i.mode,l;t=Le(i,t);var a=ae(i,t.line),s=fn(e,t.line,n),u=new Je(a.text,e.options.tabSize,s),h;for(r&&(h=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,l=bi(o,u,s.state),r&&h.push(new yo(u,l,Kt(i.mode,s.state)));return r?h:new yo(u,l,s.state)}function bo(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function ko(e,t,n,r,i,o,l){var a=n.flattenSpans;a==null&&(a=e.options.flattenSpans);var s=0,u=null,h=new Je(t,e.options.tabSize,r),v,b=e.options.addModeClass&&[null];for(t==""&&bo(mo(n,r.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(a=!1,l&&xi(e,t,r,h.pos),h.pos=t.length,v=null):v=bo(bi(n,h,r.state,b),o),b){var x=b[0].name;x&&(v="m-"+(v?x+" "+v:x))}if(!a||u!=v){for(;s<h.start;)s=Math.min(h.start,s+5e3),i(s,u);u=v}h.start=h.pos}for(;s<h.pos;){var D=Math.min(h.pos,s+5e3);i(D,u),s=D}}function wa(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=ae(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof Hn?u.lookAhead:0)<=o.modeFrontier))return a;var h=Te(s.text,null,e.options.tabSize);(i==null||r>h)&&(i=a-1,r=h)}return i}function Sa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=ae(e,r).stateAfter;if(i&&(!(i instanceof Hn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var wo=!1,$t=!1;function Ta(){wo=!0}function La(){$t=!0}function Rn(e,t,n){this.marker=e,this.from=t,this.to=n}function cn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ca(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Da(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function Ma(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=o.from==null||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&l.type=="bookmark"&&(!n||!o.marker.insertLeft)){var s=o.to==null||(l.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Rn(l,o.from,s?null:o.to))}}return r}function Fa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=o.to==null||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Rn(l,s?null:o.from-t,o.to==null?null:o.to-t))}}return r}function ki(e,t){if(t.full)return null;var n=A(e,t.from.line)&&ae(e,t.from.line).markedSpans,r=A(e,t.to.line)&&ae(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,l=X(t.from,t.to)==0,a=Ma(n,i,l),s=Fa(r,o,l),u=t.text.length==1,h=he(t.text).length+(u?i:0);if(a)for(var v=0;v<a.length;++v){var b=a[v];if(b.to==null){var x=cn(s,b.marker);x?u&&(b.to=x.to==null?null:x.to+h):b.to=i}}if(s)for(var D=0;D<s.length;++D){var E=s[D];if(E.to!=null&&(E.to+=h),E.from==null){var _=cn(a,E.marker);_||(E.from=h,u&&(a||(a=[])).push(E))}else E.from+=h,u&&(a||(a=[])).push(E)}a&&(a=So(a)),s&&s!=a&&(s=So(s));var q=[a];if(!u){var Z=t.text.length-2,j;if(Z>0&&a)for(var J=0;J<a.length;++J)a[J].to==null&&(j||(j=[])).push(new Rn(a[J].marker,null,null));for(var ge=0;ge<Z;++ge)q.push(j);q.push(s)}return q}function So(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Aa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(x){if(x.markedSpans)for(var D=0;D<x.markedSpans.length;++D){var E=x.markedSpans[D].marker;E.readOnly&&(!r||te(r,E)==-1)&&(r||(r=[])).push(E)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],a=l.find(0),s=0;s<i.length;++s){var u=i[s];if(!(X(u.to,a.from)<0||X(u.from,a.to)>0)){var h=[s,1],v=X(u.from,a.from),b=X(u.to,a.to);(v<0||!l.inclusiveLeft&&!v)&&h.push({from:u.from,to:a.from}),(b>0||!l.inclusiveRight&&!b)&&h.push({from:a.to,to:u.to}),i.splice.apply(i,h),s+=h.length-3}}return i}function To(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Lo(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function qn(e){return e.inclusiveLeft?-1:0}function jn(e){return e.inclusiveRight?1:0}function wi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),o=X(r.from,i.from)||qn(e)-qn(t);if(o)return-o;var l=X(r.to,i.to)||jn(e)-jn(t);return l||t.id-e.id}function Co(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wi(r,i.marker)<0)&&(r=i.marker);return r}function Do(e){return Co(e,!0)}function Kn(e){return Co(e,!1)}function Ea(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!r||wi(r,o.marker)<0)&&(r=o.marker)}return r}function Mo(e,t,n,r,i){var o=ae(e,t),l=$t&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var u=s.marker.find(0),h=X(u.from,n)||qn(s.marker)-qn(i),v=X(u.to,r)||jn(s.marker)-jn(i);if(!(h>=0&&v<=0||h<=0&&v>=0)&&(h<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?X(u.to,n)>=0:X(u.to,n)>0)||h>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?X(u.from,r)<=0:X(u.from,r)<0)))return!0}}}function _t(e){for(var t;t=Do(e);)e=t.find(-1,!0).line;return e}function Na(e){for(var t;t=Kn(e);)e=t.find(1,!0).line;return e}function Oa(e){for(var t,n;t=Kn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Si(e,t){var n=ae(e,t),r=_t(n);return n==r?t:f(r)}function Fo(e,t){if(t>e.lastLine())return t;var n=ae(e,t),r;if(!cr(e,n))return t;for(;r=Kn(n);)n=r.find(1,!0).line;return f(n)+1}function cr(e,t){var n=$t&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Ti(e,t,r))return!0}}}function Ti(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ti(e,r.line,cn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ti(e,t,i))return!0}function er(e){e=_t(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function Un(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Do(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Kn(r);){var o=n.find(0,!0);t-=r.text.length-o.from.ch,r=o.to.line,t+=r.text.length-o.to.ch}return t}function Li(e){var t=e.display,n=e.doc;t.maxLine=ae(n,n.first),t.maxLineLength=Un(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Un(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Lo(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return f(this)},Pt(Hr);function Pa(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),To(e),Lo(e,n);var i=r?r(e):1;i!=e.height&&Ft(e,i)}function Ia(e){e.parent=null,To(e)}var za={},Ba={};function Ao(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ba:za;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Eo(e,t){var n=S("span",null,null,U?"padding-right: .1px":null),r={pre:S("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=_a,sr(e.display.measure)&&(l=We(o,e.doc.direction))&&(r.addToken=Ra(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&f(o);qa(o,r,vo(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=re(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=re(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Wn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(U){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ye(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=re(r.pre.className,r.textClass||"")),r}function Wa(e){var t=d("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function _a(e,t,n,r,i,o,l){if(t){var a=e.splitSpaces?Ha(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,h;if(!s.test(t))e.col+=t.length,h=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,h),k&&ee<9&&(u=!0),e.pos+=t.length;else{h=document.createDocumentFragment();for(var v=0;;){s.lastIndex=v;var b=s.exec(t),x=b?b.index-v:t.length-v;if(x){var D=document.createTextNode(a.slice(v,v+x));k&&ee<9?h.appendChild(d("span",[D])):h.appendChild(D),e.map.push(e.pos,e.pos+x,D),e.col+=x,e.pos+=x}if(!b)break;v+=x+1;var E=void 0;if(b[0]==" "){var _=e.cm.options.tabSize,q=_-e.col%_;E=h.appendChild(d("span",et(q),"cm-tab")),E.setAttribute("role","presentation"),E.setAttribute("cm-text"," "),e.col+=q}else b[0]=="\r"||b[0]==`
|