1// Shinylive 0.9.1 2// Copyright 2024 Posit, PBC 3import { 4 Icon, 5 appUrlPrefix, 6 currentScriptDir, 7 editorUrlPrefix, 8 fileContentsToUrlString, 9 fileContentsToUrlStringInWebWorker, 10 inferFiletype, 11 isBinary, 12 modKeySymbol, 13 require_jsx_runtime, 14 require_react, 15 stringToUint8Array 16} from "./chunk-PHWSSKUM.js"; 17import { 18 __commonJS, 19 __esm, 20 __export, 21 __privateAdd, 22 __privateMethod, 23 __publicField, 24 __toCommonJS, 25 __toESM 26} from "./chunk-O5P2LFOG.js"; 27
vendor: 13,265 bytes, lines 28-399
28// node_modules/events/events.js 29var require_events = __commonJS({ 30 "node_modules/events/events.js"(exports, module) { 31 "use strict"; 32 var R = typeof Reflect === "object" ? Reflect : null; 33 var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { 34 return Function.prototype.apply.call(target, receiver, args); 35 }; 36 var ReflectOwnKeys; 37 if (R && typeof R.ownKeys === "function") { 38 ReflectOwnKeys = R.ownKeys; 39 } else if (Object.getOwnPropertySymbols) { 40 ReflectOwnKeys = function ReflectOwnKeys2(target) { 41 return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); 42 }; 43 } else { 44 ReflectOwnKeys = function ReflectOwnKeys2(target) { 45 return Object.getOwnPropertyNames(target); 46 }; 47 } 48 function ProcessEmitWarning(warning) { 49 if (console && console.warn) 50 console.warn(warning); 51 } 52 var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { 53 return value !== value; 54 }; 55 function EventEmitter2() { 56 EventEmitter2.init.call(this); 57 } 58 module.exports = EventEmitter2; 59 module.exports.once = once; 60 EventEmitter2.EventEmitter = EventEmitter2; 61 EventEmitter2.prototype._events = void 0; 62 EventEmitter2.prototype._eventsCount = 0; 63 EventEmitter2.prototype._maxListeners = void 0; 64 var defaultMaxListeners = 10; 65 function checkListener(listener) { 66 if (typeof listener !== "function") { 67 throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); 68 } 69 } 70 Object.defineProperty(EventEmitter2, "defaultMaxListeners", { 71 enumerable: true, 72 get: function() { 73 return defaultMaxListeners; 74 }, 75 set: function(arg) { 76 if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { 77 throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); 78 } 79 defaultMaxListeners = arg; 80 } 81 }); 82 EventEmitter2.init = function() { 83 if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { 84 this._events = /* @__PURE__ */ Object.create(null); 85 this._eventsCount = 0; 86 } 87 this._maxListeners = this._maxListeners || void 0; 88 }; 89 EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n3) { 90 if (typeof n3 !== "number" || n3 < 0 || NumberIsNaN(n3)) { 91 throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n3 + "."); 92 } 93 this._maxListeners = n3; 94 return this; 95 }; 96 function _getMaxListeners(that) { 97 if (that._maxListeners === void 0) 98 return EventEmitter2.defaultMaxListeners; 99 return that._maxListeners; 100 } 101 EventEmitter2.prototype.getMaxListeners = function getMaxListeners() { 102 return _getMaxListeners(this); 103 }; 104 EventEmitter2.prototype.emit = function emit(type) { 105 var args = []; 106 for (var i2 = 1; i2 < arguments.length; i2++) 107 args.push(arguments[i2]); 108 var doError = type === "error"; 109 var events = this._events; 110 if (events !== void 0) 111 doError = doError && events.error === void 0; 112 else if (!doError) 113 return false; 114 if (doError) { 115 var er; 116 if (args.length > 0) 117 er = args[0]; 118 if (er instanceof Error) { 119 throw er; 120 } 121 var err2 = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); 122 err2.context = er; 123 throw err2; 124 } 125 var handler = events[type]; 126 if (handler === void 0) 127 return false; 128 if (typeof handler === "function") { 129 ReflectApply(handler, this, args); 130 } else { 131 var len = handler.length; 132 var listeners = arrayClone(handler, len); 133 for (var i2 = 0; i2 < len; ++i2) 134 ReflectApply(listeners[i2], this, args); 135 } 136 return true; 137 }; 138 function _addListener(target, type, listener, prepend) { 139 var m2; 140 var events; 141 var existing; 142 checkListener(listener); 143 events = target._events; 144 if (events === void 0) { 145 events = target._events = /* @__PURE__ */ Object.create(null); 146 target._eventsCount = 0; 147 } else { 148 if (events.newListener !== void 0) { 149 target.emit( 150 "newListener", 151 type, 152 listener.listener ? listener.listener : listener 153 ); 154 events = target._events; 155 } 156 existing = events[type]; 157 } 158 if (existing === void 0) { 159 existing = events[type] = listener; 160 ++target._eventsCount; 161 } else { 162 if (typeof existing === "function") { 163 existing = events[type] = prepend ? [listener, existing] : [existing, listener]; 164 } else if (prepend) { 165 existing.unshift(listener); 166 } else { 167 existing.push(listener); 168 } 169 m2 = _getMaxListeners(target); 170 if (m2 > 0 && existing.length > m2 && !existing.warned) { 171 existing.warned = true; 172 var w2 = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); 173 w2.name = "MaxListenersExceededWarning"; 174 w2.emitter = target; 175 w2.type = type; 176 w2.count = existing.length; 177 ProcessEmitWarning(w2); 178 } 179 } 180 return target; 181 } 182 EventEmitter2.prototype.addListener = function addListener(type, listener) { 183 return _addListener(this, type, listener, false); 184 }; 185 EventEmitter2.prototype.on = EventEmitter2.prototype.addListener; 186 EventEmitter2.prototype.prependListener = function prependListener(type, listener) { 187 return _addListener(this, type, listener, true); 188 }; 189 function onceWrapper() { 190 if (!this.fired) { 191 this.target.removeListener(this.type, this.wrapFn); 192 this.fired = true; 193 if (arguments.length === 0) 194 return this.listener.call(this.target); 195 return this.listener.apply(this.target, arguments); 196 } 197 } 198 function _onceWrap(target, type, listener) { 199 var state = { fired: false, wrapFn: void 0, target, type, listener }; 200 var wrapped = onceWrapper.bind(state); 201 wrapped.listener = listener; 202 state.wrapFn = wrapped; 203 return wrapped; 204 } 205 EventEmitter2.prototype.once = function once2(type, listener) { 206 checkListener(listener); 207 this.on(type, _onceWrap(this, type, listener)); 208 return this; 209 }; 210 EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type, listener) { 211 checkListener(listener); 212 this.prependListener(type, _onceWrap(this, type, listener)); 213 return this; 214 }; 215 EventEmitter2.prototype.removeListener = function removeListener(type, listener) { 216 var list, events, position, i2, originalListener; 217 checkListener(listener); 218 events = this._events; 219 if (events === void 0) 220 return this; 221 list = events[type]; 222 if (list === void 0) 223 return this; 224 if (list === listener || list.listener === listener) { 225 if (--this._eventsCount === 0) 226 this._events = /* @__PURE__ */ Object.create(null); 227 else { 228 delete events[type]; 229 if (events.removeListener) 230 this.emit("removeListener", type, list.listener || listener); 231 } 232 } else if (typeof list !== "function") { 233 position = -1; 234 for (i2 = list.length - 1; i2 >= 0; i2--) { 235 if (list[i2] === listener || list[i2].listener === listener) { 236 originalListener = list[i2].listener; 237 position = i2; 238 break; 239 } 240 } 241 if (position < 0) 242 return this; 243 if (position === 0) 244 list.shift(); 245 else { 246 spliceOne(list, position); 247 } 248 if (list.length === 1) 249 events[type] = list[0]; 250 if (events.removeListener !== void 0) 251 this.emit("removeListener", type, originalListener || listener); 252 } 253 return this; 254 }; 255 EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener; 256 EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type) { 257 var listeners, events, i2; 258 events = this._events; 259 if (events === void 0) 260 return this; 261 if (events.removeListener === void 0) { 262 if (arguments.length === 0) { 263 this._events = /* @__PURE__ */ Object.create(null); 264 this._eventsCount = 0; 265 } else if (events[type] !== void 0) { 266 if (--this._eventsCount === 0) 267 this._events = /* @__PURE__ */ Object.create(null); 268 else 269 delete events[type]; 270 } 271 return this; 272 } 273 if (arguments.length === 0) { 274 var keys = Object.keys(events); 275 var key; 276 for (i2 = 0; i2 < keys.length; ++i2) { 277 key = keys[i2]; 278 if (key === "removeListener") 279 continue; 280 this.removeAllListeners(key); 281 } 282 this.removeAllListeners("removeListener"); 283 this._events = /* @__PURE__ */ Object.create(null); 284 this._eventsCount = 0; 285 return this; 286 } 287 listeners = events[type]; 288 if (typeof listeners === "function") { 289 this.removeListener(type, listeners); 290 } else if (listeners !== void 0) { 291 for (i2 = listeners.length - 1; i2 >= 0; i2--) { 292 this.removeListener(type, listeners[i2]); 293 } 294 } 295 return this; 296 }; 297 function _listeners(target, type, unwrap) { 298 var events = target._events; 299 if (events === void 0) 300 return []; 301 var evlistener = events[type]; 302 if (evlistener === void 0) 303 return []; 304 if (typeof evlistener === "function") 305 return unwrap ? [evlistener.listener || evlistener] : [evlistener]; 306 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); 307 } 308 EventEmitter2.prototype.listeners = function listeners(type) { 309 return _listeners(this, type, true); 310 }; 311 EventEmitter2.prototype.rawListeners = function rawListeners(type) { 312 return _listeners(this, type, false); 313 }; 314 EventEmitter2.listenerCount = function(emitter, type) { 315 if (typeof emitter.listenerCount === "function") { 316 return emitter.listenerCount(type); 317 } else { 318 return listenerCount.call(emitter, type); 319 } 320 }; 321 EventEmitter2.prototype.listenerCount = listenerCount; 322 function listenerCount(type) { 323 var events = this._events; 324 if (events !== void 0) { 325 var evlistener = events[type]; 326 if (typeof evlistener === "function") { 327 return 1; 328 } else if (evlistener !== void 0) { 329 return evlistener.length; 330 } 331 } 332 return 0; 333 } 334 EventEmitter2.prototype.eventNames = function eventNames() { 335 return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; 336 }; 337 function arrayClone(arr, n3) { 338 var copy = new Array(n3); 339 for (var i2 = 0; i2 < n3; ++i2) 340 copy[i2] = arr[i2]; 341 return copy; 342 } 343 function spliceOne(list, index) { 344 for (; index + 1 < list.length; index++) 345 list[index] = list[index + 1]; 346 list.pop(); 347 } 348 function unwrapListeners(arr) { 349 var ret = new Array(arr.length); 350 for (var i2 = 0; i2 < ret.length; ++i2) { 351 ret[i2] = arr[i2].listener || arr[i2]; 352 } 353 return ret; 354 } 355 function once(emitter, name2) { 356 return new Promise(function(resolve, reject) { 357 function errorListener(err2) { 358 emitter.removeListener(name2, resolver); 359 reject(err2); 360 } 361 function resolver() { 362 if (typeof emitter.removeListener === "function") { 363 emitter.removeListener("error", errorListener); 364 } 365 resolve([].slice.call(arguments)); 366 } 367 ; 368 eventTargetAgnosticAddListener(emitter, name2, resolver, { once: true }); 369 if (name2 !== "error") { 370 addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); 371 } 372 }); 373 } 374 function addErrorHandlerIfEventEmitter(emitter, handler, flags) { 375 if (typeof emitter.on === "function") { 376 eventTargetAgnosticAddListener(emitter, "error", handler, flags); 377 } 378 } 379 function eventTargetAgnosticAddListener(emitter, name2, listener, flags) { 380 if (typeof emitter.on === "function") { 381 if (flags.once) { 382 emitter.once(name2, listener); 383 } else { 384 emitter.on(name2, listener); 385 } 386 } else if (typeof emitter.addEventListener === "function") { 387 emitter.addEventListener(name2, function wrapListener(arg) { 388 if (flags.once) { 389 emitter.removeEventListener(name2, wrapListener); 390 } 391 listener(arg); 392 }); 393 } else { 394 throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); 395 } 396 } 397 } 398}); 399
vendor: 1,186 bytes, lines 400-436
400// node_modules/vscode-jsonrpc/lib/common/is.js 401var require_is = __commonJS({ 402 "node_modules/vscode-jsonrpc/lib/common/is.js"(exports) { 403 "use strict"; 404 Object.defineProperty(exports, "__esModule", { value: true }); 405 exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; 406 function boolean(value) { 407 return value === true || value === false; 408 } 409 exports.boolean = boolean; 410 function string2(value) { 411 return typeof value === "string" || value instanceof String; 412 } 413 exports.string = string2; 414 function number2(value) { 415 return typeof value === "number" || value instanceof Number; 416 } 417 exports.number = number2; 418 function error(value) { 419 return value instanceof Error; 420 } 421 exports.error = error; 422 function func(value) { 423 return typeof value === "function"; 424 } 425 exports.func = func; 426 function array(value) { 427 return Array.isArray(value); 428 } 429 exports.array = array; 430 function stringArray(value) { 431 return array(value) && value.every((elem) => string2(elem)); 432 } 433 exports.stringArray = stringArray; 434 } 435}); 436
vendor: 8,864 bytes, lines 437-674
437// node_modules/vscode-jsonrpc/lib/common/messages.js 438var require_messages = __commonJS({ 439 "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports) { 440 "use strict"; 441 Object.defineProperty(exports, "__esModule", { value: true }); 442 exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; 443 var is = require_is(); 444 var ErrorCodes; 445 (function(ErrorCodes2) { 446 ErrorCodes2.ParseError = -32700; 447 ErrorCodes2.InvalidRequest = -32600; 448 ErrorCodes2.MethodNotFound = -32601; 449 ErrorCodes2.InvalidParams = -32602; 450 ErrorCodes2.InternalError = -32603; 451 ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; 452 ErrorCodes2.serverErrorStart = -32099; 453 ErrorCodes2.MessageWriteError = -32099; 454 ErrorCodes2.MessageReadError = -32098; 455 ErrorCodes2.PendingResponseRejected = -32097; 456 ErrorCodes2.ConnectionInactive = -32096; 457 ErrorCodes2.ServerNotInitialized = -32002; 458 ErrorCodes2.UnknownErrorCode = -32001; 459 ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; 460 ErrorCodes2.serverErrorEnd = -32e3; 461 })(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {})); 462 var ResponseError = class _ResponseError extends Error { 463 constructor(code, message, data) { 464 super(message); 465 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; 466 this.data = data; 467 Object.setPrototypeOf(this, _ResponseError.prototype); 468 } 469 toJson() { 470 const result = { 471 code: this.code, 472 message: this.message 473 }; 474 if (this.data !== void 0) { 475 result.data = this.data; 476 } 477 return result; 478 } 479 }; 480 exports.ResponseError = ResponseError; 481 var ParameterStructures = class _ParameterStructures { 482 constructor(kind) { 483 this.kind = kind; 484 } 485 static is(value) { 486 return value === _ParameterStructures.auto || value === _ParameterStructures.byName || value === _ParameterStructures.byPosition; 487 } 488 toString() { 489 return this.kind; 490 } 491 }; 492 exports.ParameterStructures = ParameterStructures; 493 ParameterStructures.auto = new ParameterStructures("auto"); 494 ParameterStructures.byPosition = new ParameterStructures("byPosition"); 495 ParameterStructures.byName = new ParameterStructures("byName"); 496 var AbstractMessageSignature = class { 497 constructor(method, numberOfParams) { 498 this.method = method; 499 this.numberOfParams = numberOfParams; 500 } 501 get parameterStructures() { 502 return ParameterStructures.auto; 503 } 504 }; 505 exports.AbstractMessageSignature = AbstractMessageSignature; 506 var RequestType0 = class extends AbstractMessageSignature { 507 constructor(method) { 508 super(method, 0); 509 } 510 }; 511 exports.RequestType0 = RequestType0; 512 var RequestType = class extends AbstractMessageSignature { 513 constructor(method, _parameterStructures = ParameterStructures.auto) { 514 super(method, 1); 515 this._parameterStructures = _parameterStructures; 516 } 517 get parameterStructures() { 518 return this._parameterStructures; 519 } 520 }; 521 exports.RequestType = RequestType; 522 var RequestType1 = class extends AbstractMessageSignature { 523 constructor(method, _parameterStructures = ParameterStructures.auto) { 524 super(method, 1); 525 this._parameterStructures = _parameterStructures; 526 } 527 get parameterStructures() { 528 return this._parameterStructures; 529 } 530 }; 531 exports.RequestType1 = RequestType1; 532 var RequestType2 = class extends AbstractMessageSignature { 533 constructor(method) { 534 super(method, 2); 535 } 536 }; 537 exports.RequestType2 = RequestType2; 538 var RequestType3 = class extends AbstractMessageSignature { 539 constructor(method) { 540 super(method, 3); 541 } 542 }; 543 exports.RequestType3 = RequestType3; 544 var RequestType4 = class extends AbstractMessageSignature { 545 constructor(method) { 546 super(method, 4); 547 } 548 }; 549 exports.RequestType4 = RequestType4; 550 var RequestType5 = class extends AbstractMessageSignature { 551 constructor(method) { 552 super(method, 5); 553 } 554 }; 555 exports.RequestType5 = RequestType5; 556 var RequestType6 = class extends AbstractMessageSignature { 557 constructor(method) { 558 super(method, 6); 559 } 560 }; 561 exports.RequestType6 = RequestType6; 562 var RequestType7 = class extends AbstractMessageSignature { 563 constructor(method) { 564 super(method, 7); 565 } 566 }; 567 exports.RequestType7 = RequestType7; 568 var RequestType8 = class extends AbstractMessageSignature { 569 constructor(method) { 570 super(method, 8); 571 } 572 }; 573 exports.RequestType8 = RequestType8; 574 var RequestType9 = class extends AbstractMessageSignature { 575 constructor(method) { 576 super(method, 9); 577 } 578 }; 579 exports.RequestType9 = RequestType9; 580 var NotificationType = class extends AbstractMessageSignature { 581 constructor(method, _parameterStructures = ParameterStructures.auto) { 582 super(method, 1); 583 this._parameterStructures = _parameterStructures; 584 } 585 get parameterStructures() { 586 return this._parameterStructures; 587 } 588 }; 589 exports.NotificationType = NotificationType; 590 var NotificationType0 = class extends AbstractMessageSignature { 591 constructor(method) { 592 super(method, 0); 593 } 594 }; 595 exports.NotificationType0 = NotificationType0; 596 var NotificationType1 = class extends AbstractMessageSignature { 597 constructor(method, _parameterStructures = ParameterStructures.auto) { 598 super(method, 1); 599 this._parameterStructures = _parameterStructures; 600 } 601 get parameterStructures() { 602 return this._parameterStructures; 603 } 604 }; 605 exports.NotificationType1 = NotificationType1; 606 var NotificationType2 = class extends AbstractMessageSignature { 607 constructor(method) { 608 super(method, 2); 609 } 610 }; 611 exports.NotificationType2 = NotificationType2; 612 var NotificationType3 = class extends AbstractMessageSignature { 613 constructor(method) { 614 super(method, 3); 615 } 616 }; 617 exports.NotificationType3 = NotificationType3; 618 var NotificationType4 = class extends AbstractMessageSignature { 619 constructor(method) { 620 super(method, 4); 621 } 622 }; 623 exports.NotificationType4 = NotificationType4; 624 var NotificationType5 = class extends AbstractMessageSignature { 625 constructor(method) { 626 super(method, 5); 627 } 628 }; 629 exports.NotificationType5 = NotificationType5; 630 var NotificationType6 = class extends AbstractMessageSignature { 631 constructor(method) { 632 super(method, 6); 633 } 634 }; 635 exports.NotificationType6 = NotificationType6; 636 var NotificationType7 = class extends AbstractMessageSignature { 637 constructor(method) { 638 super(method, 7); 639 } 640 }; 641 exports.NotificationType7 = NotificationType7; 642 var NotificationType8 = class extends AbstractMessageSignature { 643 constructor(method) { 644 super(method, 8); 645 } 646 }; 647 exports.NotificationType8 = NotificationType8; 648 var NotificationType9 = class extends AbstractMessageSignature { 649 constructor(method) { 650 super(method, 9); 651 } 652 }; 653 exports.NotificationType9 = NotificationType9; 654 var Message; 655 (function(Message2) { 656 function isRequest(message) { 657 const candidate = message; 658 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); 659 } 660 Message2.isRequest = isRequest; 661 function isNotification(message) { 662 const candidate = message; 663 return candidate && is.string(candidate.method) && message.id === void 0; 664 } 665 Message2.isNotification = isNotification; 666 function isResponse(message) { 667 const candidate = message; 668 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); 669 } 670 Message2.isResponse = isResponse; 671 })(Message || (exports.Message = Message = {})); 672 } 673}); 674
vendor: 10,268 bytes, lines 675-1044
675// node_modules/vscode-jsonrpc/lib/common/linkedMap.js 676var require_linkedMap = __commonJS({ 677 "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports) { 678 "use strict"; 679 var _a3; 680 Object.defineProperty(exports, "__esModule", { value: true }); 681 exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; 682 var Touch; 683 (function(Touch2) { 684 Touch2.None = 0; 685 Touch2.First = 1; 686 Touch2.AsOld = Touch2.First; 687 Touch2.Last = 2; 688 Touch2.AsNew = Touch2.Last; 689 })(Touch || (exports.Touch = Touch = {})); 690 var LinkedMap = class { 691 constructor() { 692 this[_a3] = "LinkedMap"; 693 this._map = /* @__PURE__ */ new Map(); 694 this._head = void 0; 695 this._tail = void 0; 696 this._size = 0; 697 this._state = 0; 698 } 699 clear() { 700 this._map.clear(); 701 this._head = void 0; 702 this._tail = void 0; 703 this._size = 0; 704 this._state++; 705 } 706 isEmpty() { 707 return !this._head && !this._tail; 708 } 709 get size() { 710 return this._size; 711 } 712 get first() { 713 return this._head?.value; 714 } 715 get last() { 716 return this._tail?.value; 717 } 718 has(key) { 719 return this._map.has(key); 720 } 721 get(key, touch = Touch.None) { 722 const item = this._map.get(key); 723 if (!item) { 724 return void 0; 725 } 726 if (touch !== Touch.None) { 727 this.touch(item, touch); 728 } 729 return item.value; 730 } 731 set(key, value, touch = Touch.None) { 732 let item = this._map.get(key); 733 if (item) { 734 item.value = value; 735 if (touch !== Touch.None) { 736 this.touch(item, touch); 737 } 738 } else { 739 item = { key, value, next: void 0, previous: void 0 }; 740 switch (touch) { 741 case Touch.None: 742 this.addItemLast(item); 743 break; 744 case Touch.First: 745 this.addItemFirst(item); 746 break; 747 case Touch.Last: 748 this.addItemLast(item); 749 break; 750 default: 751 this.addItemLast(item); 752 break; 753 } 754 this._map.set(key, item); 755 this._size++; 756 } 757 return this; 758 } 759 delete(key) { 760 return !!this.remove(key); 761 } 762 remove(key) { 763 const item = this._map.get(key); 764 if (!item) { 765 return void 0; 766 } 767 this._map.delete(key); 768 this.removeItem(item); 769 this._size--; 770 return item.value; 771 } 772 shift() { 773 if (!this._head && !this._tail) { 774 return void 0; 775 } 776 if (!this._head || !this._tail) { 777 throw new Error("Invalid list"); 778 } 779 const item = this._head; 780 this._map.delete(item.key); 781 this.removeItem(item); 782 this._size--; 783 return item.value; 784 } 785 forEach(callbackfn, thisArg) { 786 const state = this._state; 787 let current = this._head; 788 while (current) { 789 if (thisArg) { 790 callbackfn.bind(thisArg)(current.value, current.key, this); 791 } else { 792 callbackfn(current.value, current.key, this); 793 } 794 if (this._state !== state) { 795 throw new Error(`LinkedMap got modified during iteration.`); 796 } 797 current = current.next; 798 } 799 } 800 keys() { 801 const state = this._state; 802 let current = this._head; 803 const iterator = { 804 [Symbol.iterator]: () => { 805 return iterator; 806 }, 807 next: () => { 808 if (this._state !== state) { 809 throw new Error(`LinkedMap got modified during iteration.`); 810 } 811 if (current) { 812 const result = { value: current.key, done: false }; 813 current = current.next; 814 return result; 815 } else { 816 return { value: void 0, done: true }; 817 } 818 } 819 }; 820 return iterator; 821 } 822 values() { 823 const state = this._state; 824 let current = this._head; 825 const iterator = { 826 [Symbol.iterator]: () => { 827 return iterator; 828 }, 829 next: () => { 830 if (this._state !== state) { 831 throw new Error(`LinkedMap got modified during iteration.`); 832 } 833 if (current) { 834 const result = { value: current.value, done: false }; 835 current = current.next; 836 return result; 837 } else { 838 return { value: void 0, done: true }; 839 } 840 } 841 }; 842 return iterator; 843 } 844 entries() { 845 const state = this._state; 846 let current = this._head; 847 const iterator = { 848 [Symbol.iterator]: () => { 849 return iterator; 850 }, 851 next: () => { 852 if (this._state !== state) { 853 throw new Error(`LinkedMap got modified during iteration.`); 854 } 855 if (current) { 856 const result = { value: [current.key, current.value], done: false }; 857 current = current.next; 858 return result; 859 } else { 860 return { value: void 0, done: true }; 861 } 862 } 863 }; 864 return iterator; 865 } 866 [(_a3 = Symbol.toStringTag, Symbol.iterator)]() { 867 return this.entries(); 868 } 869 trimOld(newSize) { 870 if (newSize >= this.size) { 871 return; 872 } 873 if (newSize === 0) { 874 this.clear(); 875 return; 876 } 877 let current = this._head; 878 let currentSize = this.size; 879 while (current && currentSize > newSize) { 880 this._map.delete(current.key); 881 current = current.next; 882 currentSize--; 883 } 884 this._head = current; 885 this._size = currentSize; 886 if (current) { 887 current.previous = void 0; 888 } 889 this._state++; 890 } 891 addItemFirst(item) { 892 if (!this._head && !this._tail) { 893 this._tail = item; 894 } else if (!this._head) { 895 throw new Error("Invalid list"); 896 } else { 897 item.next = this._head; 898 this._head.previous = item; 899 } 900 this._head = item; 901 this._state++; 902 } 903 addItemLast(item) { 904 if (!this._head && !this._tail) { 905 this._head = item; 906 } else if (!this._tail) { 907 throw new Error("Invalid list"); 908 } else { 909 item.previous = this._tail; 910 this._tail.next = item; 911 } 912 this._tail = item; 913 this._state++; 914 } 915 removeItem(item) { 916 if (item === this._head && item === this._tail) { 917 this._head = void 0; 918 this._tail = void 0; 919 } else if (item === this._head) { 920 if (!item.next) { 921 throw new Error("Invalid list"); 922 } 923 item.next.previous = void 0; 924 this._head = item.next; 925 } else if (item === this._tail) { 926 if (!item.previous) { 927 throw new Error("Invalid list"); 928 } 929 item.previous.next = void 0; 930 this._tail = item.previous; 931 } else { 932 const next = item.next; 933 const previous = item.previous; 934 if (!next || !previous) { 935 throw new Error("Invalid list"); 936 } 937 next.previous = previous; 938 previous.next = next; 939 } 940 item.next = void 0; 941 item.previous = void 0; 942 this._state++; 943 } 944 touch(item, touch) { 945 if (!this._head || !this._tail) { 946 throw new Error("Invalid list"); 947 } 948 if (touch !== Touch.First && touch !== Touch.Last) { 949 return; 950 } 951 if (touch === Touch.First) { 952 if (item === this._head) { 953 return; 954 } 955 const next = item.next; 956 const previous = item.previous; 957 if (item === this._tail) { 958 previous.next = void 0; 959 this._tail = previous; 960 } else { 961 next.previous = previous; 962 previous.next = next; 963 } 964 item.previous = void 0; 965 item.next = this._head; 966 this._head.previous = item; 967 this._head = item; 968 this._state++; 969 } else if (touch === Touch.Last) { 970 if (item === this._tail) { 971 return; 972 } 973 const next = item.next; 974 const previous = item.previous; 975 if (item === this._head) { 976 next.previous = void 0; 977 this._head = next; 978 } else { 979 next.previous = previous; 980 previous.next = next; 981 } 982 item.next = void 0; 983 item.previous = this._tail; 984 this._tail.next = item; 985 this._tail = item; 986 this._state++; 987 } 988 } 989 toJSON() { 990 const data = []; 991 this.forEach((value, key) => { 992 data.push([key, value]); 993 }); 994 return data; 995 } 996 fromJSON(data) { 997 this.clear(); 998 for (const [key, value] of data) { 999 this.set(key, value); 1000 } 1001 } 1002 }; 1003 exports.LinkedMap = LinkedMap; 1004 var LRUCache = class extends LinkedMap { 1005 constructor(limit, ratio = 1) { 1006 super(); 1007 this._limit = limit; 1008 this._ratio = Math.min(Math.max(0, ratio), 1); 1009 } 1010 get limit() { 1011 return this._limit; 1012 } 1013 set limit(limit) { 1014 this._limit = limit; 1015 this.checkTrim(); 1016 } 1017 get ratio() { 1018 return this._ratio; 1019 } 1020 set ratio(ratio) { 1021 this._ratio = Math.min(Math.max(0, ratio), 1); 1022 this.checkTrim(); 1023 } 1024 get(key, touch = Touch.AsNew) { 1025 return super.get(key, touch); 1026 } 1027 peek(key) { 1028 return super.get(key, Touch.None); 1029 } 1030 set(key, value) { 1031 super.set(key, value, Touch.Last); 1032 this.checkTrim(); 1033 return this; 1034 } 1035 checkTrim() { 1036 if (this.size > this._limit) { 1037 this.trimOld(Math.round(this._limit * this._ratio)); 1038 } 1039 } 1040 }; 1041 exports.LRUCache = LRUCache; 1042 } 1043}); 1044
vendor: 525 bytes, lines 1045-1062
1045// node_modules/vscode-jsonrpc/lib/common/disposable.js 1046var require_disposable = __commonJS({ 1047 "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports) { 1048 "use strict"; 1049 Object.defineProperty(exports, "__esModule", { value: true }); 1050 exports.Disposable = void 0; 1051 var Disposable; 1052 (function(Disposable2) { 1053 function create(func) { 1054 return { 1055 dispose: func 1056 }; 1057 } 1058 Disposable2.create = create; 1059 })(Disposable || (exports.Disposable = Disposable = {})); 1060 } 1061}); 1062
vendor: 671 bytes, lines 1063-1087
1063// node_modules/vscode-jsonrpc/lib/common/ral.js 1064var require_ral = __commonJS({ 1065 "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports) { 1066 "use strict"; 1067 Object.defineProperty(exports, "__esModule", { value: true }); 1068 var _ral; 1069 function RAL() { 1070 if (_ral === void 0) { 1071 throw new Error(`No runtime abstraction layer installed`); 1072 } 1073 return _ral; 1074 } 1075 (function(RAL2) { 1076 function install(ral) { 1077 if (ral === void 0) { 1078 throw new Error(`No runtime abstraction layer provided`); 1079 } 1080 _ral = ral; 1081 } 1082 RAL2.install = install; 1083 })(RAL || (RAL = {})); 1084 exports.default = RAL; 1085 } 1086}); 1087
vendor: 4,032 bytes, lines 1088-1216
1088// node_modules/vscode-jsonrpc/lib/common/events.js 1089var require_events2 = __commonJS({ 1090 "node_modules/vscode-jsonrpc/lib/common/events.js"(exports) { 1091 "use strict"; 1092 Object.defineProperty(exports, "__esModule", { value: true }); 1093 exports.Emitter = exports.Event = void 0; 1094 var ral_1 = require_ral(); 1095 var Event; 1096 (function(Event2) { 1097 const _disposable = { dispose() { 1098 } }; 1099 Event2.None = function() { 1100 return _disposable; 1101 }; 1102 })(Event || (exports.Event = Event = {})); 1103 var CallbackList = class { 1104 add(callback, context = null, bucket) { 1105 if (!this._callbacks) { 1106 this._callbacks = []; 1107 this._contexts = []; 1108 } 1109 this._callbacks.push(callback); 1110 this._contexts.push(context); 1111 if (Array.isArray(bucket)) { 1112 bucket.push({ dispose: () => this.remove(callback, context) }); 1113 } 1114 } 1115 remove(callback, context = null) { 1116 if (!this._callbacks) { 1117 return; 1118 } 1119 let foundCallbackWithDifferentContext = false; 1120 for (let i2 = 0, len = this._callbacks.length; i2 < len; i2++) { 1121 if (this._callbacks[i2] === callback) { 1122 if (this._contexts[i2] === context) { 1123 this._callbacks.splice(i2, 1); 1124 this._contexts.splice(i2, 1); 1125 return; 1126 } else { 1127 foundCallbackWithDifferentContext = true; 1128 } 1129 } 1130 } 1131 if (foundCallbackWithDifferentContext) { 1132 throw new Error("When adding a listener with a context, you should remove it with the same context"); 1133 } 1134 } 1135 invoke(...args) { 1136 if (!this._callbacks) { 1137 return []; 1138 } 1139 const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); 1140 for (let i2 = 0, len = callbacks.length; i2 < len; i2++) { 1141 try { 1142 ret.push(callbacks[i2].apply(contexts[i2], args)); 1143 } catch (e2) { 1144 (0, ral_1.default)().console.error(e2); 1145 } 1146 } 1147 return ret; 1148 } 1149 isEmpty() { 1150 return !this._callbacks || this._callbacks.length === 0; 1151 } 1152 dispose() { 1153 this._callbacks = void 0; 1154 this._contexts = void 0; 1155 } 1156 }; 1157 var Emitter = class _Emitter { 1158 constructor(_options) { 1159 this._options = _options; 1160 } 1161 /** 1162 * For the public to allow to subscribe 1163 * to events from this Emitter 1164 */ 1165 get event() { 1166 if (!this._event) { 1167 this._event = (listener, thisArgs, disposables) => { 1168 if (!this._callbacks) { 1169 this._callbacks = new CallbackList(); 1170 } 1171 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { 1172 this._options.onFirstListenerAdd(this); 1173 } 1174 this._callbacks.add(listener, thisArgs); 1175 const result = { 1176 dispose: () => { 1177 if (!this._callbacks) { 1178 return; 1179 } 1180 this._callbacks.remove(listener, thisArgs); 1181 result.dispose = _Emitter._noop; 1182 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { 1183 this._options.onLastListenerRemove(this); 1184 } 1185 } 1186 }; 1187 if (Array.isArray(disposables)) { 1188 disposables.push(result); 1189 } 1190 return result; 1191 }; 1192 } 1193 return this._event; 1194 } 1195 /** 1196 * To be kept private to fire an event to 1197 * subscribers 1198 */ 1199 fire(event) { 1200 if (this._callbacks) { 1201 this._callbacks.invoke.call(this._callbacks, event); 1202 } 1203 } 1204 dispose() { 1205 if (this._callbacks) { 1206 this._callbacks.dispose(); 1207 this._callbacks = void 0; 1208 } 1209 } 1210 }; 1211 exports.Emitter = Emitter; 1212 Emitter._noop = function() { 1213 }; 1214 } 1215}); 1216
vendor: 2,816 bytes, lines 1217-1305
1217// node_modules/vscode-jsonrpc/lib/common/cancellation.js 1218var require_cancellation = __commonJS({ 1219 "node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports) { 1220 "use strict"; 1221 Object.defineProperty(exports, "__esModule", { value: true }); 1222 exports.CancellationTokenSource = exports.CancellationToken = void 0; 1223 var ral_1 = require_ral(); 1224 var Is2 = require_is(); 1225 var events_1 = require_events2(); 1226 var CancellationToken; 1227 (function(CancellationToken2) { 1228 CancellationToken2.None = Object.freeze({ 1229 isCancellationRequested: false, 1230 onCancellationRequested: events_1.Event.None 1231 }); 1232 CancellationToken2.Cancelled = Object.freeze({ 1233 isCancellationRequested: true, 1234 onCancellationRequested: events_1.Event.None 1235 }); 1236 function is(value) { 1237 const candidate = value; 1238 return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); 1239 } 1240 CancellationToken2.is = is; 1241 })(CancellationToken || (exports.CancellationToken = CancellationToken = {})); 1242 var shortcutEvent = Object.freeze(function(callback, context) { 1243 const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0); 1244 return { dispose() { 1245 handle.dispose(); 1246 } }; 1247 }); 1248 var MutableToken = class { 1249 constructor() { 1250 this._isCancelled = false; 1251 } 1252 cancel() { 1253 if (!this._isCancelled) { 1254 this._isCancelled = true; 1255 if (this._emitter) { 1256 this._emitter.fire(void 0); 1257 this.dispose(); 1258 } 1259 } 1260 } 1261 get isCancellationRequested() { 1262 return this._isCancelled; 1263 } 1264 get onCancellationRequested() { 1265 if (this._isCancelled) { 1266 return shortcutEvent; 1267 } 1268 if (!this._emitter) { 1269 this._emitter = new events_1.Emitter(); 1270 } 1271 return this._emitter.event; 1272 } 1273 dispose() { 1274 if (this._emitter) { 1275 this._emitter.dispose(); 1276 this._emitter = void 0; 1277 } 1278 } 1279 }; 1280 var CancellationTokenSource = class { 1281 get token() { 1282 if (!this._token) { 1283 this._token = new MutableToken(); 1284 } 1285 return this._token; 1286 } 1287 cancel() { 1288 if (!this._token) { 1289 this._token = CancellationToken.Cancelled; 1290 } else { 1291 this._token.cancel(); 1292 } 1293 } 1294 dispose() { 1295 if (!this._token) { 1296 this._token = CancellationToken.None; 1297 } else if (this._token instanceof MutableToken) { 1298 this._token.dispose(); 1299 } 1300 } 1301 }; 1302 exports.CancellationTokenSource = CancellationTokenSource; 1303 } 1304}); 1305
vendor: 2,657 bytes, lines 1306-1383
1306// node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js 1307var require_sharedArrayCancellation = __commonJS({ 1308 "node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports) { 1309 "use strict"; 1310 Object.defineProperty(exports, "__esModule", { value: true }); 1311 exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = void 0; 1312 var cancellation_1 = require_cancellation(); 1313 var CancellationState; 1314 (function(CancellationState2) { 1315 CancellationState2.Continue = 0; 1316 CancellationState2.Cancelled = 1; 1317 })(CancellationState || (CancellationState = {})); 1318 var SharedArraySenderStrategy = class { 1319 constructor() { 1320 this.buffers = /* @__PURE__ */ new Map(); 1321 } 1322 enableCancellation(request) { 1323 if (request.id === null) { 1324 return; 1325 } 1326 const buffer = new SharedArrayBuffer(4); 1327 const data = new Int32Array(buffer, 0, 1); 1328 data[0] = CancellationState.Continue; 1329 this.buffers.set(request.id, buffer); 1330 request.$cancellationData = buffer; 1331 } 1332 async sendCancellation(_conn, id2) { 1333 const buffer = this.buffers.get(id2); 1334 if (buffer === void 0) { 1335 return; 1336 } 1337 const data = new Int32Array(buffer, 0, 1); 1338 Atomics.store(data, 0, CancellationState.Cancelled); 1339 } 1340 cleanup(id2) { 1341 this.buffers.delete(id2); 1342 } 1343 dispose() { 1344 this.buffers.clear(); 1345 } 1346 }; 1347 exports.SharedArraySenderStrategy = SharedArraySenderStrategy; 1348 var SharedArrayBufferCancellationToken = class { 1349 constructor(buffer) { 1350 this.data = new Int32Array(buffer, 0, 1); 1351 } 1352 get isCancellationRequested() { 1353 return Atomics.load(this.data, 0) === CancellationState.Cancelled; 1354 } 1355 get onCancellationRequested() { 1356 throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`); 1357 } 1358 }; 1359 var SharedArrayBufferCancellationTokenSource = class { 1360 constructor(buffer) { 1361 this.token = new SharedArrayBufferCancellationToken(buffer); 1362 } 1363 cancel() { 1364 } 1365 dispose() { 1366 } 1367 }; 1368 var SharedArrayReceiverStrategy = class { 1369 constructor() { 1370 this.kind = "request"; 1371 } 1372 createCancellationTokenSource(request) { 1373 const buffer = request.$cancellationData; 1374 if (buffer === void 0) { 1375 return new cancellation_1.CancellationTokenSource(); 1376 } 1377 return new SharedArrayBufferCancellationTokenSource(buffer); 1378 } 1379 }; 1380 exports.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy; 1381 } 1382}); 1383
vendor: 1,963 bytes, lines 1384-1451
1384// node_modules/vscode-jsonrpc/lib/common/semaphore.js 1385var require_semaphore = __commonJS({ 1386 "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports) { 1387 "use strict"; 1388 Object.defineProperty(exports, "__esModule", { value: true }); 1389 exports.Semaphore = void 0; 1390 var ral_1 = require_ral(); 1391 var Semaphore = class { 1392 constructor(capacity = 1) { 1393 if (capacity <= 0) { 1394 throw new Error("Capacity must be greater than 0"); 1395 } 1396 this._capacity = capacity; 1397 this._active = 0; 1398 this._waiting = []; 1399 } 1400 lock(thunk) { 1401 return new Promise((resolve, reject) => { 1402 this._waiting.push({ thunk, resolve, reject }); 1403 this.runNext(); 1404 }); 1405 } 1406 get active() { 1407 return this._active; 1408 } 1409 runNext() { 1410 if (this._waiting.length === 0 || this._active === this._capacity) { 1411 return; 1412 } 1413 (0, ral_1.default)().timer.setImmediate(() => this.doRunNext()); 1414 } 1415 doRunNext() { 1416 if (this._waiting.length === 0 || this._active === this._capacity) { 1417 return; 1418 } 1419 const next = this._waiting.shift(); 1420 this._active++; 1421 if (this._active > this._capacity) { 1422 throw new Error(`To many thunks active`); 1423 } 1424 try { 1425 const result = next.thunk(); 1426 if (result instanceof Promise) { 1427 result.then((value) => { 1428 this._active--; 1429 next.resolve(value); 1430 this.runNext(); 1431 }, (err2) => { 1432 this._active--; 1433 next.reject(err2); 1434 this.runNext(); 1435 }); 1436 } else { 1437 this._active--; 1438 next.resolve(result); 1439 this.runNext(); 1440 } 1441 } catch (err2) { 1442 this._active--; 1443 next.reject(err2); 1444 this.runNext(); 1445 } 1446 } 1447 }; 1448 exports.Semaphore = Semaphore; 1449 } 1450}); 1451
vendor: 7,401 bytes, lines 1452-1640
1452// node_modules/vscode-jsonrpc/lib/common/messageReader.js 1453var require_messageReader = __commonJS({ 1454 "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports) { 1455 "use strict"; 1456 Object.defineProperty(exports, "__esModule", { value: true }); 1457 exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; 1458 var ral_1 = require_ral(); 1459 var Is2 = require_is(); 1460 var events_1 = require_events2(); 1461 var semaphore_1 = require_semaphore(); 1462 var MessageReader; 1463 (function(MessageReader2) { 1464 function is(value) { 1465 let candidate = value; 1466 return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage); 1467 } 1468 MessageReader2.is = is; 1469 })(MessageReader || (exports.MessageReader = MessageReader = {})); 1470 var AbstractMessageReader2 = class { 1471 constructor() { 1472 this.errorEmitter = new events_1.Emitter(); 1473 this.closeEmitter = new events_1.Emitter(); 1474 this.partialMessageEmitter = new events_1.Emitter(); 1475 } 1476 dispose() { 1477 this.errorEmitter.dispose(); 1478 this.closeEmitter.dispose(); 1479 } 1480 get onError() { 1481 return this.errorEmitter.event; 1482 } 1483 fireError(error) { 1484 this.errorEmitter.fire(this.asError(error)); 1485 } 1486 get onClose() { 1487 return this.closeEmitter.event; 1488 } 1489 fireClose() { 1490 this.closeEmitter.fire(void 0); 1491 } 1492 get onPartialMessage() { 1493 return this.partialMessageEmitter.event; 1494 } 1495 firePartialMessage(info) { 1496 this.partialMessageEmitter.fire(info); 1497 } 1498 asError(error) { 1499 if (error instanceof Error) { 1500 return error; 1501 } else { 1502 return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); 1503 } 1504 } 1505 }; 1506 exports.AbstractMessageReader = AbstractMessageReader2; 1507 var ResolvedMessageReaderOptions; 1508 (function(ResolvedMessageReaderOptions2) { 1509 function fromOptions(options2) { 1510 let charset; 1511 let result; 1512 let contentDecoder; 1513 const contentDecoders = /* @__PURE__ */ new Map(); 1514 let contentTypeDecoder; 1515 const contentTypeDecoders = /* @__PURE__ */ new Map(); 1516 if (options2 === void 0 || typeof options2 === "string") { 1517 charset = options2 ?? "utf-8"; 1518 } else { 1519 charset = options2.charset ?? "utf-8"; 1520 if (options2.contentDecoder !== void 0) { 1521 contentDecoder = options2.contentDecoder; 1522 contentDecoders.set(contentDecoder.name, contentDecoder); 1523 } 1524 if (options2.contentDecoders !== void 0) { 1525 for (const decoder of options2.contentDecoders) { 1526 contentDecoders.set(decoder.name, decoder); 1527 } 1528 } 1529 if (options2.contentTypeDecoder !== void 0) { 1530 contentTypeDecoder = options2.contentTypeDecoder; 1531 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); 1532 } 1533 if (options2.contentTypeDecoders !== void 0) { 1534 for (const decoder of options2.contentTypeDecoders) { 1535 contentTypeDecoders.set(decoder.name, decoder); 1536 } 1537 } 1538 } 1539 if (contentTypeDecoder === void 0) { 1540 contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder; 1541 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); 1542 } 1543 return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; 1544 } 1545 ResolvedMessageReaderOptions2.fromOptions = fromOptions; 1546 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); 1547 var ReadableStreamMessageReader = class extends AbstractMessageReader2 { 1548 constructor(readable, options2) { 1549 super(); 1550 this.readable = readable; 1551 this.options = ResolvedMessageReaderOptions.fromOptions(options2); 1552 this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset); 1553 this._partialMessageTimeout = 1e4; 1554 this.nextMessageLength = -1; 1555 this.messageToken = 0; 1556 this.readSemaphore = new semaphore_1.Semaphore(1); 1557 } 1558 set partialMessageTimeout(timeout) { 1559 this._partialMessageTimeout = timeout; 1560 } 1561 get partialMessageTimeout() { 1562 return this._partialMessageTimeout; 1563 } 1564 listen(callback) { 1565 this.nextMessageLength = -1; 1566 this.messageToken = 0; 1567 this.partialMessageTimer = void 0; 1568 this.callback = callback; 1569 const result = this.readable.onData((data) => { 1570 this.onData(data); 1571 }); 1572 this.readable.onError((error) => this.fireError(error)); 1573 this.readable.onClose(() => this.fireClose()); 1574 return result; 1575 } 1576 onData(data) { 1577 try { 1578 this.buffer.append(data); 1579 while (true) { 1580 if (this.nextMessageLength === -1) { 1581 const headers = this.buffer.tryReadHeaders(true); 1582 if (!headers) { 1583 return; 1584 } 1585 const contentLength = headers.get("content-length"); 1586 if (!contentLength) { 1587 this.fireError(new Error(`Header must provide a Content-Length property. 1588${JSON.stringify(Object.fromEntries(headers))}`)); 1589 return; 1590 } 1591 const length = parseInt(contentLength); 1592 if (isNaN(length)) { 1593 this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`)); 1594 return; 1595 } 1596 this.nextMessageLength = length; 1597 } 1598 const body = this.buffer.tryReadBody(this.nextMessageLength); 1599 if (body === void 0) { 1600 this.setPartialMessageTimer(); 1601 return; 1602 } 1603 this.clearPartialMessageTimer(); 1604 this.nextMessageLength = -1; 1605 this.readSemaphore.lock(async () => { 1606 const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body; 1607 const message = await this.options.contentTypeDecoder.decode(bytes, this.options); 1608 this.callback(message); 1609 }).catch((error) => { 1610 this.fireError(error); 1611 }); 1612 } 1613 } catch (error) { 1614 this.fireError(error); 1615 } 1616 } 1617 clearPartialMessageTimer() { 1618 if (this.partialMessageTimer) { 1619 this.partialMessageTimer.dispose(); 1620 this.partialMessageTimer = void 0; 1621 } 1622 } 1623 setPartialMessageTimer() { 1624 this.clearPartialMessageTimer(); 1625 if (this._partialMessageTimeout <= 0) { 1626 return; 1627 } 1628 this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => { 1629 this.partialMessageTimer = void 0; 1630 if (token === this.messageToken) { 1631 this.firePartialMessage({ messageToken: token, waitingTime: timeout }); 1632 this.setPartialMessageTimer(); 1633 } 1634 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); 1635 } 1636 }; 1637 exports.ReadableStreamMessageReader = ReadableStreamMessageReader; 1638 } 1639}); 1640
vendor: 4,281 bytes, lines 1641-1752
1641// node_modules/vscode-jsonrpc/lib/common/messageWriter.js 1642var require_messageWriter = __commonJS({ 1643 "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports) { 1644 "use strict"; 1645 Object.defineProperty(exports, "__esModule", { value: true }); 1646 exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; 1647 var ral_1 = require_ral(); 1648 var Is2 = require_is(); 1649 var semaphore_1 = require_semaphore(); 1650 var events_1 = require_events2(); 1651 var ContentLength = "Content-Length: "; 1652 var CRLF = "\r\n"; 1653 var MessageWriter; 1654 (function(MessageWriter2) { 1655 function is(value) { 1656 let candidate = value; 1657 return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write); 1658 } 1659 MessageWriter2.is = is; 1660 })(MessageWriter || (exports.MessageWriter = MessageWriter = {})); 1661 var AbstractMessageWriter2 = class { 1662 constructor() { 1663 this.errorEmitter = new events_1.Emitter(); 1664 this.closeEmitter = new events_1.Emitter(); 1665 } 1666 dispose() { 1667 this.errorEmitter.dispose(); 1668 this.closeEmitter.dispose(); 1669 } 1670 get onError() { 1671 return this.errorEmitter.event; 1672 } 1673 fireError(error, message, count) { 1674 this.errorEmitter.fire([this.asError(error), message, count]); 1675 } 1676 get onClose() { 1677 return this.closeEmitter.event; 1678 } 1679 fireClose() { 1680 this.closeEmitter.fire(void 0); 1681 } 1682 asError(error) { 1683 if (error instanceof Error) { 1684 return error; 1685 } else { 1686 return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); 1687 } 1688 } 1689 }; 1690 exports.AbstractMessageWriter = AbstractMessageWriter2; 1691 var ResolvedMessageWriterOptions; 1692 (function(ResolvedMessageWriterOptions2) { 1693 function fromOptions(options2) { 1694 if (options2 === void 0 || typeof options2 === "string") { 1695 return { charset: options2 ?? "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder }; 1696 } else { 1697 return { charset: options2.charset ?? "utf-8", contentEncoder: options2.contentEncoder, contentTypeEncoder: options2.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder }; 1698 } 1699 } 1700 ResolvedMessageWriterOptions2.fromOptions = fromOptions; 1701 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); 1702 var WriteableStreamMessageWriter = class extends AbstractMessageWriter2 { 1703 constructor(writable, options2) { 1704 super(); 1705 this.writable = writable; 1706 this.options = ResolvedMessageWriterOptions.fromOptions(options2); 1707 this.errorCount = 0; 1708 this.writeSemaphore = new semaphore_1.Semaphore(1); 1709 this.writable.onError((error) => this.fireError(error)); 1710 this.writable.onClose(() => this.fireClose()); 1711 } 1712 async write(msg) { 1713 return this.writeSemaphore.lock(async () => { 1714 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { 1715 if (this.options.contentEncoder !== void 0) { 1716 return this.options.contentEncoder.encode(buffer); 1717 } else { 1718 return buffer; 1719 } 1720 }); 1721 return payload.then((buffer) => { 1722 const headers = []; 1723 headers.push(ContentLength, buffer.byteLength.toString(), CRLF); 1724 headers.push(CRLF); 1725 return this.doWrite(msg, headers, buffer); 1726 }, (error) => { 1727 this.fireError(error); 1728 throw error; 1729 }); 1730 }); 1731 } 1732 async doWrite(msg, headers, data) { 1733 try { 1734 await this.writable.write(headers.join(""), "ascii"); 1735 return this.writable.write(data); 1736 } catch (error) { 1737 this.handleError(error, msg); 1738 return Promise.reject(error); 1739 } 1740 } 1741 handleError(error, msg) { 1742 this.errorCount++; 1743 this.fireError(error, msg, this.errorCount); 1744 } 1745 end() { 1746 this.writable.end(); 1747 } 1748 }; 1749 exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; 1750 } 1751}); 1752
vendor: 4,948 bytes, lines 1753-1902
1753// node_modules/vscode-jsonrpc/lib/common/messageBuffer.js 1754var require_messageBuffer = __commonJS({ 1755 "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports) { 1756 "use strict"; 1757 Object.defineProperty(exports, "__esModule", { value: true }); 1758 exports.AbstractMessageBuffer = void 0; 1759 var CR = 13; 1760 var LF = 10; 1761 var CRLF = "\r\n"; 1762 var AbstractMessageBuffer = class { 1763 constructor(encoding = "utf-8") { 1764 this._encoding = encoding; 1765 this._chunks = []; 1766 this._totalLength = 0; 1767 } 1768 get encoding() { 1769 return this._encoding; 1770 } 1771 append(chunk) { 1772 const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; 1773 this._chunks.push(toAppend); 1774 this._totalLength += toAppend.byteLength; 1775 } 1776 tryReadHeaders(lowerCaseKeys = false) { 1777 if (this._chunks.length === 0) { 1778 return void 0; 1779 } 1780 let state = 0; 1781 let chunkIndex = 0; 1782 let offset = 0; 1783 let chunkBytesRead = 0; 1784 row: 1785 while (chunkIndex < this._chunks.length) { 1786 const chunk = this._chunks[chunkIndex]; 1787 offset = 0; 1788 column: 1789 while (offset < chunk.length) { 1790 const value = chunk[offset]; 1791 switch (value) { 1792 case CR: 1793 switch (state) { 1794 case 0: 1795 state = 1; 1796 break; 1797 case 2: 1798 state = 3; 1799 break; 1800 default: 1801 state = 0; 1802 } 1803 break; 1804 case LF: 1805 switch (state) { 1806 case 1: 1807 state = 2; 1808 break; 1809 case 3: 1810 state = 4; 1811 offset++; 1812 break row; 1813 default: 1814 state = 0; 1815 } 1816 break; 1817 default: 1818 state = 0; 1819 } 1820 offset++; 1821 } 1822 chunkBytesRead += chunk.byteLength; 1823 chunkIndex++; 1824 } 1825 if (state !== 4) { 1826 return void 0; 1827 } 1828 const buffer = this._read(chunkBytesRead + offset); 1829 const result = /* @__PURE__ */ new Map(); 1830 const headers = this.toString(buffer, "ascii").split(CRLF); 1831 if (headers.length < 2) { 1832 return result; 1833 } 1834 for (let i2 = 0; i2 < headers.length - 2; i2++) { 1835 const header = headers[i2]; 1836 const index = header.indexOf(":"); 1837 if (index === -1) { 1838 throw new Error(`Message header must separate key and value using ':' 1839${header}`); 1840 } 1841 const key = header.substr(0, index); 1842 const value = header.substr(index + 1).trim(); 1843 result.set(lowerCaseKeys ? key.toLowerCase() : key, value); 1844 } 1845 return result; 1846 } 1847 tryReadBody(length) { 1848 if (this._totalLength < length) { 1849 return void 0; 1850 } 1851 return this._read(length); 1852 } 1853 get numberOfBytes() { 1854 return this._totalLength; 1855 } 1856 _read(byteCount) { 1857 if (byteCount === 0) { 1858 return this.emptyBuffer(); 1859 } 1860 if (byteCount > this._totalLength) { 1861 throw new Error(`Cannot read so many bytes!`); 1862 } 1863 if (this._chunks[0].byteLength === byteCount) { 1864 const chunk = this._chunks[0]; 1865 this._chunks.shift(); 1866 this._totalLength -= byteCount; 1867 return this.asNative(chunk); 1868 } 1869 if (this._chunks[0].byteLength > byteCount) { 1870 const chunk = this._chunks[0]; 1871 const result2 = this.asNative(chunk, byteCount); 1872 this._chunks[0] = chunk.slice(byteCount); 1873 this._totalLength -= byteCount; 1874 return result2; 1875 } 1876 const result = this.allocNative(byteCount); 1877 let resultOffset = 0; 1878 let chunkIndex = 0; 1879 while (byteCount > 0) { 1880 const chunk = this._chunks[chunkIndex]; 1881 if (chunk.byteLength > byteCount) { 1882 const chunkPart = chunk.slice(0, byteCount); 1883 result.set(chunkPart, resultOffset); 1884 resultOffset += byteCount; 1885 this._chunks[chunkIndex] = chunk.slice(byteCount); 1886 this._totalLength -= byteCount; 1887 byteCount -= byteCount; 1888 } else { 1889 result.set(chunk, resultOffset); 1890 resultOffset += chunk.byteLength; 1891 this._chunks.shift(); 1892 this._totalLength -= chunk.byteLength; 1893 byteCount -= chunk.byteLength; 1894 } 1895 } 1896 return result; 1897 } 1898 }; 1899 exports.AbstractMessageBuffer = AbstractMessageBuffer; 1900 } 1901}); 1902
vendor: 46,317 bytes, lines 1903-3030
1903// node_modules/vscode-jsonrpc/lib/common/connection.js 1904var require_connection = __commonJS({ 1905 "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports) { 1906 "use strict"; 1907 Object.defineProperty(exports, "__esModule", { value: true }); 1908 exports.createMessageConnection = exports.ConnectionOptions = exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = exports.NullLogger = exports.ProgressType = exports.ProgressToken = void 0; 1909 var ral_1 = require_ral(); 1910 var Is2 = require_is(); 1911 var messages_1 = require_messages(); 1912 var linkedMap_1 = require_linkedMap(); 1913 var events_1 = require_events2(); 1914 var cancellation_1 = require_cancellation(); 1915 var CancelNotification; 1916 (function(CancelNotification2) { 1917 CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); 1918 })(CancelNotification || (CancelNotification = {})); 1919 var ProgressToken; 1920 (function(ProgressToken2) { 1921 function is(value) { 1922 return typeof value === "string" || typeof value === "number"; 1923 } 1924 ProgressToken2.is = is; 1925 })(ProgressToken || (exports.ProgressToken = ProgressToken = {})); 1926 var ProgressNotification; 1927 (function(ProgressNotification2) { 1928 ProgressNotification2.type = new messages_1.NotificationType("$/progress"); 1929 })(ProgressNotification || (ProgressNotification = {})); 1930 var ProgressType = class { 1931 constructor() { 1932 } 1933 }; 1934 exports.ProgressType = ProgressType; 1935 var StarRequestHandler; 1936 (function(StarRequestHandler2) { 1937 function is(value) { 1938 return Is2.func(value); 1939 } 1940 StarRequestHandler2.is = is; 1941 })(StarRequestHandler || (StarRequestHandler = {})); 1942 exports.NullLogger = Object.freeze({ 1943 error: () => { 1944 }, 1945 warn: () => { 1946 }, 1947 info: () => { 1948 }, 1949 log: () => { 1950 } 1951 }); 1952 var Trace; 1953 (function(Trace2) { 1954 Trace2[Trace2["Off"] = 0] = "Off"; 1955 Trace2[Trace2["Messages"] = 1] = "Messages"; 1956 Trace2[Trace2["Compact"] = 2] = "Compact"; 1957 Trace2[Trace2["Verbose"] = 3] = "Verbose"; 1958 })(Trace || (exports.Trace = Trace = {})); 1959 var TraceValues; 1960 (function(TraceValues2) { 1961 TraceValues2.Off = "off"; 1962 TraceValues2.Messages = "messages"; 1963 TraceValues2.Compact = "compact"; 1964 TraceValues2.Verbose = "verbose"; 1965 })(TraceValues || (exports.TraceValues = TraceValues = {})); 1966 (function(Trace2) { 1967 function fromString(value) { 1968 if (!Is2.string(value)) { 1969 return Trace2.Off; 1970 } 1971 value = value.toLowerCase(); 1972 switch (value) { 1973 case "off": 1974 return Trace2.Off; 1975 case "messages": 1976 return Trace2.Messages; 1977 case "compact": 1978 return Trace2.Compact; 1979 case "verbose": 1980 return Trace2.Verbose; 1981 default: 1982 return Trace2.Off; 1983 } 1984 } 1985 Trace2.fromString = fromString; 1986 function toString(value) { 1987 switch (value) { 1988 case Trace2.Off: 1989 return "off"; 1990 case Trace2.Messages: 1991 return "messages"; 1992 case Trace2.Compact: 1993 return "compact"; 1994 case Trace2.Verbose: 1995 return "verbose"; 1996 default: 1997 return "off"; 1998 } 1999 } 2000 Trace2.toString = toString; 2001 })(Trace || (exports.Trace = Trace = {})); 2002 var TraceFormat; 2003 (function(TraceFormat2) { 2004 TraceFormat2["Text"] = "text"; 2005 TraceFormat2["JSON"] = "json"; 2006 })(TraceFormat || (exports.TraceFormat = TraceFormat = {})); 2007 (function(TraceFormat2) { 2008 function fromString(value) { 2009 if (!Is2.string(value)) { 2010 return TraceFormat2.Text; 2011 } 2012 value = value.toLowerCase(); 2013 if (value === "json") { 2014 return TraceFormat2.JSON; 2015 } else { 2016 return TraceFormat2.Text; 2017 } 2018 } 2019 TraceFormat2.fromString = fromString; 2020 })(TraceFormat || (exports.TraceFormat = TraceFormat = {})); 2021 var SetTraceNotification; 2022 (function(SetTraceNotification2) { 2023 SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); 2024 })(SetTraceNotification || (exports.SetTraceNotification = SetTraceNotification = {})); 2025 var LogTraceNotification; 2026 (function(LogTraceNotification2) { 2027 LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); 2028 })(LogTraceNotification || (exports.LogTraceNotification = LogTraceNotification = {})); 2029 var ConnectionErrors; 2030 (function(ConnectionErrors2) { 2031 ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; 2032 ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; 2033 ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; 2034 })(ConnectionErrors || (exports.ConnectionErrors = ConnectionErrors = {})); 2035 var ConnectionError = class _ConnectionError extends Error { 2036 constructor(code, message) { 2037 super(message); 2038 this.code = code; 2039 Object.setPrototypeOf(this, _ConnectionError.prototype); 2040 } 2041 }; 2042 exports.ConnectionError = ConnectionError; 2043 var ConnectionStrategy; 2044 (function(ConnectionStrategy2) { 2045 function is(value) { 2046 const candidate = value; 2047 return candidate && Is2.func(candidate.cancelUndispatched); 2048 } 2049 ConnectionStrategy2.is = is; 2050 })(ConnectionStrategy || (exports.ConnectionStrategy = ConnectionStrategy = {})); 2051 var IdCancellationReceiverStrategy; 2052 (function(IdCancellationReceiverStrategy2) { 2053 function is(value) { 2054 const candidate = value; 2055 return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); 2056 } 2057 IdCancellationReceiverStrategy2.is = is; 2058 })(IdCancellationReceiverStrategy || (exports.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {})); 2059 var RequestCancellationReceiverStrategy; 2060 (function(RequestCancellationReceiverStrategy2) { 2061 function is(value) { 2062 const candidate = value; 2063 return candidate && candidate.kind === "request" && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); 2064 } 2065 RequestCancellationReceiverStrategy2.is = is; 2066 })(RequestCancellationReceiverStrategy || (exports.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {})); 2067 var CancellationReceiverStrategy; 2068 (function(CancellationReceiverStrategy2) { 2069 CancellationReceiverStrategy2.Message = Object.freeze({ 2070 createCancellationTokenSource(_2) { 2071 return new cancellation_1.CancellationTokenSource(); 2072 } 2073 }); 2074 function is(value) { 2075 return IdCancellationReceiverStrategy.is(value) || RequestCancellationReceiverStrategy.is(value); 2076 } 2077 CancellationReceiverStrategy2.is = is; 2078 })(CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = CancellationReceiverStrategy = {})); 2079 var CancellationSenderStrategy; 2080 (function(CancellationSenderStrategy2) { 2081 CancellationSenderStrategy2.Message = Object.freeze({ 2082 sendCancellation(conn, id2) { 2083 return conn.sendNotification(CancelNotification.type, { id: id2 }); 2084 }, 2085 cleanup(_2) { 2086 } 2087 }); 2088 function is(value) { 2089 const candidate = value; 2090 return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup); 2091 } 2092 CancellationSenderStrategy2.is = is; 2093 })(CancellationSenderStrategy || (exports.CancellationSenderStrategy = CancellationSenderStrategy = {})); 2094 var CancellationStrategy; 2095 (function(CancellationStrategy2) { 2096 CancellationStrategy2.Message = Object.freeze({ 2097 receiver: CancellationReceiverStrategy.Message, 2098 sender: CancellationSenderStrategy.Message 2099 }); 2100 function is(value) { 2101 const candidate = value; 2102 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); 2103 } 2104 CancellationStrategy2.is = is; 2105 })(CancellationStrategy || (exports.CancellationStrategy = CancellationStrategy = {})); 2106 var MessageStrategy; 2107 (function(MessageStrategy2) { 2108 function is(value) { 2109 const candidate = value; 2110 return candidate && Is2.func(candidate.handleMessage); 2111 } 2112 MessageStrategy2.is = is; 2113 })(MessageStrategy || (exports.MessageStrategy = MessageStrategy = {})); 2114 var ConnectionOptions; 2115 (function(ConnectionOptions2) { 2116 function is(value) { 2117 const candidate = value; 2118 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy)); 2119 } 2120 ConnectionOptions2.is = is; 2121 })(ConnectionOptions || (exports.ConnectionOptions = ConnectionOptions = {})); 2122 var ConnectionState; 2123 (function(ConnectionState2) { 2124 ConnectionState2[ConnectionState2["New"] = 1] = "New"; 2125 ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; 2126 ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; 2127 ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; 2128 })(ConnectionState || (ConnectionState = {})); 2129 function createMessageConnection3(messageReader, messageWriter, _logger, options2) { 2130 const logger = _logger !== void 0 ? _logger : exports.NullLogger; 2131 let sequenceNumber = 0; 2132 let notificationSequenceNumber = 0; 2133 let unknownResponseSequenceNumber = 0; 2134 const version = "2.0"; 2135 let starRequestHandler = void 0; 2136 const requestHandlers = /* @__PURE__ */ new Map(); 2137 let starNotificationHandler = void 0; 2138 const notificationHandlers = /* @__PURE__ */ new Map(); 2139 const progressHandlers = /* @__PURE__ */ new Map(); 2140 let timer; 2141 let messageQueue = new linkedMap_1.LinkedMap(); 2142 let responsePromises = /* @__PURE__ */ new Map(); 2143 let knownCanceledRequests = /* @__PURE__ */ new Set(); 2144 let requestTokens = /* @__PURE__ */ new Map(); 2145 let trace = Trace.Off; 2146 let traceFormat = TraceFormat.Text; 2147 let tracer; 2148 let state = ConnectionState.New; 2149 const errorEmitter = new events_1.Emitter(); 2150 const closeEmitter = new events_1.Emitter(); 2151 const unhandledNotificationEmitter = new events_1.Emitter(); 2152 const unhandledProgressEmitter = new events_1.Emitter(); 2153 const disposeEmitter = new events_1.Emitter(); 2154 const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message; 2155 function createRequestQueueKey(id2) { 2156 if (id2 === null) { 2157 throw new Error(`Can't send requests with id null since the response can't be correlated.`); 2158 } 2159 return "req-" + id2.toString(); 2160 } 2161 function createResponseQueueKey(id2) { 2162 if (id2 === null) { 2163 return "res-unknown-" + (++unknownResponseSequenceNumber).toString(); 2164 } else { 2165 return "res-" + id2.toString(); 2166 } 2167 } 2168 function createNotificationQueueKey() { 2169 return "not-" + (++notificationSequenceNumber).toString(); 2170 } 2171 function addMessageToQueue(queue, message) { 2172 if (messages_1.Message.isRequest(message)) { 2173 queue.set(createRequestQueueKey(message.id), message); 2174 } else if (messages_1.Message.isResponse(message)) { 2175 queue.set(createResponseQueueKey(message.id), message); 2176 } else { 2177 queue.set(createNotificationQueueKey(), message); 2178 } 2179 } 2180 function cancelUndispatched(_message) { 2181 return void 0; 2182 } 2183 function isListening() { 2184 return state === ConnectionState.Listening; 2185 } 2186 function isClosed() { 2187 return state === ConnectionState.Closed; 2188 } 2189 function isDisposed() { 2190 return state === ConnectionState.Disposed; 2191 } 2192 function closeHandler() { 2193 if (state === ConnectionState.New || state === ConnectionState.Listening) { 2194 state = ConnectionState.Closed; 2195 closeEmitter.fire(void 0); 2196 } 2197 } 2198 function readErrorHandler(error) { 2199 errorEmitter.fire([error, void 0, void 0]); 2200 } 2201 function writeErrorHandler(data) { 2202 errorEmitter.fire(data); 2203 } 2204 messageReader.onClose(closeHandler); 2205 messageReader.onError(readErrorHandler); 2206 messageWriter.onClose(closeHandler); 2207 messageWriter.onError(writeErrorHandler); 2208 function triggerMessageQueue() { 2209 if (timer || messageQueue.size === 0) { 2210 return; 2211 } 2212 timer = (0, ral_1.default)().timer.setImmediate(() => { 2213 timer = void 0; 2214 processMessageQueue(); 2215 }); 2216 } 2217 function handleMessage(message) { 2218 if (messages_1.Message.isRequest(message)) { 2219 handleRequest(message); 2220 } else if (messages_1.Message.isNotification(message)) { 2221 handleNotification(message); 2222 } else if (messages_1.Message.isResponse(message)) { 2223 handleResponse(message); 2224 } else { 2225 handleInvalidMessage(message); 2226 } 2227 } 2228 function processMessageQueue() { 2229 if (messageQueue.size === 0) { 2230 return; 2231 } 2232 const message = messageQueue.shift(); 2233 try { 2234 const messageStrategy = options2?.messageStrategy; 2235 if (MessageStrategy.is(messageStrategy)) { 2236 messageStrategy.handleMessage(message, handleMessage); 2237 } else { 2238 handleMessage(message); 2239 } 2240 } finally { 2241 triggerMessageQueue(); 2242 } 2243 } 2244 const callback = (message) => { 2245 try { 2246 if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) { 2247 const cancelId = message.params.id; 2248 const key = createRequestQueueKey(cancelId); 2249 const toCancel = messageQueue.get(key); 2250 if (messages_1.Message.isRequest(toCancel)) { 2251 const strategy = options2?.connectionStrategy; 2252 const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); 2253 if (response && (response.error !== void 0 || response.result !== void 0)) { 2254 messageQueue.delete(key); 2255 requestTokens.delete(cancelId); 2256 response.id = toCancel.id; 2257 traceSendingResponse(response, message.method, Date.now()); 2258 messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`)); 2259 return; 2260 } 2261 } 2262 const cancellationToken = requestTokens.get(cancelId); 2263 if (cancellationToken !== void 0) { 2264 cancellationToken.cancel(); 2265 traceReceivedNotification(message); 2266 return; 2267 } else { 2268 knownCanceledRequests.add(cancelId); 2269 } 2270 } 2271 addMessageToQueue(messageQueue, message); 2272 } finally { 2273 triggerMessageQueue(); 2274 } 2275 }; 2276 function handleRequest(requestMessage) { 2277 if (isDisposed()) { 2278 return; 2279 } 2280 function reply(resultOrError, method, startTime2) { 2281 const message = { 2282 jsonrpc: version, 2283 id: requestMessage.id 2284 }; 2285 if (resultOrError instanceof messages_1.ResponseError) { 2286 message.error = resultOrError.toJson(); 2287 } else { 2288 message.result = resultOrError === void 0 ? null : resultOrError; 2289 } 2290 traceSendingResponse(message, method, startTime2); 2291 messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); 2292 } 2293 function replyError(error, method, startTime2) { 2294 const message = { 2295 jsonrpc: version, 2296 id: requestMessage.id, 2297 error: error.toJson() 2298 }; 2299 traceSendingResponse(message, method, startTime2); 2300 messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); 2301 } 2302 function replySuccess(result, method, startTime2) { 2303 if (result === void 0) { 2304 result = null; 2305 } 2306 const message = { 2307 jsonrpc: version, 2308 id: requestMessage.id, 2309 result 2310 }; 2311 traceSendingResponse(message, method, startTime2); 2312 messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); 2313 } 2314 traceReceivedRequest(requestMessage); 2315 const element = requestHandlers.get(requestMessage.method); 2316 let type; 2317 let requestHandler; 2318 if (element) { 2319 type = element.type; 2320 requestHandler = element.handler; 2321 } 2322 const startTime = Date.now(); 2323 if (requestHandler || starRequestHandler) { 2324 const tokenKey = requestMessage.id ?? String(Date.now()); 2325 const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage); 2326 if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { 2327 cancellationSource.cancel(); 2328 } 2329 if (requestMessage.id !== null) { 2330 requestTokens.set(tokenKey, cancellationSource); 2331 } 2332 try { 2333 let handlerResult; 2334 if (requestHandler) { 2335 if (requestMessage.params === void 0) { 2336 if (type !== void 0 && type.numberOfParams !== 0) { 2337 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime); 2338 return; 2339 } 2340 handlerResult = requestHandler(cancellationSource.token); 2341 } else if (Array.isArray(requestMessage.params)) { 2342 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) { 2343 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); 2344 return; 2345 } 2346 handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); 2347 } else { 2348 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { 2349 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); 2350 return; 2351 } 2352 handlerResult = requestHandler(requestMessage.params, cancellationSource.token); 2353 } 2354 } else if (starRequestHandler) { 2355 handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); 2356 } 2357 const promise = handlerResult; 2358 if (!handlerResult) { 2359 requestTokens.delete(tokenKey); 2360 replySuccess(handlerResult, requestMessage.method, startTime); 2361 } else if (promise.then) { 2362 promise.then((resultOrError) => { 2363 requestTokens.delete(tokenKey); 2364 reply(resultOrError, requestMessage.method, startTime); 2365 }, (error) => { 2366 requestTokens.delete(tokenKey); 2367 if (error instanceof messages_1.ResponseError) { 2368 replyError(error, requestMessage.method, startTime); 2369 } else if (error && Is2.string(error.message)) { 2370 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); 2371 } else { 2372 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); 2373 } 2374 }); 2375 } else { 2376 requestTokens.delete(tokenKey); 2377 reply(handlerResult, requestMessage.method, startTime); 2378 } 2379 } catch (error) { 2380 requestTokens.delete(tokenKey); 2381 if (error instanceof messages_1.ResponseError) { 2382 reply(error, requestMessage.method, startTime); 2383 } else if (error && Is2.string(error.message)) { 2384 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); 2385 } else { 2386 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); 2387 } 2388 } 2389 } else { 2390 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); 2391 } 2392 } 2393 function handleResponse(responseMessage) { 2394 if (isDisposed()) { 2395 return; 2396 } 2397 if (responseMessage.id === null) { 2398 if (responseMessage.error) { 2399 logger.error(`Received response message without id: Error is: 2400${JSON.stringify(responseMessage.error, void 0, 4)}`); 2401 } else { 2402 logger.error(`Received response message without id. No further error information provided.`); 2403 } 2404 } else { 2405 const key = responseMessage.id; 2406 const responsePromise = responsePromises.get(key); 2407 traceReceivedResponse(responseMessage, responsePromise); 2408 if (responsePromise !== void 0) { 2409 responsePromises.delete(key); 2410 try { 2411 if (responseMessage.error) { 2412 const error = responseMessage.error; 2413 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); 2414 } else if (responseMessage.result !== void 0) { 2415 responsePromise.resolve(responseMessage.result); 2416 } else { 2417 throw new Error("Should never happen."); 2418 } 2419 } catch (error) { 2420 if (error.message) { 2421 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); 2422 } else { 2423 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); 2424 } 2425 } 2426 } 2427 } 2428 } 2429 function handleNotification(message) { 2430 if (isDisposed()) { 2431 return; 2432 } 2433 let type = void 0; 2434 let notificationHandler; 2435 if (message.method === CancelNotification.type.method) { 2436 const cancelId = message.params.id; 2437 knownCanceledRequests.delete(cancelId); 2438 traceReceivedNotification(message); 2439 return; 2440 } else { 2441 const element = notificationHandlers.get(message.method); 2442 if (element) { 2443 notificationHandler = element.handler; 2444 type = element.type; 2445 } 2446 } 2447 if (notificationHandler || starNotificationHandler) { 2448 try { 2449 traceReceivedNotification(message); 2450 if (notificationHandler) { 2451 if (message.params === void 0) { 2452 if (type !== void 0) { 2453 if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { 2454 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`); 2455 } 2456 } 2457 notificationHandler(); 2458 } else if (Array.isArray(message.params)) { 2459 const params = message.params; 2460 if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) { 2461 notificationHandler({ token: params[0], value: params[1] }); 2462 } else { 2463 if (type !== void 0) { 2464 if (type.parameterStructures === messages_1.ParameterStructures.byName) { 2465 logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); 2466 } 2467 if (type.numberOfParams !== message.params.length) { 2468 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`); 2469 } 2470 } 2471 notificationHandler(...params); 2472 } 2473 } else { 2474 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { 2475 logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); 2476 } 2477 notificationHandler(message.params); 2478 } 2479 } else if (starNotificationHandler) { 2480 starNotificationHandler(message.method, message.params); 2481 } 2482 } catch (error) { 2483 if (error.message) { 2484 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); 2485 } else { 2486 logger.error(`Notification handler '${message.method}' failed unexpectedly.`); 2487 } 2488 } 2489 } else { 2490 unhandledNotificationEmitter.fire(message); 2491 } 2492 } 2493 function handleInvalidMessage(message) { 2494 if (!message) { 2495 logger.error("Received empty message."); 2496 return; 2497 } 2498 logger.error(`Received message which is neither a response nor a notification message: 2499${JSON.stringify(message, null, 4)}`); 2500 const responseMessage = message; 2501 if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) { 2502 const key = responseMessage.id; 2503 const responseHandler = responsePromises.get(key); 2504 if (responseHandler) { 2505 responseHandler.reject(new Error("The received response has neither a result nor an error property.")); 2506 } 2507 } 2508 } 2509 function stringifyTrace(params) { 2510 if (params === void 0 || params === null) { 2511 return void 0; 2512 } 2513 switch (trace) { 2514 case Trace.Verbose: 2515 return JSON.stringify(params, null, 4); 2516 case Trace.Compact: 2517 return JSON.stringify(params); 2518 default: 2519 return void 0; 2520 } 2521 } 2522 function traceSendingRequest(message) { 2523 if (trace === Trace.Off || !tracer) { 2524 return; 2525 } 2526 if (traceFormat === TraceFormat.Text) { 2527 let data = void 0; 2528 if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { 2529 data = `Params: ${stringifyTrace(message.params)} 2530 2531`; 2532 } 2533 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); 2534 } else { 2535 logLSPMessage("send-request", message); 2536 } 2537 } 2538 function traceSendingNotification(message) { 2539 if (trace === Trace.Off || !tracer) { 2540 return; 2541 } 2542 if (traceFormat === TraceFormat.Text) { 2543 let data = void 0; 2544 if (trace === Trace.Verbose || trace === Trace.Compact) { 2545 if (message.params) { 2546 data = `Params: ${stringifyTrace(message.params)} 2547 2548`; 2549 } else { 2550 data = "No parameters provided.\n\n"; 2551 } 2552 } 2553 tracer.log(`Sending notification '${message.method}'.`, data); 2554 } else { 2555 logLSPMessage("send-notification", message); 2556 } 2557 } 2558 function traceSendingResponse(message, method, startTime) { 2559 if (trace === Trace.Off || !tracer) { 2560 return; 2561 } 2562 if (traceFormat === TraceFormat.Text) { 2563 let data = void 0; 2564 if (trace === Trace.Verbose || trace === Trace.Compact) { 2565 if (message.error && message.error.data) { 2566 data = `Error data: ${stringifyTrace(message.error.data)} 2567 2568`; 2569 } else { 2570 if (message.result) { 2571 data = `Result: ${stringifyTrace(message.result)} 2572 2573`; 2574 } else if (message.error === void 0) { 2575 data = "No result returned.\n\n"; 2576 } 2577 } 2578 } 2579 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); 2580 } else { 2581 logLSPMessage("send-response", message); 2582 } 2583 } 2584 function traceReceivedRequest(message) { 2585 if (trace === Trace.Off || !tracer) { 2586 return; 2587 } 2588 if (traceFormat === TraceFormat.Text) { 2589 let data = void 0; 2590 if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { 2591 data = `Params: ${stringifyTrace(message.params)} 2592 2593`; 2594 } 2595 tracer.log(`Received request '${message.method} - (${message.id})'.`, data); 2596 } else { 2597 logLSPMessage("receive-request", message); 2598 } 2599 } 2600 function traceReceivedNotification(message) { 2601 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { 2602 return; 2603 } 2604 if (traceFormat === TraceFormat.Text) { 2605 let data = void 0; 2606 if (trace === Trace.Verbose || trace === Trace.Compact) { 2607 if (message.params) { 2608 data = `Params: ${stringifyTrace(message.params)} 2609 2610`; 2611 } else { 2612 data = "No parameters provided.\n\n"; 2613 } 2614 } 2615 tracer.log(`Received notification '${message.method}'.`, data); 2616 } else { 2617 logLSPMessage("receive-notification", message); 2618 } 2619 } 2620 function traceReceivedResponse(message, responsePromise) { 2621 if (trace === Trace.Off || !tracer) { 2622 return; 2623 } 2624 if (traceFormat === TraceFormat.Text) { 2625 let data = void 0; 2626 if (trace === Trace.Verbose || trace === Trace.Compact) { 2627 if (message.error && message.error.data) { 2628 data = `Error data: ${stringifyTrace(message.error.data)} 2629 2630`; 2631 } else { 2632 if (message.result) { 2633 data = `Result: ${stringifyTrace(message.result)} 2634 2635`; 2636 } else if (message.error === void 0) { 2637 data = "No result returned.\n\n"; 2638 } 2639 } 2640 } 2641 if (responsePromise) { 2642 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; 2643 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); 2644 } else { 2645 tracer.log(`Received response ${message.id} without active response promise.`, data); 2646 } 2647 } else { 2648 logLSPMessage("receive-response", message); 2649 } 2650 } 2651 function logLSPMessage(type, message) { 2652 if (!tracer || trace === Trace.Off) { 2653 return; 2654 } 2655 const lspMessage = { 2656 isLSPMessage: true, 2657 type, 2658 message, 2659 timestamp: Date.now() 2660 }; 2661 tracer.log(lspMessage); 2662 } 2663 function throwIfClosedOrDisposed() { 2664 if (isClosed()) { 2665 throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); 2666 } 2667 if (isDisposed()) { 2668 throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); 2669 } 2670 } 2671 function throwIfListening() { 2672 if (isListening()) { 2673 throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); 2674 } 2675 } 2676 function throwIfNotListening() { 2677 if (!isListening()) { 2678 throw new Error("Call listen() first."); 2679 } 2680 } 2681 function undefinedToNull(param) { 2682 if (param === void 0) { 2683 return null; 2684 } else { 2685 return param; 2686 } 2687 } 2688 function nullToUndefined(param) { 2689 if (param === null) { 2690 return void 0; 2691 } else { 2692 return param; 2693 } 2694 } 2695 function isNamedParam(param) { 2696 return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; 2697 } 2698 function computeSingleParam(parameterStructures, param) { 2699 switch (parameterStructures) { 2700 case messages_1.ParameterStructures.auto: 2701 if (isNamedParam(param)) { 2702 return nullToUndefined(param); 2703 } else { 2704 return [undefinedToNull(param)]; 2705 } 2706 case messages_1.ParameterStructures.byName: 2707 if (!isNamedParam(param)) { 2708 throw new Error(`Received parameters by name but param is not an object literal.`); 2709 } 2710 return nullToUndefined(param); 2711 case messages_1.ParameterStructures.byPosition: 2712 return [undefinedToNull(param)]; 2713 default: 2714 throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); 2715 } 2716 } 2717 function computeMessageParams(type, params) { 2718 let result; 2719 const numberOfParams = type.numberOfParams; 2720 switch (numberOfParams) { 2721 case 0: 2722 result = void 0; 2723 break; 2724 case 1: 2725 result = computeSingleParam(type.parameterStructures, params[0]); 2726 break; 2727 default: 2728 result = []; 2729 for (let i2 = 0; i2 < params.length && i2 < numberOfParams; i2++) { 2730 result.push(undefinedToNull(params[i2])); 2731 } 2732 if (params.length < numberOfParams) { 2733 for (let i2 = params.length; i2 < numberOfParams; i2++) { 2734 result.push(null); 2735 } 2736 } 2737 break; 2738 } 2739 return result; 2740 } 2741 const connection = { 2742 sendNotification: (type, ...args) => { 2743 throwIfClosedOrDisposed(); 2744 let method; 2745 let messageParams; 2746 if (Is2.string(type)) { 2747 method = type; 2748 const first = args[0]; 2749 let paramStart = 0; 2750 let parameterStructures = messages_1.ParameterStructures.auto; 2751 if (messages_1.ParameterStructures.is(first)) { 2752 paramStart = 1; 2753 parameterStructures = first; 2754 } 2755 let paramEnd = args.length; 2756 const numberOfParams = paramEnd - paramStart; 2757 switch (numberOfParams) { 2758 case 0: 2759 messageParams = void 0; 2760 break; 2761 case 1: 2762 messageParams = computeSingleParam(parameterStructures, args[paramStart]); 2763 break; 2764 default: 2765 if (parameterStructures === messages_1.ParameterStructures.byName) { 2766 throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); 2767 } 2768 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); 2769 break; 2770 } 2771 } else { 2772 const params = args; 2773 method = type.method; 2774 messageParams = computeMessageParams(type, params); 2775 } 2776 const notificationMessage = { 2777 jsonrpc: version, 2778 method, 2779 params: messageParams 2780 }; 2781 traceSendingNotification(notificationMessage); 2782 return messageWriter.write(notificationMessage).catch((error) => { 2783 logger.error(`Sending notification failed.`); 2784 throw error; 2785 }); 2786 }, 2787 onNotification: (type, handler) => { 2788 throwIfClosedOrDisposed(); 2789 let method; 2790 if (Is2.func(type)) { 2791 starNotificationHandler = type; 2792 } else if (handler) { 2793 if (Is2.string(type)) { 2794 method = type; 2795 notificationHandlers.set(type, { type: void 0, handler }); 2796 } else { 2797 method = type.method; 2798 notificationHandlers.set(type.method, { type, handler }); 2799 } 2800 } 2801 return { 2802 dispose: () => { 2803 if (method !== void 0) { 2804 notificationHandlers.delete(method); 2805 } else { 2806 starNotificationHandler = void 0; 2807 } 2808 } 2809 }; 2810 }, 2811 onProgress: (_type, token, handler) => { 2812 if (progressHandlers.has(token)) { 2813 throw new Error(`Progress handler for token ${token} already registered`); 2814 } 2815 progressHandlers.set(token, handler); 2816 return { 2817 dispose: () => { 2818 progressHandlers.delete(token); 2819 } 2820 }; 2821 }, 2822 sendProgress: (_type, token, value) => { 2823 return connection.sendNotification(ProgressNotification.type, { token, value }); 2824 }, 2825 onUnhandledProgress: unhandledProgressEmitter.event, 2826 sendRequest: (type, ...args) => { 2827 throwIfClosedOrDisposed(); 2828 throwIfNotListening(); 2829 let method; 2830 let messageParams; 2831 let token = void 0; 2832 if (Is2.string(type)) { 2833 method = type; 2834 const first = args[0]; 2835 const last = args[args.length - 1]; 2836 let paramStart = 0; 2837 let parameterStructures = messages_1.ParameterStructures.auto; 2838 if (messages_1.ParameterStructures.is(first)) { 2839 paramStart = 1; 2840 parameterStructures = first; 2841 } 2842 let paramEnd = args.length; 2843 if (cancellation_1.CancellationToken.is(last)) { 2844 paramEnd = paramEnd - 1; 2845 token = last; 2846 } 2847 const numberOfParams = paramEnd - paramStart; 2848 switch (numberOfParams) { 2849 case 0: 2850 messageParams = void 0; 2851 break; 2852 case 1: 2853 messageParams = computeSingleParam(parameterStructures, args[paramStart]); 2854 break; 2855 default: 2856 if (parameterStructures === messages_1.ParameterStructures.byName) { 2857 throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); 2858 } 2859 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); 2860 break; 2861 } 2862 } else { 2863 const params = args; 2864 method = type.method; 2865 messageParams = computeMessageParams(type, params); 2866 const numberOfParams = type.numberOfParams; 2867 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; 2868 } 2869 const id2 = sequenceNumber++; 2870 let disposable; 2871 if (token) { 2872 disposable = token.onCancellationRequested(() => { 2873 const p2 = cancellationStrategy.sender.sendCancellation(connection, id2); 2874 if (p2 === void 0) { 2875 logger.log(`Received no promise from cancellation strategy when cancelling id ${id2}`); 2876 return Promise.resolve(); 2877 } else { 2878 return p2.catch(() => { 2879 logger.log(`Sending cancellation messages for id ${id2} failed`); 2880 }); 2881 } 2882 }); 2883 } 2884 const requestMessage = { 2885 jsonrpc: version, 2886 id: id2, 2887 method, 2888 params: messageParams 2889 }; 2890 traceSendingRequest(requestMessage); 2891 if (typeof cancellationStrategy.sender.enableCancellation === "function") { 2892 cancellationStrategy.sender.enableCancellation(requestMessage); 2893 } 2894 return new Promise(async (resolve, reject) => { 2895 const resolveWithCleanup = (r2) => { 2896 resolve(r2); 2897 cancellationStrategy.sender.cleanup(id2); 2898 disposable?.dispose(); 2899 }; 2900 const rejectWithCleanup = (r2) => { 2901 reject(r2); 2902 cancellationStrategy.sender.cleanup(id2); 2903 disposable?.dispose(); 2904 }; 2905 const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; 2906 try { 2907 await messageWriter.write(requestMessage); 2908 responsePromises.set(id2, responsePromise); 2909 } catch (error) { 2910 logger.error(`Sending request failed.`); 2911 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : "Unknown reason")); 2912 throw error; 2913 } 2914 }); 2915 }, 2916 onRequest: (type, handler) => { 2917 throwIfClosedOrDisposed(); 2918 let method = null; 2919 if (StarRequestHandler.is(type)) { 2920 method = void 0; 2921 starRequestHandler = type; 2922 } else if (Is2.string(type)) { 2923 method = null; 2924 if (handler !== void 0) { 2925 method = type; 2926 requestHandlers.set(type, { handler, type: void 0 }); 2927 } 2928 } else { 2929 if (handler !== void 0) { 2930 method = type.method; 2931 requestHandlers.set(type.method, { type, handler }); 2932 } 2933 } 2934 return { 2935 dispose: () => { 2936 if (method === null) { 2937 return; 2938 } 2939 if (method !== void 0) { 2940 requestHandlers.delete(method); 2941 } else { 2942 starRequestHandler = void 0; 2943 } 2944 } 2945 }; 2946 }, 2947 hasPendingResponse: () => { 2948 return responsePromises.size > 0; 2949 }, 2950 trace: async (_value, _tracer, sendNotificationOrTraceOptions) => { 2951 let _sendNotification = false; 2952 let _traceFormat = TraceFormat.Text; 2953 if (sendNotificationOrTraceOptions !== void 0) { 2954 if (Is2.boolean(sendNotificationOrTraceOptions)) { 2955 _sendNotification = sendNotificationOrTraceOptions; 2956 } else { 2957 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; 2958 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; 2959 } 2960 } 2961 trace = _value; 2962 traceFormat = _traceFormat; 2963 if (trace === Trace.Off) { 2964 tracer = void 0; 2965 } else { 2966 tracer = _tracer; 2967 } 2968 if (_sendNotification && !isClosed() && !isDisposed()) { 2969 await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); 2970 } 2971 }, 2972 onError: errorEmitter.event, 2973 onClose: closeEmitter.event, 2974 onUnhandledNotification: unhandledNotificationEmitter.event, 2975 onDispose: disposeEmitter.event, 2976 end: () => { 2977 messageWriter.end(); 2978 }, 2979 dispose: () => { 2980 if (isDisposed()) { 2981 return; 2982 } 2983 state = ConnectionState.Disposed; 2984 disposeEmitter.fire(void 0); 2985 const error = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed"); 2986 for (const promise of responsePromises.values()) { 2987 promise.reject(error); 2988 } 2989 responsePromises = /* @__PURE__ */ new Map(); 2990 requestTokens = /* @__PURE__ */ new Map(); 2991 knownCanceledRequests = /* @__PURE__ */ new Set(); 2992 messageQueue = new linkedMap_1.LinkedMap(); 2993 if (Is2.func(messageWriter.dispose)) { 2994 messageWriter.dispose(); 2995 } 2996 if (Is2.func(messageReader.dispose)) { 2997 messageReader.dispose(); 2998 } 2999 }, 3000 listen: () => { 3001 throwIfClosedOrDisposed(); 3002 throwIfListening(); 3003 state = ConnectionState.Listening; 3004 messageReader.listen(callback); 3005 }, 3006 inspect: () => { 3007 (0, ral_1.default)().console.log("inspect"); 3008 } 3009 }; 3010 connection.onNotification(LogTraceNotification.type, (params) => { 3011 if (trace === Trace.Off || !tracer) { 3012 return; 3013 } 3014 const verbose2 = trace === Trace.Verbose || trace === Trace.Compact; 3015 tracer.log(params.message, verbose2 ? params.verbose : void 0); 3016 }); 3017 connection.onNotification(ProgressNotification.type, (params) => { 3018 const handler = progressHandlers.get(params.token); 3019 if (handler) { 3020 handler(params.value); 3021 } else { 3022 unhandledProgressEmitter.fire(params); 3023 } 3024 }); 3025 return connection; 3026 } 3027 exports.createMessageConnection = createMessageConnection3; 3028 } 3029}); 3030
vendor: 11,148 bytes, lines 3031-3232
3031// node_modules/vscode-jsonrpc/lib/common/api.js 3032var require_api = __commonJS({ 3033 "node_modules/vscode-jsonrpc/lib/common/api.js"(exports) { 3034 "use strict"; 3035 Object.defineProperty(exports, "__esModule", { value: true }); 3036 exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0; 3037 exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0; 3038 var messages_1 = require_messages(); 3039 Object.defineProperty(exports, "Message", { enumerable: true, get: function() { 3040 return messages_1.Message; 3041 } }); 3042 Object.defineProperty(exports, "RequestType", { enumerable: true, get: function() { 3043 return messages_1.RequestType; 3044 } }); 3045 Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function() { 3046 return messages_1.RequestType0; 3047 } }); 3048 Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function() { 3049 return messages_1.RequestType1; 3050 } }); 3051 Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function() { 3052 return messages_1.RequestType2; 3053 } }); 3054 Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function() { 3055 return messages_1.RequestType3; 3056 } }); 3057 Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function() { 3058 return messages_1.RequestType4; 3059 } }); 3060 Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function() { 3061 return messages_1.RequestType5; 3062 } }); 3063 Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function() { 3064 return messages_1.RequestType6; 3065 } }); 3066 Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function() { 3067 return messages_1.RequestType7; 3068 } }); 3069 Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function() { 3070 return messages_1.RequestType8; 3071 } }); 3072 Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function() { 3073 return messages_1.RequestType9; 3074 } }); 3075 Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function() { 3076 return messages_1.ResponseError; 3077 } }); 3078 Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function() { 3079 return messages_1.ErrorCodes; 3080 } }); 3081 Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function() { 3082 return messages_1.NotificationType; 3083 } }); 3084 Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function() { 3085 return messages_1.NotificationType0; 3086 } }); 3087 Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function() { 3088 return messages_1.NotificationType1; 3089 } }); 3090 Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function() { 3091 return messages_1.NotificationType2; 3092 } }); 3093 Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function() { 3094 return messages_1.NotificationType3; 3095 } }); 3096 Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function() { 3097 return messages_1.NotificationType4; 3098 } }); 3099 Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function() { 3100 return messages_1.NotificationType5; 3101 } }); 3102 Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function() { 3103 return messages_1.NotificationType6; 3104 } }); 3105 Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function() { 3106 return messages_1.NotificationType7; 3107 } }); 3108 Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function() { 3109 return messages_1.NotificationType8; 3110 } }); 3111 Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function() { 3112 return messages_1.NotificationType9; 3113 } }); 3114 Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function() { 3115 return messages_1.ParameterStructures; 3116 } }); 3117 var linkedMap_1 = require_linkedMap(); 3118 Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function() { 3119 return linkedMap_1.LinkedMap; 3120 } }); 3121 Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function() { 3122 return linkedMap_1.LRUCache; 3123 } }); 3124 Object.defineProperty(exports, "Touch", { enumerable: true, get: function() { 3125 return linkedMap_1.Touch; 3126 } }); 3127 var disposable_1 = require_disposable(); 3128 Object.defineProperty(exports, "Disposable", { enumerable: true, get: function() { 3129 return disposable_1.Disposable; 3130 } }); 3131 var events_1 = require_events2(); 3132 Object.defineProperty(exports, "Event", { enumerable: true, get: function() { 3133 return events_1.Event; 3134 } }); 3135 Object.defineProperty(exports, "Emitter", { enumerable: true, get: function() { 3136 return events_1.Emitter; 3137 } }); 3138 var cancellation_1 = require_cancellation(); 3139 Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function() { 3140 return cancellation_1.CancellationTokenSource; 3141 } }); 3142 Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function() { 3143 return cancellation_1.CancellationToken; 3144 } }); 3145 var sharedArrayCancellation_1 = require_sharedArrayCancellation(); 3146 Object.defineProperty(exports, "SharedArraySenderStrategy", { enumerable: true, get: function() { 3147 return sharedArrayCancellation_1.SharedArraySenderStrategy; 3148 } }); 3149 Object.defineProperty(exports, "SharedArrayReceiverStrategy", { enumerable: true, get: function() { 3150 return sharedArrayCancellation_1.SharedArrayReceiverStrategy; 3151 } }); 3152 var messageReader_1 = require_messageReader(); 3153 Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function() { 3154 return messageReader_1.MessageReader; 3155 } }); 3156 Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function() { 3157 return messageReader_1.AbstractMessageReader; 3158 } }); 3159 Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function() { 3160 return messageReader_1.ReadableStreamMessageReader; 3161 } }); 3162 var messageWriter_1 = require_messageWriter(); 3163 Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function() { 3164 return messageWriter_1.MessageWriter; 3165 } }); 3166 Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function() { 3167 return messageWriter_1.AbstractMessageWriter; 3168 } }); 3169 Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function() { 3170 return messageWriter_1.WriteableStreamMessageWriter; 3171 } }); 3172 var messageBuffer_1 = require_messageBuffer(); 3173 Object.defineProperty(exports, "AbstractMessageBuffer", { enumerable: true, get: function() { 3174 return messageBuffer_1.AbstractMessageBuffer; 3175 } }); 3176 var connection_1 = require_connection(); 3177 Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function() { 3178 return connection_1.ConnectionStrategy; 3179 } }); 3180 Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function() { 3181 return connection_1.ConnectionOptions; 3182 } }); 3183 Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function() { 3184 return connection_1.NullLogger; 3185 } }); 3186 Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function() { 3187 return connection_1.createMessageConnection; 3188 } }); 3189 Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function() { 3190 return connection_1.ProgressToken; 3191 } }); 3192 Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function() { 3193 return connection_1.ProgressType; 3194 } }); 3195 Object.defineProperty(exports, "Trace", { enumerable: true, get: function() { 3196 return connection_1.Trace; 3197 } }); 3198 Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function() { 3199 return connection_1.TraceValues; 3200 } }); 3201 Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function() { 3202 return connection_1.TraceFormat; 3203 } }); 3204 Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function() { 3205 return connection_1.SetTraceNotification; 3206 } }); 3207 Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function() { 3208 return connection_1.LogTraceNotification; 3209 } }); 3210 Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function() { 3211 return connection_1.ConnectionErrors; 3212 } }); 3213 Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function() { 3214 return connection_1.ConnectionError; 3215 } }); 3216 Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function() { 3217 return connection_1.CancellationReceiverStrategy; 3218 } }); 3219 Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function() { 3220 return connection_1.CancellationSenderStrategy; 3221 } }); 3222 Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function() { 3223 return connection_1.CancellationStrategy; 3224 } }); 3225 Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function() { 3226 return connection_1.MessageStrategy; 3227 } }); 3228 var ral_1 = require_ral(); 3229 exports.RAL = ral_1.default; 3230 } 3231}); 3232
vendor: 5,494 bytes, lines 3233-3387
3233// node_modules/vscode-jsonrpc/lib/browser/ril.js 3234var require_ril = __commonJS({ 3235 "node_modules/vscode-jsonrpc/lib/browser/ril.js"(exports) { 3236 "use strict"; 3237 Object.defineProperty(exports, "__esModule", { value: true }); 3238 var api_1 = require_api(); 3239 var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer { 3240 constructor(encoding = "utf-8") { 3241 super(encoding); 3242 this.asciiDecoder = new TextDecoder("ascii"); 3243 } 3244 emptyBuffer() { 3245 return _MessageBuffer.emptyBuffer; 3246 } 3247 fromString(value, _encoding) { 3248 return new TextEncoder().encode(value); 3249 } 3250 toString(value, encoding) { 3251 if (encoding === "ascii") { 3252 return this.asciiDecoder.decode(value); 3253 } else { 3254 return new TextDecoder(encoding).decode(value); 3255 } 3256 } 3257 asNative(buffer, length) { 3258 if (length === void 0) { 3259 return buffer; 3260 } else { 3261 return buffer.slice(0, length); 3262 } 3263 } 3264 allocNative(length) { 3265 return new Uint8Array(length); 3266 } 3267 }; 3268 MessageBuffer.emptyBuffer = new Uint8Array(0); 3269 var ReadableStreamWrapper = class { 3270 constructor(socket) { 3271 this.socket = socket; 3272 this._onData = new api_1.Emitter(); 3273 this._messageListener = (event) => { 3274 const blob = event.data; 3275 blob.arrayBuffer().then((buffer) => { 3276 this._onData.fire(new Uint8Array(buffer)); 3277 }, () => { 3278 (0, api_1.RAL)().console.error(`Converting blob to array buffer failed.`); 3279 }); 3280 }; 3281 this.socket.addEventListener("message", this._messageListener); 3282 } 3283 onClose(listener) { 3284 this.socket.addEventListener("close", listener); 3285 return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); 3286 } 3287 onError(listener) { 3288 this.socket.addEventListener("error", listener); 3289 return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); 3290 } 3291 onEnd(listener) { 3292 this.socket.addEventListener("end", listener); 3293 return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); 3294 } 3295 onData(listener) { 3296 return this._onData.event(listener); 3297 } 3298 }; 3299 var WritableStreamWrapper = class { 3300 constructor(socket) { 3301 this.socket = socket; 3302 } 3303 onClose(listener) { 3304 this.socket.addEventListener("close", listener); 3305 return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); 3306 } 3307 onError(listener) { 3308 this.socket.addEventListener("error", listener); 3309 return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); 3310 } 3311 onEnd(listener) { 3312 this.socket.addEventListener("end", listener); 3313 return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); 3314 } 3315 write(data, encoding) { 3316 if (typeof data === "string") { 3317 if (encoding !== void 0 && encoding !== "utf-8") { 3318 throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`); 3319 } 3320 this.socket.send(data); 3321 } else { 3322 this.socket.send(data); 3323 } 3324 return Promise.resolve(); 3325 } 3326 end() { 3327 this.socket.close(); 3328 } 3329 }; 3330 var _textEncoder = new TextEncoder(); 3331 var _ril = Object.freeze({ 3332 messageBuffer: Object.freeze({ 3333 create: (encoding) => new MessageBuffer(encoding) 3334 }), 3335 applicationJson: Object.freeze({ 3336 encoder: Object.freeze({ 3337 name: "application/json", 3338 encode: (msg, options2) => { 3339 if (options2.charset !== "utf-8") { 3340 throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options2.charset}`); 3341 } 3342 return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, void 0, 0))); 3343 } 3344 }), 3345 decoder: Object.freeze({ 3346 name: "application/json", 3347 decode: (buffer, options2) => { 3348 if (!(buffer instanceof Uint8Array)) { 3349 throw new Error(`In a Browser environments only Uint8Arrays are supported.`); 3350 } 3351 return Promise.resolve(JSON.parse(new TextDecoder(options2.charset).decode(buffer))); 3352 } 3353 }) 3354 }), 3355 stream: Object.freeze({ 3356 asReadableStream: (socket) => new ReadableStreamWrapper(socket), 3357 asWritableStream: (socket) => new WritableStreamWrapper(socket) 3358 }), 3359 console, 3360 timer: Object.freeze({ 3361 setTimeout(callback, ms, ...args) { 3362 const handle = setTimeout(callback, ms, ...args); 3363 return { dispose: () => clearTimeout(handle) }; 3364 }, 3365 setImmediate(callback, ...args) { 3366 const handle = setTimeout(callback, 0, ...args); 3367 return { dispose: () => clearTimeout(handle) }; 3368 }, 3369 setInterval(callback, ms, ...args) { 3370 const handle = setInterval(callback, ms, ...args); 3371 return { dispose: () => clearInterval(handle) }; 3372 } 3373 }) 3374 }); 3375 function RIL() { 3376 return _ril; 3377 } 3378 (function(RIL2) { 3379 function install() { 3380 api_1.RAL.install(_ril); 3381 } 3382 RIL2.install = install; 3383 })(RIL || (RIL = {})); 3384 exports.default = RIL; 3385 } 3386}); 3387
vendor: 2,909 bytes, lines 3388-3469
3388// node_modules/vscode-jsonrpc/lib/browser/main.js 3389var require_main = __commonJS({ 3390 "node_modules/vscode-jsonrpc/lib/browser/main.js"(exports) { 3391 "use strict"; 3392 var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k, k2) { 3393 if (k2 === void 0) 3394 k2 = k; 3395 var desc = Object.getOwnPropertyDescriptor(m2, k); 3396 if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { 3397 desc = { enumerable: true, get: function() { 3398 return m2[k]; 3399 } }; 3400 } 3401 Object.defineProperty(o2, k2, desc); 3402 } : function(o2, m2, k, k2) { 3403 if (k2 === void 0) 3404 k2 = k; 3405 o2[k2] = m2[k]; 3406 }); 3407 var __exportStar = exports && exports.__exportStar || function(m2, exports2) { 3408 for (var p2 in m2) 3409 if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2)) 3410 __createBinding(exports2, m2, p2); 3411 }; 3412 Object.defineProperty(exports, "__esModule", { value: true }); 3413 exports.createMessageConnection = exports.BrowserMessageWriter = exports.BrowserMessageReader = void 0; 3414 var ril_1 = require_ril(); 3415 ril_1.default.install(); 3416 var api_1 = require_api(); 3417 __exportStar(require_api(), exports); 3418 var BrowserMessageReader2 = class extends api_1.AbstractMessageReader { 3419 constructor(port) { 3420 super(); 3421 this._onData = new api_1.Emitter(); 3422 this._messageListener = (event) => { 3423 this._onData.fire(event.data); 3424 }; 3425 port.addEventListener("error", (event) => this.fireError(event)); 3426 port.onmessage = this._messageListener; 3427 } 3428 listen(callback) { 3429 return this._onData.event(callback); 3430 } 3431 }; 3432 exports.BrowserMessageReader = BrowserMessageReader2; 3433 var BrowserMessageWriter2 = class extends api_1.AbstractMessageWriter { 3434 constructor(port) { 3435 super(); 3436 this.port = port; 3437 this.errorCount = 0; 3438 port.addEventListener("error", (event) => this.fireError(event)); 3439 } 3440 write(msg) { 3441 try { 3442 this.port.postMessage(msg); 3443 return Promise.resolve(); 3444 } catch (error) { 3445 this.handleError(error, msg); 3446 return Promise.reject(error); 3447 } 3448 } 3449 handleError(error, msg) { 3450 this.errorCount++; 3451 this.fireError(error, msg, this.errorCount); 3452 } 3453 end() { 3454 } 3455 }; 3456 exports.BrowserMessageWriter = BrowserMessageWriter2; 3457 function createMessageConnection3(reader, writer, logger, options2) { 3458 if (logger === void 0) { 3459 logger = api_1.NullLogger; 3460 } 3461 if (api_1.ConnectionStrategy.is(options2)) { 3462 options2 = { connectionStrategy: options2 }; 3463 } 3464 return (0, api_1.createMessageConnection)(reader, writer, logger, options2); 3465 } 3466 exports.createMessageConnection = createMessageConnection3; 3467 } 3468}); 3469
vendor: 203 bytes, lines 3470-3477
3470// node_modules/vscode-jsonrpc/browser.js 3471var require_browser = __commonJS({ 3472 "node_modules/vscode-jsonrpc/browser.js"(exports, module) { 3473 "use strict"; 3474 module.exports = require_main(); 3475 } 3476}); 3477
vendor: 60,838 bytes, lines 3478-4938
3478// node_modules/vscode-languageserver-types/lib/esm/main.js 3479var main_exports = {}; 3480__export(main_exports, { 3481 AnnotatedTextEdit: () => AnnotatedTextEdit, 3482 ChangeAnnotation: () => ChangeAnnotation, 3483 ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier, 3484 CodeAction: () => CodeAction, 3485 CodeActionContext: () => CodeActionContext, 3486 CodeActionKind: () => CodeActionKind, 3487 CodeActionTriggerKind: () => CodeActionTriggerKind, 3488 CodeDescription: () => CodeDescription, 3489 CodeLens: () => CodeLens, 3490 Color: () => Color, 3491 ColorInformation: () => ColorInformation, 3492 ColorPresentation: () => ColorPresentation, 3493 Command: () => Command, 3494 CompletionItem: () => CompletionItem, 3495 CompletionItemKind: () => CompletionItemKind, 3496 CompletionItemLabelDetails: () => CompletionItemLabelDetails, 3497 CompletionItemTag: () => CompletionItemTag, 3498 CompletionList: () => CompletionList, 3499 CreateFile: () => CreateFile, 3500 DeleteFile: () => DeleteFile, 3501 Diagnostic: () => Diagnostic, 3502 DiagnosticRelatedInformation: () => DiagnosticRelatedInformation, 3503 DiagnosticSeverity: () => DiagnosticSeverity, 3504 DiagnosticTag: () => DiagnosticTag, 3505 DocumentHighlight: () => DocumentHighlight, 3506 DocumentHighlightKind: () => DocumentHighlightKind, 3507 DocumentLink: () => DocumentLink, 3508 DocumentSymbol: () => DocumentSymbol, 3509 DocumentUri: () => DocumentUri, 3510 EOL: () => EOL, 3511 FoldingRange: () => FoldingRange, 3512 FoldingRangeKind: () => FoldingRangeKind, 3513 FormattingOptions: () => FormattingOptions, 3514 Hover: () => Hover, 3515 InlayHint: () => InlayHint, 3516 InlayHintKind: () => InlayHintKind, 3517 InlayHintLabelPart: () => InlayHintLabelPart, 3518 InlineCompletionContext: () => InlineCompletionContext, 3519 InlineCompletionItem: () => InlineCompletionItem, 3520 InlineCompletionList: () => InlineCompletionList, 3521 InlineCompletionTriggerKind: () => InlineCompletionTriggerKind, 3522 InlineValueContext: () => InlineValueContext, 3523 InlineValueEvaluatableExpression: () => InlineValueEvaluatableExpression, 3524 InlineValueText: () => InlineValueText, 3525 InlineValueVariableLookup: () => InlineValueVariableLookup, 3526 InsertReplaceEdit: () => InsertReplaceEdit, 3527 InsertTextFormat: () => InsertTextFormat, 3528 InsertTextMode: () => InsertTextMode, 3529 Location: () => Location, 3530 LocationLink: () => LocationLink, 3531 MarkedString: () => MarkedString, 3532 MarkupContent: () => MarkupContent, 3533 MarkupKind: () => MarkupKind, 3534 OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier, 3535 ParameterInformation: () => ParameterInformation, 3536 Position: () => Position, 3537 Range: () => Range2, 3538 RenameFile: () => RenameFile, 3539 SelectedCompletionInfo: () => SelectedCompletionInfo, 3540 SelectionRange: () => SelectionRange2, 3541 SemanticTokenModifiers: () => SemanticTokenModifiers, 3542 SemanticTokenTypes: () => SemanticTokenTypes, 3543 SemanticTokens: () => SemanticTokens, 3544 SignatureInformation: () => SignatureInformation, 3545 StringValue: () => StringValue, 3546 SymbolInformation: () => SymbolInformation, 3547 SymbolKind: () => SymbolKind, 3548 SymbolTag: () => SymbolTag, 3549 TextDocument: () => TextDocument, 3550 TextDocumentEdit: () => TextDocumentEdit, 3551 TextDocumentIdentifier: () => TextDocumentIdentifier, 3552 TextDocumentItem: () => TextDocumentItem, 3553 TextEdit: () => TextEdit, 3554 URI: () => URI, 3555 VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier, 3556 WorkspaceChange: () => WorkspaceChange, 3557 WorkspaceEdit: () => WorkspaceEdit, 3558 WorkspaceFolder: () => WorkspaceFolder, 3559 WorkspaceSymbol: () => WorkspaceSymbol, 3560 integer: () => integer, 3561 uinteger: () => uinteger 3562}); 3563var DocumentUri, URI, integer, uinteger, Position, Range2, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange2, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is; 3564var init_main = __esm({ 3565 "node_modules/vscode-languageserver-types/lib/esm/main.js"() { 3566 "use strict"; 3567 (function(DocumentUri2) { 3568 function is(value) { 3569 return typeof value === "string"; 3570 } 3571 DocumentUri2.is = is; 3572 })(DocumentUri || (DocumentUri = {})); 3573 (function(URI2) { 3574 function is(value) { 3575 return typeof value === "string"; 3576 } 3577 URI2.is = is; 3578 })(URI || (URI = {})); 3579 (function(integer2) { 3580 integer2.MIN_VALUE = -2147483648; 3581 integer2.MAX_VALUE = 2147483647; 3582 function is(value) { 3583 return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; 3584 } 3585 integer2.is = is; 3586 })(integer || (integer = {})); 3587 (function(uinteger2) { 3588 uinteger2.MIN_VALUE = 0; 3589 uinteger2.MAX_VALUE = 2147483647; 3590 function is(value) { 3591 return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; 3592 } 3593 uinteger2.is = is; 3594 })(uinteger || (uinteger = {})); 3595 (function(Position2) { 3596 function create(line, character) { 3597 if (line === Number.MAX_VALUE) { 3598 line = uinteger.MAX_VALUE; 3599 } 3600 if (character === Number.MAX_VALUE) { 3601 character = uinteger.MAX_VALUE; 3602 } 3603 return { line, character }; 3604 } 3605 Position2.create = create; 3606 function is(value) { 3607 let candidate = value; 3608 return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); 3609 } 3610 Position2.is = is; 3611 })(Position || (Position = {})); 3612 (function(Range4) { 3613 function create(one, two, three2, four) { 3614 if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three2) && Is.uinteger(four)) { 3615 return { start: Position.create(one, two), end: Position.create(three2, four) }; 3616 } else if (Position.is(one) && Position.is(two)) { 3617 return { start: one, end: two }; 3618 } else { 3619 throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three2}, ${four}]`); 3620 } 3621 } 3622 Range4.create = create; 3623 function is(value) { 3624 let candidate = value; 3625 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); 3626 } 3627 Range4.is = is; 3628 })(Range2 || (Range2 = {})); 3629 (function(Location2) { 3630 function create(uri, range) { 3631 return { uri, range }; 3632 } 3633 Location2.create = create; 3634 function is(value) { 3635 let candidate = value; 3636 return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); 3637 } 3638 Location2.is = is; 3639 })(Location || (Location = {})); 3640 (function(LocationLink2) { 3641 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { 3642 return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; 3643 } 3644 LocationLink2.create = create; 3645 function is(value) { 3646 let candidate = value; 3647 return Is.objectLiteral(candidate) && Range2.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range2.is(candidate.targetSelectionRange) && (Range2.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); 3648 } 3649 LocationLink2.is = is; 3650 })(LocationLink || (LocationLink = {})); 3651 (function(Color2) { 3652 function create(red, green, blue, alpha) { 3653 return { 3654 red, 3655 green, 3656 blue, 3657 alpha 3658 }; 3659 } 3660 Color2.create = create; 3661 function is(value) { 3662 const candidate = value; 3663 return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); 3664 } 3665 Color2.is = is; 3666 })(Color || (Color = {})); 3667 (function(ColorInformation2) { 3668 function create(range, color) { 3669 return { 3670 range, 3671 color 3672 }; 3673 } 3674 ColorInformation2.create = create; 3675 function is(value) { 3676 const candidate = value; 3677 return Is.objectLiteral(candidate) && Range2.is(candidate.range) && Color.is(candidate.color); 3678 } 3679 ColorInformation2.is = is; 3680 })(ColorInformation || (ColorInformation = {})); 3681 (function(ColorPresentation2) { 3682 function create(label, textEdit, additionalTextEdits) { 3683 return { 3684 label, 3685 textEdit, 3686 additionalTextEdits 3687 }; 3688 } 3689 ColorPresentation2.create = create; 3690 function is(value) { 3691 const candidate = value; 3692 return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); 3693 } 3694 ColorPresentation2.is = is; 3695 })(ColorPresentation || (ColorPresentation = {})); 3696 (function(FoldingRangeKind2) { 3697 FoldingRangeKind2.Comment = "comment"; 3698 FoldingRangeKind2.Imports = "imports"; 3699 FoldingRangeKind2.Region = "region"; 3700 })(FoldingRangeKind || (FoldingRangeKind = {})); 3701 (function(FoldingRange2) { 3702 function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { 3703 const result = { 3704 startLine, 3705 endLine 3706 }; 3707 if (Is.defined(startCharacter)) { 3708 result.startCharacter = startCharacter; 3709 } 3710 if (Is.defined(endCharacter)) { 3711 result.endCharacter = endCharacter; 3712 } 3713 if (Is.defined(kind)) { 3714 result.kind = kind; 3715 } 3716 if (Is.defined(collapsedText)) { 3717 result.collapsedText = collapsedText; 3718 } 3719 return result; 3720 } 3721 FoldingRange2.create = create; 3722 function is(value) { 3723 const candidate = value; 3724 return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); 3725 } 3726 FoldingRange2.is = is; 3727 })(FoldingRange || (FoldingRange = {})); 3728 (function(DiagnosticRelatedInformation2) { 3729 function create(location, message) { 3730 return { 3731 location, 3732 message 3733 }; 3734 } 3735 DiagnosticRelatedInformation2.create = create; 3736 function is(value) { 3737 let candidate = value; 3738 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); 3739 } 3740 DiagnosticRelatedInformation2.is = is; 3741 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); 3742 (function(DiagnosticSeverity4) { 3743 DiagnosticSeverity4.Error = 1; 3744 DiagnosticSeverity4.Warning = 2; 3745 DiagnosticSeverity4.Information = 3; 3746 DiagnosticSeverity4.Hint = 4; 3747 })(DiagnosticSeverity || (DiagnosticSeverity = {})); 3748 (function(DiagnosticTag3) { 3749 DiagnosticTag3.Unnecessary = 1; 3750 DiagnosticTag3.Deprecated = 2; 3751 })(DiagnosticTag || (DiagnosticTag = {})); 3752 (function(CodeDescription2) { 3753 function is(value) { 3754 const candidate = value; 3755 return Is.objectLiteral(candidate) && Is.string(candidate.href); 3756 } 3757 CodeDescription2.is = is; 3758 })(CodeDescription || (CodeDescription = {})); 3759 (function(Diagnostic2) { 3760 function create(range, message, severity, code, source, relatedInformation) { 3761 let result = { range, message }; 3762 if (Is.defined(severity)) { 3763 result.severity = severity; 3764 } 3765 if (Is.defined(code)) { 3766 result.code = code; 3767 } 3768 if (Is.defined(source)) { 3769 result.source = source; 3770 } 3771 if (Is.defined(relatedInformation)) { 3772 result.relatedInformation = relatedInformation; 3773 } 3774 return result; 3775 } 3776 Diagnostic2.create = create; 3777 function is(value) { 3778 var _a3; 3779 let candidate = value; 3780 return Is.defined(candidate) && Range2.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a3 = candidate.codeDescription) === null || _a3 === void 0 ? void 0 : _a3.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); 3781 } 3782 Diagnostic2.is = is; 3783 })(Diagnostic || (Diagnostic = {})); 3784 (function(Command2) { 3785 function create(title, command2, ...args) { 3786 let result = { title, command: command2 }; 3787 if (Is.defined(args) && args.length > 0) { 3788 result.arguments = args; 3789 } 3790 return result; 3791 } 3792 Command2.create = create; 3793 function is(value) { 3794 let candidate = value; 3795 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); 3796 } 3797 Command2.is = is; 3798 })(Command || (Command = {})); 3799 (function(TextEdit2) { 3800 function replace(range, newText) { 3801 return { range, newText }; 3802 } 3803 TextEdit2.replace = replace; 3804 function insert2(position, newText) { 3805 return { range: { start: position, end: position }, newText }; 3806 } 3807 TextEdit2.insert = insert2; 3808 function del(range) { 3809 return { range, newText: "" }; 3810 } 3811 TextEdit2.del = del; 3812 function is(value) { 3813 const candidate = value; 3814 return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range2.is(candidate.range); 3815 } 3816 TextEdit2.is = is; 3817 })(TextEdit || (TextEdit = {})); 3818 (function(ChangeAnnotation2) { 3819 function create(label, needsConfirmation, description) { 3820 const result = { label }; 3821 if (needsConfirmation !== void 0) { 3822 result.needsConfirmation = needsConfirmation; 3823 } 3824 if (description !== void 0) { 3825 result.description = description; 3826 } 3827 return result; 3828 } 3829 ChangeAnnotation2.create = create; 3830 function is(value) { 3831 const candidate = value; 3832 return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); 3833 } 3834 ChangeAnnotation2.is = is; 3835 })(ChangeAnnotation || (ChangeAnnotation = {})); 3836 (function(ChangeAnnotationIdentifier2) { 3837 function is(value) { 3838 const candidate = value; 3839 return Is.string(candidate); 3840 } 3841 ChangeAnnotationIdentifier2.is = is; 3842 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); 3843 (function(AnnotatedTextEdit2) { 3844 function replace(range, newText, annotation) { 3845 return { range, newText, annotationId: annotation }; 3846 } 3847 AnnotatedTextEdit2.replace = replace; 3848 function insert2(position, newText, annotation) { 3849 return { range: { start: position, end: position }, newText, annotationId: annotation }; 3850 } 3851 AnnotatedTextEdit2.insert = insert2; 3852 function del(range, annotation) { 3853 return { range, newText: "", annotationId: annotation }; 3854 } 3855 AnnotatedTextEdit2.del = del; 3856 function is(value) { 3857 const candidate = value; 3858 return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); 3859 } 3860 AnnotatedTextEdit2.is = is; 3861 })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); 3862 (function(TextDocumentEdit2) { 3863 function create(textDocument, edits) { 3864 return { textDocument, edits }; 3865 } 3866 TextDocumentEdit2.create = create; 3867 function is(value) { 3868 let candidate = value; 3869 return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); 3870 } 3871 TextDocumentEdit2.is = is; 3872 })(TextDocumentEdit || (TextDocumentEdit = {})); 3873 (function(CreateFile2) { 3874 function create(uri, options2, annotation) { 3875 let result = { 3876 kind: "create", 3877 uri 3878 }; 3879 if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { 3880 result.options = options2; 3881 } 3882 if (annotation !== void 0) { 3883 result.annotationId = annotation; 3884 } 3885 return result; 3886 } 3887 CreateFile2.create = create; 3888 function is(value) { 3889 let candidate = value; 3890 return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); 3891 } 3892 CreateFile2.is = is; 3893 })(CreateFile || (CreateFile = {})); 3894 (function(RenameFile2) { 3895 function create(oldUri, newUri, options2, annotation) { 3896 let result = { 3897 kind: "rename", 3898 oldUri, 3899 newUri 3900 }; 3901 if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { 3902 result.options = options2; 3903 } 3904 if (annotation !== void 0) { 3905 result.annotationId = annotation; 3906 } 3907 return result; 3908 } 3909 RenameFile2.create = create; 3910 function is(value) { 3911 let candidate = value; 3912 return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); 3913 } 3914 RenameFile2.is = is; 3915 })(RenameFile || (RenameFile = {})); 3916 (function(DeleteFile2) { 3917 function create(uri, options2, annotation) { 3918 let result = { 3919 kind: "delete", 3920 uri 3921 }; 3922 if (options2 !== void 0 && (options2.recursive !== void 0 || options2.ignoreIfNotExists !== void 0)) { 3923 result.options = options2; 3924 } 3925 if (annotation !== void 0) { 3926 result.annotationId = annotation; 3927 } 3928 return result; 3929 } 3930 DeleteFile2.create = create; 3931 function is(value) { 3932 let candidate = value; 3933 return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); 3934 } 3935 DeleteFile2.is = is; 3936 })(DeleteFile || (DeleteFile = {})); 3937 (function(WorkspaceEdit2) { 3938 function is(value) { 3939 let candidate = value; 3940 return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => { 3941 if (Is.string(change.kind)) { 3942 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); 3943 } else { 3944 return TextDocumentEdit.is(change); 3945 } 3946 })); 3947 } 3948 WorkspaceEdit2.is = is; 3949 })(WorkspaceEdit || (WorkspaceEdit = {})); 3950 TextEditChangeImpl = class { 3951 constructor(edits, changeAnnotations) { 3952 this.edits = edits; 3953 this.changeAnnotations = changeAnnotations; 3954 } 3955 insert(position, newText, annotation) { 3956 let edit2; 3957 let id2; 3958 if (annotation === void 0) { 3959 edit2 = TextEdit.insert(position, newText); 3960 } else if (ChangeAnnotationIdentifier.is(annotation)) { 3961 id2 = annotation; 3962 edit2 = AnnotatedTextEdit.insert(position, newText, annotation); 3963 } else { 3964 this.assertChangeAnnotations(this.changeAnnotations); 3965 id2 = this.changeAnnotations.manage(annotation); 3966 edit2 = AnnotatedTextEdit.insert(position, newText, id2); 3967 } 3968 this.edits.push(edit2); 3969 if (id2 !== void 0) { 3970 return id2; 3971 } 3972 } 3973 replace(range, newText, annotation) { 3974 let edit2; 3975 let id2; 3976 if (annotation === void 0) { 3977 edit2 = TextEdit.replace(range, newText); 3978 } else if (ChangeAnnotationIdentifier.is(annotation)) { 3979 id2 = annotation; 3980 edit2 = AnnotatedTextEdit.replace(range, newText, annotation); 3981 } else { 3982 this.assertChangeAnnotations(this.changeAnnotations); 3983 id2 = this.changeAnnotations.manage(annotation); 3984 edit2 = AnnotatedTextEdit.replace(range, newText, id2); 3985 } 3986 this.edits.push(edit2); 3987 if (id2 !== void 0) { 3988 return id2; 3989 } 3990 } 3991 delete(range, annotation) { 3992 let edit2; 3993 let id2; 3994 if (annotation === void 0) { 3995 edit2 = TextEdit.del(range); 3996 } else if (ChangeAnnotationIdentifier.is(annotation)) { 3997 id2 = annotation; 3998 edit2 = AnnotatedTextEdit.del(range, annotation); 3999 } else { 4000 this.assertChangeAnnotations(this.changeAnnotations); 4001 id2 = this.changeAnnotations.manage(annotation); 4002 edit2 = AnnotatedTextEdit.del(range, id2); 4003 } 4004 this.edits.push(edit2); 4005 if (id2 !== void 0) { 4006 return id2; 4007 } 4008 } 4009 add(edit2) { 4010 this.edits.push(edit2); 4011 } 4012 all() { 4013 return this.edits; 4014 } 4015 clear() { 4016 this.edits.splice(0, this.edits.length); 4017 } 4018 assertChangeAnnotations(value) { 4019 if (value === void 0) { 4020 throw new Error(`Text edit change is not configured to manage change annotations.`); 4021 } 4022 } 4023 }; 4024 ChangeAnnotations = class { 4025 constructor(annotations) { 4026 this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; 4027 this._counter = 0; 4028 this._size = 0; 4029 } 4030 all() { 4031 return this._annotations; 4032 } 4033 get size() { 4034 return this._size; 4035 } 4036 manage(idOrAnnotation, annotation) { 4037 let id2; 4038 if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { 4039 id2 = idOrAnnotation; 4040 } else { 4041 id2 = this.nextId(); 4042 annotation = idOrAnnotation; 4043 } 4044 if (this._annotations[id2] !== void 0) { 4045 throw new Error(`Id ${id2} is already in use.`); 4046 } 4047 if (annotation === void 0) { 4048 throw new Error(`No annotation provided for id ${id2}`); 4049 } 4050 this._annotations[id2] = annotation; 4051 this._size++; 4052 return id2; 4053 } 4054 nextId() { 4055 this._counter++; 4056 return this._counter.toString(); 4057 } 4058 }; 4059 WorkspaceChange = class { 4060 constructor(workspaceEdit) { 4061 this._textEditChanges = /* @__PURE__ */ Object.create(null); 4062 if (workspaceEdit !== void 0) { 4063 this._workspaceEdit = workspaceEdit; 4064 if (workspaceEdit.documentChanges) { 4065 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); 4066 workspaceEdit.changeAnnotations = this._changeAnnotations.all(); 4067 workspaceEdit.documentChanges.forEach((change) => { 4068 if (TextDocumentEdit.is(change)) { 4069 const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations); 4070 this._textEditChanges[change.textDocument.uri] = textEditChange; 4071 } 4072 }); 4073 } else if (workspaceEdit.changes) { 4074 Object.keys(workspaceEdit.changes).forEach((key) => { 4075 const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); 4076 this._textEditChanges[key] = textEditChange; 4077 }); 4078 } 4079 } else { 4080 this._workspaceEdit = {}; 4081 } 4082 } 4083 /** 4084 * Returns the underlying {@link WorkspaceEdit} literal 4085 * use to be returned from a workspace edit operation like rename. 4086 */ 4087 get edit() { 4088 this.initDocumentChanges(); 4089 if (this._changeAnnotations !== void 0) { 4090 if (this._changeAnnotations.size === 0) { 4091 this._workspaceEdit.changeAnnotations = void 0; 4092 } else { 4093 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); 4094 } 4095 } 4096 return this._workspaceEdit; 4097 } 4098 getTextEditChange(key) { 4099 if (OptionalVersionedTextDocumentIdentifier.is(key)) { 4100 this.initDocumentChanges(); 4101 if (this._workspaceEdit.documentChanges === void 0) { 4102 throw new Error("Workspace edit is not configured for document changes."); 4103 } 4104 const textDocument = { uri: key.uri, version: key.version }; 4105 let result = this._textEditChanges[textDocument.uri]; 4106 if (!result) { 4107 const edits = []; 4108 const textDocumentEdit = { 4109 textDocument, 4110 edits 4111 }; 4112 this._workspaceEdit.documentChanges.push(textDocumentEdit); 4113 result = new TextEditChangeImpl(edits, this._changeAnnotations); 4114 this._textEditChanges[textDocument.uri] = result; 4115 } 4116 return result; 4117 } else { 4118 this.initChanges(); 4119 if (this._workspaceEdit.changes === void 0) { 4120 throw new Error("Workspace edit is not configured for normal text edit changes."); 4121 } 4122 let result = this._textEditChanges[key]; 4123 if (!result) { 4124 let edits = []; 4125 this._workspaceEdit.changes[key] = edits; 4126 result = new TextEditChangeImpl(edits); 4127 this._textEditChanges[key] = result; 4128 } 4129 return result; 4130 } 4131 } 4132 initDocumentChanges() { 4133 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { 4134 this._changeAnnotations = new ChangeAnnotations(); 4135 this._workspaceEdit.documentChanges = []; 4136 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); 4137 } 4138 } 4139 initChanges() { 4140 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { 4141 this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); 4142 } 4143 } 4144 createFile(uri, optionsOrAnnotation, options2) { 4145 this.initDocumentChanges(); 4146 if (this._workspaceEdit.documentChanges === void 0) { 4147 throw new Error("Workspace edit is not configured for document changes."); 4148 } 4149 let annotation; 4150 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { 4151 annotation = optionsOrAnnotation; 4152 } else { 4153 options2 = optionsOrAnnotation; 4154 } 4155 let operation; 4156 let id2; 4157 if (annotation === void 0) { 4158 operation = CreateFile.create(uri, options2); 4159 } else { 4160 id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); 4161 operation = CreateFile.create(uri, options2, id2); 4162 } 4163 this._workspaceEdit.documentChanges.push(operation); 4164 if (id2 !== void 0) { 4165 return id2; 4166 } 4167 } 4168 renameFile(oldUri, newUri, optionsOrAnnotation, options2) { 4169 this.initDocumentChanges(); 4170 if (this._workspaceEdit.documentChanges === void 0) { 4171 throw new Error("Workspace edit is not configured for document changes."); 4172 } 4173 let annotation; 4174 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { 4175 annotation = optionsOrAnnotation; 4176 } else { 4177 options2 = optionsOrAnnotation; 4178 } 4179 let operation; 4180 let id2; 4181 if (annotation === void 0) { 4182 operation = RenameFile.create(oldUri, newUri, options2); 4183 } else { 4184 id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); 4185 operation = RenameFile.create(oldUri, newUri, options2, id2); 4186 } 4187 this._workspaceEdit.documentChanges.push(operation); 4188 if (id2 !== void 0) { 4189 return id2; 4190 } 4191 } 4192 deleteFile(uri, optionsOrAnnotation, options2) { 4193 this.initDocumentChanges(); 4194 if (this._workspaceEdit.documentChanges === void 0) { 4195 throw new Error("Workspace edit is not configured for document changes."); 4196 } 4197 let annotation; 4198 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { 4199 annotation = optionsOrAnnotation; 4200 } else { 4201 options2 = optionsOrAnnotation; 4202 } 4203 let operation; 4204 let id2; 4205 if (annotation === void 0) { 4206 operation = DeleteFile.create(uri, options2); 4207 } else { 4208 id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); 4209 operation = DeleteFile.create(uri, options2, id2); 4210 } 4211 this._workspaceEdit.documentChanges.push(operation); 4212 if (id2 !== void 0) { 4213 return id2; 4214 } 4215 } 4216 }; 4217 (function(TextDocumentIdentifier2) { 4218 function create(uri) { 4219 return { uri }; 4220 } 4221 TextDocumentIdentifier2.create = create; 4222 function is(value) { 4223 let candidate = value; 4224 return Is.defined(candidate) && Is.string(candidate.uri); 4225 } 4226 TextDocumentIdentifier2.is = is; 4227 })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); 4228 (function(VersionedTextDocumentIdentifier2) { 4229 function create(uri, version) { 4230 return { uri, version }; 4231 } 4232 VersionedTextDocumentIdentifier2.create = create; 4233 function is(value) { 4234 let candidate = value; 4235 return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); 4236 } 4237 VersionedTextDocumentIdentifier2.is = is; 4238 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); 4239 (function(OptionalVersionedTextDocumentIdentifier2) { 4240 function create(uri, version) { 4241 return { uri, version }; 4242 } 4243 OptionalVersionedTextDocumentIdentifier2.create = create; 4244 function is(value) { 4245 let candidate = value; 4246 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); 4247 } 4248 OptionalVersionedTextDocumentIdentifier2.is = is; 4249 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); 4250 (function(TextDocumentItem2) { 4251 function create(uri, languageId, version, text) { 4252 return { uri, languageId, version, text }; 4253 } 4254 TextDocumentItem2.create = create; 4255 function is(value) { 4256 let candidate = value; 4257 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); 4258 } 4259 TextDocumentItem2.is = is; 4260 })(TextDocumentItem || (TextDocumentItem = {})); 4261 (function(MarkupKind2) { 4262 MarkupKind2.PlainText = "plaintext"; 4263 MarkupKind2.Markdown = "markdown"; 4264 function is(value) { 4265 const candidate = value; 4266 return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; 4267 } 4268 MarkupKind2.is = is; 4269 })(MarkupKind || (MarkupKind = {})); 4270 (function(MarkupContent2) { 4271 function is(value) { 4272 const candidate = value; 4273 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); 4274 } 4275 MarkupContent2.is = is; 4276 })(MarkupContent || (MarkupContent = {})); 4277 (function(CompletionItemKind3) { 4278 CompletionItemKind3.Text = 1; 4279 CompletionItemKind3.Method = 2; 4280 CompletionItemKind3.Function = 3; 4281 CompletionItemKind3.Constructor = 4; 4282 CompletionItemKind3.Field = 5; 4283 CompletionItemKind3.Variable = 6; 4284 CompletionItemKind3.Class = 7; 4285 CompletionItemKind3.Interface = 8; 4286 CompletionItemKind3.Module = 9; 4287 CompletionItemKind3.Property = 10; 4288 CompletionItemKind3.Unit = 11; 4289 CompletionItemKind3.Value = 12; 4290 CompletionItemKind3.Enum = 13; 4291 CompletionItemKind3.Keyword = 14; 4292 CompletionItemKind3.Snippet = 15; 4293 CompletionItemKind3.Color = 16; 4294 CompletionItemKind3.File = 17; 4295 CompletionItemKind3.Reference = 18; 4296 CompletionItemKind3.Folder = 19; 4297 CompletionItemKind3.EnumMember = 20; 4298 CompletionItemKind3.Constant = 21; 4299 CompletionItemKind3.Struct = 22; 4300 CompletionItemKind3.Event = 23; 4301 CompletionItemKind3.Operator = 24; 4302 CompletionItemKind3.TypeParameter = 25; 4303 })(CompletionItemKind || (CompletionItemKind = {})); 4304 (function(InsertTextFormat2) { 4305 InsertTextFormat2.PlainText = 1; 4306 InsertTextFormat2.Snippet = 2; 4307 })(InsertTextFormat || (InsertTextFormat = {})); 4308 (function(CompletionItemTag2) { 4309 CompletionItemTag2.Deprecated = 1; 4310 })(CompletionItemTag || (CompletionItemTag = {})); 4311 (function(InsertReplaceEdit2) { 4312 function create(newText, insert2, replace) { 4313 return { newText, insert: insert2, replace }; 4314 } 4315 InsertReplaceEdit2.create = create; 4316 function is(value) { 4317 const candidate = value; 4318 return candidate && Is.string(candidate.newText) && Range2.is(candidate.insert) && Range2.is(candidate.replace); 4319 } 4320 InsertReplaceEdit2.is = is; 4321 })(InsertReplaceEdit || (InsertReplaceEdit = {})); 4322 (function(InsertTextMode2) { 4323 InsertTextMode2.asIs = 1; 4324 InsertTextMode2.adjustIndentation = 2; 4325 })(InsertTextMode || (InsertTextMode = {})); 4326 (function(CompletionItemLabelDetails2) { 4327 function is(value) { 4328 const candidate = value; 4329 return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); 4330 } 4331 CompletionItemLabelDetails2.is = is; 4332 })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); 4333 (function(CompletionItem2) { 4334 function create(label) { 4335 return { label }; 4336 } 4337 CompletionItem2.create = create; 4338 })(CompletionItem || (CompletionItem = {})); 4339 (function(CompletionList2) { 4340 function create(items, isIncomplete) { 4341 return { items: items ? items : [], isIncomplete: !!isIncomplete }; 4342 } 4343 CompletionList2.create = create; 4344 })(CompletionList || (CompletionList = {})); 4345 (function(MarkedString2) { 4346 function fromPlainText(plainText) { 4347 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); 4348 } 4349 MarkedString2.fromPlainText = fromPlainText; 4350 function is(value) { 4351 const candidate = value; 4352 return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); 4353 } 4354 MarkedString2.is = is; 4355 })(MarkedString || (MarkedString = {})); 4356 (function(Hover2) { 4357 function is(value) { 4358 let candidate = value; 4359 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range2.is(value.range)); 4360 } 4361 Hover2.is = is; 4362 })(Hover || (Hover = {})); 4363 (function(ParameterInformation2) { 4364 function create(label, documentation) { 4365 return documentation ? { label, documentation } : { label }; 4366 } 4367 ParameterInformation2.create = create; 4368 })(ParameterInformation || (ParameterInformation = {})); 4369 (function(SignatureInformation2) { 4370 function create(label, documentation, ...parameters) { 4371 let result = { label }; 4372 if (Is.defined(documentation)) { 4373 result.documentation = documentation; 4374 } 4375 if (Is.defined(parameters)) { 4376 result.parameters = parameters; 4377 } else { 4378 result.parameters = []; 4379 } 4380 return result; 4381 } 4382 SignatureInformation2.create = create; 4383 })(SignatureInformation || (SignatureInformation = {})); 4384 (function(DocumentHighlightKind2) { 4385 DocumentHighlightKind2.Text = 1; 4386 DocumentHighlightKind2.Read = 2; 4387 DocumentHighlightKind2.Write = 3; 4388 })(DocumentHighlightKind || (DocumentHighlightKind = {})); 4389 (function(DocumentHighlight2) { 4390 function create(range, kind) { 4391 let result = { range }; 4392 if (Is.number(kind)) { 4393 result.kind = kind; 4394 } 4395 return result; 4396 } 4397 DocumentHighlight2.create = create; 4398 })(DocumentHighlight || (DocumentHighlight = {})); 4399 (function(SymbolKind2) { 4400 SymbolKind2.File = 1; 4401 SymbolKind2.Module = 2; 4402 SymbolKind2.Namespace = 3; 4403 SymbolKind2.Package = 4; 4404 SymbolKind2.Class = 5; 4405 SymbolKind2.Method = 6; 4406 SymbolKind2.Property = 7; 4407 SymbolKind2.Field = 8; 4408 SymbolKind2.Constructor = 9; 4409 SymbolKind2.Enum = 10; 4410 SymbolKind2.Interface = 11; 4411 SymbolKind2.Function = 12; 4412 SymbolKind2.Variable = 13; 4413 SymbolKind2.Constant = 14; 4414 SymbolKind2.String = 15; 4415 SymbolKind2.Number = 16; 4416 SymbolKind2.Boolean = 17; 4417 SymbolKind2.Array = 18; 4418 SymbolKind2.Object = 19; 4419 SymbolKind2.Key = 20; 4420 SymbolKind2.Null = 21; 4421 SymbolKind2.EnumMember = 22; 4422 SymbolKind2.Struct = 23; 4423 SymbolKind2.Event = 24; 4424 SymbolKind2.Operator = 25; 4425 SymbolKind2.TypeParameter = 26; 4426 })(SymbolKind || (SymbolKind = {})); 4427 (function(SymbolTag2) { 4428 SymbolTag2.Deprecated = 1; 4429 })(SymbolTag || (SymbolTag = {})); 4430 (function(SymbolInformation2) { 4431 function create(name2, kind, range, uri, containerName) { 4432 let result = { 4433 name: name2, 4434 kind, 4435 location: { uri, range } 4436 }; 4437 if (containerName) { 4438 result.containerName = containerName; 4439 } 4440 return result; 4441 } 4442 SymbolInformation2.create = create; 4443 })(SymbolInformation || (SymbolInformation = {})); 4444 (function(WorkspaceSymbol2) { 4445 function create(name2, kind, uri, range) { 4446 return range !== void 0 ? { name: name2, kind, location: { uri, range } } : { name: name2, kind, location: { uri } }; 4447 } 4448 WorkspaceSymbol2.create = create; 4449 })(WorkspaceSymbol || (WorkspaceSymbol = {})); 4450 (function(DocumentSymbol2) { 4451 function create(name2, detail, kind, range, selectionRange, children) { 4452 let result = { 4453 name: name2, 4454 detail, 4455 kind, 4456 range, 4457 selectionRange 4458 }; 4459 if (children !== void 0) { 4460 result.children = children; 4461 } 4462 return result; 4463 } 4464 DocumentSymbol2.create = create; 4465 function is(value) { 4466 let candidate = value; 4467 return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range2.is(candidate.range) && Range2.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); 4468 } 4469 DocumentSymbol2.is = is; 4470 })(DocumentSymbol || (DocumentSymbol = {})); 4471 (function(CodeActionKind2) { 4472 CodeActionKind2.Empty = ""; 4473 CodeActionKind2.QuickFix = "quickfix"; 4474 CodeActionKind2.Refactor = "refactor"; 4475 CodeActionKind2.RefactorExtract = "refactor.extract"; 4476 CodeActionKind2.RefactorInline = "refactor.inline"; 4477 CodeActionKind2.RefactorRewrite = "refactor.rewrite"; 4478 CodeActionKind2.Source = "source"; 4479 CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; 4480 CodeActionKind2.SourceFixAll = "source.fixAll"; 4481 })(CodeActionKind || (CodeActionKind = {})); 4482 (function(CodeActionTriggerKind2) { 4483 CodeActionTriggerKind2.Invoked = 1; 4484 CodeActionTriggerKind2.Automatic = 2; 4485 })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); 4486 (function(CodeActionContext2) { 4487 function create(diagnostics, only, triggerKind) { 4488 let result = { diagnostics }; 4489 if (only !== void 0 && only !== null) { 4490 result.only = only; 4491 } 4492 if (triggerKind !== void 0 && triggerKind !== null) { 4493 result.triggerKind = triggerKind; 4494 } 4495 return result; 4496 } 4497 CodeActionContext2.create = create; 4498 function is(value) { 4499 let candidate = value; 4500 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); 4501 } 4502 CodeActionContext2.is = is; 4503 })(CodeActionContext || (CodeActionContext = {})); 4504 (function(CodeAction2) { 4505 function create(title, kindOrCommandOrEdit, kind) { 4506 let result = { title }; 4507 let checkKind = true; 4508 if (typeof kindOrCommandOrEdit === "string") { 4509 checkKind = false; 4510 result.kind = kindOrCommandOrEdit; 4511 } else if (Command.is(kindOrCommandOrEdit)) { 4512 result.command = kindOrCommandOrEdit; 4513 } else { 4514 result.edit = kindOrCommandOrEdit; 4515 } 4516 if (checkKind && kind !== void 0) { 4517 result.kind = kind; 4518 } 4519 return result; 4520 } 4521 CodeAction2.create = create; 4522 function is(value) { 4523 let candidate = value; 4524 return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); 4525 } 4526 CodeAction2.is = is; 4527 })(CodeAction || (CodeAction = {})); 4528 (function(CodeLens2) { 4529 function create(range, data) { 4530 let result = { range }; 4531 if (Is.defined(data)) { 4532 result.data = data; 4533 } 4534 return result; 4535 } 4536 CodeLens2.create = create; 4537 function is(value) { 4538 let candidate = value; 4539 return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); 4540 } 4541 CodeLens2.is = is; 4542 })(CodeLens || (CodeLens = {})); 4543 (function(FormattingOptions2) { 4544 function create(tabSize, insertSpaces) { 4545 return { tabSize, insertSpaces }; 4546 } 4547 FormattingOptions2.create = create; 4548 function is(value) { 4549 let candidate = value; 4550 return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); 4551 } 4552 FormattingOptions2.is = is; 4553 })(FormattingOptions || (FormattingOptions = {})); 4554 (function(DocumentLink2) { 4555 function create(range, target, data) { 4556 return { range, target, data }; 4557 } 4558 DocumentLink2.create = create; 4559 function is(value) { 4560 let candidate = value; 4561 return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); 4562 } 4563 DocumentLink2.is = is; 4564 })(DocumentLink || (DocumentLink = {})); 4565 (function(SelectionRange3) { 4566 function create(range, parent) { 4567 return { range, parent }; 4568 } 4569 SelectionRange3.create = create; 4570 function is(value) { 4571 let candidate = value; 4572 return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (candidate.parent === void 0 || SelectionRange3.is(candidate.parent)); 4573 } 4574 SelectionRange3.is = is; 4575 })(SelectionRange2 || (SelectionRange2 = {})); 4576 (function(SemanticTokenTypes2) { 4577 SemanticTokenTypes2["namespace"] = "namespace"; 4578 SemanticTokenTypes2["type"] = "type"; 4579 SemanticTokenTypes2["class"] = "class"; 4580 SemanticTokenTypes2["enum"] = "enum"; 4581 SemanticTokenTypes2["interface"] = "interface"; 4582 SemanticTokenTypes2["struct"] = "struct"; 4583 SemanticTokenTypes2["typeParameter"] = "typeParameter"; 4584 SemanticTokenTypes2["parameter"] = "parameter"; 4585 SemanticTokenTypes2["variable"] = "variable"; 4586 SemanticTokenTypes2["property"] = "property"; 4587 SemanticTokenTypes2["enumMember"] = "enumMember"; 4588 SemanticTokenTypes2["event"] = "event"; 4589 SemanticTokenTypes2["function"] = "function"; 4590 SemanticTokenTypes2["method"] = "method"; 4591 SemanticTokenTypes2["macro"] = "macro"; 4592 SemanticTokenTypes2["keyword"] = "keyword"; 4593 SemanticTokenTypes2["modifier"] = "modifier"; 4594 SemanticTokenTypes2["comment"] = "comment"; 4595 SemanticTokenTypes2["string"] = "string"; 4596 SemanticTokenTypes2["number"] = "number"; 4597 SemanticTokenTypes2["regexp"] = "regexp"; 4598 SemanticTokenTypes2["operator"] = "operator"; 4599 SemanticTokenTypes2["decorator"] = "decorator"; 4600 })(SemanticTokenTypes || (SemanticTokenTypes = {})); 4601 (function(SemanticTokenModifiers2) { 4602 SemanticTokenModifiers2["declaration"] = "declaration"; 4603 SemanticTokenModifiers2["definition"] = "definition"; 4604 SemanticTokenModifiers2["readonly"] = "readonly"; 4605 SemanticTokenModifiers2["static"] = "static"; 4606 SemanticTokenModifiers2["deprecated"] = "deprecated"; 4607 SemanticTokenModifiers2["abstract"] = "abstract"; 4608 SemanticTokenModifiers2["async"] = "async"; 4609 SemanticTokenModifiers2["modification"] = "modification"; 4610 SemanticTokenModifiers2["documentation"] = "documentation"; 4611 SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; 4612 })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); 4613 (function(SemanticTokens2) { 4614 function is(value) { 4615 const candidate = value; 4616 return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); 4617 } 4618 SemanticTokens2.is = is; 4619 })(SemanticTokens || (SemanticTokens = {})); 4620 (function(InlineValueText2) { 4621 function create(range, text) { 4622 return { range, text }; 4623 } 4624 InlineValueText2.create = create; 4625 function is(value) { 4626 const candidate = value; 4627 return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.string(candidate.text); 4628 } 4629 InlineValueText2.is = is; 4630 })(InlineValueText || (InlineValueText = {})); 4631 (function(InlineValueVariableLookup2) { 4632 function create(range, variableName, caseSensitiveLookup) { 4633 return { range, variableName, caseSensitiveLookup }; 4634 } 4635 InlineValueVariableLookup2.create = create; 4636 function is(value) { 4637 const candidate = value; 4638 return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); 4639 } 4640 InlineValueVariableLookup2.is = is; 4641 })(InlineValueVariableLookup || (InlineValueVariableLookup = {})); 4642 (function(InlineValueEvaluatableExpression2) { 4643 function create(range, expression) { 4644 return { range, expression }; 4645 } 4646 InlineValueEvaluatableExpression2.create = create; 4647 function is(value) { 4648 const candidate = value; 4649 return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); 4650 } 4651 InlineValueEvaluatableExpression2.is = is; 4652 })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); 4653 (function(InlineValueContext2) { 4654 function create(frameId, stoppedLocation) { 4655 return { frameId, stoppedLocation }; 4656 } 4657 InlineValueContext2.create = create; 4658 function is(value) { 4659 const candidate = value; 4660 return Is.defined(candidate) && Range2.is(value.stoppedLocation); 4661 } 4662 InlineValueContext2.is = is; 4663 })(InlineValueContext || (InlineValueContext = {})); 4664 (function(InlayHintKind2) { 4665 InlayHintKind2.Type = 1; 4666 InlayHintKind2.Parameter = 2; 4667 function is(value) { 4668 return value === 1 || value === 2; 4669 } 4670 InlayHintKind2.is = is; 4671 })(InlayHintKind || (InlayHintKind = {})); 4672 (function(InlayHintLabelPart2) { 4673 function create(value) { 4674 return { value }; 4675 } 4676 InlayHintLabelPart2.create = create; 4677 function is(value) { 4678 const candidate = value; 4679 return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); 4680 } 4681 InlayHintLabelPart2.is = is; 4682 })(InlayHintLabelPart || (InlayHintLabelPart = {})); 4683 (function(InlayHint2) { 4684 function create(position, label, kind) { 4685 const result = { position, label }; 4686 if (kind !== void 0) { 4687 result.kind = kind; 4688 } 4689 return result; 4690 } 4691 InlayHint2.create = create; 4692 function is(value) { 4693 const candidate = value; 4694 return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); 4695 } 4696 InlayHint2.is = is; 4697 })(InlayHint || (InlayHint = {})); 4698 (function(StringValue2) { 4699 function createSnippet(value) { 4700 return { kind: "snippet", value }; 4701 } 4702 StringValue2.createSnippet = createSnippet; 4703 })(StringValue || (StringValue = {})); 4704 (function(InlineCompletionItem2) { 4705 function create(insertText, filterText, range, command2) { 4706 return { insertText, filterText, range, command: command2 }; 4707 } 4708 InlineCompletionItem2.create = create; 4709 })(InlineCompletionItem || (InlineCompletionItem = {})); 4710 (function(InlineCompletionList2) { 4711 function create(items) { 4712 return { items }; 4713 } 4714 InlineCompletionList2.create = create; 4715 })(InlineCompletionList || (InlineCompletionList = {})); 4716 (function(InlineCompletionTriggerKind2) { 4717 InlineCompletionTriggerKind2.Invoked = 0; 4718 InlineCompletionTriggerKind2.Automatic = 1; 4719 })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {})); 4720 (function(SelectedCompletionInfo2) { 4721 function create(range, text) { 4722 return { range, text }; 4723 } 4724 SelectedCompletionInfo2.create = create; 4725 })(SelectedCompletionInfo || (SelectedCompletionInfo = {})); 4726 (function(InlineCompletionContext2) { 4727 function create(triggerKind, selectedCompletionInfo) { 4728 return { triggerKind, selectedCompletionInfo }; 4729 } 4730 InlineCompletionContext2.create = create; 4731 })(InlineCompletionContext || (InlineCompletionContext = {})); 4732 (function(WorkspaceFolder2) { 4733 function is(value) { 4734 const candidate = value; 4735 return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name); 4736 } 4737 WorkspaceFolder2.is = is; 4738 })(WorkspaceFolder || (WorkspaceFolder = {})); 4739 EOL = ["\n", "\r\n", "\r"]; 4740 (function(TextDocument2) { 4741 function create(uri, languageId, version, content2) { 4742 return new FullTextDocument(uri, languageId, version, content2); 4743 } 4744 TextDocument2.create = create; 4745 function is(value) { 4746 let candidate = value; 4747 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; 4748 } 4749 TextDocument2.is = is; 4750 function applyEdits(document2, edits) { 4751 let text = document2.getText(); 4752 let sortedEdits = mergeSort(edits, (a2, b3) => { 4753 let diff = a2.range.start.line - b3.range.start.line; 4754 if (diff === 0) { 4755 return a2.range.start.character - b3.range.start.character; 4756 } 4757 return diff; 4758 }); 4759 let lastModifiedOffset = text.length; 4760 for (let i2 = sortedEdits.length - 1; i2 >= 0; i2--) { 4761 let e2 = sortedEdits[i2]; 4762 let startOffset = document2.offsetAt(e2.range.start); 4763 let endOffset = document2.offsetAt(e2.range.end); 4764 if (endOffset <= lastModifiedOffset) { 4765 text = text.substring(0, startOffset) + e2.newText + text.substring(endOffset, text.length); 4766 } else { 4767 throw new Error("Overlapping edit"); 4768 } 4769 lastModifiedOffset = startOffset; 4770 } 4771 return text; 4772 } 4773 TextDocument2.applyEdits = applyEdits; 4774 function mergeSort(data, compare2) { 4775 if (data.length <= 1) { 4776 return data; 4777 } 4778 const p2 = data.length / 2 | 0; 4779 const left = data.slice(0, p2); 4780 const right = data.slice(p2); 4781 mergeSort(left, compare2); 4782 mergeSort(right, compare2); 4783 let leftIdx = 0; 4784 let rightIdx = 0; 4785 let i2 = 0; 4786 while (leftIdx < left.length && rightIdx < right.length) { 4787 let ret = compare2(left[leftIdx], right[rightIdx]); 4788 if (ret <= 0) { 4789 data[i2++] = left[leftIdx++]; 4790 } else { 4791 data[i2++] = right[rightIdx++]; 4792 } 4793 } 4794 while (leftIdx < left.length) { 4795 data[i2++] = left[leftIdx++]; 4796 } 4797 while (rightIdx < right.length) { 4798 data[i2++] = right[rightIdx++]; 4799 } 4800 return data; 4801 } 4802 })(TextDocument || (TextDocument = {})); 4803 FullTextDocument = class { 4804 constructor(uri, languageId, version, content2) { 4805 this._uri = uri; 4806 this._languageId = languageId; 4807 this._version = version; 4808 this._content = content2; 4809 this._lineOffsets = void 0; 4810 } 4811 get uri() { 4812 return this._uri; 4813 } 4814 get languageId() { 4815 return this._languageId; 4816 } 4817 get version() { 4818 return this._version; 4819 } 4820 getText(range) { 4821 if (range) { 4822 let start = this.offsetAt(range.start); 4823 let end = this.offsetAt(range.end); 4824 return this._content.substring(start, end); 4825 } 4826 return this._content; 4827 } 4828 update(event, version) { 4829 this._content = event.text; 4830 this._version = version; 4831 this._lineOffsets = void 0; 4832 } 4833 getLineOffsets() { 4834 if (this._lineOffsets === void 0) { 4835 let lineOffsets = []; 4836 let text = this._content; 4837 let isLineStart = true; 4838 for (let i2 = 0; i2 < text.length; i2++) { 4839 if (isLineStart) { 4840 lineOffsets.push(i2); 4841 isLineStart = false; 4842 } 4843 let ch = text.charAt(i2); 4844 isLineStart = ch === "\r" || ch === "\n"; 4845 if (ch === "\r" && i2 + 1 < text.length && text.charAt(i2 + 1) === "\n") { 4846 i2++; 4847 } 4848 } 4849 if (isLineStart && text.length > 0) { 4850 lineOffsets.push(text.length); 4851 } 4852 this._lineOffsets = lineOffsets; 4853 } 4854 return this._lineOffsets; 4855 } 4856 positionAt(offset) { 4857 offset = Math.max(Math.min(offset, this._content.length), 0); 4858 let lineOffsets = this.getLineOffsets(); 4859 let low = 0, high = lineOffsets.length; 4860 if (high === 0) { 4861 return Position.create(0, offset); 4862 } 4863 while (low < high) { 4864 let mid = Math.floor((low + high) / 2); 4865 if (lineOffsets[mid] > offset) { 4866 high = mid; 4867 } else { 4868 low = mid + 1; 4869 } 4870 } 4871 let line = low - 1; 4872 return Position.create(line, offset - lineOffsets[line]); 4873 } 4874 offsetAt(position) { 4875 let lineOffsets = this.getLineOffsets(); 4876 if (position.line >= lineOffsets.length) { 4877 return this._content.length; 4878 } else if (position.line < 0) { 4879 return 0; 4880 } 4881 let lineOffset = lineOffsets[position.line]; 4882 let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; 4883 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); 4884 } 4885 get lineCount() { 4886 return this.getLineOffsets().length; 4887 } 4888 }; 4889 (function(Is2) { 4890 const toString = Object.prototype.toString; 4891 function defined(value) { 4892 return typeof value !== "undefined"; 4893 } 4894 Is2.defined = defined; 4895 function undefined2(value) { 4896 return typeof value === "undefined"; 4897 } 4898 Is2.undefined = undefined2; 4899 function boolean(value) { 4900 return value === true || value === false; 4901 } 4902 Is2.boolean = boolean; 4903 function string2(value) { 4904 return toString.call(value) === "[object String]"; 4905 } 4906 Is2.string = string2; 4907 function number2(value) { 4908 return toString.call(value) === "[object Number]"; 4909 } 4910 Is2.number = number2; 4911 function numberRange(value, min, max) { 4912 return toString.call(value) === "[object Number]" && min <= value && value <= max; 4913 } 4914 Is2.numberRange = numberRange; 4915 function integer2(value) { 4916 return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; 4917 } 4918 Is2.integer = integer2; 4919 function uinteger2(value) { 4920 return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; 4921 } 4922 Is2.uinteger = uinteger2; 4923 function func(value) { 4924 return toString.call(value) === "[object Function]"; 4925 } 4926 Is2.func = func; 4927 function objectLiteral(value) { 4928 return value !== null && typeof value === "object"; 4929 } 4930 Is2.objectLiteral = objectLiteral; 4931 function typedArray(value, check) { 4932 return Array.isArray(value) && value.every(check); 4933 } 4934 Is2.typedArray = typedArray; 4935 })(Is || (Is = {})); 4936 } 4937}); 4938
vendor: 1,910 bytes, lines 4939-4984
4939// node_modules/vscode-languageserver-protocol/lib/common/messages.js 4940var require_messages2 = __commonJS({ 4941 "node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports) { 4942 "use strict"; 4943 Object.defineProperty(exports, "__esModule", { value: true }); 4944 exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = exports.MessageDirection = void 0; 4945 var vscode_jsonrpc_1 = require_main(); 4946 var MessageDirection; 4947 (function(MessageDirection2) { 4948 MessageDirection2["clientToServer"] = "clientToServer"; 4949 MessageDirection2["serverToClient"] = "serverToClient"; 4950 MessageDirection2["both"] = "both"; 4951 })(MessageDirection || (exports.MessageDirection = MessageDirection = {})); 4952 var RegistrationType = class { 4953 constructor(method) { 4954 this.method = method; 4955 } 4956 }; 4957 exports.RegistrationType = RegistrationType; 4958 var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { 4959 constructor(method) { 4960 super(method); 4961 } 4962 }; 4963 exports.ProtocolRequestType0 = ProtocolRequestType0; 4964 var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { 4965 constructor(method) { 4966 super(method, vscode_jsonrpc_1.ParameterStructures.byName); 4967 } 4968 }; 4969 exports.ProtocolRequestType = ProtocolRequestType; 4970 var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { 4971 constructor(method) { 4972 super(method); 4973 } 4974 }; 4975 exports.ProtocolNotificationType0 = ProtocolNotificationType0; 4976 var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { 4977 constructor(method) { 4978 super(method, vscode_jsonrpc_1.ParameterStructures.byName); 4979 } 4980 }; 4981 exports.ProtocolNotificationType = ProtocolNotificationType; 4982 } 4983}); 4984
vendor: 1,559 bytes, lines 4985-5029
4985// node_modules/vscode-languageserver-protocol/lib/common/utils/is.js 4986var require_is2 = __commonJS({ 4987 "node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports) { 4988 "use strict"; 4989 Object.defineProperty(exports, "__esModule", { value: true }); 4990 exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; 4991 function boolean(value) { 4992 return value === true || value === false; 4993 } 4994 exports.boolean = boolean; 4995 function string2(value) { 4996 return typeof value === "string" || value instanceof String; 4997 } 4998 exports.string = string2; 4999 function number2(value) { 5000 return typeof value === "number" || value instanceof Number; 5001 } 5002 exports.number = number2; 5003 function error(value) { 5004 return value instanceof Error; 5005 } 5006 exports.error = error; 5007 function func(value) { 5008 return typeof value === "function"; 5009 } 5010 exports.func = func; 5011 function array(value) { 5012 return Array.isArray(value); 5013 } 5014 exports.array = array; 5015 function stringArray(value) { 5016 return array(value) && value.every((elem) => string2(elem)); 5017 } 5018 exports.stringArray = stringArray; 5019 function typedArray(value, check) { 5020 return Array.isArray(value) && value.every(check); 5021 } 5022 exports.typedArray = typedArray; 5023 function objectLiteral(value) { 5024 return value !== null && typeof value === "object"; 5025 } 5026 exports.objectLiteral = objectLiteral; 5027 } 5028}); 5029
vendor: 843 bytes, lines 5030-5045
5030// node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js 5031var require_protocol_implementation = __commonJS({ 5032 "node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports) { 5033 "use strict"; 5034 Object.defineProperty(exports, "__esModule", { value: true }); 5035 exports.ImplementationRequest = void 0; 5036 var messages_1 = require_messages2(); 5037 var ImplementationRequest; 5038 (function(ImplementationRequest2) { 5039 ImplementationRequest2.method = "textDocument/implementation"; 5040 ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5041 ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); 5042 })(ImplementationRequest || (exports.ImplementationRequest = ImplementationRequest = {})); 5043 } 5044}); 5045
vendor: 843 bytes, lines 5046-5061
5046// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js 5047var require_protocol_typeDefinition = __commonJS({ 5048 "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports) { 5049 "use strict"; 5050 Object.defineProperty(exports, "__esModule", { value: true }); 5051 exports.TypeDefinitionRequest = void 0; 5052 var messages_1 = require_messages2(); 5053 var TypeDefinitionRequest; 5054 (function(TypeDefinitionRequest2) { 5055 TypeDefinitionRequest2.method = "textDocument/typeDefinition"; 5056 TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5057 TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); 5058 })(TypeDefinitionRequest || (exports.TypeDefinitionRequest = TypeDefinitionRequest = {})); 5059 } 5060}); 5061
vendor: 1,501 bytes, lines 5062-5083
5062// node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js 5063var require_protocol_workspaceFolder = __commonJS({ 5064 "node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports) { 5065 "use strict"; 5066 Object.defineProperty(exports, "__esModule", { value: true }); 5067 exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; 5068 var messages_1 = require_messages2(); 5069 var WorkspaceFoldersRequest; 5070 (function(WorkspaceFoldersRequest2) { 5071 WorkspaceFoldersRequest2.method = "workspace/workspaceFolders"; 5072 WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5073 WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method); 5074 })(WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {})); 5075 var DidChangeWorkspaceFoldersNotification; 5076 (function(DidChangeWorkspaceFoldersNotification2) { 5077 DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders"; 5078 DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5079 DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method); 5080 })(DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {})); 5081 } 5082}); 5083
vendor: 826 bytes, lines 5084-5099
5084// node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js 5085var require_protocol_configuration = __commonJS({ 5086 "node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports) { 5087 "use strict"; 5088 Object.defineProperty(exports, "__esModule", { value: true }); 5089 exports.ConfigurationRequest = void 0; 5090 var messages_1 = require_messages2(); 5091 var ConfigurationRequest; 5092 (function(ConfigurationRequest2) { 5093 ConfigurationRequest2.method = "workspace/configuration"; 5094 ConfigurationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5095 ConfigurationRequest2.type = new messages_1.ProtocolRequestType(ConfigurationRequest2.method); 5096 })(ConfigurationRequest || (exports.ConfigurationRequest = ConfigurationRequest = {})); 5097 } 5098}); 5099
vendor: 1,324 bytes, lines 5100-5121
5100// node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js 5101var require_protocol_colorProvider = __commonJS({ 5102 "node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports) { 5103 "use strict"; 5104 Object.defineProperty(exports, "__esModule", { value: true }); 5105 exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; 5106 var messages_1 = require_messages2(); 5107 var DocumentColorRequest; 5108 (function(DocumentColorRequest2) { 5109 DocumentColorRequest2.method = "textDocument/documentColor"; 5110 DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5111 DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); 5112 })(DocumentColorRequest || (exports.DocumentColorRequest = DocumentColorRequest = {})); 5113 var ColorPresentationRequest; 5114 (function(ColorPresentationRequest2) { 5115 ColorPresentationRequest2.method = "textDocument/colorPresentation"; 5116 ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5117 ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method); 5118 })(ColorPresentationRequest || (exports.ColorPresentationRequest = ColorPresentationRequest = {})); 5119 } 5120}); 5121
vendor: 1,331 bytes, lines 5122-5143
5122// node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js 5123var require_protocol_foldingRange = __commonJS({ 5124 "node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports) { 5125 "use strict"; 5126 Object.defineProperty(exports, "__esModule", { value: true }); 5127 exports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = void 0; 5128 var messages_1 = require_messages2(); 5129 var FoldingRangeRequest; 5130 (function(FoldingRangeRequest2) { 5131 FoldingRangeRequest2.method = "textDocument/foldingRange"; 5132 FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5133 FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); 5134 })(FoldingRangeRequest || (exports.FoldingRangeRequest = FoldingRangeRequest = {})); 5135 var FoldingRangeRefreshRequest; 5136 (function(FoldingRangeRefreshRequest2) { 5137 FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`; 5138 FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5139 FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method); 5140 })(FoldingRangeRefreshRequest || (exports.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {})); 5141 } 5142}); 5143
vendor: 801 bytes, lines 5144-5159
5144// node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js 5145var require_protocol_declaration = __commonJS({ 5146 "node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports) { 5147 "use strict"; 5148 Object.defineProperty(exports, "__esModule", { value: true }); 5149 exports.DeclarationRequest = void 0; 5150 var messages_1 = require_messages2(); 5151 var DeclarationRequest; 5152 (function(DeclarationRequest2) { 5153 DeclarationRequest2.method = "textDocument/declaration"; 5154 DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5155 DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); 5156 })(DeclarationRequest || (exports.DeclarationRequest = DeclarationRequest = {})); 5157 } 5158}); 5159
vendor: 843 bytes, lines 5160-5175
5160// node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js 5161var require_protocol_selectionRange = __commonJS({ 5162 "node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports) { 5163 "use strict"; 5164 Object.defineProperty(exports, "__esModule", { value: true }); 5165 exports.SelectionRangeRequest = void 0; 5166 var messages_1 = require_messages2(); 5167 var SelectionRangeRequest; 5168 (function(SelectionRangeRequest2) { 5169 SelectionRangeRequest2.method = "textDocument/selectionRange"; 5170 SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5171 SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); 5172 })(SelectionRangeRequest || (exports.SelectionRangeRequest = SelectionRangeRequest = {})); 5173 } 5174}); 5175
vendor: 1,904 bytes, lines 5176-5206
5176// node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js 5177var require_protocol_progress = __commonJS({ 5178 "node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports) { 5179 "use strict"; 5180 Object.defineProperty(exports, "__esModule", { value: true }); 5181 exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; 5182 var vscode_jsonrpc_1 = require_main(); 5183 var messages_1 = require_messages2(); 5184 var WorkDoneProgress; 5185 (function(WorkDoneProgress2) { 5186 WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); 5187 function is(value) { 5188 return value === WorkDoneProgress2.type; 5189 } 5190 WorkDoneProgress2.is = is; 5191 })(WorkDoneProgress || (exports.WorkDoneProgress = WorkDoneProgress = {})); 5192 var WorkDoneProgressCreateRequest; 5193 (function(WorkDoneProgressCreateRequest2) { 5194 WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create"; 5195 WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5196 WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method); 5197 })(WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {})); 5198 var WorkDoneProgressCancelNotification; 5199 (function(WorkDoneProgressCancelNotification2) { 5200 WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel"; 5201 WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5202 WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method); 5203 })(WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {})); 5204 } 5205}); 5206
vendor: 2,070 bytes, lines 5207-5234
5207// node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js 5208var require_protocol_callHierarchy = __commonJS({ 5209 "node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports) { 5210 "use strict"; 5211 Object.defineProperty(exports, "__esModule", { value: true }); 5212 exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; 5213 var messages_1 = require_messages2(); 5214 var CallHierarchyPrepareRequest; 5215 (function(CallHierarchyPrepareRequest2) { 5216 CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; 5217 CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5218 CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); 5219 })(CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {})); 5220 var CallHierarchyIncomingCallsRequest; 5221 (function(CallHierarchyIncomingCallsRequest2) { 5222 CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; 5223 CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5224 CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); 5225 })(CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {})); 5226 var CallHierarchyOutgoingCallsRequest; 5227 (function(CallHierarchyOutgoingCallsRequest2) { 5228 CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; 5229 CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5230 CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); 5231 })(CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {})); 5232 } 5233}); 5234
vendor: 3,332 bytes, lines 5235-5280
5235// node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js 5236var require_protocol_semanticTokens = __commonJS({ 5237 "node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports) { 5238 "use strict"; 5239 Object.defineProperty(exports, "__esModule", { value: true }); 5240 exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = void 0; 5241 var messages_1 = require_messages2(); 5242 var TokenFormat; 5243 (function(TokenFormat2) { 5244 TokenFormat2.Relative = "relative"; 5245 })(TokenFormat || (exports.TokenFormat = TokenFormat = {})); 5246 var SemanticTokensRegistrationType; 5247 (function(SemanticTokensRegistrationType2) { 5248 SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; 5249 SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); 5250 })(SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {})); 5251 var SemanticTokensRequest; 5252 (function(SemanticTokensRequest2) { 5253 SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; 5254 SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5255 SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); 5256 SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method; 5257 })(SemanticTokensRequest || (exports.SemanticTokensRequest = SemanticTokensRequest = {})); 5258 var SemanticTokensDeltaRequest; 5259 (function(SemanticTokensDeltaRequest2) { 5260 SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; 5261 SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5262 SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); 5263 SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method; 5264 })(SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {})); 5265 var SemanticTokensRangeRequest; 5266 (function(SemanticTokensRangeRequest2) { 5267 SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; 5268 SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5269 SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); 5270 SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method; 5271 })(SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {})); 5272 var SemanticTokensRefreshRequest; 5273 (function(SemanticTokensRefreshRequest2) { 5274 SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; 5275 SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5276 SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); 5277 })(SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {})); 5278 } 5279}); 5280
vendor: 809 bytes, lines 5281-5296
5281// node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js 5282var require_protocol_showDocument = __commonJS({ 5283 "node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports) { 5284 "use strict"; 5285 Object.defineProperty(exports, "__esModule", { value: true }); 5286 exports.ShowDocumentRequest = void 0; 5287 var messages_1 = require_messages2(); 5288 var ShowDocumentRequest; 5289 (function(ShowDocumentRequest2) { 5290 ShowDocumentRequest2.method = "window/showDocument"; 5291 ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5292 ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); 5293 })(ShowDocumentRequest || (exports.ShowDocumentRequest = ShowDocumentRequest = {})); 5294 } 5295}); 5296
vendor: 899 bytes, lines 5297-5312
5297// node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js 5298var require_protocol_linkedEditingRange = __commonJS({ 5299 "node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports) { 5300 "use strict"; 5301 Object.defineProperty(exports, "__esModule", { value: true }); 5302 exports.LinkedEditingRangeRequest = void 0; 5303 var messages_1 = require_messages2(); 5304 var LinkedEditingRangeRequest; 5305 (function(LinkedEditingRangeRequest2) { 5306 LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; 5307 LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5308 LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); 5309 })(LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {})); 5310 } 5311}); 5312
vendor: 3,647 bytes, lines 5313-5363
5313// node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js 5314var require_protocol_fileOperations = __commonJS({ 5315 "node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports) { 5316 "use strict"; 5317 Object.defineProperty(exports, "__esModule", { value: true }); 5318 exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; 5319 var messages_1 = require_messages2(); 5320 var FileOperationPatternKind; 5321 (function(FileOperationPatternKind2) { 5322 FileOperationPatternKind2.file = "file"; 5323 FileOperationPatternKind2.folder = "folder"; 5324 })(FileOperationPatternKind || (exports.FileOperationPatternKind = FileOperationPatternKind = {})); 5325 var WillCreateFilesRequest; 5326 (function(WillCreateFilesRequest2) { 5327 WillCreateFilesRequest2.method = "workspace/willCreateFiles"; 5328 WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5329 WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); 5330 })(WillCreateFilesRequest || (exports.WillCreateFilesRequest = WillCreateFilesRequest = {})); 5331 var DidCreateFilesNotification; 5332 (function(DidCreateFilesNotification2) { 5333 DidCreateFilesNotification2.method = "workspace/didCreateFiles"; 5334 DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5335 DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); 5336 })(DidCreateFilesNotification || (exports.DidCreateFilesNotification = DidCreateFilesNotification = {})); 5337 var WillRenameFilesRequest; 5338 (function(WillRenameFilesRequest2) { 5339 WillRenameFilesRequest2.method = "workspace/willRenameFiles"; 5340 WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5341 WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); 5342 })(WillRenameFilesRequest || (exports.WillRenameFilesRequest = WillRenameFilesRequest = {})); 5343 var DidRenameFilesNotification; 5344 (function(DidRenameFilesNotification2) { 5345 DidRenameFilesNotification2.method = "workspace/didRenameFiles"; 5346 DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5347 DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); 5348 })(DidRenameFilesNotification || (exports.DidRenameFilesNotification = DidRenameFilesNotification = {})); 5349 var DidDeleteFilesNotification; 5350 (function(DidDeleteFilesNotification2) { 5351 DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; 5352 DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5353 DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); 5354 })(DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = DidDeleteFilesNotification = {})); 5355 var WillDeleteFilesRequest; 5356 (function(WillDeleteFilesRequest2) { 5357 WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; 5358 WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5359 WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); 5360 })(WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = WillDeleteFilesRequest = {})); 5361 } 5362}); 5363
vendor: 1,373 bytes, lines 5364-5393
5364// node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js 5365var require_protocol_moniker = __commonJS({ 5366 "node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports) { 5367 "use strict"; 5368 Object.defineProperty(exports, "__esModule", { value: true }); 5369 exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; 5370 var messages_1 = require_messages2(); 5371 var UniquenessLevel; 5372 (function(UniquenessLevel2) { 5373 UniquenessLevel2.document = "document"; 5374 UniquenessLevel2.project = "project"; 5375 UniquenessLevel2.group = "group"; 5376 UniquenessLevel2.scheme = "scheme"; 5377 UniquenessLevel2.global = "global"; 5378 })(UniquenessLevel || (exports.UniquenessLevel = UniquenessLevel = {})); 5379 var MonikerKind; 5380 (function(MonikerKind2) { 5381 MonikerKind2.$import = "import"; 5382 MonikerKind2.$export = "export"; 5383 MonikerKind2.local = "local"; 5384 })(MonikerKind || (exports.MonikerKind = MonikerKind = {})); 5385 var MonikerRequest; 5386 (function(MonikerRequest2) { 5387 MonikerRequest2.method = "textDocument/moniker"; 5388 MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5389 MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); 5390 })(MonikerRequest || (exports.MonikerRequest = MonikerRequest = {})); 5391 } 5392}); 5393
vendor: 1,982 bytes, lines 5394-5421
5394// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js 5395var require_protocol_typeHierarchy = __commonJS({ 5396 "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports) { 5397 "use strict"; 5398 Object.defineProperty(exports, "__esModule", { value: true }); 5399 exports.TypeHierarchySubtypesRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchyPrepareRequest = void 0; 5400 var messages_1 = require_messages2(); 5401 var TypeHierarchyPrepareRequest; 5402 (function(TypeHierarchyPrepareRequest2) { 5403 TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy"; 5404 TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5405 TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method); 5406 })(TypeHierarchyPrepareRequest || (exports.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {})); 5407 var TypeHierarchySupertypesRequest; 5408 (function(TypeHierarchySupertypesRequest2) { 5409 TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes"; 5410 TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5411 TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method); 5412 })(TypeHierarchySupertypesRequest || (exports.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {})); 5413 var TypeHierarchySubtypesRequest; 5414 (function(TypeHierarchySubtypesRequest2) { 5415 TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes"; 5416 TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5417 TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method); 5418 })(TypeHierarchySubtypesRequest || (exports.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {})); 5419 } 5420}); 5421
vendor: 1,306 bytes, lines 5422-5443
5422// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js 5423var require_protocol_inlineValue = __commonJS({ 5424 "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports) { 5425 "use strict"; 5426 Object.defineProperty(exports, "__esModule", { value: true }); 5427 exports.InlineValueRefreshRequest = exports.InlineValueRequest = void 0; 5428 var messages_1 = require_messages2(); 5429 var InlineValueRequest; 5430 (function(InlineValueRequest2) { 5431 InlineValueRequest2.method = "textDocument/inlineValue"; 5432 InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5433 InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method); 5434 })(InlineValueRequest || (exports.InlineValueRequest = InlineValueRequest = {})); 5435 var InlineValueRefreshRequest; 5436 (function(InlineValueRefreshRequest2) { 5437 InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`; 5438 InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5439 InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method); 5440 })(InlineValueRefreshRequest || (exports.InlineValueRefreshRequest = InlineValueRefreshRequest = {})); 5441 } 5442}); 5443
vendor: 1,728 bytes, lines 5444-5471
5444// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js 5445var require_protocol_inlayHint = __commonJS({ 5446 "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports) { 5447 "use strict"; 5448 Object.defineProperty(exports, "__esModule", { value: true }); 5449 exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = void 0; 5450 var messages_1 = require_messages2(); 5451 var InlayHintRequest; 5452 (function(InlayHintRequest2) { 5453 InlayHintRequest2.method = "textDocument/inlayHint"; 5454 InlayHintRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5455 InlayHintRequest2.type = new messages_1.ProtocolRequestType(InlayHintRequest2.method); 5456 })(InlayHintRequest || (exports.InlayHintRequest = InlayHintRequest = {})); 5457 var InlayHintResolveRequest; 5458 (function(InlayHintResolveRequest2) { 5459 InlayHintResolveRequest2.method = "inlayHint/resolve"; 5460 InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5461 InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method); 5462 })(InlayHintResolveRequest || (exports.InlayHintResolveRequest = InlayHintResolveRequest = {})); 5463 var InlayHintRefreshRequest; 5464 (function(InlayHintRefreshRequest2) { 5465 InlayHintRefreshRequest2.method = `workspace/inlayHint/refresh`; 5466 InlayHintRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5467 InlayHintRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method); 5468 })(InlayHintRefreshRequest || (exports.InlayHintRefreshRequest = InlayHintRefreshRequest = {})); 5469 } 5470}); 5471
vendor: 2,913 bytes, lines 5472-5516
5472// node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js 5473var require_protocol_diagnostic = __commonJS({ 5474 "node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports) { 5475 "use strict"; 5476 Object.defineProperty(exports, "__esModule", { value: true }); 5477 exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = void 0; 5478 var vscode_jsonrpc_1 = require_main(); 5479 var Is2 = require_is2(); 5480 var messages_1 = require_messages2(); 5481 var DiagnosticServerCancellationData; 5482 (function(DiagnosticServerCancellationData2) { 5483 function is(value) { 5484 const candidate = value; 5485 return candidate && Is2.boolean(candidate.retriggerRequest); 5486 } 5487 DiagnosticServerCancellationData2.is = is; 5488 })(DiagnosticServerCancellationData || (exports.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {})); 5489 var DocumentDiagnosticReportKind; 5490 (function(DocumentDiagnosticReportKind2) { 5491 DocumentDiagnosticReportKind2.Full = "full"; 5492 DocumentDiagnosticReportKind2.Unchanged = "unchanged"; 5493 })(DocumentDiagnosticReportKind || (exports.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {})); 5494 var DocumentDiagnosticRequest; 5495 (function(DocumentDiagnosticRequest2) { 5496 DocumentDiagnosticRequest2.method = "textDocument/diagnostic"; 5497 DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5498 DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method); 5499 DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); 5500 })(DocumentDiagnosticRequest || (exports.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {})); 5501 var WorkspaceDiagnosticRequest; 5502 (function(WorkspaceDiagnosticRequest2) { 5503 WorkspaceDiagnosticRequest2.method = "workspace/diagnostic"; 5504 WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5505 WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method); 5506 WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); 5507 })(WorkspaceDiagnosticRequest || (exports.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {})); 5508 var DiagnosticRefreshRequest; 5509 (function(DiagnosticRefreshRequest2) { 5510 DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`; 5511 DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5512 DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method); 5513 })(DiagnosticRefreshRequest || (exports.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {})); 5514 } 5515}); 5516
vendor: 9,705 bytes, lines 5517-5705
5517// node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js 5518var require_protocol_notebook = __commonJS({ 5519 "node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports) { 5520 "use strict"; 5521 Object.defineProperty(exports, "__esModule", { value: true }); 5522 exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = void 0; 5523 var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); 5524 var Is2 = require_is2(); 5525 var messages_1 = require_messages2(); 5526 var NotebookCellKind; 5527 (function(NotebookCellKind2) { 5528 NotebookCellKind2.Markup = 1; 5529 NotebookCellKind2.Code = 2; 5530 function is(value) { 5531 return value === 1 || value === 2; 5532 } 5533 NotebookCellKind2.is = is; 5534 })(NotebookCellKind || (exports.NotebookCellKind = NotebookCellKind = {})); 5535 var ExecutionSummary; 5536 (function(ExecutionSummary2) { 5537 function create(executionOrder, success) { 5538 const result = { executionOrder }; 5539 if (success === true || success === false) { 5540 result.success = success; 5541 } 5542 return result; 5543 } 5544 ExecutionSummary2.create = create; 5545 function is(value) { 5546 const candidate = value; 5547 return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success)); 5548 } 5549 ExecutionSummary2.is = is; 5550 function equals2(one, other) { 5551 if (one === other) { 5552 return true; 5553 } 5554 if (one === null || one === void 0 || other === null || other === void 0) { 5555 return false; 5556 } 5557 return one.executionOrder === other.executionOrder && one.success === other.success; 5558 } 5559 ExecutionSummary2.equals = equals2; 5560 })(ExecutionSummary || (exports.ExecutionSummary = ExecutionSummary = {})); 5561 var NotebookCell; 5562 (function(NotebookCell2) { 5563 function create(kind, document2) { 5564 return { kind, document: document2 }; 5565 } 5566 NotebookCell2.create = create; 5567 function is(value) { 5568 const candidate = value; 5569 return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata)); 5570 } 5571 NotebookCell2.is = is; 5572 function diff(one, two) { 5573 const result = /* @__PURE__ */ new Set(); 5574 if (one.document !== two.document) { 5575 result.add("document"); 5576 } 5577 if (one.kind !== two.kind) { 5578 result.add("kind"); 5579 } 5580 if (one.executionSummary !== two.executionSummary) { 5581 result.add("executionSummary"); 5582 } 5583 if ((one.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one.metadata, two.metadata)) { 5584 result.add("metadata"); 5585 } 5586 if ((one.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one.executionSummary, two.executionSummary)) { 5587 result.add("executionSummary"); 5588 } 5589 return result; 5590 } 5591 NotebookCell2.diff = diff; 5592 function equalsMetadata(one, other) { 5593 if (one === other) { 5594 return true; 5595 } 5596 if (one === null || one === void 0 || other === null || other === void 0) { 5597 return false; 5598 } 5599 if (typeof one !== typeof other) { 5600 return false; 5601 } 5602 if (typeof one !== "object") { 5603 return false; 5604 } 5605 const oneArray = Array.isArray(one); 5606 const otherArray = Array.isArray(other); 5607 if (oneArray !== otherArray) { 5608 return false; 5609 } 5610 if (oneArray && otherArray) { 5611 if (one.length !== other.length) { 5612 return false; 5613 } 5614 for (let i2 = 0; i2 < one.length; i2++) { 5615 if (!equalsMetadata(one[i2], other[i2])) { 5616 return false; 5617 } 5618 } 5619 } 5620 if (Is2.objectLiteral(one) && Is2.objectLiteral(other)) { 5621 const oneKeys = Object.keys(one); 5622 const otherKeys = Object.keys(other); 5623 if (oneKeys.length !== otherKeys.length) { 5624 return false; 5625 } 5626 oneKeys.sort(); 5627 otherKeys.sort(); 5628 if (!equalsMetadata(oneKeys, otherKeys)) { 5629 return false; 5630 } 5631 for (let i2 = 0; i2 < oneKeys.length; i2++) { 5632 const prop = oneKeys[i2]; 5633 if (!equalsMetadata(one[prop], other[prop])) { 5634 return false; 5635 } 5636 } 5637 } 5638 return true; 5639 } 5640 })(NotebookCell || (exports.NotebookCell = NotebookCell = {})); 5641 var NotebookDocument; 5642 (function(NotebookDocument2) { 5643 function create(uri, notebookType, version, cells) { 5644 return { uri, notebookType, version, cells }; 5645 } 5646 NotebookDocument2.create = create; 5647 function is(value) { 5648 const candidate = value; 5649 return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is); 5650 } 5651 NotebookDocument2.is = is; 5652 })(NotebookDocument || (exports.NotebookDocument = NotebookDocument = {})); 5653 var NotebookDocumentSyncRegistrationType; 5654 (function(NotebookDocumentSyncRegistrationType2) { 5655 NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync"; 5656 NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer; 5657 NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method); 5658 })(NotebookDocumentSyncRegistrationType || (exports.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {})); 5659 var DidOpenNotebookDocumentNotification; 5660 (function(DidOpenNotebookDocumentNotification2) { 5661 DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen"; 5662 DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5663 DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method); 5664 DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; 5665 })(DidOpenNotebookDocumentNotification || (exports.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {})); 5666 var NotebookCellArrayChange; 5667 (function(NotebookCellArrayChange2) { 5668 function is(value) { 5669 const candidate = value; 5670 return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is)); 5671 } 5672 NotebookCellArrayChange2.is = is; 5673 function create(start, deleteCount, cells) { 5674 const result = { start, deleteCount }; 5675 if (cells !== void 0) { 5676 result.cells = cells; 5677 } 5678 return result; 5679 } 5680 NotebookCellArrayChange2.create = create; 5681 })(NotebookCellArrayChange || (exports.NotebookCellArrayChange = NotebookCellArrayChange = {})); 5682 var DidChangeNotebookDocumentNotification; 5683 (function(DidChangeNotebookDocumentNotification2) { 5684 DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange"; 5685 DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5686 DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method); 5687 DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; 5688 })(DidChangeNotebookDocumentNotification || (exports.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {})); 5689 var DidSaveNotebookDocumentNotification; 5690 (function(DidSaveNotebookDocumentNotification2) { 5691 DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave"; 5692 DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5693 DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method); 5694 DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; 5695 })(DidSaveNotebookDocumentNotification || (exports.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {})); 5696 var DidCloseNotebookDocumentNotification; 5697 (function(DidCloseNotebookDocumentNotification2) { 5698 DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose"; 5699 DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 5700 DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method); 5701 DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; 5702 })(DidCloseNotebookDocumentNotification || (exports.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {})); 5703 } 5704}); 5705
vendor: 871 bytes, lines 5706-5721
5706// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js 5707var require_protocol_inlineCompletion = __commonJS({ 5708 "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports) { 5709 "use strict"; 5710 Object.defineProperty(exports, "__esModule", { value: true }); 5711 exports.InlineCompletionRequest = void 0; 5712 var messages_1 = require_messages2(); 5713 var InlineCompletionRequest; 5714 (function(InlineCompletionRequest2) { 5715 InlineCompletionRequest2.method = "textDocument/inlineCompletion"; 5716 InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 5717 InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method); 5718 })(InlineCompletionRequest || (exports.InlineCompletionRequest = InlineCompletionRequest = {})); 5719 } 5720}); 5721
vendor: 44,223 bytes, lines 5722-6357
5722// node_modules/vscode-languageserver-protocol/lib/common/protocol.js 5723var require_protocol = __commonJS({ 5724 "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports) { 5725 "use strict"; 5726 Object.defineProperty(exports, "__esModule", { value: true }); 5727 exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.RelativePattern = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeErrorCodes = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.PositionEncodingKind = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.NotebookCellTextDocumentFilter = exports.NotebookDocumentFilter = exports.TextDocumentFilter = void 0; 5728 exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangesFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolResolveRequest = void 0; 5729 exports.InlineCompletionRequest = exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = exports.InlineValueRefreshRequest = exports.InlineValueRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchySubtypesRequest = exports.TypeHierarchyPrepareRequest = void 0; 5730 var messages_1 = require_messages2(); 5731 var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); 5732 var Is2 = require_is2(); 5733 var protocol_implementation_1 = require_protocol_implementation(); 5734 Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function() { 5735 return protocol_implementation_1.ImplementationRequest; 5736 } }); 5737 var protocol_typeDefinition_1 = require_protocol_typeDefinition(); 5738 Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function() { 5739 return protocol_typeDefinition_1.TypeDefinitionRequest; 5740 } }); 5741 var protocol_workspaceFolder_1 = require_protocol_workspaceFolder(); 5742 Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function() { 5743 return protocol_workspaceFolder_1.WorkspaceFoldersRequest; 5744 } }); 5745 Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() { 5746 return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; 5747 } }); 5748 var protocol_configuration_1 = require_protocol_configuration(); 5749 Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function() { 5750 return protocol_configuration_1.ConfigurationRequest; 5751 } }); 5752 var protocol_colorProvider_1 = require_protocol_colorProvider(); 5753 Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function() { 5754 return protocol_colorProvider_1.DocumentColorRequest; 5755 } }); 5756 Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function() { 5757 return protocol_colorProvider_1.ColorPresentationRequest; 5758 } }); 5759 var protocol_foldingRange_1 = require_protocol_foldingRange(); 5760 Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function() { 5761 return protocol_foldingRange_1.FoldingRangeRequest; 5762 } }); 5763 Object.defineProperty(exports, "FoldingRangeRefreshRequest", { enumerable: true, get: function() { 5764 return protocol_foldingRange_1.FoldingRangeRefreshRequest; 5765 } }); 5766 var protocol_declaration_1 = require_protocol_declaration(); 5767 Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function() { 5768 return protocol_declaration_1.DeclarationRequest; 5769 } }); 5770 var protocol_selectionRange_1 = require_protocol_selectionRange(); 5771 Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function() { 5772 return protocol_selectionRange_1.SelectionRangeRequest; 5773 } }); 5774 var protocol_progress_1 = require_protocol_progress(); 5775 Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function() { 5776 return protocol_progress_1.WorkDoneProgress; 5777 } }); 5778 Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() { 5779 return protocol_progress_1.WorkDoneProgressCreateRequest; 5780 } }); 5781 Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() { 5782 return protocol_progress_1.WorkDoneProgressCancelNotification; 5783 } }); 5784 var protocol_callHierarchy_1 = require_protocol_callHierarchy(); 5785 Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() { 5786 return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; 5787 } }); 5788 Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() { 5789 return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; 5790 } }); 5791 Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function() { 5792 return protocol_callHierarchy_1.CallHierarchyPrepareRequest; 5793 } }); 5794 var protocol_semanticTokens_1 = require_protocol_semanticTokens(); 5795 Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function() { 5796 return protocol_semanticTokens_1.TokenFormat; 5797 } }); 5798 Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function() { 5799 return protocol_semanticTokens_1.SemanticTokensRequest; 5800 } }); 5801 Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function() { 5802 return protocol_semanticTokens_1.SemanticTokensDeltaRequest; 5803 } }); 5804 Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function() { 5805 return protocol_semanticTokens_1.SemanticTokensRangeRequest; 5806 } }); 5807 Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function() { 5808 return protocol_semanticTokens_1.SemanticTokensRefreshRequest; 5809 } }); 5810 Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function() { 5811 return protocol_semanticTokens_1.SemanticTokensRegistrationType; 5812 } }); 5813 var protocol_showDocument_1 = require_protocol_showDocument(); 5814 Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function() { 5815 return protocol_showDocument_1.ShowDocumentRequest; 5816 } }); 5817 var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); 5818 Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function() { 5819 return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; 5820 } }); 5821 var protocol_fileOperations_1 = require_protocol_fileOperations(); 5822 Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function() { 5823 return protocol_fileOperations_1.FileOperationPatternKind; 5824 } }); 5825 Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function() { 5826 return protocol_fileOperations_1.DidCreateFilesNotification; 5827 } }); 5828 Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function() { 5829 return protocol_fileOperations_1.WillCreateFilesRequest; 5830 } }); 5831 Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function() { 5832 return protocol_fileOperations_1.DidRenameFilesNotification; 5833 } }); 5834 Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function() { 5835 return protocol_fileOperations_1.WillRenameFilesRequest; 5836 } }); 5837 Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function() { 5838 return protocol_fileOperations_1.DidDeleteFilesNotification; 5839 } }); 5840 Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function() { 5841 return protocol_fileOperations_1.WillDeleteFilesRequest; 5842 } }); 5843 var protocol_moniker_1 = require_protocol_moniker(); 5844 Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function() { 5845 return protocol_moniker_1.UniquenessLevel; 5846 } }); 5847 Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function() { 5848 return protocol_moniker_1.MonikerKind; 5849 } }); 5850 Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function() { 5851 return protocol_moniker_1.MonikerRequest; 5852 } }); 5853 var protocol_typeHierarchy_1 = require_protocol_typeHierarchy(); 5854 Object.defineProperty(exports, "TypeHierarchyPrepareRequest", { enumerable: true, get: function() { 5855 return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; 5856 } }); 5857 Object.defineProperty(exports, "TypeHierarchySubtypesRequest", { enumerable: true, get: function() { 5858 return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; 5859 } }); 5860 Object.defineProperty(exports, "TypeHierarchySupertypesRequest", { enumerable: true, get: function() { 5861 return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; 5862 } }); 5863 var protocol_inlineValue_1 = require_protocol_inlineValue(); 5864 Object.defineProperty(exports, "InlineValueRequest", { enumerable: true, get: function() { 5865 return protocol_inlineValue_1.InlineValueRequest; 5866 } }); 5867 Object.defineProperty(exports, "InlineValueRefreshRequest", { enumerable: true, get: function() { 5868 return protocol_inlineValue_1.InlineValueRefreshRequest; 5869 } }); 5870 var protocol_inlayHint_1 = require_protocol_inlayHint(); 5871 Object.defineProperty(exports, "InlayHintRequest", { enumerable: true, get: function() { 5872 return protocol_inlayHint_1.InlayHintRequest; 5873 } }); 5874 Object.defineProperty(exports, "InlayHintResolveRequest", { enumerable: true, get: function() { 5875 return protocol_inlayHint_1.InlayHintResolveRequest; 5876 } }); 5877 Object.defineProperty(exports, "InlayHintRefreshRequest", { enumerable: true, get: function() { 5878 return protocol_inlayHint_1.InlayHintRefreshRequest; 5879 } }); 5880 var protocol_diagnostic_1 = require_protocol_diagnostic(); 5881 Object.defineProperty(exports, "DiagnosticServerCancellationData", { enumerable: true, get: function() { 5882 return protocol_diagnostic_1.DiagnosticServerCancellationData; 5883 } }); 5884 Object.defineProperty(exports, "DocumentDiagnosticReportKind", { enumerable: true, get: function() { 5885 return protocol_diagnostic_1.DocumentDiagnosticReportKind; 5886 } }); 5887 Object.defineProperty(exports, "DocumentDiagnosticRequest", { enumerable: true, get: function() { 5888 return protocol_diagnostic_1.DocumentDiagnosticRequest; 5889 } }); 5890 Object.defineProperty(exports, "WorkspaceDiagnosticRequest", { enumerable: true, get: function() { 5891 return protocol_diagnostic_1.WorkspaceDiagnosticRequest; 5892 } }); 5893 Object.defineProperty(exports, "DiagnosticRefreshRequest", { enumerable: true, get: function() { 5894 return protocol_diagnostic_1.DiagnosticRefreshRequest; 5895 } }); 5896 var protocol_notebook_1 = require_protocol_notebook(); 5897 Object.defineProperty(exports, "NotebookCellKind", { enumerable: true, get: function() { 5898 return protocol_notebook_1.NotebookCellKind; 5899 } }); 5900 Object.defineProperty(exports, "ExecutionSummary", { enumerable: true, get: function() { 5901 return protocol_notebook_1.ExecutionSummary; 5902 } }); 5903 Object.defineProperty(exports, "NotebookCell", { enumerable: true, get: function() { 5904 return protocol_notebook_1.NotebookCell; 5905 } }); 5906 Object.defineProperty(exports, "NotebookDocument", { enumerable: true, get: function() { 5907 return protocol_notebook_1.NotebookDocument; 5908 } }); 5909 Object.defineProperty(exports, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: function() { 5910 return protocol_notebook_1.NotebookDocumentSyncRegistrationType; 5911 } }); 5912 Object.defineProperty(exports, "DidOpenNotebookDocumentNotification", { enumerable: true, get: function() { 5913 return protocol_notebook_1.DidOpenNotebookDocumentNotification; 5914 } }); 5915 Object.defineProperty(exports, "NotebookCellArrayChange", { enumerable: true, get: function() { 5916 return protocol_notebook_1.NotebookCellArrayChange; 5917 } }); 5918 Object.defineProperty(exports, "DidChangeNotebookDocumentNotification", { enumerable: true, get: function() { 5919 return protocol_notebook_1.DidChangeNotebookDocumentNotification; 5920 } }); 5921 Object.defineProperty(exports, "DidSaveNotebookDocumentNotification", { enumerable: true, get: function() { 5922 return protocol_notebook_1.DidSaveNotebookDocumentNotification; 5923 } }); 5924 Object.defineProperty(exports, "DidCloseNotebookDocumentNotification", { enumerable: true, get: function() { 5925 return protocol_notebook_1.DidCloseNotebookDocumentNotification; 5926 } }); 5927 var protocol_inlineCompletion_1 = require_protocol_inlineCompletion(); 5928 Object.defineProperty(exports, "InlineCompletionRequest", { enumerable: true, get: function() { 5929 return protocol_inlineCompletion_1.InlineCompletionRequest; 5930 } }); 5931 var TextDocumentFilter; 5932 (function(TextDocumentFilter2) { 5933 function is(value) { 5934 const candidate = value; 5935 return Is2.string(candidate) || (Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); 5936 } 5937 TextDocumentFilter2.is = is; 5938 })(TextDocumentFilter || (exports.TextDocumentFilter = TextDocumentFilter = {})); 5939 var NotebookDocumentFilter; 5940 (function(NotebookDocumentFilter2) { 5941 function is(value) { 5942 const candidate = value; 5943 return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); 5944 } 5945 NotebookDocumentFilter2.is = is; 5946 })(NotebookDocumentFilter || (exports.NotebookDocumentFilter = NotebookDocumentFilter = {})); 5947 var NotebookCellTextDocumentFilter; 5948 (function(NotebookCellTextDocumentFilter2) { 5949 function is(value) { 5950 const candidate = value; 5951 return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language)); 5952 } 5953 NotebookCellTextDocumentFilter2.is = is; 5954 })(NotebookCellTextDocumentFilter || (exports.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {})); 5955 var DocumentSelector; 5956 (function(DocumentSelector2) { 5957 function is(value) { 5958 if (!Array.isArray(value)) { 5959 return false; 5960 } 5961 for (let elem of value) { 5962 if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) { 5963 return false; 5964 } 5965 } 5966 return true; 5967 } 5968 DocumentSelector2.is = is; 5969 })(DocumentSelector || (exports.DocumentSelector = DocumentSelector = {})); 5970 var RegistrationRequest2; 5971 (function(RegistrationRequest3) { 5972 RegistrationRequest3.method = "client/registerCapability"; 5973 RegistrationRequest3.messageDirection = messages_1.MessageDirection.serverToClient; 5974 RegistrationRequest3.type = new messages_1.ProtocolRequestType(RegistrationRequest3.method); 5975 })(RegistrationRequest2 || (exports.RegistrationRequest = RegistrationRequest2 = {})); 5976 var UnregistrationRequest; 5977 (function(UnregistrationRequest2) { 5978 UnregistrationRequest2.method = "client/unregisterCapability"; 5979 UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 5980 UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method); 5981 })(UnregistrationRequest || (exports.UnregistrationRequest = UnregistrationRequest = {})); 5982 var ResourceOperationKind; 5983 (function(ResourceOperationKind2) { 5984 ResourceOperationKind2.Create = "create"; 5985 ResourceOperationKind2.Rename = "rename"; 5986 ResourceOperationKind2.Delete = "delete"; 5987 })(ResourceOperationKind || (exports.ResourceOperationKind = ResourceOperationKind = {})); 5988 var FailureHandlingKind; 5989 (function(FailureHandlingKind2) { 5990 FailureHandlingKind2.Abort = "abort"; 5991 FailureHandlingKind2.Transactional = "transactional"; 5992 FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; 5993 FailureHandlingKind2.Undo = "undo"; 5994 })(FailureHandlingKind || (exports.FailureHandlingKind = FailureHandlingKind = {})); 5995 var PositionEncodingKind; 5996 (function(PositionEncodingKind2) { 5997 PositionEncodingKind2.UTF8 = "utf-8"; 5998 PositionEncodingKind2.UTF16 = "utf-16"; 5999 PositionEncodingKind2.UTF32 = "utf-32"; 6000 })(PositionEncodingKind || (exports.PositionEncodingKind = PositionEncodingKind = {})); 6001 var StaticRegistrationOptions; 6002 (function(StaticRegistrationOptions2) { 6003 function hasId(value) { 6004 const candidate = value; 6005 return candidate && Is2.string(candidate.id) && candidate.id.length > 0; 6006 } 6007 StaticRegistrationOptions2.hasId = hasId; 6008 })(StaticRegistrationOptions || (exports.StaticRegistrationOptions = StaticRegistrationOptions = {})); 6009 var TextDocumentRegistrationOptions; 6010 (function(TextDocumentRegistrationOptions2) { 6011 function is(value) { 6012 const candidate = value; 6013 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); 6014 } 6015 TextDocumentRegistrationOptions2.is = is; 6016 })(TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {})); 6017 var WorkDoneProgressOptions; 6018 (function(WorkDoneProgressOptions2) { 6019 function is(value) { 6020 const candidate = value; 6021 return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress)); 6022 } 6023 WorkDoneProgressOptions2.is = is; 6024 function hasWorkDoneProgress(value) { 6025 const candidate = value; 6026 return candidate && Is2.boolean(candidate.workDoneProgress); 6027 } 6028 WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; 6029 })(WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = WorkDoneProgressOptions = {})); 6030 var InitializeRequest2; 6031 (function(InitializeRequest3) { 6032 InitializeRequest3.method = "initialize"; 6033 InitializeRequest3.messageDirection = messages_1.MessageDirection.clientToServer; 6034 InitializeRequest3.type = new messages_1.ProtocolRequestType(InitializeRequest3.method); 6035 })(InitializeRequest2 || (exports.InitializeRequest = InitializeRequest2 = {})); 6036 var InitializeErrorCodes; 6037 (function(InitializeErrorCodes2) { 6038 InitializeErrorCodes2.unknownProtocolVersion = 1; 6039 })(InitializeErrorCodes || (exports.InitializeErrorCodes = InitializeErrorCodes = {})); 6040 var InitializedNotification2; 6041 (function(InitializedNotification3) { 6042 InitializedNotification3.method = "initialized"; 6043 InitializedNotification3.messageDirection = messages_1.MessageDirection.clientToServer; 6044 InitializedNotification3.type = new messages_1.ProtocolNotificationType(InitializedNotification3.method); 6045 })(InitializedNotification2 || (exports.InitializedNotification = InitializedNotification2 = {})); 6046 var ShutdownRequest; 6047 (function(ShutdownRequest2) { 6048 ShutdownRequest2.method = "shutdown"; 6049 ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6050 ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method); 6051 })(ShutdownRequest || (exports.ShutdownRequest = ShutdownRequest = {})); 6052 var ExitNotification; 6053 (function(ExitNotification2) { 6054 ExitNotification2.method = "exit"; 6055 ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 6056 ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method); 6057 })(ExitNotification || (exports.ExitNotification = ExitNotification = {})); 6058 var DidChangeConfigurationNotification; 6059 (function(DidChangeConfigurationNotification2) { 6060 DidChangeConfigurationNotification2.method = "workspace/didChangeConfiguration"; 6061 DidChangeConfigurationNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 6062 DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method); 6063 })(DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = DidChangeConfigurationNotification = {})); 6064 var MessageType; 6065 (function(MessageType2) { 6066 MessageType2.Error = 1; 6067 MessageType2.Warning = 2; 6068 MessageType2.Info = 3; 6069 MessageType2.Log = 4; 6070 MessageType2.Debug = 5; 6071 })(MessageType || (exports.MessageType = MessageType = {})); 6072 var ShowMessageNotification; 6073 (function(ShowMessageNotification2) { 6074 ShowMessageNotification2.method = "window/showMessage"; 6075 ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; 6076 ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method); 6077 })(ShowMessageNotification || (exports.ShowMessageNotification = ShowMessageNotification = {})); 6078 var ShowMessageRequest; 6079 (function(ShowMessageRequest2) { 6080 ShowMessageRequest2.method = "window/showMessageRequest"; 6081 ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 6082 ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method); 6083 })(ShowMessageRequest || (exports.ShowMessageRequest = ShowMessageRequest = {})); 6084 var LogMessageNotification; 6085 (function(LogMessageNotification2) { 6086 LogMessageNotification2.method = "window/logMessage"; 6087 LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; 6088 LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method); 6089 })(LogMessageNotification || (exports.LogMessageNotification = LogMessageNotification = {})); 6090 var TelemetryEventNotification; 6091 (function(TelemetryEventNotification2) { 6092 TelemetryEventNotification2.method = "telemetry/event"; 6093 TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient; 6094 TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method); 6095 })(TelemetryEventNotification || (exports.TelemetryEventNotification = TelemetryEventNotification = {})); 6096 var TextDocumentSyncKind; 6097 (function(TextDocumentSyncKind2) { 6098 TextDocumentSyncKind2.None = 0; 6099 TextDocumentSyncKind2.Full = 1; 6100 TextDocumentSyncKind2.Incremental = 2; 6101 })(TextDocumentSyncKind || (exports.TextDocumentSyncKind = TextDocumentSyncKind = {})); 6102 var DidOpenTextDocumentNotification2; 6103 (function(DidOpenTextDocumentNotification3) { 6104 DidOpenTextDocumentNotification3.method = "textDocument/didOpen"; 6105 DidOpenTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; 6106 DidOpenTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification3.method); 6107 })(DidOpenTextDocumentNotification2 || (exports.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification2 = {})); 6108 var TextDocumentContentChangeEvent; 6109 (function(TextDocumentContentChangeEvent2) { 6110 function isIncremental(event) { 6111 let candidate = event; 6112 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); 6113 } 6114 TextDocumentContentChangeEvent2.isIncremental = isIncremental; 6115 function isFull(event) { 6116 let candidate = event; 6117 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; 6118 } 6119 TextDocumentContentChangeEvent2.isFull = isFull; 6120 })(TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {})); 6121 var DidChangeTextDocumentNotification2; 6122 (function(DidChangeTextDocumentNotification3) { 6123 DidChangeTextDocumentNotification3.method = "textDocument/didChange"; 6124 DidChangeTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; 6125 DidChangeTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification3.method); 6126 })(DidChangeTextDocumentNotification2 || (exports.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification2 = {})); 6127 var DidCloseTextDocumentNotification2; 6128 (function(DidCloseTextDocumentNotification3) { 6129 DidCloseTextDocumentNotification3.method = "textDocument/didClose"; 6130 DidCloseTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; 6131 DidCloseTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification3.method); 6132 })(DidCloseTextDocumentNotification2 || (exports.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification2 = {})); 6133 var DidSaveTextDocumentNotification; 6134 (function(DidSaveTextDocumentNotification2) { 6135 DidSaveTextDocumentNotification2.method = "textDocument/didSave"; 6136 DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 6137 DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); 6138 })(DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {})); 6139 var TextDocumentSaveReason; 6140 (function(TextDocumentSaveReason2) { 6141 TextDocumentSaveReason2.Manual = 1; 6142 TextDocumentSaveReason2.AfterDelay = 2; 6143 TextDocumentSaveReason2.FocusOut = 3; 6144 })(TextDocumentSaveReason || (exports.TextDocumentSaveReason = TextDocumentSaveReason = {})); 6145 var WillSaveTextDocumentNotification; 6146 (function(WillSaveTextDocumentNotification2) { 6147 WillSaveTextDocumentNotification2.method = "textDocument/willSave"; 6148 WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 6149 WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); 6150 })(WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {})); 6151 var WillSaveTextDocumentWaitUntilRequest; 6152 (function(WillSaveTextDocumentWaitUntilRequest2) { 6153 WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; 6154 WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6155 WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); 6156 })(WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {})); 6157 var DidChangeWatchedFilesNotification; 6158 (function(DidChangeWatchedFilesNotification2) { 6159 DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles"; 6160 DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; 6161 DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method); 6162 })(DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {})); 6163 var FileChangeType; 6164 (function(FileChangeType2) { 6165 FileChangeType2.Created = 1; 6166 FileChangeType2.Changed = 2; 6167 FileChangeType2.Deleted = 3; 6168 })(FileChangeType || (exports.FileChangeType = FileChangeType = {})); 6169 var RelativePattern; 6170 (function(RelativePattern2) { 6171 function is(value) { 6172 const candidate = value; 6173 return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern); 6174 } 6175 RelativePattern2.is = is; 6176 })(RelativePattern || (exports.RelativePattern = RelativePattern = {})); 6177 var WatchKind; 6178 (function(WatchKind2) { 6179 WatchKind2.Create = 1; 6180 WatchKind2.Change = 2; 6181 WatchKind2.Delete = 4; 6182 })(WatchKind || (exports.WatchKind = WatchKind = {})); 6183 var PublishDiagnosticsNotification2; 6184 (function(PublishDiagnosticsNotification3) { 6185 PublishDiagnosticsNotification3.method = "textDocument/publishDiagnostics"; 6186 PublishDiagnosticsNotification3.messageDirection = messages_1.MessageDirection.serverToClient; 6187 PublishDiagnosticsNotification3.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification3.method); 6188 })(PublishDiagnosticsNotification2 || (exports.PublishDiagnosticsNotification = PublishDiagnosticsNotification2 = {})); 6189 var CompletionTriggerKind2; 6190 (function(CompletionTriggerKind3) { 6191 CompletionTriggerKind3.Invoked = 1; 6192 CompletionTriggerKind3.TriggerCharacter = 2; 6193 CompletionTriggerKind3.TriggerForIncompleteCompletions = 3; 6194 })(CompletionTriggerKind2 || (exports.CompletionTriggerKind = CompletionTriggerKind2 = {})); 6195 var CompletionRequest2; 6196 (function(CompletionRequest3) { 6197 CompletionRequest3.method = "textDocument/completion"; 6198 CompletionRequest3.messageDirection = messages_1.MessageDirection.clientToServer; 6199 CompletionRequest3.type = new messages_1.ProtocolRequestType(CompletionRequest3.method); 6200 })(CompletionRequest2 || (exports.CompletionRequest = CompletionRequest2 = {})); 6201 var CompletionResolveRequest; 6202 (function(CompletionResolveRequest2) { 6203 CompletionResolveRequest2.method = "completionItem/resolve"; 6204 CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6205 CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); 6206 })(CompletionResolveRequest || (exports.CompletionResolveRequest = CompletionResolveRequest = {})); 6207 var HoverRequest2; 6208 (function(HoverRequest3) { 6209 HoverRequest3.method = "textDocument/hover"; 6210 HoverRequest3.messageDirection = messages_1.MessageDirection.clientToServer; 6211 HoverRequest3.type = new messages_1.ProtocolRequestType(HoverRequest3.method); 6212 })(HoverRequest2 || (exports.HoverRequest = HoverRequest2 = {})); 6213 var SignatureHelpTriggerKind; 6214 (function(SignatureHelpTriggerKind2) { 6215 SignatureHelpTriggerKind2.Invoked = 1; 6216 SignatureHelpTriggerKind2.TriggerCharacter = 2; 6217 SignatureHelpTriggerKind2.ContentChange = 3; 6218 })(SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {})); 6219 var SignatureHelpRequest2; 6220 (function(SignatureHelpRequest3) { 6221 SignatureHelpRequest3.method = "textDocument/signatureHelp"; 6222 SignatureHelpRequest3.messageDirection = messages_1.MessageDirection.clientToServer; 6223 SignatureHelpRequest3.type = new messages_1.ProtocolRequestType(SignatureHelpRequest3.method); 6224 })(SignatureHelpRequest2 || (exports.SignatureHelpRequest = SignatureHelpRequest2 = {})); 6225 var DefinitionRequest; 6226 (function(DefinitionRequest2) { 6227 DefinitionRequest2.method = "textDocument/definition"; 6228 DefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6229 DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method); 6230 })(DefinitionRequest || (exports.DefinitionRequest = DefinitionRequest = {})); 6231 var ReferencesRequest; 6232 (function(ReferencesRequest2) { 6233 ReferencesRequest2.method = "textDocument/references"; 6234 ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6235 ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); 6236 })(ReferencesRequest || (exports.ReferencesRequest = ReferencesRequest = {})); 6237 var DocumentHighlightRequest; 6238 (function(DocumentHighlightRequest2) { 6239 DocumentHighlightRequest2.method = "textDocument/documentHighlight"; 6240 DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6241 DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); 6242 })(DocumentHighlightRequest || (exports.DocumentHighlightRequest = DocumentHighlightRequest = {})); 6243 var DocumentSymbolRequest; 6244 (function(DocumentSymbolRequest2) { 6245 DocumentSymbolRequest2.method = "textDocument/documentSymbol"; 6246 DocumentSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6247 DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method); 6248 })(DocumentSymbolRequest || (exports.DocumentSymbolRequest = DocumentSymbolRequest = {})); 6249 var CodeActionRequest; 6250 (function(CodeActionRequest2) { 6251 CodeActionRequest2.method = "textDocument/codeAction"; 6252 CodeActionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6253 CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method); 6254 })(CodeActionRequest || (exports.CodeActionRequest = CodeActionRequest = {})); 6255 var CodeActionResolveRequest; 6256 (function(CodeActionResolveRequest2) { 6257 CodeActionResolveRequest2.method = "codeAction/resolve"; 6258 CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6259 CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); 6260 })(CodeActionResolveRequest || (exports.CodeActionResolveRequest = CodeActionResolveRequest = {})); 6261 var WorkspaceSymbolRequest; 6262 (function(WorkspaceSymbolRequest2) { 6263 WorkspaceSymbolRequest2.method = "workspace/symbol"; 6264 WorkspaceSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6265 WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method); 6266 })(WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {})); 6267 var WorkspaceSymbolResolveRequest; 6268 (function(WorkspaceSymbolResolveRequest2) { 6269 WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve"; 6270 WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6271 WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method); 6272 })(WorkspaceSymbolResolveRequest || (exports.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {})); 6273 var CodeLensRequest; 6274 (function(CodeLensRequest2) { 6275 CodeLensRequest2.method = "textDocument/codeLens"; 6276 CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6277 CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); 6278 })(CodeLensRequest || (exports.CodeLensRequest = CodeLensRequest = {})); 6279 var CodeLensResolveRequest; 6280 (function(CodeLensResolveRequest2) { 6281 CodeLensResolveRequest2.method = "codeLens/resolve"; 6282 CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6283 CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); 6284 })(CodeLensResolveRequest || (exports.CodeLensResolveRequest = CodeLensResolveRequest = {})); 6285 var CodeLensRefreshRequest; 6286 (function(CodeLensRefreshRequest2) { 6287 CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; 6288 CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 6289 CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); 6290 })(CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = CodeLensRefreshRequest = {})); 6291 var DocumentLinkRequest; 6292 (function(DocumentLinkRequest2) { 6293 DocumentLinkRequest2.method = "textDocument/documentLink"; 6294 DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6295 DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); 6296 })(DocumentLinkRequest || (exports.DocumentLinkRequest = DocumentLinkRequest = {})); 6297 var DocumentLinkResolveRequest; 6298 (function(DocumentLinkResolveRequest2) { 6299 DocumentLinkResolveRequest2.method = "documentLink/resolve"; 6300 DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6301 DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); 6302 })(DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {})); 6303 var DocumentFormattingRequest; 6304 (function(DocumentFormattingRequest2) { 6305 DocumentFormattingRequest2.method = "textDocument/formatting"; 6306 DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6307 DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); 6308 })(DocumentFormattingRequest || (exports.DocumentFormattingRequest = DocumentFormattingRequest = {})); 6309 var DocumentRangeFormattingRequest; 6310 (function(DocumentRangeFormattingRequest2) { 6311 DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; 6312 DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6313 DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); 6314 })(DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {})); 6315 var DocumentRangesFormattingRequest; 6316 (function(DocumentRangesFormattingRequest2) { 6317 DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting"; 6318 DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6319 DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method); 6320 })(DocumentRangesFormattingRequest || (exports.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {})); 6321 var DocumentOnTypeFormattingRequest; 6322 (function(DocumentOnTypeFormattingRequest2) { 6323 DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; 6324 DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6325 DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); 6326 })(DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {})); 6327 var PrepareSupportDefaultBehavior; 6328 (function(PrepareSupportDefaultBehavior2) { 6329 PrepareSupportDefaultBehavior2.Identifier = 1; 6330 })(PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {})); 6331 var RenameRequest; 6332 (function(RenameRequest2) { 6333 RenameRequest2.method = "textDocument/rename"; 6334 RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6335 RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); 6336 })(RenameRequest || (exports.RenameRequest = RenameRequest = {})); 6337 var PrepareRenameRequest; 6338 (function(PrepareRenameRequest2) { 6339 PrepareRenameRequest2.method = "textDocument/prepareRename"; 6340 PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6341 PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); 6342 })(PrepareRenameRequest || (exports.PrepareRenameRequest = PrepareRenameRequest = {})); 6343 var ExecuteCommandRequest; 6344 (function(ExecuteCommandRequest2) { 6345 ExecuteCommandRequest2.method = "workspace/executeCommand"; 6346 ExecuteCommandRequest2.messageDirection = messages_1.MessageDirection.clientToServer; 6347 ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method); 6348 })(ExecuteCommandRequest || (exports.ExecuteCommandRequest = ExecuteCommandRequest = {})); 6349 var ApplyWorkspaceEditRequest; 6350 (function(ApplyWorkspaceEditRequest2) { 6351 ApplyWorkspaceEditRequest2.method = "workspace/applyEdit"; 6352 ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient; 6353 ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); 6354 })(ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {})); 6355 } 6356}); 6357
vendor: 739 bytes, lines 6358-6374
6358// node_modules/vscode-languageserver-protocol/lib/common/connection.js 6359var require_connection2 = __commonJS({ 6360 "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports) { 6361 "use strict"; 6362 Object.defineProperty(exports, "__esModule", { value: true }); 6363 exports.createProtocolConnection = void 0; 6364 var vscode_jsonrpc_1 = require_main(); 6365 function createProtocolConnection(input, output, logger, options2) { 6366 if (vscode_jsonrpc_1.ConnectionStrategy.is(options2)) { 6367 options2 = { connectionStrategy: options2 }; 6368 } 6369 return (0, vscode_jsonrpc_1.createMessageConnection)(input, output, logger, options2); 6370 } 6371 exports.createProtocolConnection = createProtocolConnection; 6372 } 6373}); 6374
vendor: 1,971 bytes, lines 6375-6420
6375// node_modules/vscode-languageserver-protocol/lib/common/api.js 6376var require_api2 = __commonJS({ 6377 "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports) { 6378 "use strict"; 6379 var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k, k2) { 6380 if (k2 === void 0) 6381 k2 = k; 6382 var desc = Object.getOwnPropertyDescriptor(m2, k); 6383 if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { 6384 desc = { enumerable: true, get: function() { 6385 return m2[k]; 6386 } }; 6387 } 6388 Object.defineProperty(o2, k2, desc); 6389 } : function(o2, m2, k, k2) { 6390 if (k2 === void 0) 6391 k2 = k; 6392 o2[k2] = m2[k]; 6393 }); 6394 var __exportStar = exports && exports.__exportStar || function(m2, exports2) { 6395 for (var p2 in m2) 6396 if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2)) 6397 __createBinding(exports2, m2, p2); 6398 }; 6399 Object.defineProperty(exports, "__esModule", { value: true }); 6400 exports.LSPErrorCodes = exports.createProtocolConnection = void 0; 6401 __exportStar(require_main(), exports); 6402 __exportStar((init_main(), __toCommonJS(main_exports)), exports); 6403 __exportStar(require_messages2(), exports); 6404 __exportStar(require_protocol(), exports); 6405 var connection_1 = require_connection2(); 6406 Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function() { 6407 return connection_1.createProtocolConnection; 6408 } }); 6409 var LSPErrorCodes; 6410 (function(LSPErrorCodes2) { 6411 LSPErrorCodes2.lspReservedErrorRangeStart = -32899; 6412 LSPErrorCodes2.RequestFailed = -32803; 6413 LSPErrorCodes2.ServerCancelled = -32802; 6414 LSPErrorCodes2.ContentModified = -32801; 6415 LSPErrorCodes2.RequestCancelled = -32800; 6416 LSPErrorCodes2.lspReservedErrorRangeEnd = -32800; 6417 })(LSPErrorCodes || (exports.LSPErrorCodes = LSPErrorCodes = {})); 6418 } 6419}); 6420
vendor: 1,468 bytes, lines 6421-6456
6421// node_modules/vscode-languageserver-protocol/lib/browser/main.js 6422var require_main2 = __commonJS({ 6423 "node_modules/vscode-languageserver-protocol/lib/browser/main.js"(exports) { 6424 "use strict"; 6425 var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k, k2) { 6426 if (k2 === void 0) 6427 k2 = k; 6428 var desc = Object.getOwnPropertyDescriptor(m2, k); 6429 if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { 6430 desc = { enumerable: true, get: function() { 6431 return m2[k]; 6432 } }; 6433 } 6434 Object.defineProperty(o2, k2, desc); 6435 } : function(o2, m2, k, k2) { 6436 if (k2 === void 0) 6437 k2 = k; 6438 o2[k2] = m2[k]; 6439 }); 6440 var __exportStar = exports && exports.__exportStar || function(m2, exports2) { 6441 for (var p2 in m2) 6442 if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2)) 6443 __createBinding(exports2, m2, p2); 6444 }; 6445 Object.defineProperty(exports, "__esModule", { value: true }); 6446 exports.createProtocolConnection = void 0; 6447 var browser_1 = require_browser(); 6448 __exportStar(require_browser(), exports); 6449 __exportStar(require_api2(), exports); 6450 function createProtocolConnection(reader, writer, logger, options2) { 6451 return (0, browser_1.createMessageConnection)(reader, writer, logger, options2); 6452 } 6453 exports.createProtocolConnection = createProtocolConnection; 6454 } 6455}); 6456
vendor: 47,574 bytes, lines 6457-7397
6457// node_modules/dompurify/dist/purify.js 6458var require_purify = __commonJS({ 6459 "node_modules/dompurify/dist/purify.js"(exports, module) { 6460 (function(global, factory) { 6461 typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.DOMPurify = factory()); 6462 })(exports, function() { 6463 "use strict"; 6464 const { 6465 entries, 6466 setPrototypeOf, 6467 isFrozen, 6468 getPrototypeOf, 6469 getOwnPropertyDescriptor 6470 } = Object; 6471 let { 6472 freeze, 6473 seal, 6474 create 6475 } = Object; 6476 let { 6477 apply, 6478 construct 6479 } = typeof Reflect !== "undefined" && Reflect; 6480 if (!freeze) { 6481 freeze = function freeze2(x) { 6482 return x; 6483 }; 6484 } 6485 if (!seal) { 6486 seal = function seal2(x) { 6487 return x; 6488 }; 6489 } 6490 if (!apply) { 6491 apply = function apply2(fun, thisValue, args) { 6492 return fun.apply(thisValue, args); 6493 }; 6494 } 6495 if (!construct) { 6496 construct = function construct2(Func, args) { 6497 return new Func(...args); 6498 }; 6499 } 6500 const arrayForEach = unapply(Array.prototype.forEach); 6501 const arrayPop = unapply(Array.prototype.pop); 6502 const arrayPush = unapply(Array.prototype.push); 6503 const stringToLowerCase = unapply(String.prototype.toLowerCase); 6504 const stringToString = unapply(String.prototype.toString); 6505 const stringMatch = unapply(String.prototype.match); 6506 const stringReplace = unapply(String.prototype.replace); 6507 const stringIndexOf = unapply(String.prototype.indexOf); 6508 const stringTrim = unapply(String.prototype.trim); 6509 const regExpTest = unapply(RegExp.prototype.test); 6510 const typeErrorCreate = unconstruct(TypeError); 6511 function unapply(func) { 6512 return function(thisArg) { 6513 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 6514 args[_key - 1] = arguments[_key]; 6515 } 6516 return apply(func, thisArg, args); 6517 }; 6518 } 6519 function unconstruct(func) { 6520 return function() { 6521 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 6522 args[_key2] = arguments[_key2]; 6523 } 6524 return construct(func, args); 6525 }; 6526 } 6527 function addToSet(set, array) { 6528 let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; 6529 if (setPrototypeOf) { 6530 setPrototypeOf(set, null); 6531 } 6532 let l3 = array.length; 6533 while (l3--) { 6534 let element = array[l3]; 6535 if (typeof element === "string") { 6536 const lcElement = transformCaseFunc(element); 6537 if (lcElement !== element) { 6538 if (!isFrozen(array)) { 6539 array[l3] = lcElement; 6540 } 6541 element = lcElement; 6542 } 6543 } 6544 set[element] = true; 6545 } 6546 return set; 6547 } 6548 function clone(object) { 6549 const newObject = create(null); 6550 for (const [property, value] of entries(object)) { 6551 if (getOwnPropertyDescriptor(object, property) !== void 0) { 6552 newObject[property] = value; 6553 } 6554 } 6555 return newObject; 6556 } 6557 function lookupGetter(object, prop) { 6558 while (object !== null) { 6559 const desc = getOwnPropertyDescriptor(object, prop); 6560 if (desc) { 6561 if (desc.get) { 6562 return unapply(desc.get); 6563 } 6564 if (typeof desc.value === "function") { 6565 return unapply(desc.value); 6566 } 6567 } 6568 object = getPrototypeOf(object); 6569 } 6570 function fallbackValue(element) { 6571 console.warn("fallback value for", element); 6572 return null; 6573 } 6574 return fallbackValue; 6575 } 6576 const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); 6577 const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); 6578 const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); 6579 const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); 6580 const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]); 6581 const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); 6582 const text = freeze(["#text"]); 6583 const html2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]); 6584 const svg2 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); 6585 const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); 6586 const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); 6587 const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); 6588 const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); 6589 const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); 6590 const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); 6591 const ARIA_ATTR = seal(/^aria-[\-\w]+$/); 6592 const IS_ALLOWED_URI = seal( 6593 /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i 6594 // eslint-disable-line no-useless-escape 6595 ); 6596 const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); 6597 const ATTR_WHITESPACE = seal( 6598 /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g 6599 // eslint-disable-line no-control-regex 6600 ); 6601 const DOCTYPE_NAME = seal(/^html$/i); 6602 var EXPRESSIONS = /* @__PURE__ */ Object.freeze({ 6603 __proto__: null, 6604 MUSTACHE_EXPR, 6605 ERB_EXPR, 6606 TMPLIT_EXPR, 6607 DATA_ATTR, 6608 ARIA_ATTR, 6609 IS_ALLOWED_URI, 6610 IS_SCRIPT_OR_DATA, 6611 ATTR_WHITESPACE, 6612 DOCTYPE_NAME 6613 }); 6614 const getGlobal = function getGlobal2() { 6615 return typeof window === "undefined" ? null : window; 6616 }; 6617 const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) { 6618 if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") { 6619 return null; 6620 } 6621 let suffix = null; 6622 const ATTR_NAME = "data-tt-policy-suffix"; 6623 if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { 6624 suffix = purifyHostElement.getAttribute(ATTR_NAME); 6625 } 6626 const policyName = "dompurify" + (suffix ? "#" + suffix : ""); 6627 try { 6628 return trustedTypes.createPolicy(policyName, { 6629 createHTML(html3) { 6630 return html3; 6631 }, 6632 createScriptURL(scriptUrl) { 6633 return scriptUrl; 6634 } 6635 }); 6636 } catch (_2) { 6637 console.warn("TrustedTypes policy " + policyName + " could not be created."); 6638 return null; 6639 } 6640 }; 6641 function createDOMPurify() { 6642 let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); 6643 const DOMPurify2 = (root) => createDOMPurify(root); 6644 DOMPurify2.version = "3.0.6"; 6645 DOMPurify2.removed = []; 6646 if (!window2 || !window2.document || window2.document.nodeType !== 9) { 6647 DOMPurify2.isSupported = false; 6648 return DOMPurify2; 6649 } 6650 let { 6651 document: document2 6652 } = window2; 6653 const originalDocument = document2; 6654 const currentScript = originalDocument.currentScript; 6655 const { 6656 DocumentFragment, 6657 HTMLTemplateElement, 6658 Node, 6659 Element: Element2, 6660 NodeFilter, 6661 NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap, 6662 HTMLFormElement, 6663 DOMParser, 6664 trustedTypes 6665 } = window2; 6666 const ElementPrototype = Element2.prototype; 6667 const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); 6668 const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); 6669 const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); 6670 const getParentNode = lookupGetter(ElementPrototype, "parentNode"); 6671 if (typeof HTMLTemplateElement === "function") { 6672 const template = document2.createElement("template"); 6673 if (template.content && template.content.ownerDocument) { 6674 document2 = template.content.ownerDocument; 6675 } 6676 } 6677 let trustedTypesPolicy; 6678 let emptyHTML = ""; 6679 const { 6680 implementation, 6681 createNodeIterator, 6682 createDocumentFragment, 6683 getElementsByTagName 6684 } = document2; 6685 const { 6686 importNode 6687 } = originalDocument; 6688 let hooks = {}; 6689 DOMPurify2.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; 6690 const { 6691 MUSTACHE_EXPR: MUSTACHE_EXPR2, 6692 ERB_EXPR: ERB_EXPR2, 6693 TMPLIT_EXPR: TMPLIT_EXPR2, 6694 DATA_ATTR: DATA_ATTR2, 6695 ARIA_ATTR: ARIA_ATTR2, 6696 IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2, 6697 ATTR_WHITESPACE: ATTR_WHITESPACE2 6698 } = EXPRESSIONS; 6699 let { 6700 IS_ALLOWED_URI: IS_ALLOWED_URI$1 6701 } = EXPRESSIONS; 6702 let ALLOWED_TAGS = null; 6703 const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); 6704 let ALLOWED_ATTR = null; 6705 const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html2, ...svg2, ...mathMl, ...xml]); 6706 let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { 6707 tagNameCheck: { 6708 writable: true, 6709 configurable: false, 6710 enumerable: true, 6711 value: null 6712 }, 6713 attributeNameCheck: { 6714 writable: true, 6715 configurable: false, 6716 enumerable: true, 6717 value: null 6718 }, 6719 allowCustomizedBuiltInElements: { 6720 writable: true, 6721 configurable: false, 6722 enumerable: true, 6723 value: false 6724 } 6725 })); 6726 let FORBID_TAGS = null; 6727 let FORBID_ATTR = null; 6728 let ALLOW_ARIA_ATTR = true; 6729 let ALLOW_DATA_ATTR = true; 6730 let ALLOW_UNKNOWN_PROTOCOLS = false; 6731 let ALLOW_SELF_CLOSE_IN_ATTR = true; 6732 let SAFE_FOR_TEMPLATES = false; 6733 let WHOLE_DOCUMENT = false; 6734 let SET_CONFIG = false; 6735 let FORCE_BODY = false; 6736 let RETURN_DOM = false; 6737 let RETURN_DOM_FRAGMENT = false; 6738 let RETURN_TRUSTED_TYPE = false; 6739 let SANITIZE_DOM = true; 6740 let SANITIZE_NAMED_PROPS = false; 6741 const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; 6742 let KEEP_CONTENT = true; 6743 let IN_PLACE = false; 6744 let USE_PROFILES = {}; 6745 let FORBID_CONTENTS = null; 6746 const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); 6747 let DATA_URI_TAGS = null; 6748 const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); 6749 let URI_SAFE_ATTRIBUTES = null; 6750 const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); 6751 const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; 6752 const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; 6753 const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; 6754 let NAMESPACE = HTML_NAMESPACE; 6755 let IS_EMPTY_INPUT = false; 6756 let ALLOWED_NAMESPACES = null; 6757 const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); 6758 let PARSER_MEDIA_TYPE = null; 6759 const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; 6760 const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; 6761 let transformCaseFunc = null; 6762 let CONFIG = null; 6763 const formElement = document2.createElement("form"); 6764 const isRegexOrFunction = function isRegexOrFunction2(testValue) { 6765 return testValue instanceof RegExp || testValue instanceof Function; 6766 }; 6767 const _parseConfig = function _parseConfig2() { 6768 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 6769 if (CONFIG && CONFIG === cfg) { 6770 return; 6771 } 6772 if (!cfg || typeof cfg !== "object") { 6773 cfg = {}; 6774 } 6775 cfg = clone(cfg); 6776 PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes 6777 SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; 6778 transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; 6779 ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; 6780 ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; 6781 ALLOWED_NAMESPACES = "ALLOWED_NAMESPACES" in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; 6782 URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet( 6783 clone(DEFAULT_URI_SAFE_ATTRIBUTES), 6784 // eslint-disable-line indent 6785 cfg.ADD_URI_SAFE_ATTR, 6786 // eslint-disable-line indent 6787 transformCaseFunc 6788 // eslint-disable-line indent 6789 ) : DEFAULT_URI_SAFE_ATTRIBUTES; 6790 DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet( 6791 clone(DEFAULT_DATA_URI_TAGS), 6792 // eslint-disable-line indent 6793 cfg.ADD_DATA_URI_TAGS, 6794 // eslint-disable-line indent 6795 transformCaseFunc 6796 // eslint-disable-line indent 6797 ) : DEFAULT_DATA_URI_TAGS; 6798 FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; 6799 FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; 6800 FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; 6801 USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false; 6802 ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; 6803 ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; 6804 ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; 6805 ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; 6806 SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; 6807 WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; 6808 RETURN_DOM = cfg.RETURN_DOM || false; 6809 RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; 6810 RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; 6811 FORCE_BODY = cfg.FORCE_BODY || false; 6812 SANITIZE_DOM = cfg.SANITIZE_DOM !== false; 6813 SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; 6814 KEEP_CONTENT = cfg.KEEP_CONTENT !== false; 6815 IN_PLACE = cfg.IN_PLACE || false; 6816 IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; 6817 NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; 6818 CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; 6819 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { 6820 CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; 6821 } 6822 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { 6823 CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; 6824 } 6825 if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { 6826 CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; 6827 } 6828 if (SAFE_FOR_TEMPLATES) { 6829 ALLOW_DATA_ATTR = false; 6830 } 6831 if (RETURN_DOM_FRAGMENT) { 6832 RETURN_DOM = true; 6833 } 6834 if (USE_PROFILES) { 6835 ALLOWED_TAGS = addToSet({}, [...text]); 6836 ALLOWED_ATTR = []; 6837 if (USE_PROFILES.html === true) { 6838 addToSet(ALLOWED_TAGS, html$1); 6839 addToSet(ALLOWED_ATTR, html2); 6840 } 6841 if (USE_PROFILES.svg === true) { 6842 addToSet(ALLOWED_TAGS, svg$1); 6843 addToSet(ALLOWED_ATTR, svg2); 6844 addToSet(ALLOWED_ATTR, xml); 6845 } 6846 if (USE_PROFILES.svgFilters === true) { 6847 addToSet(ALLOWED_TAGS, svgFilters); 6848 addToSet(ALLOWED_ATTR, svg2); 6849 addToSet(ALLOWED_ATTR, xml); 6850 } 6851 if (USE_PROFILES.mathMl === true) { 6852 addToSet(ALLOWED_TAGS, mathMl$1); 6853 addToSet(ALLOWED_ATTR, mathMl); 6854 addToSet(ALLOWED_ATTR, xml); 6855 } 6856 } 6857 if (cfg.ADD_TAGS) { 6858 if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { 6859 ALLOWED_TAGS = clone(ALLOWED_TAGS); 6860 } 6861 addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); 6862 } 6863 if (cfg.ADD_ATTR) { 6864 if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { 6865 ALLOWED_ATTR = clone(ALLOWED_ATTR); 6866 } 6867 addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); 6868 } 6869 if (cfg.ADD_URI_SAFE_ATTR) { 6870 addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); 6871 } 6872 if (cfg.FORBID_CONTENTS) { 6873 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { 6874 FORBID_CONTENTS = clone(FORBID_CONTENTS); 6875 } 6876 addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); 6877 } 6878 if (KEEP_CONTENT) { 6879 ALLOWED_TAGS["#text"] = true; 6880 } 6881 if (WHOLE_DOCUMENT) { 6882 addToSet(ALLOWED_TAGS, ["html", "head", "body"]); 6883 } 6884 if (ALLOWED_TAGS.table) { 6885 addToSet(ALLOWED_TAGS, ["tbody"]); 6886 delete FORBID_TAGS.tbody; 6887 } 6888 if (cfg.TRUSTED_TYPES_POLICY) { 6889 if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") { 6890 throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); 6891 } 6892 if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") { 6893 throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); 6894 } 6895 trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; 6896 emptyHTML = trustedTypesPolicy.createHTML(""); 6897 } else { 6898 if (trustedTypesPolicy === void 0) { 6899 trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); 6900 } 6901 if (trustedTypesPolicy !== null && typeof emptyHTML === "string") { 6902 emptyHTML = trustedTypesPolicy.createHTML(""); 6903 } 6904 } 6905 if (freeze) { 6906 freeze(cfg); 6907 } 6908 CONFIG = cfg; 6909 }; 6910 const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); 6911 const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]); 6912 const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); 6913 const ALL_SVG_TAGS = addToSet({}, svg$1); 6914 addToSet(ALL_SVG_TAGS, svgFilters); 6915 addToSet(ALL_SVG_TAGS, svgDisallowed); 6916 const ALL_MATHML_TAGS = addToSet({}, mathMl$1); 6917 addToSet(ALL_MATHML_TAGS, mathMlDisallowed); 6918 const _checkValidNamespace = function _checkValidNamespace2(element) { 6919 let parent = getParentNode(element); 6920 if (!parent || !parent.tagName) { 6921 parent = { 6922 namespaceURI: NAMESPACE, 6923 tagName: "template" 6924 }; 6925 } 6926 const tagName = stringToLowerCase(element.tagName); 6927 const parentTagName = stringToLowerCase(parent.tagName); 6928 if (!ALLOWED_NAMESPACES[element.namespaceURI]) { 6929 return false; 6930 } 6931 if (element.namespaceURI === SVG_NAMESPACE) { 6932 if (parent.namespaceURI === HTML_NAMESPACE) { 6933 return tagName === "svg"; 6934 } 6935 if (parent.namespaceURI === MATHML_NAMESPACE) { 6936 return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); 6937 } 6938 return Boolean(ALL_SVG_TAGS[tagName]); 6939 } 6940 if (element.namespaceURI === MATHML_NAMESPACE) { 6941 if (parent.namespaceURI === HTML_NAMESPACE) { 6942 return tagName === "math"; 6943 } 6944 if (parent.namespaceURI === SVG_NAMESPACE) { 6945 return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; 6946 } 6947 return Boolean(ALL_MATHML_TAGS[tagName]); 6948 } 6949 if (element.namespaceURI === HTML_NAMESPACE) { 6950 if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { 6951 return false; 6952 } 6953 if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { 6954 return false; 6955 } 6956 return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); 6957 } 6958 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) { 6959 return true; 6960 } 6961 return false; 6962 }; 6963 const _forceRemove = function _forceRemove2(node) { 6964 arrayPush(DOMPurify2.removed, { 6965 element: node 6966 }); 6967 try { 6968 node.parentNode.removeChild(node); 6969 } catch (_2) { 6970 node.remove(); 6971 } 6972 }; 6973 const _removeAttribute = function _removeAttribute2(name2, node) { 6974 try { 6975 arrayPush(DOMPurify2.removed, { 6976 attribute: node.getAttributeNode(name2), 6977 from: node 6978 }); 6979 } catch (_2) { 6980 arrayPush(DOMPurify2.removed, { 6981 attribute: null, 6982 from: node 6983 }); 6984 } 6985 node.removeAttribute(name2); 6986 if (name2 === "is" && !ALLOWED_ATTR[name2]) { 6987 if (RETURN_DOM || RETURN_DOM_FRAGMENT) { 6988 try { 6989 _forceRemove(node); 6990 } catch (_2) { 6991 } 6992 } else { 6993 try { 6994 node.setAttribute(name2, ""); 6995 } catch (_2) { 6996 } 6997 } 6998 } 6999 }; 7000 const _initDocument = function _initDocument2(dirty) { 7001 let doc2 = null; 7002 let leadingWhitespace = null; 7003 if (FORCE_BODY) { 7004 dirty = "<remove></remove>" + dirty; 7005 } else { 7006 const matches = stringMatch(dirty, /^[\r\n\t ]+/); 7007 leadingWhitespace = matches && matches[0]; 7008 } 7009 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) { 7010 dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>"; 7011 } 7012 const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; 7013 if (NAMESPACE === HTML_NAMESPACE) { 7014 try { 7015 doc2 = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); 7016 } catch (_2) { 7017 } 7018 } 7019 if (!doc2 || !doc2.documentElement) { 7020 doc2 = implementation.createDocument(NAMESPACE, "template", null); 7021 try { 7022 doc2.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; 7023 } catch (_2) { 7024 } 7025 } 7026 const body = doc2.body || doc2.documentElement; 7027 if (dirty && leadingWhitespace) { 7028 body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null); 7029 } 7030 if (NAMESPACE === HTML_NAMESPACE) { 7031 return getElementsByTagName.call(doc2, WHOLE_DOCUMENT ? "html" : "body")[0]; 7032 } 7033 return WHOLE_DOCUMENT ? doc2.documentElement : body; 7034 }; 7035 const _createNodeIterator = function _createNodeIterator2(root) { 7036 return createNodeIterator.call( 7037 root.ownerDocument || root, 7038 root, 7039 // eslint-disable-next-line no-bitwise 7040 NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, 7041 null 7042 ); 7043 }; 7044 const _isClobbered = function _isClobbered2(elm) { 7045 return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function"); 7046 }; 7047 const _isNode = function _isNode2(object) { 7048 return typeof Node === "function" && object instanceof Node; 7049 }; 7050 const _executeHook = function _executeHook2(entryPoint, currentNode, data) { 7051 if (!hooks[entryPoint]) { 7052 return; 7053 } 7054 arrayForEach(hooks[entryPoint], (hook) => { 7055 hook.call(DOMPurify2, currentNode, data, CONFIG); 7056 }); 7057 }; 7058 const _sanitizeElements = function _sanitizeElements2(currentNode) { 7059 let content2 = null; 7060 _executeHook("beforeSanitizeElements", currentNode, null); 7061 if (_isClobbered(currentNode)) { 7062 _forceRemove(currentNode); 7063 return true; 7064 } 7065 const tagName = transformCaseFunc(currentNode.nodeName); 7066 _executeHook("uponSanitizeElement", currentNode, { 7067 tagName, 7068 allowedTags: ALLOWED_TAGS 7069 }); 7070 if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { 7071 _forceRemove(currentNode); 7072 return true; 7073 } 7074 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { 7075 if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { 7076 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { 7077 return false; 7078 } 7079 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) { 7080 return false; 7081 } 7082 } 7083 if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { 7084 const parentNode = getParentNode(currentNode) || currentNode.parentNode; 7085 const childNodes = getChildNodes(currentNode) || currentNode.childNodes; 7086 if (childNodes && parentNode) { 7087 const childCount = childNodes.length; 7088 for (let i2 = childCount - 1; i2 >= 0; --i2) { 7089 parentNode.insertBefore(cloneNode(childNodes[i2], true), getNextSibling(currentNode)); 7090 } 7091 } 7092 } 7093 _forceRemove(currentNode); 7094 return true; 7095 } 7096 if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) { 7097 _forceRemove(currentNode); 7098 return true; 7099 } 7100 if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { 7101 _forceRemove(currentNode); 7102 return true; 7103 } 7104 if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) { 7105 content2 = currentNode.textContent; 7106 arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { 7107 content2 = stringReplace(content2, expr, " "); 7108 }); 7109 if (currentNode.textContent !== content2) { 7110 arrayPush(DOMPurify2.removed, { 7111 element: currentNode.cloneNode() 7112 }); 7113 currentNode.textContent = content2; 7114 } 7115 } 7116 _executeHook("afterSanitizeElements", currentNode, null); 7117 return false; 7118 }; 7119 const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) { 7120 if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) { 7121 return false; 7122 } 7123 if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) 7124 ; 7125 else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) 7126 ; 7127 else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { 7128 if ( 7129 // First condition does a very basic check if a) it's basically a valid custom element tagname AND 7130 // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck 7131 // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck 7132 _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND 7133 // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck 7134 lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)) 7135 ) 7136 ; 7137 else { 7138 return false; 7139 } 7140 } else if (URI_SAFE_ATTRIBUTES[lcName]) 7141 ; 7142 else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) 7143 ; 7144 else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) 7145 ; 7146 else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) 7147 ; 7148 else if (value) { 7149 return false; 7150 } else 7151 ; 7152 return true; 7153 }; 7154 const _isBasicCustomElement = function _isBasicCustomElement2(tagName) { 7155 return tagName.indexOf("-") > 0; 7156 }; 7157 const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) { 7158 _executeHook("beforeSanitizeAttributes", currentNode, null); 7159 const { 7160 attributes 7161 } = currentNode; 7162 if (!attributes) { 7163 return; 7164 } 7165 const hookEvent = { 7166 attrName: "", 7167 attrValue: "", 7168 keepAttr: true, 7169 allowedAttributes: ALLOWED_ATTR 7170 }; 7171 let l3 = attributes.length; 7172 while (l3--) { 7173 const attr = attributes[l3]; 7174 const { 7175 name: name2, 7176 namespaceURI, 7177 value: attrValue 7178 } = attr; 7179 const lcName = transformCaseFunc(name2); 7180 let value = name2 === "value" ? attrValue : stringTrim(attrValue); 7181 hookEvent.attrName = lcName; 7182 hookEvent.attrValue = value; 7183 hookEvent.keepAttr = true; 7184 hookEvent.forceKeepAttr = void 0; 7185 _executeHook("uponSanitizeAttribute", currentNode, hookEvent); 7186 value = hookEvent.attrValue; 7187 if (hookEvent.forceKeepAttr) { 7188 continue; 7189 } 7190 _removeAttribute(name2, currentNode); 7191 if (!hookEvent.keepAttr) { 7192 continue; 7193 } 7194 if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { 7195 _removeAttribute(name2, currentNode); 7196 continue; 7197 } 7198 if (SAFE_FOR_TEMPLATES) { 7199 arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { 7200 value = stringReplace(value, expr, " "); 7201 }); 7202 } 7203 const lcTag = transformCaseFunc(currentNode.nodeName); 7204 if (!_isValidAttribute(lcTag, lcName, value)) { 7205 continue; 7206 } 7207 if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) { 7208 _removeAttribute(name2, currentNode); 7209 value = SANITIZE_NAMED_PROPS_PREFIX + value; 7210 } 7211 if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") { 7212 if (namespaceURI) 7213 ; 7214 else { 7215 switch (trustedTypes.getAttributeType(lcTag, lcName)) { 7216 case "TrustedHTML": { 7217 value = trustedTypesPolicy.createHTML(value); 7218 break; 7219 } 7220 case "TrustedScriptURL": { 7221 value = trustedTypesPolicy.createScriptURL(value); 7222 break; 7223 } 7224 } 7225 } 7226 } 7227 try { 7228 if (namespaceURI) { 7229 currentNode.setAttributeNS(namespaceURI, name2, value); 7230 } else { 7231 currentNode.setAttribute(name2, value); 7232 } 7233 arrayPop(DOMPurify2.removed); 7234 } catch (_2) { 7235 } 7236 } 7237 _executeHook("afterSanitizeAttributes", currentNode, null); 7238 }; 7239 const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) { 7240 let shadowNode = null; 7241 const shadowIterator = _createNodeIterator(fragment); 7242 _executeHook("beforeSanitizeShadowDOM", fragment, null); 7243 while (shadowNode = shadowIterator.nextNode()) { 7244 _executeHook("uponSanitizeShadowNode", shadowNode, null); 7245 if (_sanitizeElements(shadowNode)) { 7246 continue; 7247 } 7248 if (shadowNode.content instanceof DocumentFragment) { 7249 _sanitizeShadowDOM2(shadowNode.content); 7250 } 7251 _sanitizeAttributes(shadowNode); 7252 } 7253 _executeHook("afterSanitizeShadowDOM", fragment, null); 7254 }; 7255 DOMPurify2.sanitize = function(dirty) { 7256 let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 7257 let body = null; 7258 let importedNode = null; 7259 let currentNode = null; 7260 let returnNode = null; 7261 IS_EMPTY_INPUT = !dirty; 7262 if (IS_EMPTY_INPUT) { 7263 dirty = "<!-->"; 7264 } 7265 if (typeof dirty !== "string" && !_isNode(dirty)) { 7266 if (typeof dirty.toString === "function") { 7267 dirty = dirty.toString(); 7268 if (typeof dirty !== "string") { 7269 throw typeErrorCreate("dirty is not a string, aborting"); 7270 } 7271 } else { 7272 throw typeErrorCreate("toString is not a function"); 7273 } 7274 } 7275 if (!DOMPurify2.isSupported) { 7276 return dirty; 7277 } 7278 if (!SET_CONFIG) { 7279 _parseConfig(cfg); 7280 } 7281 DOMPurify2.removed = []; 7282 if (typeof dirty === "string") { 7283 IN_PLACE = false; 7284 } 7285 if (IN_PLACE) { 7286 if (dirty.nodeName) { 7287 const tagName = transformCaseFunc(dirty.nodeName); 7288 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { 7289 throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place"); 7290 } 7291 } 7292 } else if (dirty instanceof Node) { 7293 body = _initDocument("<!---->"); 7294 importedNode = body.ownerDocument.importNode(dirty, true); 7295 if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") { 7296 body = importedNode; 7297 } else if (importedNode.nodeName === "HTML") { 7298 body = importedNode; 7299 } else { 7300 body.appendChild(importedNode); 7301 } 7302 } else { 7303 if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes 7304 dirty.indexOf("<") === -1) { 7305 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; 7306 } 7307 body = _initDocument(dirty); 7308 if (!body) { 7309 return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ""; 7310 } 7311 } 7312 if (body && FORCE_BODY) { 7313 _forceRemove(body.firstChild); 7314 } 7315 const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); 7316 while (currentNode = nodeIterator.nextNode()) { 7317 if (_sanitizeElements(currentNode)) { 7318 continue; 7319 } 7320 if (currentNode.content instanceof DocumentFragment) { 7321 _sanitizeShadowDOM(currentNode.content); 7322 } 7323 _sanitizeAttributes(currentNode); 7324 } 7325 if (IN_PLACE) { 7326 return dirty; 7327 } 7328 if (RETURN_DOM) { 7329 if (RETURN_DOM_FRAGMENT) { 7330 returnNode = createDocumentFragment.call(body.ownerDocument); 7331 while (body.firstChild) { 7332 returnNode.appendChild(body.firstChild); 7333 } 7334 } else { 7335 returnNode = body; 7336 } 7337 if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) { 7338 returnNode = importNode.call(originalDocument, returnNode, true); 7339 } 7340 return returnNode; 7341 } 7342 let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; 7343 if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { 7344 serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML; 7345 } 7346 if (SAFE_FOR_TEMPLATES) { 7347 arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { 7348 serializedHTML = stringReplace(serializedHTML, expr, " "); 7349 }); 7350 } 7351 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; 7352 }; 7353 DOMPurify2.setConfig = function() { 7354 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 7355 _parseConfig(cfg); 7356 SET_CONFIG = true; 7357 }; 7358 DOMPurify2.clearConfig = function() { 7359 CONFIG = null; 7360 SET_CONFIG = false; 7361 }; 7362 DOMPurify2.isValidAttribute = function(tag, attr, value) { 7363 if (!CONFIG) { 7364 _parseConfig({}); 7365 } 7366 const lcTag = transformCaseFunc(tag); 7367 const lcName = transformCaseFunc(attr); 7368 return _isValidAttribute(lcTag, lcName, value); 7369 }; 7370 DOMPurify2.addHook = function(entryPoint, hookFunction) { 7371 if (typeof hookFunction !== "function") { 7372 return; 7373 } 7374 hooks[entryPoint] = hooks[entryPoint] || []; 7375 arrayPush(hooks[entryPoint], hookFunction); 7376 }; 7377 DOMPurify2.removeHook = function(entryPoint) { 7378 if (hooks[entryPoint]) { 7379 return arrayPop(hooks[entryPoint]); 7380 } 7381 }; 7382 DOMPurify2.removeHooks = function(entryPoint) { 7383 if (hooks[entryPoint]) { 7384 hooks[entryPoint] = []; 7385 } 7386 }; 7387 DOMPurify2.removeAllHooks = function() { 7388 hooks = {}; 7389 }; 7390 return DOMPurify2; 7391 } 7392 var purify = createDOMPurify(); 7393 return purify; 7394 }); 7395 } 7396}); 7397
vendor: 113,150 bytes, lines 7398-10756
7398// node_modules/@codemirror/state/dist/index.js 7399var Text2 = class _Text { 7400 /** 7401 Get the line description around the given position. 7402 */ 7403 lineAt(pos) { 7404 if (pos < 0 || pos > this.length) 7405 throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`); 7406 return this.lineInner(pos, false, 1, 0); 7407 } 7408 /** 7409 Get the description for the given (1-based) line number. 7410 */ 7411 line(n3) { 7412 if (n3 < 1 || n3 > this.lines) 7413 throw new RangeError(`Invalid line number ${n3} in ${this.lines}-line document`); 7414 return this.lineInner(n3, true, 1, 0); 7415 } 7416 /** 7417 Replace a range of the text with the given content. 7418 */ 7419 replace(from, to, text) { 7420 let parts = []; 7421 this.decompose( 7422 0, 7423 from, 7424 parts, 7425 2 7426 /* Open.To */ 7427 ); 7428 if (text.length) 7429 text.decompose( 7430 0, 7431 text.length, 7432 parts, 7433 1 | 2 7434 /* Open.To */ 7435 ); 7436 this.decompose( 7437 to, 7438 this.length, 7439 parts, 7440 1 7441 /* Open.From */ 7442 ); 7443 return TextNode.from(parts, this.length - (to - from) + text.length); 7444 } 7445 /** 7446 Append another document to this one. 7447 */ 7448 append(other) { 7449 return this.replace(this.length, this.length, other); 7450 } 7451 /** 7452 Retrieve the text between the given points. 7453 */ 7454 slice(from, to = this.length) { 7455 let parts = []; 7456 this.decompose(from, to, parts, 0); 7457 return TextNode.from(parts, to - from); 7458 } 7459 /** 7460 Test whether this text is equal to another instance. 7461 */ 7462 eq(other) { 7463 if (other == this) 7464 return true; 7465 if (other.length != this.length || other.lines != this.lines) 7466 return false; 7467 let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1); 7468 let a2 = new RawTextCursor(this), b3 = new RawTextCursor(other); 7469 for (let skip = start, pos = start; ; ) { 7470 a2.next(skip); 7471 b3.next(skip); 7472 skip = 0; 7473 if (a2.lineBreak != b3.lineBreak || a2.done != b3.done || a2.value != b3.value) 7474 return false; 7475 pos += a2.value.length; 7476 if (a2.done || pos >= end) 7477 return true; 7478 } 7479 } 7480 /** 7481 Iterate over the text. When `dir` is `-1`, iteration happens 7482 from end to start. This will return lines and the breaks between 7483 them as separate strings. 7484 */ 7485 iter(dir = 1) { 7486 return new RawTextCursor(this, dir); 7487 } 7488 /** 7489 Iterate over a range of the text. When `from` > `to`, the 7490 iterator will run in reverse. 7491 */ 7492 iterRange(from, to = this.length) { 7493 return new PartialTextCursor(this, from, to); 7494 } 7495 /** 7496 Return a cursor that iterates over the given range of lines, 7497 _without_ returning the line breaks between, and yielding empty 7498 strings for empty lines. 7499 7500 When `from` and `to` are given, they should be 1-based line numbers. 7501 */ 7502 iterLines(from, to) { 7503 let inner; 7504 if (from == null) { 7505 inner = this.iter(); 7506 } else { 7507 if (to == null) 7508 to = this.lines + 1; 7509 let start = this.line(from).from; 7510 inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to)); 7511 } 7512 return new LineCursor(inner); 7513 } 7514 /** 7515 Return the document as a string, using newline characters to 7516 separate lines. 7517 */ 7518 toString() { 7519 return this.sliceString(0); 7520 } 7521 /** 7522 Convert the document to an array of lines (which can be 7523 deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). 7524 */ 7525 toJSON() { 7526 let lines = []; 7527 this.flatten(lines); 7528 return lines; 7529 } 7530 /** 7531 @internal 7532 */ 7533 constructor() { 7534 } 7535 /** 7536 Create a `Text` instance for the given array of lines. 7537 */ 7538 static of(text) { 7539 if (text.length == 0) 7540 throw new RangeError("A document must have at least one line"); 7541 if (text.length == 1 && !text[0]) 7542 return _Text.empty; 7543 return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, [])); 7544 } 7545}; 7546var TextLeaf = class _TextLeaf extends Text2 { 7547 constructor(text, length = textLength(text)) { 7548 super(); 7549 this.text = text; 7550 this.length = length; 7551 } 7552 get lines() { 7553 return this.text.length; 7554 } 7555 get children() { 7556 return null; 7557 } 7558 lineInner(target, isLine, line, offset) { 7559 for (let i2 = 0; ; i2++) { 7560 let string2 = this.text[i2], end = offset + string2.length; 7561 if ((isLine ? line : end) >= target) 7562 return new Line(offset, end, line, string2); 7563 offset = end + 1; 7564 line++; 7565 } 7566 } 7567 decompose(from, to, target, open) { 7568 let text = from <= 0 && to >= this.length ? this : new _TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from)); 7569 if (open & 1) { 7570 let prev = target.pop(); 7571 let joined = appendText(text.text, prev.text.slice(), 0, text.length); 7572 if (joined.length <= 32) { 7573 target.push(new _TextLeaf(joined, prev.length + text.length)); 7574 } else { 7575 let mid = joined.length >> 1; 7576 target.push(new _TextLeaf(joined.slice(0, mid)), new _TextLeaf(joined.slice(mid))); 7577 } 7578 } else { 7579 target.push(text); 7580 } 7581 } 7582 replace(from, to, text) { 7583 if (!(text instanceof _TextLeaf)) 7584 return super.replace(from, to, text); 7585 let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to); 7586 let newLen = this.length + text.length - (to - from); 7587 if (lines.length <= 32) 7588 return new _TextLeaf(lines, newLen); 7589 return TextNode.from(_TextLeaf.split(lines, []), newLen); 7590 } 7591 sliceString(from, to = this.length, lineSep = "\n") { 7592 let result = ""; 7593 for (let pos = 0, i2 = 0; pos <= to && i2 < this.text.length; i2++) { 7594 let line = this.text[i2], end = pos + line.length; 7595 if (pos > from && i2) 7596 result += lineSep; 7597 if (from < end && to > pos) 7598 result += line.slice(Math.max(0, from - pos), to - pos); 7599 pos = end + 1; 7600 } 7601 return result; 7602 } 7603 flatten(target) { 7604 for (let line of this.text) 7605 target.push(line); 7606 } 7607 scanIdentical() { 7608 return 0; 7609 } 7610 static split(text, target) { 7611 let part = [], len = -1; 7612 for (let line of text) { 7613 part.push(line); 7614 len += line.length + 1; 7615 if (part.length == 32) { 7616 target.push(new _TextLeaf(part, len)); 7617 part = []; 7618 len = -1; 7619 } 7620 } 7621 if (len > -1) 7622 target.push(new _TextLeaf(part, len)); 7623 return target; 7624 } 7625}; 7626var TextNode = class _TextNode extends Text2 { 7627 constructor(children, length) { 7628 super(); 7629 this.children = children; 7630 this.length = length; 7631 this.lines = 0; 7632 for (let child of children) 7633 this.lines += child.lines; 7634 } 7635 lineInner(target, isLine, line, offset) { 7636 for (let i2 = 0; ; i2++) { 7637 let child = this.children[i2], end = offset + child.length, endLine = line + child.lines - 1; 7638 if ((isLine ? endLine : end) >= target) 7639 return child.lineInner(target, isLine, line, offset); 7640 offset = end + 1; 7641 line = endLine + 1; 7642 } 7643 } 7644 decompose(from, to, target, open) { 7645 for (let i2 = 0, pos = 0; pos <= to && i2 < this.children.length; i2++) { 7646 let child = this.children[i2], end = pos + child.length; 7647 if (from <= end && to >= pos) { 7648 let childOpen = open & ((pos <= from ? 1 : 0) | (end >= to ? 2 : 0)); 7649 if (pos >= from && end <= to && !childOpen) 7650 target.push(child); 7651 else 7652 child.decompose(from - pos, to - pos, target, childOpen); 7653 } 7654 pos = end + 1; 7655 } 7656 } 7657 replace(from, to, text) { 7658 if (text.lines < this.lines) 7659 for (let i2 = 0, pos = 0; i2 < this.children.length; i2++) { 7660 let child = this.children[i2], end = pos + child.length; 7661 if (from >= pos && to <= end) { 7662 let updated = child.replace(from - pos, to - pos, text); 7663 let totalLines = this.lines - child.lines + updated.lines; 7664 if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) { 7665 let copy = this.children.slice(); 7666 copy[i2] = updated; 7667 return new _TextNode(copy, this.length - (to - from) + text.length); 7668 } 7669 return super.replace(pos, end, updated); 7670 } 7671 pos = end + 1; 7672 } 7673 return super.replace(from, to, text); 7674 } 7675 sliceString(from, to = this.length, lineSep = "\n") { 7676 let result = ""; 7677 for (let i2 = 0, pos = 0; i2 < this.children.length && pos <= to; i2++) { 7678 let child = this.children[i2], end = pos + child.length; 7679 if (pos > from && i2) 7680 result += lineSep; 7681 if (from < end && to > pos) 7682 result += child.sliceString(from - pos, to - pos, lineSep); 7683 pos = end + 1; 7684 } 7685 return result; 7686 } 7687 flatten(target) { 7688 for (let child of this.children) 7689 child.flatten(target); 7690 } 7691 scanIdentical(other, dir) { 7692 if (!(other instanceof _TextNode)) 7693 return 0; 7694 let length = 0; 7695 let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length] : [this.children.length - 1, other.children.length - 1, -1, -1]; 7696 for (; ; iA += dir, iB += dir) { 7697 if (iA == eA || iB == eB) 7698 return length; 7699 let chA = this.children[iA], chB = other.children[iB]; 7700 if (chA != chB) 7701 return length + chA.scanIdentical(chB, dir); 7702 length += chA.length + 1; 7703 } 7704 } 7705 static from(children, length = children.reduce((l3, ch) => l3 + ch.length + 1, -1)) { 7706 let lines = 0; 7707 for (let ch of children) 7708 lines += ch.lines; 7709 if (lines < 32) { 7710 let flat = []; 7711 for (let ch of children) 7712 ch.flatten(flat); 7713 return new TextLeaf(flat, length); 7714 } 7715 let chunk = Math.max( 7716 32, 7717 lines >> 5 7718 /* Tree.BranchShift */ 7719 ), maxChunk = chunk << 1, minChunk = chunk >> 1; 7720 let chunked = [], currentLines = 0, currentLen = -1, currentChunk = []; 7721 function add2(child) { 7722 let last; 7723 if (child.lines > maxChunk && child instanceof _TextNode) { 7724 for (let node of child.children) 7725 add2(node); 7726 } else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) { 7727 flush(); 7728 chunked.push(child); 7729 } else if (child instanceof TextLeaf && currentLines && (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && child.lines + last.lines <= 32) { 7730 currentLines += child.lines; 7731 currentLen += child.length + 1; 7732 currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length); 7733 } else { 7734 if (currentLines + child.lines > chunk) 7735 flush(); 7736 currentLines += child.lines; 7737 currentLen += child.length + 1; 7738 currentChunk.push(child); 7739 } 7740 } 7741 function flush() { 7742 if (currentLines == 0) 7743 return; 7744 chunked.push(currentChunk.length == 1 ? currentChunk[0] : _TextNode.from(currentChunk, currentLen)); 7745 currentLen = -1; 7746 currentLines = currentChunk.length = 0; 7747 } 7748 for (let child of children) 7749 add2(child); 7750 flush(); 7751 return chunked.length == 1 ? chunked[0] : new _TextNode(chunked, length); 7752 } 7753}; 7754Text2.empty = /* @__PURE__ */ new TextLeaf([""], 0); 7755function textLength(text) { 7756 let length = -1; 7757 for (let line of text) 7758 length += line.length + 1; 7759 return length; 7760} 7761function appendText(text, target, from = 0, to = 1e9) { 7762 for (let pos = 0, i2 = 0, first = true; i2 < text.length && pos <= to; i2++) { 7763 let line = text[i2], end = pos + line.length; 7764 if (end >= from) { 7765 if (end > to) 7766 line = line.slice(0, to - pos); 7767 if (pos < from) 7768 line = line.slice(from - pos); 7769 if (first) { 7770 target[target.length - 1] += line; 7771 first = false; 7772 } else 7773 target.push(line); 7774 } 7775 pos = end + 1; 7776 } 7777 return target; 7778} 7779function sliceText(text, from, to) { 7780 return appendText(text, [""], from, to); 7781} 7782var RawTextCursor = class { 7783 constructor(text, dir = 1) { 7784 this.dir = dir; 7785 this.done = false; 7786 this.lineBreak = false; 7787 this.value = ""; 7788 this.nodes = [text]; 7789 this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1]; 7790 } 7791 nextInner(skip, dir) { 7792 this.done = this.lineBreak = false; 7793 for (; ; ) { 7794 let last = this.nodes.length - 1; 7795 let top2 = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1; 7796 let size = top2 instanceof TextLeaf ? top2.text.length : top2.children.length; 7797 if (offset == (dir > 0 ? size : 0)) { 7798 if (last == 0) { 7799 this.done = true; 7800 this.value = ""; 7801 return this; 7802 } 7803 if (dir > 0) 7804 this.offsets[last - 1]++; 7805 this.nodes.pop(); 7806 this.offsets.pop(); 7807 } else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) { 7808 this.offsets[last] += dir; 7809 if (skip == 0) { 7810 this.lineBreak = true; 7811 this.value = "\n"; 7812 return this; 7813 } 7814 skip--; 7815 } else if (top2 instanceof TextLeaf) { 7816 let next = top2.text[offset + (dir < 0 ? -1 : 0)]; 7817 this.offsets[last] += dir; 7818 if (next.length > Math.max(0, skip)) { 7819 this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip); 7820 return this; 7821 } 7822 skip -= next.length; 7823 } else { 7824 let next = top2.children[offset + (dir < 0 ? -1 : 0)]; 7825 if (skip > next.length) { 7826 skip -= next.length; 7827 this.offsets[last] += dir; 7828 } else { 7829 if (dir < 0) 7830 this.offsets[last]--; 7831 this.nodes.push(next); 7832 this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1); 7833 } 7834 } 7835 } 7836 } 7837 next(skip = 0) { 7838 if (skip < 0) { 7839 this.nextInner(-skip, -this.dir); 7840 skip = this.value.length; 7841 } 7842 return this.nextInner(skip, this.dir); 7843 } 7844}; 7845var PartialTextCursor = class { 7846 constructor(text, start, end) { 7847 this.value = ""; 7848 this.done = false; 7849 this.cursor = new RawTextCursor(text, start > end ? -1 : 1); 7850 this.pos = start > end ? text.length : 0; 7851 this.from = Math.min(start, end); 7852 this.to = Math.max(start, end); 7853 } 7854 nextInner(skip, dir) { 7855 if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) { 7856 this.value = ""; 7857 this.done = true; 7858 return this; 7859 } 7860 skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos); 7861 let limit = dir < 0 ? this.pos - this.from : this.to - this.pos; 7862 if (skip > limit) 7863 skip = limit; 7864 limit -= skip; 7865 let { value } = this.cursor.next(skip); 7866 this.pos += (value.length + skip) * dir; 7867 this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit); 7868 this.done = !this.value; 7869 return this; 7870 } 7871 next(skip = 0) { 7872 if (skip < 0) 7873 skip = Math.max(skip, this.from - this.pos); 7874 else if (skip > 0) 7875 skip = Math.min(skip, this.to - this.pos); 7876 return this.nextInner(skip, this.cursor.dir); 7877 } 7878 get lineBreak() { 7879 return this.cursor.lineBreak && this.value != ""; 7880 } 7881}; 7882var LineCursor = class { 7883 constructor(inner) { 7884 this.inner = inner; 7885 this.afterBreak = true; 7886 this.value = ""; 7887 this.done = false; 7888 } 7889 next(skip = 0) { 7890 let { done, lineBreak, value } = this.inner.next(skip); 7891 if (done && this.afterBreak) { 7892 this.value = ""; 7893 this.afterBreak = false; 7894 } else if (done) { 7895 this.done = true; 7896 this.value = ""; 7897 } else if (lineBreak) { 7898 if (this.afterBreak) { 7899 this.value = ""; 7900 } else { 7901 this.afterBreak = true; 7902 this.next(); 7903 } 7904 } else { 7905 this.value = value; 7906 this.afterBreak = false; 7907 } 7908 return this; 7909 } 7910 get lineBreak() { 7911 return false; 7912 } 7913}; 7914if (typeof Symbol != "undefined") { 7915 Text2.prototype[Symbol.iterator] = function() { 7916 return this.iter(); 7917 }; 7918 RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] = LineCursor.prototype[Symbol.iterator] = function() { 7919 return this; 7920 }; 7921} 7922var Line = class { 7923 /** 7924 @internal 7925 */ 7926 constructor(from, to, number2, text) { 7927 this.from = from; 7928 this.to = to; 7929 this.number = number2; 7930 this.text = text; 7931 } 7932 /** 7933 The length of the line (not including any line break after it). 7934 */ 7935 get length() { 7936 return this.to - this.from; 7937 } 7938}; 7939var extend = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((s2) => s2 ? parseInt(s2, 36) : 1); 7940for (let i2 = 1; i2 < extend.length; i2++) 7941 extend[i2] += extend[i2 - 1]; 7942function isExtendingChar(code) { 7943 for (let i2 = 1; i2 < extend.length; i2 += 2) 7944 if (extend[i2] > code) 7945 return extend[i2 - 1] <= code; 7946 return false; 7947} 7948function isRegionalIndicator(code) { 7949 return code >= 127462 && code <= 127487; 7950} 7951var ZWJ = 8205; 7952function findClusterBreak(str, pos, forward = true, includeExtending = true) { 7953 return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending); 7954} 7955function nextClusterBreak(str, pos, includeExtending) { 7956 if (pos == str.length) 7957 return pos; 7958 if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) 7959 pos--; 7960 let prev = codePointAt(str, pos); 7961 pos += codePointSize(prev); 7962 while (pos < str.length) { 7963 let next = codePointAt(str, pos); 7964 if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) { 7965 pos += codePointSize(next); 7966 prev = next; 7967 } else if (isRegionalIndicator(next)) { 7968 let countBefore = 0, i2 = pos - 2; 7969 while (i2 >= 0 && isRegionalIndicator(codePointAt(str, i2))) { 7970 countBefore++; 7971 i2 -= 2; 7972 } 7973 if (countBefore % 2 == 0) 7974 break; 7975 else 7976 pos += 2; 7977 } else { 7978 break; 7979 } 7980 } 7981 return pos; 7982} 7983function prevClusterBreak(str, pos, includeExtending) { 7984 while (pos > 0) { 7985 let found = nextClusterBreak(str, pos - 2, includeExtending); 7986 if (found < pos) 7987 return found; 7988 pos--; 7989 } 7990 return 0; 7991} 7992function surrogateLow(ch) { 7993 return ch >= 56320 && ch < 57344; 7994} 7995function surrogateHigh(ch) { 7996 return ch >= 55296 && ch < 56320; 7997} 7998function codePointAt(str, pos) { 7999 let code0 = str.charCodeAt(pos); 8000 if (!surrogateHigh(code0) || pos + 1 == str.length) 8001 return code0; 8002 let code1 = str.charCodeAt(pos + 1); 8003 if (!surrogateLow(code1)) 8004 return code0; 8005 return (code0 - 55296 << 10) + (code1 - 56320) + 65536; 8006} 8007function fromCodePoint(code) { 8008 if (code <= 65535) 8009 return String.fromCharCode(code); 8010 code -= 65536; 8011 return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); 8012} 8013function codePointSize(code) { 8014 return code < 65536 ? 1 : 2; 8015} 8016var DefaultSplit = /\r\n?|\n/; 8017var MapMode = /* @__PURE__ */ function(MapMode2) { 8018 MapMode2[MapMode2["Simple"] = 0] = "Simple"; 8019 MapMode2[MapMode2["TrackDel"] = 1] = "TrackDel"; 8020 MapMode2[MapMode2["TrackBefore"] = 2] = "TrackBefore"; 8021 MapMode2[MapMode2["TrackAfter"] = 3] = "TrackAfter"; 8022 return MapMode2; 8023}(MapMode || (MapMode = {})); 8024var ChangeDesc = class _ChangeDesc { 8025 // Sections are encoded as pairs of integers. The first is the 8026 // length in the current document, and the second is -1 for 8027 // unaffected sections, and the length of the replacement content 8028 // otherwise. So an insertion would be (0, n>0), a deletion (n>0, 8029 // 0), and a replacement two positive numbers. 8030 /** 8031 @internal 8032 */ 8033 constructor(sections) { 8034 this.sections = sections; 8035 } 8036 /** 8037 The length of the document before the change. 8038 */ 8039 get length() { 8040 let result = 0; 8041 for (let i2 = 0; i2 < this.sections.length; i2 += 2) 8042 result += this.sections[i2]; 8043 return result; 8044 } 8045 /** 8046 The length of the document after the change. 8047 */ 8048 get newLength() { 8049 let result = 0; 8050 for (let i2 = 0; i2 < this.sections.length; i2 += 2) { 8051 let ins = this.sections[i2 + 1]; 8052 result += ins < 0 ? this.sections[i2] : ins; 8053 } 8054 return result; 8055 } 8056 /** 8057 False when there are actual changes in this set. 8058 */ 8059 get empty() { 8060 return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; 8061 } 8062 /** 8063 Iterate over the unchanged parts left by these changes. `posA` 8064 provides the position of the range in the old document, `posB` 8065 the new position in the changed document. 8066 */ 8067 iterGaps(f3) { 8068 for (let i2 = 0, posA = 0, posB = 0; i2 < this.sections.length; ) { 8069 let len = this.sections[i2++], ins = this.sections[i2++]; 8070 if (ins < 0) { 8071 f3(posA, posB, len); 8072 posB += len; 8073 } else { 8074 posB += ins; 8075 } 8076 posA += len; 8077 } 8078 } 8079 /** 8080 Iterate over the ranges changed by these changes. (See 8081 [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a 8082 variant that also provides you with the inserted text.) 8083 `fromA`/`toA` provides the extent of the change in the starting 8084 document, `fromB`/`toB` the extent of the replacement in the 8085 changed document. 8086 8087 When `individual` is true, adjacent changes (which are kept 8088 separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are 8089 reported separately. 8090 */ 8091 iterChangedRanges(f3, individual = false) { 8092 iterChanges(this, f3, individual); 8093 } 8094 /** 8095 Get a description of the inverted form of these changes. 8096 */ 8097 get invertedDesc() { 8098 let sections = []; 8099 for (let i2 = 0; i2 < this.sections.length; ) { 8100 let len = this.sections[i2++], ins = this.sections[i2++]; 8101 if (ins < 0) 8102 sections.push(len, ins); 8103 else 8104 sections.push(ins, len); 8105 } 8106 return new _ChangeDesc(sections); 8107 } 8108 /** 8109 Compute the combined effect of applying another set of changes 8110 after this one. The length of the document after this set should 8111 match the length before `other`. 8112 */ 8113 composeDesc(other) { 8114 return this.empty ? other : other.empty ? this : composeSets(this, other); 8115 } 8116 /** 8117 Map this description, which should start with the same document 8118 as `other`, over another set of changes, so that it can be 8119 applied after it. When `before` is true, map as if the changes 8120 in `other` happened before the ones in `this`. 8121 */ 8122 mapDesc(other, before = false) { 8123 return other.empty ? this : mapSet(this, other, before); 8124 } 8125 mapPos(pos, assoc = -1, mode = MapMode.Simple) { 8126 let posA = 0, posB = 0; 8127 for (let i2 = 0; i2 < this.sections.length; ) { 8128 let len = this.sections[i2++], ins = this.sections[i2++], endA = posA + len; 8129 if (ins < 0) { 8130 if (endA > pos) 8131 return posB + (pos - posA); 8132 posB += len; 8133 } else { 8134 if (mode != MapMode.Simple && endA >= pos && (mode == MapMode.TrackDel && posA < pos && endA > pos || mode == MapMode.TrackBefore && posA < pos || mode == MapMode.TrackAfter && endA > pos)) 8135 return null; 8136 if (endA > pos || endA == pos && assoc < 0 && !len) 8137 return pos == posA || assoc < 0 ? posB : posB + ins; 8138 posB += ins; 8139 } 8140 posA = endA; 8141 } 8142 if (pos > posA) 8143 throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`); 8144 return posB; 8145 } 8146 /** 8147 Check whether these changes touch a given range. When one of the 8148 changes entirely covers the range, the string `"cover"` is 8149 returned. 8150 */ 8151 touchesRange(from, to = from) { 8152 for (let i2 = 0, pos = 0; i2 < this.sections.length && pos <= to; ) { 8153 let len = this.sections[i2++], ins = this.sections[i2++], end = pos + len; 8154 if (ins >= 0 && pos <= to && end >= from) 8155 return pos < from && end > to ? "cover" : true; 8156 pos = end; 8157 } 8158 return false; 8159 } 8160 /** 8161 @internal 8162 */ 8163 toString() { 8164 let result = ""; 8165 for (let i2 = 0; i2 < this.sections.length; ) { 8166 let len = this.sections[i2++], ins = this.sections[i2++]; 8167 result += (result ? " " : "") + len + (ins >= 0 ? ":" + ins : ""); 8168 } 8169 return result; 8170 } 8171 /** 8172 Serialize this change desc to a JSON-representable value. 8173 */ 8174 toJSON() { 8175 return this.sections; 8176 } 8177 /** 8178 Create a change desc from its JSON representation (as produced 8179 by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). 8180 */ 8181 static fromJSON(json) { 8182 if (!Array.isArray(json) || json.length % 2 || json.some((a2) => typeof a2 != "number")) 8183 throw new RangeError("Invalid JSON representation of ChangeDesc"); 8184 return new _ChangeDesc(json); 8185 } 8186 /** 8187 @internal 8188 */ 8189 static create(sections) { 8190 return new _ChangeDesc(sections); 8191 } 8192}; 8193var ChangeSet = class _ChangeSet extends ChangeDesc { 8194 constructor(sections, inserted) { 8195 super(sections); 8196 this.inserted = inserted; 8197 } 8198 /** 8199 Apply the changes to a document, returning the modified 8200 document. 8201 */ 8202 apply(doc2) { 8203 if (this.length != doc2.length) 8204 throw new RangeError("Applying change set to a document with the wrong length"); 8205 iterChanges(this, (fromA, toA, fromB, _toB, text) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text), false); 8206 return doc2; 8207 } 8208 mapDesc(other, before = false) { 8209 return mapSet(this, other, before, true); 8210 } 8211 /** 8212 Given the document as it existed _before_ the changes, return a 8213 change set that represents the inverse of this set, which could 8214 be used to go from the document created by the changes back to 8215 the document as it existed before the changes. 8216 */ 8217 invert(doc2) { 8218 let sections = this.sections.slice(), inserted = []; 8219 for (let i2 = 0, pos = 0; i2 < sections.length; i2 += 2) { 8220 let len = sections[i2], ins = sections[i2 + 1]; 8221 if (ins >= 0) { 8222 sections[i2] = ins; 8223 sections[i2 + 1] = len; 8224 let index = i2 >> 1; 8225 while (inserted.length < index) 8226 inserted.push(Text2.empty); 8227 inserted.push(len ? doc2.slice(pos, pos + len) : Text2.empty); 8228 } 8229 pos += len; 8230 } 8231 return new _ChangeSet(sections, inserted); 8232 } 8233 /** 8234 Combine two subsequent change sets into a single set. `other` 8235 must start in the document produced by `this`. If `this` goes 8236 `docA` → `docB` and `other` represents `docB` → `docC`, the 8237 returned value will represent the change `docA` → `docC`. 8238 */ 8239 compose(other) { 8240 return this.empty ? other : other.empty ? this : composeSets(this, other, true); 8241 } 8242 /** 8243 Given another change set starting in the same document, maps this 8244 change set over the other, producing a new change set that can be 8245 applied to the document produced by applying `other`. When 8246 `before` is `true`, order changes as if `this` comes before 8247 `other`, otherwise (the default) treat `other` as coming first. 8248 8249 Given two changes `A` and `B`, `A.compose(B.map(A))` and 8250 `B.compose(A.map(B, true))` will produce the same document. This 8251 provides a basic form of [operational 8252 transformation](https://en.wikipedia.org/wiki/Operational_transformation), 8253 and can be used for collaborative editing. 8254 */ 8255 map(other, before = false) { 8256 return other.empty ? this : mapSet(this, other, before, true); 8257 } 8258 /** 8259 Iterate over the changed ranges in the document, calling `f` for 8260 each, with the range in the original document (`fromA`-`toA`) 8261 and the range that replaces it in the new document 8262 (`fromB`-`toB`). 8263 8264 When `individual` is true, adjacent changes are reported 8265 separately. 8266 */ 8267 iterChanges(f3, individual = false) { 8268 iterChanges(this, f3, individual); 8269 } 8270 /** 8271 Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change 8272 set. 8273 */ 8274 get desc() { 8275 return ChangeDesc.create(this.sections); 8276 } 8277 /** 8278 @internal 8279 */ 8280 filter(ranges) { 8281 let resultSections = [], resultInserted = [], filteredSections = []; 8282 let iter = new SectionIter(this); 8283 done: 8284 for (let i2 = 0, pos = 0; ; ) { 8285 let next = i2 == ranges.length ? 1e9 : ranges[i2++]; 8286 while (pos < next || pos == next && iter.len == 0) { 8287 if (iter.done) 8288 break done; 8289 let len = Math.min(iter.len, next - pos); 8290 addSection(filteredSections, len, -1); 8291 let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0; 8292 addSection(resultSections, len, ins); 8293 if (ins > 0) 8294 addInsert(resultInserted, resultSections, iter.text); 8295 iter.forward(len); 8296 pos += len; 8297 } 8298 let end = ranges[i2++]; 8299 while (pos < end) { 8300 if (iter.done) 8301 break done; 8302 let len = Math.min(iter.len, end - pos); 8303 addSection(resultSections, len, -1); 8304 addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0); 8305 iter.forward(len); 8306 pos += len; 8307 } 8308 } 8309 return { 8310 changes: new _ChangeSet(resultSections, resultInserted), 8311 filtered: ChangeDesc.create(filteredSections) 8312 }; 8313 } 8314 /** 8315 Serialize this change set to a JSON-representable value. 8316 */ 8317 toJSON() { 8318 let parts = []; 8319 for (let i2 = 0; i2 < this.sections.length; i2 += 2) { 8320 let len = this.sections[i2], ins = this.sections[i2 + 1]; 8321 if (ins < 0) 8322 parts.push(len); 8323 else if (ins == 0) 8324 parts.push([len]); 8325 else 8326 parts.push([len].concat(this.inserted[i2 >> 1].toJSON())); 8327 } 8328 return parts; 8329 } 8330 /** 8331 Create a change set for the given changes, for a document of the 8332 given length, using `lineSep` as line separator. 8333 */ 8334 static of(changes, length, lineSep) { 8335 let sections = [], inserted = [], pos = 0; 8336 let total = null; 8337 function flush(force = false) { 8338 if (!force && !sections.length) 8339 return; 8340 if (pos < length) 8341 addSection(sections, length - pos, -1); 8342 let set = new _ChangeSet(sections, inserted); 8343 total = total ? total.compose(set.map(total)) : set; 8344 sections = []; 8345 inserted = []; 8346 pos = 0; 8347 } 8348 function process2(spec) { 8349 if (Array.isArray(spec)) { 8350 for (let sub of spec) 8351 process2(sub); 8352 } else if (spec instanceof _ChangeSet) { 8353 if (spec.length != length) 8354 throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`); 8355 flush(); 8356 total = total ? total.compose(spec.map(total)) : spec; 8357 } else { 8358 let { from, to = from, insert: insert2 } = spec; 8359 if (from > to || from < 0 || to > length) 8360 throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`); 8361 let insText = !insert2 ? Text2.empty : typeof insert2 == "string" ? Text2.of(insert2.split(lineSep || DefaultSplit)) : insert2; 8362 let insLen = insText.length; 8363 if (from == to && insLen == 0) 8364 return; 8365 if (from < pos) 8366 flush(); 8367 if (from > pos) 8368 addSection(sections, from - pos, -1); 8369 addSection(sections, to - from, insLen); 8370 addInsert(inserted, sections, insText); 8371 pos = to; 8372 } 8373 } 8374 process2(changes); 8375 flush(!total); 8376 return total; 8377 } 8378 /** 8379 Create an empty changeset of the given length. 8380 */ 8381 static empty(length) { 8382 return new _ChangeSet(length ? [length, -1] : [], []); 8383 } 8384 /** 8385 Create a changeset from its JSON representation (as produced by 8386 [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). 8387 */ 8388 static fromJSON(json) { 8389 if (!Array.isArray(json)) 8390 throw new RangeError("Invalid JSON representation of ChangeSet"); 8391 let sections = [], inserted = []; 8392 for (let i2 = 0; i2 < json.length; i2++) { 8393 let part = json[i2]; 8394 if (typeof part == "number") { 8395 sections.push(part, -1); 8396 } else if (!Array.isArray(part) || typeof part[0] != "number" || part.some((e2, i3) => i3 && typeof e2 != "string")) { 8397 throw new RangeError("Invalid JSON representation of ChangeSet"); 8398 } else if (part.length == 1) { 8399 sections.push(part[0], 0); 8400 } else { 8401 while (inserted.length < i2) 8402 inserted.push(Text2.empty); 8403 inserted[i2] = Text2.of(part.slice(1)); 8404 sections.push(part[0], inserted[i2].length); 8405 } 8406 } 8407 return new _ChangeSet(sections, inserted); 8408 } 8409 /** 8410 @internal 8411 */ 8412 static createSet(sections, inserted) { 8413 return new _ChangeSet(sections, inserted); 8414 } 8415}; 8416function addSection(sections, len, ins, forceJoin = false) { 8417 if (len == 0 && ins <= 0) 8418 return; 8419 let last = sections.length - 2; 8420 if (last >= 0 && ins <= 0 && ins == sections[last + 1]) 8421 sections[last] += len; 8422 else if (len == 0 && sections[last] == 0) 8423 sections[last + 1] += ins; 8424 else if (forceJoin) { 8425 sections[last] += len; 8426 sections[last + 1] += ins; 8427 } else 8428 sections.push(len, ins); 8429} 8430function addInsert(values2, sections, value) { 8431 if (value.length == 0) 8432 return; 8433 let index = sections.length - 2 >> 1; 8434 if (index < values2.length) { 8435 values2[values2.length - 1] = values2[values2.length - 1].append(value); 8436 } else { 8437 while (values2.length < index) 8438 values2.push(Text2.empty); 8439 values2.push(value); 8440 } 8441} 8442function iterChanges(desc, f3, individual) { 8443 let inserted = desc.inserted; 8444 for (let posA = 0, posB = 0, i2 = 0; i2 < desc.sections.length; ) { 8445 let len = desc.sections[i2++], ins = desc.sections[i2++]; 8446 if (ins < 0) { 8447 posA += len; 8448 posB += len; 8449 } else { 8450 let endA = posA, endB = posB, text = Text2.empty; 8451 for (; ; ) { 8452 endA += len; 8453 endB += ins; 8454 if (ins && inserted) 8455 text = text.append(inserted[i2 - 2 >> 1]); 8456 if (individual || i2 == desc.sections.length || desc.sections[i2 + 1] < 0) 8457 break; 8458 len = desc.sections[i2++]; 8459 ins = desc.sections[i2++]; 8460 } 8461 f3(posA, endA, posB, endB, text); 8462 posA = endA; 8463 posB = endB; 8464 } 8465 } 8466} 8467function mapSet(setA, setB, before, mkSet = false) { 8468 let sections = [], insert2 = mkSet ? [] : null; 8469 let a2 = new SectionIter(setA), b3 = new SectionIter(setB); 8470 for (let inserted = -1; ; ) { 8471 if (a2.ins == -1 && b3.ins == -1) { 8472 let len = Math.min(a2.len, b3.len); 8473 addSection(sections, len, -1); 8474 a2.forward(len); 8475 b3.forward(len); 8476 } else if (b3.ins >= 0 && (a2.ins < 0 || inserted == a2.i || a2.off == 0 && (b3.len < a2.len || b3.len == a2.len && !before))) { 8477 let len = b3.len; 8478 addSection(sections, b3.ins, -1); 8479 while (len) { 8480 let piece = Math.min(a2.len, len); 8481 if (a2.ins >= 0 && inserted < a2.i && a2.len <= piece) { 8482 addSection(sections, 0, a2.ins); 8483 if (insert2) 8484 addInsert(insert2, sections, a2.text); 8485 inserted = a2.i; 8486 } 8487 a2.forward(piece); 8488 len -= piece; 8489 } 8490 b3.next(); 8491 } else if (a2.ins >= 0) { 8492 let len = 0, left = a2.len; 8493 while (left) { 8494 if (b3.ins == -1) { 8495 let piece = Math.min(left, b3.len); 8496 len += piece; 8497 left -= piece; 8498 b3.forward(piece); 8499 } else if (b3.ins == 0 && b3.len < left) { 8500 left -= b3.len; 8501 b3.next(); 8502 } else { 8503 break; 8504 } 8505 } 8506 addSection(sections, len, inserted < a2.i ? a2.ins : 0); 8507 if (insert2 && inserted < a2.i) 8508 addInsert(insert2, sections, a2.text); 8509 inserted = a2.i; 8510 a2.forward(a2.len - left); 8511 } else if (a2.done && b3.done) { 8512 return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); 8513 } else { 8514 throw new Error("Mismatched change set lengths"); 8515 } 8516 } 8517} 8518function composeSets(setA, setB, mkSet = false) { 8519 let sections = []; 8520 let insert2 = mkSet ? [] : null; 8521 let a2 = new SectionIter(setA), b3 = new SectionIter(setB); 8522 for (let open = false; ; ) { 8523 if (a2.done && b3.done) { 8524 return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); 8525 } else if (a2.ins == 0) { 8526 addSection(sections, a2.len, 0, open); 8527 a2.next(); 8528 } else if (b3.len == 0 && !b3.done) { 8529 addSection(sections, 0, b3.ins, open); 8530 if (insert2) 8531 addInsert(insert2, sections, b3.text); 8532 b3.next(); 8533 } else if (a2.done || b3.done) { 8534 throw new Error("Mismatched change set lengths"); 8535 } else { 8536 let len = Math.min(a2.len2, b3.len), sectionLen = sections.length; 8537 if (a2.ins == -1) { 8538 let insB = b3.ins == -1 ? -1 : b3.off ? 0 : b3.ins; 8539 addSection(sections, len, insB, open); 8540 if (insert2 && insB) 8541 addInsert(insert2, sections, b3.text); 8542 } else if (b3.ins == -1) { 8543 addSection(sections, a2.off ? 0 : a2.len, len, open); 8544 if (insert2) 8545 addInsert(insert2, sections, a2.textBit(len)); 8546 } else { 8547 addSection(sections, a2.off ? 0 : a2.len, b3.off ? 0 : b3.ins, open); 8548 if (insert2 && !b3.off) 8549 addInsert(insert2, sections, b3.text); 8550 } 8551 open = (a2.ins > len || b3.ins >= 0 && b3.len > len) && (open || sections.length > sectionLen); 8552 a2.forward2(len); 8553 b3.forward(len); 8554 } 8555 } 8556} 8557var SectionIter = class { 8558 constructor(set) { 8559 this.set = set; 8560 this.i = 0; 8561 this.next(); 8562 } 8563 next() { 8564 let { sections } = this.set; 8565 if (this.i < sections.length) { 8566 this.len = sections[this.i++]; 8567 this.ins = sections[this.i++]; 8568 } else { 8569 this.len = 0; 8570 this.ins = -2; 8571 } 8572 this.off = 0; 8573 } 8574 get done() { 8575 return this.ins == -2; 8576 } 8577 get len2() { 8578 return this.ins < 0 ? this.len : this.ins; 8579 } 8580 get text() { 8581 let { inserted } = this.set, index = this.i - 2 >> 1; 8582 return index >= inserted.length ? Text2.empty : inserted[index]; 8583 } 8584 textBit(len) { 8585 let { inserted } = this.set, index = this.i - 2 >> 1; 8586 return index >= inserted.length && !len ? Text2.empty : inserted[index].slice(this.off, len == null ? void 0 : this.off + len); 8587 } 8588 forward(len) { 8589 if (len == this.len) 8590 this.next(); 8591 else { 8592 this.len -= len; 8593 this.off += len; 8594 } 8595 } 8596 forward2(len) { 8597 if (this.ins == -1) 8598 this.forward(len); 8599 else if (len == this.ins) 8600 this.next(); 8601 else { 8602 this.ins -= len; 8603 this.off += len; 8604 } 8605 } 8606}; 8607var SelectionRange = class _SelectionRange { 8608 constructor(from, to, flags) { 8609 this.from = from; 8610 this.to = to; 8611 this.flags = flags; 8612 } 8613 /** 8614 The anchor of the range—the side that doesn't move when you 8615 extend it. 8616 */ 8617 get anchor() { 8618 return this.flags & 32 ? this.to : this.from; 8619 } 8620 /** 8621 The head of the range, which is moved when the range is 8622 [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). 8623 */ 8624 get head() { 8625 return this.flags & 32 ? this.from : this.to; 8626 } 8627 /** 8628 True when `anchor` and `head` are at the same position. 8629 */ 8630 get empty() { 8631 return this.from == this.to; 8632 } 8633 /** 8634 If this is a cursor that is explicitly associated with the 8635 character on one of its sides, this returns the side. -1 means 8636 the character before its position, 1 the character after, and 0 8637 means no association. 8638 */ 8639 get assoc() { 8640 return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0; 8641 } 8642 /** 8643 The bidirectional text level associated with this cursor, if 8644 any. 8645 */ 8646 get bidiLevel() { 8647 let level = this.flags & 7; 8648 return level == 7 ? null : level; 8649 } 8650 /** 8651 The goal column (stored vertical offset) associated with a 8652 cursor. This is used to preserve the vertical position when 8653 [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across 8654 lines of different length. 8655 */ 8656 get goalColumn() { 8657 let value = this.flags >> 6; 8658 return value == 16777215 ? void 0 : value; 8659 } 8660 /** 8661 Map this range through a change, producing a valid range in the 8662 updated document. 8663 */ 8664 map(change, assoc = -1) { 8665 let from, to; 8666 if (this.empty) { 8667 from = to = change.mapPos(this.from, assoc); 8668 } else { 8669 from = change.mapPos(this.from, 1); 8670 to = change.mapPos(this.to, -1); 8671 } 8672 return from == this.from && to == this.to ? this : new _SelectionRange(from, to, this.flags); 8673 } 8674 /** 8675 Extend this range to cover at least `from` to `to`. 8676 */ 8677 extend(from, to = from) { 8678 if (from <= this.anchor && to >= this.anchor) 8679 return EditorSelection.range(from, to); 8680 let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to; 8681 return EditorSelection.range(this.anchor, head); 8682 } 8683 /** 8684 Compare this range to another range. 8685 */ 8686 eq(other) { 8687 return this.anchor == other.anchor && this.head == other.head; 8688 } 8689 /** 8690 Return a JSON-serializable object representing the range. 8691 */ 8692 toJSON() { 8693 return { anchor: this.anchor, head: this.head }; 8694 } 8695 /** 8696 Convert a JSON representation of a range to a `SelectionRange` 8697 instance. 8698 */ 8699 static fromJSON(json) { 8700 if (!json || typeof json.anchor != "number" || typeof json.head != "number") 8701 throw new RangeError("Invalid JSON representation for SelectionRange"); 8702 return EditorSelection.range(json.anchor, json.head); 8703 } 8704 /** 8705 @internal 8706 */ 8707 static create(from, to, flags) { 8708 return new _SelectionRange(from, to, flags); 8709 } 8710}; 8711var EditorSelection = class _EditorSelection { 8712 constructor(ranges, mainIndex) { 8713 this.ranges = ranges; 8714 this.mainIndex = mainIndex; 8715 } 8716 /** 8717 Map a selection through a change. Used to adjust the selection 8718 position for changes. 8719 */ 8720 map(change, assoc = -1) { 8721 if (change.empty) 8722 return this; 8723 return _EditorSelection.create(this.ranges.map((r2) => r2.map(change, assoc)), this.mainIndex); 8724 } 8725 /** 8726 Compare this selection to another selection. 8727 */ 8728 eq(other) { 8729 if (this.ranges.length != other.ranges.length || this.mainIndex != other.mainIndex) 8730 return false; 8731 for (let i2 = 0; i2 < this.ranges.length; i2++) 8732 if (!this.ranges[i2].eq(other.ranges[i2])) 8733 return false; 8734 return true; 8735 } 8736 /** 8737 Get the primary selection range. Usually, you should make sure 8738 your code applies to _all_ ranges, by using methods like 8739 [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange). 8740 */ 8741 get main() { 8742 return this.ranges[this.mainIndex]; 8743 } 8744 /** 8745 Make sure the selection only has one range. Returns a selection 8746 holding only the main range from this selection. 8747 */ 8748 asSingle() { 8749 return this.ranges.length == 1 ? this : new _EditorSelection([this.main], 0); 8750 } 8751 /** 8752 Extend this selection with an extra range. 8753 */ 8754 addRange(range, main = true) { 8755 return _EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1); 8756 } 8757 /** 8758 Replace a given range with another range, and then normalize the 8759 selection to merge and sort ranges if necessary. 8760 */ 8761 replaceRange(range, which = this.mainIndex) { 8762 let ranges = this.ranges.slice(); 8763 ranges[which] = range; 8764 return _EditorSelection.create(ranges, this.mainIndex); 8765 } 8766 /** 8767 Convert this selection to an object that can be serialized to 8768 JSON. 8769 */ 8770 toJSON() { 8771 return { ranges: this.ranges.map((r2) => r2.toJSON()), main: this.mainIndex }; 8772 } 8773 /** 8774 Create a selection from a JSON representation. 8775 */ 8776 static fromJSON(json) { 8777 if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length) 8778 throw new RangeError("Invalid JSON representation for EditorSelection"); 8779 return new _EditorSelection(json.ranges.map((r2) => SelectionRange.fromJSON(r2)), json.main); 8780 } 8781 /** 8782 Create a selection holding a single range. 8783 */ 8784 static single(anchor, head = anchor) { 8785 return new _EditorSelection([_EditorSelection.range(anchor, head)], 0); 8786 } 8787 /** 8788 Sort and merge the given set of ranges, creating a valid 8789 selection. 8790 */ 8791 static create(ranges, mainIndex = 0) { 8792 if (ranges.length == 0) 8793 throw new RangeError("A selection needs at least one range"); 8794 for (let pos = 0, i2 = 0; i2 < ranges.length; i2++) { 8795 let range = ranges[i2]; 8796 if (range.empty ? range.from <= pos : range.from < pos) 8797 return _EditorSelection.normalized(ranges.slice(), mainIndex); 8798 pos = range.to; 8799 } 8800 return new _EditorSelection(ranges, mainIndex); 8801 } 8802 /** 8803 Create a cursor selection range at the given position. You can 8804 safely ignore the optional arguments in most situations. 8805 */ 8806 static cursor(pos, assoc = 0, bidiLevel, goalColumn) { 8807 return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 : 16) | (bidiLevel == null ? 7 : Math.min(6, bidiLevel)) | (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6); 8808 } 8809 /** 8810 Create a selection range. 8811 */ 8812 static range(anchor, head, goalColumn, bidiLevel) { 8813 let flags = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6 | (bidiLevel == null ? 7 : Math.min(6, bidiLevel)); 8814 return head < anchor ? SelectionRange.create(head, anchor, 32 | 16 | flags) : SelectionRange.create(anchor, head, (head > anchor ? 8 : 0) | flags); 8815 } 8816 /** 8817 @internal 8818 */ 8819 static normalized(ranges, mainIndex = 0) { 8820 let main = ranges[mainIndex]; 8821 ranges.sort((a2, b3) => a2.from - b3.from); 8822 mainIndex = ranges.indexOf(main); 8823 for (let i2 = 1; i2 < ranges.length; i2++) { 8824 let range = ranges[i2], prev = ranges[i2 - 1]; 8825 if (range.empty ? range.from <= prev.to : range.from < prev.to) { 8826 let from = prev.from, to = Math.max(range.to, prev.to); 8827 if (i2 <= mainIndex) 8828 mainIndex--; 8829 ranges.splice(--i2, 2, range.anchor > range.head ? _EditorSelection.range(to, from) : _EditorSelection.range(from, to)); 8830 } 8831 } 8832 return new _EditorSelection(ranges, mainIndex); 8833 } 8834}; 8835function checkSelection(selection, docLength) { 8836 for (let range of selection.ranges) 8837 if (range.to > docLength) 8838 throw new RangeError("Selection points outside of document"); 8839} 8840var nextID = 0; 8841var Facet = class _Facet { 8842 constructor(combine, compareInput, compare2, isStatic, enables) { 8843 this.combine = combine; 8844 this.compareInput = compareInput; 8845 this.compare = compare2; 8846 this.isStatic = isStatic; 8847 this.id = nextID++; 8848 this.default = combine([]); 8849 this.extensions = typeof enables == "function" ? enables(this) : enables; 8850 } 8851 /** 8852 Returns a facet reader for this facet, which can be used to 8853 [read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it. 8854 */ 8855 get reader() { 8856 return this; 8857 } 8858 /** 8859 Define a new facet. 8860 */ 8861 static define(config2 = {}) { 8862 return new _Facet(config2.combine || ((a2) => a2), config2.compareInput || ((a2, b3) => a2 === b3), config2.compare || (!config2.combine ? sameArray : (a2, b3) => a2 === b3), !!config2.static, config2.enables); 8863 } 8864 /** 8865 Returns an extension that adds the given value to this facet. 8866 */ 8867 of(value) { 8868 return new FacetProvider([], this, 0, value); 8869 } 8870 /** 8871 Create an extension that computes a value for the facet from a 8872 state. You must take care to declare the parts of the state that 8873 this value depends on, since your function is only called again 8874 for a new state when one of those parts changed. 8875 8876 In cases where your value depends only on a single field, you'll 8877 want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. 8878 */ 8879 compute(deps, get) { 8880 if (this.isStatic) 8881 throw new Error("Can't compute a static facet"); 8882 return new FacetProvider(deps, this, 1, get); 8883 } 8884 /** 8885 Create an extension that computes zero or more values for this 8886 facet from a state. 8887 */ 8888 computeN(deps, get) { 8889 if (this.isStatic) 8890 throw new Error("Can't compute a static facet"); 8891 return new FacetProvider(deps, this, 2, get); 8892 } 8893 from(field, get) { 8894 if (!get) 8895 get = (x) => x; 8896 return this.compute([field], (state) => get(state.field(field))); 8897 } 8898}; 8899function sameArray(a2, b3) { 8900 return a2 == b3 || a2.length == b3.length && a2.every((e2, i2) => e2 === b3[i2]); 8901} 8902var FacetProvider = class { 8903 constructor(dependencies, facet, type, value) { 8904 this.dependencies = dependencies; 8905 this.facet = facet; 8906 this.type = type; 8907 this.value = value; 8908 this.id = nextID++; 8909 } 8910 dynamicSlot(addresses) { 8911 var _a3; 8912 let getter = this.value; 8913 let compare2 = this.facet.compareInput; 8914 let id2 = this.id, idx = addresses[id2] >> 1, multi = this.type == 2; 8915 let depDoc = false, depSel = false, depAddrs = []; 8916 for (let dep of this.dependencies) { 8917 if (dep == "doc") 8918 depDoc = true; 8919 else if (dep == "selection") 8920 depSel = true; 8921 else if ((((_a3 = addresses[dep.id]) !== null && _a3 !== void 0 ? _a3 : 1) & 1) == 0) 8922 depAddrs.push(addresses[dep.id]); 8923 } 8924 return { 8925 create(state) { 8926 state.values[idx] = getter(state); 8927 return 1; 8928 }, 8929 update(state, tr) { 8930 if (depDoc && tr.docChanged || depSel && (tr.docChanged || tr.selection) || ensureAll(state, depAddrs)) { 8931 let newVal = getter(state); 8932 if (multi ? !compareArray(newVal, state.values[idx], compare2) : !compare2(newVal, state.values[idx])) { 8933 state.values[idx] = newVal; 8934 return 1; 8935 } 8936 } 8937 return 0; 8938 }, 8939 reconfigure: (state, oldState) => { 8940 let newVal, oldAddr = oldState.config.address[id2]; 8941 if (oldAddr != null) { 8942 let oldVal = getAddr(oldState, oldAddr); 8943 if (this.dependencies.every((dep) => { 8944 return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) : dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true; 8945 }) || (multi ? compareArray(newVal = getter(state), oldVal, compare2) : compare2(newVal = getter(state), oldVal))) { 8946 state.values[idx] = oldVal; 8947 return 0; 8948 } 8949 } else { 8950 newVal = getter(state); 8951 } 8952 state.values[idx] = newVal; 8953 return 1; 8954 } 8955 }; 8956 } 8957}; 8958function compareArray(a2, b3, compare2) { 8959 if (a2.length != b3.length) 8960 return false; 8961 for (let i2 = 0; i2 < a2.length; i2++) 8962 if (!compare2(a2[i2], b3[i2])) 8963 return false; 8964 return true; 8965} 8966function ensureAll(state, addrs) { 8967 let changed = false; 8968 for (let addr of addrs) 8969 if (ensureAddr(state, addr) & 1) 8970 changed = true; 8971 return changed; 8972} 8973function dynamicFacetSlot(addresses, facet, providers) { 8974 let providerAddrs = providers.map((p2) => addresses[p2.id]); 8975 let providerTypes = providers.map((p2) => p2.type); 8976 let dynamic = providerAddrs.filter((p2) => !(p2 & 1)); 8977 let idx = addresses[facet.id] >> 1; 8978 function get(state) { 8979 let values2 = []; 8980 for (let i2 = 0; i2 < providerAddrs.length; i2++) { 8981 let value = getAddr(state, providerAddrs[i2]); 8982 if (providerTypes[i2] == 2) 8983 for (let val of value) 8984 values2.push(val); 8985 else 8986 values2.push(value); 8987 } 8988 return facet.combine(values2); 8989 } 8990 return { 8991 create(state) { 8992 for (let addr of providerAddrs) 8993 ensureAddr(state, addr); 8994 state.values[idx] = get(state); 8995 return 1; 8996 }, 8997 update(state, tr) { 8998 if (!ensureAll(state, dynamic)) 8999 return 0; 9000 let value = get(state); 9001 if (facet.compare(value, state.values[idx])) 9002 return 0; 9003 state.values[idx] = value; 9004 return 1; 9005 }, 9006 reconfigure(state, oldState) { 9007 let depChanged = ensureAll(state, providerAddrs); 9008 let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet); 9009 if (oldProviders && !depChanged && sameArray(providers, oldProviders)) { 9010 state.values[idx] = oldValue; 9011 return 0; 9012 } 9013 let value = get(state); 9014 if (facet.compare(value, oldValue)) { 9015 state.values[idx] = oldValue; 9016 return 0; 9017 } 9018 state.values[idx] = value; 9019 return 1; 9020 } 9021 }; 9022} 9023var initField = /* @__PURE__ */ Facet.define({ static: true }); 9024var StateField = class _StateField { 9025 constructor(id2, createF, updateF, compareF, spec) { 9026 this.id = id2; 9027 this.createF = createF; 9028 this.updateF = updateF; 9029 this.compareF = compareF; 9030 this.spec = spec; 9031 this.provides = void 0; 9032 } 9033 /** 9034 Define a state field. 9035 */ 9036 static define(config2) { 9037 let field = new _StateField(nextID++, config2.create, config2.update, config2.compare || ((a2, b3) => a2 === b3), config2); 9038 if (config2.provide) 9039 field.provides = config2.provide(field); 9040 return field; 9041 } 9042 create(state) { 9043 let init = state.facet(initField).find((i2) => i2.field == this); 9044 return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state); 9045 } 9046 /** 9047 @internal 9048 */ 9049 slot(addresses) { 9050 let idx = addresses[this.id] >> 1; 9051 return { 9052 create: (state) => { 9053 state.values[idx] = this.create(state); 9054 return 1; 9055 }, 9056 update: (state, tr) => { 9057 let oldVal = state.values[idx]; 9058 let value = this.updateF(oldVal, tr); 9059 if (this.compareF(oldVal, value)) 9060 return 0; 9061 state.values[idx] = value; 9062 return 1; 9063 }, 9064 reconfigure: (state, oldState) => { 9065 if (oldState.config.address[this.id] != null) { 9066 state.values[idx] = oldState.field(this); 9067 return 0; 9068 } 9069 state.values[idx] = this.create(state); 9070 return 1; 9071 } 9072 }; 9073 } 9074 /** 9075 Returns an extension that enables this field and overrides the 9076 way it is initialized. Can be useful when you need to provide a 9077 non-default starting value for the field. 9078 */ 9079 init(create) { 9080 return [this, initField.of({ field: this, create })]; 9081 } 9082 /** 9083 State field instances can be used as 9084 [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a 9085 given state. 9086 */ 9087 get extension() { 9088 return this; 9089 } 9090}; 9091var Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; 9092function prec(value) { 9093 return (ext) => new PrecExtension(ext, value); 9094} 9095var Prec = { 9096 /** 9097 The highest precedence level, for extensions that should end up 9098 near the start of the precedence ordering. 9099 */ 9100 highest: /* @__PURE__ */ prec(Prec_.highest), 9101 /** 9102 A higher-than-default precedence, for extensions that should 9103 come before those with default precedence. 9104 */ 9105 high: /* @__PURE__ */ prec(Prec_.high), 9106 /** 9107 The default precedence, which is also used for extensions 9108 without an explicit precedence. 9109 */ 9110 default: /* @__PURE__ */ prec(Prec_.default), 9111 /** 9112 A lower-than-default precedence. 9113 */ 9114 low: /* @__PURE__ */ prec(Prec_.low), 9115 /** 9116 The lowest precedence level. Meant for things that should end up 9117 near the end of the extension order. 9118 */ 9119 lowest: /* @__PURE__ */ prec(Prec_.lowest) 9120}; 9121var PrecExtension = class { 9122 constructor(inner, prec2) { 9123 this.inner = inner; 9124 this.prec = prec2; 9125 } 9126}; 9127var Compartment = class _Compartment { 9128 /** 9129 Create an instance of this compartment to add to your [state 9130 configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). 9131 */ 9132 of(ext) { 9133 return new CompartmentInstance(this, ext); 9134 } 9135 /** 9136 Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that 9137 reconfigures this compartment. 9138 */ 9139 reconfigure(content2) { 9140 return _Compartment.reconfigure.of({ compartment: this, extension: content2 }); 9141 } 9142 /** 9143 Get the current content of the compartment in the state, or 9144 `undefined` if it isn't present. 9145 */ 9146 get(state) { 9147 return state.config.compartments.get(this); 9148 } 9149}; 9150var CompartmentInstance = class { 9151 constructor(compartment, inner) { 9152 this.compartment = compartment; 9153 this.inner = inner; 9154 } 9155}; 9156var Configuration = class _Configuration { 9157 constructor(base2, compartments, dynamicSlots, address, staticValues, facets) { 9158 this.base = base2; 9159 this.compartments = compartments; 9160 this.dynamicSlots = dynamicSlots; 9161 this.address = address; 9162 this.staticValues = staticValues; 9163 this.facets = facets; 9164 this.statusTemplate = []; 9165 while (this.statusTemplate.length < dynamicSlots.length) 9166 this.statusTemplate.push( 9167 0 9168 /* SlotStatus.Unresolved */ 9169 ); 9170 } 9171 staticFacet(facet) { 9172 let addr = this.address[facet.id]; 9173 return addr == null ? facet.default : this.staticValues[addr >> 1]; 9174 } 9175 static resolve(base2, compartments, oldState) { 9176 let fields = []; 9177 let facets = /* @__PURE__ */ Object.create(null); 9178 let newCompartments = /* @__PURE__ */ new Map(); 9179 for (let ext of flatten(base2, compartments, newCompartments)) { 9180 if (ext instanceof StateField) 9181 fields.push(ext); 9182 else 9183 (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext); 9184 } 9185 let address = /* @__PURE__ */ Object.create(null); 9186 let staticValues = []; 9187 let dynamicSlots = []; 9188 for (let field of fields) { 9189 address[field.id] = dynamicSlots.length << 1; 9190 dynamicSlots.push((a2) => field.slot(a2)); 9191 } 9192 let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets; 9193 for (let id2 in facets) { 9194 let providers = facets[id2], facet = providers[0].facet; 9195 let oldProviders = oldFacets && oldFacets[id2] || []; 9196 if (providers.every( 9197 (p2) => p2.type == 0 9198 /* Provider.Static */ 9199 )) { 9200 address[facet.id] = staticValues.length << 1 | 1; 9201 if (sameArray(oldProviders, providers)) { 9202 staticValues.push(oldState.facet(facet)); 9203 } else { 9204 let value = facet.combine(providers.map((p2) => p2.value)); 9205 staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value); 9206 } 9207 } else { 9208 for (let p2 of providers) { 9209 if (p2.type == 0) { 9210 address[p2.id] = staticValues.length << 1 | 1; 9211 staticValues.push(p2.value); 9212 } else { 9213 address[p2.id] = dynamicSlots.length << 1; 9214 dynamicSlots.push((a2) => p2.dynamicSlot(a2)); 9215 } 9216 } 9217 address[facet.id] = dynamicSlots.length << 1; 9218 dynamicSlots.push((a2) => dynamicFacetSlot(a2, facet, providers)); 9219 } 9220 } 9221 let dynamic = dynamicSlots.map((f3) => f3(address)); 9222 return new _Configuration(base2, newCompartments, dynamic, address, staticValues, facets); 9223 } 9224}; 9225function flatten(extension, compartments, newCompartments) { 9226 let result = [[], [], [], [], []]; 9227 let seen = /* @__PURE__ */ new Map(); 9228 function inner(ext, prec2) { 9229 let known = seen.get(ext); 9230 if (known != null) { 9231 if (known <= prec2) 9232 return; 9233 let found = result[known].indexOf(ext); 9234 if (found > -1) 9235 result[known].splice(found, 1); 9236 if (ext instanceof CompartmentInstance) 9237 newCompartments.delete(ext.compartment); 9238 } 9239 seen.set(ext, prec2); 9240 if (Array.isArray(ext)) { 9241 for (let e2 of ext) 9242 inner(e2, prec2); 9243 } else if (ext instanceof CompartmentInstance) { 9244 if (newCompartments.has(ext.compartment)) 9245 throw new RangeError(`Duplicate use of compartment in extensions`); 9246 let content2 = compartments.get(ext.compartment) || ext.inner; 9247 newCompartments.set(ext.compartment, content2); 9248 inner(content2, prec2); 9249 } else if (ext instanceof PrecExtension) { 9250 inner(ext.inner, ext.prec); 9251 } else if (ext instanceof StateField) { 9252 result[prec2].push(ext); 9253 if (ext.provides) 9254 inner(ext.provides, prec2); 9255 } else if (ext instanceof FacetProvider) { 9256 result[prec2].push(ext); 9257 if (ext.facet.extensions) 9258 inner(ext.facet.extensions, Prec_.default); 9259 } else { 9260 let content2 = ext.extension; 9261 if (!content2) 9262 throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); 9263 inner(content2, prec2); 9264 } 9265 } 9266 inner(extension, Prec_.default); 9267 return result.reduce((a2, b3) => a2.concat(b3)); 9268} 9269function ensureAddr(state, addr) { 9270 if (addr & 1) 9271 return 2; 9272 let idx = addr >> 1; 9273 let status = state.status[idx]; 9274 if (status == 4) 9275 throw new Error("Cyclic dependency between fields and/or facets"); 9276 if (status & 2) 9277 return status; 9278 state.status[idx] = 4; 9279 let changed = state.computeSlot(state, state.config.dynamicSlots[idx]); 9280 return state.status[idx] = 2 | changed; 9281} 9282function getAddr(state, addr) { 9283 return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1]; 9284} 9285var languageData = /* @__PURE__ */ Facet.define(); 9286var allowMultipleSelections = /* @__PURE__ */ Facet.define({ 9287 combine: (values2) => values2.some((v2) => v2), 9288 static: true 9289}); 9290var lineSeparator = /* @__PURE__ */ Facet.define({ 9291 combine: (values2) => values2.length ? values2[0] : void 0, 9292 static: true 9293}); 9294var changeFilter = /* @__PURE__ */ Facet.define(); 9295var transactionFilter = /* @__PURE__ */ Facet.define(); 9296var transactionExtender = /* @__PURE__ */ Facet.define(); 9297var readOnly = /* @__PURE__ */ Facet.define({ 9298 combine: (values2) => values2.length ? values2[0] : false 9299}); 9300var Annotation = class { 9301 /** 9302 @internal 9303 */ 9304 constructor(type, value) { 9305 this.type = type; 9306 this.value = value; 9307 } 9308 /** 9309 Define a new type of annotation. 9310 */ 9311 static define() { 9312 return new AnnotationType(); 9313 } 9314}; 9315var AnnotationType = class { 9316 /** 9317 Create an instance of this annotation. 9318 */ 9319 of(value) { 9320 return new Annotation(this, value); 9321 } 9322}; 9323var StateEffectType = class { 9324 /** 9325 @internal 9326 */ 9327 constructor(map) { 9328 this.map = map; 9329 } 9330 /** 9331 Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this 9332 type. 9333 */ 9334 of(value) { 9335 return new StateEffect(this, value); 9336 } 9337}; 9338var StateEffect = class _StateEffect { 9339 /** 9340 @internal 9341 */ 9342 constructor(type, value) { 9343 this.type = type; 9344 this.value = value; 9345 } 9346 /** 9347 Map this effect through a position mapping. Will return 9348 `undefined` when that ends up deleting the effect. 9349 */ 9350 map(mapping) { 9351 let mapped = this.type.map(this.value, mapping); 9352 return mapped === void 0 ? void 0 : mapped == this.value ? this : new _StateEffect(this.type, mapped); 9353 } 9354 /** 9355 Tells you whether this effect object is of a given 9356 [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). 9357 */ 9358 is(type) { 9359 return this.type == type; 9360 } 9361 /** 9362 Define a new effect type. The type parameter indicates the type 9363 of values that his effect holds. It should be a type that 9364 doesn't include `undefined`, since that is used in 9365 [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is 9366 removed. 9367 */ 9368 static define(spec = {}) { 9369 return new StateEffectType(spec.map || ((v2) => v2)); 9370 } 9371 /** 9372 Map an array of effects through a change set. 9373 */ 9374 static mapEffects(effects, mapping) { 9375 if (!effects.length) 9376 return effects; 9377 let result = []; 9378 for (let effect of effects) { 9379 let mapped = effect.map(mapping); 9380 if (mapped) 9381 result.push(mapped); 9382 } 9383 return result; 9384 } 9385}; 9386StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define(); 9387StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define(); 9388var Transaction = class _Transaction { 9389 constructor(startState, changes, selection, effects, annotations, scrollIntoView3) { 9390 this.startState = startState; 9391 this.changes = changes; 9392 this.selection = selection; 9393 this.effects = effects; 9394 this.annotations = annotations; 9395 this.scrollIntoView = scrollIntoView3; 9396 this._doc = null; 9397 this._state = null; 9398 if (selection) 9399 checkSelection(selection, changes.newLength); 9400 if (!annotations.some((a2) => a2.type == _Transaction.time)) 9401 this.annotations = annotations.concat(_Transaction.time.of(Date.now())); 9402 } 9403 /** 9404 @internal 9405 */ 9406 static create(startState, changes, selection, effects, annotations, scrollIntoView3) { 9407 return new _Transaction(startState, changes, selection, effects, annotations, scrollIntoView3); 9408 } 9409 /** 9410 The new document produced by the transaction. Contrary to 9411 [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't 9412 force the entire new state to be computed right away, so it is 9413 recommended that [transaction 9414 filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter 9415 when they need to look at the new document. 9416 */ 9417 get newDoc() { 9418 return this._doc || (this._doc = this.changes.apply(this.startState.doc)); 9419 } 9420 /** 9421 The new selection produced by the transaction. If 9422 [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, 9423 this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's 9424 current selection through the changes made by the transaction. 9425 */ 9426 get newSelection() { 9427 return this.selection || this.startState.selection.map(this.changes); 9428 } 9429 /** 9430 The new state created by the transaction. Computed on demand 9431 (but retained for subsequent access), so it is recommended not to 9432 access it in [transaction 9433 filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. 9434 */ 9435 get state() { 9436 if (!this._state) 9437 this.startState.applyTransaction(this); 9438 return this._state; 9439 } 9440 /** 9441 Get the value of the given annotation type, if any. 9442 */ 9443 annotation(type) { 9444 for (let ann of this.annotations) 9445 if (ann.type == type) 9446 return ann.value; 9447 return void 0; 9448 } 9449 /** 9450 Indicates whether the transaction changed the document. 9451 */ 9452 get docChanged() { 9453 return !this.changes.empty; 9454 } 9455 /** 9456 Indicates whether this transaction reconfigures the state 9457 (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or 9458 with a top-level configuration 9459 [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). 9460 */ 9461 get reconfigured() { 9462 return this.startState.config != this.state.config; 9463 } 9464 /** 9465 Returns true if the transaction has a [user 9466 event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to 9467 or more specific than `event`. For example, if the transaction 9468 has `"select.pointer"` as user event, `"select"` and 9469 `"select.pointer"` will match it. 9470 */ 9471 isUserEvent(event) { 9472 let e2 = this.annotation(_Transaction.userEvent); 9473 return !!(e2 && (e2 == event || e2.length > event.length && e2.slice(0, event.length) == event && e2[event.length] == ".")); 9474 } 9475}; 9476Transaction.time = /* @__PURE__ */ Annotation.define(); 9477Transaction.userEvent = /* @__PURE__ */ Annotation.define(); 9478Transaction.addToHistory = /* @__PURE__ */ Annotation.define(); 9479Transaction.remote = /* @__PURE__ */ Annotation.define(); 9480function joinRanges(a2, b3) { 9481 let result = []; 9482 for (let iA = 0, iB = 0; ; ) { 9483 let from, to; 9484 if (iA < a2.length && (iB == b3.length || b3[iB] >= a2[iA])) { 9485 from = a2[iA++]; 9486 to = a2[iA++]; 9487 } else if (iB < b3.length) { 9488 from = b3[iB++]; 9489 to = b3[iB++]; 9490 } else 9491 return result; 9492 if (!result.length || result[result.length - 1] < from) 9493 result.push(from, to); 9494 else if (result[result.length - 1] < to) 9495 result[result.length - 1] = to; 9496 } 9497} 9498function mergeTransaction(a2, b3, sequential) { 9499 var _a3; 9500 let mapForA, mapForB, changes; 9501 if (sequential) { 9502 mapForA = b3.changes; 9503 mapForB = ChangeSet.empty(b3.changes.length); 9504 changes = a2.changes.compose(b3.changes); 9505 } else { 9506 mapForA = b3.changes.map(a2.changes); 9507 mapForB = a2.changes.mapDesc(b3.changes, true); 9508 changes = a2.changes.compose(mapForA); 9509 } 9510 return { 9511 changes, 9512 selection: b3.selection ? b3.selection.map(mapForB) : (_a3 = a2.selection) === null || _a3 === void 0 ? void 0 : _a3.map(mapForA), 9513 effects: StateEffect.mapEffects(a2.effects, mapForA).concat(StateEffect.mapEffects(b3.effects, mapForB)), 9514 annotations: a2.annotations.length ? a2.annotations.concat(b3.annotations) : b3.annotations, 9515 scrollIntoView: a2.scrollIntoView || b3.scrollIntoView 9516 }; 9517} 9518function resolveTransactionInner(state, spec, docSize) { 9519 let sel = spec.selection, annotations = asArray(spec.annotations); 9520 if (spec.userEvent) 9521 annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent)); 9522 return { 9523 changes: spec.changes instanceof ChangeSet ? spec.changes : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)), 9524 selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)), 9525 effects: asArray(spec.effects), 9526 annotations, 9527 scrollIntoView: !!spec.scrollIntoView 9528 }; 9529} 9530function resolveTransaction(state, specs, filter) { 9531 let s2 = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length); 9532 if (specs.length && specs[0].filter === false) 9533 filter = false; 9534 for (let i2 = 1; i2 < specs.length; i2++) { 9535 if (specs[i2].filter === false) 9536 filter = false; 9537 let seq = !!specs[i2].sequential; 9538 s2 = mergeTransaction(s2, resolveTransactionInner(state, specs[i2], seq ? s2.changes.newLength : state.doc.length), seq); 9539 } 9540 let tr = Transaction.create(state, s2.changes, s2.selection, s2.effects, s2.annotations, s2.scrollIntoView); 9541 return extendTransaction(filter ? filterTransaction(tr) : tr); 9542} 9543function filterTransaction(tr) { 9544 let state = tr.startState; 9545 let result = true; 9546 for (let filter of state.facet(changeFilter)) { 9547 let value = filter(tr); 9548 if (value === false) { 9549 result = false; 9550 break; 9551 } 9552 if (Array.isArray(value)) 9553 result = result === true ? value : joinRanges(result, value); 9554 } 9555 if (result !== true) { 9556 let changes, back; 9557 if (result === false) { 9558 back = tr.changes.invertedDesc; 9559 changes = ChangeSet.empty(state.doc.length); 9560 } else { 9561 let filtered = tr.changes.filter(result); 9562 changes = filtered.changes; 9563 back = filtered.filtered.mapDesc(filtered.changes).invertedDesc; 9564 } 9565 tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView); 9566 } 9567 let filters = state.facet(transactionFilter); 9568 for (let i2 = filters.length - 1; i2 >= 0; i2--) { 9569 let filtered = filters[i2](tr); 9570 if (filtered instanceof Transaction) 9571 tr = filtered; 9572 else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) 9573 tr = filtered[0]; 9574 else 9575 tr = resolveTransaction(state, asArray(filtered), false); 9576 } 9577 return tr; 9578} 9579function extendTransaction(tr) { 9580 let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr; 9581 for (let i2 = extenders.length - 1; i2 >= 0; i2--) { 9582 let extension = extenders[i2](tr); 9583 if (extension && Object.keys(extension).length) 9584 spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true); 9585 } 9586 return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView); 9587} 9588var none = []; 9589function asArray(value) { 9590 return value == null ? none : Array.isArray(value) ? value : [value]; 9591} 9592var CharCategory = /* @__PURE__ */ function(CharCategory2) { 9593 CharCategory2[CharCategory2["Word"] = 0] = "Word"; 9594 CharCategory2[CharCategory2["Space"] = 1] = "Space"; 9595 CharCategory2[CharCategory2["Other"] = 2] = "Other"; 9596 return CharCategory2; 9597}(CharCategory || (CharCategory = {})); 9598var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; 9599var wordChar; 9600try { 9601 wordChar = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); 9602} catch (_2) { 9603} 9604function hasWordChar(str) { 9605 if (wordChar) 9606 return wordChar.test(str); 9607 for (let i2 = 0; i2 < str.length; i2++) { 9608 let ch = str[i2]; 9609 if (/\w/.test(ch) || ch > "\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))) 9610 return true; 9611 } 9612 return false; 9613} 9614function makeCategorizer(wordChars) { 9615 return (char) => { 9616 if (!/\S/.test(char)) 9617 return CharCategory.Space; 9618 if (hasWordChar(char)) 9619 return CharCategory.Word; 9620 for (let i2 = 0; i2 < wordChars.length; i2++) 9621 if (char.indexOf(wordChars[i2]) > -1) 9622 return CharCategory.Word; 9623 return CharCategory.Other; 9624 }; 9625} 9626var EditorState = class _EditorState { 9627 constructor(config2, doc2, selection, values2, computeSlot, tr) { 9628 this.config = config2; 9629 this.doc = doc2; 9630 this.selection = selection; 9631 this.values = values2; 9632 this.status = config2.statusTemplate.slice(); 9633 this.computeSlot = computeSlot; 9634 if (tr) 9635 tr._state = this; 9636 for (let i2 = 0; i2 < this.config.dynamicSlots.length; i2++) 9637 ensureAddr(this, i2 << 1); 9638 this.computeSlot = null; 9639 } 9640 field(field, require2 = true) { 9641 let addr = this.config.address[field.id]; 9642 if (addr == null) { 9643 if (require2) 9644 throw new RangeError("Field is not present in this state"); 9645 return void 0; 9646 } 9647 ensureAddr(this, addr); 9648 return getAddr(this, addr); 9649 } 9650 /** 9651 Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this 9652 state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec) 9653 can be passed. Unless 9654 [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the 9655 [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec 9656 are assumed to start in the _current_ document (not the document 9657 produced by previous specs), and its 9658 [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and 9659 [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer 9660 to the document created by its _own_ changes. The resulting 9661 transaction contains the combined effect of all the different 9662 specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later 9663 specs take precedence over earlier ones. 9664 */ 9665 update(...specs) { 9666 return resolveTransaction(this, specs, true); 9667 } 9668 /** 9669 @internal 9670 */ 9671 applyTransaction(tr) { 9672 let conf = this.config, { base: base2, compartments } = conf; 9673 for (let effect of tr.effects) { 9674 if (effect.is(Compartment.reconfigure)) { 9675 if (conf) { 9676 compartments = /* @__PURE__ */ new Map(); 9677 conf.compartments.forEach((val, key) => compartments.set(key, val)); 9678 conf = null; 9679 } 9680 compartments.set(effect.value.compartment, effect.value.extension); 9681 } else if (effect.is(StateEffect.reconfigure)) { 9682 conf = null; 9683 base2 = effect.value; 9684 } else if (effect.is(StateEffect.appendConfig)) { 9685 conf = null; 9686 base2 = asArray(base2).concat(effect.value); 9687 } 9688 } 9689 let startValues; 9690 if (!conf) { 9691 conf = Configuration.resolve(base2, compartments, this); 9692 let intermediateState = new _EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null); 9693 startValues = intermediateState.values; 9694 } else { 9695 startValues = tr.startState.values.slice(); 9696 } 9697 let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle(); 9698 new _EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr); 9699 } 9700 /** 9701 Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that 9702 replaces every selection range with the given content. 9703 */ 9704 replaceSelection(text) { 9705 if (typeof text == "string") 9706 text = this.toText(text); 9707 return this.changeByRange((range) => ({ 9708 changes: { from: range.from, to: range.to, insert: text }, 9709 range: EditorSelection.cursor(range.from + text.length) 9710 })); 9711 } 9712 /** 9713 Create a set of changes and a new selection by running the given 9714 function for each range in the active selection. The function 9715 can return an optional set of changes (in the coordinate space 9716 of the start document), plus an updated range (in the coordinate 9717 space of the document produced by the call's own changes). This 9718 method will merge all the changes and ranges into a single 9719 changeset and selection, and return it as a [transaction 9720 spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to 9721 [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). 9722 */ 9723 changeByRange(f3) { 9724 let sel = this.selection; 9725 let result1 = f3(sel.ranges[0]); 9726 let changes = this.changes(result1.changes), ranges = [result1.range]; 9727 let effects = asArray(result1.effects); 9728 for (let i2 = 1; i2 < sel.ranges.length; i2++) { 9729 let result = f3(sel.ranges[i2]); 9730 let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes); 9731 for (let j3 = 0; j3 < i2; j3++) 9732 ranges[j3] = ranges[j3].map(newMapped); 9733 let mapBy = changes.mapDesc(newChanges, true); 9734 ranges.push(result.range.map(mapBy)); 9735 changes = changes.compose(newMapped); 9736 effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy)); 9737 } 9738 return { 9739 changes, 9740 selection: EditorSelection.create(ranges, sel.mainIndex), 9741 effects 9742 }; 9743 } 9744 /** 9745 Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change 9746 description, taking the state's document length and line 9747 separator into account. 9748 */ 9749 changes(spec = []) { 9750 if (spec instanceof ChangeSet) 9751 return spec; 9752 return ChangeSet.of(spec, this.doc.length, this.facet(_EditorState.lineSeparator)); 9753 } 9754 /** 9755 Using the state's [line 9756 separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a 9757 [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string. 9758 */ 9759 toText(string2) { 9760 return Text2.of(string2.split(this.facet(_EditorState.lineSeparator) || DefaultSplit)); 9761 } 9762 /** 9763 Return the given range of the document as a string. 9764 */ 9765 sliceDoc(from = 0, to = this.doc.length) { 9766 return this.doc.sliceString(from, to, this.lineBreak); 9767 } 9768 /** 9769 Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet). 9770 */ 9771 facet(facet) { 9772 let addr = this.config.address[facet.id]; 9773 if (addr == null) 9774 return facet.default; 9775 ensureAddr(this, addr); 9776 return getAddr(this, addr); 9777 } 9778 /** 9779 Convert this state to a JSON-serializable object. When custom 9780 fields should be serialized, you can pass them in as an object 9781 mapping property names (in the resulting object, which should 9782 not use `doc` or `selection`) to fields. 9783 */ 9784 toJSON(fields) { 9785 let result = { 9786 doc: this.sliceDoc(), 9787 selection: this.selection.toJSON() 9788 }; 9789 if (fields) 9790 for (let prop in fields) { 9791 let value = fields[prop]; 9792 if (value instanceof StateField && this.config.address[value.id] != null) 9793 result[prop] = value.spec.toJSON(this.field(fields[prop]), this); 9794 } 9795 return result; 9796 } 9797 /** 9798 Deserialize a state from its JSON representation. When custom 9799 fields should be deserialized, pass the same object you passed 9800 to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as 9801 third argument. 9802 */ 9803 static fromJSON(json, config2 = {}, fields) { 9804 if (!json || typeof json.doc != "string") 9805 throw new RangeError("Invalid JSON representation for EditorState"); 9806 let fieldInit = []; 9807 if (fields) 9808 for (let prop in fields) { 9809 if (Object.prototype.hasOwnProperty.call(json, prop)) { 9810 let field = fields[prop], value = json[prop]; 9811 fieldInit.push(field.init((state) => field.spec.fromJSON(value, state))); 9812 } 9813 } 9814 return _EditorState.create({ 9815 doc: json.doc, 9816 selection: EditorSelection.fromJSON(json.selection), 9817 extensions: config2.extensions ? fieldInit.concat([config2.extensions]) : fieldInit 9818 }); 9819 } 9820 /** 9821 Create a new state. You'll usually only need this when 9822 initializing an editor—updated states are created by applying 9823 transactions. 9824 */ 9825 static create(config2 = {}) { 9826 let configuration = Configuration.resolve(config2.extensions || [], /* @__PURE__ */ new Map()); 9827 let doc2 = config2.doc instanceof Text2 ? config2.doc : Text2.of((config2.doc || "").split(configuration.staticFacet(_EditorState.lineSeparator) || DefaultSplit)); 9828 let selection = !config2.selection ? EditorSelection.single(0) : config2.selection instanceof EditorSelection ? config2.selection : EditorSelection.single(config2.selection.anchor, config2.selection.head); 9829 checkSelection(selection, doc2.length); 9830 if (!configuration.staticFacet(allowMultipleSelections)) 9831 selection = selection.asSingle(); 9832 return new _EditorState(configuration, doc2, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null); 9833 } 9834 /** 9835 The size (in columns) of a tab in the document, determined by 9836 the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. 9837 */ 9838 get tabSize() { 9839 return this.facet(_EditorState.tabSize); 9840 } 9841 /** 9842 Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) 9843 string for this state. 9844 */ 9845 get lineBreak() { 9846 return this.facet(_EditorState.lineSeparator) || "\n"; 9847 } 9848 /** 9849 Returns true when the editor is 9850 [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. 9851 */ 9852 get readOnly() { 9853 return this.facet(readOnly); 9854 } 9855 /** 9856 Look up a translation for the given phrase (via the 9857 [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the 9858 original string if no translation is found. 9859 9860 If additional arguments are passed, they will be inserted in 9861 place of markers like `$1` (for the first value) and `$2`, etc. 9862 A single `$` is equivalent to `$1`, and `$$` will produce a 9863 literal dollar sign. 9864 */ 9865 phrase(phrase2, ...insert2) { 9866 for (let map of this.facet(_EditorState.phrases)) 9867 if (Object.prototype.hasOwnProperty.call(map, phrase2)) { 9868 phrase2 = map[phrase2]; 9869 break; 9870 } 9871 if (insert2.length) 9872 phrase2 = phrase2.replace(/\$(\$|\d*)/g, (m2, i2) => { 9873 if (i2 == "$") 9874 return "$"; 9875 let n3 = +(i2 || 1); 9876 return !n3 || n3 > insert2.length ? m2 : insert2[n3 - 1]; 9877 }); 9878 return phrase2; 9879 } 9880 /** 9881 Find the values for a given language data field, provided by the 9882 the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. 9883 9884 Examples of language data fields are... 9885 9886 - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying 9887 comment syntax. 9888 - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override) 9889 for providing language-specific completion sources. 9890 - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding 9891 characters that should be considered part of words in this 9892 language. 9893 - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls 9894 bracket closing behavior. 9895 */ 9896 languageDataAt(name2, pos, side = -1) { 9897 let values2 = []; 9898 for (let provider of this.facet(languageData)) { 9899 for (let result of provider(this, pos, side)) { 9900 if (Object.prototype.hasOwnProperty.call(result, name2)) 9901 values2.push(result[name2]); 9902 } 9903 } 9904 return values2; 9905 } 9906 /** 9907 Return a function that can categorize strings (expected to 9908 represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) 9909 into one of: 9910 9911 - Word (contains an alphanumeric character or a character 9912 explicitly listed in the local language's `"wordChars"` 9913 language data, which should be a string) 9914 - Space (contains only whitespace) 9915 - Other (anything else) 9916 */ 9917 charCategorizer(at) { 9918 return makeCategorizer(this.languageDataAt("wordChars", at).join("")); 9919 } 9920 /** 9921 Find the word at the given position, meaning the range 9922 containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters 9923 around it. If no word characters are adjacent to the position, 9924 this returns null. 9925 */ 9926 wordAt(pos) { 9927 let { text, from, length } = this.doc.lineAt(pos); 9928 let cat = this.charCategorizer(pos); 9929 let start = pos - from, end = pos - from; 9930 while (start > 0) { 9931 let prev = findClusterBreak(text, start, false); 9932 if (cat(text.slice(prev, start)) != CharCategory.Word) 9933 break; 9934 start = prev; 9935 } 9936 while (end < length) { 9937 let next = findClusterBreak(text, end); 9938 if (cat(text.slice(end, next)) != CharCategory.Word) 9939 break; 9940 end = next; 9941 } 9942 return start == end ? null : EditorSelection.range(start + from, end + from); 9943 } 9944}; 9945EditorState.allowMultipleSelections = allowMultipleSelections; 9946EditorState.tabSize = /* @__PURE__ */ Facet.define({ 9947 combine: (values2) => values2.length ? values2[0] : 4 9948}); 9949EditorState.lineSeparator = lineSeparator; 9950EditorState.readOnly = readOnly; 9951EditorState.phrases = /* @__PURE__ */ Facet.define({ 9952 compare(a2, b3) { 9953 let kA = Object.keys(a2), kB = Object.keys(b3); 9954 return kA.length == kB.length && kA.every((k) => a2[k] == b3[k]); 9955 } 9956}); 9957EditorState.languageData = languageData; 9958EditorState.changeFilter = changeFilter; 9959EditorState.transactionFilter = transactionFilter; 9960EditorState.transactionExtender = transactionExtender; 9961Compartment.reconfigure = /* @__PURE__ */ StateEffect.define(); 9962function combineConfig(configs, defaults5, combine = {}) { 9963 let result = {}; 9964 for (let config2 of configs) 9965 for (let key of Object.keys(config2)) { 9966 let value = config2[key], current = result[key]; 9967 if (current === void 0) 9968 result[key] = value; 9969 else if (current === value || value === void 0) 9970 ; 9971 else if (Object.hasOwnProperty.call(combine, key)) 9972 result[key] = combine[key](current, value); 9973 else 9974 throw new Error("Config merge conflict for field " + key); 9975 } 9976 for (let key in defaults5) 9977 if (result[key] === void 0) 9978 result[key] = defaults5[key]; 9979 return result; 9980} 9981var RangeValue = class { 9982 /** 9983 Compare this value with another value. Used when comparing 9984 rangesets. The default implementation compares by identity. 9985 Unless you are only creating a fixed number of unique instances 9986 of your value type, it is a good idea to implement this 9987 properly. 9988 */ 9989 eq(other) { 9990 return this == other; 9991 } 9992 /** 9993 Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. 9994 */ 9995 range(from, to = from) { 9996 return Range.create(from, to, this); 9997 } 9998}; 9999RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0; 10000RangeValue.prototype.point = false; 10001RangeValue.prototype.mapMode = MapMode.TrackDel; 10002var Range = class _Range { 10003 constructor(from, to, value) { 10004 this.from = from; 10005 this.to = to; 10006 this.value = value; 10007 } 10008 /** 10009 @internal 10010 */ 10011 static create(from, to, value) { 10012 return new _Range(from, to, value); 10013 } 10014}; 10015function cmpRange(a2, b3) { 10016 return a2.from - b3.from || a2.value.startSide - b3.value.startSide; 10017} 10018var Chunk = class _Chunk { 10019 constructor(from, to, value, maxPoint) { 10020 this.from = from; 10021 this.to = to; 10022 this.value = value; 10023 this.maxPoint = maxPoint; 10024 } 10025 get length() { 10026 return this.to[this.to.length - 1]; 10027 } 10028 // Find the index of the given position and side. Use the ranges' 10029 // `from` pos when `end == false`, `to` when `end == true`. 10030 findIndex(pos, side, end, startAt = 0) { 10031 let arr = end ? this.to : this.from; 10032 for (let lo = startAt, hi = arr.length; ; ) { 10033 if (lo == hi) 10034 return lo; 10035 let mid = lo + hi >> 1; 10036 let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side; 10037 if (mid == lo) 10038 return diff >= 0 ? lo : hi; 10039 if (diff >= 0) 10040 hi = mid; 10041 else 10042 lo = mid + 1; 10043 } 10044 } 10045 between(offset, from, to, f3) { 10046 for (let i2 = this.findIndex(from, -1e9, true), e2 = this.findIndex(to, 1e9, false, i2); i2 < e2; i2++) 10047 if (f3(this.from[i2] + offset, this.to[i2] + offset, this.value[i2]) === false) 10048 return false; 10049 } 10050 map(offset, changes) { 10051 let value = [], from = [], to = [], newPos = -1, maxPoint = -1; 10052 for (let i2 = 0; i2 < this.value.length; i2++) { 10053 let val = this.value[i2], curFrom = this.from[i2] + offset, curTo = this.to[i2] + offset, newFrom, newTo; 10054 if (curFrom == curTo) { 10055 let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode); 10056 if (mapped == null) 10057 continue; 10058 newFrom = newTo = mapped; 10059 if (val.startSide != val.endSide) { 10060 newTo = changes.mapPos(curFrom, val.endSide); 10061 if (newTo < newFrom) 10062 continue; 10063 } 10064 } else { 10065 newFrom = changes.mapPos(curFrom, val.startSide); 10066 newTo = changes.mapPos(curTo, val.endSide); 10067 if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0) 10068 continue; 10069 } 10070 if ((newTo - newFrom || val.endSide - val.startSide) < 0) 10071 continue; 10072 if (newPos < 0) 10073 newPos = newFrom; 10074 if (val.point) 10075 maxPoint = Math.max(maxPoint, newTo - newFrom); 10076 value.push(val); 10077 from.push(newFrom - newPos); 10078 to.push(newTo - newPos); 10079 } 10080 return { mapped: value.length ? new _Chunk(from, to, value, maxPoint) : null, pos: newPos }; 10081 } 10082}; 10083var RangeSet = class _RangeSet { 10084 constructor(chunkPos, chunk, nextLayer, maxPoint) { 10085 this.chunkPos = chunkPos; 10086 this.chunk = chunk; 10087 this.nextLayer = nextLayer; 10088 this.maxPoint = maxPoint; 10089 } 10090 /** 10091 @internal 10092 */ 10093 static create(chunkPos, chunk, nextLayer, maxPoint) { 10094 return new _RangeSet(chunkPos, chunk, nextLayer, maxPoint); 10095 } 10096 /** 10097 @internal 10098 */ 10099 get length() { 10100 let last = this.chunk.length - 1; 10101 return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length); 10102 } 10103 /** 10104 The number of ranges in the set. 10105 */ 10106 get size() { 10107 if (this.isEmpty) 10108 return 0; 10109 let size = this.nextLayer.size; 10110 for (let chunk of this.chunk) 10111 size += chunk.value.length; 10112 return size; 10113 } 10114 /** 10115 @internal 10116 */ 10117 chunkEnd(index) { 10118 return this.chunkPos[index] + this.chunk[index].length; 10119 } 10120 /** 10121 Update the range set, optionally adding new ranges or filtering 10122 out existing ones. 10123 10124 (Note: The type parameter is just there as a kludge to work 10125 around TypeScript variance issues that prevented `RangeSet<X>` 10126 from being a subtype of `RangeSet<Y>` when `X` is a subtype of 10127 `Y`.) 10128 */ 10129 update(updateSpec) { 10130 let { add: add2 = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec; 10131 let filter = updateSpec.filter; 10132 if (add2.length == 0 && !filter) 10133 return this; 10134 if (sort) 10135 add2 = add2.slice().sort(cmpRange); 10136 if (this.isEmpty) 10137 return add2.length ? _RangeSet.of(add2) : this; 10138 let cur2 = new LayerCursor(this, null, -1).goto(0), i2 = 0, spill = []; 10139 let builder = new RangeSetBuilder(); 10140 while (cur2.value || i2 < add2.length) { 10141 if (i2 < add2.length && (cur2.from - add2[i2].from || cur2.startSide - add2[i2].value.startSide) >= 0) { 10142 let range = add2[i2++]; 10143 if (!builder.addInner(range.from, range.to, range.value)) 10144 spill.push(range); 10145 } else if (cur2.rangeIndex == 1 && cur2.chunkIndex < this.chunk.length && (i2 == add2.length || this.chunkEnd(cur2.chunkIndex) < add2[i2].from) && (!filter || filterFrom > this.chunkEnd(cur2.chunkIndex) || filterTo < this.chunkPos[cur2.chunkIndex]) && builder.addChunk(this.chunkPos[cur2.chunkIndex], this.chunk[cur2.chunkIndex])) { 10146 cur2.nextChunk(); 10147 } else { 10148 if (!filter || filterFrom > cur2.to || filterTo < cur2.from || filter(cur2.from, cur2.to, cur2.value)) { 10149 if (!builder.addInner(cur2.from, cur2.to, cur2.value)) 10150 spill.push(Range.create(cur2.from, cur2.to, cur2.value)); 10151 } 10152 cur2.next(); 10153 } 10154 } 10155 return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? _RangeSet.empty : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo })); 10156 } 10157 /** 10158 Map this range set through a set of changes, return the new set. 10159 */ 10160 map(changes) { 10161 if (changes.empty || this.isEmpty) 10162 return this; 10163 let chunks = [], chunkPos = [], maxPoint = -1; 10164 for (let i2 = 0; i2 < this.chunk.length; i2++) { 10165 let start = this.chunkPos[i2], chunk = this.chunk[i2]; 10166 let touch = changes.touchesRange(start, start + chunk.length); 10167 if (touch === false) { 10168 maxPoint = Math.max(maxPoint, chunk.maxPoint); 10169 chunks.push(chunk); 10170 chunkPos.push(changes.mapPos(start)); 10171 } else if (touch === true) { 10172 let { mapped, pos } = chunk.map(start, changes); 10173 if (mapped) { 10174 maxPoint = Math.max(maxPoint, mapped.maxPoint); 10175 chunks.push(mapped); 10176 chunkPos.push(pos); 10177 } 10178 } 10179 } 10180 let next = this.nextLayer.map(changes); 10181 return chunks.length == 0 ? next : new _RangeSet(chunkPos, chunks, next || _RangeSet.empty, maxPoint); 10182 } 10183 /** 10184 Iterate over the ranges that touch the region `from` to `to`, 10185 calling `f` for each. There is no guarantee that the ranges will 10186 be reported in any specific order. When the callback returns 10187 `false`, iteration stops. 10188 */ 10189 between(from, to, f3) { 10190 if (this.isEmpty) 10191 return; 10192 for (let i2 = 0; i2 < this.chunk.length; i2++) { 10193 let start = this.chunkPos[i2], chunk = this.chunk[i2]; 10194 if (to >= start && from <= start + chunk.length && chunk.between(start, from - start, to - start, f3) === false) 10195 return; 10196 } 10197 this.nextLayer.between(from, to, f3); 10198 } 10199 /** 10200 Iterate over the ranges in this set, in order, including all 10201 ranges that end at or after `from`. 10202 */ 10203 iter(from = 0) { 10204 return HeapCursor.from([this]).goto(from); 10205 } 10206 /** 10207 @internal 10208 */ 10209 get isEmpty() { 10210 return this.nextLayer == this; 10211 } 10212 /** 10213 Iterate over the ranges in a collection of sets, in order, 10214 starting from `from`. 10215 */ 10216 static iter(sets, from = 0) { 10217 return HeapCursor.from(sets).goto(from); 10218 } 10219 /** 10220 Iterate over two groups of sets, calling methods on `comparator` 10221 to notify it of possible differences. 10222 */ 10223 static compare(oldSets, newSets, textDiff, comparator, minPointSize = -1) { 10224 let a2 = oldSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); 10225 let b3 = newSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); 10226 let sharedChunks = findSharedChunks(a2, b3, textDiff); 10227 let sideA = new SpanCursor(a2, sharedChunks, minPointSize); 10228 let sideB = new SpanCursor(b3, sharedChunks, minPointSize); 10229 textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator)); 10230 if (textDiff.empty && textDiff.length == 0) 10231 compare(sideA, 0, sideB, 0, 0, comparator); 10232 } 10233 /** 10234 Compare the contents of two groups of range sets, returning true 10235 if they are equivalent in the given range. 10236 */ 10237 static eq(oldSets, newSets, from = 0, to) { 10238 if (to == null) 10239 to = 1e9 - 1; 10240 let a2 = oldSets.filter((set) => !set.isEmpty && newSets.indexOf(set) < 0); 10241 let b3 = newSets.filter((set) => !set.isEmpty && oldSets.indexOf(set) < 0); 10242 if (a2.length != b3.length) 10243 return false; 10244 if (!a2.length) 10245 return true; 10246 let sharedChunks = findSharedChunks(a2, b3); 10247 let sideA = new SpanCursor(a2, sharedChunks, 0).goto(from), sideB = new SpanCursor(b3, sharedChunks, 0).goto(from); 10248 for (; ; ) { 10249 if (sideA.to != sideB.to || !sameValues(sideA.active, sideB.active) || sideA.point && (!sideB.point || !sideA.point.eq(sideB.point))) 10250 return false; 10251 if (sideA.to > to) 10252 return true; 10253 sideA.next(); 10254 sideB.next(); 10255 } 10256 } 10257 /** 10258 Iterate over a group of range sets at the same time, notifying 10259 the iterator about the ranges covering every given piece of 10260 content. Returns the open count (see 10261 [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end 10262 of the iteration. 10263 */ 10264 static spans(sets, from, to, iterator, minPointSize = -1) { 10265 let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from; 10266 let openRanges = cursor.openStart; 10267 for (; ; ) { 10268 let curTo = Math.min(cursor.to, to); 10269 if (cursor.point) { 10270 let active = cursor.activeForPoint(cursor.to); 10271 let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges); 10272 iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank); 10273 openRanges = Math.min(cursor.openEnd(curTo), active.length); 10274 } else if (curTo > pos) { 10275 iterator.span(pos, curTo, cursor.active, openRanges); 10276 openRanges = cursor.openEnd(curTo); 10277 } 10278 if (cursor.to > to) 10279 return openRanges + (cursor.point && cursor.to > to ? 1 : 0); 10280 pos = cursor.to; 10281 cursor.next(); 10282 } 10283 } 10284 /** 10285 Create a range set for the given range or array of ranges. By 10286 default, this expects the ranges to be _sorted_ (by start 10287 position and, if two start at the same position, 10288 `value.startSide`). You can pass `true` as second argument to 10289 cause the method to sort them. 10290 */ 10291 static of(ranges, sort = false) { 10292 let build = new RangeSetBuilder(); 10293 for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges) 10294 build.add(range.from, range.to, range.value); 10295 return build.finish(); 10296 } 10297}; 10298RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1); 10299function lazySort(ranges) { 10300 if (ranges.length > 1) 10301 for (let prev = ranges[0], i2 = 1; i2 < ranges.length; i2++) { 10302 let cur2 = ranges[i2]; 10303 if (cmpRange(prev, cur2) > 0) 10304 return ranges.slice().sort(cmpRange); 10305 prev = cur2; 10306 } 10307 return ranges; 10308} 10309RangeSet.empty.nextLayer = RangeSet.empty; 10310var RangeSetBuilder = class _RangeSetBuilder { 10311 finishChunk(newArrays) { 10312 this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint)); 10313 this.chunkPos.push(this.chunkStart); 10314 this.chunkStart = -1; 10315 this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint); 10316 this.maxPoint = -1; 10317 if (newArrays) { 10318 this.from = []; 10319 this.to = []; 10320 this.value = []; 10321 } 10322 } 10323 /** 10324 Create an empty builder. 10325 */ 10326 constructor() { 10327 this.chunks = []; 10328 this.chunkPos = []; 10329 this.chunkStart = -1; 10330 this.last = null; 10331 this.lastFrom = -1e9; 10332 this.lastTo = -1e9; 10333 this.from = []; 10334 this.to = []; 10335 this.value = []; 10336 this.maxPoint = -1; 10337 this.setMaxPoint = -1; 10338 this.nextLayer = null; 10339 } 10340 /** 10341 Add a range. Ranges should be added in sorted (by `from` and 10342 `value.startSide`) order. 10343 */ 10344 add(from, to, value) { 10345 if (!this.addInner(from, to, value)) 10346 (this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).add(from, to, value); 10347 } 10348 /** 10349 @internal 10350 */ 10351 addInner(from, to, value) { 10352 let diff = from - this.lastTo || value.startSide - this.last.endSide; 10353 if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0) 10354 throw new Error("Ranges must be added sorted by `from` position and `startSide`"); 10355 if (diff < 0) 10356 return false; 10357 if (this.from.length == 250) 10358 this.finishChunk(true); 10359 if (this.chunkStart < 0) 10360 this.chunkStart = from; 10361 this.from.push(from - this.chunkStart); 10362 this.to.push(to - this.chunkStart); 10363 this.last = value; 10364 this.lastFrom = from; 10365 this.lastTo = to; 10366 this.value.push(value); 10367 if (value.point) 10368 this.maxPoint = Math.max(this.maxPoint, to - from); 10369 return true; 10370 } 10371 /** 10372 @internal 10373 */ 10374 addChunk(from, chunk) { 10375 if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0) 10376 return false; 10377 if (this.from.length) 10378 this.finishChunk(true); 10379 this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint); 10380 this.chunks.push(chunk); 10381 this.chunkPos.push(from); 10382 let last = chunk.value.length - 1; 10383 this.last = chunk.value[last]; 10384 this.lastFrom = chunk.from[last] + from; 10385 this.lastTo = chunk.to[last] + from; 10386 return true; 10387 } 10388 /** 10389 Finish the range set. Returns the new set. The builder can't be 10390 used anymore after this has been called. 10391 */ 10392 finish() { 10393 return this.finishInner(RangeSet.empty); 10394 } 10395 /** 10396 @internal 10397 */ 10398 finishInner(next) { 10399 if (this.from.length) 10400 this.finishChunk(false); 10401 if (this.chunks.length == 0) 10402 return next; 10403 let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint); 10404 this.from = null; 10405 return result; 10406 } 10407}; 10408function findSharedChunks(a2, b3, textDiff) { 10409 let inA = /* @__PURE__ */ new Map(); 10410 for (let set of a2) 10411 for (let i2 = 0; i2 < set.chunk.length; i2++) 10412 if (set.chunk[i2].maxPoint <= 0) 10413 inA.set(set.chunk[i2], set.chunkPos[i2]); 10414 let shared = /* @__PURE__ */ new Set(); 10415 for (let set of b3) 10416 for (let i2 = 0; i2 < set.chunk.length; i2++) { 10417 let known = inA.get(set.chunk[i2]); 10418 if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i2] && !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i2].length))) 10419 shared.add(set.chunk[i2]); 10420 } 10421 return shared; 10422} 10423var LayerCursor = class { 10424 constructor(layer2, skip, minPoint, rank = 0) { 10425 this.layer = layer2; 10426 this.skip = skip; 10427 this.minPoint = minPoint; 10428 this.rank = rank; 10429 } 10430 get startSide() { 10431 return this.value ? this.value.startSide : 0; 10432 } 10433 get endSide() { 10434 return this.value ? this.value.endSide : 0; 10435 } 10436 goto(pos, side = -1e9) { 10437 this.chunkIndex = this.rangeIndex = 0; 10438 this.gotoInner(pos, side, false); 10439 return this; 10440 } 10441 gotoInner(pos, side, forward) { 10442 while (this.chunkIndex < this.layer.chunk.length) { 10443 let next = this.layer.chunk[this.chunkIndex]; 10444 if (!(this.skip && this.skip.has(next) || this.layer.chunkEnd(this.chunkIndex) < pos || next.maxPoint < this.minPoint)) 10445 break; 10446 this.chunkIndex++; 10447 forward = false; 10448 } 10449 if (this.chunkIndex < this.layer.chunk.length) { 10450 let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); 10451 if (!forward || this.rangeIndex < rangeIndex) 10452 this.setRangeIndex(rangeIndex); 10453 } 10454 this.next(); 10455 } 10456 forward(pos, side) { 10457 if ((this.to - pos || this.endSide - side) < 0) 10458 this.gotoInner(pos, side, true); 10459 } 10460 next() { 10461 for (; ; ) { 10462 if (this.chunkIndex == this.layer.chunk.length) { 10463 this.from = this.to = 1e9; 10464 this.value = null; 10465 break; 10466 } else { 10467 let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex]; 10468 let from = chunkPos + chunk.from[this.rangeIndex]; 10469 this.from = from; 10470 this.to = chunkPos + chunk.to[this.rangeIndex]; 10471 this.value = chunk.value[this.rangeIndex]; 10472 this.setRangeIndex(this.rangeIndex + 1); 10473 if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) 10474 break; 10475 } 10476 } 10477 } 10478 setRangeIndex(index) { 10479 if (index == this.layer.chunk[this.chunkIndex].value.length) { 10480 this.chunkIndex++; 10481 if (this.skip) { 10482 while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) 10483 this.chunkIndex++; 10484 } 10485 this.rangeIndex = 0; 10486 } else { 10487 this.rangeIndex = index; 10488 } 10489 } 10490 nextChunk() { 10491 this.chunkIndex++; 10492 this.rangeIndex = 0; 10493 this.next(); 10494 } 10495 compare(other) { 10496 return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || this.to - other.to || this.endSide - other.endSide; 10497 } 10498}; 10499var HeapCursor = class _HeapCursor { 10500 constructor(heap) { 10501 this.heap = heap; 10502 } 10503 static from(sets, skip = null, minPoint = -1) { 10504 let heap = []; 10505 for (let i2 = 0; i2 < sets.length; i2++) { 10506 for (let cur2 = sets[i2]; !cur2.isEmpty; cur2 = cur2.nextLayer) { 10507 if (cur2.maxPoint >= minPoint) 10508 heap.push(new LayerCursor(cur2, skip, minPoint, i2)); 10509 } 10510 } 10511 return heap.length == 1 ? heap[0] : new _HeapCursor(heap); 10512 } 10513 get startSide() { 10514 return this.value ? this.value.startSide : 0; 10515 } 10516 goto(pos, side = -1e9) { 10517 for (let cur2 of this.heap) 10518 cur2.goto(pos, side); 10519 for (let i2 = this.heap.length >> 1; i2 >= 0; i2--) 10520 heapBubble(this.heap, i2); 10521 this.next(); 10522 return this; 10523 } 10524 forward(pos, side) { 10525 for (let cur2 of this.heap) 10526 cur2.forward(pos, side); 10527 for (let i2 = this.heap.length >> 1; i2 >= 0; i2--) 10528 heapBubble(this.heap, i2); 10529 if ((this.to - pos || this.value.endSide - side) < 0) 10530 this.next(); 10531 } 10532 next() { 10533 if (this.heap.length == 0) { 10534 this.from = this.to = 1e9; 10535 this.value = null; 10536 this.rank = -1; 10537 } else { 10538 let top2 = this.heap[0]; 10539 this.from = top2.from; 10540 this.to = top2.to; 10541 this.value = top2.value; 10542 this.rank = top2.rank; 10543 if (top2.value) 10544 top2.next(); 10545 heapBubble(this.heap, 0); 10546 } 10547 } 10548}; 10549function heapBubble(heap, index) { 10550 for (let cur2 = heap[index]; ; ) { 10551 let childIndex = (index << 1) + 1; 10552 if (childIndex >= heap.length) 10553 break; 10554 let child = heap[childIndex]; 10555 if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) { 10556 child = heap[childIndex + 1]; 10557 childIndex++; 10558 } 10559 if (cur2.compare(child) < 0) 10560 break; 10561 heap[childIndex] = cur2; 10562 heap[index] = child; 10563 index = childIndex; 10564 } 10565} 10566var SpanCursor = class { 10567 constructor(sets, skip, minPoint) { 10568 this.minPoint = minPoint; 10569 this.active = []; 10570 this.activeTo = []; 10571 this.activeRank = []; 10572 this.minActive = -1; 10573 this.point = null; 10574 this.pointFrom = 0; 10575 this.pointRank = 0; 10576 this.to = -1e9; 10577 this.endSide = 0; 10578 this.openStart = -1; 10579 this.cursor = HeapCursor.from(sets, skip, minPoint); 10580 } 10581 goto(pos, side = -1e9) { 10582 this.cursor.goto(pos, side); 10583 this.active.length = this.activeTo.length = this.activeRank.length = 0; 10584 this.minActive = -1; 10585 this.to = pos; 10586 this.endSide = side; 10587 this.openStart = -1; 10588 this.next(); 10589 return this; 10590 } 10591 forward(pos, side) { 10592 while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0) 10593 this.removeActive(this.minActive); 10594 this.cursor.forward(pos, side); 10595 } 10596 removeActive(index) { 10597 remove(this.active, index); 10598 remove(this.activeTo, index); 10599 remove(this.activeRank, index); 10600 this.minActive = findMinIndex(this.active, this.activeTo); 10601 } 10602 addActive(trackOpen) { 10603 let i2 = 0, { value, to, rank } = this.cursor; 10604 while (i2 < this.activeRank.length && this.activeRank[i2] <= rank) 10605 i2++; 10606 insert(this.active, i2, value); 10607 insert(this.activeTo, i2, to); 10608 insert(this.activeRank, i2, rank); 10609 if (trackOpen) 10610 insert(trackOpen, i2, this.cursor.from); 10611 this.minActive = findMinIndex(this.active, this.activeTo); 10612 } 10613 // After calling this, if `this.point` != null, the next range is a 10614 // point. Otherwise, it's a regular range, covered by `this.active`. 10615 next() { 10616 let from = this.to, wasPoint = this.point; 10617 this.point = null; 10618 let trackOpen = this.openStart < 0 ? [] : null; 10619 for (; ; ) { 10620 let a2 = this.minActive; 10621 if (a2 > -1 && (this.activeTo[a2] - this.cursor.from || this.active[a2].endSide - this.cursor.startSide) < 0) { 10622 if (this.activeTo[a2] > from) { 10623 this.to = this.activeTo[a2]; 10624 this.endSide = this.active[a2].endSide; 10625 break; 10626 } 10627 this.removeActive(a2); 10628 if (trackOpen) 10629 remove(trackOpen, a2); 10630 } else if (!this.cursor.value) { 10631 this.to = this.endSide = 1e9; 10632 break; 10633 } else if (this.cursor.from > from) { 10634 this.to = this.cursor.from; 10635 this.endSide = this.cursor.startSide; 10636 break; 10637 } else { 10638 let nextVal = this.cursor.value; 10639 if (!nextVal.point) { 10640 this.addActive(trackOpen); 10641 this.cursor.next(); 10642 } else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) { 10643 this.cursor.next(); 10644 } else { 10645 this.point = nextVal; 10646 this.pointFrom = this.cursor.from; 10647 this.pointRank = this.cursor.rank; 10648 this.to = this.cursor.to; 10649 this.endSide = nextVal.endSide; 10650 this.cursor.next(); 10651 this.forward(this.to, this.endSide); 10652 break; 10653 } 10654 } 10655 } 10656 if (trackOpen) { 10657 this.openStart = 0; 10658 for (let i2 = trackOpen.length - 1; i2 >= 0 && trackOpen[i2] < from; i2--) 10659 this.openStart++; 10660 } 10661 } 10662 activeForPoint(to) { 10663 if (!this.active.length) 10664 return this.active; 10665 let active = []; 10666 for (let i2 = this.active.length - 1; i2 >= 0; i2--) { 10667 if (this.activeRank[i2] < this.pointRank) 10668 break; 10669 if (this.activeTo[i2] > to || this.activeTo[i2] == to && this.active[i2].endSide >= this.point.endSide) 10670 active.push(this.active[i2]); 10671 } 10672 return active.reverse(); 10673 } 10674 openEnd(to) { 10675 let open = 0; 10676 for (let i2 = this.activeTo.length - 1; i2 >= 0 && this.activeTo[i2] > to; i2--) 10677 open++; 10678 return open; 10679 } 10680}; 10681function compare(a2, startA, b3, startB, length, comparator) { 10682 a2.goto(startA); 10683 b3.goto(startB); 10684 let endB = startB + length; 10685 let pos = startB, dPos = startB - startA; 10686 for (; ; ) { 10687 let diff = a2.to + dPos - b3.to || a2.endSide - b3.endSide; 10688 let end = diff < 0 ? a2.to + dPos : b3.to, clipEnd = Math.min(end, endB); 10689 if (a2.point || b3.point) { 10690 if (!(a2.point && b3.point && (a2.point == b3.point || a2.point.eq(b3.point)) && sameValues(a2.activeForPoint(a2.to), b3.activeForPoint(b3.to)))) 10691 comparator.comparePoint(pos, clipEnd, a2.point, b3.point); 10692 } else { 10693 if (clipEnd > pos && !sameValues(a2.active, b3.active)) 10694 comparator.compareRange(pos, clipEnd, a2.active, b3.active); 10695 } 10696 if (end > endB) 10697 break; 10698 pos = end; 10699 if (diff <= 0) 10700 a2.next(); 10701 if (diff >= 0) 10702 b3.next(); 10703 } 10704} 10705function sameValues(a2, b3) { 10706 if (a2.length != b3.length) 10707 return false; 10708 for (let i2 = 0; i2 < a2.length; i2++) 10709 if (a2[i2] != b3[i2] && !a2[i2].eq(b3[i2])) 10710 return false; 10711 return true; 10712} 10713function remove(array, index) { 10714 for (let i2 = index, e2 = array.length - 1; i2 < e2; i2++) 10715 array[i2] = array[i2 + 1]; 10716 array.pop(); 10717} 10718function insert(array, index, value) { 10719 for (let i2 = array.length - 1; i2 >= index; i2--) 10720 array[i2 + 1] = array[i2]; 10721 array[index] = value; 10722} 10723function findMinIndex(value, array) { 10724 let found = -1, foundPos = 1e9; 10725 for (let i2 = 0; i2 < array.length; i2++) 10726 if ((array[i2] - foundPos || value[i2].endSide - value[found].endSide) < 0) { 10727 found = i2; 10728 foundPos = array[i2]; 10729 } 10730 return found; 10731} 10732function countColumn(string2, tabSize, to = string2.length) { 10733 let n3 = 0; 10734 for (let i2 = 0; i2 < to; ) { 10735 if (string2.charCodeAt(i2) == 9) { 10736 n3 += tabSize - n3 % tabSize; 10737 i2++; 10738 } else { 10739 n3++; 10740 i2 = findClusterBreak(string2, i2); 10741 } 10742 } 10743 return n3; 10744} 10745function findColumn(string2, col, tabSize, strict) { 10746 for (let i2 = 0, n3 = 0; ; ) { 10747 if (n3 >= col) 10748 return i2; 10749 if (i2 == string2.length) 10750 break; 10751 n3 += string2.charCodeAt(i2) == 9 ? tabSize - n3 % tabSize : 1; 10752 i2 = findClusterBreak(string2, i2); 10753 } 10754 return strict === true ? -1 : string2.length; 10755} 10756
vendor: 5,243 bytes, lines 10757-10895
10757// node_modules/style-mod/src/style-mod.js 10758var C = "\u037C"; 10759var COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C); 10760var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"); 10761var top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {}; 10762var StyleModule = class { 10763 // :: (Object<Style>, ?{finish: ?(string) → string}) 10764 // Create a style module from the given spec. 10765 // 10766 // When `finish` is given, it is called on regular (non-`@`) 10767 // selectors (after `&` expansion) to compute the final selector. 10768 constructor(spec, options2) { 10769 this.rules = []; 10770 let { finish } = options2 || {}; 10771 function splitSelector(selector) { 10772 return /^@/.test(selector) ? [selector] : selector.split(/,\s*/); 10773 } 10774 function render(selectors, spec2, target, isKeyframes) { 10775 let local = [], isAt = /^@(\w+)\b/.exec(selectors[0]), keyframes = isAt && isAt[1] == "keyframes"; 10776 if (isAt && spec2 == null) 10777 return target.push(selectors[0] + ";"); 10778 for (let prop in spec2) { 10779 let value = spec2[prop]; 10780 if (/&/.test(prop)) { 10781 render( 10782 prop.split(/,\s*/).map((part) => selectors.map((sel) => part.replace(/&/, sel))).reduce((a2, b3) => a2.concat(b3)), 10783 value, 10784 target 10785 ); 10786 } else if (value && typeof value == "object") { 10787 if (!isAt) 10788 throw new RangeError("The value of a property (" + prop + ") should be a primitive value."); 10789 render(splitSelector(prop), value, local, keyframes); 10790 } else if (value != null) { 10791 local.push(prop.replace(/_.*/, "").replace(/[A-Z]/g, (l3) => "-" + l3.toLowerCase()) + ": " + value + ";"); 10792 } 10793 } 10794 if (local.length || keyframes) { 10795 target.push((finish && !isAt && !isKeyframes ? selectors.map(finish) : selectors).join(", ") + " {" + local.join(" ") + "}"); 10796 } 10797 } 10798 for (let prop in spec) 10799 render(splitSelector(prop), spec[prop], this.rules); 10800 } 10801 // :: () → string 10802 // Returns a string containing the module's CSS rules. 10803 getRules() { 10804 return this.rules.join("\n"); 10805 } 10806 // :: () → string 10807 // Generate a new unique CSS class name. 10808 static newName() { 10809 let id2 = top[COUNT] || 1; 10810 top[COUNT] = id2 + 1; 10811 return C + id2.toString(36); 10812 } 10813 // :: (union<Document, ShadowRoot>, union<[StyleModule], StyleModule>, ?{nonce: ?string}) 10814 // 10815 // Mount the given set of modules in the given DOM root, which ensures 10816 // that the CSS rules defined by the module are available in that 10817 // context. 10818 // 10819 // Rules are only added to the document once per root. 10820 // 10821 // Rule order will follow the order of the modules, so that rules from 10822 // modules later in the array take precedence of those from earlier 10823 // modules. If you call this function multiple times for the same root 10824 // in a way that changes the order of already mounted modules, the old 10825 // order will be changed. 10826 // 10827 // If a Content Security Policy nonce is provided, it is added to 10828 // the `<style>` tag generated by the library. 10829 static mount(root, modules, options2) { 10830 let set = root[SET], nonce = options2 && options2.nonce; 10831 if (!set) 10832 set = new StyleSet(root, nonce); 10833 else if (nonce) 10834 set.setNonce(nonce); 10835 set.mount(Array.isArray(modules) ? modules : [modules]); 10836 } 10837}; 10838var adoptedSet = /* @__PURE__ */ new Map(); 10839var StyleSet = class { 10840 constructor(root, nonce) { 10841 let doc2 = root.ownerDocument || root, win = doc2.defaultView; 10842 if (!root.head && root.adoptedStyleSheets && win.CSSStyleSheet) { 10843 let adopted = adoptedSet.get(doc2); 10844 if (adopted) { 10845 root.adoptedStyleSheets = [adopted.sheet, ...root.adoptedStyleSheets]; 10846 return root[SET] = adopted; 10847 } 10848 this.sheet = new win.CSSStyleSheet(); 10849 root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets]; 10850 adoptedSet.set(doc2, this); 10851 } else { 10852 this.styleTag = doc2.createElement("style"); 10853 if (nonce) 10854 this.styleTag.setAttribute("nonce", nonce); 10855 let target = root.head || root; 10856 target.insertBefore(this.styleTag, target.firstChild); 10857 } 10858 this.modules = []; 10859 root[SET] = this; 10860 } 10861 mount(modules) { 10862 let sheet = this.sheet; 10863 let pos = 0, j3 = 0; 10864 for (let i2 = 0; i2 < modules.length; i2++) { 10865 let mod = modules[i2], index = this.modules.indexOf(mod); 10866 if (index < j3 && index > -1) { 10867 this.modules.splice(index, 1); 10868 j3--; 10869 index = -1; 10870 } 10871 if (index == -1) { 10872 this.modules.splice(j3++, 0, mod); 10873 if (sheet) 10874 for (let k = 0; k < mod.rules.length; k++) 10875 sheet.insertRule(mod.rules[k], pos++); 10876 } else { 10877 while (j3 < index) 10878 pos += this.modules[j3++].rules.length; 10879 pos += mod.rules.length; 10880 j3++; 10881 } 10882 } 10883 if (!sheet) { 10884 let text = ""; 10885 for (let i2 = 0; i2 < this.modules.length; i2++) 10886 text += this.modules[i2].getRules() + "\n"; 10887 this.styleTag.textContent = text; 10888 } 10889 } 10890 setNonce(nonce) { 10891 if (this.styleTag && this.styleTag.getAttribute("nonce") != nonce) 10892 this.styleTag.setAttribute("nonce", nonce); 10893 } 10894}; 10895
vendor: 2,293 bytes, lines 10896-11011
10896// node_modules/w3c-keyname/index.js 10897var base = { 10898 8: "Backspace", 10899 9: "Tab", 10900 10: "Enter", 10901 12: "NumLock", 10902 13: "Enter", 10903 16: "Shift", 10904 17: "Control", 10905 18: "Alt", 10906 20: "CapsLock", 10907 27: "Escape", 10908 32: " ", 10909 33: "PageUp", 10910 34: "PageDown", 10911 35: "End", 10912 36: "Home", 10913 37: "ArrowLeft", 10914 38: "ArrowUp", 10915 39: "ArrowRight", 10916 40: "ArrowDown", 10917 44: "PrintScreen", 10918 45: "Insert", 10919 46: "Delete", 10920 59: ";", 10921 61: "=", 10922 91: "Meta", 10923 92: "Meta", 10924 106: "*", 10925 107: "+", 10926 108: ",", 10927 109: "-", 10928 110: ".", 10929 111: "/", 10930 144: "NumLock", 10931 145: "ScrollLock", 10932 160: "Shift", 10933 161: "Shift", 10934 162: "Control", 10935 163: "Control", 10936 164: "Alt", 10937 165: "Alt", 10938 173: "-", 10939 186: ";", 10940 187: "=", 10941 188: ",", 10942 189: "-", 10943 190: ".", 10944 191: "/", 10945 192: "`", 10946 219: "[", 10947 220: "\\", 10948 221: "]", 10949 222: "'" 10950}; 10951var shift = { 10952 48: ")", 10953 49: "!", 10954 50: "@", 10955 51: "#", 10956 52: "$", 10957 53: "%", 10958 54: "^", 10959 55: "&", 10960 56: "*", 10961 57: "(", 10962 59: ":", 10963 61: "+", 10964 173: "_", 10965 186: ":", 10966 187: "+", 10967 188: "<", 10968 189: "_", 10969 190: ">", 10970 191: "?", 10971 192: "~", 10972 219: "{", 10973 220: "|", 10974 221: "}", 10975 222: '"' 10976}; 10977var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform); 10978var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent); 10979for (i2 = 0; i2 < 10; i2++) 10980 base[48 + i2] = base[96 + i2] = String(i2); 10981var i2; 10982for (i2 = 1; i2 <= 24; i2++) 10983 base[i2 + 111] = "F" + i2; 10984var i2; 10985for (i2 = 65; i2 <= 90; i2++) { 10986 base[i2] = String.fromCharCode(i2 + 32); 10987 shift[i2] = String.fromCharCode(i2); 10988} 10989var i2; 10990for (code in base) 10991 if (!shift.hasOwnProperty(code)) 10992 shift[code] = base[code]; 10993var code; 10994function keyName(event) { 10995 var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified"; 10996 var name2 = !ignoreKey && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || "Unidentified"; 10997 if (name2 == "Esc") 10998 name2 = "Escape"; 10999 if (name2 == "Del") 11000 name2 = "Delete"; 11001 if (name2 == "Left") 11002 name2 = "ArrowLeft"; 11003 if (name2 == "Up") 11004 name2 = "ArrowUp"; 11005 if (name2 == "Right") 11006 name2 = "ArrowRight"; 11007 if (name2 == "Down") 11008 name2 = "ArrowDown"; 11009 return name2; 11010} 11011
vendor: 333,412 bytes, lines 11012-20297
11012// node_modules/@codemirror/view/dist/index.js 11013function getSelection(root) { 11014 let target; 11015 if (root.nodeType == 11) { 11016 target = root.getSelection ? root : root.ownerDocument; 11017 } else { 11018 target = root; 11019 } 11020 return target.getSelection(); 11021} 11022function contains(dom, node) { 11023 return node ? dom == node || dom.contains(node.nodeType != 1 ? node.parentNode : node) : false; 11024} 11025function deepActiveElement(doc2) { 11026 let elt = doc2.activeElement; 11027 while (elt && elt.shadowRoot) 11028 elt = elt.shadowRoot.activeElement; 11029 return elt; 11030} 11031function hasSelection(dom, selection) { 11032 if (!selection.anchorNode) 11033 return false; 11034 try { 11035 return contains(dom, selection.anchorNode); 11036 } catch (_2) { 11037 return false; 11038 } 11039} 11040function clientRectsFor(dom) { 11041 if (dom.nodeType == 3) 11042 return textRange(dom, 0, dom.nodeValue.length).getClientRects(); 11043 else if (dom.nodeType == 1) 11044 return dom.getClientRects(); 11045 else 11046 return []; 11047} 11048function isEquivalentPosition(node, off, targetNode, targetOff) { 11049 return targetNode ? scanFor(node, off, targetNode, targetOff, -1) || scanFor(node, off, targetNode, targetOff, 1) : false; 11050} 11051function domIndex(node) { 11052 for (var index = 0; ; index++) { 11053 node = node.previousSibling; 11054 if (!node) 11055 return index; 11056 } 11057} 11058function scanFor(node, off, targetNode, targetOff, dir) { 11059 for (; ; ) { 11060 if (node == targetNode && off == targetOff) 11061 return true; 11062 if (off == (dir < 0 ? 0 : maxOffset(node))) { 11063 if (node.nodeName == "DIV") 11064 return false; 11065 let parent = node.parentNode; 11066 if (!parent || parent.nodeType != 1) 11067 return false; 11068 off = domIndex(node) + (dir < 0 ? 0 : 1); 11069 node = parent; 11070 } else if (node.nodeType == 1) { 11071 node = node.childNodes[off + (dir < 0 ? -1 : 0)]; 11072 if (node.nodeType == 1 && node.contentEditable == "false") 11073 return false; 11074 off = dir < 0 ? maxOffset(node) : 0; 11075 } else { 11076 return false; 11077 } 11078 } 11079} 11080function maxOffset(node) { 11081 return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length; 11082} 11083function flattenRect(rect, left) { 11084 let x = left ? rect.left : rect.right; 11085 return { left: x, right: x, top: rect.top, bottom: rect.bottom }; 11086} 11087function windowRect(win) { 11088 return { 11089 left: 0, 11090 right: win.innerWidth, 11091 top: 0, 11092 bottom: win.innerHeight 11093 }; 11094} 11095function scrollRectIntoView(dom, rect, side, x, y2, xMargin, yMargin, ltr) { 11096 let doc2 = dom.ownerDocument, win = doc2.defaultView || window; 11097 for (let cur2 = dom, stop = false; cur2 && !stop; ) { 11098 if (cur2.nodeType == 1) { 11099 let bounding, top2 = cur2 == doc2.body; 11100 let scaleX = 1, scaleY = 1; 11101 if (top2) { 11102 bounding = windowRect(win); 11103 } else { 11104 if (/^(fixed|sticky)$/.test(getComputedStyle(cur2).position)) 11105 stop = true; 11106 if (cur2.scrollHeight <= cur2.clientHeight && cur2.scrollWidth <= cur2.clientWidth) { 11107 cur2 = cur2.assignedSlot || cur2.parentNode; 11108 continue; 11109 } 11110 let rect2 = cur2.getBoundingClientRect(); 11111 scaleX = rect2.width / cur2.offsetWidth; 11112 scaleY = rect2.height / cur2.offsetHeight; 11113 bounding = { 11114 left: rect2.left, 11115 right: rect2.left + cur2.clientWidth * scaleX, 11116 top: rect2.top, 11117 bottom: rect2.top + cur2.clientHeight * scaleY 11118 }; 11119 } 11120 let moveX = 0, moveY = 0; 11121 if (y2 == "nearest") { 11122 if (rect.top < bounding.top) { 11123 moveY = -(bounding.top - rect.top + yMargin); 11124 if (side > 0 && rect.bottom > bounding.bottom + moveY) 11125 moveY = rect.bottom - bounding.bottom + moveY + yMargin; 11126 } else if (rect.bottom > bounding.bottom) { 11127 moveY = rect.bottom - bounding.bottom + yMargin; 11128 if (side < 0 && rect.top - moveY < bounding.top) 11129 moveY = -(bounding.top + moveY - rect.top + yMargin); 11130 } 11131 } else { 11132 let rectHeight = rect.bottom - rect.top, boundingHeight = bounding.bottom - bounding.top; 11133 let targetTop = y2 == "center" && rectHeight <= boundingHeight ? rect.top + rectHeight / 2 - boundingHeight / 2 : y2 == "start" || y2 == "center" && side < 0 ? rect.top - yMargin : rect.bottom - boundingHeight + yMargin; 11134 moveY = targetTop - bounding.top; 11135 } 11136 if (x == "nearest") { 11137 if (rect.left < bounding.left) { 11138 moveX = -(bounding.left - rect.left + xMargin); 11139 if (side > 0 && rect.right > bounding.right + moveX) 11140 moveX = rect.right - bounding.right + moveX + xMargin; 11141 } else if (rect.right > bounding.right) { 11142 moveX = rect.right - bounding.right + xMargin; 11143 if (side < 0 && rect.left < bounding.left + moveX) 11144 moveX = -(bounding.left + moveX - rect.left + xMargin); 11145 } 11146 } else { 11147 let targetLeft = x == "center" ? rect.left + (rect.right - rect.left) / 2 - (bounding.right - bounding.left) / 2 : x == "start" == ltr ? rect.left - xMargin : rect.right - (bounding.right - bounding.left) + xMargin; 11148 moveX = targetLeft - bounding.left; 11149 } 11150 if (moveX || moveY) { 11151 if (top2) { 11152 win.scrollBy(moveX, moveY); 11153 } else { 11154 let movedX = 0, movedY = 0; 11155 if (moveY) { 11156 let start = cur2.scrollTop; 11157 cur2.scrollTop += moveY / scaleY; 11158 movedY = (cur2.scrollTop - start) * scaleY; 11159 } 11160 if (moveX) { 11161 let start = cur2.scrollLeft; 11162 cur2.scrollLeft += moveX / scaleX; 11163 movedX = (cur2.scrollLeft - start) * scaleX; 11164 } 11165 rect = { 11166 left: rect.left - movedX, 11167 top: rect.top - movedY, 11168 right: rect.right - movedX, 11169 bottom: rect.bottom - movedY 11170 }; 11171 if (movedX && Math.abs(movedX - moveX) < 1) 11172 x = "nearest"; 11173 if (movedY && Math.abs(movedY - moveY) < 1) 11174 y2 = "nearest"; 11175 } 11176 } 11177 if (top2) 11178 break; 11179 cur2 = cur2.assignedSlot || cur2.parentNode; 11180 } else if (cur2.nodeType == 11) { 11181 cur2 = cur2.host; 11182 } else { 11183 break; 11184 } 11185 } 11186} 11187function scrollableParent(dom) { 11188 let doc2 = dom.ownerDocument; 11189 for (let cur2 = dom.parentNode; cur2; ) { 11190 if (cur2 == doc2.body) { 11191 break; 11192 } else if (cur2.nodeType == 1) { 11193 if (cur2.scrollHeight > cur2.clientHeight || cur2.scrollWidth > cur2.clientWidth) 11194 return cur2; 11195 cur2 = cur2.assignedSlot || cur2.parentNode; 11196 } else if (cur2.nodeType == 11) { 11197 cur2 = cur2.host; 11198 } else { 11199 break; 11200 } 11201 } 11202 return null; 11203} 11204var DOMSelectionState = class { 11205 constructor() { 11206 this.anchorNode = null; 11207 this.anchorOffset = 0; 11208 this.focusNode = null; 11209 this.focusOffset = 0; 11210 } 11211 eq(domSel) { 11212 return this.anchorNode == domSel.anchorNode && this.anchorOffset == domSel.anchorOffset && this.focusNode == domSel.focusNode && this.focusOffset == domSel.focusOffset; 11213 } 11214 setRange(range) { 11215 let { anchorNode, focusNode } = range; 11216 this.set(anchorNode, Math.min(range.anchorOffset, anchorNode ? maxOffset(anchorNode) : 0), focusNode, Math.min(range.focusOffset, focusNode ? maxOffset(focusNode) : 0)); 11217 } 11218 set(anchorNode, anchorOffset, focusNode, focusOffset) { 11219 this.anchorNode = anchorNode; 11220 this.anchorOffset = anchorOffset; 11221 this.focusNode = focusNode; 11222 this.focusOffset = focusOffset; 11223 } 11224}; 11225var preventScrollSupported = null; 11226function focusPreventScroll(dom) { 11227 if (dom.setActive) 11228 return dom.setActive(); 11229 if (preventScrollSupported) 11230 return dom.focus(preventScrollSupported); 11231 let stack = []; 11232 for (let cur2 = dom; cur2; cur2 = cur2.parentNode) { 11233 stack.push(cur2, cur2.scrollTop, cur2.scrollLeft); 11234 if (cur2 == cur2.ownerDocument) 11235 break; 11236 } 11237 dom.focus(preventScrollSupported == null ? { 11238 get preventScroll() { 11239 preventScrollSupported = { preventScroll: true }; 11240 return true; 11241 } 11242 } : void 0); 11243 if (!preventScrollSupported) { 11244 preventScrollSupported = false; 11245 for (let i2 = 0; i2 < stack.length; ) { 11246 let elt = stack[i2++], top2 = stack[i2++], left = stack[i2++]; 11247 if (elt.scrollTop != top2) 11248 elt.scrollTop = top2; 11249 if (elt.scrollLeft != left) 11250 elt.scrollLeft = left; 11251 } 11252 } 11253} 11254var scratchRange; 11255function textRange(node, from, to = from) { 11256 let range = scratchRange || (scratchRange = document.createRange()); 11257 range.setEnd(node, to); 11258 range.setStart(node, from); 11259 return range; 11260} 11261function dispatchKey(elt, name2, code) { 11262 let options2 = { key: name2, code: name2, keyCode: code, which: code, cancelable: true }; 11263 let down = new KeyboardEvent("keydown", options2); 11264 down.synthetic = true; 11265 elt.dispatchEvent(down); 11266 let up = new KeyboardEvent("keyup", options2); 11267 up.synthetic = true; 11268 elt.dispatchEvent(up); 11269 return down.defaultPrevented || up.defaultPrevented; 11270} 11271function getRoot(node) { 11272 while (node) { 11273 if (node && (node.nodeType == 9 || node.nodeType == 11 && node.host)) 11274 return node; 11275 node = node.assignedSlot || node.parentNode; 11276 } 11277 return null; 11278} 11279function clearAttributes(node) { 11280 while (node.attributes.length) 11281 node.removeAttributeNode(node.attributes[0]); 11282} 11283function atElementStart(doc2, selection) { 11284 let node = selection.focusNode, offset = selection.focusOffset; 11285 if (!node || selection.anchorNode != node || selection.anchorOffset != offset) 11286 return false; 11287 offset = Math.min(offset, maxOffset(node)); 11288 for (; ; ) { 11289 if (offset) { 11290 if (node.nodeType != 1) 11291 return false; 11292 let prev = node.childNodes[offset - 1]; 11293 if (prev.contentEditable == "false") 11294 offset--; 11295 else { 11296 node = prev; 11297 offset = maxOffset(node); 11298 } 11299 } else if (node == doc2) { 11300 return true; 11301 } else { 11302 offset = domIndex(node); 11303 node = node.parentNode; 11304 } 11305 } 11306} 11307function isScrolledToBottom(elt) { 11308 return elt.scrollTop > Math.max(1, elt.scrollHeight - elt.clientHeight - 4); 11309} 11310var DOMPos = class _DOMPos { 11311 constructor(node, offset, precise = true) { 11312 this.node = node; 11313 this.offset = offset; 11314 this.precise = precise; 11315 } 11316 static before(dom, precise) { 11317 return new _DOMPos(dom.parentNode, domIndex(dom), precise); 11318 } 11319 static after(dom, precise) { 11320 return new _DOMPos(dom.parentNode, domIndex(dom) + 1, precise); 11321 } 11322}; 11323var noChildren = []; 11324var ContentView = class _ContentView { 11325 constructor() { 11326 this.parent = null; 11327 this.dom = null; 11328 this.flags = 2; 11329 } 11330 get overrideDOMText() { 11331 return null; 11332 } 11333 get posAtStart() { 11334 return this.parent ? this.parent.posBefore(this) : 0; 11335 } 11336 get posAtEnd() { 11337 return this.posAtStart + this.length; 11338 } 11339 posBefore(view) { 11340 let pos = this.posAtStart; 11341 for (let child of this.children) { 11342 if (child == view) 11343 return pos; 11344 pos += child.length + child.breakAfter; 11345 } 11346 throw new RangeError("Invalid child in posBefore"); 11347 } 11348 posAfter(view) { 11349 return this.posBefore(view) + view.length; 11350 } 11351 sync(view, track) { 11352 if (this.flags & 2) { 11353 let parent = this.dom; 11354 let prev = null, next; 11355 for (let child of this.children) { 11356 if (child.flags & 7) { 11357 if (!child.dom && (next = prev ? prev.nextSibling : parent.firstChild)) { 11358 let contentView = _ContentView.get(next); 11359 if (!contentView || !contentView.parent && contentView.canReuseDOM(child)) 11360 child.reuseDOM(next); 11361 } 11362 child.sync(view, track); 11363 child.flags &= ~7; 11364 } 11365 next = prev ? prev.nextSibling : parent.firstChild; 11366 if (track && !track.written && track.node == parent && next != child.dom) 11367 track.written = true; 11368 if (child.dom.parentNode == parent) { 11369 while (next && next != child.dom) 11370 next = rm$1(next); 11371 } else { 11372 parent.insertBefore(child.dom, next); 11373 } 11374 prev = child.dom; 11375 } 11376 next = prev ? prev.nextSibling : parent.firstChild; 11377 if (next && track && track.node == parent) 11378 track.written = true; 11379 while (next) 11380 next = rm$1(next); 11381 } else if (this.flags & 1) { 11382 for (let child of this.children) 11383 if (child.flags & 7) { 11384 child.sync(view, track); 11385 child.flags &= ~7; 11386 } 11387 } 11388 } 11389 reuseDOM(_dom) { 11390 } 11391 localPosFromDOM(node, offset) { 11392 let after; 11393 if (node == this.dom) { 11394 after = this.dom.childNodes[offset]; 11395 } else { 11396 let bias = maxOffset(node) == 0 ? 0 : offset == 0 ? -1 : 1; 11397 for (; ; ) { 11398 let parent = node.parentNode; 11399 if (parent == this.dom) 11400 break; 11401 if (bias == 0 && parent.firstChild != parent.lastChild) { 11402 if (node == parent.firstChild) 11403 bias = -1; 11404 else 11405 bias = 1; 11406 } 11407 node = parent; 11408 } 11409 if (bias < 0) 11410 after = node; 11411 else 11412 after = node.nextSibling; 11413 } 11414 if (after == this.dom.firstChild) 11415 return 0; 11416 while (after && !_ContentView.get(after)) 11417 after = after.nextSibling; 11418 if (!after) 11419 return this.length; 11420 for (let i2 = 0, pos = 0; ; i2++) { 11421 let child = this.children[i2]; 11422 if (child.dom == after) 11423 return pos; 11424 pos += child.length + child.breakAfter; 11425 } 11426 } 11427 domBoundsAround(from, to, offset = 0) { 11428 let fromI = -1, fromStart = -1, toI = -1, toEnd = -1; 11429 for (let i2 = 0, pos = offset, prevEnd = offset; i2 < this.children.length; i2++) { 11430 let child = this.children[i2], end = pos + child.length; 11431 if (pos < from && end > to) 11432 return child.domBoundsAround(from, to, pos); 11433 if (end >= from && fromI == -1) { 11434 fromI = i2; 11435 fromStart = pos; 11436 } 11437 if (pos > to && child.dom.parentNode == this.dom) { 11438 toI = i2; 11439 toEnd = prevEnd; 11440 break; 11441 } 11442 prevEnd = end; 11443 pos = end + child.breakAfter; 11444 } 11445 return { 11446 from: fromStart, 11447 to: toEnd < 0 ? offset + this.length : toEnd, 11448 startDOM: (fromI ? this.children[fromI - 1].dom.nextSibling : null) || this.dom.firstChild, 11449 endDOM: toI < this.children.length && toI >= 0 ? this.children[toI].dom : null 11450 }; 11451 } 11452 markDirty(andParent = false) { 11453 this.flags |= 2; 11454 this.markParentsDirty(andParent); 11455 } 11456 markParentsDirty(childList) { 11457 for (let parent = this.parent; parent; parent = parent.parent) { 11458 if (childList) 11459 parent.flags |= 2; 11460 if (parent.flags & 1) 11461 return; 11462 parent.flags |= 1; 11463 childList = false; 11464 } 11465 } 11466 setParent(parent) { 11467 if (this.parent != parent) { 11468 this.parent = parent; 11469 if (this.flags & 7) 11470 this.markParentsDirty(true); 11471 } 11472 } 11473 setDOM(dom) { 11474 if (this.dom == dom) 11475 return; 11476 if (this.dom) 11477 this.dom.cmView = null; 11478 this.dom = dom; 11479 dom.cmView = this; 11480 } 11481 get rootView() { 11482 for (let v2 = this; ; ) { 11483 let parent = v2.parent; 11484 if (!parent) 11485 return v2; 11486 v2 = parent; 11487 } 11488 } 11489 replaceChildren(from, to, children = noChildren) { 11490 this.markDirty(); 11491 for (let i2 = from; i2 < to; i2++) { 11492 let child = this.children[i2]; 11493 if (child.parent == this && children.indexOf(child) < 0) 11494 child.destroy(); 11495 } 11496 this.children.splice(from, to - from, ...children); 11497 for (let i2 = 0; i2 < children.length; i2++) 11498 children[i2].setParent(this); 11499 } 11500 ignoreMutation(_rec) { 11501 return false; 11502 } 11503 ignoreEvent(_event) { 11504 return false; 11505 } 11506 childCursor(pos = this.length) { 11507 return new ChildCursor(this.children, pos, this.children.length); 11508 } 11509 childPos(pos, bias = 1) { 11510 return this.childCursor().findPos(pos, bias); 11511 } 11512 toString() { 11513 let name2 = this.constructor.name.replace("View", ""); 11514 return name2 + (this.children.length ? "(" + this.children.join() + ")" : this.length ? "[" + (name2 == "Text" ? this.text : this.length) + "]" : "") + (this.breakAfter ? "#" : ""); 11515 } 11516 static get(node) { 11517 return node.cmView; 11518 } 11519 get isEditable() { 11520 return true; 11521 } 11522 get isWidget() { 11523 return false; 11524 } 11525 get isHidden() { 11526 return false; 11527 } 11528 merge(from, to, source, hasStart, openStart, openEnd) { 11529 return false; 11530 } 11531 become(other) { 11532 return false; 11533 } 11534 canReuseDOM(other) { 11535 return other.constructor == this.constructor && !((this.flags | other.flags) & 8); 11536 } 11537 // When this is a zero-length view with a side, this should return a 11538 // number <= 0 to indicate it is before its position, or a 11539 // number > 0 when after its position. 11540 getSide() { 11541 return 0; 11542 } 11543 destroy() { 11544 for (let child of this.children) 11545 child.destroy(); 11546 this.parent = null; 11547 } 11548}; 11549ContentView.prototype.breakAfter = 0; 11550function rm$1(dom) { 11551 let next = dom.nextSibling; 11552 dom.parentNode.removeChild(dom); 11553 return next; 11554} 11555var ChildCursor = class { 11556 constructor(children, pos, i2) { 11557 this.children = children; 11558 this.pos = pos; 11559 this.i = i2; 11560 this.off = 0; 11561 } 11562 findPos(pos, bias = 1) { 11563 for (; ; ) { 11564 if (pos > this.pos || pos == this.pos && (bias > 0 || this.i == 0 || this.children[this.i - 1].breakAfter)) { 11565 this.off = pos - this.pos; 11566 return this; 11567 } 11568 let next = this.children[--this.i]; 11569 this.pos -= next.length + next.breakAfter; 11570 } 11571 } 11572}; 11573function replaceRange(parent, fromI, fromOff, toI, toOff, insert2, breakAtStart, openStart, openEnd) { 11574 let { children } = parent; 11575 let before = children.length ? children[fromI] : null; 11576 let last = insert2.length ? insert2[insert2.length - 1] : null; 11577 let breakAtEnd = last ? last.breakAfter : breakAtStart; 11578 if (fromI == toI && before && !breakAtStart && !breakAtEnd && insert2.length < 2 && before.merge(fromOff, toOff, insert2.length ? last : null, fromOff == 0, openStart, openEnd)) 11579 return; 11580 if (toI < children.length) { 11581 let after = children[toI]; 11582 if (after && (toOff < after.length || after.breakAfter && (last === null || last === void 0 ? void 0 : last.breakAfter))) { 11583 if (fromI == toI) { 11584 after = after.split(toOff); 11585 toOff = 0; 11586 } 11587 if (!breakAtEnd && last && after.merge(0, toOff, last, true, 0, openEnd)) { 11588 insert2[insert2.length - 1] = after; 11589 } else { 11590 if (toOff || after.children.length && !after.children[0].length) 11591 after.merge(0, toOff, null, false, 0, openEnd); 11592 insert2.push(after); 11593 } 11594 } else if (after === null || after === void 0 ? void 0 : after.breakAfter) { 11595 if (last) 11596 last.breakAfter = 1; 11597 else 11598 breakAtStart = 1; 11599 } 11600 toI++; 11601 } 11602 if (before) { 11603 before.breakAfter = breakAtStart; 11604 if (fromOff > 0) { 11605 if (!breakAtStart && insert2.length && before.merge(fromOff, before.length, insert2[0], false, openStart, 0)) { 11606 before.breakAfter = insert2.shift().breakAfter; 11607 } else if (fromOff < before.length || before.children.length && before.children[before.children.length - 1].length == 0) { 11608 before.merge(fromOff, before.length, null, false, openStart, 0); 11609 } 11610 fromI++; 11611 } 11612 } 11613 while (fromI < toI && insert2.length) { 11614 if (children[toI - 1].become(insert2[insert2.length - 1])) { 11615 toI--; 11616 insert2.pop(); 11617 openEnd = insert2.length ? 0 : openStart; 11618 } else if (children[fromI].become(insert2[0])) { 11619 fromI++; 11620 insert2.shift(); 11621 openStart = insert2.length ? 0 : openEnd; 11622 } else { 11623 break; 11624 } 11625 } 11626 if (!insert2.length && fromI && toI < children.length && !children[fromI - 1].breakAfter && children[toI].merge(0, 0, children[fromI - 1], false, openStart, openEnd)) 11627 fromI--; 11628 if (fromI < toI || insert2.length) 11629 parent.replaceChildren(fromI, toI, insert2); 11630} 11631function mergeChildrenInto(parent, from, to, insert2, openStart, openEnd) { 11632 let cur2 = parent.childCursor(); 11633 let { i: toI, off: toOff } = cur2.findPos(to, 1); 11634 let { i: fromI, off: fromOff } = cur2.findPos(from, -1); 11635 let dLen = from - to; 11636 for (let view of insert2) 11637 dLen += view.length; 11638 parent.length += dLen; 11639 replaceRange(parent, fromI, fromOff, toI, toOff, insert2, 0, openStart, openEnd); 11640} 11641var nav = typeof navigator != "undefined" ? navigator : { userAgent: "", vendor: "", platform: "" }; 11642var doc = typeof document != "undefined" ? document : { documentElement: { style: {} } }; 11643var ie_edge = /* @__PURE__ */ /Edge\/(\d+)/.exec(nav.userAgent); 11644var ie_upto10 = /* @__PURE__ */ /MSIE \d/.test(nav.userAgent); 11645var ie_11up = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent); 11646var ie2 = !!(ie_upto10 || ie_11up || ie_edge); 11647var gecko = !ie2 && /* @__PURE__ */ /gecko\/(\d+)/i.test(nav.userAgent); 11648var chrome = !ie2 && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent); 11649var webkit = "webkitFontSmoothing" in doc.documentElement.style; 11650var safari = !ie2 && /* @__PURE__ */ /Apple Computer/.test(nav.vendor); 11651var ios = safari && (/* @__PURE__ */ /Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2); 11652var browser = { 11653 mac: ios || /* @__PURE__ */ /Mac/.test(nav.platform), 11654 windows: /* @__PURE__ */ /Win/.test(nav.platform), 11655 linux: /* @__PURE__ */ /Linux|X11/.test(nav.platform), 11656 ie: ie2, 11657 ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0, 11658 gecko, 11659 gecko_version: gecko ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0, 11660 chrome: !!chrome, 11661 chrome_version: chrome ? +chrome[1] : 0, 11662 ios, 11663 android: /* @__PURE__ */ /Android\b/.test(nav.userAgent), 11664 webkit, 11665 safari, 11666 webkit_version: webkit ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0, 11667 tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size" 11668}; 11669var MaxJoinLen = 256; 11670var TextView = class _TextView extends ContentView { 11671 constructor(text) { 11672 super(); 11673 this.text = text; 11674 } 11675 get length() { 11676 return this.text.length; 11677 } 11678 createDOM(textDOM) { 11679 this.setDOM(textDOM || document.createTextNode(this.text)); 11680 } 11681 sync(view, track) { 11682 if (!this.dom) 11683 this.createDOM(); 11684 if (this.dom.nodeValue != this.text) { 11685 if (track && track.node == this.dom) 11686 track.written = true; 11687 this.dom.nodeValue = this.text; 11688 } 11689 } 11690 reuseDOM(dom) { 11691 if (dom.nodeType == 3) 11692 this.createDOM(dom); 11693 } 11694 merge(from, to, source) { 11695 if (this.flags & 8 || source && (!(source instanceof _TextView) || this.length - (to - from) + source.length > MaxJoinLen || source.flags & 8)) 11696 return false; 11697 this.text = this.text.slice(0, from) + (source ? source.text : "") + this.text.slice(to); 11698 this.markDirty(); 11699 return true; 11700 } 11701 split(from) { 11702 let result = new _TextView(this.text.slice(from)); 11703 this.text = this.text.slice(0, from); 11704 this.markDirty(); 11705 result.flags |= this.flags & 8; 11706 return result; 11707 } 11708 localPosFromDOM(node, offset) { 11709 return node == this.dom ? offset : offset ? this.text.length : 0; 11710 } 11711 domAtPos(pos) { 11712 return new DOMPos(this.dom, pos); 11713 } 11714 domBoundsAround(_from, _to, offset) { 11715 return { from: offset, to: offset + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling }; 11716 } 11717 coordsAt(pos, side) { 11718 return textCoords(this.dom, pos, side); 11719 } 11720}; 11721var MarkView = class _MarkView extends ContentView { 11722 constructor(mark, children = [], length = 0) { 11723 super(); 11724 this.mark = mark; 11725 this.children = children; 11726 this.length = length; 11727 for (let ch of children) 11728 ch.setParent(this); 11729 } 11730 setAttrs(dom) { 11731 clearAttributes(dom); 11732 if (this.mark.class) 11733 dom.className = this.mark.class; 11734 if (this.mark.attrs) 11735 for (let name2 in this.mark.attrs) 11736 dom.setAttribute(name2, this.mark.attrs[name2]); 11737 return dom; 11738 } 11739 canReuseDOM(other) { 11740 return super.canReuseDOM(other) && !((this.flags | other.flags) & 8); 11741 } 11742 reuseDOM(node) { 11743 if (node.nodeName == this.mark.tagName.toUpperCase()) { 11744 this.setDOM(node); 11745 this.flags |= 4 | 2; 11746 } 11747 } 11748 sync(view, track) { 11749 if (!this.dom) 11750 this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))); 11751 else if (this.flags & 4) 11752 this.setAttrs(this.dom); 11753 super.sync(view, track); 11754 } 11755 merge(from, to, source, _hasStart, openStart, openEnd) { 11756 if (source && (!(source instanceof _MarkView && source.mark.eq(this.mark)) || from && openStart <= 0 || to < this.length && openEnd <= 0)) 11757 return false; 11758 mergeChildrenInto(this, from, to, source ? source.children : [], openStart - 1, openEnd - 1); 11759 this.markDirty(); 11760 return true; 11761 } 11762 split(from) { 11763 let result = [], off = 0, detachFrom = -1, i2 = 0; 11764 for (let elt of this.children) { 11765 let end = off + elt.length; 11766 if (end > from) 11767 result.push(off < from ? elt.split(from - off) : elt); 11768 if (detachFrom < 0 && off >= from) 11769 detachFrom = i2; 11770 off = end; 11771 i2++; 11772 } 11773 let length = this.length - from; 11774 this.length = from; 11775 if (detachFrom > -1) { 11776 this.children.length = detachFrom; 11777 this.markDirty(); 11778 } 11779 return new _MarkView(this.mark, result, length); 11780 } 11781 domAtPos(pos) { 11782 return inlineDOMAtPos(this, pos); 11783 } 11784 coordsAt(pos, side) { 11785 return coordsInChildren(this, pos, side); 11786 } 11787}; 11788function textCoords(text, pos, side) { 11789 let length = text.nodeValue.length; 11790 if (pos > length) 11791 pos = length; 11792 let from = pos, to = pos, flatten2 = 0; 11793 if (pos == 0 && side < 0 || pos == length && side >= 0) { 11794 if (!(browser.chrome || browser.gecko)) { 11795 if (pos) { 11796 from--; 11797 flatten2 = 1; 11798 } else if (to < length) { 11799 to++; 11800 flatten2 = -1; 11801 } 11802 } 11803 } else { 11804 if (side < 0) 11805 from--; 11806 else if (to < length) 11807 to++; 11808 } 11809 let rects = textRange(text, from, to).getClientRects(); 11810 if (!rects.length) 11811 return null; 11812 let rect = rects[(flatten2 ? flatten2 < 0 : side >= 0) ? 0 : rects.length - 1]; 11813 if (browser.safari && !flatten2 && rect.width == 0) 11814 rect = Array.prototype.find.call(rects, (r2) => r2.width) || rect; 11815 return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null; 11816} 11817var WidgetView = class _WidgetView extends ContentView { 11818 static create(widget, length, side) { 11819 return new _WidgetView(widget, length, side); 11820 } 11821 constructor(widget, length, side) { 11822 super(); 11823 this.widget = widget; 11824 this.length = length; 11825 this.side = side; 11826 this.prevWidget = null; 11827 } 11828 split(from) { 11829 let result = _WidgetView.create(this.widget, this.length - from, this.side); 11830 this.length -= from; 11831 return result; 11832 } 11833 sync(view) { 11834 if (!this.dom || !this.widget.updateDOM(this.dom, view)) { 11835 if (this.dom && this.prevWidget) 11836 this.prevWidget.destroy(this.dom); 11837 this.prevWidget = null; 11838 this.setDOM(this.widget.toDOM(view)); 11839 this.dom.contentEditable = "false"; 11840 } 11841 } 11842 getSide() { 11843 return this.side; 11844 } 11845 merge(from, to, source, hasStart, openStart, openEnd) { 11846 if (source && (!(source instanceof _WidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0)) 11847 return false; 11848 this.length = from + (source ? source.length : 0) + (this.length - to); 11849 return true; 11850 } 11851 become(other) { 11852 if (other instanceof _WidgetView && other.side == this.side && this.widget.constructor == other.widget.constructor) { 11853 if (!this.widget.compare(other.widget)) 11854 this.markDirty(true); 11855 if (this.dom && !this.prevWidget) 11856 this.prevWidget = this.widget; 11857 this.widget = other.widget; 11858 this.length = other.length; 11859 return true; 11860 } 11861 return false; 11862 } 11863 ignoreMutation() { 11864 return true; 11865 } 11866 ignoreEvent(event) { 11867 return this.widget.ignoreEvent(event); 11868 } 11869 get overrideDOMText() { 11870 if (this.length == 0) 11871 return Text2.empty; 11872 let top2 = this; 11873 while (top2.parent) 11874 top2 = top2.parent; 11875 let { view } = top2, text = view && view.state.doc, start = this.posAtStart; 11876 return text ? text.slice(start, start + this.length) : Text2.empty; 11877 } 11878 domAtPos(pos) { 11879 return (this.length ? pos == 0 : this.side > 0) ? DOMPos.before(this.dom) : DOMPos.after(this.dom, pos == this.length); 11880 } 11881 domBoundsAround() { 11882 return null; 11883 } 11884 coordsAt(pos, side) { 11885 let custom = this.widget.coordsAt(this.dom, pos, side); 11886 if (custom) 11887 return custom; 11888 let rects = this.dom.getClientRects(), rect = null; 11889 if (!rects.length) 11890 return null; 11891 let fromBack = this.side ? this.side < 0 : pos > 0; 11892 for (let i2 = fromBack ? rects.length - 1 : 0; ; i2 += fromBack ? -1 : 1) { 11893 rect = rects[i2]; 11894 if (pos > 0 ? i2 == 0 : i2 == rects.length - 1 || rect.top < rect.bottom) 11895 break; 11896 } 11897 return flattenRect(rect, !fromBack); 11898 } 11899 get isEditable() { 11900 return false; 11901 } 11902 get isWidget() { 11903 return true; 11904 } 11905 get isHidden() { 11906 return this.widget.isHidden; 11907 } 11908 destroy() { 11909 super.destroy(); 11910 if (this.dom) 11911 this.widget.destroy(this.dom); 11912 } 11913}; 11914var WidgetBufferView = class _WidgetBufferView extends ContentView { 11915 constructor(side) { 11916 super(); 11917 this.side = side; 11918 } 11919 get length() { 11920 return 0; 11921 } 11922 merge() { 11923 return false; 11924 } 11925 become(other) { 11926 return other instanceof _WidgetBufferView && other.side == this.side; 11927 } 11928 split() { 11929 return new _WidgetBufferView(this.side); 11930 } 11931 sync() { 11932 if (!this.dom) { 11933 let dom = document.createElement("img"); 11934 dom.className = "cm-widgetBuffer"; 11935 dom.setAttribute("aria-hidden", "true"); 11936 this.setDOM(dom); 11937 } 11938 } 11939 getSide() { 11940 return this.side; 11941 } 11942 domAtPos(pos) { 11943 return this.side > 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom); 11944 } 11945 localPosFromDOM() { 11946 return 0; 11947 } 11948 domBoundsAround() { 11949 return null; 11950 } 11951 coordsAt(pos) { 11952 return this.dom.getBoundingClientRect(); 11953 } 11954 get overrideDOMText() { 11955 return Text2.empty; 11956 } 11957 get isHidden() { 11958 return true; 11959 } 11960}; 11961TextView.prototype.children = WidgetView.prototype.children = WidgetBufferView.prototype.children = noChildren; 11962function inlineDOMAtPos(parent, pos) { 11963 let dom = parent.dom, { children } = parent, i2 = 0; 11964 for (let off = 0; i2 < children.length; i2++) { 11965 let child = children[i2], end = off + child.length; 11966 if (end == off && child.getSide() <= 0) 11967 continue; 11968 if (pos > off && pos < end && child.dom.parentNode == dom) 11969 return child.domAtPos(pos - off); 11970 if (pos <= off) 11971 break; 11972 off = end; 11973 } 11974 for (let j3 = i2; j3 > 0; j3--) { 11975 let prev = children[j3 - 1]; 11976 if (prev.dom.parentNode == dom) 11977 return prev.domAtPos(prev.length); 11978 } 11979 for (let j3 = i2; j3 < children.length; j3++) { 11980 let next = children[j3]; 11981 if (next.dom.parentNode == dom) 11982 return next.domAtPos(0); 11983 } 11984 return new DOMPos(dom, 0); 11985} 11986function joinInlineInto(parent, view, open) { 11987 let last, { children } = parent; 11988 if (open > 0 && view instanceof MarkView && children.length && (last = children[children.length - 1]) instanceof MarkView && last.mark.eq(view.mark)) { 11989 joinInlineInto(last, view.children[0], open - 1); 11990 } else { 11991 children.push(view); 11992 view.setParent(parent); 11993 } 11994 parent.length += view.length; 11995} 11996function coordsInChildren(view, pos, side) { 11997 let before = null, beforePos = -1, after = null, afterPos = -1; 11998 function scan(view2, pos2) { 11999 for (let i2 = 0, off = 0; i2 < view2.children.length && off <= pos2; i2++) { 12000 let child = view2.children[i2], end = off + child.length; 12001 if (end >= pos2) { 12002 if (child.children.length) { 12003 scan(child, pos2 - off); 12004 } else if ((!after || after.isHidden && side > 0) && (end > pos2 || off == end && child.getSide() > 0)) { 12005 after = child; 12006 afterPos = pos2 - off; 12007 } else if (off < pos2 || off == end && child.getSide() < 0 && !child.isHidden) { 12008 before = child; 12009 beforePos = pos2 - off; 12010 } 12011 } 12012 off = end; 12013 } 12014 } 12015 scan(view, pos); 12016 let target = (side < 0 ? before : after) || before || after; 12017 if (target) 12018 return target.coordsAt(Math.max(0, target == before ? beforePos : afterPos), side); 12019 return fallbackRect(view); 12020} 12021function fallbackRect(view) { 12022 let last = view.dom.lastChild; 12023 if (!last) 12024 return view.dom.getBoundingClientRect(); 12025 let rects = clientRectsFor(last); 12026 return rects[rects.length - 1] || null; 12027} 12028function combineAttrs(source, target) { 12029 for (let name2 in source) { 12030 if (name2 == "class" && target.class) 12031 target.class += " " + source.class; 12032 else if (name2 == "style" && target.style) 12033 target.style += ";" + source.style; 12034 else 12035 target[name2] = source[name2]; 12036 } 12037 return target; 12038} 12039var noAttrs = /* @__PURE__ */ Object.create(null); 12040function attrsEq(a2, b3, ignore) { 12041 if (a2 == b3) 12042 return true; 12043 if (!a2) 12044 a2 = noAttrs; 12045 if (!b3) 12046 b3 = noAttrs; 12047 let keysA = Object.keys(a2), keysB = Object.keys(b3); 12048 if (keysA.length - (ignore && keysA.indexOf(ignore) > -1 ? 1 : 0) != keysB.length - (ignore && keysB.indexOf(ignore) > -1 ? 1 : 0)) 12049 return false; 12050 for (let key of keysA) { 12051 if (key != ignore && (keysB.indexOf(key) == -1 || a2[key] !== b3[key])) 12052 return false; 12053 } 12054 return true; 12055} 12056function updateAttrs(dom, prev, attrs) { 12057 let changed = false; 12058 if (prev) { 12059 for (let name2 in prev) 12060 if (!(attrs && name2 in attrs)) { 12061 changed = true; 12062 if (name2 == "style") 12063 dom.style.cssText = ""; 12064 else 12065 dom.removeAttribute(name2); 12066 } 12067 } 12068 if (attrs) { 12069 for (let name2 in attrs) 12070 if (!(prev && prev[name2] == attrs[name2])) { 12071 changed = true; 12072 if (name2 == "style") 12073 dom.style.cssText = attrs[name2]; 12074 else 12075 dom.setAttribute(name2, attrs[name2]); 12076 } 12077 } 12078 return changed; 12079} 12080function getAttrs(dom) { 12081 let attrs = /* @__PURE__ */ Object.create(null); 12082 for (let i2 = 0; i2 < dom.attributes.length; i2++) { 12083 let attr = dom.attributes[i2]; 12084 attrs[attr.name] = attr.value; 12085 } 12086 return attrs; 12087} 12088var LineView = class _LineView extends ContentView { 12089 constructor() { 12090 super(...arguments); 12091 this.children = []; 12092 this.length = 0; 12093 this.prevAttrs = void 0; 12094 this.attrs = null; 12095 this.breakAfter = 0; 12096 } 12097 // Consumes source 12098 merge(from, to, source, hasStart, openStart, openEnd) { 12099 if (source) { 12100 if (!(source instanceof _LineView)) 12101 return false; 12102 if (!this.dom) 12103 source.transferDOM(this); 12104 } 12105 if (hasStart) 12106 this.setDeco(source ? source.attrs : null); 12107 mergeChildrenInto(this, from, to, source ? source.children : [], openStart, openEnd); 12108 return true; 12109 } 12110 split(at) { 12111 let end = new _LineView(); 12112 end.breakAfter = this.breakAfter; 12113 if (this.length == 0) 12114 return end; 12115 let { i: i2, off } = this.childPos(at); 12116 if (off) { 12117 end.append(this.children[i2].split(off), 0); 12118 this.children[i2].merge(off, this.children[i2].length, null, false, 0, 0); 12119 i2++; 12120 } 12121 for (let j3 = i2; j3 < this.children.length; j3++) 12122 end.append(this.children[j3], 0); 12123 while (i2 > 0 && this.children[i2 - 1].length == 0) 12124 this.children[--i2].destroy(); 12125 this.children.length = i2; 12126 this.markDirty(); 12127 this.length = at; 12128 return end; 12129 } 12130 transferDOM(other) { 12131 if (!this.dom) 12132 return; 12133 this.markDirty(); 12134 other.setDOM(this.dom); 12135 other.prevAttrs = this.prevAttrs === void 0 ? this.attrs : this.prevAttrs; 12136 this.prevAttrs = void 0; 12137 this.dom = null; 12138 } 12139 setDeco(attrs) { 12140 if (!attrsEq(this.attrs, attrs)) { 12141 if (this.dom) { 12142 this.prevAttrs = this.attrs; 12143 this.markDirty(); 12144 } 12145 this.attrs = attrs; 12146 } 12147 } 12148 append(child, openStart) { 12149 joinInlineInto(this, child, openStart); 12150 } 12151 // Only called when building a line view in ContentBuilder 12152 addLineDeco(deco) { 12153 let attrs = deco.spec.attributes, cls = deco.spec.class; 12154 if (attrs) 12155 this.attrs = combineAttrs(attrs, this.attrs || {}); 12156 if (cls) 12157 this.attrs = combineAttrs({ class: cls }, this.attrs || {}); 12158 } 12159 domAtPos(pos) { 12160 return inlineDOMAtPos(this, pos); 12161 } 12162 reuseDOM(node) { 12163 if (node.nodeName == "DIV") { 12164 this.setDOM(node); 12165 this.flags |= 4 | 2; 12166 } 12167 } 12168 sync(view, track) { 12169 var _a3; 12170 if (!this.dom) { 12171 this.setDOM(document.createElement("div")); 12172 this.dom.className = "cm-line"; 12173 this.prevAttrs = this.attrs ? null : void 0; 12174 } else if (this.flags & 4) { 12175 clearAttributes(this.dom); 12176 this.dom.className = "cm-line"; 12177 this.prevAttrs = this.attrs ? null : void 0; 12178 } 12179 if (this.prevAttrs !== void 0) { 12180 updateAttrs(this.dom, this.prevAttrs, this.attrs); 12181 this.dom.classList.add("cm-line"); 12182 this.prevAttrs = void 0; 12183 } 12184 super.sync(view, track); 12185 let last = this.dom.lastChild; 12186 while (last && ContentView.get(last) instanceof MarkView) 12187 last = last.lastChild; 12188 if (!last || !this.length || last.nodeName != "BR" && ((_a3 = ContentView.get(last)) === null || _a3 === void 0 ? void 0 : _a3.isEditable) == false && (!browser.ios || !this.children.some((ch) => ch instanceof TextView))) { 12189 let hack = document.createElement("BR"); 12190 hack.cmIgnore = true; 12191 this.dom.appendChild(hack); 12192 } 12193 } 12194 measureTextSize() { 12195 if (this.children.length == 0 || this.length > 20) 12196 return null; 12197 let totalWidth = 0, textHeight; 12198 for (let child of this.children) { 12199 if (!(child instanceof TextView) || /[^ -~]/.test(child.text)) 12200 return null; 12201 let rects = clientRectsFor(child.dom); 12202 if (rects.length != 1) 12203 return null; 12204 totalWidth += rects[0].width; 12205 textHeight = rects[0].height; 12206 } 12207 return !totalWidth ? null : { 12208 lineHeight: this.dom.getBoundingClientRect().height, 12209 charWidth: totalWidth / this.length, 12210 textHeight 12211 }; 12212 } 12213 coordsAt(pos, side) { 12214 let rect = coordsInChildren(this, pos, side); 12215 if (!this.children.length && rect && this.parent) { 12216 let { heightOracle } = this.parent.view.viewState, height = rect.bottom - rect.top; 12217 if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) { 12218 let dist2 = (height - heightOracle.textHeight) / 2; 12219 return { top: rect.top + dist2, bottom: rect.bottom - dist2, left: rect.left, right: rect.left }; 12220 } 12221 } 12222 return rect; 12223 } 12224 become(_other) { 12225 return false; 12226 } 12227 covers() { 12228 return true; 12229 } 12230 static find(docView, pos) { 12231 for (let i2 = 0, off = 0; i2 < docView.children.length; i2++) { 12232 let block2 = docView.children[i2], end = off + block2.length; 12233 if (end >= pos) { 12234 if (block2 instanceof _LineView) 12235 return block2; 12236 if (end > pos) 12237 break; 12238 } 12239 off = end + block2.breakAfter; 12240 } 12241 return null; 12242 } 12243}; 12244var BlockWidgetView = class _BlockWidgetView extends ContentView { 12245 constructor(widget, length, deco) { 12246 super(); 12247 this.widget = widget; 12248 this.length = length; 12249 this.deco = deco; 12250 this.breakAfter = 0; 12251 this.prevWidget = null; 12252 } 12253 merge(from, to, source, _takeDeco, openStart, openEnd) { 12254 if (source && (!(source instanceof _BlockWidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0)) 12255 return false; 12256 this.length = from + (source ? source.length : 0) + (this.length - to); 12257 return true; 12258 } 12259 domAtPos(pos) { 12260 return pos == 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom, pos == this.length); 12261 } 12262 split(at) { 12263 let len = this.length - at; 12264 this.length = at; 12265 let end = new _BlockWidgetView(this.widget, len, this.deco); 12266 end.breakAfter = this.breakAfter; 12267 return end; 12268 } 12269 get children() { 12270 return noChildren; 12271 } 12272 sync(view) { 12273 if (!this.dom || !this.widget.updateDOM(this.dom, view)) { 12274 if (this.dom && this.prevWidget) 12275 this.prevWidget.destroy(this.dom); 12276 this.prevWidget = null; 12277 this.setDOM(this.widget.toDOM(view)); 12278 this.dom.contentEditable = "false"; 12279 } 12280 } 12281 get overrideDOMText() { 12282 return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text2.empty; 12283 } 12284 domBoundsAround() { 12285 return null; 12286 } 12287 become(other) { 12288 if (other instanceof _BlockWidgetView && other.widget.constructor == this.widget.constructor) { 12289 if (!other.widget.compare(this.widget)) 12290 this.markDirty(true); 12291 if (this.dom && !this.prevWidget) 12292 this.prevWidget = this.widget; 12293 this.widget = other.widget; 12294 this.length = other.length; 12295 this.deco = other.deco; 12296 this.breakAfter = other.breakAfter; 12297 return true; 12298 } 12299 return false; 12300 } 12301 ignoreMutation() { 12302 return true; 12303 } 12304 ignoreEvent(event) { 12305 return this.widget.ignoreEvent(event); 12306 } 12307 get isEditable() { 12308 return false; 12309 } 12310 get isWidget() { 12311 return true; 12312 } 12313 coordsAt(pos, side) { 12314 return this.widget.coordsAt(this.dom, pos, side); 12315 } 12316 destroy() { 12317 super.destroy(); 12318 if (this.dom) 12319 this.widget.destroy(this.dom); 12320 } 12321 covers(side) { 12322 let { startSide, endSide } = this.deco; 12323 return startSide == endSide ? false : side < 0 ? startSide < 0 : endSide > 0; 12324 } 12325}; 12326var WidgetType = class { 12327 /** 12328 Compare this instance to another instance of the same type. 12329 (TypeScript can't express this, but only instances of the same 12330 specific class will be passed to this method.) This is used to 12331 avoid redrawing widgets when they are replaced by a new 12332 decoration of the same type. The default implementation just 12333 returns `false`, which will cause new instances of the widget to 12334 always be redrawn. 12335 */ 12336 eq(widget) { 12337 return false; 12338 } 12339 /** 12340 Update a DOM element created by a widget of the same type (but 12341 different, non-`eq` content) to reflect this widget. May return 12342 true to indicate that it could update, false to indicate it 12343 couldn't (in which case the widget will be redrawn). The default 12344 implementation just returns false. 12345 */ 12346 updateDOM(dom, view) { 12347 return false; 12348 } 12349 /** 12350 @internal 12351 */ 12352 compare(other) { 12353 return this == other || this.constructor == other.constructor && this.eq(other); 12354 } 12355 /** 12356 The estimated height this widget will have, to be used when 12357 estimating the height of content that hasn't been drawn. May 12358 return -1 to indicate you don't know. The default implementation 12359 returns -1. 12360 */ 12361 get estimatedHeight() { 12362 return -1; 12363 } 12364 /** 12365 For inline widgets that are displayed inline (as opposed to 12366 `inline-block`) and introduce line breaks (through `<br>` tags 12367 or textual newlines), this must indicate the amount of line 12368 breaks they introduce. Defaults to 0. 12369 */ 12370 get lineBreaks() { 12371 return 0; 12372 } 12373 /** 12374 Can be used to configure which kinds of events inside the widget 12375 should be ignored by the editor. The default is to ignore all 12376 events. 12377 */ 12378 ignoreEvent(event) { 12379 return true; 12380 } 12381 /** 12382 Override the way screen coordinates for positions at/in the 12383 widget are found. `pos` will be the offset into the widget, and 12384 `side` the side of the position that is being queried—less than 12385 zero for before, greater than zero for after, and zero for 12386 directly at that position. 12387 */ 12388 coordsAt(dom, pos, side) { 12389 return null; 12390 } 12391 /** 12392 @internal 12393 */ 12394 get isHidden() { 12395 return false; 12396 } 12397 /** 12398 This is called when the an instance of the widget is removed 12399 from the editor view. 12400 */ 12401 destroy(dom) { 12402 } 12403}; 12404var BlockType = /* @__PURE__ */ function(BlockType2) { 12405 BlockType2[BlockType2["Text"] = 0] = "Text"; 12406 BlockType2[BlockType2["WidgetBefore"] = 1] = "WidgetBefore"; 12407 BlockType2[BlockType2["WidgetAfter"] = 2] = "WidgetAfter"; 12408 BlockType2[BlockType2["WidgetRange"] = 3] = "WidgetRange"; 12409 return BlockType2; 12410}(BlockType || (BlockType = {})); 12411var Decoration = class extends RangeValue { 12412 constructor(startSide, endSide, widget, spec) { 12413 super(); 12414 this.startSide = startSide; 12415 this.endSide = endSide; 12416 this.widget = widget; 12417 this.spec = spec; 12418 } 12419 /** 12420 @internal 12421 */ 12422 get heightRelevant() { 12423 return false; 12424 } 12425 /** 12426 Create a mark decoration, which influences the styling of the 12427 content in its range. Nested mark decorations will cause nested 12428 DOM elements to be created. Nesting order is determined by 12429 precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with 12430 the higher-precedence decorations creating the inner DOM nodes. 12431 Such elements are split on line boundaries and on the boundaries 12432 of lower-precedence decorations. 12433 */ 12434 static mark(spec) { 12435 return new MarkDecoration(spec); 12436 } 12437 /** 12438 Create a widget decoration, which displays a DOM element at the 12439 given position. 12440 */ 12441 static widget(spec) { 12442 let side = Math.max(-1e4, Math.min(1e4, spec.side || 0)), block2 = !!spec.block; 12443 side += block2 && !spec.inlineOrder ? side > 0 ? 3e8 : -4e8 : side > 0 ? 1e8 : -1e8; 12444 return new PointDecoration(spec, side, side, block2, spec.widget || null, false); 12445 } 12446 /** 12447 Create a replace decoration which replaces the given range with 12448 a widget, or simply hides it. 12449 */ 12450 static replace(spec) { 12451 let block2 = !!spec.block, startSide, endSide; 12452 if (spec.isBlockGap) { 12453 startSide = -5e8; 12454 endSide = 4e8; 12455 } else { 12456 let { start, end } = getInclusive(spec, block2); 12457 startSide = (start ? block2 ? -3e8 : -1 : 5e8) - 1; 12458 endSide = (end ? block2 ? 2e8 : 1 : -6e8) + 1; 12459 } 12460 return new PointDecoration(spec, startSide, endSide, block2, spec.widget || null, true); 12461 } 12462 /** 12463 Create a line decoration, which can add DOM attributes to the 12464 line starting at the given position. 12465 */ 12466 static line(spec) { 12467 return new LineDecoration(spec); 12468 } 12469 /** 12470 Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given 12471 decorated range or ranges. If the ranges aren't already sorted, 12472 pass `true` for `sort` to make the library sort them for you. 12473 */ 12474 static set(of, sort = false) { 12475 return RangeSet.of(of, sort); 12476 } 12477 /** 12478 @internal 12479 */ 12480 hasHeight() { 12481 return this.widget ? this.widget.estimatedHeight > -1 : false; 12482 } 12483}; 12484Decoration.none = RangeSet.empty; 12485var MarkDecoration = class _MarkDecoration extends Decoration { 12486 constructor(spec) { 12487 let { start, end } = getInclusive(spec); 12488 super(start ? -1 : 5e8, end ? 1 : -6e8, null, spec); 12489 this.tagName = spec.tagName || "span"; 12490 this.class = spec.class || ""; 12491 this.attrs = spec.attributes || null; 12492 } 12493 eq(other) { 12494 var _a3, _b2; 12495 return this == other || other instanceof _MarkDecoration && this.tagName == other.tagName && (this.class || ((_a3 = this.attrs) === null || _a3 === void 0 ? void 0 : _a3.class)) == (other.class || ((_b2 = other.attrs) === null || _b2 === void 0 ? void 0 : _b2.class)) && attrsEq(this.attrs, other.attrs, "class"); 12496 } 12497 range(from, to = from) { 12498 if (from >= to) 12499 throw new RangeError("Mark decorations may not be empty"); 12500 return super.range(from, to); 12501 } 12502}; 12503MarkDecoration.prototype.point = false; 12504var LineDecoration = class _LineDecoration extends Decoration { 12505 constructor(spec) { 12506 super(-2e8, -2e8, null, spec); 12507 } 12508 eq(other) { 12509 return other instanceof _LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes); 12510 } 12511 range(from, to = from) { 12512 if (to != from) 12513 throw new RangeError("Line decoration ranges must be zero-length"); 12514 return super.range(from, to); 12515 } 12516}; 12517LineDecoration.prototype.mapMode = MapMode.TrackBefore; 12518LineDecoration.prototype.point = true; 12519var PointDecoration = class _PointDecoration extends Decoration { 12520 constructor(spec, startSide, endSide, block2, widget, isReplace) { 12521 super(startSide, endSide, widget, spec); 12522 this.block = block2; 12523 this.isReplace = isReplace; 12524 this.mapMode = !block2 ? MapMode.TrackDel : startSide <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter; 12525 } 12526 // Only relevant when this.block == true 12527 get type() { 12528 return this.startSide != this.endSide ? BlockType.WidgetRange : this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter; 12529 } 12530 get heightRelevant() { 12531 return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0); 12532 } 12533 eq(other) { 12534 return other instanceof _PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide; 12535 } 12536 range(from, to = from) { 12537 if (this.isReplace && (from > to || from == to && this.startSide > 0 && this.endSide <= 0)) 12538 throw new RangeError("Invalid range for replacement decoration"); 12539 if (!this.isReplace && to != from) 12540 throw new RangeError("Widget decorations can only have zero-length ranges"); 12541 return super.range(from, to); 12542 } 12543}; 12544PointDecoration.prototype.point = true; 12545function getInclusive(spec, block2 = false) { 12546 let { inclusiveStart: start, inclusiveEnd: end } = spec; 12547 if (start == null) 12548 start = spec.inclusive; 12549 if (end == null) 12550 end = spec.inclusive; 12551 return { start: start !== null && start !== void 0 ? start : block2, end: end !== null && end !== void 0 ? end : block2 }; 12552} 12553function widgetsEq(a2, b3) { 12554 return a2 == b3 || !!(a2 && b3 && a2.compare(b3)); 12555} 12556function addRange(from, to, ranges, margin = 0) { 12557 let last = ranges.length - 1; 12558 if (last >= 0 && ranges[last] + margin >= from) 12559 ranges[last] = Math.max(ranges[last], to); 12560 else 12561 ranges.push(from, to); 12562} 12563var ContentBuilder = class _ContentBuilder { 12564 constructor(doc2, pos, end, disallowBlockEffectsFor) { 12565 this.doc = doc2; 12566 this.pos = pos; 12567 this.end = end; 12568 this.disallowBlockEffectsFor = disallowBlockEffectsFor; 12569 this.content = []; 12570 this.curLine = null; 12571 this.breakAtStart = 0; 12572 this.pendingBuffer = 0; 12573 this.bufferMarks = []; 12574 this.atCursorPos = true; 12575 this.openStart = -1; 12576 this.openEnd = -1; 12577 this.text = ""; 12578 this.textOff = 0; 12579 this.cursor = doc2.iter(); 12580 this.skip = pos; 12581 } 12582 posCovered() { 12583 if (this.content.length == 0) 12584 return !this.breakAtStart && this.doc.lineAt(this.pos).from != this.pos; 12585 let last = this.content[this.content.length - 1]; 12586 return !(last.breakAfter || last instanceof BlockWidgetView && last.deco.endSide < 0); 12587 } 12588 getLine() { 12589 if (!this.curLine) { 12590 this.content.push(this.curLine = new LineView()); 12591 this.atCursorPos = true; 12592 } 12593 return this.curLine; 12594 } 12595 flushBuffer(active = this.bufferMarks) { 12596 if (this.pendingBuffer) { 12597 this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length); 12598 this.pendingBuffer = 0; 12599 } 12600 } 12601 addBlockWidget(view) { 12602 this.flushBuffer(); 12603 this.curLine = null; 12604 this.content.push(view); 12605 } 12606 finish(openEnd) { 12607 if (this.pendingBuffer && openEnd <= this.bufferMarks.length) 12608 this.flushBuffer(); 12609 else 12610 this.pendingBuffer = 0; 12611 if (!this.posCovered() && !(openEnd && this.content.length && this.content[this.content.length - 1] instanceof BlockWidgetView)) 12612 this.getLine(); 12613 } 12614 buildText(length, active, openStart) { 12615 while (length > 0) { 12616 if (this.textOff == this.text.length) { 12617 let { value, lineBreak, done } = this.cursor.next(this.skip); 12618 this.skip = 0; 12619 if (done) 12620 throw new Error("Ran out of text content when drawing inline views"); 12621 if (lineBreak) { 12622 if (!this.posCovered()) 12623 this.getLine(); 12624 if (this.content.length) 12625 this.content[this.content.length - 1].breakAfter = 1; 12626 else 12627 this.breakAtStart = 1; 12628 this.flushBuffer(); 12629 this.curLine = null; 12630 this.atCursorPos = true; 12631 length--; 12632 continue; 12633 } else { 12634 this.text = value; 12635 this.textOff = 0; 12636 } 12637 } 12638 let take = Math.min( 12639 this.text.length - this.textOff, 12640 length, 12641 512 12642 /* T.Chunk */ 12643 ); 12644 this.flushBuffer(active.slice(active.length - openStart)); 12645 this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart); 12646 this.atCursorPos = true; 12647 this.textOff += take; 12648 length -= take; 12649 openStart = 0; 12650 } 12651 } 12652 span(from, to, active, openStart) { 12653 this.buildText(to - from, active, openStart); 12654 this.pos = to; 12655 if (this.openStart < 0) 12656 this.openStart = openStart; 12657 } 12658 point(from, to, deco, active, openStart, index) { 12659 if (this.disallowBlockEffectsFor[index] && deco instanceof PointDecoration) { 12660 if (deco.block) 12661 throw new RangeError("Block decorations may not be specified via plugins"); 12662 if (to > this.doc.lineAt(this.pos).to) 12663 throw new RangeError("Decorations that replace line breaks may not be specified via plugins"); 12664 } 12665 let len = to - from; 12666 if (deco instanceof PointDecoration) { 12667 if (deco.block) { 12668 if (deco.startSide > 0 && !this.posCovered()) 12669 this.getLine(); 12670 this.addBlockWidget(new BlockWidgetView(deco.widget || new NullWidget("div"), len, deco)); 12671 } else { 12672 let view = WidgetView.create(deco.widget || new NullWidget("span"), len, len ? 0 : deco.startSide); 12673 let cursorBefore = this.atCursorPos && !view.isEditable && openStart <= active.length && (from < to || deco.startSide > 0); 12674 let cursorAfter = !view.isEditable && (from < to || openStart > active.length || deco.startSide <= 0); 12675 let line = this.getLine(); 12676 if (this.pendingBuffer == 2 && !cursorBefore && !view.isEditable) 12677 this.pendingBuffer = 0; 12678 this.flushBuffer(active); 12679 if (cursorBefore) { 12680 line.append(wrapMarks(new WidgetBufferView(1), active), openStart); 12681 openStart = active.length + Math.max(0, openStart - active.length); 12682 } 12683 line.append(wrapMarks(view, active), openStart); 12684 this.atCursorPos = cursorAfter; 12685 this.pendingBuffer = !cursorAfter ? 0 : from < to || openStart > active.length ? 1 : 2; 12686 if (this.pendingBuffer) 12687 this.bufferMarks = active.slice(); 12688 } 12689 } else if (this.doc.lineAt(this.pos).from == this.pos) { 12690 this.getLine().addLineDeco(deco); 12691 } 12692 if (len) { 12693 if (this.textOff + len <= this.text.length) { 12694 this.textOff += len; 12695 } else { 12696 this.skip += len - (this.text.length - this.textOff); 12697 this.text = ""; 12698 this.textOff = 0; 12699 } 12700 this.pos = to; 12701 } 12702 if (this.openStart < 0) 12703 this.openStart = openStart; 12704 } 12705 static build(text, from, to, decorations2, dynamicDecorationMap) { 12706 let builder = new _ContentBuilder(text, from, to, dynamicDecorationMap); 12707 builder.openEnd = RangeSet.spans(decorations2, from, to, builder); 12708 if (builder.openStart < 0) 12709 builder.openStart = builder.openEnd; 12710 builder.finish(builder.openEnd); 12711 return builder; 12712 } 12713}; 12714function wrapMarks(view, active) { 12715 for (let mark of active) 12716 view = new MarkView(mark, [view], view.length); 12717 return view; 12718} 12719var NullWidget = class extends WidgetType { 12720 constructor(tag) { 12721 super(); 12722 this.tag = tag; 12723 } 12724 eq(other) { 12725 return other.tag == this.tag; 12726 } 12727 toDOM() { 12728 return document.createElement(this.tag); 12729 } 12730 updateDOM(elt) { 12731 return elt.nodeName.toLowerCase() == this.tag; 12732 } 12733 get isHidden() { 12734 return true; 12735 } 12736}; 12737var clickAddsSelectionRange = /* @__PURE__ */ Facet.define(); 12738var dragMovesSelection$1 = /* @__PURE__ */ Facet.define(); 12739var mouseSelectionStyle = /* @__PURE__ */ Facet.define(); 12740var exceptionSink = /* @__PURE__ */ Facet.define(); 12741var updateListener = /* @__PURE__ */ Facet.define(); 12742var inputHandler = /* @__PURE__ */ Facet.define(); 12743var focusChangeEffect = /* @__PURE__ */ Facet.define(); 12744var perLineTextDirection = /* @__PURE__ */ Facet.define({ 12745 combine: (values2) => values2.some((x) => x) 12746}); 12747var nativeSelectionHidden = /* @__PURE__ */ Facet.define({ 12748 combine: (values2) => values2.some((x) => x) 12749}); 12750var ScrollTarget = class _ScrollTarget { 12751 constructor(range, y2 = "nearest", x = "nearest", yMargin = 5, xMargin = 5, isSnapshot = false) { 12752 this.range = range; 12753 this.y = y2; 12754 this.x = x; 12755 this.yMargin = yMargin; 12756 this.xMargin = xMargin; 12757 this.isSnapshot = isSnapshot; 12758 } 12759 map(changes) { 12760 return changes.empty ? this : new _ScrollTarget(this.range.map(changes), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); 12761 } 12762 clip(state) { 12763 return this.range.to <= state.doc.length ? this : new _ScrollTarget(EditorSelection.cursor(state.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); 12764 } 12765}; 12766var scrollIntoView = /* @__PURE__ */ StateEffect.define({ map: (t3, ch) => t3.map(ch) }); 12767function logException(state, exception, context) { 12768 let handler = state.facet(exceptionSink); 12769 if (handler.length) 12770 handler[0](exception); 12771 else if (window.onerror) 12772 window.onerror(String(exception), context, void 0, void 0, exception); 12773 else if (context) 12774 console.error(context + ":", exception); 12775 else 12776 console.error(exception); 12777} 12778var editable = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : true }); 12779var nextPluginID = 0; 12780var viewPlugin = /* @__PURE__ */ Facet.define(); 12781var ViewPlugin = class _ViewPlugin { 12782 constructor(id2, create, domEventHandlers, domEventObservers, buildExtensions) { 12783 this.id = id2; 12784 this.create = create; 12785 this.domEventHandlers = domEventHandlers; 12786 this.domEventObservers = domEventObservers; 12787 this.extension = buildExtensions(this); 12788 } 12789 /** 12790 Define a plugin from a constructor function that creates the 12791 plugin's value, given an editor view. 12792 */ 12793 static define(create, spec) { 12794 const { eventHandlers, eventObservers, provide, decorations: deco } = spec || {}; 12795 return new _ViewPlugin(nextPluginID++, create, eventHandlers, eventObservers, (plugin) => { 12796 let ext = [viewPlugin.of(plugin)]; 12797 if (deco) 12798 ext.push(decorations.of((view) => { 12799 let pluginInst = view.plugin(plugin); 12800 return pluginInst ? deco(pluginInst) : Decoration.none; 12801 })); 12802 if (provide) 12803 ext.push(provide(plugin)); 12804 return ext; 12805 }); 12806 } 12807 /** 12808 Create a plugin for a class whose constructor takes a single 12809 editor view as argument. 12810 */ 12811 static fromClass(cls, spec) { 12812 return _ViewPlugin.define((view) => new cls(view), spec); 12813 } 12814}; 12815var PluginInstance = class { 12816 constructor(spec) { 12817 this.spec = spec; 12818 this.mustUpdate = null; 12819 this.value = null; 12820 } 12821 update(view) { 12822 if (!this.value) { 12823 if (this.spec) { 12824 try { 12825 this.value = this.spec.create(view); 12826 } catch (e2) { 12827 logException(view.state, e2, "CodeMirror plugin crashed"); 12828 this.deactivate(); 12829 } 12830 } 12831 } else if (this.mustUpdate) { 12832 let update = this.mustUpdate; 12833 this.mustUpdate = null; 12834 if (this.value.update) { 12835 try { 12836 this.value.update(update); 12837 } catch (e2) { 12838 logException(update.state, e2, "CodeMirror plugin crashed"); 12839 if (this.value.destroy) 12840 try { 12841 this.value.destroy(); 12842 } catch (_2) { 12843 } 12844 this.deactivate(); 12845 } 12846 } 12847 } 12848 return this; 12849 } 12850 destroy(view) { 12851 var _a3; 12852 if ((_a3 = this.value) === null || _a3 === void 0 ? void 0 : _a3.destroy) { 12853 try { 12854 this.value.destroy(); 12855 } catch (e2) { 12856 logException(view.state, e2, "CodeMirror plugin crashed"); 12857 } 12858 } 12859 } 12860 deactivate() { 12861 this.spec = this.value = null; 12862 } 12863}; 12864var editorAttributes = /* @__PURE__ */ Facet.define(); 12865var contentAttributes = /* @__PURE__ */ Facet.define(); 12866var decorations = /* @__PURE__ */ Facet.define(); 12867var atomicRanges = /* @__PURE__ */ Facet.define(); 12868var bidiIsolatedRanges = /* @__PURE__ */ Facet.define(); 12869function getIsolatedRanges(view, from, to) { 12870 let isolates = view.state.facet(bidiIsolatedRanges); 12871 if (!isolates.length) 12872 return isolates; 12873 let sets = isolates.map((i2) => i2 instanceof Function ? i2(view) : i2); 12874 let result = []; 12875 RangeSet.spans(sets, from, to, { 12876 point() { 12877 }, 12878 span(from2, to2, active, open) { 12879 let level = result; 12880 for (let i2 = active.length - 1; i2 >= 0; i2--, open--) { 12881 let iso = active[i2].spec.bidiIsolate, update; 12882 if (iso == null) 12883 continue; 12884 if (open > 0 && level.length && (update = level[level.length - 1]).to == from2 && update.direction == iso) { 12885 update.to = to2; 12886 level = update.inner; 12887 } else { 12888 let add2 = { from: from2, to: to2, direction: iso, inner: [] }; 12889 level.push(add2); 12890 level = add2.inner; 12891 } 12892 } 12893 } 12894 }); 12895 return result; 12896} 12897var scrollMargins = /* @__PURE__ */ Facet.define(); 12898function getScrollMargins(view) { 12899 let left = 0, right = 0, top2 = 0, bottom = 0; 12900 for (let source of view.state.facet(scrollMargins)) { 12901 let m2 = source(view); 12902 if (m2) { 12903 if (m2.left != null) 12904 left = Math.max(left, m2.left); 12905 if (m2.right != null) 12906 right = Math.max(right, m2.right); 12907 if (m2.top != null) 12908 top2 = Math.max(top2, m2.top); 12909 if (m2.bottom != null) 12910 bottom = Math.max(bottom, m2.bottom); 12911 } 12912 } 12913 return { left, right, top: top2, bottom }; 12914} 12915var styleModule = /* @__PURE__ */ Facet.define(); 12916var ChangedRange = class _ChangedRange { 12917 constructor(fromA, toA, fromB, toB) { 12918 this.fromA = fromA; 12919 this.toA = toA; 12920 this.fromB = fromB; 12921 this.toB = toB; 12922 } 12923 join(other) { 12924 return new _ChangedRange(Math.min(this.fromA, other.fromA), Math.max(this.toA, other.toA), Math.min(this.fromB, other.fromB), Math.max(this.toB, other.toB)); 12925 } 12926 addToSet(set) { 12927 let i2 = set.length, me = this; 12928 for (; i2 > 0; i2--) { 12929 let range = set[i2 - 1]; 12930 if (range.fromA > me.toA) 12931 continue; 12932 if (range.toA < me.fromA) 12933 break; 12934 me = me.join(range); 12935 set.splice(i2 - 1, 1); 12936 } 12937 set.splice(i2, 0, me); 12938 return set; 12939 } 12940 static extendWithRanges(diff, ranges) { 12941 if (ranges.length == 0) 12942 return diff; 12943 let result = []; 12944 for (let dI = 0, rI = 0, posA = 0, posB = 0; ; dI++) { 12945 let next = dI == diff.length ? null : diff[dI], off = posA - posB; 12946 let end = next ? next.fromB : 1e9; 12947 while (rI < ranges.length && ranges[rI] < end) { 12948 let from = ranges[rI], to = ranges[rI + 1]; 12949 let fromB = Math.max(posB, from), toB = Math.min(end, to); 12950 if (fromB <= toB) 12951 new _ChangedRange(fromB + off, toB + off, fromB, toB).addToSet(result); 12952 if (to > end) 12953 break; 12954 else 12955 rI += 2; 12956 } 12957 if (!next) 12958 return result; 12959 new _ChangedRange(next.fromA, next.toA, next.fromB, next.toB).addToSet(result); 12960 posA = next.toA; 12961 posB = next.toB; 12962 } 12963 } 12964}; 12965var ViewUpdate = class _ViewUpdate { 12966 constructor(view, state, transactions) { 12967 this.view = view; 12968 this.state = state; 12969 this.transactions = transactions; 12970 this.flags = 0; 12971 this.startState = view.state; 12972 this.changes = ChangeSet.empty(this.startState.doc.length); 12973 for (let tr of transactions) 12974 this.changes = this.changes.compose(tr.changes); 12975 let changedRanges = []; 12976 this.changes.iterChangedRanges((fromA, toA, fromB, toB) => changedRanges.push(new ChangedRange(fromA, toA, fromB, toB))); 12977 this.changedRanges = changedRanges; 12978 } 12979 /** 12980 @internal 12981 */ 12982 static create(view, state, transactions) { 12983 return new _ViewUpdate(view, state, transactions); 12984 } 12985 /** 12986 Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or 12987 [visible ranges](https://codemirror.net/6/docs/ref/#view.EditorView.visibleRanges) changed in this 12988 update. 12989 */ 12990 get viewportChanged() { 12991 return (this.flags & 4) > 0; 12992 } 12993 /** 12994 Indicates whether the height of a block element in the editor 12995 changed in this update. 12996 */ 12997 get heightChanged() { 12998 return (this.flags & 2) > 0; 12999 } 13000 /** 13001 Returns true when the document was modified or the size of the 13002 editor, or elements within the editor, changed. 13003 */ 13004 get geometryChanged() { 13005 return this.docChanged || (this.flags & (8 | 2)) > 0; 13006 } 13007 /** 13008 True when this update indicates a focus change. 13009 */ 13010 get focusChanged() { 13011 return (this.flags & 1) > 0; 13012 } 13013 /** 13014 Whether the document changed in this update. 13015 */ 13016 get docChanged() { 13017 return !this.changes.empty; 13018 } 13019 /** 13020 Whether the selection was explicitly set in this update. 13021 */ 13022 get selectionSet() { 13023 return this.transactions.some((tr) => tr.selection); 13024 } 13025 /** 13026 @internal 13027 */ 13028 get empty() { 13029 return this.flags == 0 && this.transactions.length == 0; 13030 } 13031}; 13032var Direction = /* @__PURE__ */ function(Direction2) { 13033 Direction2[Direction2["LTR"] = 0] = "LTR"; 13034 Direction2[Direction2["RTL"] = 1] = "RTL"; 13035 return Direction2; 13036}(Direction || (Direction = {})); 13037var LTR = Direction.LTR; 13038var RTL = Direction.RTL; 13039function dec(str) { 13040 let result = []; 13041 for (let i2 = 0; i2 < str.length; i2++) 13042 result.push(1 << +str[i2]); 13043 return result; 13044} 13045var LowTypes = /* @__PURE__ */ dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"); 13046var ArabicTypes = /* @__PURE__ */ dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"); 13047var Brackets = /* @__PURE__ */ Object.create(null); 13048var BracketStack = []; 13049for (let p2 of ["()", "[]", "{}"]) { 13050 let l3 = /* @__PURE__ */ p2.charCodeAt(0), r2 = /* @__PURE__ */ p2.charCodeAt(1); 13051 Brackets[l3] = r2; 13052 Brackets[r2] = -l3; 13053} 13054function charType(ch) { 13055 return ch <= 247 ? LowTypes[ch] : 1424 <= ch && ch <= 1524 ? 2 : 1536 <= ch && ch <= 1785 ? ArabicTypes[ch - 1536] : 1774 <= ch && ch <= 2220 ? 4 : 8192 <= ch && ch <= 8203 ? 256 : 64336 <= ch && ch <= 65023 ? 4 : ch == 8204 ? 256 : 1; 13056} 13057var BidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/; 13058var BidiSpan = class { 13059 /** 13060 The direction of this span. 13061 */ 13062 get dir() { 13063 return this.level % 2 ? RTL : LTR; 13064 } 13065 /** 13066 @internal 13067 */ 13068 constructor(from, to, level) { 13069 this.from = from; 13070 this.to = to; 13071 this.level = level; 13072 } 13073 /** 13074 @internal 13075 */ 13076 side(end, dir) { 13077 return this.dir == dir == end ? this.to : this.from; 13078 } 13079 /** 13080 @internal 13081 */ 13082 static find(order, index, level, assoc) { 13083 let maybe = -1; 13084 for (let i2 = 0; i2 < order.length; i2++) { 13085 let span = order[i2]; 13086 if (span.from <= index && span.to >= index) { 13087 if (span.level == level) 13088 return i2; 13089 if (maybe < 0 || (assoc != 0 ? assoc < 0 ? span.from < index : span.to > index : order[maybe].level > span.level)) 13090 maybe = i2; 13091 } 13092 } 13093 if (maybe < 0) 13094 throw new RangeError("Index out of range"); 13095 return maybe; 13096 } 13097}; 13098function isolatesEq(a2, b3) { 13099 if (a2.length != b3.length) 13100 return false; 13101 for (let i2 = 0; i2 < a2.length; i2++) { 13102 let iA = a2[i2], iB = b3[i2]; 13103 if (iA.from != iB.from || iA.to != iB.to || iA.direction != iB.direction || !isolatesEq(iA.inner, iB.inner)) 13104 return false; 13105 } 13106 return true; 13107} 13108var types = []; 13109function computeCharTypes(line, rFrom, rTo, isolates, outerType) { 13110 for (let iI = 0; iI <= isolates.length; iI++) { 13111 let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo; 13112 let prevType = iI ? 256 : outerType; 13113 for (let i2 = from, prev = prevType, prevStrong = prevType; i2 < to; i2++) { 13114 let type = charType(line.charCodeAt(i2)); 13115 if (type == 512) 13116 type = prev; 13117 else if (type == 8 && prevStrong == 4) 13118 type = 16; 13119 types[i2] = type == 4 ? 2 : type; 13120 if (type & 7) 13121 prevStrong = type; 13122 prev = type; 13123 } 13124 for (let i2 = from, prev = prevType, prevStrong = prevType; i2 < to; i2++) { 13125 let type = types[i2]; 13126 if (type == 128) { 13127 if (i2 < to - 1 && prev == types[i2 + 1] && prev & 24) 13128 type = types[i2] = prev; 13129 else 13130 types[i2] = 256; 13131 } else if (type == 64) { 13132 let end = i2 + 1; 13133 while (end < to && types[end] == 64) 13134 end++; 13135 let replace = i2 && prev == 8 || end < rTo && types[end] == 8 ? prevStrong == 1 ? 1 : 8 : 256; 13136 for (let j3 = i2; j3 < end; j3++) 13137 types[j3] = replace; 13138 i2 = end - 1; 13139 } else if (type == 8 && prevStrong == 1) { 13140 types[i2] = 1; 13141 } 13142 prev = type; 13143 if (type & 7) 13144 prevStrong = type; 13145 } 13146 } 13147} 13148function processBracketPairs(line, rFrom, rTo, isolates, outerType) { 13149 let oppositeType = outerType == 1 ? 2 : 1; 13150 for (let iI = 0, sI = 0, context = 0; iI <= isolates.length; iI++) { 13151 let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo; 13152 for (let i2 = from, ch, br, type; i2 < to; i2++) { 13153 if (br = Brackets[ch = line.charCodeAt(i2)]) { 13154 if (br < 0) { 13155 for (let sJ = sI - 3; sJ >= 0; sJ -= 3) { 13156 if (BracketStack[sJ + 1] == -br) { 13157 let flags = BracketStack[sJ + 2]; 13158 let type2 = flags & 2 ? outerType : !(flags & 4) ? 0 : flags & 1 ? oppositeType : outerType; 13159 if (type2) 13160 types[i2] = types[BracketStack[sJ]] = type2; 13161 sI = sJ; 13162 break; 13163 } 13164 } 13165 } else if (BracketStack.length == 189) { 13166 break; 13167 } else { 13168 BracketStack[sI++] = i2; 13169 BracketStack[sI++] = ch; 13170 BracketStack[sI++] = context; 13171 } 13172 } else if ((type = types[i2]) == 2 || type == 1) { 13173 let embed = type == outerType; 13174 context = embed ? 0 : 1; 13175 for (let sJ = sI - 3; sJ >= 0; sJ -= 3) { 13176 let cur2 = BracketStack[sJ + 2]; 13177 if (cur2 & 2) 13178 break; 13179 if (embed) { 13180 BracketStack[sJ + 2] |= 2; 13181 } else { 13182 if (cur2 & 4) 13183 break; 13184 BracketStack[sJ + 2] |= 4; 13185 } 13186 } 13187 } 13188 } 13189 } 13190} 13191function processNeutrals(rFrom, rTo, isolates, outerType) { 13192 for (let iI = 0, prev = outerType; iI <= isolates.length; iI++) { 13193 let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo; 13194 for (let i2 = from; i2 < to; ) { 13195 let type = types[i2]; 13196 if (type == 256) { 13197 let end = i2 + 1; 13198 for (; ; ) { 13199 if (end == to) { 13200 if (iI == isolates.length) 13201 break; 13202 end = isolates[iI++].to; 13203 to = iI < isolates.length ? isolates[iI].from : rTo; 13204 } else if (types[end] == 256) { 13205 end++; 13206 } else { 13207 break; 13208 } 13209 } 13210 let beforeL = prev == 1; 13211 let afterL = (end < rTo ? types[end] : outerType) == 1; 13212 let replace = beforeL == afterL ? beforeL ? 1 : 2 : outerType; 13213 for (let j3 = end, jI = iI, fromJ = jI ? isolates[jI - 1].to : rFrom; j3 > i2; ) { 13214 if (j3 == fromJ) { 13215 j3 = isolates[--jI].from; 13216 fromJ = jI ? isolates[jI - 1].to : rFrom; 13217 } 13218 types[--j3] = replace; 13219 } 13220 i2 = end; 13221 } else { 13222 prev = type; 13223 i2++; 13224 } 13225 } 13226 } 13227} 13228function emitSpans(line, from, to, level, baseLevel, isolates, order) { 13229 let ourType = level % 2 ? 2 : 1; 13230 if (level % 2 == baseLevel % 2) { 13231 for (let iCh = from, iI = 0; iCh < to; ) { 13232 let sameDir = true, isNum = false; 13233 if (iI == isolates.length || iCh < isolates[iI].from) { 13234 let next = types[iCh]; 13235 if (next != ourType) { 13236 sameDir = false; 13237 isNum = next == 16; 13238 } 13239 } 13240 let recurse = !sameDir && ourType == 1 ? [] : null; 13241 let localLevel = sameDir ? level : level + 1; 13242 let iScan = iCh; 13243 run: 13244 for (; ; ) { 13245 if (iI < isolates.length && iScan == isolates[iI].from) { 13246 if (isNum) 13247 break run; 13248 let iso = isolates[iI]; 13249 if (!sameDir) 13250 for (let upto = iso.to, jI = iI + 1; ; ) { 13251 if (upto == to) 13252 break run; 13253 if (jI < isolates.length && isolates[jI].from == upto) 13254 upto = isolates[jI++].to; 13255 else if (types[upto] == ourType) 13256 break run; 13257 else 13258 break; 13259 } 13260 iI++; 13261 if (recurse) { 13262 recurse.push(iso); 13263 } else { 13264 if (iso.from > iCh) 13265 order.push(new BidiSpan(iCh, iso.from, localLevel)); 13266 let dirSwap = iso.direction == LTR != !(localLevel % 2); 13267 computeSectionOrder(line, dirSwap ? level + 1 : level, baseLevel, iso.inner, iso.from, iso.to, order); 13268 iCh = iso.to; 13269 } 13270 iScan = iso.to; 13271 } else if (iScan == to || (sameDir ? types[iScan] != ourType : types[iScan] == ourType)) { 13272 break; 13273 } else { 13274 iScan++; 13275 } 13276 } 13277 if (recurse) 13278 emitSpans(line, iCh, iScan, level + 1, baseLevel, recurse, order); 13279 else if (iCh < iScan) 13280 order.push(new BidiSpan(iCh, iScan, localLevel)); 13281 iCh = iScan; 13282 } 13283 } else { 13284 for (let iCh = to, iI = isolates.length; iCh > from; ) { 13285 let sameDir = true, isNum = false; 13286 if (!iI || iCh > isolates[iI - 1].to) { 13287 let next = types[iCh - 1]; 13288 if (next != ourType) { 13289 sameDir = false; 13290 isNum = next == 16; 13291 } 13292 } 13293 let recurse = !sameDir && ourType == 1 ? [] : null; 13294 let localLevel = sameDir ? level : level + 1; 13295 let iScan = iCh; 13296 run: 13297 for (; ; ) { 13298 if (iI && iScan == isolates[iI - 1].to) { 13299 if (isNum) 13300 break run; 13301 let iso = isolates[--iI]; 13302 if (!sameDir) 13303 for (let upto = iso.from, jI = iI; ; ) { 13304 if (upto == from) 13305 break run; 13306 if (jI && isolates[jI - 1].to == upto) 13307 upto = isolates[--jI].from; 13308 else if (types[upto - 1] == ourType) 13309 break run; 13310 else 13311 break; 13312 } 13313 if (recurse) { 13314 recurse.push(iso); 13315 } else { 13316 if (iso.to < iCh) 13317 order.push(new BidiSpan(iso.to, iCh, localLevel)); 13318 let dirSwap = iso.direction == LTR != !(localLevel % 2); 13319 computeSectionOrder(line, dirSwap ? level + 1 : level, baseLevel, iso.inner, iso.from, iso.to, order); 13320 iCh = iso.from; 13321 } 13322 iScan = iso.from; 13323 } else if (iScan == from || (sameDir ? types[iScan - 1] != ourType : types[iScan - 1] == ourType)) { 13324 break; 13325 } else { 13326 iScan--; 13327 } 13328 } 13329 if (recurse) 13330 emitSpans(line, iScan, iCh, level + 1, baseLevel, recurse, order); 13331 else if (iScan < iCh) 13332 order.push(new BidiSpan(iScan, iCh, localLevel)); 13333 iCh = iScan; 13334 } 13335 } 13336} 13337function computeSectionOrder(line, level, baseLevel, isolates, from, to, order) { 13338 let outerType = level % 2 ? 2 : 1; 13339 computeCharTypes(line, from, to, isolates, outerType); 13340 processBracketPairs(line, from, to, isolates, outerType); 13341 processNeutrals(from, to, isolates, outerType); 13342 emitSpans(line, from, to, level, baseLevel, isolates, order); 13343} 13344function computeOrder(line, direction, isolates) { 13345 if (!line) 13346 return [new BidiSpan(0, 0, direction == RTL ? 1 : 0)]; 13347 if (direction == LTR && !isolates.length && !BidiRE.test(line)) 13348 return trivialOrder(line.length); 13349 if (isolates.length) 13350 while (line.length > types.length) 13351 types[types.length] = 256; 13352 let order = [], level = direction == LTR ? 0 : 1; 13353 computeSectionOrder(line, level, level, isolates, 0, line.length, order); 13354 return order; 13355} 13356function trivialOrder(length) { 13357 return [new BidiSpan(0, length, 0)]; 13358} 13359var movedOver = ""; 13360function moveVisually(line, order, dir, start, forward) { 13361 var _a3; 13362 let startIndex = start.head - line.from, spanI = -1; 13363 if (startIndex == 0) { 13364 if (!forward || !line.length) 13365 return null; 13366 if (order[0].level != dir) { 13367 startIndex = order[0].side(false, dir); 13368 spanI = 0; 13369 } 13370 } else if (startIndex == line.length) { 13371 if (forward) 13372 return null; 13373 let last = order[order.length - 1]; 13374 if (last.level != dir) { 13375 startIndex = last.side(true, dir); 13376 spanI = order.length - 1; 13377 } 13378 } 13379 if (spanI < 0) 13380 spanI = BidiSpan.find(order, startIndex, (_a3 = start.bidiLevel) !== null && _a3 !== void 0 ? _a3 : -1, start.assoc); 13381 let span = order[spanI]; 13382 if (startIndex == span.side(forward, dir)) { 13383 span = order[spanI += forward ? 1 : -1]; 13384 startIndex = span.side(!forward, dir); 13385 } 13386 let indexForward = forward == (span.dir == dir); 13387 let nextIndex = findClusterBreak(line.text, startIndex, indexForward); 13388 movedOver = line.text.slice(Math.min(startIndex, nextIndex), Math.max(startIndex, nextIndex)); 13389 if (nextIndex != span.side(forward, dir)) 13390 return EditorSelection.cursor(nextIndex + line.from, indexForward ? -1 : 1, span.level); 13391 let nextSpan = spanI == (forward ? order.length - 1 : 0) ? null : order[spanI + (forward ? 1 : -1)]; 13392 if (!nextSpan && span.level != dir) 13393 return EditorSelection.cursor(forward ? line.to : line.from, forward ? -1 : 1, dir); 13394 if (nextSpan && nextSpan.level < span.level) 13395 return EditorSelection.cursor(nextSpan.side(!forward, dir) + line.from, forward ? 1 : -1, nextSpan.level); 13396 return EditorSelection.cursor(nextIndex + line.from, forward ? -1 : 1, span.level); 13397} 13398var DocView = class extends ContentView { 13399 get length() { 13400 return this.view.state.doc.length; 13401 } 13402 constructor(view) { 13403 super(); 13404 this.view = view; 13405 this.decorations = []; 13406 this.dynamicDecorationMap = []; 13407 this.domChanged = null; 13408 this.hasComposition = null; 13409 this.markedForComposition = /* @__PURE__ */ new Set(); 13410 this.minWidth = 0; 13411 this.minWidthFrom = 0; 13412 this.minWidthTo = 0; 13413 this.impreciseAnchor = null; 13414 this.impreciseHead = null; 13415 this.forceSelection = false; 13416 this.lastUpdate = Date.now(); 13417 this.setDOM(view.contentDOM); 13418 this.children = [new LineView()]; 13419 this.children[0].setParent(this); 13420 this.updateDeco(); 13421 this.updateInner([new ChangedRange(0, 0, 0, view.state.doc.length)], 0, null); 13422 } 13423 // Update the document view to a given state. 13424 update(update) { 13425 var _a3; 13426 let changedRanges = update.changedRanges; 13427 if (this.minWidth > 0 && changedRanges.length) { 13428 if (!changedRanges.every(({ fromA, toA }) => toA < this.minWidthFrom || fromA > this.minWidthTo)) { 13429 this.minWidth = this.minWidthFrom = this.minWidthTo = 0; 13430 } else { 13431 this.minWidthFrom = update.changes.mapPos(this.minWidthFrom, 1); 13432 this.minWidthTo = update.changes.mapPos(this.minWidthTo, 1); 13433 } 13434 } 13435 let readCompositionAt = -1; 13436 if (this.view.inputState.composing >= 0) { 13437 if ((_a3 = this.domChanged) === null || _a3 === void 0 ? void 0 : _a3.newSel) 13438 readCompositionAt = this.domChanged.newSel.head; 13439 else if (!touchesComposition(update.changes, this.hasComposition) && !update.selectionSet) 13440 readCompositionAt = update.state.selection.main.head; 13441 } 13442 let composition = readCompositionAt > -1 ? findCompositionRange(this.view, update.changes, readCompositionAt) : null; 13443 this.domChanged = null; 13444 if (this.hasComposition) { 13445 this.markedForComposition.clear(); 13446 let { from, to } = this.hasComposition; 13447 changedRanges = new ChangedRange(from, to, update.changes.mapPos(from, -1), update.changes.mapPos(to, 1)).addToSet(changedRanges.slice()); 13448 } 13449 this.hasComposition = composition ? { from: composition.range.fromB, to: composition.range.toB } : null; 13450 if ((browser.ie || browser.chrome) && !composition && update && update.state.doc.lines != update.startState.doc.lines) 13451 this.forceSelection = true; 13452 let prevDeco = this.decorations, deco = this.updateDeco(); 13453 let decoDiff = findChangedDeco(prevDeco, deco, update.changes); 13454 changedRanges = ChangedRange.extendWithRanges(changedRanges, decoDiff); 13455 if (!(this.flags & 7) && changedRanges.length == 0) { 13456 return false; 13457 } else { 13458 this.updateInner(changedRanges, update.startState.doc.length, composition); 13459 if (update.transactions.length) 13460 this.lastUpdate = Date.now(); 13461 return true; 13462 } 13463 } 13464 // Used by update and the constructor do perform the actual DOM 13465 // update 13466 updateInner(changes, oldLength, composition) { 13467 this.view.viewState.mustMeasureContent = true; 13468 this.updateChildren(changes, oldLength, composition); 13469 let { observer } = this.view; 13470 observer.ignore(() => { 13471 this.dom.style.height = this.view.viewState.contentHeight / this.view.scaleY + "px"; 13472 this.dom.style.flexBasis = this.minWidth ? this.minWidth + "px" : ""; 13473 let track = browser.chrome || browser.ios ? { node: observer.selectionRange.focusNode, written: false } : void 0; 13474 this.sync(this.view, track); 13475 this.flags &= ~7; 13476 if (track && (track.written || observer.selectionRange.focusNode != track.node)) 13477 this.forceSelection = true; 13478 this.dom.style.height = ""; 13479 }); 13480 this.markedForComposition.forEach( 13481 (cView) => cView.flags &= ~8 13482 /* ViewFlag.Composition */ 13483 ); 13484 let gaps = []; 13485 if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length) { 13486 for (let child of this.children) 13487 if (child instanceof BlockWidgetView && child.widget instanceof BlockGapWidget) 13488 gaps.push(child.dom); 13489 } 13490 observer.updateGaps(gaps); 13491 } 13492 updateChildren(changes, oldLength, composition) { 13493 let ranges = composition ? composition.range.addToSet(changes.slice()) : changes; 13494 let cursor = this.childCursor(oldLength); 13495 for (let i2 = ranges.length - 1; ; i2--) { 13496 let next = i2 >= 0 ? ranges[i2] : null; 13497 if (!next) 13498 break; 13499 let { fromA, toA, fromB, toB } = next, content2, breakAtStart, openStart, openEnd; 13500 if (composition && composition.range.fromB < toB && composition.range.toB > fromB) { 13501 let before = ContentBuilder.build(this.view.state.doc, fromB, composition.range.fromB, this.decorations, this.dynamicDecorationMap); 13502 let after = ContentBuilder.build(this.view.state.doc, composition.range.toB, toB, this.decorations, this.dynamicDecorationMap); 13503 breakAtStart = before.breakAtStart; 13504 openStart = before.openStart; 13505 openEnd = after.openEnd; 13506 let compLine = this.compositionView(composition); 13507 if (after.breakAtStart) { 13508 compLine.breakAfter = 1; 13509 } else if (after.content.length && compLine.merge(compLine.length, compLine.length, after.content[0], false, after.openStart, 0)) { 13510 compLine.breakAfter = after.content[0].breakAfter; 13511 after.content.shift(); 13512 } 13513 if (before.content.length && compLine.merge(0, 0, before.content[before.content.length - 1], true, 0, before.openEnd)) { 13514 before.content.pop(); 13515 } 13516 content2 = before.content.concat(compLine).concat(after.content); 13517 } else { 13518 ({ content: content2, breakAtStart, openStart, openEnd } = ContentBuilder.build(this.view.state.doc, fromB, toB, this.decorations, this.dynamicDecorationMap)); 13519 } 13520 let { i: toI, off: toOff } = cursor.findPos(toA, 1); 13521 let { i: fromI, off: fromOff } = cursor.findPos(fromA, -1); 13522 replaceRange(this, fromI, fromOff, toI, toOff, content2, breakAtStart, openStart, openEnd); 13523 } 13524 if (composition) 13525 this.fixCompositionDOM(composition); 13526 } 13527 compositionView(composition) { 13528 let cur2 = new TextView(composition.text.nodeValue); 13529 cur2.flags |= 8; 13530 for (let { deco } of composition.marks) 13531 cur2 = new MarkView(deco, [cur2], cur2.length); 13532 let line = new LineView(); 13533 line.append(cur2, 0); 13534 return line; 13535 } 13536 fixCompositionDOM(composition) { 13537 let fix = (dom, cView2) => { 13538 cView2.flags |= 8 | (cView2.children.some( 13539 (c2) => c2.flags & 7 13540 /* ViewFlag.Dirty */ 13541 ) ? 1 : 0); 13542 this.markedForComposition.add(cView2); 13543 let prev = ContentView.get(dom); 13544 if (prev && prev != cView2) 13545 prev.dom = null; 13546 cView2.setDOM(dom); 13547 }; 13548 let pos = this.childPos(composition.range.fromB, 1); 13549 let cView = this.children[pos.i]; 13550 fix(composition.line, cView); 13551 for (let i2 = composition.marks.length - 1; i2 >= -1; i2--) { 13552 pos = cView.childPos(pos.off, 1); 13553 cView = cView.children[pos.i]; 13554 fix(i2 >= 0 ? composition.marks[i2].node : composition.text, cView); 13555 } 13556 } 13557 // Sync the DOM selection to this.state.selection 13558 updateSelection(mustRead = false, fromPointer = false) { 13559 if (mustRead || !this.view.observer.selectionRange.focusNode) 13560 this.view.observer.readSelectionRange(); 13561 let activeElt = this.view.root.activeElement, focused = activeElt == this.dom; 13562 let selectionNotFocus = !focused && hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt)); 13563 if (!(focused || fromPointer || selectionNotFocus)) 13564 return; 13565 let force = this.forceSelection; 13566 this.forceSelection = false; 13567 let main = this.view.state.selection.main; 13568 let anchor = this.moveToLine(this.domAtPos(main.anchor)); 13569 let head = main.empty ? anchor : this.moveToLine(this.domAtPos(main.head)); 13570 if (browser.gecko && main.empty && !this.hasComposition && betweenUneditable(anchor)) { 13571 let dummy = document.createTextNode(""); 13572 this.view.observer.ignore(() => anchor.node.insertBefore(dummy, anchor.node.childNodes[anchor.offset] || null)); 13573 anchor = head = new DOMPos(dummy, 0); 13574 force = true; 13575 } 13576 let domSel = this.view.observer.selectionRange; 13577 if (force || !domSel.focusNode || !isEquivalentPosition(anchor.node, anchor.offset, domSel.anchorNode, domSel.anchorOffset) || !isEquivalentPosition(head.node, head.offset, domSel.focusNode, domSel.focusOffset)) { 13578 this.view.observer.ignore(() => { 13579 if (browser.android && browser.chrome && this.dom.contains(domSel.focusNode) && inUneditable(domSel.focusNode, this.dom)) { 13580 this.dom.blur(); 13581 this.dom.focus({ preventScroll: true }); 13582 } 13583 let rawSel = getSelection(this.view.root); 13584 if (!rawSel) 13585 ; 13586 else if (main.empty) { 13587 if (browser.gecko) { 13588 let nextTo = nextToUneditable(anchor.node, anchor.offset); 13589 if (nextTo && nextTo != (1 | 2)) { 13590 let text = nearbyTextNode(anchor.node, anchor.offset, nextTo == 1 ? 1 : -1); 13591 if (text) 13592 anchor = new DOMPos(text.node, text.offset); 13593 } 13594 } 13595 rawSel.collapse(anchor.node, anchor.offset); 13596 if (main.bidiLevel != null && rawSel.caretBidiLevel !== void 0) 13597 rawSel.caretBidiLevel = main.bidiLevel; 13598 } else if (rawSel.extend) { 13599 rawSel.collapse(anchor.node, anchor.offset); 13600 try { 13601 rawSel.extend(head.node, head.offset); 13602 } catch (_2) { 13603 } 13604 } else { 13605 let range = document.createRange(); 13606 if (main.anchor > main.head) 13607 [anchor, head] = [head, anchor]; 13608 range.setEnd(head.node, head.offset); 13609 range.setStart(anchor.node, anchor.offset); 13610 rawSel.removeAllRanges(); 13611 rawSel.addRange(range); 13612 } 13613 if (selectionNotFocus && this.view.root.activeElement == this.dom) { 13614 this.dom.blur(); 13615 if (activeElt) 13616 activeElt.focus(); 13617 } 13618 }); 13619 this.view.observer.setSelectionRange(anchor, head); 13620 } 13621 this.impreciseAnchor = anchor.precise ? null : new DOMPos(domSel.anchorNode, domSel.anchorOffset); 13622 this.impreciseHead = head.precise ? null : new DOMPos(domSel.focusNode, domSel.focusOffset); 13623 } 13624 enforceCursorAssoc() { 13625 if (this.hasComposition) 13626 return; 13627 let { view } = this, cursor = view.state.selection.main; 13628 let sel = getSelection(view.root); 13629 let { anchorNode, anchorOffset } = view.observer.selectionRange; 13630 if (!sel || !cursor.empty || !cursor.assoc || !sel.modify) 13631 return; 13632 let line = LineView.find(this, cursor.head); 13633 if (!line) 13634 return; 13635 let lineStart = line.posAtStart; 13636 if (cursor.head == lineStart || cursor.head == lineStart + line.length) 13637 return; 13638 let before = this.coordsAt(cursor.head, -1), after = this.coordsAt(cursor.head, 1); 13639 if (!before || !after || before.bottom > after.top) 13640 return; 13641 let dom = this.domAtPos(cursor.head + cursor.assoc); 13642 sel.collapse(dom.node, dom.offset); 13643 sel.modify("move", cursor.assoc < 0 ? "forward" : "backward", "lineboundary"); 13644 view.observer.readSelectionRange(); 13645 let newRange = view.observer.selectionRange; 13646 if (view.docView.posFromDOM(newRange.anchorNode, newRange.anchorOffset) != cursor.from) 13647 sel.collapse(anchorNode, anchorOffset); 13648 } 13649 // If a position is in/near a block widget, move it to a nearby text 13650 // line, since we don't want the cursor inside a block widget. 13651 moveToLine(pos) { 13652 let dom = this.dom, newPos; 13653 if (pos.node != dom) 13654 return pos; 13655 for (let i2 = pos.offset; !newPos && i2 < dom.childNodes.length; i2++) { 13656 let view = ContentView.get(dom.childNodes[i2]); 13657 if (view instanceof LineView) 13658 newPos = view.domAtPos(0); 13659 } 13660 for (let i2 = pos.offset - 1; !newPos && i2 >= 0; i2--) { 13661 let view = ContentView.get(dom.childNodes[i2]); 13662 if (view instanceof LineView) 13663 newPos = view.domAtPos(view.length); 13664 } 13665 return newPos ? new DOMPos(newPos.node, newPos.offset, true) : pos; 13666 } 13667 nearest(dom) { 13668 for (let cur2 = dom; cur2; ) { 13669 let domView = ContentView.get(cur2); 13670 if (domView && domView.rootView == this) 13671 return domView; 13672 cur2 = cur2.parentNode; 13673 } 13674 return null; 13675 } 13676 posFromDOM(node, offset) { 13677 let view = this.nearest(node); 13678 if (!view) 13679 throw new RangeError("Trying to find position for a DOM position outside of the document"); 13680 return view.localPosFromDOM(node, offset) + view.posAtStart; 13681 } 13682 domAtPos(pos) { 13683 let { i: i2, off } = this.childCursor().findPos(pos, -1); 13684 for (; i2 < this.children.length - 1; ) { 13685 let child = this.children[i2]; 13686 if (off < child.length || child instanceof LineView) 13687 break; 13688 i2++; 13689 off = 0; 13690 } 13691 return this.children[i2].domAtPos(off); 13692 } 13693 coordsAt(pos, side) { 13694 let best = null, bestPos = 0; 13695 for (let off = this.length, i2 = this.children.length - 1; i2 >= 0; i2--) { 13696 let child = this.children[i2], end = off - child.breakAfter, start = end - child.length; 13697 if (end < pos) 13698 break; 13699 if (start <= pos && (start < pos || child.covers(-1)) && (end > pos || child.covers(1)) && (!best || child instanceof LineView && !(best instanceof LineView && side >= 0))) { 13700 best = child; 13701 bestPos = start; 13702 } 13703 off = start; 13704 } 13705 return best ? best.coordsAt(pos - bestPos, side) : null; 13706 } 13707 coordsForChar(pos) { 13708 let { i: i2, off } = this.childPos(pos, 1), child = this.children[i2]; 13709 if (!(child instanceof LineView)) 13710 return null; 13711 while (child.children.length) { 13712 let { i: i3, off: childOff } = child.childPos(off, 1); 13713 for (; ; i3++) { 13714 if (i3 == child.children.length) 13715 return null; 13716 if ((child = child.children[i3]).length) 13717 break; 13718 } 13719 off = childOff; 13720 } 13721 if (!(child instanceof TextView)) 13722 return null; 13723 let end = findClusterBreak(child.text, off); 13724 if (end == off) 13725 return null; 13726 let rects = textRange(child.dom, off, end).getClientRects(); 13727 for (let i3 = 0; i3 < rects.length; i3++) { 13728 let rect = rects[i3]; 13729 if (i3 == rects.length - 1 || rect.top < rect.bottom && rect.left < rect.right) 13730 return rect; 13731 } 13732 return null; 13733 } 13734 measureVisibleLineHeights(viewport) { 13735 let result = [], { from, to } = viewport; 13736 let contentWidth = this.view.contentDOM.clientWidth; 13737 let isWider = contentWidth > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1; 13738 let widest = -1, ltr = this.view.textDirection == Direction.LTR; 13739 for (let pos = 0, i2 = 0; i2 < this.children.length; i2++) { 13740 let child = this.children[i2], end = pos + child.length; 13741 if (end > to) 13742 break; 13743 if (pos >= from) { 13744 let childRect = child.dom.getBoundingClientRect(); 13745 result.push(childRect.height); 13746 if (isWider) { 13747 let last = child.dom.lastChild; 13748 let rects = last ? clientRectsFor(last) : []; 13749 if (rects.length) { 13750 let rect = rects[rects.length - 1]; 13751 let width = ltr ? rect.right - childRect.left : childRect.right - rect.left; 13752 if (width > widest) { 13753 widest = width; 13754 this.minWidth = contentWidth; 13755 this.minWidthFrom = pos; 13756 this.minWidthTo = end; 13757 } 13758 } 13759 } 13760 } 13761 pos = end + child.breakAfter; 13762 } 13763 return result; 13764 } 13765 textDirectionAt(pos) { 13766 let { i: i2 } = this.childPos(pos, 1); 13767 return getComputedStyle(this.children[i2].dom).direction == "rtl" ? Direction.RTL : Direction.LTR; 13768 } 13769 measureTextSize() { 13770 for (let child of this.children) { 13771 if (child instanceof LineView) { 13772 let measure = child.measureTextSize(); 13773 if (measure) 13774 return measure; 13775 } 13776 } 13777 let dummy = document.createElement("div"), lineHeight, charWidth, textHeight; 13778 dummy.className = "cm-line"; 13779 dummy.style.width = "99999px"; 13780 dummy.style.position = "absolute"; 13781 dummy.textContent = "abc def ghi jkl mno pqr stu"; 13782 this.view.observer.ignore(() => { 13783 this.dom.appendChild(dummy); 13784 let rect = clientRectsFor(dummy.firstChild)[0]; 13785 lineHeight = dummy.getBoundingClientRect().height; 13786 charWidth = rect ? rect.width / 27 : 7; 13787 textHeight = rect ? rect.height : lineHeight; 13788 dummy.remove(); 13789 }); 13790 return { lineHeight, charWidth, textHeight }; 13791 } 13792 childCursor(pos = this.length) { 13793 let i2 = this.children.length; 13794 if (i2) 13795 pos -= this.children[--i2].length; 13796 return new ChildCursor(this.children, pos, i2); 13797 } 13798 computeBlockGapDeco() { 13799 let deco = [], vs = this.view.viewState; 13800 for (let pos = 0, i2 = 0; ; i2++) { 13801 let next = i2 == vs.viewports.length ? null : vs.viewports[i2]; 13802 let end = next ? next.from - 1 : this.length; 13803 if (end > pos) { 13804 let height = (vs.lineBlockAt(end).bottom - vs.lineBlockAt(pos).top) / this.view.scaleY; 13805 deco.push(Decoration.replace({ 13806 widget: new BlockGapWidget(height), 13807 block: true, 13808 inclusive: true, 13809 isBlockGap: true 13810 }).range(pos, end)); 13811 } 13812 if (!next) 13813 break; 13814 pos = next.to + 1; 13815 } 13816 return Decoration.set(deco); 13817 } 13818 updateDeco() { 13819 let allDeco = this.view.state.facet(decorations).map((d2, i2) => { 13820 let dynamic = this.dynamicDecorationMap[i2] = typeof d2 == "function"; 13821 return dynamic ? d2(this.view) : d2; 13822 }); 13823 for (let i2 = allDeco.length; i2 < allDeco.length + 3; i2++) 13824 this.dynamicDecorationMap[i2] = false; 13825 return this.decorations = [ 13826 ...allDeco, 13827 this.computeBlockGapDeco(), 13828 this.view.viewState.lineGapDeco 13829 ]; 13830 } 13831 scrollIntoView(target) { 13832 if (target.isSnapshot) { 13833 let ref = this.view.viewState.lineBlockAt(target.range.head); 13834 this.view.scrollDOM.scrollTop = ref.top - target.yMargin; 13835 this.view.scrollDOM.scrollLeft = target.xMargin; 13836 return; 13837 } 13838 let { range } = target; 13839 let rect = this.coordsAt(range.head, range.empty ? range.assoc : range.head > range.anchor ? -1 : 1), other; 13840 if (!rect) 13841 return; 13842 if (!range.empty && (other = this.coordsAt(range.anchor, range.anchor > range.head ? -1 : 1))) 13843 rect = { 13844 left: Math.min(rect.left, other.left), 13845 top: Math.min(rect.top, other.top), 13846 right: Math.max(rect.right, other.right), 13847 bottom: Math.max(rect.bottom, other.bottom) 13848 }; 13849 let margins = getScrollMargins(this.view); 13850 let targetRect = { 13851 left: rect.left - margins.left, 13852 top: rect.top - margins.top, 13853 right: rect.right + margins.right, 13854 bottom: rect.bottom + margins.bottom 13855 }; 13856 let { offsetWidth, offsetHeight } = this.view.scrollDOM; 13857 scrollRectIntoView(this.view.scrollDOM, targetRect, range.head < range.anchor ? -1 : 1, target.x, target.y, Math.max(Math.min(target.xMargin, offsetWidth), -offsetWidth), Math.max(Math.min(target.yMargin, offsetHeight), -offsetHeight), this.view.textDirection == Direction.LTR); 13858 } 13859}; 13860function betweenUneditable(pos) { 13861 return pos.node.nodeType == 1 && pos.node.firstChild && (pos.offset == 0 || pos.node.childNodes[pos.offset - 1].contentEditable == "false") && (pos.offset == pos.node.childNodes.length || pos.node.childNodes[pos.offset].contentEditable == "false"); 13862} 13863var BlockGapWidget = class extends WidgetType { 13864 constructor(height) { 13865 super(); 13866 this.height = height; 13867 } 13868 toDOM() { 13869 let elt = document.createElement("div"); 13870 this.updateDOM(elt); 13871 return elt; 13872 } 13873 eq(other) { 13874 return other.height == this.height; 13875 } 13876 updateDOM(elt) { 13877 elt.style.height = this.height + "px"; 13878 return true; 13879 } 13880 get estimatedHeight() { 13881 return this.height; 13882 } 13883}; 13884function findCompositionNode(view, headPos) { 13885 let sel = view.observer.selectionRange; 13886 let textNode = sel.focusNode && nearbyTextNode(sel.focusNode, sel.focusOffset, 0); 13887 if (!textNode) 13888 return null; 13889 let from = headPos - textNode.offset; 13890 return { from, to: from + textNode.node.nodeValue.length, node: textNode.node }; 13891} 13892function findCompositionRange(view, changes, headPos) { 13893 let found = findCompositionNode(view, headPos); 13894 if (!found) 13895 return null; 13896 let { node: textNode, from, to } = found, text = textNode.nodeValue; 13897 if (/[\n\r]/.test(text)) 13898 return null; 13899 if (view.state.doc.sliceString(found.from, found.to) != text) 13900 return null; 13901 let inv = changes.invertedDesc; 13902 let range = new ChangedRange(inv.mapPos(from), inv.mapPos(to), from, to); 13903 let marks = []; 13904 for (let parent = textNode.parentNode; ; parent = parent.parentNode) { 13905 let parentView = ContentView.get(parent); 13906 if (parentView instanceof MarkView) 13907 marks.push({ node: parent, deco: parentView.mark }); 13908 else if (parentView instanceof LineView || parent.nodeName == "DIV" && parent.parentNode == view.contentDOM) 13909 return { range, text: textNode, marks, line: parent }; 13910 else if (parent != view.contentDOM) 13911 marks.push({ node: parent, deco: new MarkDecoration({ 13912 inclusive: true, 13913 attributes: getAttrs(parent), 13914 tagName: parent.tagName.toLowerCase() 13915 }) }); 13916 else 13917 return null; 13918 } 13919} 13920function nearbyTextNode(startNode, startOffset, side) { 13921 if (side <= 0) 13922 for (let node = startNode, offset = startOffset; ; ) { 13923 if (node.nodeType == 3) 13924 return { node, offset }; 13925 if (node.nodeType == 1 && offset > 0) { 13926 node = node.childNodes[offset - 1]; 13927 offset = maxOffset(node); 13928 } else { 13929 break; 13930 } 13931 } 13932 if (side >= 0) 13933 for (let node = startNode, offset = startOffset; ; ) { 13934 if (node.nodeType == 3) 13935 return { node, offset }; 13936 if (node.nodeType == 1 && offset < node.childNodes.length && side >= 0) { 13937 node = node.childNodes[offset]; 13938 offset = 0; 13939 } else { 13940 break; 13941 } 13942 } 13943 return null; 13944} 13945function nextToUneditable(node, offset) { 13946 if (node.nodeType != 1) 13947 return 0; 13948 return (offset && node.childNodes[offset - 1].contentEditable == "false" ? 1 : 0) | (offset < node.childNodes.length && node.childNodes[offset].contentEditable == "false" ? 2 : 0); 13949} 13950var DecorationComparator$1 = class DecorationComparator { 13951 constructor() { 13952 this.changes = []; 13953 } 13954 compareRange(from, to) { 13955 addRange(from, to, this.changes); 13956 } 13957 comparePoint(from, to) { 13958 addRange(from, to, this.changes); 13959 } 13960}; 13961function findChangedDeco(a2, b3, diff) { 13962 let comp = new DecorationComparator$1(); 13963 RangeSet.compare(a2, b3, diff, comp); 13964 return comp.changes; 13965} 13966function inUneditable(node, inside2) { 13967 for (let cur2 = node; cur2 && cur2 != inside2; cur2 = cur2.assignedSlot || cur2.parentNode) { 13968 if (cur2.nodeType == 1 && cur2.contentEditable == "false") { 13969 return true; 13970 } 13971 } 13972 return false; 13973} 13974function touchesComposition(changes, composition) { 13975 let touched = false; 13976 if (composition) 13977 changes.iterChangedRanges((from, to) => { 13978 if (from < composition.to && to > composition.from) 13979 touched = true; 13980 }); 13981 return touched; 13982} 13983function groupAt(state, pos, bias = 1) { 13984 let categorize = state.charCategorizer(pos); 13985 let line = state.doc.lineAt(pos), linePos = pos - line.from; 13986 if (line.length == 0) 13987 return EditorSelection.cursor(pos); 13988 if (linePos == 0) 13989 bias = 1; 13990 else if (linePos == line.length) 13991 bias = -1; 13992 let from = linePos, to = linePos; 13993 if (bias < 0) 13994 from = findClusterBreak(line.text, linePos, false); 13995 else 13996 to = findClusterBreak(line.text, linePos); 13997 let cat = categorize(line.text.slice(from, to)); 13998 while (from > 0) { 13999 let prev = findClusterBreak(line.text, from, false); 14000 if (categorize(line.text.slice(prev, from)) != cat) 14001 break; 14002 from = prev; 14003 } 14004 while (to < line.length) { 14005 let next = findClusterBreak(line.text, to); 14006 if (categorize(line.text.slice(to, next)) != cat) 14007 break; 14008 to = next; 14009 } 14010 return EditorSelection.range(from + line.from, to + line.from); 14011} 14012function getdx(x, rect) { 14013 return rect.left > x ? rect.left - x : Math.max(0, x - rect.right); 14014} 14015function getdy(y2, rect) { 14016 return rect.top > y2 ? rect.top - y2 : Math.max(0, y2 - rect.bottom); 14017} 14018function yOverlap(a2, b3) { 14019 return a2.top < b3.bottom - 1 && a2.bottom > b3.top + 1; 14020} 14021function upTop(rect, top2) { 14022 return top2 < rect.top ? { top: top2, left: rect.left, right: rect.right, bottom: rect.bottom } : rect; 14023} 14024function upBot(rect, bottom) { 14025 return bottom > rect.bottom ? { top: rect.top, left: rect.left, right: rect.right, bottom } : rect; 14026} 14027function domPosAtCoords(parent, x, y2) { 14028 let closest, closestRect, closestX, closestY, closestOverlap = false; 14029 let above, below, aboveRect, belowRect; 14030 for (let child = parent.firstChild; child; child = child.nextSibling) { 14031 let rects = clientRectsFor(child); 14032 for (let i2 = 0; i2 < rects.length; i2++) { 14033 let rect = rects[i2]; 14034 if (closestRect && yOverlap(closestRect, rect)) 14035 rect = upTop(upBot(rect, closestRect.bottom), closestRect.top); 14036 let dx = getdx(x, rect), dy = getdy(y2, rect); 14037 if (dx == 0 && dy == 0) 14038 return child.nodeType == 3 ? domPosInText(child, x, y2) : domPosAtCoords(child, x, y2); 14039 if (!closest || closestY > dy || closestY == dy && closestX > dx) { 14040 closest = child; 14041 closestRect = rect; 14042 closestX = dx; 14043 closestY = dy; 14044 let side = dy ? y2 < rect.top ? -1 : 1 : dx ? x < rect.left ? -1 : 1 : 0; 14045 closestOverlap = !side || (side > 0 ? i2 < rects.length - 1 : i2 > 0); 14046 } 14047 if (dx == 0) { 14048 if (y2 > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) { 14049 above = child; 14050 aboveRect = rect; 14051 } else if (y2 < rect.top && (!belowRect || belowRect.top > rect.top)) { 14052 below = child; 14053 belowRect = rect; 14054 } 14055 } else if (aboveRect && yOverlap(aboveRect, rect)) { 14056 aboveRect = upBot(aboveRect, rect.bottom); 14057 } else if (belowRect && yOverlap(belowRect, rect)) { 14058 belowRect = upTop(belowRect, rect.top); 14059 } 14060 } 14061 } 14062 if (aboveRect && aboveRect.bottom >= y2) { 14063 closest = above; 14064 closestRect = aboveRect; 14065 } else if (belowRect && belowRect.top <= y2) { 14066 closest = below; 14067 closestRect = belowRect; 14068 } 14069 if (!closest) 14070 return { node: parent, offset: 0 }; 14071 let clipX = Math.max(closestRect.left, Math.min(closestRect.right, x)); 14072 if (closest.nodeType == 3) 14073 return domPosInText(closest, clipX, y2); 14074 if (closestOverlap && closest.contentEditable != "false") 14075 return domPosAtCoords(closest, clipX, y2); 14076 let offset = Array.prototype.indexOf.call(parent.childNodes, closest) + (x >= (closestRect.left + closestRect.right) / 2 ? 1 : 0); 14077 return { node: parent, offset }; 14078} 14079function domPosInText(node, x, y2) { 14080 let len = node.nodeValue.length; 14081 let closestOffset = -1, closestDY = 1e9, generalSide = 0; 14082 for (let i2 = 0; i2 < len; i2++) { 14083 let rects = textRange(node, i2, i2 + 1).getClientRects(); 14084 for (let j3 = 0; j3 < rects.length; j3++) { 14085 let rect = rects[j3]; 14086 if (rect.top == rect.bottom) 14087 continue; 14088 if (!generalSide) 14089 generalSide = x - rect.left; 14090 let dy = (rect.top > y2 ? rect.top - y2 : y2 - rect.bottom) - 1; 14091 if (rect.left - 1 <= x && rect.right + 1 >= x && dy < closestDY) { 14092 let right = x >= (rect.left + rect.right) / 2, after = right; 14093 if (browser.chrome || browser.gecko) { 14094 let rectBefore = textRange(node, i2).getBoundingClientRect(); 14095 if (rectBefore.left == rect.right) 14096 after = !right; 14097 } 14098 if (dy <= 0) 14099 return { node, offset: i2 + (after ? 1 : 0) }; 14100 closestOffset = i2 + (after ? 1 : 0); 14101 closestDY = dy; 14102 } 14103 } 14104 } 14105 return { node, offset: closestOffset > -1 ? closestOffset : generalSide > 0 ? node.nodeValue.length : 0 }; 14106} 14107function posAtCoords(view, coords, precise, bias = -1) { 14108 var _a3, _b2; 14109 let content2 = view.contentDOM.getBoundingClientRect(), docTop = content2.top + view.viewState.paddingTop; 14110 let block2, { docHeight } = view.viewState; 14111 let { x, y: y2 } = coords, yOffset = y2 - docTop; 14112 if (yOffset < 0) 14113 return 0; 14114 if (yOffset > docHeight) 14115 return view.state.doc.length; 14116 for (let halfLine = view.viewState.heightOracle.textHeight / 2, bounced = false; ; ) { 14117 block2 = view.elementAtHeight(yOffset); 14118 if (block2.type == BlockType.Text) 14119 break; 14120 for (; ; ) { 14121 yOffset = bias > 0 ? block2.bottom + halfLine : block2.top - halfLine; 14122 if (yOffset >= 0 && yOffset <= docHeight) 14123 break; 14124 if (bounced) 14125 return precise ? null : 0; 14126 bounced = true; 14127 bias = -bias; 14128 } 14129 } 14130 y2 = docTop + yOffset; 14131 let lineStart = block2.from; 14132 if (lineStart < view.viewport.from) 14133 return view.viewport.from == 0 ? 0 : precise ? null : posAtCoordsImprecise(view, content2, block2, x, y2); 14134 if (lineStart > view.viewport.to) 14135 return view.viewport.to == view.state.doc.length ? view.state.doc.length : precise ? null : posAtCoordsImprecise(view, content2, block2, x, y2); 14136 let doc2 = view.dom.ownerDocument; 14137 let root = view.root.elementFromPoint ? view.root : doc2; 14138 let element = root.elementFromPoint(x, y2); 14139 if (element && !view.contentDOM.contains(element)) 14140 element = null; 14141 if (!element) { 14142 x = Math.max(content2.left + 1, Math.min(content2.right - 1, x)); 14143 element = root.elementFromPoint(x, y2); 14144 if (element && !view.contentDOM.contains(element)) 14145 element = null; 14146 } 14147 let node, offset = -1; 14148 if (element && ((_a3 = view.docView.nearest(element)) === null || _a3 === void 0 ? void 0 : _a3.isEditable) != false) { 14149 if (doc2.caretPositionFromPoint) { 14150 let pos = doc2.caretPositionFromPoint(x, y2); 14151 if (pos) 14152 ({ offsetNode: node, offset } = pos); 14153 } else if (doc2.caretRangeFromPoint) { 14154 let range = doc2.caretRangeFromPoint(x, y2); 14155 if (range) { 14156 ({ startContainer: node, startOffset: offset } = range); 14157 if (!view.contentDOM.contains(node) || browser.safari && isSuspiciousSafariCaretResult(node, offset, x) || browser.chrome && isSuspiciousChromeCaretResult(node, offset, x)) 14158 node = void 0; 14159 } 14160 } 14161 } 14162 if (!node || !view.docView.dom.contains(node)) { 14163 let line = LineView.find(view.docView, lineStart); 14164 if (!line) 14165 return yOffset > block2.top + block2.height / 2 ? block2.to : block2.from; 14166 ({ node, offset } = domPosAtCoords(line.dom, x, y2)); 14167 } 14168 let nearest = view.docView.nearest(node); 14169 if (!nearest) 14170 return null; 14171 if (nearest.isWidget && ((_b2 = nearest.dom) === null || _b2 === void 0 ? void 0 : _b2.nodeType) == 1) { 14172 let rect = nearest.dom.getBoundingClientRect(); 14173 return coords.y < rect.top || coords.y <= rect.bottom && coords.x <= (rect.left + rect.right) / 2 ? nearest.posAtStart : nearest.posAtEnd; 14174 } else { 14175 return nearest.localPosFromDOM(node, offset) + nearest.posAtStart; 14176 } 14177} 14178function posAtCoordsImprecise(view, contentRect, block2, x, y2) { 14179 let into = Math.round((x - contentRect.left) * view.defaultCharacterWidth); 14180 if (view.lineWrapping && block2.height > view.defaultLineHeight * 1.5) { 14181 let textHeight = view.viewState.heightOracle.textHeight; 14182 let line = Math.floor((y2 - block2.top - (view.defaultLineHeight - textHeight) * 0.5) / textHeight); 14183 into += line * view.viewState.heightOracle.lineLength; 14184 } 14185 let content2 = view.state.sliceDoc(block2.from, block2.to); 14186 return block2.from + findColumn(content2, into, view.state.tabSize); 14187} 14188function isSuspiciousSafariCaretResult(node, offset, x) { 14189 let len; 14190 if (node.nodeType != 3 || offset != (len = node.nodeValue.length)) 14191 return false; 14192 for (let next = node.nextSibling; next; next = next.nextSibling) 14193 if (next.nodeType != 1 || next.nodeName != "BR") 14194 return false; 14195 return textRange(node, len - 1, len).getBoundingClientRect().left > x; 14196} 14197function isSuspiciousChromeCaretResult(node, offset, x) { 14198 if (offset != 0) 14199 return false; 14200 for (let cur2 = node; ; ) { 14201 let parent = cur2.parentNode; 14202 if (!parent || parent.nodeType != 1 || parent.firstChild != cur2) 14203 return false; 14204 if (parent.classList.contains("cm-line")) 14205 break; 14206 cur2 = parent; 14207 } 14208 let rect = node.nodeType == 1 ? node.getBoundingClientRect() : textRange(node, 0, Math.max(node.nodeValue.length, 1)).getBoundingClientRect(); 14209 return x - rect.left > 5; 14210} 14211function blockAt(view, pos) { 14212 let line = view.lineBlockAt(pos); 14213 if (Array.isArray(line.type)) 14214 for (let l3 of line.type) { 14215 if (l3.to > pos || l3.to == pos && (l3.to == line.to || l3.type == BlockType.Text)) 14216 return l3; 14217 } 14218 return line; 14219} 14220function moveToLineBoundary(view, start, forward, includeWrap) { 14221 let line = blockAt(view, start.head); 14222 let coords = !includeWrap || line.type != BlockType.Text || !(view.lineWrapping || line.widgetLineBreaks) ? null : view.coordsAtPos(start.assoc < 0 && start.head > line.from ? start.head - 1 : start.head); 14223 if (coords) { 14224 let editorRect = view.dom.getBoundingClientRect(); 14225 let direction = view.textDirectionAt(line.from); 14226 let pos = view.posAtCoords({ 14227 x: forward == (direction == Direction.LTR) ? editorRect.right - 1 : editorRect.left + 1, 14228 y: (coords.top + coords.bottom) / 2 14229 }); 14230 if (pos != null) 14231 return EditorSelection.cursor(pos, forward ? -1 : 1); 14232 } 14233 return EditorSelection.cursor(forward ? line.to : line.from, forward ? -1 : 1); 14234} 14235function moveByChar(view, start, forward, by) { 14236 let line = view.state.doc.lineAt(start.head), spans = view.bidiSpans(line); 14237 let direction = view.textDirectionAt(line.from); 14238 for (let cur2 = start, check = null; ; ) { 14239 let next = moveVisually(line, spans, direction, cur2, forward), char = movedOver; 14240 if (!next) { 14241 if (line.number == (forward ? view.state.doc.lines : 1)) 14242 return cur2; 14243 char = "\n"; 14244 line = view.state.doc.line(line.number + (forward ? 1 : -1)); 14245 spans = view.bidiSpans(line); 14246 next = EditorSelection.cursor(forward ? line.from : line.to); 14247 } 14248 if (!check) { 14249 if (!by) 14250 return next; 14251 check = by(char); 14252 } else if (!check(char)) { 14253 return cur2; 14254 } 14255 cur2 = next; 14256 } 14257} 14258function byGroup(view, pos, start) { 14259 let categorize = view.state.charCategorizer(pos); 14260 let cat = categorize(start); 14261 return (next) => { 14262 let nextCat = categorize(next); 14263 if (cat == CharCategory.Space) 14264 cat = nextCat; 14265 return cat == nextCat; 14266 }; 14267} 14268function moveVertically(view, start, forward, distance) { 14269 let startPos = start.head, dir = forward ? 1 : -1; 14270 if (startPos == (forward ? view.state.doc.length : 0)) 14271 return EditorSelection.cursor(startPos, start.assoc); 14272 let goal = start.goalColumn, startY; 14273 let rect = view.contentDOM.getBoundingClientRect(); 14274 let startCoords = view.coordsAtPos(startPos, start.assoc || -1), docTop = view.documentTop; 14275 if (startCoords) { 14276 if (goal == null) 14277 goal = startCoords.left - rect.left; 14278 startY = dir < 0 ? startCoords.top : startCoords.bottom; 14279 } else { 14280 let line = view.viewState.lineBlockAt(startPos); 14281 if (goal == null) 14282 goal = Math.min(rect.right - rect.left, view.defaultCharacterWidth * (startPos - line.from)); 14283 startY = (dir < 0 ? line.top : line.bottom) + docTop; 14284 } 14285 let resolvedGoal = rect.left + goal; 14286 let dist2 = distance !== null && distance !== void 0 ? distance : view.viewState.heightOracle.textHeight >> 1; 14287 for (let extra = 0; ; extra += 10) { 14288 let curY = startY + (dist2 + extra) * dir; 14289 let pos = posAtCoords(view, { x: resolvedGoal, y: curY }, false, dir); 14290 if (curY < rect.top || curY > rect.bottom || (dir < 0 ? pos < startPos : pos > startPos)) { 14291 let charRect = view.docView.coordsForChar(pos); 14292 let assoc = !charRect || curY < charRect.top ? -1 : 1; 14293 return EditorSelection.cursor(pos, assoc, void 0, goal); 14294 } 14295 } 14296} 14297function skipAtomicRanges(atoms2, pos, bias) { 14298 for (; ; ) { 14299 let moved = 0; 14300 for (let set of atoms2) { 14301 set.between(pos - 1, pos + 1, (from, to, value) => { 14302 if (pos > from && pos < to) { 14303 let side = moved || bias || (pos - from < to - pos ? -1 : 1); 14304 pos = side < 0 ? from : to; 14305 moved = side; 14306 } 14307 }); 14308 } 14309 if (!moved) 14310 return pos; 14311 } 14312} 14313function skipAtoms(view, oldPos, pos) { 14314 let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map((f3) => f3(view)), pos.from, oldPos.head > pos.from ? -1 : 1); 14315 return newPos == pos.from ? pos : EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1); 14316} 14317var InputState = class { 14318 setSelectionOrigin(origin) { 14319 this.lastSelectionOrigin = origin; 14320 this.lastSelectionTime = Date.now(); 14321 } 14322 constructor(view) { 14323 this.view = view; 14324 this.lastKeyCode = 0; 14325 this.lastKeyTime = 0; 14326 this.lastTouchTime = 0; 14327 this.lastFocusTime = 0; 14328 this.lastScrollTop = 0; 14329 this.lastScrollLeft = 0; 14330 this.pendingIOSKey = void 0; 14331 this.lastSelectionOrigin = null; 14332 this.lastSelectionTime = 0; 14333 this.lastEscPress = 0; 14334 this.lastContextMenu = 0; 14335 this.scrollHandlers = []; 14336 this.handlers = /* @__PURE__ */ Object.create(null); 14337 this.composing = -1; 14338 this.compositionFirstChange = null; 14339 this.compositionEndedAt = 0; 14340 this.compositionPendingKey = false; 14341 this.compositionPendingChange = false; 14342 this.mouseSelection = null; 14343 this.draggedContent = null; 14344 this.handleEvent = this.handleEvent.bind(this); 14345 this.notifiedFocused = view.hasFocus; 14346 if (browser.safari) 14347 view.contentDOM.addEventListener("input", () => null); 14348 if (browser.gecko) 14349 firefoxCopyCutHack(view.contentDOM.ownerDocument); 14350 } 14351 handleEvent(event) { 14352 if (!eventBelongsToEditor(this.view, event) || this.ignoreDuringComposition(event)) 14353 return; 14354 if (event.type == "keydown" && this.keydown(event)) 14355 return; 14356 this.runHandlers(event.type, event); 14357 } 14358 runHandlers(type, event) { 14359 let handlers2 = this.handlers[type]; 14360 if (handlers2) { 14361 for (let observer of handlers2.observers) 14362 observer(this.view, event); 14363 for (let handler of handlers2.handlers) { 14364 if (event.defaultPrevented) 14365 break; 14366 if (handler(this.view, event)) { 14367 event.preventDefault(); 14368 break; 14369 } 14370 } 14371 } 14372 } 14373 ensureHandlers(plugins) { 14374 let handlers2 = computeHandlers(plugins), prev = this.handlers, dom = this.view.contentDOM; 14375 for (let type in handlers2) 14376 if (type != "scroll") { 14377 let passive = !handlers2[type].handlers.length; 14378 let exists = prev[type]; 14379 if (exists && passive != !exists.handlers.length) { 14380 dom.removeEventListener(type, this.handleEvent); 14381 exists = null; 14382 } 14383 if (!exists) 14384 dom.addEventListener(type, this.handleEvent, { passive }); 14385 } 14386 for (let type in prev) 14387 if (type != "scroll" && !handlers2[type]) 14388 dom.removeEventListener(type, this.handleEvent); 14389 this.handlers = handlers2; 14390 } 14391 keydown(event) { 14392 this.lastKeyCode = event.keyCode; 14393 this.lastKeyTime = Date.now(); 14394 if (event.keyCode == 9 && Date.now() < this.lastEscPress + 2e3) 14395 return true; 14396 if (event.keyCode != 27 && modifierCodes.indexOf(event.keyCode) < 0) 14397 this.view.inputState.lastEscPress = 0; 14398 if (browser.android && browser.chrome && !event.synthetic && (event.keyCode == 13 || event.keyCode == 8)) { 14399 this.view.observer.delayAndroidKey(event.key, event.keyCode); 14400 return true; 14401 } 14402 let pending; 14403 if (browser.ios && !event.synthetic && !event.altKey && !event.metaKey && ((pending = PendingKeys.find((key) => key.keyCode == event.keyCode)) && !event.ctrlKey || EmacsyPendingKeys.indexOf(event.key) > -1 && event.ctrlKey && !event.shiftKey)) { 14404 this.pendingIOSKey = pending || event; 14405 setTimeout(() => this.flushIOSKey(), 250); 14406 return true; 14407 } 14408 if (event.keyCode != 229) 14409 this.view.observer.forceFlush(); 14410 return false; 14411 } 14412 flushIOSKey() { 14413 let key = this.pendingIOSKey; 14414 if (!key) 14415 return false; 14416 this.pendingIOSKey = void 0; 14417 return dispatchKey(this.view.contentDOM, key.key, key.keyCode); 14418 } 14419 ignoreDuringComposition(event) { 14420 if (!/^key/.test(event.type)) 14421 return false; 14422 if (this.composing > 0) 14423 return true; 14424 if (browser.safari && !browser.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100) { 14425 this.compositionPendingKey = false; 14426 return true; 14427 } 14428 return false; 14429 } 14430 startMouseSelection(mouseSelection) { 14431 if (this.mouseSelection) 14432 this.mouseSelection.destroy(); 14433 this.mouseSelection = mouseSelection; 14434 } 14435 update(update) { 14436 if (this.mouseSelection) 14437 this.mouseSelection.update(update); 14438 if (this.draggedContent && update.docChanged) 14439 this.draggedContent = this.draggedContent.map(update.changes); 14440 if (update.transactions.length) 14441 this.lastKeyCode = this.lastSelectionTime = 0; 14442 } 14443 destroy() { 14444 if (this.mouseSelection) 14445 this.mouseSelection.destroy(); 14446 } 14447}; 14448function bindHandler(plugin, handler) { 14449 return (view, event) => { 14450 try { 14451 return handler.call(plugin, event, view); 14452 } catch (e2) { 14453 logException(view.state, e2); 14454 } 14455 }; 14456} 14457function computeHandlers(plugins) { 14458 let result = /* @__PURE__ */ Object.create(null); 14459 function record(type) { 14460 return result[type] || (result[type] = { observers: [], handlers: [] }); 14461 } 14462 for (let plugin of plugins) { 14463 let spec = plugin.spec; 14464 if (spec && spec.domEventHandlers) 14465 for (let type in spec.domEventHandlers) { 14466 let f3 = spec.domEventHandlers[type]; 14467 if (f3) 14468 record(type).handlers.push(bindHandler(plugin.value, f3)); 14469 } 14470 if (spec && spec.domEventObservers) 14471 for (let type in spec.domEventObservers) { 14472 let f3 = spec.domEventObservers[type]; 14473 if (f3) 14474 record(type).observers.push(bindHandler(plugin.value, f3)); 14475 } 14476 } 14477 for (let type in handlers) 14478 record(type).handlers.push(handlers[type]); 14479 for (let type in observers) 14480 record(type).observers.push(observers[type]); 14481 return result; 14482} 14483var PendingKeys = [ 14484 { key: "Backspace", keyCode: 8, inputType: "deleteContentBackward" }, 14485 { key: "Enter", keyCode: 13, inputType: "insertParagraph" }, 14486 { key: "Enter", keyCode: 13, inputType: "insertLineBreak" }, 14487 { key: "Delete", keyCode: 46, inputType: "deleteContentForward" } 14488]; 14489var EmacsyPendingKeys = "dthko"; 14490var modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225]; 14491var dragScrollMargin = 6; 14492function dragScrollSpeed(dist2) { 14493 return Math.max(0, dist2) * 0.7 + 8; 14494} 14495function dist(a2, b3) { 14496 return Math.max(Math.abs(a2.clientX - b3.clientX), Math.abs(a2.clientY - b3.clientY)); 14497} 14498var MouseSelection = class { 14499 constructor(view, startEvent, style, mustSelect) { 14500 this.view = view; 14501 this.startEvent = startEvent; 14502 this.style = style; 14503 this.mustSelect = mustSelect; 14504 this.scrollSpeed = { x: 0, y: 0 }; 14505 this.scrolling = -1; 14506 this.lastEvent = startEvent; 14507 this.scrollParent = scrollableParent(view.contentDOM); 14508 this.atoms = view.state.facet(atomicRanges).map((f3) => f3(view)); 14509 let doc2 = view.contentDOM.ownerDocument; 14510 doc2.addEventListener("mousemove", this.move = this.move.bind(this)); 14511 doc2.addEventListener("mouseup", this.up = this.up.bind(this)); 14512 this.extend = startEvent.shiftKey; 14513 this.multiple = view.state.facet(EditorState.allowMultipleSelections) && addsSelectionRange(view, startEvent); 14514 this.dragging = isInPrimarySelection(view, startEvent) && getClickType(startEvent) == 1 ? null : false; 14515 } 14516 start(event) { 14517 if (this.dragging === false) 14518 this.select(event); 14519 } 14520 move(event) { 14521 var _a3; 14522 if (event.buttons == 0) 14523 return this.destroy(); 14524 if (this.dragging || this.dragging == null && dist(this.startEvent, event) < 10) 14525 return; 14526 this.select(this.lastEvent = event); 14527 let sx = 0, sy = 0; 14528 let rect = ((_a3 = this.scrollParent) === null || _a3 === void 0 ? void 0 : _a3.getBoundingClientRect()) || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight }; 14529 let margins = getScrollMargins(this.view); 14530 if (event.clientX - margins.left <= rect.left + dragScrollMargin) 14531 sx = -dragScrollSpeed(rect.left - event.clientX); 14532 else if (event.clientX + margins.right >= rect.right - dragScrollMargin) 14533 sx = dragScrollSpeed(event.clientX - rect.right); 14534 if (event.clientY - margins.top <= rect.top + dragScrollMargin) 14535 sy = -dragScrollSpeed(rect.top - event.clientY); 14536 else if (event.clientY + margins.bottom >= rect.bottom - dragScrollMargin) 14537 sy = dragScrollSpeed(event.clientY - rect.bottom); 14538 this.setScrollSpeed(sx, sy); 14539 } 14540 up(event) { 14541 if (this.dragging == null) 14542 this.select(this.lastEvent); 14543 if (!this.dragging) 14544 event.preventDefault(); 14545 this.destroy(); 14546 } 14547 destroy() { 14548 this.setScrollSpeed(0, 0); 14549 let doc2 = this.view.contentDOM.ownerDocument; 14550 doc2.removeEventListener("mousemove", this.move); 14551 doc2.removeEventListener("mouseup", this.up); 14552 this.view.inputState.mouseSelection = this.view.inputState.draggedContent = null; 14553 } 14554 setScrollSpeed(sx, sy) { 14555 this.scrollSpeed = { x: sx, y: sy }; 14556 if (sx || sy) { 14557 if (this.scrolling < 0) 14558 this.scrolling = setInterval(() => this.scroll(), 50); 14559 } else if (this.scrolling > -1) { 14560 clearInterval(this.scrolling); 14561 this.scrolling = -1; 14562 } 14563 } 14564 scroll() { 14565 if (this.scrollParent) { 14566 this.scrollParent.scrollLeft += this.scrollSpeed.x; 14567 this.scrollParent.scrollTop += this.scrollSpeed.y; 14568 } else { 14569 this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y); 14570 } 14571 if (this.dragging === false) 14572 this.select(this.lastEvent); 14573 } 14574 skipAtoms(sel) { 14575 let ranges = null; 14576 for (let i2 = 0; i2 < sel.ranges.length; i2++) { 14577 let range = sel.ranges[i2], updated = null; 14578 if (range.empty) { 14579 let pos = skipAtomicRanges(this.atoms, range.from, 0); 14580 if (pos != range.from) 14581 updated = EditorSelection.cursor(pos, -1); 14582 } else { 14583 let from = skipAtomicRanges(this.atoms, range.from, -1); 14584 let to = skipAtomicRanges(this.atoms, range.to, 1); 14585 if (from != range.from || to != range.to) 14586 updated = EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to); 14587 } 14588 if (updated) { 14589 if (!ranges) 14590 ranges = sel.ranges.slice(); 14591 ranges[i2] = updated; 14592 } 14593 } 14594 return ranges ? EditorSelection.create(ranges, sel.mainIndex) : sel; 14595 } 14596 select(event) { 14597 let { view } = this, selection = this.skipAtoms(this.style.get(event, this.extend, this.multiple)); 14598 if (this.mustSelect || !selection.eq(view.state.selection) || selection.main.assoc != view.state.selection.main.assoc && this.dragging === false) 14599 this.view.dispatch({ 14600 selection, 14601 userEvent: "select.pointer" 14602 }); 14603 this.mustSelect = false; 14604 } 14605 update(update) { 14606 if (this.style.update(update)) 14607 setTimeout(() => this.select(this.lastEvent), 20); 14608 } 14609}; 14610function addsSelectionRange(view, event) { 14611 let facet = view.state.facet(clickAddsSelectionRange); 14612 return facet.length ? facet[0](event) : browser.mac ? event.metaKey : event.ctrlKey; 14613} 14614function dragMovesSelection(view, event) { 14615 let facet = view.state.facet(dragMovesSelection$1); 14616 return facet.length ? facet[0](event) : browser.mac ? !event.altKey : !event.ctrlKey; 14617} 14618function isInPrimarySelection(view, event) { 14619 let { main } = view.state.selection; 14620 if (main.empty) 14621 return false; 14622 let sel = getSelection(view.root); 14623 if (!sel || sel.rangeCount == 0) 14624 return true; 14625 let rects = sel.getRangeAt(0).getClientRects(); 14626 for (let i2 = 0; i2 < rects.length; i2++) { 14627 let rect = rects[i2]; 14628 if (rect.left <= event.clientX && rect.right >= event.clientX && rect.top <= event.clientY && rect.bottom >= event.clientY) 14629 return true; 14630 } 14631 return false; 14632} 14633function eventBelongsToEditor(view, event) { 14634 if (!event.bubbles) 14635 return true; 14636 if (event.defaultPrevented) 14637 return false; 14638 for (let node = event.target, cView; node != view.contentDOM; node = node.parentNode) 14639 if (!node || node.nodeType == 11 || (cView = ContentView.get(node)) && cView.ignoreEvent(event)) 14640 return false; 14641 return true; 14642} 14643var handlers = /* @__PURE__ */ Object.create(null); 14644var observers = /* @__PURE__ */ Object.create(null); 14645var brokenClipboardAPI = browser.ie && browser.ie_version < 15 || browser.ios && browser.webkit_version < 604; 14646function capturePaste(view) { 14647 let parent = view.dom.parentNode; 14648 if (!parent) 14649 return; 14650 let target = parent.appendChild(document.createElement("textarea")); 14651 target.style.cssText = "position: fixed; left: -10000px; top: 10px"; 14652 target.focus(); 14653 setTimeout(() => { 14654 view.focus(); 14655 target.remove(); 14656 doPaste(view, target.value); 14657 }, 50); 14658} 14659function doPaste(view, input) { 14660 let { state } = view, changes, i2 = 1, text = state.toText(input); 14661 let byLine = text.lines == state.selection.ranges.length; 14662 let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r2) => r2.empty) && lastLinewiseCopy == text.toString(); 14663 if (linewise) { 14664 let lastLine = -1; 14665 changes = state.changeByRange((range) => { 14666 let line = state.doc.lineAt(range.from); 14667 if (line.from == lastLine) 14668 return { range }; 14669 lastLine = line.from; 14670 let insert2 = state.toText((byLine ? text.line(i2++).text : input) + state.lineBreak); 14671 return { 14672 changes: { from: line.from, insert: insert2 }, 14673 range: EditorSelection.cursor(range.from + insert2.length) 14674 }; 14675 }); 14676 } else if (byLine) { 14677 changes = state.changeByRange((range) => { 14678 let line = text.line(i2++); 14679 return { 14680 changes: { from: range.from, to: range.to, insert: line.text }, 14681 range: EditorSelection.cursor(range.from + line.length) 14682 }; 14683 }); 14684 } else { 14685 changes = state.replaceSelection(text); 14686 } 14687 view.dispatch(changes, { 14688 userEvent: "input.paste", 14689 scrollIntoView: true 14690 }); 14691} 14692observers.scroll = (view) => { 14693 view.inputState.lastScrollTop = view.scrollDOM.scrollTop; 14694 view.inputState.lastScrollLeft = view.scrollDOM.scrollLeft; 14695}; 14696handlers.keydown = (view, event) => { 14697 view.inputState.setSelectionOrigin("select"); 14698 if (event.keyCode == 27) 14699 view.inputState.lastEscPress = Date.now(); 14700 return false; 14701}; 14702observers.touchstart = (view, e2) => { 14703 view.inputState.lastTouchTime = Date.now(); 14704 view.inputState.setSelectionOrigin("select.pointer"); 14705}; 14706observers.touchmove = (view) => { 14707 view.inputState.setSelectionOrigin("select.pointer"); 14708}; 14709handlers.mousedown = (view, event) => { 14710 view.observer.flush(); 14711 if (view.inputState.lastTouchTime > Date.now() - 2e3) 14712 return false; 14713 let style = null; 14714 for (let makeStyle of view.state.facet(mouseSelectionStyle)) { 14715 style = makeStyle(view, event); 14716 if (style) 14717 break; 14718 } 14719 if (!style && event.button == 0) 14720 style = basicMouseSelection(view, event); 14721 if (style) { 14722 let mustFocus = !view.hasFocus; 14723 view.inputState.startMouseSelection(new MouseSelection(view, event, style, mustFocus)); 14724 if (mustFocus) 14725 view.observer.ignore(() => focusPreventScroll(view.contentDOM)); 14726 let mouseSel = view.inputState.mouseSelection; 14727 if (mouseSel) { 14728 mouseSel.start(event); 14729 return mouseSel.dragging === false; 14730 } 14731 } 14732 return false; 14733}; 14734function rangeForClick(view, pos, bias, type) { 14735 if (type == 1) { 14736 return EditorSelection.cursor(pos, bias); 14737 } else if (type == 2) { 14738 return groupAt(view.state, pos, bias); 14739 } else { 14740 let visual = LineView.find(view.docView, pos), line = view.state.doc.lineAt(visual ? visual.posAtEnd : pos); 14741 let from = visual ? visual.posAtStart : line.from, to = visual ? visual.posAtEnd : line.to; 14742 if (to < view.state.doc.length && to == line.to) 14743 to++; 14744 return EditorSelection.range(from, to); 14745 } 14746} 14747var insideY = (y2, rect) => y2 >= rect.top && y2 <= rect.bottom; 14748var inside = (x, y2, rect) => insideY(y2, rect) && x >= rect.left && x <= rect.right; 14749function findPositionSide(view, pos, x, y2) { 14750 let line = LineView.find(view.docView, pos); 14751 if (!line) 14752 return 1; 14753 let off = pos - line.posAtStart; 14754 if (off == 0) 14755 return 1; 14756 if (off == line.length) 14757 return -1; 14758 let before = line.coordsAt(off, -1); 14759 if (before && inside(x, y2, before)) 14760 return -1; 14761 let after = line.coordsAt(off, 1); 14762 if (after && inside(x, y2, after)) 14763 return 1; 14764 return before && insideY(y2, before) ? -1 : 1; 14765} 14766function queryPos(view, event) { 14767 let pos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false); 14768 return { pos, bias: findPositionSide(view, pos, event.clientX, event.clientY) }; 14769} 14770var BadMouseDetail = browser.ie && browser.ie_version <= 11; 14771var lastMouseDown = null; 14772var lastMouseDownCount = 0; 14773var lastMouseDownTime = 0; 14774function getClickType(event) { 14775 if (!BadMouseDetail) 14776 return event.detail; 14777 let last = lastMouseDown, lastTime = lastMouseDownTime; 14778 lastMouseDown = event; 14779 lastMouseDownTime = Date.now(); 14780 return lastMouseDownCount = !last || lastTime > Date.now() - 400 && Math.abs(last.clientX - event.clientX) < 2 && Math.abs(last.clientY - event.clientY) < 2 ? (lastMouseDownCount + 1) % 3 : 1; 14781} 14782function basicMouseSelection(view, event) { 14783 let start = queryPos(view, event), type = getClickType(event); 14784 let startSel = view.state.selection; 14785 return { 14786 update(update) { 14787 if (update.docChanged) { 14788 start.pos = update.changes.mapPos(start.pos); 14789 startSel = startSel.map(update.changes); 14790 } 14791 }, 14792 get(event2, extend2, multiple) { 14793 let cur2 = queryPos(view, event2), removed; 14794 let range = rangeForClick(view, cur2.pos, cur2.bias, type); 14795 if (start.pos != cur2.pos && !extend2) { 14796 let startRange = rangeForClick(view, start.pos, start.bias, type); 14797 let from = Math.min(startRange.from, range.from), to = Math.max(startRange.to, range.to); 14798 range = from < range.from ? EditorSelection.range(from, to) : EditorSelection.range(to, from); 14799 } 14800 if (extend2) 14801 return startSel.replaceRange(startSel.main.extend(range.from, range.to)); 14802 else if (multiple && type == 1 && startSel.ranges.length > 1 && (removed = removeRangeAround(startSel, cur2.pos))) 14803 return removed; 14804 else if (multiple) 14805 return startSel.addRange(range); 14806 else 14807 return EditorSelection.create([range]); 14808 } 14809 }; 14810} 14811function removeRangeAround(sel, pos) { 14812 for (let i2 = 0; i2 < sel.ranges.length; i2++) { 14813 let { from, to } = sel.ranges[i2]; 14814 if (from <= pos && to >= pos) 14815 return EditorSelection.create(sel.ranges.slice(0, i2).concat(sel.ranges.slice(i2 + 1)), sel.mainIndex == i2 ? 0 : sel.mainIndex - (sel.mainIndex > i2 ? 1 : 0)); 14816 } 14817 return null; 14818} 14819handlers.dragstart = (view, event) => { 14820 let { selection: { main: range } } = view.state; 14821 if (event.target.draggable) { 14822 let cView = view.docView.nearest(event.target); 14823 if (cView && cView.isWidget) { 14824 let from = cView.posAtStart, to = from + cView.length; 14825 if (from >= range.to || to <= range.from) 14826 range = EditorSelection.range(from, to); 14827 } 14828 } 14829 let { inputState } = view; 14830 if (inputState.mouseSelection) 14831 inputState.mouseSelection.dragging = true; 14832 inputState.draggedContent = range; 14833 if (event.dataTransfer) { 14834 event.dataTransfer.setData("Text", view.state.sliceDoc(range.from, range.to)); 14835 event.dataTransfer.effectAllowed = "copyMove"; 14836 } 14837 return false; 14838}; 14839handlers.dragend = (view) => { 14840 view.inputState.draggedContent = null; 14841 return false; 14842}; 14843function dropText(view, event, text, direct) { 14844 if (!text) 14845 return; 14846 let dropPos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false); 14847 let { draggedContent } = view.inputState; 14848 let del = direct && draggedContent && dragMovesSelection(view, event) ? { from: draggedContent.from, to: draggedContent.to } : null; 14849 let ins = { from: dropPos, insert: text }; 14850 let changes = view.state.changes(del ? [del, ins] : ins); 14851 view.focus(); 14852 view.dispatch({ 14853 changes, 14854 selection: { anchor: changes.mapPos(dropPos, -1), head: changes.mapPos(dropPos, 1) }, 14855 userEvent: del ? "move.drop" : "input.drop" 14856 }); 14857 view.inputState.draggedContent = null; 14858} 14859handlers.drop = (view, event) => { 14860 if (!event.dataTransfer) 14861 return false; 14862 if (view.state.readOnly) 14863 return true; 14864 let files = event.dataTransfer.files; 14865 if (files && files.length) { 14866 let text = Array(files.length), read = 0; 14867 let finishFile = () => { 14868 if (++read == files.length) 14869 dropText(view, event, text.filter((s2) => s2 != null).join(view.state.lineBreak), false); 14870 }; 14871 for (let i2 = 0; i2 < files.length; i2++) { 14872 let reader = new FileReader(); 14873 reader.onerror = finishFile; 14874 reader.onload = () => { 14875 if (!/[\x00-\x08\x0e-\x1f]{2}/.test(reader.result)) 14876 text[i2] = reader.result; 14877 finishFile(); 14878 }; 14879 reader.readAsText(files[i2]); 14880 } 14881 return true; 14882 } else { 14883 let text = event.dataTransfer.getData("Text"); 14884 if (text) { 14885 dropText(view, event, text, true); 14886 return true; 14887 } 14888 } 14889 return false; 14890}; 14891handlers.paste = (view, event) => { 14892 if (view.state.readOnly) 14893 return true; 14894 view.observer.flush(); 14895 let data = brokenClipboardAPI ? null : event.clipboardData; 14896 if (data) { 14897 doPaste(view, data.getData("text/plain") || data.getData("text/uri-text")); 14898 return true; 14899 } else { 14900 capturePaste(view); 14901 return false; 14902 } 14903}; 14904function captureCopy(view, text) { 14905 let parent = view.dom.parentNode; 14906 if (!parent) 14907 return; 14908 let target = parent.appendChild(document.createElement("textarea")); 14909 target.style.cssText = "position: fixed; left: -10000px; top: 10px"; 14910 target.value = text; 14911 target.focus(); 14912 target.selectionEnd = text.length; 14913 target.selectionStart = 0; 14914 setTimeout(() => { 14915 target.remove(); 14916 view.focus(); 14917 }, 50); 14918} 14919function copiedRange(state) { 14920 let content2 = [], ranges = [], linewise = false; 14921 for (let range of state.selection.ranges) 14922 if (!range.empty) { 14923 content2.push(state.sliceDoc(range.from, range.to)); 14924 ranges.push(range); 14925 } 14926 if (!content2.length) { 14927 let upto = -1; 14928 for (let { from } of state.selection.ranges) { 14929 let line = state.doc.lineAt(from); 14930 if (line.number > upto) { 14931 content2.push(line.text); 14932 ranges.push({ from: line.from, to: Math.min(state.doc.length, line.to + 1) }); 14933 } 14934 upto = line.number; 14935 } 14936 linewise = true; 14937 } 14938 return { text: content2.join(state.lineBreak), ranges, linewise }; 14939} 14940var lastLinewiseCopy = null; 14941handlers.copy = handlers.cut = (view, event) => { 14942 let { text, ranges, linewise } = copiedRange(view.state); 14943 if (!text && !linewise) 14944 return false; 14945 lastLinewiseCopy = linewise ? text : null; 14946 if (event.type == "cut" && !view.state.readOnly) 14947 view.dispatch({ 14948 changes: ranges, 14949 scrollIntoView: true, 14950 userEvent: "delete.cut" 14951 }); 14952 let data = brokenClipboardAPI ? null : event.clipboardData; 14953 if (data) { 14954 data.clearData(); 14955 data.setData("text/plain", text); 14956 return true; 14957 } else { 14958 captureCopy(view, text); 14959 return false; 14960 } 14961}; 14962var isFocusChange = /* @__PURE__ */ Annotation.define(); 14963function focusChangeTransaction(state, focus) { 14964 let effects = []; 14965 for (let getEffect of state.facet(focusChangeEffect)) { 14966 let effect = getEffect(state, focus); 14967 if (effect) 14968 effects.push(effect); 14969 } 14970 return effects ? state.update({ effects, annotations: isFocusChange.of(true) }) : null; 14971} 14972function updateForFocusChange(view) { 14973 setTimeout(() => { 14974 let focus = view.hasFocus; 14975 if (focus != view.inputState.notifiedFocused) { 14976 let tr = focusChangeTransaction(view.state, focus); 14977 if (tr) 14978 view.dispatch(tr); 14979 else 14980 view.update([]); 14981 } 14982 }, 10); 14983} 14984observers.focus = (view) => { 14985 view.inputState.lastFocusTime = Date.now(); 14986 if (!view.scrollDOM.scrollTop && (view.inputState.lastScrollTop || view.inputState.lastScrollLeft)) { 14987 view.scrollDOM.scrollTop = view.inputState.lastScrollTop; 14988 view.scrollDOM.scrollLeft = view.inputState.lastScrollLeft; 14989 } 14990 updateForFocusChange(view); 14991}; 14992observers.blur = (view) => { 14993 view.observer.clearSelectionRange(); 14994 updateForFocusChange(view); 14995}; 14996observers.compositionstart = observers.compositionupdate = (view) => { 14997 if (view.inputState.compositionFirstChange == null) 14998 view.inputState.compositionFirstChange = true; 14999 if (view.inputState.composing < 0) { 15000 view.inputState.composing = 0; 15001 } 15002}; 15003observers.compositionend = (view) => { 15004 view.inputState.composing = -1; 15005 view.inputState.compositionEndedAt = Date.now(); 15006 view.inputState.compositionPendingKey = true; 15007 view.inputState.compositionPendingChange = view.observer.pendingRecords().length > 0; 15008 view.inputState.compositionFirstChange = null; 15009 if (browser.chrome && browser.android) { 15010 view.observer.flushSoon(); 15011 } else if (view.inputState.compositionPendingChange) { 15012 Promise.resolve().then(() => view.observer.flush()); 15013 } else { 15014 setTimeout(() => { 15015 if (view.inputState.composing < 0 && view.docView.hasComposition) 15016 view.update([]); 15017 }, 50); 15018 } 15019}; 15020observers.contextmenu = (view) => { 15021 view.inputState.lastContextMenu = Date.now(); 15022}; 15023handlers.beforeinput = (view, event) => { 15024 var _a3; 15025 let pending; 15026 if (browser.chrome && browser.android && (pending = PendingKeys.find((key) => key.inputType == event.inputType))) { 15027 view.observer.delayAndroidKey(pending.key, pending.keyCode); 15028 if (pending.key == "Backspace" || pending.key == "Delete") { 15029 let startViewHeight = ((_a3 = window.visualViewport) === null || _a3 === void 0 ? void 0 : _a3.height) || 0; 15030 setTimeout(() => { 15031 var _a4; 15032 if ((((_a4 = window.visualViewport) === null || _a4 === void 0 ? void 0 : _a4.height) || 0) > startViewHeight + 10 && view.hasFocus) { 15033 view.contentDOM.blur(); 15034 view.focus(); 15035 } 15036 }, 100); 15037 } 15038 } 15039 return false; 15040}; 15041var appliedFirefoxHack = /* @__PURE__ */ new Set(); 15042function firefoxCopyCutHack(doc2) { 15043 if (!appliedFirefoxHack.has(doc2)) { 15044 appliedFirefoxHack.add(doc2); 15045 doc2.addEventListener("copy", () => { 15046 }); 15047 doc2.addEventListener("cut", () => { 15048 }); 15049 } 15050} 15051var wrappingWhiteSpace = ["pre-wrap", "normal", "pre-line", "break-spaces"]; 15052var HeightOracle = class { 15053 constructor(lineWrapping) { 15054 this.lineWrapping = lineWrapping; 15055 this.doc = Text2.empty; 15056 this.heightSamples = {}; 15057 this.lineHeight = 14; 15058 this.charWidth = 7; 15059 this.textHeight = 14; 15060 this.lineLength = 30; 15061 this.heightChanged = false; 15062 } 15063 heightForGap(from, to) { 15064 let lines = this.doc.lineAt(to).number - this.doc.lineAt(from).number + 1; 15065 if (this.lineWrapping) 15066 lines += Math.max(0, Math.ceil((to - from - lines * this.lineLength * 0.5) / this.lineLength)); 15067 return this.lineHeight * lines; 15068 } 15069 heightForLine(length) { 15070 if (!this.lineWrapping) 15071 return this.lineHeight; 15072 let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5))); 15073 return lines * this.lineHeight; 15074 } 15075 setDoc(doc2) { 15076 this.doc = doc2; 15077 return this; 15078 } 15079 mustRefreshForWrapping(whiteSpace) { 15080 return wrappingWhiteSpace.indexOf(whiteSpace) > -1 != this.lineWrapping; 15081 } 15082 mustRefreshForHeights(lineHeights) { 15083 let newHeight = false; 15084 for (let i2 = 0; i2 < lineHeights.length; i2++) { 15085 let h3 = lineHeights[i2]; 15086 if (h3 < 0) { 15087 i2++; 15088 } else if (!this.heightSamples[Math.floor(h3 * 10)]) { 15089 newHeight = true; 15090 this.heightSamples[Math.floor(h3 * 10)] = true; 15091 } 15092 } 15093 return newHeight; 15094 } 15095 refresh(whiteSpace, lineHeight, charWidth, textHeight, lineLength, knownHeights) { 15096 let lineWrapping = wrappingWhiteSpace.indexOf(whiteSpace) > -1; 15097 let changed = Math.round(lineHeight) != Math.round(this.lineHeight) || this.lineWrapping != lineWrapping; 15098 this.lineWrapping = lineWrapping; 15099 this.lineHeight = lineHeight; 15100 this.charWidth = charWidth; 15101 this.textHeight = textHeight; 15102 this.lineLength = lineLength; 15103 if (changed) { 15104 this.heightSamples = {}; 15105 for (let i2 = 0; i2 < knownHeights.length; i2++) { 15106 let h3 = knownHeights[i2]; 15107 if (h3 < 0) 15108 i2++; 15109 else 15110 this.heightSamples[Math.floor(h3 * 10)] = true; 15111 } 15112 } 15113 return changed; 15114 } 15115}; 15116var MeasuredHeights = class { 15117 constructor(from, heights) { 15118 this.from = from; 15119 this.heights = heights; 15120 this.index = 0; 15121 } 15122 get more() { 15123 return this.index < this.heights.length; 15124 } 15125}; 15126var BlockInfo = class _BlockInfo { 15127 /** 15128 @internal 15129 */ 15130 constructor(from, length, top2, height, _content) { 15131 this.from = from; 15132 this.length = length; 15133 this.top = top2; 15134 this.height = height; 15135 this._content = _content; 15136 } 15137 /** 15138 The type of element this is. When querying lines, this may be 15139 an array of all the blocks that make up the line. 15140 */ 15141 get type() { 15142 return typeof this._content == "number" ? BlockType.Text : Array.isArray(this._content) ? this._content : this._content.type; 15143 } 15144 /** 15145 The end of the element as a document position. 15146 */ 15147 get to() { 15148 return this.from + this.length; 15149 } 15150 /** 15151 The bottom position of the element. 15152 */ 15153 get bottom() { 15154 return this.top + this.height; 15155 } 15156 /** 15157 If this is a widget block, this will return the widget 15158 associated with it. 15159 */ 15160 get widget() { 15161 return this._content instanceof PointDecoration ? this._content.widget : null; 15162 } 15163 /** 15164 If this is a textblock, this holds the number of line breaks 15165 that appear in widgets inside the block. 15166 */ 15167 get widgetLineBreaks() { 15168 return typeof this._content == "number" ? this._content : 0; 15169 } 15170 /** 15171 @internal 15172 */ 15173 join(other) { 15174 let content2 = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(other._content) ? other._content : [other]); 15175 return new _BlockInfo(this.from, this.length + other.length, this.top, this.height + other.height, content2); 15176 } 15177}; 15178var QueryType = /* @__PURE__ */ function(QueryType3) { 15179 QueryType3[QueryType3["ByPos"] = 0] = "ByPos"; 15180 QueryType3[QueryType3["ByHeight"] = 1] = "ByHeight"; 15181 QueryType3[QueryType3["ByPosNoHeight"] = 2] = "ByPosNoHeight"; 15182 return QueryType3; 15183}(QueryType || (QueryType = {})); 15184var Epsilon = 1e-3; 15185var HeightMap = class _HeightMap { 15186 constructor(length, height, flags = 2) { 15187 this.length = length; 15188 this.height = height; 15189 this.flags = flags; 15190 } 15191 get outdated() { 15192 return (this.flags & 2) > 0; 15193 } 15194 set outdated(value) { 15195 this.flags = (value ? 2 : 0) | this.flags & ~2; 15196 } 15197 setHeight(oracle, height) { 15198 if (this.height != height) { 15199 if (Math.abs(this.height - height) > Epsilon) 15200 oracle.heightChanged = true; 15201 this.height = height; 15202 } 15203 } 15204 // Base case is to replace a leaf node, which simply builds a tree 15205 // from the new nodes and returns that (HeightMapBranch and 15206 // HeightMapGap override this to actually use from/to) 15207 replace(_from, _to, nodes) { 15208 return _HeightMap.of(nodes); 15209 } 15210 // Again, these are base cases, and are overridden for branch and gap nodes. 15211 decomposeLeft(_to, result) { 15212 result.push(this); 15213 } 15214 decomposeRight(_from, result) { 15215 result.push(this); 15216 } 15217 applyChanges(decorations2, oldDoc, oracle, changes) { 15218 let me = this, doc2 = oracle.doc; 15219 for (let i2 = changes.length - 1; i2 >= 0; i2--) { 15220 let { fromA, toA, fromB, toB } = changes[i2]; 15221 let start = me.lineAt(fromA, QueryType.ByPosNoHeight, oracle.setDoc(oldDoc), 0, 0); 15222 let end = start.to >= toA ? start : me.lineAt(toA, QueryType.ByPosNoHeight, oracle, 0, 0); 15223 toB += end.to - toA; 15224 toA = end.to; 15225 while (i2 > 0 && start.from <= changes[i2 - 1].toA) { 15226 fromA = changes[i2 - 1].fromA; 15227 fromB = changes[i2 - 1].fromB; 15228 i2--; 15229 if (fromA < start.from) 15230 start = me.lineAt(fromA, QueryType.ByPosNoHeight, oracle, 0, 0); 15231 } 15232 fromB += start.from - fromA; 15233 fromA = start.from; 15234 let nodes = NodeBuilder.build(oracle.setDoc(doc2), decorations2, fromB, toB); 15235 me = me.replace(fromA, toA, nodes); 15236 } 15237 return me.updateHeight(oracle, 0); 15238 } 15239 static empty() { 15240 return new HeightMapText(0, 0); 15241 } 15242 // nodes uses null values to indicate the position of line breaks. 15243 // There are never line breaks at the start or end of the array, or 15244 // two line breaks next to each other, and the array isn't allowed 15245 // to be empty (same restrictions as return value from the builder). 15246 static of(nodes) { 15247 if (nodes.length == 1) 15248 return nodes[0]; 15249 let i2 = 0, j3 = nodes.length, before = 0, after = 0; 15250 for (; ; ) { 15251 if (i2 == j3) { 15252 if (before > after * 2) { 15253 let split = nodes[i2 - 1]; 15254 if (split.break) 15255 nodes.splice(--i2, 1, split.left, null, split.right); 15256 else 15257 nodes.splice(--i2, 1, split.left, split.right); 15258 j3 += 1 + split.break; 15259 before -= split.size; 15260 } else if (after > before * 2) { 15261 let split = nodes[j3]; 15262 if (split.break) 15263 nodes.splice(j3, 1, split.left, null, split.right); 15264 else 15265 nodes.splice(j3, 1, split.left, split.right); 15266 j3 += 2 + split.break; 15267 after -= split.size; 15268 } else { 15269 break; 15270 } 15271 } else if (before < after) { 15272 let next = nodes[i2++]; 15273 if (next) 15274 before += next.size; 15275 } else { 15276 let next = nodes[--j3]; 15277 if (next) 15278 after += next.size; 15279 } 15280 } 15281 let brk = 0; 15282 if (nodes[i2 - 1] == null) { 15283 brk = 1; 15284 i2--; 15285 } else if (nodes[i2] == null) { 15286 brk = 1; 15287 j3++; 15288 } 15289 return new HeightMapBranch(_HeightMap.of(nodes.slice(0, i2)), brk, _HeightMap.of(nodes.slice(j3))); 15290 } 15291}; 15292HeightMap.prototype.size = 1; 15293var HeightMapBlock = class extends HeightMap { 15294 constructor(length, height, deco) { 15295 super(length, height); 15296 this.deco = deco; 15297 } 15298 blockAt(_height, _oracle, top2, offset) { 15299 return new BlockInfo(offset, this.length, top2, this.height, this.deco || 0); 15300 } 15301 lineAt(_value, _type, oracle, top2, offset) { 15302 return this.blockAt(0, oracle, top2, offset); 15303 } 15304 forEachLine(from, to, oracle, top2, offset, f3) { 15305 if (from <= offset + this.length && to >= offset) 15306 f3(this.blockAt(0, oracle, top2, offset)); 15307 } 15308 updateHeight(oracle, offset = 0, _force = false, measured) { 15309 if (measured && measured.from <= offset && measured.more) 15310 this.setHeight(oracle, measured.heights[measured.index++]); 15311 this.outdated = false; 15312 return this; 15313 } 15314 toString() { 15315 return `block(${this.length})`; 15316 } 15317}; 15318var HeightMapText = class _HeightMapText extends HeightMapBlock { 15319 constructor(length, height) { 15320 super(length, height, null); 15321 this.collapsed = 0; 15322 this.widgetHeight = 0; 15323 this.breaks = 0; 15324 } 15325 blockAt(_height, _oracle, top2, offset) { 15326 return new BlockInfo(offset, this.length, top2, this.height, this.breaks); 15327 } 15328 replace(_from, _to, nodes) { 15329 let node = nodes[0]; 15330 if (nodes.length == 1 && (node instanceof _HeightMapText || node instanceof HeightMapGap && node.flags & 4) && Math.abs(this.length - node.length) < 10) { 15331 if (node instanceof HeightMapGap) 15332 node = new _HeightMapText(node.length, this.height); 15333 else 15334 node.height = this.height; 15335 if (!this.outdated) 15336 node.outdated = false; 15337 return node; 15338 } else { 15339 return HeightMap.of(nodes); 15340 } 15341 } 15342 updateHeight(oracle, offset = 0, force = false, measured) { 15343 if (measured && measured.from <= offset && measured.more) 15344 this.setHeight(oracle, measured.heights[measured.index++]); 15345 else if (force || this.outdated) 15346 this.setHeight(oracle, Math.max(this.widgetHeight, oracle.heightForLine(this.length - this.collapsed)) + this.breaks * oracle.lineHeight); 15347 this.outdated = false; 15348 return this; 15349 } 15350 toString() { 15351 return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`; 15352 } 15353}; 15354var HeightMapGap = class _HeightMapGap extends HeightMap { 15355 constructor(length) { 15356 super(length, 0); 15357 } 15358 heightMetrics(oracle, offset) { 15359 let firstLine = oracle.doc.lineAt(offset).number, lastLine = oracle.doc.lineAt(offset + this.length).number; 15360 let lines = lastLine - firstLine + 1; 15361 let perLine, perChar = 0; 15362 if (oracle.lineWrapping) { 15363 let totalPerLine = Math.min(this.height, oracle.lineHeight * lines); 15364 perLine = totalPerLine / lines; 15365 if (this.length > lines + 1) 15366 perChar = (this.height - totalPerLine) / (this.length - lines - 1); 15367 } else { 15368 perLine = this.height / lines; 15369 } 15370 return { firstLine, lastLine, perLine, perChar }; 15371 } 15372 blockAt(height, oracle, top2, offset) { 15373 let { firstLine, lastLine, perLine, perChar } = this.heightMetrics(oracle, offset); 15374 if (oracle.lineWrapping) { 15375 let guess = offset + Math.round(Math.max(0, Math.min(1, (height - top2) / this.height)) * this.length); 15376 let line = oracle.doc.lineAt(guess), lineHeight = perLine + line.length * perChar; 15377 let lineTop = Math.max(top2, height - lineHeight / 2); 15378 return new BlockInfo(line.from, line.length, lineTop, lineHeight, 0); 15379 } else { 15380 let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top2) / perLine))); 15381 let { from, length } = oracle.doc.line(firstLine + line); 15382 return new BlockInfo(from, length, top2 + perLine * line, perLine, 0); 15383 } 15384 } 15385 lineAt(value, type, oracle, top2, offset) { 15386 if (type == QueryType.ByHeight) 15387 return this.blockAt(value, oracle, top2, offset); 15388 if (type == QueryType.ByPosNoHeight) { 15389 let { from, to } = oracle.doc.lineAt(value); 15390 return new BlockInfo(from, to - from, 0, 0, 0); 15391 } 15392 let { firstLine, perLine, perChar } = this.heightMetrics(oracle, offset); 15393 let line = oracle.doc.lineAt(value), lineHeight = perLine + line.length * perChar; 15394 let linesAbove = line.number - firstLine; 15395 let lineTop = top2 + perLine * linesAbove + perChar * (line.from - offset - linesAbove); 15396 return new BlockInfo(line.from, line.length, Math.max(top2, Math.min(lineTop, top2 + this.height - lineHeight)), lineHeight, 0); 15397 } 15398 forEachLine(from, to, oracle, top2, offset, f3) { 15399 from = Math.max(from, offset); 15400 to = Math.min(to, offset + this.length); 15401 let { firstLine, perLine, perChar } = this.heightMetrics(oracle, offset); 15402 for (let pos = from, lineTop = top2; pos <= to; ) { 15403 let line = oracle.doc.lineAt(pos); 15404 if (pos == from) { 15405 let linesAbove = line.number - firstLine; 15406 lineTop += perLine * linesAbove + perChar * (from - offset - linesAbove); 15407 } 15408 let lineHeight = perLine + perChar * line.length; 15409 f3(new BlockInfo(line.from, line.length, lineTop, lineHeight, 0)); 15410 lineTop += lineHeight; 15411 pos = line.to + 1; 15412 } 15413 } 15414 replace(from, to, nodes) { 15415 let after = this.length - to; 15416 if (after > 0) { 15417 let last = nodes[nodes.length - 1]; 15418 if (last instanceof _HeightMapGap) 15419 nodes[nodes.length - 1] = new _HeightMapGap(last.length + after); 15420 else 15421 nodes.push(null, new _HeightMapGap(after - 1)); 15422 } 15423 if (from > 0) { 15424 let first = nodes[0]; 15425 if (first instanceof _HeightMapGap) 15426 nodes[0] = new _HeightMapGap(from + first.length); 15427 else 15428 nodes.unshift(new _HeightMapGap(from - 1), null); 15429 } 15430 return HeightMap.of(nodes); 15431 } 15432 decomposeLeft(to, result) { 15433 result.push(new _HeightMapGap(to - 1), null); 15434 } 15435 decomposeRight(from, result) { 15436 result.push(null, new _HeightMapGap(this.length - from - 1)); 15437 } 15438 updateHeight(oracle, offset = 0, force = false, measured) { 15439 let end = offset + this.length; 15440 if (measured && measured.from <= offset + this.length && measured.more) { 15441 let nodes = [], pos = Math.max(offset, measured.from), singleHeight = -1; 15442 if (measured.from > offset) 15443 nodes.push(new _HeightMapGap(measured.from - offset - 1).updateHeight(oracle, offset)); 15444 while (pos <= end && measured.more) { 15445 let len = oracle.doc.lineAt(pos).length; 15446 if (nodes.length) 15447 nodes.push(null); 15448 let height = measured.heights[measured.index++]; 15449 if (singleHeight == -1) 15450 singleHeight = height; 15451 else if (Math.abs(height - singleHeight) >= Epsilon) 15452 singleHeight = -2; 15453 let line = new HeightMapText(len, height); 15454 line.outdated = false; 15455 nodes.push(line); 15456 pos += len + 1; 15457 } 15458 if (pos <= end) 15459 nodes.push(null, new _HeightMapGap(end - pos).updateHeight(oracle, pos)); 15460 let result = HeightMap.of(nodes); 15461 if (singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon || Math.abs(singleHeight - this.heightMetrics(oracle, offset).perLine) >= Epsilon) 15462 oracle.heightChanged = true; 15463 return result; 15464 } else if (force || this.outdated) { 15465 this.setHeight(oracle, oracle.heightForGap(offset, offset + this.length)); 15466 this.outdated = false; 15467 } 15468 return this; 15469 } 15470 toString() { 15471 return `gap(${this.length})`; 15472 } 15473}; 15474var HeightMapBranch = class extends HeightMap { 15475 constructor(left, brk, right) { 15476 super(left.length + brk + right.length, left.height + right.height, brk | (left.outdated || right.outdated ? 2 : 0)); 15477 this.left = left; 15478 this.right = right; 15479 this.size = left.size + right.size; 15480 } 15481 get break() { 15482 return this.flags & 1; 15483 } 15484 blockAt(height, oracle, top2, offset) { 15485 let mid = top2 + this.left.height; 15486 return height < mid ? this.left.blockAt(height, oracle, top2, offset) : this.right.blockAt(height, oracle, mid, offset + this.left.length + this.break); 15487 } 15488 lineAt(value, type, oracle, top2, offset) { 15489 let rightTop = top2 + this.left.height, rightOffset = offset + this.left.length + this.break; 15490 let left = type == QueryType.ByHeight ? value < rightTop : value < rightOffset; 15491 let base2 = left ? this.left.lineAt(value, type, oracle, top2, offset) : this.right.lineAt(value, type, oracle, rightTop, rightOffset); 15492 if (this.break || (left ? base2.to < rightOffset : base2.from > rightOffset)) 15493 return base2; 15494 let subQuery = type == QueryType.ByPosNoHeight ? QueryType.ByPosNoHeight : QueryType.ByPos; 15495 if (left) 15496 return base2.join(this.right.lineAt(rightOffset, subQuery, oracle, rightTop, rightOffset)); 15497 else 15498 return this.left.lineAt(rightOffset, subQuery, oracle, top2, offset).join(base2); 15499 } 15500 forEachLine(from, to, oracle, top2, offset, f3) { 15501 let rightTop = top2 + this.left.height, rightOffset = offset + this.left.length + this.break; 15502 if (this.break) { 15503 if (from < rightOffset) 15504 this.left.forEachLine(from, to, oracle, top2, offset, f3); 15505 if (to >= rightOffset) 15506 this.right.forEachLine(from, to, oracle, rightTop, rightOffset, f3); 15507 } else { 15508 let mid = this.lineAt(rightOffset, QueryType.ByPos, oracle, top2, offset); 15509 if (from < mid.from) 15510 this.left.forEachLine(from, mid.from - 1, oracle, top2, offset, f3); 15511 if (mid.to >= from && mid.from <= to) 15512 f3(mid); 15513 if (to > mid.to) 15514 this.right.forEachLine(mid.to + 1, to, oracle, rightTop, rightOffset, f3); 15515 } 15516 } 15517 replace(from, to, nodes) { 15518 let rightStart = this.left.length + this.break; 15519 if (to < rightStart) 15520 return this.balanced(this.left.replace(from, to, nodes), this.right); 15521 if (from > this.left.length) 15522 return this.balanced(this.left, this.right.replace(from - rightStart, to - rightStart, nodes)); 15523 let result = []; 15524 if (from > 0) 15525 this.decomposeLeft(from, result); 15526 let left = result.length; 15527 for (let node of nodes) 15528 result.push(node); 15529 if (from > 0) 15530 mergeGaps(result, left - 1); 15531 if (to < this.length) { 15532 let right = result.length; 15533 this.decomposeRight(to, result); 15534 mergeGaps(result, right); 15535 } 15536 return HeightMap.of(result); 15537 } 15538 decomposeLeft(to, result) { 15539 let left = this.left.length; 15540 if (to <= left) 15541 return this.left.decomposeLeft(to, result); 15542 result.push(this.left); 15543 if (this.break) { 15544 left++; 15545 if (to >= left) 15546 result.push(null); 15547 } 15548 if (to > left) 15549 this.right.decomposeLeft(to - left, result); 15550 } 15551 decomposeRight(from, result) { 15552 let left = this.left.length, right = left + this.break; 15553 if (from >= right) 15554 return this.right.decomposeRight(from - right, result); 15555 if (from < left) 15556 this.left.decomposeRight(from, result); 15557 if (this.break && from < right) 15558 result.push(null); 15559 result.push(this.right); 15560 } 15561 balanced(left, right) { 15562 if (left.size > 2 * right.size || right.size > 2 * left.size) 15563 return HeightMap.of(this.break ? [left, null, right] : [left, right]); 15564 this.left = left; 15565 this.right = right; 15566 this.height = left.height + right.height; 15567 this.outdated = left.outdated || right.outdated; 15568 this.size = left.size + right.size; 15569 this.length = left.length + this.break + right.length; 15570 return this; 15571 } 15572 updateHeight(oracle, offset = 0, force = false, measured) { 15573 let { left, right } = this, rightStart = offset + left.length + this.break, rebalance = null; 15574 if (measured && measured.from <= offset + left.length && measured.more) 15575 rebalance = left = left.updateHeight(oracle, offset, force, measured); 15576 else 15577 left.updateHeight(oracle, offset, force); 15578 if (measured && measured.from <= rightStart + right.length && measured.more) 15579 rebalance = right = right.updateHeight(oracle, rightStart, force, measured); 15580 else 15581 right.updateHeight(oracle, rightStart, force); 15582 if (rebalance) 15583 return this.balanced(left, right); 15584 this.height = this.left.height + this.right.height; 15585 this.outdated = false; 15586 return this; 15587 } 15588 toString() { 15589 return this.left + (this.break ? " " : "-") + this.right; 15590 } 15591}; 15592function mergeGaps(nodes, around) { 15593 let before, after; 15594 if (nodes[around] == null && (before = nodes[around - 1]) instanceof HeightMapGap && (after = nodes[around + 1]) instanceof HeightMapGap) 15595 nodes.splice(around - 1, 3, new HeightMapGap(before.length + 1 + after.length)); 15596} 15597var relevantWidgetHeight = 5; 15598var NodeBuilder = class _NodeBuilder { 15599 constructor(pos, oracle) { 15600 this.pos = pos; 15601 this.oracle = oracle; 15602 this.nodes = []; 15603 this.lineStart = -1; 15604 this.lineEnd = -1; 15605 this.covering = null; 15606 this.writtenTo = pos; 15607 } 15608 get isCovered() { 15609 return this.covering && this.nodes[this.nodes.length - 1] == this.covering; 15610 } 15611 span(_from, to) { 15612 if (this.lineStart > -1) { 15613 let end = Math.min(to, this.lineEnd), last = this.nodes[this.nodes.length - 1]; 15614 if (last instanceof HeightMapText) 15615 last.length += end - this.pos; 15616 else if (end > this.pos || !this.isCovered) 15617 this.nodes.push(new HeightMapText(end - this.pos, -1)); 15618 this.writtenTo = end; 15619 if (to > end) { 15620 this.nodes.push(null); 15621 this.writtenTo++; 15622 this.lineStart = -1; 15623 } 15624 } 15625 this.pos = to; 15626 } 15627 point(from, to, deco) { 15628 if (from < to || deco.heightRelevant) { 15629 let height = deco.widget ? deco.widget.estimatedHeight : 0; 15630 let breaks = deco.widget ? deco.widget.lineBreaks : 0; 15631 if (height < 0) 15632 height = this.oracle.lineHeight; 15633 let len = to - from; 15634 if (deco.block) { 15635 this.addBlock(new HeightMapBlock(len, height, deco)); 15636 } else if (len || breaks || height >= relevantWidgetHeight) { 15637 this.addLineDeco(height, breaks, len); 15638 } 15639 } else if (to > from) { 15640 this.span(from, to); 15641 } 15642 if (this.lineEnd > -1 && this.lineEnd < this.pos) 15643 this.lineEnd = this.oracle.doc.lineAt(this.pos).to; 15644 } 15645 enterLine() { 15646 if (this.lineStart > -1) 15647 return; 15648 let { from, to } = this.oracle.doc.lineAt(this.pos); 15649 this.lineStart = from; 15650 this.lineEnd = to; 15651 if (this.writtenTo < from) { 15652 if (this.writtenTo < from - 1 || this.nodes[this.nodes.length - 1] == null) 15653 this.nodes.push(this.blankContent(this.writtenTo, from - 1)); 15654 this.nodes.push(null); 15655 } 15656 if (this.pos > from) 15657 this.nodes.push(new HeightMapText(this.pos - from, -1)); 15658 this.writtenTo = this.pos; 15659 } 15660 blankContent(from, to) { 15661 let gap = new HeightMapGap(to - from); 15662 if (this.oracle.doc.lineAt(from).to == to) 15663 gap.flags |= 4; 15664 return gap; 15665 } 15666 ensureLine() { 15667 this.enterLine(); 15668 let last = this.nodes.length ? this.nodes[this.nodes.length - 1] : null; 15669 if (last instanceof HeightMapText) 15670 return last; 15671 let line = new HeightMapText(0, -1); 15672 this.nodes.push(line); 15673 return line; 15674 } 15675 addBlock(block2) { 15676 this.enterLine(); 15677 let deco = block2.deco; 15678 if (deco && deco.startSide > 0 && !this.isCovered) 15679 this.ensureLine(); 15680 this.nodes.push(block2); 15681 this.writtenTo = this.pos = this.pos + block2.length; 15682 if (deco && deco.endSide > 0) 15683 this.covering = block2; 15684 } 15685 addLineDeco(height, breaks, length) { 15686 let line = this.ensureLine(); 15687 line.length += length; 15688 line.collapsed += length; 15689 line.widgetHeight = Math.max(line.widgetHeight, height); 15690 line.breaks += breaks; 15691 this.writtenTo = this.pos = this.pos + length; 15692 } 15693 finish(from) { 15694 let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1]; 15695 if (this.lineStart > -1 && !(last instanceof HeightMapText) && !this.isCovered) 15696 this.nodes.push(new HeightMapText(0, -1)); 15697 else if (this.writtenTo < this.pos || last == null) 15698 this.nodes.push(this.blankContent(this.writtenTo, this.pos)); 15699 let pos = from; 15700 for (let node of this.nodes) { 15701 if (node instanceof HeightMapText) 15702 node.updateHeight(this.oracle, pos); 15703 pos += node ? node.length : 1; 15704 } 15705 return this.nodes; 15706 } 15707 // Always called with a region that on both sides either stretches 15708 // to a line break or the end of the document. 15709 // The returned array uses null to indicate line breaks, but never 15710 // starts or ends in a line break, or has multiple line breaks next 15711 // to each other. 15712 static build(oracle, decorations2, from, to) { 15713 let builder = new _NodeBuilder(from, oracle); 15714 RangeSet.spans(decorations2, from, to, builder, 0); 15715 return builder.finish(from); 15716 } 15717}; 15718function heightRelevantDecoChanges(a2, b3, diff) { 15719 let comp = new DecorationComparator2(); 15720 RangeSet.compare(a2, b3, diff, comp, 0); 15721 return comp.changes; 15722} 15723var DecorationComparator2 = class { 15724 constructor() { 15725 this.changes = []; 15726 } 15727 compareRange() { 15728 } 15729 comparePoint(from, to, a2, b3) { 15730 if (from < to || a2 && a2.heightRelevant || b3 && b3.heightRelevant) 15731 addRange(from, to, this.changes, 5); 15732 } 15733}; 15734function visiblePixelRange(dom, paddingTop) { 15735 let rect = dom.getBoundingClientRect(); 15736 let doc2 = dom.ownerDocument, win = doc2.defaultView || window; 15737 let left = Math.max(0, rect.left), right = Math.min(win.innerWidth, rect.right); 15738 let top2 = Math.max(0, rect.top), bottom = Math.min(win.innerHeight, rect.bottom); 15739 for (let parent = dom.parentNode; parent && parent != doc2.body; ) { 15740 if (parent.nodeType == 1) { 15741 let elt = parent; 15742 let style = window.getComputedStyle(elt); 15743 if ((elt.scrollHeight > elt.clientHeight || elt.scrollWidth > elt.clientWidth) && style.overflow != "visible") { 15744 let parentRect = elt.getBoundingClientRect(); 15745 left = Math.max(left, parentRect.left); 15746 right = Math.min(right, parentRect.right); 15747 top2 = Math.max(top2, parentRect.top); 15748 bottom = parent == dom.parentNode ? parentRect.bottom : Math.min(bottom, parentRect.bottom); 15749 } 15750 parent = style.position == "absolute" || style.position == "fixed" ? elt.offsetParent : elt.parentNode; 15751 } else if (parent.nodeType == 11) { 15752 parent = parent.host; 15753 } else { 15754 break; 15755 } 15756 } 15757 return { 15758 left: left - rect.left, 15759 right: Math.max(left, right) - rect.left, 15760 top: top2 - (rect.top + paddingTop), 15761 bottom: Math.max(top2, bottom) - (rect.top + paddingTop) 15762 }; 15763} 15764function fullPixelRange(dom, paddingTop) { 15765 let rect = dom.getBoundingClientRect(); 15766 return { 15767 left: 0, 15768 right: rect.right - rect.left, 15769 top: paddingTop, 15770 bottom: rect.bottom - (rect.top + paddingTop) 15771 }; 15772} 15773var LineGap = class { 15774 constructor(from, to, size) { 15775 this.from = from; 15776 this.to = to; 15777 this.size = size; 15778 } 15779 static same(a2, b3) { 15780 if (a2.length != b3.length) 15781 return false; 15782 for (let i2 = 0; i2 < a2.length; i2++) { 15783 let gA = a2[i2], gB = b3[i2]; 15784 if (gA.from != gB.from || gA.to != gB.to || gA.size != gB.size) 15785 return false; 15786 } 15787 return true; 15788 } 15789 draw(viewState, wrapping) { 15790 return Decoration.replace({ 15791 widget: new LineGapWidget(this.size * (wrapping ? viewState.scaleY : viewState.scaleX), wrapping) 15792 }).range(this.from, this.to); 15793 } 15794}; 15795var LineGapWidget = class extends WidgetType { 15796 constructor(size, vertical) { 15797 super(); 15798 this.size = size; 15799 this.vertical = vertical; 15800 } 15801 eq(other) { 15802 return other.size == this.size && other.vertical == this.vertical; 15803 } 15804 toDOM() { 15805 let elt = document.createElement("div"); 15806 if (this.vertical) { 15807 elt.style.height = this.size + "px"; 15808 } else { 15809 elt.style.width = this.size + "px"; 15810 elt.style.height = "2px"; 15811 elt.style.display = "inline-block"; 15812 } 15813 return elt; 15814 } 15815 get estimatedHeight() { 15816 return this.vertical ? this.size : -1; 15817 } 15818}; 15819var ViewState = class { 15820 constructor(state) { 15821 this.state = state; 15822 this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }; 15823 this.inView = true; 15824 this.paddingTop = 0; 15825 this.paddingBottom = 0; 15826 this.contentDOMWidth = 0; 15827 this.contentDOMHeight = 0; 15828 this.editorHeight = 0; 15829 this.editorWidth = 0; 15830 this.scrollTop = 0; 15831 this.scrolledToBottom = true; 15832 this.scaleX = 1; 15833 this.scaleY = 1; 15834 this.scrollAnchorPos = 0; 15835 this.scrollAnchorHeight = -1; 15836 this.scaler = IdScaler; 15837 this.scrollTarget = null; 15838 this.printing = false; 15839 this.mustMeasureContent = true; 15840 this.defaultTextDirection = Direction.LTR; 15841 this.visibleRanges = []; 15842 this.mustEnforceCursorAssoc = false; 15843 let guessWrapping = state.facet(contentAttributes).some((v2) => typeof v2 != "function" && v2.class == "cm-lineWrapping"); 15844 this.heightOracle = new HeightOracle(guessWrapping); 15845 this.stateDeco = state.facet(decorations).filter((d2) => typeof d2 != "function"); 15846 this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text2.empty, this.heightOracle.setDoc(state.doc), [new ChangedRange(0, 0, 0, state.doc.length)]); 15847 this.viewport = this.getViewport(0, null); 15848 this.updateViewportLines(); 15849 this.updateForViewport(); 15850 this.lineGaps = this.ensureLineGaps([]); 15851 this.lineGapDeco = Decoration.set(this.lineGaps.map((gap) => gap.draw(this, false))); 15852 this.computeVisibleRanges(); 15853 } 15854 updateForViewport() { 15855 let viewports = [this.viewport], { main } = this.state.selection; 15856 for (let i2 = 0; i2 <= 1; i2++) { 15857 let pos = i2 ? main.head : main.anchor; 15858 if (!viewports.some(({ from, to }) => pos >= from && pos <= to)) { 15859 let { from, to } = this.lineBlockAt(pos); 15860 viewports.push(new Viewport(from, to)); 15861 } 15862 } 15863 this.viewports = viewports.sort((a2, b3) => a2.from - b3.from); 15864 this.scaler = this.heightMap.height <= 7e6 ? IdScaler : new BigScaler(this.heightOracle, this.heightMap, this.viewports); 15865 } 15866 updateViewportLines() { 15867 this.viewportLines = []; 15868 this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, (block2) => { 15869 this.viewportLines.push(this.scaler.scale == 1 ? block2 : scaleBlock(block2, this.scaler)); 15870 }); 15871 } 15872 update(update, scrollTarget = null) { 15873 this.state = update.state; 15874 let prevDeco = this.stateDeco; 15875 this.stateDeco = this.state.facet(decorations).filter((d2) => typeof d2 != "function"); 15876 let contentChanges = update.changedRanges; 15877 let heightChanges = ChangedRange.extendWithRanges(contentChanges, heightRelevantDecoChanges(prevDeco, this.stateDeco, update ? update.changes : ChangeSet.empty(this.state.doc.length))); 15878 let prevHeight = this.heightMap.height; 15879 let scrollAnchor = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop); 15880 this.heightMap = this.heightMap.applyChanges(this.stateDeco, update.startState.doc, this.heightOracle.setDoc(this.state.doc), heightChanges); 15881 if (this.heightMap.height != prevHeight) 15882 update.flags |= 2; 15883 if (scrollAnchor) { 15884 this.scrollAnchorPos = update.changes.mapPos(scrollAnchor.from, -1); 15885 this.scrollAnchorHeight = scrollAnchor.top; 15886 } else { 15887 this.scrollAnchorPos = -1; 15888 this.scrollAnchorHeight = this.heightMap.height; 15889 } 15890 let viewport = heightChanges.length ? this.mapViewport(this.viewport, update.changes) : this.viewport; 15891 if (scrollTarget && (scrollTarget.range.head < viewport.from || scrollTarget.range.head > viewport.to) || !this.viewportIsAppropriate(viewport)) 15892 viewport = this.getViewport(0, scrollTarget); 15893 let updateLines = !update.changes.empty || update.flags & 2 || viewport.from != this.viewport.from || viewport.to != this.viewport.to; 15894 this.viewport = viewport; 15895 this.updateForViewport(); 15896 if (updateLines) 15897 this.updateViewportLines(); 15898 if (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) 15899 this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, update.changes))); 15900 update.flags |= this.computeVisibleRanges(); 15901 if (scrollTarget) 15902 this.scrollTarget = scrollTarget; 15903 if (!this.mustEnforceCursorAssoc && update.selectionSet && update.view.lineWrapping && update.state.selection.main.empty && update.state.selection.main.assoc && !update.state.facet(nativeSelectionHidden)) 15904 this.mustEnforceCursorAssoc = true; 15905 } 15906 measure(view) { 15907 let dom = view.contentDOM, style = window.getComputedStyle(dom); 15908 let oracle = this.heightOracle; 15909 let whiteSpace = style.whiteSpace; 15910 this.defaultTextDirection = style.direction == "rtl" ? Direction.RTL : Direction.LTR; 15911 let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace); 15912 let domRect = dom.getBoundingClientRect(); 15913 let measureContent = refresh || this.mustMeasureContent || this.contentDOMHeight != domRect.height; 15914 this.contentDOMHeight = domRect.height; 15915 this.mustMeasureContent = false; 15916 let result = 0, bias = 0; 15917 if (domRect.width && domRect.height) { 15918 let scaleX = domRect.width / dom.offsetWidth; 15919 let scaleY = domRect.height / dom.offsetHeight; 15920 if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(domRect.width - dom.offsetWidth) < 1) 15921 scaleX = 1; 15922 if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(domRect.height - dom.offsetHeight) < 1) 15923 scaleY = 1; 15924 if (this.scaleX != scaleX || this.scaleY != scaleY) { 15925 this.scaleX = scaleX; 15926 this.scaleY = scaleY; 15927 result |= 8; 15928 refresh = measureContent = true; 15929 } 15930 } 15931 let paddingTop = (parseInt(style.paddingTop) || 0) * this.scaleY; 15932 let paddingBottom = (parseInt(style.paddingBottom) || 0) * this.scaleY; 15933 if (this.paddingTop != paddingTop || this.paddingBottom != paddingBottom) { 15934 this.paddingTop = paddingTop; 15935 this.paddingBottom = paddingBottom; 15936 result |= 8 | 2; 15937 } 15938 if (this.editorWidth != view.scrollDOM.clientWidth) { 15939 if (oracle.lineWrapping) 15940 measureContent = true; 15941 this.editorWidth = view.scrollDOM.clientWidth; 15942 result |= 8; 15943 } 15944 let scrollTop = view.scrollDOM.scrollTop * this.scaleY; 15945 if (this.scrollTop != scrollTop) { 15946 this.scrollAnchorHeight = -1; 15947 this.scrollTop = scrollTop; 15948 } 15949 this.scrolledToBottom = isScrolledToBottom(view.scrollDOM); 15950 let pixelViewport = (this.printing ? fullPixelRange : visiblePixelRange)(dom, this.paddingTop); 15951 let dTop = pixelViewport.top - this.pixelViewport.top, dBottom = pixelViewport.bottom - this.pixelViewport.bottom; 15952 this.pixelViewport = pixelViewport; 15953 let inView = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left; 15954 if (inView != this.inView) { 15955 this.inView = inView; 15956 if (inView) 15957 measureContent = true; 15958 } 15959 if (!this.inView && !this.scrollTarget) 15960 return 0; 15961 let contentWidth = domRect.width; 15962 if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) { 15963 this.contentDOMWidth = domRect.width; 15964 this.editorHeight = view.scrollDOM.clientHeight; 15965 result |= 8; 15966 } 15967 if (measureContent) { 15968 let lineHeights = view.docView.measureVisibleLineHeights(this.viewport); 15969 if (oracle.mustRefreshForHeights(lineHeights)) 15970 refresh = true; 15971 if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) { 15972 let { lineHeight, charWidth, textHeight } = view.docView.measureTextSize(); 15973 refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights); 15974 if (refresh) { 15975 view.docView.minWidth = 0; 15976 result |= 8; 15977 } 15978 } 15979 if (dTop > 0 && dBottom > 0) 15980 bias = Math.max(dTop, dBottom); 15981 else if (dTop < 0 && dBottom < 0) 15982 bias = Math.min(dTop, dBottom); 15983 oracle.heightChanged = false; 15984 for (let vp of this.viewports) { 15985 let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp); 15986 this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text2.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights)); 15987 } 15988 if (oracle.heightChanged) 15989 result |= 2; 15990 } 15991 let viewportChange = !this.viewportIsAppropriate(this.viewport, bias) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to); 15992 if (viewportChange) 15993 this.viewport = this.getViewport(bias, this.scrollTarget); 15994 this.updateForViewport(); 15995 if (result & 2 || viewportChange) 15996 this.updateViewportLines(); 15997 if (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) 15998 this.updateLineGaps(this.ensureLineGaps(refresh ? [] : this.lineGaps, view)); 15999 result |= this.computeVisibleRanges(); 16000 if (this.mustEnforceCursorAssoc) { 16001 this.mustEnforceCursorAssoc = false; 16002 view.docView.enforceCursorAssoc(); 16003 } 16004 return result; 16005 } 16006 get visibleTop() { 16007 return this.scaler.fromDOM(this.pixelViewport.top); 16008 } 16009 get visibleBottom() { 16010 return this.scaler.fromDOM(this.pixelViewport.bottom); 16011 } 16012 getViewport(bias, scrollTarget) { 16013 let marginTop = 0.5 - Math.max(-0.5, Math.min(0.5, bias / 1e3 / 2)); 16014 let map = this.heightMap, oracle = this.heightOracle; 16015 let { visibleTop, visibleBottom } = this; 16016 let viewport = new Viewport(map.lineAt(visibleTop - marginTop * 1e3, QueryType.ByHeight, oracle, 0, 0).from, map.lineAt(visibleBottom + (1 - marginTop) * 1e3, QueryType.ByHeight, oracle, 0, 0).to); 16017 if (scrollTarget) { 16018 let { head } = scrollTarget.range; 16019 if (head < viewport.from || head > viewport.to) { 16020 let viewHeight = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top); 16021 let block2 = map.lineAt(head, QueryType.ByPos, oracle, 0, 0), topPos; 16022 if (scrollTarget.y == "center") 16023 topPos = (block2.top + block2.bottom) / 2 - viewHeight / 2; 16024 else if (scrollTarget.y == "start" || scrollTarget.y == "nearest" && head < viewport.from) 16025 topPos = block2.top; 16026 else 16027 topPos = block2.bottom - viewHeight; 16028 viewport = new Viewport(map.lineAt(topPos - 1e3 / 2, QueryType.ByHeight, oracle, 0, 0).from, map.lineAt(topPos + viewHeight + 1e3 / 2, QueryType.ByHeight, oracle, 0, 0).to); 16029 } 16030 } 16031 return viewport; 16032 } 16033 mapViewport(viewport, changes) { 16034 let from = changes.mapPos(viewport.from, -1), to = changes.mapPos(viewport.to, 1); 16035 return new Viewport(this.heightMap.lineAt(from, QueryType.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(to, QueryType.ByPos, this.heightOracle, 0, 0).to); 16036 } 16037 // Checks if a given viewport covers the visible part of the 16038 // document and not too much beyond that. 16039 viewportIsAppropriate({ from, to }, bias = 0) { 16040 if (!this.inView) 16041 return true; 16042 let { top: top2 } = this.heightMap.lineAt(from, QueryType.ByPos, this.heightOracle, 0, 0); 16043 let { bottom } = this.heightMap.lineAt(to, QueryType.ByPos, this.heightOracle, 0, 0); 16044 let { visibleTop, visibleBottom } = this; 16045 return (from == 0 || top2 <= visibleTop - Math.max(10, Math.min( 16046 -bias, 16047 250 16048 /* VP.MaxCoverMargin */ 16049 ))) && (to == this.state.doc.length || bottom >= visibleBottom + Math.max(10, Math.min( 16050 bias, 16051 250 16052 /* VP.MaxCoverMargin */ 16053 ))) && (top2 > visibleTop - 2 * 1e3 && bottom < visibleBottom + 2 * 1e3); 16054 } 16055 mapLineGaps(gaps, changes) { 16056 if (!gaps.length || changes.empty) 16057 return gaps; 16058 let mapped = []; 16059 for (let gap of gaps) 16060 if (!changes.touchesRange(gap.from, gap.to)) 16061 mapped.push(new LineGap(changes.mapPos(gap.from), changes.mapPos(gap.to), gap.size)); 16062 return mapped; 16063 } 16064 // Computes positions in the viewport where the start or end of a 16065 // line should be hidden, trying to reuse existing line gaps when 16066 // appropriate to avoid unneccesary redraws. 16067 // Uses crude character-counting for the positioning and sizing, 16068 // since actual DOM coordinates aren't always available and 16069 // predictable. Relies on generous margins (see LG.Margin) to hide 16070 // the artifacts this might produce from the user. 16071 ensureLineGaps(current, mayMeasure) { 16072 let wrapping = this.heightOracle.lineWrapping; 16073 let margin = wrapping ? 1e4 : 2e3, halfMargin = margin >> 1, doubleMargin = margin << 1; 16074 if (this.defaultTextDirection != Direction.LTR && !wrapping) 16075 return []; 16076 let gaps = []; 16077 let addGap = (from, to, line, structure) => { 16078 if (to - from < halfMargin) 16079 return; 16080 let sel = this.state.selection.main, avoid = [sel.from]; 16081 if (!sel.empty) 16082 avoid.push(sel.to); 16083 for (let pos of avoid) { 16084 if (pos > from && pos < to) { 16085 addGap(from, pos - 10, line, structure); 16086 addGap(pos + 10, to, line, structure); 16087 return; 16088 } 16089 } 16090 let gap = find(current, (gap2) => gap2.from >= line.from && gap2.to <= line.to && Math.abs(gap2.from - from) < halfMargin && Math.abs(gap2.to - to) < halfMargin && !avoid.some((pos) => gap2.from < pos && gap2.to > pos)); 16091 if (!gap) { 16092 if (to < line.to && mayMeasure && wrapping && mayMeasure.visibleRanges.some((r2) => r2.from <= to && r2.to >= to)) { 16093 let lineStart = mayMeasure.moveToLineBoundary(EditorSelection.cursor(to), false, true).head; 16094 if (lineStart > from) 16095 to = lineStart; 16096 } 16097 gap = new LineGap(from, to, this.gapSize(line, from, to, structure)); 16098 } 16099 gaps.push(gap); 16100 }; 16101 for (let line of this.viewportLines) { 16102 if (line.length < doubleMargin) 16103 continue; 16104 let structure = lineStructure(line.from, line.to, this.stateDeco); 16105 if (structure.total < doubleMargin) 16106 continue; 16107 let target = this.scrollTarget ? this.scrollTarget.range.head : null; 16108 let viewFrom, viewTo; 16109 if (wrapping) { 16110 let marginHeight = margin / this.heightOracle.lineLength * this.heightOracle.lineHeight; 16111 let top2, bot; 16112 if (target != null) { 16113 let targetFrac = findFraction(structure, target); 16114 let spaceFrac = ((this.visibleBottom - this.visibleTop) / 2 + marginHeight) / line.height; 16115 top2 = targetFrac - spaceFrac; 16116 bot = targetFrac + spaceFrac; 16117 } else { 16118 top2 = (this.visibleTop - line.top - marginHeight) / line.height; 16119 bot = (this.visibleBottom - line.top + marginHeight) / line.height; 16120 } 16121 viewFrom = findPosition(structure, top2); 16122 viewTo = findPosition(structure, bot); 16123 } else { 16124 let totalWidth = structure.total * this.heightOracle.charWidth; 16125 let marginWidth = margin * this.heightOracle.charWidth; 16126 let left, right; 16127 if (target != null) { 16128 let targetFrac = findFraction(structure, target); 16129 let spaceFrac = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + marginWidth) / totalWidth; 16130 left = targetFrac - spaceFrac; 16131 right = targetFrac + spaceFrac; 16132 } else { 16133 left = (this.pixelViewport.left - marginWidth) / totalWidth; 16134 right = (this.pixelViewport.right + marginWidth) / totalWidth; 16135 } 16136 viewFrom = findPosition(structure, left); 16137 viewTo = findPosition(structure, right); 16138 } 16139 if (viewFrom > line.from) 16140 addGap(line.from, viewFrom, line, structure); 16141 if (viewTo < line.to) 16142 addGap(viewTo, line.to, line, structure); 16143 } 16144 return gaps; 16145 } 16146 gapSize(line, from, to, structure) { 16147 let fraction = findFraction(structure, to) - findFraction(structure, from); 16148 if (this.heightOracle.lineWrapping) { 16149 return line.height * fraction; 16150 } else { 16151 return structure.total * this.heightOracle.charWidth * fraction; 16152 } 16153 } 16154 updateLineGaps(gaps) { 16155 if (!LineGap.same(gaps, this.lineGaps)) { 16156 this.lineGaps = gaps; 16157 this.lineGapDeco = Decoration.set(gaps.map((gap) => gap.draw(this, this.heightOracle.lineWrapping))); 16158 } 16159 } 16160 computeVisibleRanges() { 16161 let deco = this.stateDeco; 16162 if (this.lineGaps.length) 16163 deco = deco.concat(this.lineGapDeco); 16164 let ranges = []; 16165 RangeSet.spans(deco, this.viewport.from, this.viewport.to, { 16166 span(from, to) { 16167 ranges.push({ from, to }); 16168 }, 16169 point() { 16170 } 16171 }, 20); 16172 let changed = ranges.length != this.visibleRanges.length || this.visibleRanges.some((r2, i2) => r2.from != ranges[i2].from || r2.to != ranges[i2].to); 16173 this.visibleRanges = ranges; 16174 return changed ? 4 : 0; 16175 } 16176 lineBlockAt(pos) { 16177 return pos >= this.viewport.from && pos <= this.viewport.to && this.viewportLines.find((b3) => b3.from <= pos && b3.to >= pos) || scaleBlock(this.heightMap.lineAt(pos, QueryType.ByPos, this.heightOracle, 0, 0), this.scaler); 16178 } 16179 lineBlockAtHeight(height) { 16180 return scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler); 16181 } 16182 scrollAnchorAt(scrollTop) { 16183 let block2 = this.lineBlockAtHeight(scrollTop + 8); 16184 return block2.from >= this.viewport.from || this.viewportLines[0].top - scrollTop > 200 ? block2 : this.viewportLines[0]; 16185 } 16186 elementAtHeight(height) { 16187 return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(height), this.heightOracle, 0, 0), this.scaler); 16188 } 16189 get docHeight() { 16190 return this.scaler.toDOM(this.heightMap.height); 16191 } 16192 get contentHeight() { 16193 return this.docHeight + this.paddingTop + this.paddingBottom; 16194 } 16195}; 16196var Viewport = class { 16197 constructor(from, to) { 16198 this.from = from; 16199 this.to = to; 16200 } 16201}; 16202function lineStructure(from, to, stateDeco) { 16203 let ranges = [], pos = from, total = 0; 16204 RangeSet.spans(stateDeco, from, to, { 16205 span() { 16206 }, 16207 point(from2, to2) { 16208 if (from2 > pos) { 16209 ranges.push({ from: pos, to: from2 }); 16210 total += from2 - pos; 16211 } 16212 pos = to2; 16213 } 16214 }, 20); 16215 if (pos < to) { 16216 ranges.push({ from: pos, to }); 16217 total += to - pos; 16218 } 16219 return { total, ranges }; 16220} 16221function findPosition({ total, ranges }, ratio) { 16222 if (ratio <= 0) 16223 return ranges[0].from; 16224 if (ratio >= 1) 16225 return ranges[ranges.length - 1].to; 16226 let dist2 = Math.floor(total * ratio); 16227 for (let i2 = 0; ; i2++) { 16228 let { from, to } = ranges[i2], size = to - from; 16229 if (dist2 <= size) 16230 return from + dist2; 16231 dist2 -= size; 16232 } 16233} 16234function findFraction(structure, pos) { 16235 let counted = 0; 16236 for (let { from, to } of structure.ranges) { 16237 if (pos <= to) { 16238 counted += pos - from; 16239 break; 16240 } 16241 counted += to - from; 16242 } 16243 return counted / structure.total; 16244} 16245function find(array, f3) { 16246 for (let val of array) 16247 if (f3(val)) 16248 return val; 16249 return void 0; 16250} 16251var IdScaler = { 16252 toDOM(n3) { 16253 return n3; 16254 }, 16255 fromDOM(n3) { 16256 return n3; 16257 }, 16258 scale: 1 16259}; 16260var BigScaler = class { 16261 constructor(oracle, heightMap, viewports) { 16262 let vpHeight = 0, base2 = 0, domBase = 0; 16263 this.viewports = viewports.map(({ from, to }) => { 16264 let top2 = heightMap.lineAt(from, QueryType.ByPos, oracle, 0, 0).top; 16265 let bottom = heightMap.lineAt(to, QueryType.ByPos, oracle, 0, 0).bottom; 16266 vpHeight += bottom - top2; 16267 return { from, to, top: top2, bottom, domTop: 0, domBottom: 0 }; 16268 }); 16269 this.scale = (7e6 - vpHeight) / (heightMap.height - vpHeight); 16270 for (let obj of this.viewports) { 16271 obj.domTop = domBase + (obj.top - base2) * this.scale; 16272 domBase = obj.domBottom = obj.domTop + (obj.bottom - obj.top); 16273 base2 = obj.bottom; 16274 } 16275 } 16276 toDOM(n3) { 16277 for (let i2 = 0, base2 = 0, domBase = 0; ; i2++) { 16278 let vp = i2 < this.viewports.length ? this.viewports[i2] : null; 16279 if (!vp || n3 < vp.top) 16280 return domBase + (n3 - base2) * this.scale; 16281 if (n3 <= vp.bottom) 16282 return vp.domTop + (n3 - vp.top); 16283 base2 = vp.bottom; 16284 domBase = vp.domBottom; 16285 } 16286 } 16287 fromDOM(n3) { 16288 for (let i2 = 0, base2 = 0, domBase = 0; ; i2++) { 16289 let vp = i2 < this.viewports.length ? this.viewports[i2] : null; 16290 if (!vp || n3 < vp.domTop) 16291 return base2 + (n3 - domBase) / this.scale; 16292 if (n3 <= vp.domBottom) 16293 return vp.top + (n3 - vp.domTop); 16294 base2 = vp.bottom; 16295 domBase = vp.domBottom; 16296 } 16297 } 16298}; 16299function scaleBlock(block2, scaler) { 16300 if (scaler.scale == 1) 16301 return block2; 16302 let bTop = scaler.toDOM(block2.top), bBottom = scaler.toDOM(block2.bottom); 16303 return new BlockInfo(block2.from, block2.length, bTop, bBottom - bTop, Array.isArray(block2._content) ? block2._content.map((b3) => scaleBlock(b3, scaler)) : block2._content); 16304} 16305var theme = /* @__PURE__ */ Facet.define({ combine: (strs) => strs.join(" ") }); 16306var darkTheme = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.indexOf(true) > -1 }); 16307var baseThemeID = /* @__PURE__ */ StyleModule.newName(); 16308var baseLightID = /* @__PURE__ */ StyleModule.newName(); 16309var baseDarkID = /* @__PURE__ */ StyleModule.newName(); 16310var lightDarkIDs = { "&light": "." + baseLightID, "&dark": "." + baseDarkID }; 16311function buildTheme(main, spec, scopes) { 16312 return new StyleModule(spec, { 16313 finish(sel) { 16314 return /&/.test(sel) ? sel.replace(/&\w*/, (m2) => { 16315 if (m2 == "&") 16316 return main; 16317 if (!scopes || !scopes[m2]) 16318 throw new RangeError(`Unsupported selector: ${m2}`); 16319 return scopes[m2]; 16320 }) : main + " " + sel; 16321 } 16322 }); 16323} 16324var baseTheme$1 = /* @__PURE__ */ buildTheme("." + baseThemeID, { 16325 "&": { 16326 position: "relative !important", 16327 boxSizing: "border-box", 16328 "&.cm-focused": { 16329 // Provide a simple default outline to make sure a focused 16330 // editor is visually distinct. Can't leave the default behavior 16331 // because that will apply to the content element, which is 16332 // inside the scrollable container and doesn't include the 16333 // gutters. We also can't use an 'auto' outline, since those 16334 // are, for some reason, drawn behind the element content, which 16335 // will cause things like the active line background to cover 16336 // the outline (#297). 16337 outline: "1px dotted #212121" 16338 }, 16339 display: "flex !important", 16340 flexDirection: "column" 16341 }, 16342 ".cm-scroller": { 16343 display: "flex !important", 16344 alignItems: "flex-start !important", 16345 fontFamily: "monospace", 16346 lineHeight: 1.4, 16347 height: "100%", 16348 overflowX: "auto", 16349 position: "relative", 16350 zIndex: 0 16351 }, 16352 ".cm-content": { 16353 margin: 0, 16354 flexGrow: 2, 16355 flexShrink: 0, 16356 display: "block", 16357 whiteSpace: "pre", 16358 wordWrap: "normal", 16359 boxSizing: "border-box", 16360 minHeight: "100%", 16361 padding: "4px 0", 16362 outline: "none", 16363 "&[contenteditable=true]": { 16364 WebkitUserModify: "read-write-plaintext-only" 16365 } 16366 }, 16367 ".cm-lineWrapping": { 16368 whiteSpace_fallback: "pre-wrap", 16369 whiteSpace: "break-spaces", 16370 wordBreak: "break-word", 16371 overflowWrap: "anywhere", 16372 flexShrink: 1 16373 }, 16374 "&light .cm-content": { caretColor: "black" }, 16375 "&dark .cm-content": { caretColor: "white" }, 16376 ".cm-line": { 16377 display: "block", 16378 padding: "0 2px 0 6px" 16379 }, 16380 ".cm-layer": { 16381 position: "absolute", 16382 left: 0, 16383 top: 0, 16384 contain: "size style", 16385 "& > *": { 16386 position: "absolute" 16387 } 16388 }, 16389 "&light .cm-selectionBackground": { 16390 background: "#d9d9d9" 16391 }, 16392 "&dark .cm-selectionBackground": { 16393 background: "#222" 16394 }, 16395 "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { 16396 background: "#d7d4f0" 16397 }, 16398 "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { 16399 background: "#233" 16400 }, 16401 ".cm-cursorLayer": { 16402 pointerEvents: "none" 16403 }, 16404 "&.cm-focused > .cm-scroller > .cm-cursorLayer": { 16405 animation: "steps(1) cm-blink 1.2s infinite" 16406 }, 16407 // Two animations defined so that we can switch between them to 16408 // restart the animation without forcing another style 16409 // recomputation. 16410 "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} }, 16411 "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} }, 16412 ".cm-cursor, .cm-dropCursor": { 16413 borderLeft: "1.2px solid black", 16414 marginLeft: "-0.6px", 16415 pointerEvents: "none" 16416 }, 16417 ".cm-cursor": { 16418 display: "none" 16419 }, 16420 "&dark .cm-cursor": { 16421 borderLeftColor: "#444" 16422 }, 16423 ".cm-dropCursor": { 16424 position: "absolute" 16425 }, 16426 "&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": { 16427 display: "block" 16428 }, 16429 ".cm-announced": { 16430 position: "fixed", 16431 top: "-10000px" 16432 }, 16433 "@media print": { 16434 ".cm-announced": { display: "none" } 16435 }, 16436 "&light .cm-activeLine": { backgroundColor: "#cceeff44" }, 16437 "&dark .cm-activeLine": { backgroundColor: "#99eeff33" }, 16438 "&light .cm-specialChar": { color: "red" }, 16439 "&dark .cm-specialChar": { color: "#f78" }, 16440 ".cm-gutters": { 16441 flexShrink: 0, 16442 display: "flex", 16443 height: "100%", 16444 boxSizing: "border-box", 16445 insetInlineStart: 0, 16446 zIndex: 200 16447 }, 16448 "&light .cm-gutters": { 16449 backgroundColor: "#f5f5f5", 16450 color: "#6c6c6c", 16451 borderRight: "1px solid #ddd" 16452 }, 16453 "&dark .cm-gutters": { 16454 backgroundColor: "#333338", 16455 color: "#ccc" 16456 }, 16457 ".cm-gutter": { 16458 display: "flex !important", 16459 flexDirection: "column", 16460 flexShrink: 0, 16461 boxSizing: "border-box", 16462 minHeight: "100%", 16463 overflow: "hidden" 16464 }, 16465 ".cm-gutterElement": { 16466 boxSizing: "border-box" 16467 }, 16468 ".cm-lineNumbers .cm-gutterElement": { 16469 padding: "0 3px 0 5px", 16470 minWidth: "20px", 16471 textAlign: "right", 16472 whiteSpace: "nowrap" 16473 }, 16474 "&light .cm-activeLineGutter": { 16475 backgroundColor: "#e2f2ff" 16476 }, 16477 "&dark .cm-activeLineGutter": { 16478 backgroundColor: "#222227" 16479 }, 16480 ".cm-panels": { 16481 boxSizing: "border-box", 16482 position: "sticky", 16483 left: 0, 16484 right: 0 16485 }, 16486 "&light .cm-panels": { 16487 backgroundColor: "#f5f5f5", 16488 color: "black" 16489 }, 16490 "&light .cm-panels-top": { 16491 borderBottom: "1px solid #ddd" 16492 }, 16493 "&light .cm-panels-bottom": { 16494 borderTop: "1px solid #ddd" 16495 }, 16496 "&dark .cm-panels": { 16497 backgroundColor: "#333338", 16498 color: "white" 16499 }, 16500 ".cm-tab": { 16501 display: "inline-block", 16502 overflow: "hidden", 16503 verticalAlign: "bottom" 16504 }, 16505 ".cm-widgetBuffer": { 16506 verticalAlign: "text-top", 16507 height: "1em", 16508 width: 0, 16509 display: "inline" 16510 }, 16511 ".cm-placeholder": { 16512 color: "#888", 16513 display: "inline-block", 16514 verticalAlign: "top" 16515 }, 16516 ".cm-highlightSpace:before": { 16517 content: "attr(data-display)", 16518 position: "absolute", 16519 pointerEvents: "none", 16520 color: "#888" 16521 }, 16522 ".cm-highlightTab": { 16523 backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`, 16524 backgroundSize: "auto 100%", 16525 backgroundPosition: "right 90%", 16526 backgroundRepeat: "no-repeat" 16527 }, 16528 ".cm-trailingSpace": { 16529 backgroundColor: "#ff332255" 16530 }, 16531 ".cm-button": { 16532 verticalAlign: "middle", 16533 color: "inherit", 16534 fontSize: "70%", 16535 padding: ".2em 1em", 16536 borderRadius: "1px" 16537 }, 16538 "&light .cm-button": { 16539 backgroundImage: "linear-gradient(#eff1f5, #d9d9df)", 16540 border: "1px solid #888", 16541 "&:active": { 16542 backgroundImage: "linear-gradient(#b4b4b4, #d0d3d6)" 16543 } 16544 }, 16545 "&dark .cm-button": { 16546 backgroundImage: "linear-gradient(#393939, #111)", 16547 border: "1px solid #888", 16548 "&:active": { 16549 backgroundImage: "linear-gradient(#111, #333)" 16550 } 16551 }, 16552 ".cm-textfield": { 16553 verticalAlign: "middle", 16554 color: "inherit", 16555 fontSize: "70%", 16556 border: "1px solid silver", 16557 padding: ".2em .5em" 16558 }, 16559 "&light .cm-textfield": { 16560 backgroundColor: "white" 16561 }, 16562 "&dark .cm-textfield": { 16563 border: "1px solid #555", 16564 backgroundColor: "inherit" 16565 } 16566}, lightDarkIDs); 16567var LineBreakPlaceholder = "\uFFFF"; 16568var DOMReader = class { 16569 constructor(points, state) { 16570 this.points = points; 16571 this.text = ""; 16572 this.lineSeparator = state.facet(EditorState.lineSeparator); 16573 } 16574 append(text) { 16575 this.text += text; 16576 } 16577 lineBreak() { 16578 this.text += LineBreakPlaceholder; 16579 } 16580 readRange(start, end) { 16581 if (!start) 16582 return this; 16583 let parent = start.parentNode; 16584 for (let cur2 = start; ; ) { 16585 this.findPointBefore(parent, cur2); 16586 let oldLen = this.text.length; 16587 this.readNode(cur2); 16588 let next = cur2.nextSibling; 16589 if (next == end) 16590 break; 16591 let view = ContentView.get(cur2), nextView = ContentView.get(next); 16592 if (view && nextView ? view.breakAfter : (view ? view.breakAfter : isBlockElement(cur2)) || isBlockElement(next) && (cur2.nodeName != "BR" || cur2.cmIgnore) && this.text.length > oldLen) 16593 this.lineBreak(); 16594 cur2 = next; 16595 } 16596 this.findPointBefore(parent, end); 16597 return this; 16598 } 16599 readTextNode(node) { 16600 let text = node.nodeValue; 16601 for (let point of this.points) 16602 if (point.node == node) 16603 point.pos = this.text.length + Math.min(point.offset, text.length); 16604 for (let off = 0, re2 = this.lineSeparator ? null : /\r\n?|\n/g; ; ) { 16605 let nextBreak = -1, breakSize = 1, m2; 16606 if (this.lineSeparator) { 16607 nextBreak = text.indexOf(this.lineSeparator, off); 16608 breakSize = this.lineSeparator.length; 16609 } else if (m2 = re2.exec(text)) { 16610 nextBreak = m2.index; 16611 breakSize = m2[0].length; 16612 } 16613 this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak)); 16614 if (nextBreak < 0) 16615 break; 16616 this.lineBreak(); 16617 if (breakSize > 1) { 16618 for (let point of this.points) 16619 if (point.node == node && point.pos > this.text.length) 16620 point.pos -= breakSize - 1; 16621 } 16622 off = nextBreak + breakSize; 16623 } 16624 } 16625 readNode(node) { 16626 if (node.cmIgnore) 16627 return; 16628 let view = ContentView.get(node); 16629 let fromView = view && view.overrideDOMText; 16630 if (fromView != null) { 16631 this.findPointInside(node, fromView.length); 16632 for (let i2 = fromView.iter(); !i2.next().done; ) { 16633 if (i2.lineBreak) 16634 this.lineBreak(); 16635 else 16636 this.append(i2.value); 16637 } 16638 } else if (node.nodeType == 3) { 16639 this.readTextNode(node); 16640 } else if (node.nodeName == "BR") { 16641 if (node.nextSibling) 16642 this.lineBreak(); 16643 } else if (node.nodeType == 1) { 16644 this.readRange(node.firstChild, null); 16645 } 16646 } 16647 findPointBefore(node, next) { 16648 for (let point of this.points) 16649 if (point.node == node && node.childNodes[point.offset] == next) 16650 point.pos = this.text.length; 16651 } 16652 findPointInside(node, length) { 16653 for (let point of this.points) 16654 if (node.nodeType == 3 ? point.node == node : node.contains(point.node)) 16655 point.pos = this.text.length + (isAtEnd(node, point.node, point.offset) ? length : 0); 16656 } 16657}; 16658function isAtEnd(parent, node, offset) { 16659 for (; ; ) { 16660 if (!node || offset < maxOffset(node)) 16661 return false; 16662 if (node == parent) 16663 return true; 16664 offset = domIndex(node) + 1; 16665 node = node.parentNode; 16666 } 16667} 16668function isBlockElement(node) { 16669 return node.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(node.nodeName); 16670} 16671var DOMPoint = class { 16672 constructor(node, offset) { 16673 this.node = node; 16674 this.offset = offset; 16675 this.pos = -1; 16676 } 16677}; 16678var DOMChange = class { 16679 constructor(view, start, end, typeOver) { 16680 this.typeOver = typeOver; 16681 this.bounds = null; 16682 this.text = ""; 16683 let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView; 16684 if (view.state.readOnly && start > -1) { 16685 this.newSel = null; 16686 } else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) { 16687 let selPoints = iHead || iAnchor ? [] : selectionPoints(view); 16688 let reader = new DOMReader(selPoints, view.state); 16689 reader.readRange(this.bounds.startDOM, this.bounds.endDOM); 16690 this.text = reader.text; 16691 this.newSel = selectionFromPoints(selPoints, this.bounds.from); 16692 } else { 16693 let domSel = view.observer.selectionRange; 16694 let head = iHead && iHead.node == domSel.focusNode && iHead.offset == domSel.focusOffset || !contains(view.contentDOM, domSel.focusNode) ? view.state.selection.main.head : view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset); 16695 let anchor = iAnchor && iAnchor.node == domSel.anchorNode && iAnchor.offset == domSel.anchorOffset || !contains(view.contentDOM, domSel.anchorNode) ? view.state.selection.main.anchor : view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset); 16696 this.newSel = EditorSelection.single(anchor, head); 16697 } 16698 } 16699}; 16700function applyDOMChange(view, domChange) { 16701 let change; 16702 let { newSel } = domChange, sel = view.state.selection.main; 16703 let lastKey = view.inputState.lastKeyTime > Date.now() - 100 ? view.inputState.lastKeyCode : -1; 16704 if (domChange.bounds) { 16705 let { from, to } = domChange.bounds; 16706 let preferredPos = sel.from, preferredSide = null; 16707 if (lastKey === 8 || browser.android && domChange.text.length < to - from) { 16708 preferredPos = sel.to; 16709 preferredSide = "end"; 16710 } 16711 let diff = findDiff(view.state.doc.sliceString(from, to, LineBreakPlaceholder), domChange.text, preferredPos - from, preferredSide); 16712 if (diff) { 16713 if (browser.chrome && lastKey == 13 && diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder) 16714 diff.toB--; 16715 change = { 16716 from: from + diff.from, 16717 to: from + diff.toA, 16718 insert: Text2.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) 16719 }; 16720 } 16721 } else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) { 16722 newSel = null; 16723 } 16724 if (!change && !newSel) 16725 return false; 16726 if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) { 16727 change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) }; 16728 } else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) { 16729 change = { 16730 from: sel.from, 16731 to: sel.to, 16732 insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to)) 16733 }; 16734 } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") { 16735 if (newSel && change.insert.length == 2) 16736 newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1); 16737 change = { from: sel.from, to: sel.to, insert: Text2.of([" "]) }; 16738 } else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) { 16739 if (newSel) 16740 newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1); 16741 change = { from: sel.from, to: sel.to, insert: Text2.of([" "]) }; 16742 } 16743 if (change) { 16744 if (browser.ios && view.inputState.flushIOSKey()) 16745 return true; 16746 if (browser.android && (change.from == sel.from && change.to == sel.to && change.insert.length == 1 && change.insert.lines == 2 && dispatchKey(view.contentDOM, "Enter", 13) || (change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 || lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) && dispatchKey(view.contentDOM, "Backspace", 8) || change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 && dispatchKey(view.contentDOM, "Delete", 46))) 16747 return true; 16748 let text = change.insert.toString(); 16749 if (view.inputState.composing >= 0) 16750 view.inputState.composing++; 16751 let defaultTr; 16752 let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel)); 16753 if (!view.state.facet(inputHandler).some((h3) => h3(view, change.from, change.to, text, defaultInsert))) 16754 view.dispatch(defaultInsert()); 16755 return true; 16756 } else if (newSel && !newSel.main.eq(sel)) { 16757 let scrollIntoView3 = false, userEvent = "select"; 16758 if (view.inputState.lastSelectionTime > Date.now() - 50) { 16759 if (view.inputState.lastSelectionOrigin == "select") 16760 scrollIntoView3 = true; 16761 userEvent = view.inputState.lastSelectionOrigin; 16762 } 16763 view.dispatch({ selection: newSel, scrollIntoView: scrollIntoView3, userEvent }); 16764 return true; 16765 } else { 16766 return false; 16767 } 16768} 16769function applyDefaultInsert(view, change, newSel) { 16770 let tr, startState = view.state, sel = startState.selection.main; 16771 if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 && (!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) && view.inputState.composing < 0) { 16772 let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : ""; 16773 let after = sel.to > change.to ? startState.sliceDoc(change.to, sel.to) : ""; 16774 tr = startState.replaceSelection(view.state.toText(before + change.insert.sliceString(0, void 0, view.state.lineBreak) + after)); 16775 } else { 16776 let changes = startState.changes(change); 16777 let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : void 0; 16778 if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 && change.to <= sel.to && change.to >= sel.to - 10) { 16779 let replaced = view.state.sliceDoc(change.from, change.to); 16780 let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head); 16781 if (composition) { 16782 let dLen = change.insert.length - (change.to - change.from); 16783 compositionRange = { from: composition.from, to: composition.to - dLen }; 16784 } else { 16785 compositionRange = view.state.doc.lineAt(sel.head); 16786 } 16787 let offset = sel.to - change.to, size = sel.to - sel.from; 16788 tr = startState.changeByRange((range) => { 16789 if (range.from == sel.from && range.to == sel.to) 16790 return { changes, range: mainSel || range.map(changes) }; 16791 let to = range.to - offset, from = to - replaced.length; 16792 if (range.to - range.from != size || view.state.sliceDoc(from, to) != replaced || // Unfortunately, there's no way to make multiple 16793 // changes in the same node work without aborting 16794 // composition, so cursors in the composition range are 16795 // ignored. 16796 range.to >= compositionRange.from && range.from <= compositionRange.to) 16797 return { range }; 16798 let rangeChanges = startState.changes({ from, to, insert: change.insert }), selOff = range.to - sel.to; 16799 return { 16800 changes: rangeChanges, 16801 range: !mainSel ? range.map(rangeChanges) : EditorSelection.range(Math.max(0, mainSel.anchor + selOff), Math.max(0, mainSel.head + selOff)) 16802 }; 16803 }); 16804 } else { 16805 tr = { 16806 changes, 16807 selection: mainSel && startState.selection.replaceRange(mainSel) 16808 }; 16809 } 16810 } 16811 let userEvent = "input.type"; 16812 if (view.composing || view.inputState.compositionPendingChange && view.inputState.compositionEndedAt > Date.now() - 50) { 16813 view.inputState.compositionPendingChange = false; 16814 userEvent += ".compose"; 16815 if (view.inputState.compositionFirstChange) { 16816 userEvent += ".start"; 16817 view.inputState.compositionFirstChange = false; 16818 } 16819 } 16820 return startState.update(tr, { userEvent, scrollIntoView: true }); 16821} 16822function findDiff(a2, b3, preferredPos, preferredSide) { 16823 let minLen = Math.min(a2.length, b3.length); 16824 let from = 0; 16825 while (from < minLen && a2.charCodeAt(from) == b3.charCodeAt(from)) 16826 from++; 16827 if (from == minLen && a2.length == b3.length) 16828 return null; 16829 let toA = a2.length, toB = b3.length; 16830 while (toA > 0 && toB > 0 && a2.charCodeAt(toA - 1) == b3.charCodeAt(toB - 1)) { 16831 toA--; 16832 toB--; 16833 } 16834 if (preferredSide == "end") { 16835 let adjust = Math.max(0, from - Math.min(toA, toB)); 16836 preferredPos -= toA + adjust - from; 16837 } 16838 if (toA < from && a2.length < b3.length) { 16839 let move = preferredPos <= from && preferredPos >= toA ? from - preferredPos : 0; 16840 from -= move; 16841 toB = from + (toB - toA); 16842 toA = from; 16843 } else if (toB < from) { 16844 let move = preferredPos <= from && preferredPos >= toB ? from - preferredPos : 0; 16845 from -= move; 16846 toA = from + (toA - toB); 16847 toB = from; 16848 } 16849 return { from, toA, toB }; 16850} 16851function selectionPoints(view) { 16852 let result = []; 16853 if (view.root.activeElement != view.contentDOM) 16854 return result; 16855 let { anchorNode, anchorOffset, focusNode, focusOffset } = view.observer.selectionRange; 16856 if (anchorNode) { 16857 result.push(new DOMPoint(anchorNode, anchorOffset)); 16858 if (focusNode != anchorNode || focusOffset != anchorOffset) 16859 result.push(new DOMPoint(focusNode, focusOffset)); 16860 } 16861 return result; 16862} 16863function selectionFromPoints(points, base2) { 16864 if (points.length == 0) 16865 return null; 16866 let anchor = points[0].pos, head = points.length == 2 ? points[1].pos : anchor; 16867 return anchor > -1 && head > -1 ? EditorSelection.single(anchor + base2, head + base2) : null; 16868} 16869var observeOptions = { 16870 childList: true, 16871 characterData: true, 16872 subtree: true, 16873 attributes: true, 16874 characterDataOldValue: true 16875}; 16876var useCharData = browser.ie && browser.ie_version <= 11; 16877var DOMObserver = class { 16878 constructor(view) { 16879 this.view = view; 16880 this.active = false; 16881 this.selectionRange = new DOMSelectionState(); 16882 this.selectionChanged = false; 16883 this.delayedFlush = -1; 16884 this.resizeTimeout = -1; 16885 this.queue = []; 16886 this.delayedAndroidKey = null; 16887 this.flushingAndroidKey = -1; 16888 this.lastChange = 0; 16889 this.scrollTargets = []; 16890 this.intersection = null; 16891 this.resizeScroll = null; 16892 this.intersecting = false; 16893 this.gapIntersection = null; 16894 this.gaps = []; 16895 this.parentCheck = -1; 16896 this.dom = view.contentDOM; 16897 this.observer = new MutationObserver((mutations) => { 16898 for (let mut of mutations) 16899 this.queue.push(mut); 16900 if ((browser.ie && browser.ie_version <= 11 || browser.ios && view.composing) && mutations.some((m2) => m2.type == "childList" && m2.removedNodes.length || m2.type == "characterData" && m2.oldValue.length > m2.target.nodeValue.length)) 16901 this.flushSoon(); 16902 else 16903 this.flush(); 16904 }); 16905 if (useCharData) 16906 this.onCharData = (event) => { 16907 this.queue.push({ 16908 target: event.target, 16909 type: "characterData", 16910 oldValue: event.prevValue 16911 }); 16912 this.flushSoon(); 16913 }; 16914 this.onSelectionChange = this.onSelectionChange.bind(this); 16915 this.onResize = this.onResize.bind(this); 16916 this.onPrint = this.onPrint.bind(this); 16917 this.onScroll = this.onScroll.bind(this); 16918 if (typeof ResizeObserver == "function") { 16919 this.resizeScroll = new ResizeObserver(() => { 16920 var _a3; 16921 if (((_a3 = this.view.docView) === null || _a3 === void 0 ? void 0 : _a3.lastUpdate) < Date.now() - 75) 16922 this.onResize(); 16923 }); 16924 this.resizeScroll.observe(view.scrollDOM); 16925 } 16926 this.addWindowListeners(this.win = view.win); 16927 this.start(); 16928 if (typeof IntersectionObserver == "function") { 16929 this.intersection = new IntersectionObserver((entries) => { 16930 if (this.parentCheck < 0) 16931 this.parentCheck = setTimeout(this.listenForScroll.bind(this), 1e3); 16932 if (entries.length > 0 && entries[entries.length - 1].intersectionRatio > 0 != this.intersecting) { 16933 this.intersecting = !this.intersecting; 16934 if (this.intersecting != this.view.inView) 16935 this.onScrollChanged(document.createEvent("Event")); 16936 } 16937 }, { threshold: [0, 1e-3] }); 16938 this.intersection.observe(this.dom); 16939 this.gapIntersection = new IntersectionObserver((entries) => { 16940 if (entries.length > 0 && entries[entries.length - 1].intersectionRatio > 0) 16941 this.onScrollChanged(document.createEvent("Event")); 16942 }, {}); 16943 } 16944 this.listenForScroll(); 16945 this.readSelectionRange(); 16946 } 16947 onScrollChanged(e2) { 16948 this.view.inputState.runHandlers("scroll", e2); 16949 if (this.intersecting) 16950 this.view.measure(); 16951 } 16952 onScroll(e2) { 16953 if (this.intersecting) 16954 this.flush(false); 16955 this.onScrollChanged(e2); 16956 } 16957 onResize() { 16958 if (this.resizeTimeout < 0) 16959 this.resizeTimeout = setTimeout(() => { 16960 this.resizeTimeout = -1; 16961 this.view.requestMeasure(); 16962 }, 50); 16963 } 16964 onPrint() { 16965 this.view.viewState.printing = true; 16966 this.view.measure(); 16967 setTimeout(() => { 16968 this.view.viewState.printing = false; 16969 this.view.requestMeasure(); 16970 }, 500); 16971 } 16972 updateGaps(gaps) { 16973 if (this.gapIntersection && (gaps.length != this.gaps.length || this.gaps.some((g2, i2) => g2 != gaps[i2]))) { 16974 this.gapIntersection.disconnect(); 16975 for (let gap of gaps) 16976 this.gapIntersection.observe(gap); 16977 this.gaps = gaps; 16978 } 16979 } 16980 onSelectionChange(event) { 16981 let wasChanged = this.selectionChanged; 16982 if (!this.readSelectionRange() || this.delayedAndroidKey) 16983 return; 16984 let { view } = this, sel = this.selectionRange; 16985 if (view.state.facet(editable) ? view.root.activeElement != this.dom : !hasSelection(view.dom, sel)) 16986 return; 16987 let context = sel.anchorNode && view.docView.nearest(sel.anchorNode); 16988 if (context && context.ignoreEvent(event)) { 16989 if (!wasChanged) 16990 this.selectionChanged = false; 16991 return; 16992 } 16993 if ((browser.ie && browser.ie_version <= 11 || browser.android && browser.chrome) && !view.state.selection.main.empty && // (Selection.isCollapsed isn't reliable on IE) 16994 sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) 16995 this.flushSoon(); 16996 else 16997 this.flush(false); 16998 } 16999 readSelectionRange() { 17000 let { view } = this; 17001 let range = browser.safari && view.root.nodeType == 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariSelectionRangeHack(this.view) || getSelection(view.root); 17002 if (!range || this.selectionRange.eq(range)) 17003 return false; 17004 let local = hasSelection(this.dom, range); 17005 if (local && !this.selectionChanged && view.inputState.lastFocusTime > Date.now() - 200 && view.inputState.lastTouchTime < Date.now() - 300 && atElementStart(this.dom, range)) { 17006 this.view.inputState.lastFocusTime = 0; 17007 view.docView.updateSelection(); 17008 return false; 17009 } 17010 this.selectionRange.setRange(range); 17011 if (local) 17012 this.selectionChanged = true; 17013 return true; 17014 } 17015 setSelectionRange(anchor, head) { 17016 this.selectionRange.set(anchor.node, anchor.offset, head.node, head.offset); 17017 this.selectionChanged = false; 17018 } 17019 clearSelectionRange() { 17020 this.selectionRange.set(null, 0, null, 0); 17021 } 17022 listenForScroll() { 17023 this.parentCheck = -1; 17024 let i2 = 0, changed = null; 17025 for (let dom = this.dom; dom; ) { 17026 if (dom.nodeType == 1) { 17027 if (!changed && i2 < this.scrollTargets.length && this.scrollTargets[i2] == dom) 17028 i2++; 17029 else if (!changed) 17030 changed = this.scrollTargets.slice(0, i2); 17031 if (changed) 17032 changed.push(dom); 17033 dom = dom.assignedSlot || dom.parentNode; 17034 } else if (dom.nodeType == 11) { 17035 dom = dom.host; 17036 } else { 17037 break; 17038 } 17039 } 17040 if (i2 < this.scrollTargets.length && !changed) 17041 changed = this.scrollTargets.slice(0, i2); 17042 if (changed) { 17043 for (let dom of this.scrollTargets) 17044 dom.removeEventListener("scroll", this.onScroll); 17045 for (let dom of this.scrollTargets = changed) 17046 dom.addEventListener("scroll", this.onScroll); 17047 } 17048 } 17049 ignore(f3) { 17050 if (!this.active) 17051 return f3(); 17052 try { 17053 this.stop(); 17054 return f3(); 17055 } finally { 17056 this.start(); 17057 this.clear(); 17058 } 17059 } 17060 start() { 17061 if (this.active) 17062 return; 17063 this.observer.observe(this.dom, observeOptions); 17064 if (useCharData) 17065 this.dom.addEventListener("DOMCharacterDataModified", this.onCharData); 17066 this.active = true; 17067 } 17068 stop() { 17069 if (!this.active) 17070 return; 17071 this.active = false; 17072 this.observer.disconnect(); 17073 if (useCharData) 17074 this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData); 17075 } 17076 // Throw away any pending changes 17077 clear() { 17078 this.processRecords(); 17079 this.queue.length = 0; 17080 this.selectionChanged = false; 17081 } 17082 // Chrome Android, especially in combination with GBoard, not only 17083 // doesn't reliably fire regular key events, but also often 17084 // surrounds the effect of enter or backspace with a bunch of 17085 // composition events that, when interrupted, cause text duplication 17086 // or other kinds of corruption. This hack makes the editor back off 17087 // from handling DOM changes for a moment when such a key is 17088 // detected (via beforeinput or keydown), and then tries to flush 17089 // them or, if that has no effect, dispatches the given key. 17090 delayAndroidKey(key, keyCode) { 17091 var _a3; 17092 if (!this.delayedAndroidKey) { 17093 let flush = () => { 17094 let key2 = this.delayedAndroidKey; 17095 if (key2) { 17096 this.clearDelayedAndroidKey(); 17097 this.view.inputState.lastKeyCode = key2.keyCode; 17098 this.view.inputState.lastKeyTime = Date.now(); 17099 let flushed = this.flush(); 17100 if (!flushed && key2.force) 17101 dispatchKey(this.dom, key2.key, key2.keyCode); 17102 } 17103 }; 17104 this.flushingAndroidKey = this.view.win.requestAnimationFrame(flush); 17105 } 17106 if (!this.delayedAndroidKey || key == "Enter") 17107 this.delayedAndroidKey = { 17108 key, 17109 keyCode, 17110 // Only run the key handler when no changes are detected if 17111 // this isn't coming right after another change, in which case 17112 // it is probably part of a weird chain of updates, and should 17113 // be ignored if it returns the DOM to its previous state. 17114 force: this.lastChange < Date.now() - 50 || !!((_a3 = this.delayedAndroidKey) === null || _a3 === void 0 ? void 0 : _a3.force) 17115 }; 17116 } 17117 clearDelayedAndroidKey() { 17118 this.win.cancelAnimationFrame(this.flushingAndroidKey); 17119 this.delayedAndroidKey = null; 17120 this.flushingAndroidKey = -1; 17121 } 17122 flushSoon() { 17123 if (this.delayedFlush < 0) 17124 this.delayedFlush = this.view.win.requestAnimationFrame(() => { 17125 this.delayedFlush = -1; 17126 this.flush(); 17127 }); 17128 } 17129 forceFlush() { 17130 if (this.delayedFlush >= 0) { 17131 this.view.win.cancelAnimationFrame(this.delayedFlush); 17132 this.delayedFlush = -1; 17133 } 17134 this.flush(); 17135 } 17136 pendingRecords() { 17137 for (let mut of this.observer.takeRecords()) 17138 this.queue.push(mut); 17139 return this.queue; 17140 } 17141 processRecords() { 17142 let records = this.pendingRecords(); 17143 if (records.length) 17144 this.queue = []; 17145 let from = -1, to = -1, typeOver = false; 17146 for (let record of records) { 17147 let range = this.readMutation(record); 17148 if (!range) 17149 continue; 17150 if (range.typeOver) 17151 typeOver = true; 17152 if (from == -1) { 17153 ({ from, to } = range); 17154 } else { 17155 from = Math.min(range.from, from); 17156 to = Math.max(range.to, to); 17157 } 17158 } 17159 return { from, to, typeOver }; 17160 } 17161 readChange() { 17162 let { from, to, typeOver } = this.processRecords(); 17163 let newSel = this.selectionChanged && hasSelection(this.dom, this.selectionRange); 17164 if (from < 0 && !newSel) 17165 return null; 17166 if (from > -1) 17167 this.lastChange = Date.now(); 17168 this.view.inputState.lastFocusTime = 0; 17169 this.selectionChanged = false; 17170 let change = new DOMChange(this.view, from, to, typeOver); 17171 this.view.docView.domChanged = { newSel: change.newSel ? change.newSel.main : null }; 17172 return change; 17173 } 17174 // Apply pending changes, if any 17175 flush(readSelection = true) { 17176 if (this.delayedFlush >= 0 || this.delayedAndroidKey) 17177 return false; 17178 if (readSelection) 17179 this.readSelectionRange(); 17180 let domChange = this.readChange(); 17181 if (!domChange) { 17182 this.view.requestMeasure(); 17183 return false; 17184 } 17185 let startState = this.view.state; 17186 let handled = applyDOMChange(this.view, domChange); 17187 if (this.view.state == startState) 17188 this.view.update([]); 17189 return handled; 17190 } 17191 readMutation(rec) { 17192 let cView = this.view.docView.nearest(rec.target); 17193 if (!cView || cView.ignoreMutation(rec)) 17194 return null; 17195 cView.markDirty(rec.type == "attributes"); 17196 if (rec.type == "attributes") 17197 cView.flags |= 4; 17198 if (rec.type == "childList") { 17199 let childBefore = findChild(cView, rec.previousSibling || rec.target.previousSibling, -1); 17200 let childAfter = findChild(cView, rec.nextSibling || rec.target.nextSibling, 1); 17201 return { 17202 from: childBefore ? cView.posAfter(childBefore) : cView.posAtStart, 17203 to: childAfter ? cView.posBefore(childAfter) : cView.posAtEnd, 17204 typeOver: false 17205 }; 17206 } else if (rec.type == "characterData") { 17207 return { from: cView.posAtStart, to: cView.posAtEnd, typeOver: rec.target.nodeValue == rec.oldValue }; 17208 } else { 17209 return null; 17210 } 17211 } 17212 setWindow(win) { 17213 if (win != this.win) { 17214 this.removeWindowListeners(this.win); 17215 this.win = win; 17216 this.addWindowListeners(this.win); 17217 } 17218 } 17219 addWindowListeners(win) { 17220 win.addEventListener("resize", this.onResize); 17221 win.addEventListener("beforeprint", this.onPrint); 17222 win.addEventListener("scroll", this.onScroll); 17223 win.document.addEventListener("selectionchange", this.onSelectionChange); 17224 } 17225 removeWindowListeners(win) { 17226 win.removeEventListener("scroll", this.onScroll); 17227 win.removeEventListener("resize", this.onResize); 17228 win.removeEventListener("beforeprint", this.onPrint); 17229 win.document.removeEventListener("selectionchange", this.onSelectionChange); 17230 } 17231 destroy() { 17232 var _a3, _b2, _c; 17233 this.stop(); 17234 (_a3 = this.intersection) === null || _a3 === void 0 ? void 0 : _a3.disconnect(); 17235 (_b2 = this.gapIntersection) === null || _b2 === void 0 ? void 0 : _b2.disconnect(); 17236 (_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect(); 17237 for (let dom of this.scrollTargets) 17238 dom.removeEventListener("scroll", this.onScroll); 17239 this.removeWindowListeners(this.win); 17240 clearTimeout(this.parentCheck); 17241 clearTimeout(this.resizeTimeout); 17242 this.win.cancelAnimationFrame(this.delayedFlush); 17243 this.win.cancelAnimationFrame(this.flushingAndroidKey); 17244 } 17245}; 17246function findChild(cView, dom, dir) { 17247 while (dom) { 17248 let curView = ContentView.get(dom); 17249 if (curView && curView.parent == cView) 17250 return curView; 17251 let parent = dom.parentNode; 17252 dom = parent != cView.dom ? parent : dir > 0 ? dom.nextSibling : dom.previousSibling; 17253 } 17254 return null; 17255} 17256function safariSelectionRangeHack(view) { 17257 let found = null; 17258 function read(event) { 17259 event.preventDefault(); 17260 event.stopImmediatePropagation(); 17261 found = event.getTargetRanges()[0]; 17262 } 17263 view.contentDOM.addEventListener("beforeinput", read, true); 17264 view.dom.ownerDocument.execCommand("indent"); 17265 view.contentDOM.removeEventListener("beforeinput", read, true); 17266 if (!found) 17267 return null; 17268 let anchorNode = found.startContainer, anchorOffset = found.startOffset; 17269 let focusNode = found.endContainer, focusOffset = found.endOffset; 17270 let curAnchor = view.docView.domAtPos(view.state.selection.main.anchor); 17271 if (isEquivalentPosition(curAnchor.node, curAnchor.offset, focusNode, focusOffset)) 17272 [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset]; 17273 return { anchorNode, anchorOffset, focusNode, focusOffset }; 17274} 17275var EditorView = class _EditorView { 17276 /** 17277 The current editor state. 17278 */ 17279 get state() { 17280 return this.viewState.state; 17281 } 17282 /** 17283 To be able to display large documents without consuming too much 17284 memory or overloading the browser, CodeMirror only draws the 17285 code that is visible (plus a margin around it) to the DOM. This 17286 property tells you the extent of the current drawn viewport, in 17287 document positions. 17288 */ 17289 get viewport() { 17290 return this.viewState.viewport; 17291 } 17292 /** 17293 When there are, for example, large collapsed ranges in the 17294 viewport, its size can be a lot bigger than the actual visible 17295 content. Thus, if you are doing something like styling the 17296 content in the viewport, it is preferable to only do so for 17297 these ranges, which are the subset of the viewport that is 17298 actually drawn. 17299 */ 17300 get visibleRanges() { 17301 return this.viewState.visibleRanges; 17302 } 17303 /** 17304 Returns false when the editor is entirely scrolled out of view 17305 or otherwise hidden. 17306 */ 17307 get inView() { 17308 return this.viewState.inView; 17309 } 17310 /** 17311 Indicates whether the user is currently composing text via 17312 [IME](https://en.wikipedia.org/wiki/Input_method), and at least 17313 one change has been made in the current composition. 17314 */ 17315 get composing() { 17316 return this.inputState.composing > 0; 17317 } 17318 /** 17319 Indicates whether the user is currently in composing state. Note 17320 that on some platforms, like Android, this will be the case a 17321 lot, since just putting the cursor on a word starts a 17322 composition there. 17323 */ 17324 get compositionStarted() { 17325 return this.inputState.composing >= 0; 17326 } 17327 /** 17328 The document or shadow root that the view lives in. 17329 */ 17330 get root() { 17331 return this._root; 17332 } 17333 /** 17334 @internal 17335 */ 17336 get win() { 17337 return this.dom.ownerDocument.defaultView || window; 17338 } 17339 /** 17340 Construct a new view. You'll want to either provide a `parent` 17341 option, or put `view.dom` into your document after creating a 17342 view, so that the user can see the editor. 17343 */ 17344 constructor(config2 = {}) { 17345 this.plugins = []; 17346 this.pluginMap = /* @__PURE__ */ new Map(); 17347 this.editorAttrs = {}; 17348 this.contentAttrs = {}; 17349 this.bidiCache = []; 17350 this.destroyed = false; 17351 this.updateState = 2; 17352 this.measureScheduled = -1; 17353 this.measureRequests = []; 17354 this.contentDOM = document.createElement("div"); 17355 this.scrollDOM = document.createElement("div"); 17356 this.scrollDOM.tabIndex = -1; 17357 this.scrollDOM.className = "cm-scroller"; 17358 this.scrollDOM.appendChild(this.contentDOM); 17359 this.announceDOM = document.createElement("div"); 17360 this.announceDOM.className = "cm-announced"; 17361 this.announceDOM.setAttribute("aria-live", "polite"); 17362 this.dom = document.createElement("div"); 17363 this.dom.appendChild(this.announceDOM); 17364 this.dom.appendChild(this.scrollDOM); 17365 let { dispatch } = config2; 17366 this.dispatchTransactions = config2.dispatchTransactions || dispatch && ((trs) => trs.forEach((tr) => dispatch(tr, this))) || ((trs) => this.update(trs)); 17367 this.dispatch = this.dispatch.bind(this); 17368 this._root = config2.root || getRoot(config2.parent) || document; 17369 this.viewState = new ViewState(config2.state || EditorState.create(config2)); 17370 if (config2.scrollTo && config2.scrollTo.is(scrollIntoView)) 17371 this.viewState.scrollTarget = config2.scrollTo.value.clip(this.viewState.state); 17372 this.plugins = this.state.facet(viewPlugin).map((spec) => new PluginInstance(spec)); 17373 for (let plugin of this.plugins) 17374 plugin.update(this); 17375 this.observer = new DOMObserver(this); 17376 this.inputState = new InputState(this); 17377 this.inputState.ensureHandlers(this.plugins); 17378 this.docView = new DocView(this); 17379 this.mountStyles(); 17380 this.updateAttrs(); 17381 this.updateState = 0; 17382 this.requestMeasure(); 17383 if (config2.parent) 17384 config2.parent.appendChild(this.dom); 17385 } 17386 dispatch(...input) { 17387 let trs = input.length == 1 && input[0] instanceof Transaction ? input : input.length == 1 && Array.isArray(input[0]) ? input[0] : [this.state.update(...input)]; 17388 this.dispatchTransactions(trs, this); 17389 } 17390 /** 17391 Update the view for the given array of transactions. This will 17392 update the visible document and selection to match the state 17393 produced by the transactions, and notify view plugins of the 17394 change. You should usually call 17395 [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead, which uses this 17396 as a primitive. 17397 */ 17398 update(transactions) { 17399 if (this.updateState != 0) 17400 throw new Error("Calls to EditorView.update are not allowed while an update is in progress"); 17401 let redrawn = false, attrsChanged = false, update; 17402 let state = this.state; 17403 for (let tr of transactions) { 17404 if (tr.startState != state) 17405 throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state."); 17406 state = tr.state; 17407 } 17408 if (this.destroyed) { 17409 this.viewState.state = state; 17410 return; 17411 } 17412 let focus = this.hasFocus, focusFlag = 0, dispatchFocus = null; 17413 if (transactions.some((tr) => tr.annotation(isFocusChange))) { 17414 this.inputState.notifiedFocused = focus; 17415 focusFlag = 1; 17416 } else if (focus != this.inputState.notifiedFocused) { 17417 this.inputState.notifiedFocused = focus; 17418 dispatchFocus = focusChangeTransaction(state, focus); 17419 if (!dispatchFocus) 17420 focusFlag = 1; 17421 } 17422 let pendingKey = this.observer.delayedAndroidKey, domChange = null; 17423 if (pendingKey) { 17424 this.observer.clearDelayedAndroidKey(); 17425 domChange = this.observer.readChange(); 17426 if (domChange && !this.state.doc.eq(state.doc) || !this.state.selection.eq(state.selection)) 17427 domChange = null; 17428 } else { 17429 this.observer.clear(); 17430 } 17431 if (state.facet(EditorState.phrases) != this.state.facet(EditorState.phrases)) 17432 return this.setState(state); 17433 update = ViewUpdate.create(this, state, transactions); 17434 update.flags |= focusFlag; 17435 let scrollTarget = this.viewState.scrollTarget; 17436 try { 17437 this.updateState = 2; 17438 for (let tr of transactions) { 17439 if (scrollTarget) 17440 scrollTarget = scrollTarget.map(tr.changes); 17441 if (tr.scrollIntoView) { 17442 let { main } = tr.state.selection; 17443 scrollTarget = new ScrollTarget(main.empty ? main : EditorSelection.cursor(main.head, main.head > main.anchor ? -1 : 1)); 17444 } 17445 for (let e2 of tr.effects) 17446 if (e2.is(scrollIntoView)) 17447 scrollTarget = e2.value.clip(this.state); 17448 } 17449 this.viewState.update(update, scrollTarget); 17450 this.bidiCache = CachedOrder.update(this.bidiCache, update.changes); 17451 if (!update.empty) { 17452 this.updatePlugins(update); 17453 this.inputState.update(update); 17454 } 17455 redrawn = this.docView.update(update); 17456 if (this.state.facet(styleModule) != this.styleModules) 17457 this.mountStyles(); 17458 attrsChanged = this.updateAttrs(); 17459 this.showAnnouncements(transactions); 17460 this.docView.updateSelection(redrawn, transactions.some((tr) => tr.isUserEvent("select.pointer"))); 17461 } finally { 17462 this.updateState = 0; 17463 } 17464 if (update.startState.facet(theme) != update.state.facet(theme)) 17465 this.viewState.mustMeasureContent = true; 17466 if (redrawn || attrsChanged || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) 17467 this.requestMeasure(); 17468 if (!update.empty) 17469 for (let listener of this.state.facet(updateListener)) { 17470 try { 17471 listener(update); 17472 } catch (e2) { 17473 logException(this.state, e2, "update listener"); 17474 } 17475 } 17476 if (dispatchFocus || domChange) 17477 Promise.resolve().then(() => { 17478 if (dispatchFocus && this.state == dispatchFocus.startState) 17479 this.dispatch(dispatchFocus); 17480 if (domChange) { 17481 if (!applyDOMChange(this, domChange) && pendingKey.force) 17482 dispatchKey(this.contentDOM, pendingKey.key, pendingKey.keyCode); 17483 } 17484 }); 17485 } 17486 /** 17487 Reset the view to the given state. (This will cause the entire 17488 document to be redrawn and all view plugins to be reinitialized, 17489 so you should probably only use it when the new state isn't 17490 derived from the old state. Otherwise, use 17491 [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead.) 17492 */ 17493 setState(newState) { 17494 if (this.updateState != 0) 17495 throw new Error("Calls to EditorView.setState are not allowed while an update is in progress"); 17496 if (this.destroyed) { 17497 this.viewState.state = newState; 17498 return; 17499 } 17500 this.updateState = 2; 17501 let hadFocus = this.hasFocus; 17502 try { 17503 for (let plugin of this.plugins) 17504 plugin.destroy(this); 17505 this.viewState = new ViewState(newState); 17506 this.plugins = newState.facet(viewPlugin).map((spec) => new PluginInstance(spec)); 17507 this.pluginMap.clear(); 17508 for (let plugin of this.plugins) 17509 plugin.update(this); 17510 this.docView.destroy(); 17511 this.docView = new DocView(this); 17512 this.inputState.ensureHandlers(this.plugins); 17513 this.mountStyles(); 17514 this.updateAttrs(); 17515 this.bidiCache = []; 17516 } finally { 17517 this.updateState = 0; 17518 } 17519 if (hadFocus) 17520 this.focus(); 17521 this.requestMeasure(); 17522 } 17523 updatePlugins(update) { 17524 let prevSpecs = update.startState.facet(viewPlugin), specs = update.state.facet(viewPlugin); 17525 if (prevSpecs != specs) { 17526 let newPlugins = []; 17527 for (let spec of specs) { 17528 let found = prevSpecs.indexOf(spec); 17529 if (found < 0) { 17530 newPlugins.push(new PluginInstance(spec)); 17531 } else { 17532 let plugin = this.plugins[found]; 17533 plugin.mustUpdate = update; 17534 newPlugins.push(plugin); 17535 } 17536 } 17537 for (let plugin of this.plugins) 17538 if (plugin.mustUpdate != update) 17539 plugin.destroy(this); 17540 this.plugins = newPlugins; 17541 this.pluginMap.clear(); 17542 } else { 17543 for (let p2 of this.plugins) 17544 p2.mustUpdate = update; 17545 } 17546 for (let i2 = 0; i2 < this.plugins.length; i2++) 17547 this.plugins[i2].update(this); 17548 if (prevSpecs != specs) 17549 this.inputState.ensureHandlers(this.plugins); 17550 } 17551 /** 17552 @internal 17553 */ 17554 measure(flush = true) { 17555 if (this.destroyed) 17556 return; 17557 if (this.measureScheduled > -1) 17558 this.win.cancelAnimationFrame(this.measureScheduled); 17559 if (this.observer.delayedAndroidKey) { 17560 this.measureScheduled = -1; 17561 this.requestMeasure(); 17562 return; 17563 } 17564 this.measureScheduled = 0; 17565 if (flush) 17566 this.observer.forceFlush(); 17567 let updated = null; 17568 let sDOM = this.scrollDOM, scrollTop = sDOM.scrollTop * this.scaleY; 17569 let { scrollAnchorPos, scrollAnchorHeight } = this.viewState; 17570 if (Math.abs(scrollTop - this.viewState.scrollTop) > 1) 17571 scrollAnchorHeight = -1; 17572 this.viewState.scrollAnchorHeight = -1; 17573 try { 17574 for (let i2 = 0; ; i2++) { 17575 if (scrollAnchorHeight < 0) { 17576 if (isScrolledToBottom(sDOM)) { 17577 scrollAnchorPos = -1; 17578 scrollAnchorHeight = this.viewState.heightMap.height; 17579 } else { 17580 let block2 = this.viewState.scrollAnchorAt(scrollTop); 17581 scrollAnchorPos = block2.from; 17582 scrollAnchorHeight = block2.top; 17583 } 17584 } 17585 this.updateState = 1; 17586 let changed = this.viewState.measure(this); 17587 if (!changed && !this.measureRequests.length && this.viewState.scrollTarget == null) 17588 break; 17589 if (i2 > 5) { 17590 console.warn(this.measureRequests.length ? "Measure loop restarted more than 5 times" : "Viewport failed to stabilize"); 17591 break; 17592 } 17593 let measuring = []; 17594 if (!(changed & 4)) 17595 [this.measureRequests, measuring] = [measuring, this.measureRequests]; 17596 let measured = measuring.map((m2) => { 17597 try { 17598 return m2.read(this); 17599 } catch (e2) { 17600 logException(this.state, e2); 17601 return BadMeasure; 17602 } 17603 }); 17604 let update = ViewUpdate.create(this, this.state, []), redrawn = false; 17605 update.flags |= changed; 17606 if (!updated) 17607 updated = update; 17608 else 17609 updated.flags |= changed; 17610 this.updateState = 2; 17611 if (!update.empty) { 17612 this.updatePlugins(update); 17613 this.inputState.update(update); 17614 this.updateAttrs(); 17615 redrawn = this.docView.update(update); 17616 } 17617 for (let i3 = 0; i3 < measuring.length; i3++) 17618 if (measured[i3] != BadMeasure) { 17619 try { 17620 let m2 = measuring[i3]; 17621 if (m2.write) 17622 m2.write(measured[i3], this); 17623 } catch (e2) { 17624 logException(this.state, e2); 17625 } 17626 } 17627 if (redrawn) 17628 this.docView.updateSelection(true); 17629 if (!update.viewportChanged && this.measureRequests.length == 0) { 17630 if (this.viewState.editorHeight) { 17631 if (this.viewState.scrollTarget) { 17632 this.docView.scrollIntoView(this.viewState.scrollTarget); 17633 this.viewState.scrollTarget = null; 17634 continue; 17635 } else { 17636 let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(scrollAnchorPos).top; 17637 let diff = newAnchorHeight - scrollAnchorHeight; 17638 if (diff > 1 || diff < -1) { 17639 scrollTop = scrollTop + diff; 17640 sDOM.scrollTop = scrollTop / this.scaleY; 17641 scrollAnchorHeight = -1; 17642 continue; 17643 } 17644 } 17645 } 17646 break; 17647 } 17648 } 17649 } finally { 17650 this.updateState = 0; 17651 this.measureScheduled = -1; 17652 } 17653 if (updated && !updated.empty) 17654 for (let listener of this.state.facet(updateListener)) 17655 listener(updated); 17656 } 17657 /** 17658 Get the CSS classes for the currently active editor themes. 17659 */ 17660 get themeClasses() { 17661 return baseThemeID + " " + (this.state.facet(darkTheme) ? baseDarkID : baseLightID) + " " + this.state.facet(theme); 17662 } 17663 updateAttrs() { 17664 let editorAttrs = attrsFromFacet(this, editorAttributes, { 17665 class: "cm-editor" + (this.hasFocus ? " cm-focused " : " ") + this.themeClasses 17666 }); 17667 let contentAttrs = { 17668 spellcheck: "false", 17669 autocorrect: "off", 17670 autocapitalize: "off", 17671 translate: "no", 17672 contenteditable: !this.state.facet(editable) ? "false" : "true", 17673 class: "cm-content", 17674 style: `${browser.tabSize}: ${this.state.tabSize}`, 17675 role: "textbox", 17676 "aria-multiline": "true" 17677 }; 17678 if (this.state.readOnly) 17679 contentAttrs["aria-readonly"] = "true"; 17680 attrsFromFacet(this, contentAttributes, contentAttrs); 17681 let changed = this.observer.ignore(() => { 17682 let changedContent = updateAttrs(this.contentDOM, this.contentAttrs, contentAttrs); 17683 let changedEditor = updateAttrs(this.dom, this.editorAttrs, editorAttrs); 17684 return changedContent || changedEditor; 17685 }); 17686 this.editorAttrs = editorAttrs; 17687 this.contentAttrs = contentAttrs; 17688 return changed; 17689 } 17690 showAnnouncements(trs) { 17691 let first = true; 17692 for (let tr of trs) 17693 for (let effect of tr.effects) 17694 if (effect.is(_EditorView.announce)) { 17695 if (first) 17696 this.announceDOM.textContent = ""; 17697 first = false; 17698 let div = this.announceDOM.appendChild(document.createElement("div")); 17699 div.textContent = effect.value; 17700 } 17701 } 17702 mountStyles() { 17703 this.styleModules = this.state.facet(styleModule); 17704 let nonce = this.state.facet(_EditorView.cspNonce); 17705 StyleModule.mount(this.root, this.styleModules.concat(baseTheme$1).reverse(), nonce ? { nonce } : void 0); 17706 } 17707 readMeasured() { 17708 if (this.updateState == 2) 17709 throw new Error("Reading the editor layout isn't allowed during an update"); 17710 if (this.updateState == 0 && this.measureScheduled > -1) 17711 this.measure(false); 17712 } 17713 /** 17714 Schedule a layout measurement, optionally providing callbacks to 17715 do custom DOM measuring followed by a DOM write phase. Using 17716 this is preferable reading DOM layout directly from, for 17717 example, an event handler, because it'll make sure measuring and 17718 drawing done by other components is synchronized, avoiding 17719 unnecessary DOM layout computations. 17720 */ 17721 requestMeasure(request) { 17722 if (this.measureScheduled < 0) 17723 this.measureScheduled = this.win.requestAnimationFrame(() => this.measure()); 17724 if (request) { 17725 if (this.measureRequests.indexOf(request) > -1) 17726 return; 17727 if (request.key != null) 17728 for (let i2 = 0; i2 < this.measureRequests.length; i2++) { 17729 if (this.measureRequests[i2].key === request.key) { 17730 this.measureRequests[i2] = request; 17731 return; 17732 } 17733 } 17734 this.measureRequests.push(request); 17735 } 17736 } 17737 /** 17738 Get the value of a specific plugin, if present. Note that 17739 plugins that crash can be dropped from a view, so even when you 17740 know you registered a given plugin, it is recommended to check 17741 the return value of this method. 17742 */ 17743 plugin(plugin) { 17744 let known = this.pluginMap.get(plugin); 17745 if (known === void 0 || known && known.spec != plugin) 17746 this.pluginMap.set(plugin, known = this.plugins.find((p2) => p2.spec == plugin) || null); 17747 return known && known.update(this).value; 17748 } 17749 /** 17750 The top position of the document, in screen coordinates. This 17751 may be negative when the editor is scrolled down. Points 17752 directly to the top of the first line, not above the padding. 17753 */ 17754 get documentTop() { 17755 return this.contentDOM.getBoundingClientRect().top + this.viewState.paddingTop; 17756 } 17757 /** 17758 Reports the padding above and below the document. 17759 */ 17760 get documentPadding() { 17761 return { top: this.viewState.paddingTop, bottom: this.viewState.paddingBottom }; 17762 } 17763 /** 17764 If the editor is transformed with CSS, this provides the scale 17765 along the X axis. Otherwise, it will just be 1. Note that 17766 transforms other than translation and scaling are not supported. 17767 */ 17768 get scaleX() { 17769 return this.viewState.scaleX; 17770 } 17771 /** 17772 Provide the CSS transformed scale along the Y axis. 17773 */ 17774 get scaleY() { 17775 return this.viewState.scaleY; 17776 } 17777 /** 17778 Find the text line or block widget at the given vertical 17779 position (which is interpreted as relative to the [top of the 17780 document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)). 17781 */ 17782 elementAtHeight(height) { 17783 this.readMeasured(); 17784 return this.viewState.elementAtHeight(height); 17785 } 17786 /** 17787 Find the line block (see 17788 [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given 17789 height, again interpreted relative to the [top of the 17790 document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop). 17791 */ 17792 lineBlockAtHeight(height) { 17793 this.readMeasured(); 17794 return this.viewState.lineBlockAtHeight(height); 17795 } 17796 /** 17797 Get the extent and vertical position of all [line 17798 blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions 17799 are relative to the [top of the 17800 document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop); 17801 */ 17802 get viewportLineBlocks() { 17803 return this.viewState.viewportLines; 17804 } 17805 /** 17806 Find the line block around the given document position. A line 17807 block is a range delimited on both sides by either a 17808 non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the 17809 start/end of the document. It will usually just hold a line of 17810 text, but may be broken into multiple textblocks by block 17811 widgets. 17812 */ 17813 lineBlockAt(pos) { 17814 return this.viewState.lineBlockAt(pos); 17815 } 17816 /** 17817 The editor's total content height. 17818 */ 17819 get contentHeight() { 17820 return this.viewState.contentHeight; 17821 } 17822 /** 17823 Move a cursor position by [grapheme 17824 cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak). `forward` determines whether 17825 the motion is away from the line start, or towards it. In 17826 bidirectional text, the line is traversed in visual order, using 17827 the editor's [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). 17828 When the start position was the last one on the line, the 17829 returned position will be across the line break. If there is no 17830 further line, the original position is returned. 17831 17832 By default, this method moves over a single cluster. The 17833 optional `by` argument can be used to move across more. It will 17834 be called with the first cluster as argument, and should return 17835 a predicate that determines, for each subsequent cluster, 17836 whether it should also be moved over. 17837 */ 17838 moveByChar(start, forward, by) { 17839 return skipAtoms(this, start, moveByChar(this, start, forward, by)); 17840 } 17841 /** 17842 Move a cursor position across the next group of either 17843 [letters](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) or non-letter 17844 non-whitespace characters. 17845 */ 17846 moveByGroup(start, forward) { 17847 return skipAtoms(this, start, moveByChar(this, start, forward, (initial) => byGroup(this, start.head, initial))); 17848 } 17849 /** 17850 Move to the next line boundary in the given direction. If 17851 `includeWrap` is true, line wrapping is on, and there is a 17852 further wrap point on the current line, the wrap point will be 17853 returned. Otherwise this function will return the start or end 17854 of the line. 17855 */ 17856 moveToLineBoundary(start, forward, includeWrap = true) { 17857 return moveToLineBoundary(this, start, forward, includeWrap); 17858 } 17859 /** 17860 Move a cursor position vertically. When `distance` isn't given, 17861 it defaults to moving to the next line (including wrapped 17862 lines). Otherwise, `distance` should provide a positive distance 17863 in pixels. 17864 17865 When `start` has a 17866 [`goalColumn`](https://codemirror.net/6/docs/ref/#state.SelectionRange.goalColumn), the vertical 17867 motion will use that as a target horizontal position. Otherwise, 17868 the cursor's own horizontal position is used. The returned 17869 cursor will have its goal column set to whichever column was 17870 used. 17871 */ 17872 moveVertically(start, forward, distance) { 17873 return skipAtoms(this, start, moveVertically(this, start, forward, distance)); 17874 } 17875 /** 17876 Find the DOM parent node and offset (child offset if `node` is 17877 an element, character offset when it is a text node) at the 17878 given document position. 17879 17880 Note that for positions that aren't currently in 17881 `visibleRanges`, the resulting DOM position isn't necessarily 17882 meaningful (it may just point before or after a placeholder 17883 element). 17884 */ 17885 domAtPos(pos) { 17886 return this.docView.domAtPos(pos); 17887 } 17888 /** 17889 Find the document position at the given DOM node. Can be useful 17890 for associating positions with DOM events. Will raise an error 17891 when `node` isn't part of the editor content. 17892 */ 17893 posAtDOM(node, offset = 0) { 17894 return this.docView.posFromDOM(node, offset); 17895 } 17896 posAtCoords(coords, precise = true) { 17897 this.readMeasured(); 17898 return posAtCoords(this, coords, precise); 17899 } 17900 /** 17901 Get the screen coordinates at the given document position. 17902 `side` determines whether the coordinates are based on the 17903 element before (-1) or after (1) the position (if no element is 17904 available on the given side, the method will transparently use 17905 another strategy to get reasonable coordinates). 17906 */ 17907 coordsAtPos(pos, side = 1) { 17908 this.readMeasured(); 17909 let rect = this.docView.coordsAt(pos, side); 17910 if (!rect || rect.left == rect.right) 17911 return rect; 17912 let line = this.state.doc.lineAt(pos), order = this.bidiSpans(line); 17913 let span = order[BidiSpan.find(order, pos - line.from, -1, side)]; 17914 return flattenRect(rect, span.dir == Direction.LTR == side > 0); 17915 } 17916 /** 17917 Return the rectangle around a given character. If `pos` does not 17918 point in front of a character that is in the viewport and 17919 rendered (i.e. not replaced, not a line break), this will return 17920 null. For space characters that are a line wrap point, this will 17921 return the position before the line break. 17922 */ 17923 coordsForChar(pos) { 17924 this.readMeasured(); 17925 return this.docView.coordsForChar(pos); 17926 } 17927 /** 17928 The default width of a character in the editor. May not 17929 accurately reflect the width of all characters (given variable 17930 width fonts or styling of invididual ranges). 17931 */ 17932 get defaultCharacterWidth() { 17933 return this.viewState.heightOracle.charWidth; 17934 } 17935 /** 17936 The default height of a line in the editor. May not be accurate 17937 for all lines. 17938 */ 17939 get defaultLineHeight() { 17940 return this.viewState.heightOracle.lineHeight; 17941 } 17942 /** 17943 The text direction 17944 ([`direction`](https://developer.mozilla.org/en-US/docs/Web/CSS/direction) 17945 CSS property) of the editor's content element. 17946 */ 17947 get textDirection() { 17948 return this.viewState.defaultTextDirection; 17949 } 17950 /** 17951 Find the text direction of the block at the given position, as 17952 assigned by CSS. If 17953 [`perLineTextDirection`](https://codemirror.net/6/docs/ref/#view.EditorView^perLineTextDirection) 17954 isn't enabled, or the given position is outside of the viewport, 17955 this will always return the same as 17956 [`textDirection`](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). Note that 17957 this may trigger a DOM layout. 17958 */ 17959 textDirectionAt(pos) { 17960 let perLine = this.state.facet(perLineTextDirection); 17961 if (!perLine || pos < this.viewport.from || pos > this.viewport.to) 17962 return this.textDirection; 17963 this.readMeasured(); 17964 return this.docView.textDirectionAt(pos); 17965 } 17966 /** 17967 Whether this editor [wraps lines](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping) 17968 (as determined by the 17969 [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) 17970 CSS property of its content element). 17971 */ 17972 get lineWrapping() { 17973 return this.viewState.heightOracle.lineWrapping; 17974 } 17975 /** 17976 Returns the bidirectional text structure of the given line 17977 (which should be in the current document) as an array of span 17978 objects. The order of these spans matches the [text 17979 direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection)—if that is 17980 left-to-right, the leftmost spans come first, otherwise the 17981 rightmost spans come first. 17982 */ 17983 bidiSpans(line) { 17984 if (line.length > MaxBidiLine) 17985 return trivialOrder(line.length); 17986 let dir = this.textDirectionAt(line.from), isolates; 17987 for (let entry of this.bidiCache) { 17988 if (entry.from == line.from && entry.dir == dir && (entry.fresh || isolatesEq(entry.isolates, isolates = getIsolatedRanges(this, line.from, line.to)))) 17989 return entry.order; 17990 } 17991 if (!isolates) 17992 isolates = getIsolatedRanges(this, line.from, line.to); 17993 let order = computeOrder(line.text, dir, isolates); 17994 this.bidiCache.push(new CachedOrder(line.from, line.to, dir, isolates, true, order)); 17995 return order; 17996 } 17997 /** 17998 Check whether the editor has focus. 17999 */ 18000 get hasFocus() { 18001 var _a3; 18002 return (this.dom.ownerDocument.hasFocus() || browser.safari && ((_a3 = this.inputState) === null || _a3 === void 0 ? void 0 : _a3.lastContextMenu) > Date.now() - 3e4) && this.root.activeElement == this.contentDOM; 18003 } 18004 /** 18005 Put focus on the editor. 18006 */ 18007 focus() { 18008 this.observer.ignore(() => { 18009 focusPreventScroll(this.contentDOM); 18010 this.docView.updateSelection(); 18011 }); 18012 } 18013 /** 18014 Update the [root](https://codemirror.net/6/docs/ref/##view.EditorViewConfig.root) in which the editor lives. This is only 18015 necessary when moving the editor's existing DOM to a new window or shadow root. 18016 */ 18017 setRoot(root) { 18018 if (this._root != root) { 18019 this._root = root; 18020 this.observer.setWindow((root.nodeType == 9 ? root : root.ownerDocument).defaultView || window); 18021 this.mountStyles(); 18022 } 18023 } 18024 /** 18025 Clean up this editor view, removing its element from the 18026 document, unregistering event handlers, and notifying 18027 plugins. The view instance can no longer be used after 18028 calling this. 18029 */ 18030 destroy() { 18031 for (let plugin of this.plugins) 18032 plugin.destroy(this); 18033 this.plugins = []; 18034 this.inputState.destroy(); 18035 this.docView.destroy(); 18036 this.dom.remove(); 18037 this.observer.destroy(); 18038 if (this.measureScheduled > -1) 18039 this.win.cancelAnimationFrame(this.measureScheduled); 18040 this.destroyed = true; 18041 } 18042 /** 18043 Returns an effect that can be 18044 [added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to 18045 cause it to scroll the given position or range into view. 18046 */ 18047 static scrollIntoView(pos, options2 = {}) { 18048 return scrollIntoView.of(new ScrollTarget(typeof pos == "number" ? EditorSelection.cursor(pos) : pos, options2.y, options2.x, options2.yMargin, options2.xMargin)); 18049 } 18050 /** 18051 Return an effect that resets the editor to its current (at the 18052 time this method was called) scroll position. Note that this 18053 only affects the editor's own scrollable element, not parents. 18054 See also 18055 [`EditorViewConfig.scrollTo`](https://codemirror.net/6/docs/ref/#view.EditorViewConfig.scrollTo). 18056 18057 The effect should be used with a document identical to the one 18058 it was created for. Failing to do so is not an error, but may 18059 not scroll to the expected position. You can 18060 [map](https://codemirror.net/6/docs/ref/#state.StateEffect.map) the effect to account for changes. 18061 */ 18062 scrollSnapshot() { 18063 let { scrollTop, scrollLeft } = this.scrollDOM; 18064 let ref = this.viewState.scrollAnchorAt(scrollTop); 18065 return scrollIntoView.of(new ScrollTarget(EditorSelection.cursor(ref.from), "start", "start", ref.top - scrollTop, scrollLeft, true)); 18066 } 18067 /** 18068 Returns an extension that can be used to add DOM event handlers. 18069 The value should be an object mapping event names to handler 18070 functions. For any given event, such functions are ordered by 18071 extension precedence, and the first handler to return true will 18072 be assumed to have handled that event, and no other handlers or 18073 built-in behavior will be activated for it. These are registered 18074 on the [content element](https://codemirror.net/6/docs/ref/#view.EditorView.contentDOM), except 18075 for `scroll` handlers, which will be called any time the 18076 editor's [scroll element](https://codemirror.net/6/docs/ref/#view.EditorView.scrollDOM) or one of 18077 its parent nodes is scrolled. 18078 */ 18079 static domEventHandlers(handlers2) { 18080 return ViewPlugin.define(() => ({}), { eventHandlers: handlers2 }); 18081 } 18082 /** 18083 Create an extension that registers DOM event observers. Contrary 18084 to event [handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers), 18085 observers can't be prevented from running by a higher-precedence 18086 handler returning true. They also don't prevent other handlers 18087 and observers from running when they return true, and should not 18088 call `preventDefault`. 18089 */ 18090 static domEventObservers(observers2) { 18091 return ViewPlugin.define(() => ({}), { eventObservers: observers2 }); 18092 } 18093 /** 18094 Create a theme extension. The first argument can be a 18095 [`style-mod`](https://github.com/marijnh/style-mod#documentation) 18096 style spec providing the styles for the theme. These will be 18097 prefixed with a generated class for the style. 18098 18099 Because the selectors will be prefixed with a scope class, rule 18100 that directly match the editor's [wrapper 18101 element](https://codemirror.net/6/docs/ref/#view.EditorView.dom)—to which the scope class will be 18102 added—need to be explicitly differentiated by adding an `&` to 18103 the selector for that element—for example 18104 `&.cm-focused`. 18105 18106 When `dark` is set to true, the theme will be marked as dark, 18107 which will cause the `&dark` rules from [base 18108 themes](https://codemirror.net/6/docs/ref/#view.EditorView^baseTheme) to be used (as opposed to 18109 `&light` when a light theme is active). 18110 */ 18111 static theme(spec, options2) { 18112 let prefix = StyleModule.newName(); 18113 let result = [theme.of(prefix), styleModule.of(buildTheme(`.${prefix}`, spec))]; 18114 if (options2 && options2.dark) 18115 result.push(darkTheme.of(true)); 18116 return result; 18117 } 18118 /** 18119 Create an extension that adds styles to the base theme. Like 18120 with [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme), use `&` to indicate the 18121 place of the editor wrapper element when directly targeting 18122 that. You can also use `&dark` or `&light` instead to only 18123 target editors with a dark or light theme. 18124 */ 18125 static baseTheme(spec) { 18126 return Prec.lowest(styleModule.of(buildTheme("." + baseThemeID, spec, lightDarkIDs))); 18127 } 18128 /** 18129 Retrieve an editor view instance from the view's DOM 18130 representation. 18131 */ 18132 static findFromDOM(dom) { 18133 var _a3; 18134 let content2 = dom.querySelector(".cm-content"); 18135 let cView = content2 && ContentView.get(content2) || ContentView.get(dom); 18136 return ((_a3 = cView === null || cView === void 0 ? void 0 : cView.rootView) === null || _a3 === void 0 ? void 0 : _a3.view) || null; 18137 } 18138}; 18139EditorView.styleModule = styleModule; 18140EditorView.inputHandler = inputHandler; 18141EditorView.focusChangeEffect = focusChangeEffect; 18142EditorView.perLineTextDirection = perLineTextDirection; 18143EditorView.exceptionSink = exceptionSink; 18144EditorView.updateListener = updateListener; 18145EditorView.editable = editable; 18146EditorView.mouseSelectionStyle = mouseSelectionStyle; 18147EditorView.dragMovesSelection = dragMovesSelection$1; 18148EditorView.clickAddsSelectionRange = clickAddsSelectionRange; 18149EditorView.decorations = decorations; 18150EditorView.atomicRanges = atomicRanges; 18151EditorView.bidiIsolatedRanges = bidiIsolatedRanges; 18152EditorView.scrollMargins = scrollMargins; 18153EditorView.darkTheme = darkTheme; 18154EditorView.cspNonce = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : "" }); 18155EditorView.contentAttributes = contentAttributes; 18156EditorView.editorAttributes = editorAttributes; 18157EditorView.lineWrapping = /* @__PURE__ */ EditorView.contentAttributes.of({ "class": "cm-lineWrapping" }); 18158EditorView.announce = /* @__PURE__ */ StateEffect.define(); 18159var MaxBidiLine = 4096; 18160var BadMeasure = {}; 18161var CachedOrder = class _CachedOrder { 18162 constructor(from, to, dir, isolates, fresh, order) { 18163 this.from = from; 18164 this.to = to; 18165 this.dir = dir; 18166 this.isolates = isolates; 18167 this.fresh = fresh; 18168 this.order = order; 18169 } 18170 static update(cache3, changes) { 18171 if (changes.empty && !cache3.some((c2) => c2.fresh)) 18172 return cache3; 18173 let result = [], lastDir = cache3.length ? cache3[cache3.length - 1].dir : Direction.LTR; 18174 for (let i2 = Math.max(0, cache3.length - 10); i2 < cache3.length; i2++) { 18175 let entry = cache3[i2]; 18176 if (entry.dir == lastDir && !changes.touchesRange(entry.from, entry.to)) 18177 result.push(new _CachedOrder(changes.mapPos(entry.from, 1), changes.mapPos(entry.to, -1), entry.dir, entry.isolates, false, entry.order)); 18178 } 18179 return result; 18180 } 18181}; 18182function attrsFromFacet(view, facet, base2) { 18183 for (let sources = view.state.facet(facet), i2 = sources.length - 1; i2 >= 0; i2--) { 18184 let source = sources[i2], value = typeof source == "function" ? source(view) : source; 18185 if (value) 18186 combineAttrs(value, base2); 18187 } 18188 return base2; 18189} 18190var currentPlatform = browser.mac ? "mac" : browser.windows ? "win" : browser.linux ? "linux" : "key"; 18191function normalizeKeyName(name2, platform) { 18192 const parts = name2.split(/-(?!$)/); 18193 let result = parts[parts.length - 1]; 18194 if (result == "Space") 18195 result = " "; 18196 let alt, ctrl, shift2, meta2; 18197 for (let i2 = 0; i2 < parts.length - 1; ++i2) { 18198 const mod = parts[i2]; 18199 if (/^(cmd|meta|m)$/i.test(mod)) 18200 meta2 = true; 18201 else if (/^a(lt)?$/i.test(mod)) 18202 alt = true; 18203 else if (/^(c|ctrl|control)$/i.test(mod)) 18204 ctrl = true; 18205 else if (/^s(hift)?$/i.test(mod)) 18206 shift2 = true; 18207 else if (/^mod$/i.test(mod)) { 18208 if (platform == "mac") 18209 meta2 = true; 18210 else 18211 ctrl = true; 18212 } else 18213 throw new Error("Unrecognized modifier name: " + mod); 18214 } 18215 if (alt) 18216 result = "Alt-" + result; 18217 if (ctrl) 18218 result = "Ctrl-" + result; 18219 if (meta2) 18220 result = "Meta-" + result; 18221 if (shift2) 18222 result = "Shift-" + result; 18223 return result; 18224} 18225function modifiers(name2, event, shift2) { 18226 if (event.altKey) 18227 name2 = "Alt-" + name2; 18228 if (event.ctrlKey) 18229 name2 = "Ctrl-" + name2; 18230 if (event.metaKey) 18231 name2 = "Meta-" + name2; 18232 if (shift2 !== false && event.shiftKey) 18233 name2 = "Shift-" + name2; 18234 return name2; 18235} 18236var handleKeyEvents = /* @__PURE__ */ Prec.default(/* @__PURE__ */ EditorView.domEventHandlers({ 18237 keydown(event, view) { 18238 return runHandlers(getKeymap(view.state), event, view, "editor"); 18239 } 18240})); 18241var keymap = /* @__PURE__ */ Facet.define({ enables: handleKeyEvents }); 18242var Keymaps = /* @__PURE__ */ new WeakMap(); 18243function getKeymap(state) { 18244 let bindings = state.facet(keymap); 18245 let map = Keymaps.get(bindings); 18246 if (!map) 18247 Keymaps.set(bindings, map = buildKeymap(bindings.reduce((a2, b3) => a2.concat(b3), []))); 18248 return map; 18249} 18250function runScopeHandlers(view, event, scope) { 18251 return runHandlers(getKeymap(view.state), event, view, scope); 18252} 18253var storedPrefix = null; 18254var PrefixTimeout = 4e3; 18255function buildKeymap(bindings, platform = currentPlatform) { 18256 let bound = /* @__PURE__ */ Object.create(null); 18257 let isPrefix = /* @__PURE__ */ Object.create(null); 18258 let checkPrefix = (name2, is) => { 18259 let current = isPrefix[name2]; 18260 if (current == null) 18261 isPrefix[name2] = is; 18262 else if (current != is) 18263 throw new Error("Key binding " + name2 + " is used both as a regular binding and as a multi-stroke prefix"); 18264 }; 18265 let add2 = (scope, key, command2, preventDefault, stopPropagation) => { 18266 var _a3, _b2; 18267 let scopeObj = bound[scope] || (bound[scope] = /* @__PURE__ */ Object.create(null)); 18268 let parts = key.split(/ (?!$)/).map((k) => normalizeKeyName(k, platform)); 18269 for (let i2 = 1; i2 < parts.length; i2++) { 18270 let prefix = parts.slice(0, i2).join(" "); 18271 checkPrefix(prefix, true); 18272 if (!scopeObj[prefix]) 18273 scopeObj[prefix] = { 18274 preventDefault: true, 18275 stopPropagation: false, 18276 run: [(view) => { 18277 let ourObj = storedPrefix = { view, prefix, scope }; 18278 setTimeout(() => { 18279 if (storedPrefix == ourObj) 18280 storedPrefix = null; 18281 }, PrefixTimeout); 18282 return true; 18283 }] 18284 }; 18285 } 18286 let full = parts.join(" "); 18287 checkPrefix(full, false); 18288 let binding = scopeObj[full] || (scopeObj[full] = { 18289 preventDefault: false, 18290 stopPropagation: false, 18291 run: ((_b2 = (_a3 = scopeObj._any) === null || _a3 === void 0 ? void 0 : _a3.run) === null || _b2 === void 0 ? void 0 : _b2.slice()) || [] 18292 }); 18293 if (command2) 18294 binding.run.push(command2); 18295 if (preventDefault) 18296 binding.preventDefault = true; 18297 if (stopPropagation) 18298 binding.stopPropagation = true; 18299 }; 18300 for (let b3 of bindings) { 18301 let scopes = b3.scope ? b3.scope.split(" ") : ["editor"]; 18302 if (b3.any) 18303 for (let scope of scopes) { 18304 let scopeObj = bound[scope] || (bound[scope] = /* @__PURE__ */ Object.create(null)); 18305 if (!scopeObj._any) 18306 scopeObj._any = { preventDefault: false, stopPropagation: false, run: [] }; 18307 for (let key in scopeObj) 18308 scopeObj[key].run.push(b3.any); 18309 } 18310 let name2 = b3[platform] || b3.key; 18311 if (!name2) 18312 continue; 18313 for (let scope of scopes) { 18314 add2(scope, name2, b3.run, b3.preventDefault, b3.stopPropagation); 18315 if (b3.shift) 18316 add2(scope, "Shift-" + name2, b3.shift, b3.preventDefault, b3.stopPropagation); 18317 } 18318 } 18319 return bound; 18320} 18321function runHandlers(map, event, view, scope) { 18322 let name2 = keyName(event); 18323 let charCode = codePointAt(name2, 0), isChar = codePointSize(charCode) == name2.length && name2 != " "; 18324 let prefix = "", handled = false, prevented = false, stopPropagation = false; 18325 if (storedPrefix && storedPrefix.view == view && storedPrefix.scope == scope) { 18326 prefix = storedPrefix.prefix + " "; 18327 if (modifierCodes.indexOf(event.keyCode) < 0) { 18328 prevented = true; 18329 storedPrefix = null; 18330 } 18331 } 18332 let ran = /* @__PURE__ */ new Set(); 18333 let runFor = (binding) => { 18334 if (binding) { 18335 for (let cmd2 of binding.run) 18336 if (!ran.has(cmd2)) { 18337 ran.add(cmd2); 18338 if (cmd2(view, event)) { 18339 if (binding.stopPropagation) 18340 stopPropagation = true; 18341 return true; 18342 } 18343 } 18344 if (binding.preventDefault) { 18345 if (binding.stopPropagation) 18346 stopPropagation = true; 18347 prevented = true; 18348 } 18349 } 18350 return false; 18351 }; 18352 let scopeObj = map[scope], baseName, shiftName; 18353 if (scopeObj) { 18354 if (runFor(scopeObj[prefix + modifiers(name2, event, !isChar)])) { 18355 handled = true; 18356 } else if (isChar && (event.altKey || event.metaKey || event.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows 18357 !(browser.windows && event.ctrlKey && event.altKey) && (baseName = base[event.keyCode]) && baseName != name2) { 18358 if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) { 18359 handled = true; 18360 } else if (event.shiftKey && (shiftName = shift[event.keyCode]) != name2 && shiftName != baseName && runFor(scopeObj[prefix + modifiers(shiftName, event, false)])) { 18361 handled = true; 18362 } 18363 } else if (isChar && event.shiftKey && runFor(scopeObj[prefix + modifiers(name2, event, true)])) { 18364 handled = true; 18365 } 18366 if (!handled && runFor(scopeObj._any)) 18367 handled = true; 18368 } 18369 if (prevented) 18370 handled = true; 18371 if (handled && stopPropagation) 18372 event.stopPropagation(); 18373 return handled; 18374} 18375var RectangleMarker = class _RectangleMarker { 18376 /** 18377 Create a marker with the given class and dimensions. If `width` 18378 is null, the DOM element will get no width style. 18379 */ 18380 constructor(className, left, top2, width, height) { 18381 this.className = className; 18382 this.left = left; 18383 this.top = top2; 18384 this.width = width; 18385 this.height = height; 18386 } 18387 draw() { 18388 let elt = document.createElement("div"); 18389 elt.className = this.className; 18390 this.adjust(elt); 18391 return elt; 18392 } 18393 update(elt, prev) { 18394 if (prev.className != this.className) 18395 return false; 18396 this.adjust(elt); 18397 return true; 18398 } 18399 adjust(elt) { 18400 elt.style.left = this.left + "px"; 18401 elt.style.top = this.top + "px"; 18402 if (this.width != null) 18403 elt.style.width = this.width + "px"; 18404 elt.style.height = this.height + "px"; 18405 } 18406 eq(p2) { 18407 return this.left == p2.left && this.top == p2.top && this.width == p2.width && this.height == p2.height && this.className == p2.className; 18408 } 18409 /** 18410 Create a set of rectangles for the given selection range, 18411 assigning them theclass`className`. Will create a single 18412 rectangle for empty ranges, and a set of selection-style 18413 rectangles covering the range's content (in a bidi-aware 18414 way) for non-empty ones. 18415 */ 18416 static forRange(view, className, range) { 18417 if (range.empty) { 18418 let pos = view.coordsAtPos(range.head, range.assoc || 1); 18419 if (!pos) 18420 return []; 18421 let base2 = getBase(view); 18422 return [new _RectangleMarker(className, pos.left - base2.left, pos.top - base2.top, null, pos.bottom - pos.top)]; 18423 } else { 18424 return rectanglesForRange(view, className, range); 18425 } 18426 } 18427}; 18428function getBase(view) { 18429 let rect = view.scrollDOM.getBoundingClientRect(); 18430 let left = view.textDirection == Direction.LTR ? rect.left : rect.right - view.scrollDOM.clientWidth * view.scaleX; 18431 return { left: left - view.scrollDOM.scrollLeft * view.scaleX, top: rect.top - view.scrollDOM.scrollTop * view.scaleY }; 18432} 18433function wrappedLine(view, pos, inside2) { 18434 let range = EditorSelection.cursor(pos); 18435 return { 18436 from: Math.max(inside2.from, view.moveToLineBoundary(range, false, true).from), 18437 to: Math.min(inside2.to, view.moveToLineBoundary(range, true, true).from), 18438 type: BlockType.Text 18439 }; 18440} 18441function rectanglesForRange(view, className, range) { 18442 if (range.to <= view.viewport.from || range.from >= view.viewport.to) 18443 return []; 18444 let from = Math.max(range.from, view.viewport.from), to = Math.min(range.to, view.viewport.to); 18445 let ltr = view.textDirection == Direction.LTR; 18446 let content2 = view.contentDOM, contentRect = content2.getBoundingClientRect(), base2 = getBase(view); 18447 let lineElt = content2.querySelector(".cm-line"), lineStyle = lineElt && window.getComputedStyle(lineElt); 18448 let leftSide = contentRect.left + (lineStyle ? parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent)) : 0); 18449 let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0); 18450 let startBlock = blockAt(view, from), endBlock = blockAt(view, to); 18451 let visualStart = startBlock.type == BlockType.Text ? startBlock : null; 18452 let visualEnd = endBlock.type == BlockType.Text ? endBlock : null; 18453 if (visualStart && (view.lineWrapping || startBlock.widgetLineBreaks)) 18454 visualStart = wrappedLine(view, from, visualStart); 18455 if (visualEnd && (view.lineWrapping || endBlock.widgetLineBreaks)) 18456 visualEnd = wrappedLine(view, to, visualEnd); 18457 if (visualStart && visualEnd && visualStart.from == visualEnd.from) { 18458 return pieces(drawForLine(range.from, range.to, visualStart)); 18459 } else { 18460 let top2 = visualStart ? drawForLine(range.from, null, visualStart) : drawForWidget(startBlock, false); 18461 let bottom = visualEnd ? drawForLine(null, range.to, visualEnd) : drawForWidget(endBlock, true); 18462 let between = []; 18463 if ((visualStart || startBlock).to < (visualEnd || endBlock).from - (visualStart && visualEnd ? 1 : 0) || startBlock.widgetLineBreaks > 1 && top2.bottom + view.defaultLineHeight / 2 < bottom.top) 18464 between.push(piece(leftSide, top2.bottom, rightSide, bottom.top)); 18465 else if (top2.bottom < bottom.top && view.elementAtHeight((top2.bottom + bottom.top) / 2).type == BlockType.Text) 18466 top2.bottom = bottom.top = (top2.bottom + bottom.top) / 2; 18467 return pieces(top2).concat(between).concat(pieces(bottom)); 18468 } 18469 function piece(left, top2, right, bottom) { 18470 return new RectangleMarker( 18471 className, 18472 left - base2.left, 18473 top2 - base2.top - 0.01, 18474 right - left, 18475 bottom - top2 + 0.01 18476 /* C.Epsilon */ 18477 ); 18478 } 18479 function pieces({ top: top2, bottom, horizontal }) { 18480 let pieces2 = []; 18481 for (let i2 = 0; i2 < horizontal.length; i2 += 2) 18482 pieces2.push(piece(horizontal[i2], top2, horizontal[i2 + 1], bottom)); 18483 return pieces2; 18484 } 18485 function drawForLine(from2, to2, line) { 18486 let top2 = 1e9, bottom = -1e9, horizontal = []; 18487 function addSpan(from3, fromOpen, to3, toOpen, dir) { 18488 let fromCoords = view.coordsAtPos(from3, from3 == line.to ? -2 : 2); 18489 let toCoords = view.coordsAtPos(to3, to3 == line.from ? 2 : -2); 18490 if (!fromCoords || !toCoords) 18491 return; 18492 top2 = Math.min(fromCoords.top, toCoords.top, top2); 18493 bottom = Math.max(fromCoords.bottom, toCoords.bottom, bottom); 18494 if (dir == Direction.LTR) 18495 horizontal.push(ltr && fromOpen ? leftSide : fromCoords.left, ltr && toOpen ? rightSide : toCoords.right); 18496 else 18497 horizontal.push(!ltr && toOpen ? leftSide : toCoords.left, !ltr && fromOpen ? rightSide : fromCoords.right); 18498 } 18499 let start = from2 !== null && from2 !== void 0 ? from2 : line.from, end = to2 !== null && to2 !== void 0 ? to2 : line.to; 18500 for (let r2 of view.visibleRanges) 18501 if (r2.to > start && r2.from < end) { 18502 for (let pos = Math.max(r2.from, start), endPos = Math.min(r2.to, end); ; ) { 18503 let docLine = view.state.doc.lineAt(pos); 18504 for (let span of view.bidiSpans(docLine)) { 18505 let spanFrom = span.from + docLine.from, spanTo = span.to + docLine.from; 18506 if (spanFrom >= endPos) 18507 break; 18508 if (spanTo > pos) 18509 addSpan(Math.max(spanFrom, pos), from2 == null && spanFrom <= start, Math.min(spanTo, endPos), to2 == null && spanTo >= end, span.dir); 18510 } 18511 pos = docLine.to + 1; 18512 if (pos >= endPos) 18513 break; 18514 } 18515 } 18516 if (horizontal.length == 0) 18517 addSpan(start, from2 == null, end, to2 == null, view.textDirection); 18518 return { top: top2, bottom, horizontal }; 18519 } 18520 function drawForWidget(block2, top2) { 18521 let y2 = contentRect.top + (top2 ? block2.top : block2.bottom); 18522 return { top: y2, bottom: y2, horizontal: [] }; 18523 } 18524} 18525function sameMarker(a2, b3) { 18526 return a2.constructor == b3.constructor && a2.eq(b3); 18527} 18528var LayerView = class { 18529 constructor(view, layer2) { 18530 this.view = view; 18531 this.layer = layer2; 18532 this.drawn = []; 18533 this.scaleX = 1; 18534 this.scaleY = 1; 18535 this.measureReq = { read: this.measure.bind(this), write: this.draw.bind(this) }; 18536 this.dom = view.scrollDOM.appendChild(document.createElement("div")); 18537 this.dom.classList.add("cm-layer"); 18538 if (layer2.above) 18539 this.dom.classList.add("cm-layer-above"); 18540 if (layer2.class) 18541 this.dom.classList.add(layer2.class); 18542 this.scale(); 18543 this.dom.setAttribute("aria-hidden", "true"); 18544 this.setOrder(view.state); 18545 view.requestMeasure(this.measureReq); 18546 if (layer2.mount) 18547 layer2.mount(this.dom, view); 18548 } 18549 update(update) { 18550 if (update.startState.facet(layerOrder) != update.state.facet(layerOrder)) 18551 this.setOrder(update.state); 18552 if (this.layer.update(update, this.dom) || update.geometryChanged) { 18553 this.scale(); 18554 update.view.requestMeasure(this.measureReq); 18555 } 18556 } 18557 setOrder(state) { 18558 let pos = 0, order = state.facet(layerOrder); 18559 while (pos < order.length && order[pos] != this.layer) 18560 pos++; 18561 this.dom.style.zIndex = String((this.layer.above ? 150 : -1) - pos); 18562 } 18563 measure() { 18564 return this.layer.markers(this.view); 18565 } 18566 scale() { 18567 let { scaleX, scaleY } = this.view; 18568 if (scaleX != this.scaleX || scaleY != this.scaleY) { 18569 this.scaleX = scaleX; 18570 this.scaleY = scaleY; 18571 this.dom.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; 18572 } 18573 } 18574 draw(markers) { 18575 if (markers.length != this.drawn.length || markers.some((p2, i2) => !sameMarker(p2, this.drawn[i2]))) { 18576 let old = this.dom.firstChild, oldI = 0; 18577 for (let marker of markers) { 18578 if (marker.update && old && marker.constructor && this.drawn[oldI].constructor && marker.update(old, this.drawn[oldI])) { 18579 old = old.nextSibling; 18580 oldI++; 18581 } else { 18582 this.dom.insertBefore(marker.draw(), old); 18583 } 18584 } 18585 while (old) { 18586 let next = old.nextSibling; 18587 old.remove(); 18588 old = next; 18589 } 18590 this.drawn = markers; 18591 } 18592 } 18593 destroy() { 18594 if (this.layer.destroy) 18595 this.layer.destroy(this.dom, this.view); 18596 this.dom.remove(); 18597 } 18598}; 18599var layerOrder = /* @__PURE__ */ Facet.define(); 18600function layer(config2) { 18601 return [ 18602 ViewPlugin.define((v2) => new LayerView(v2, config2)), 18603 layerOrder.of(config2) 18604 ]; 18605} 18606var CanHidePrimary = !browser.ios; 18607var selectionConfig = /* @__PURE__ */ Facet.define({ 18608 combine(configs) { 18609 return combineConfig(configs, { 18610 cursorBlinkRate: 1200, 18611 drawRangeCursor: true 18612 }, { 18613 cursorBlinkRate: (a2, b3) => Math.min(a2, b3), 18614 drawRangeCursor: (a2, b3) => a2 || b3 18615 }); 18616 } 18617}); 18618function drawSelection(config2 = {}) { 18619 return [ 18620 selectionConfig.of(config2), 18621 cursorLayer, 18622 selectionLayer, 18623 hideNativeSelection, 18624 nativeSelectionHidden.of(true) 18625 ]; 18626} 18627function configChanged(update) { 18628 return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig); 18629} 18630var cursorLayer = /* @__PURE__ */ layer({ 18631 above: true, 18632 markers(view) { 18633 let { state } = view, conf = state.facet(selectionConfig); 18634 let cursors = []; 18635 for (let r2 of state.selection.ranges) { 18636 let prim = r2 == state.selection.main; 18637 if (r2.empty ? !prim || CanHidePrimary : conf.drawRangeCursor) { 18638 let className = prim ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary"; 18639 let cursor = r2.empty ? r2 : EditorSelection.cursor(r2.head, r2.head > r2.anchor ? -1 : 1); 18640 for (let piece of RectangleMarker.forRange(view, className, cursor)) 18641 cursors.push(piece); 18642 } 18643 } 18644 return cursors; 18645 }, 18646 update(update, dom) { 18647 if (update.transactions.some((tr) => tr.selection)) 18648 dom.style.animationName = dom.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink"; 18649 let confChange = configChanged(update); 18650 if (confChange) 18651 setBlinkRate(update.state, dom); 18652 return update.docChanged || update.selectionSet || confChange; 18653 }, 18654 mount(dom, view) { 18655 setBlinkRate(view.state, dom); 18656 }, 18657 class: "cm-cursorLayer" 18658}); 18659function setBlinkRate(state, dom) { 18660 dom.style.animationDuration = state.facet(selectionConfig).cursorBlinkRate + "ms"; 18661} 18662var selectionLayer = /* @__PURE__ */ layer({ 18663 above: false, 18664 markers(view) { 18665 return view.state.selection.ranges.map((r2) => r2.empty ? [] : RectangleMarker.forRange(view, "cm-selectionBackground", r2)).reduce((a2, b3) => a2.concat(b3)); 18666 }, 18667 update(update, dom) { 18668 return update.docChanged || update.selectionSet || update.viewportChanged || configChanged(update); 18669 }, 18670 class: "cm-selectionLayer" 18671}); 18672var themeSpec = { 18673 ".cm-line": { 18674 "& ::selection": { backgroundColor: "transparent !important" }, 18675 "&::selection": { backgroundColor: "transparent !important" } 18676 } 18677}; 18678if (CanHidePrimary) { 18679 themeSpec[".cm-line"].caretColor = "transparent !important"; 18680 themeSpec[".cm-content"] = { caretColor: "transparent !important" }; 18681} 18682var hideNativeSelection = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ EditorView.theme(themeSpec)); 18683var setDropCursorPos = /* @__PURE__ */ StateEffect.define({ 18684 map(pos, mapping) { 18685 return pos == null ? null : mapping.mapPos(pos); 18686 } 18687}); 18688var dropCursorPos = /* @__PURE__ */ StateField.define({ 18689 create() { 18690 return null; 18691 }, 18692 update(pos, tr) { 18693 if (pos != null) 18694 pos = tr.changes.mapPos(pos); 18695 return tr.effects.reduce((pos2, e2) => e2.is(setDropCursorPos) ? e2.value : pos2, pos); 18696 } 18697}); 18698var drawDropCursor = /* @__PURE__ */ ViewPlugin.fromClass(class { 18699 constructor(view) { 18700 this.view = view; 18701 this.cursor = null; 18702 this.measureReq = { read: this.readPos.bind(this), write: this.drawCursor.bind(this) }; 18703 } 18704 update(update) { 18705 var _a3; 18706 let cursorPos = update.state.field(dropCursorPos); 18707 if (cursorPos == null) { 18708 if (this.cursor != null) { 18709 (_a3 = this.cursor) === null || _a3 === void 0 ? void 0 : _a3.remove(); 18710 this.cursor = null; 18711 } 18712 } else { 18713 if (!this.cursor) { 18714 this.cursor = this.view.scrollDOM.appendChild(document.createElement("div")); 18715 this.cursor.className = "cm-dropCursor"; 18716 } 18717 if (update.startState.field(dropCursorPos) != cursorPos || update.docChanged || update.geometryChanged) 18718 this.view.requestMeasure(this.measureReq); 18719 } 18720 } 18721 readPos() { 18722 let { view } = this; 18723 let pos = view.state.field(dropCursorPos); 18724 let rect = pos != null && view.coordsAtPos(pos); 18725 if (!rect) 18726 return null; 18727 let outer = view.scrollDOM.getBoundingClientRect(); 18728 return { 18729 left: rect.left - outer.left + view.scrollDOM.scrollLeft * view.scaleX, 18730 top: rect.top - outer.top + view.scrollDOM.scrollTop * view.scaleY, 18731 height: rect.bottom - rect.top 18732 }; 18733 } 18734 drawCursor(pos) { 18735 if (this.cursor) { 18736 let { scaleX, scaleY } = this.view; 18737 if (pos) { 18738 this.cursor.style.left = pos.left / scaleX + "px"; 18739 this.cursor.style.top = pos.top / scaleY + "px"; 18740 this.cursor.style.height = pos.height / scaleY + "px"; 18741 } else { 18742 this.cursor.style.left = "-100000px"; 18743 } 18744 } 18745 } 18746 destroy() { 18747 if (this.cursor) 18748 this.cursor.remove(); 18749 } 18750 setDropPos(pos) { 18751 if (this.view.state.field(dropCursorPos) != pos) 18752 this.view.dispatch({ effects: setDropCursorPos.of(pos) }); 18753 } 18754}, { 18755 eventObservers: { 18756 dragover(event) { 18757 this.setDropPos(this.view.posAtCoords({ x: event.clientX, y: event.clientY })); 18758 }, 18759 dragleave(event) { 18760 if (event.target == this.view.contentDOM || !this.view.contentDOM.contains(event.relatedTarget)) 18761 this.setDropPos(null); 18762 }, 18763 dragend() { 18764 this.setDropPos(null); 18765 }, 18766 drop() { 18767 this.setDropPos(null); 18768 } 18769 } 18770}); 18771function dropCursor() { 18772 return [dropCursorPos, drawDropCursor]; 18773} 18774function iterMatches(doc2, re2, from, to, f3) { 18775 re2.lastIndex = 0; 18776 for (let cursor = doc2.iterRange(from, to), pos = from, m2; !cursor.next().done; pos += cursor.value.length) { 18777 if (!cursor.lineBreak) 18778 while (m2 = re2.exec(cursor.value)) 18779 f3(pos + m2.index, m2); 18780 } 18781} 18782function matchRanges(view, maxLength) { 18783 let visible = view.visibleRanges; 18784 if (visible.length == 1 && visible[0].from == view.viewport.from && visible[0].to == view.viewport.to) 18785 return visible; 18786 let result = []; 18787 for (let { from, to } of visible) { 18788 from = Math.max(view.state.doc.lineAt(from).from, from - maxLength); 18789 to = Math.min(view.state.doc.lineAt(to).to, to + maxLength); 18790 if (result.length && result[result.length - 1].to >= from) 18791 result[result.length - 1].to = to; 18792 else 18793 result.push({ from, to }); 18794 } 18795 return result; 18796} 18797var MatchDecorator = class { 18798 /** 18799 Create a decorator. 18800 */ 18801 constructor(config2) { 18802 const { regexp, decoration, decorate, boundary, maxLength = 1e3 } = config2; 18803 if (!regexp.global) 18804 throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set"); 18805 this.regexp = regexp; 18806 if (decorate) { 18807 this.addMatch = (match, view, from, add2) => decorate(add2, from, from + match[0].length, match, view); 18808 } else if (typeof decoration == "function") { 18809 this.addMatch = (match, view, from, add2) => { 18810 let deco = decoration(match, view, from); 18811 if (deco) 18812 add2(from, from + match[0].length, deco); 18813 }; 18814 } else if (decoration) { 18815 this.addMatch = (match, _view, from, add2) => add2(from, from + match[0].length, decoration); 18816 } else { 18817 throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator"); 18818 } 18819 this.boundary = boundary; 18820 this.maxLength = maxLength; 18821 } 18822 /** 18823 Compute the full set of decorations for matches in the given 18824 view's viewport. You'll want to call this when initializing your 18825 plugin. 18826 */ 18827 createDeco(view) { 18828 let build = new RangeSetBuilder(), add2 = build.add.bind(build); 18829 for (let { from, to } of matchRanges(view, this.maxLength)) 18830 iterMatches(view.state.doc, this.regexp, from, to, (from2, m2) => this.addMatch(m2, view, from2, add2)); 18831 return build.finish(); 18832 } 18833 /** 18834 Update a set of decorations for a view update. `deco` _must_ be 18835 the set of decorations produced by _this_ `MatchDecorator` for 18836 the view state before the update. 18837 */ 18838 updateDeco(update, deco) { 18839 let changeFrom = 1e9, changeTo = -1; 18840 if (update.docChanged) 18841 update.changes.iterChanges((_f, _t2, from, to) => { 18842 if (to > update.view.viewport.from && from < update.view.viewport.to) { 18843 changeFrom = Math.min(from, changeFrom); 18844 changeTo = Math.max(to, changeTo); 18845 } 18846 }); 18847 if (update.viewportChanged || changeTo - changeFrom > 1e3) 18848 return this.createDeco(update.view); 18849 if (changeTo > -1) 18850 return this.updateRange(update.view, deco.map(update.changes), changeFrom, changeTo); 18851 return deco; 18852 } 18853 updateRange(view, deco, updateFrom, updateTo) { 18854 for (let r2 of view.visibleRanges) { 18855 let from = Math.max(r2.from, updateFrom), to = Math.min(r2.to, updateTo); 18856 if (to > from) { 18857 let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine; 18858 let start = Math.max(r2.from, fromLine.from), end = Math.min(r2.to, toLine.to); 18859 if (this.boundary) { 18860 for (; from > fromLine.from; from--) 18861 if (this.boundary.test(fromLine.text[from - 1 - fromLine.from])) { 18862 start = from; 18863 break; 18864 } 18865 for (; to < toLine.to; to++) 18866 if (this.boundary.test(toLine.text[to - toLine.from])) { 18867 end = to; 18868 break; 18869 } 18870 } 18871 let ranges = [], m2; 18872 let add2 = (from2, to2, deco2) => ranges.push(deco2.range(from2, to2)); 18873 if (fromLine == toLine) { 18874 this.regexp.lastIndex = start - fromLine.from; 18875 while ((m2 = this.regexp.exec(fromLine.text)) && m2.index < end - fromLine.from) 18876 this.addMatch(m2, view, m2.index + fromLine.from, add2); 18877 } else { 18878 iterMatches(view.state.doc, this.regexp, start, end, (from2, m3) => this.addMatch(m3, view, from2, add2)); 18879 } 18880 deco = deco.update({ filterFrom: start, filterTo: end, filter: (from2, to2) => from2 < start || to2 > end, add: ranges }); 18881 } 18882 } 18883 return deco; 18884 } 18885}; 18886var UnicodeRegexpSupport = /x/.unicode != null ? "gu" : "g"; 18887var Specials = /* @__PURE__ */ new RegExp("[\0-\b\n-�\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]", UnicodeRegexpSupport); 18888var Names = { 18889 0: "null", 18890 7: "bell", 18891 8: "backspace", 18892 10: "newline", 18893 11: "vertical tab", 18894 13: "carriage return", 18895 27: "escape", 18896 8203: "zero width space", 18897 8204: "zero width non-joiner", 18898 8205: "zero width joiner", 18899 8206: "left-to-right mark", 18900 8207: "right-to-left mark", 18901 8232: "line separator", 18902 8237: "left-to-right override", 18903 8238: "right-to-left override", 18904 8294: "left-to-right isolate", 18905 8295: "right-to-left isolate", 18906 8297: "pop directional isolate", 18907 8233: "paragraph separator", 18908 65279: "zero width no-break space", 18909 65532: "object replacement" 18910}; 18911var _supportsTabSize = null; 18912function supportsTabSize() { 18913 var _a3; 18914 if (_supportsTabSize == null && typeof document != "undefined" && document.body) { 18915 let styles = document.body.style; 18916 _supportsTabSize = ((_a3 = styles.tabSize) !== null && _a3 !== void 0 ? _a3 : styles.MozTabSize) != null; 18917 } 18918 return _supportsTabSize || false; 18919} 18920var specialCharConfig = /* @__PURE__ */ Facet.define({ 18921 combine(configs) { 18922 let config2 = combineConfig(configs, { 18923 render: null, 18924 specialChars: Specials, 18925 addSpecialChars: null 18926 }); 18927 if (config2.replaceTabs = !supportsTabSize()) 18928 config2.specialChars = new RegExp(" |" + config2.specialChars.source, UnicodeRegexpSupport); 18929 if (config2.addSpecialChars) 18930 config2.specialChars = new RegExp(config2.specialChars.source + "|" + config2.addSpecialChars.source, UnicodeRegexpSupport); 18931 return config2; 18932 } 18933}); 18934function highlightSpecialChars(config2 = {}) { 18935 return [specialCharConfig.of(config2), specialCharPlugin()]; 18936} 18937var _plugin = null; 18938function specialCharPlugin() { 18939 return _plugin || (_plugin = ViewPlugin.fromClass(class { 18940 constructor(view) { 18941 this.view = view; 18942 this.decorations = Decoration.none; 18943 this.decorationCache = /* @__PURE__ */ Object.create(null); 18944 this.decorator = this.makeDecorator(view.state.facet(specialCharConfig)); 18945 this.decorations = this.decorator.createDeco(view); 18946 } 18947 makeDecorator(conf) { 18948 return new MatchDecorator({ 18949 regexp: conf.specialChars, 18950 decoration: (m2, view, pos) => { 18951 let { doc: doc2 } = view.state; 18952 let code = codePointAt(m2[0], 0); 18953 if (code == 9) { 18954 let line = doc2.lineAt(pos); 18955 let size = view.state.tabSize, col = countColumn(line.text, size, pos - line.from); 18956 return Decoration.replace({ 18957 widget: new TabWidget((size - col % size) * this.view.defaultCharacterWidth / this.view.scaleX) 18958 }); 18959 } 18960 return this.decorationCache[code] || (this.decorationCache[code] = Decoration.replace({ widget: new SpecialCharWidget(conf, code) })); 18961 }, 18962 boundary: conf.replaceTabs ? void 0 : /[^]/ 18963 }); 18964 } 18965 update(update) { 18966 let conf = update.state.facet(specialCharConfig); 18967 if (update.startState.facet(specialCharConfig) != conf) { 18968 this.decorator = this.makeDecorator(conf); 18969 this.decorations = this.decorator.createDeco(update.view); 18970 } else { 18971 this.decorations = this.decorator.updateDeco(update, this.decorations); 18972 } 18973 } 18974 }, { 18975 decorations: (v2) => v2.decorations 18976 })); 18977} 18978var DefaultPlaceholder = "\u2022"; 18979function placeholder$1(code) { 18980 if (code >= 32) 18981 return DefaultPlaceholder; 18982 if (code == 10) 18983 return "\u2424"; 18984 return String.fromCharCode(9216 + code); 18985} 18986var SpecialCharWidget = class extends WidgetType { 18987 constructor(options2, code) { 18988 super(); 18989 this.options = options2; 18990 this.code = code; 18991 } 18992 eq(other) { 18993 return other.code == this.code; 18994 } 18995 toDOM(view) { 18996 let ph = placeholder$1(this.code); 18997 let desc = view.state.phrase("Control character") + " " + (Names[this.code] || "0x" + this.code.toString(16)); 18998 let custom = this.options.render && this.options.render(this.code, desc, ph); 18999 if (custom) 19000 return custom; 19001 let span = document.createElement("span"); 19002 span.textContent = ph; 19003 span.title = desc; 19004 span.setAttribute("aria-label", desc); 19005 span.className = "cm-specialChar"; 19006 return span; 19007 } 19008 ignoreEvent() { 19009 return false; 19010 } 19011}; 19012var TabWidget = class extends WidgetType { 19013 constructor(width) { 19014 super(); 19015 this.width = width; 19016 } 19017 eq(other) { 19018 return other.width == this.width; 19019 } 19020 toDOM() { 19021 let span = document.createElement("span"); 19022 span.textContent = " "; 19023 span.className = "cm-tab"; 19024 span.style.width = this.width + "px"; 19025 return span; 19026 } 19027 ignoreEvent() { 19028 return false; 19029 } 19030}; 19031var MaxOff = 2e3; 19032function rectangleFor(state, a2, b3) { 19033 let startLine = Math.min(a2.line, b3.line), endLine = Math.max(a2.line, b3.line); 19034 let ranges = []; 19035 if (a2.off > MaxOff || b3.off > MaxOff || a2.col < 0 || b3.col < 0) { 19036 let startOff = Math.min(a2.off, b3.off), endOff = Math.max(a2.off, b3.off); 19037 for (let i2 = startLine; i2 <= endLine; i2++) { 19038 let line = state.doc.line(i2); 19039 if (line.length <= endOff) 19040 ranges.push(EditorSelection.range(line.from + startOff, line.to + endOff)); 19041 } 19042 } else { 19043 let startCol = Math.min(a2.col, b3.col), endCol = Math.max(a2.col, b3.col); 19044 for (let i2 = startLine; i2 <= endLine; i2++) { 19045 let line = state.doc.line(i2); 19046 let start = findColumn(line.text, startCol, state.tabSize, true); 19047 if (start < 0) { 19048 ranges.push(EditorSelection.cursor(line.to)); 19049 } else { 19050 let end = findColumn(line.text, endCol, state.tabSize); 19051 ranges.push(EditorSelection.range(line.from + start, line.from + end)); 19052 } 19053 } 19054 } 19055 return ranges; 19056} 19057function absoluteColumn(view, x) { 19058 let ref = view.coordsAtPos(view.viewport.from); 19059 return ref ? Math.round(Math.abs((ref.left - x) / view.defaultCharacterWidth)) : -1; 19060} 19061function getPos(view, event) { 19062 let offset = view.posAtCoords({ x: event.clientX, y: event.clientY }, false); 19063 let line = view.state.doc.lineAt(offset), off = offset - line.from; 19064 let col = off > MaxOff ? -1 : off == line.length ? absoluteColumn(view, event.clientX) : countColumn(line.text, view.state.tabSize, offset - line.from); 19065 return { line: line.number, col, off }; 19066} 19067function rectangleSelectionStyle(view, event) { 19068 let start = getPos(view, event), startSel = view.state.selection; 19069 if (!start) 19070 return null; 19071 return { 19072 update(update) { 19073 if (update.docChanged) { 19074 let newStart = update.changes.mapPos(update.startState.doc.line(start.line).from); 19075 let newLine = update.state.doc.lineAt(newStart); 19076 start = { line: newLine.number, col: start.col, off: Math.min(start.off, newLine.length) }; 19077 startSel = startSel.map(update.changes); 19078 } 19079 }, 19080 get(event2, _extend, multiple) { 19081 let cur2 = getPos(view, event2); 19082 if (!cur2) 19083 return startSel; 19084 let ranges = rectangleFor(view.state, start, cur2); 19085 if (!ranges.length) 19086 return startSel; 19087 if (multiple) 19088 return EditorSelection.create(ranges.concat(startSel.ranges)); 19089 else 19090 return EditorSelection.create(ranges); 19091 } 19092 }; 19093} 19094function rectangularSelection(options2) { 19095 let filter = (options2 === null || options2 === void 0 ? void 0 : options2.eventFilter) || ((e2) => e2.altKey && e2.button == 0); 19096 return EditorView.mouseSelectionStyle.of((view, event) => filter(event) ? rectangleSelectionStyle(view, event) : null); 19097} 19098var Outside = "-10000px"; 19099var TooltipViewManager = class { 19100 constructor(view, facet, createTooltipView) { 19101 this.facet = facet; 19102 this.createTooltipView = createTooltipView; 19103 this.input = view.state.facet(facet); 19104 this.tooltips = this.input.filter((t3) => t3); 19105 this.tooltipViews = this.tooltips.map(createTooltipView); 19106 } 19107 update(update, above) { 19108 var _a3; 19109 let input = update.state.facet(this.facet); 19110 let tooltips = input.filter((x) => x); 19111 if (input === this.input) { 19112 for (let t3 of this.tooltipViews) 19113 if (t3.update) 19114 t3.update(update); 19115 return false; 19116 } 19117 let tooltipViews = [], newAbove = above ? [] : null; 19118 for (let i2 = 0; i2 < tooltips.length; i2++) { 19119 let tip = tooltips[i2], known = -1; 19120 if (!tip) 19121 continue; 19122 for (let i3 = 0; i3 < this.tooltips.length; i3++) { 19123 let other = this.tooltips[i3]; 19124 if (other && other.create == tip.create) 19125 known = i3; 19126 } 19127 if (known < 0) { 19128 tooltipViews[i2] = this.createTooltipView(tip); 19129 if (newAbove) 19130 newAbove[i2] = !!tip.above; 19131 } else { 19132 let tooltipView = tooltipViews[i2] = this.tooltipViews[known]; 19133 if (newAbove) 19134 newAbove[i2] = above[known]; 19135 if (tooltipView.update) 19136 tooltipView.update(update); 19137 } 19138 } 19139 for (let t3 of this.tooltipViews) 19140 if (tooltipViews.indexOf(t3) < 0) { 19141 t3.dom.remove(); 19142 (_a3 = t3.destroy) === null || _a3 === void 0 ? void 0 : _a3.call(t3); 19143 } 19144 if (above) { 19145 newAbove.forEach((val, i2) => above[i2] = val); 19146 above.length = newAbove.length; 19147 } 19148 this.input = input; 19149 this.tooltips = tooltips; 19150 this.tooltipViews = tooltipViews; 19151 return true; 19152 } 19153}; 19154function windowSpace(view) { 19155 let { win } = view; 19156 return { top: 0, left: 0, bottom: win.innerHeight, right: win.innerWidth }; 19157} 19158var tooltipConfig = /* @__PURE__ */ Facet.define({ 19159 combine: (values2) => { 19160 var _a3, _b2, _c; 19161 return { 19162 position: browser.ios ? "absolute" : ((_a3 = values2.find((conf) => conf.position)) === null || _a3 === void 0 ? void 0 : _a3.position) || "fixed", 19163 parent: ((_b2 = values2.find((conf) => conf.parent)) === null || _b2 === void 0 ? void 0 : _b2.parent) || null, 19164 tooltipSpace: ((_c = values2.find((conf) => conf.tooltipSpace)) === null || _c === void 0 ? void 0 : _c.tooltipSpace) || windowSpace 19165 }; 19166 } 19167}); 19168var knownHeight = /* @__PURE__ */ new WeakMap(); 19169var tooltipPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class { 19170 constructor(view) { 19171 this.view = view; 19172 this.above = []; 19173 this.inView = true; 19174 this.madeAbsolute = false; 19175 this.lastTransaction = 0; 19176 this.measureTimeout = -1; 19177 let config2 = view.state.facet(tooltipConfig); 19178 this.position = config2.position; 19179 this.parent = config2.parent; 19180 this.classes = view.themeClasses; 19181 this.createContainer(); 19182 this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }; 19183 this.manager = new TooltipViewManager(view, showTooltip, (t3) => this.createTooltip(t3)); 19184 this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver((entries) => { 19185 if (Date.now() > this.lastTransaction - 50 && entries.length > 0 && entries[entries.length - 1].intersectionRatio < 1) 19186 this.measureSoon(); 19187 }, { threshold: [1] }) : null; 19188 this.observeIntersection(); 19189 view.win.addEventListener("resize", this.measureSoon = this.measureSoon.bind(this)); 19190 this.maybeMeasure(); 19191 } 19192 createContainer() { 19193 if (this.parent) { 19194 this.container = document.createElement("div"); 19195 this.container.style.position = "relative"; 19196 this.container.className = this.view.themeClasses; 19197 this.parent.appendChild(this.container); 19198 } else { 19199 this.container = this.view.dom; 19200 } 19201 } 19202 observeIntersection() { 19203 if (this.intersectionObserver) { 19204 this.intersectionObserver.disconnect(); 19205 for (let tooltip of this.manager.tooltipViews) 19206 this.intersectionObserver.observe(tooltip.dom); 19207 } 19208 } 19209 measureSoon() { 19210 if (this.measureTimeout < 0) 19211 this.measureTimeout = setTimeout(() => { 19212 this.measureTimeout = -1; 19213 this.maybeMeasure(); 19214 }, 50); 19215 } 19216 update(update) { 19217 if (update.transactions.length) 19218 this.lastTransaction = Date.now(); 19219 let updated = this.manager.update(update, this.above); 19220 if (updated) 19221 this.observeIntersection(); 19222 let shouldMeasure = updated || update.geometryChanged; 19223 let newConfig = update.state.facet(tooltipConfig); 19224 if (newConfig.position != this.position && !this.madeAbsolute) { 19225 this.position = newConfig.position; 19226 for (let t3 of this.manager.tooltipViews) 19227 t3.dom.style.position = this.position; 19228 shouldMeasure = true; 19229 } 19230 if (newConfig.parent != this.parent) { 19231 if (this.parent) 19232 this.container.remove(); 19233 this.parent = newConfig.parent; 19234 this.createContainer(); 19235 for (let t3 of this.manager.tooltipViews) 19236 this.container.appendChild(t3.dom); 19237 shouldMeasure = true; 19238 } else if (this.parent && this.view.themeClasses != this.classes) { 19239 this.classes = this.container.className = this.view.themeClasses; 19240 } 19241 if (shouldMeasure) 19242 this.maybeMeasure(); 19243 } 19244 createTooltip(tooltip) { 19245 let tooltipView = tooltip.create(this.view); 19246 tooltipView.dom.classList.add("cm-tooltip"); 19247 if (tooltip.arrow && !tooltipView.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")) { 19248 let arrow = document.createElement("div"); 19249 arrow.className = "cm-tooltip-arrow"; 19250 tooltipView.dom.appendChild(arrow); 19251 } 19252 tooltipView.dom.style.position = this.position; 19253 tooltipView.dom.style.top = Outside; 19254 tooltipView.dom.style.left = "0px"; 19255 this.container.appendChild(tooltipView.dom); 19256 if (tooltipView.mount) 19257 tooltipView.mount(this.view); 19258 return tooltipView; 19259 } 19260 destroy() { 19261 var _a3, _b2; 19262 this.view.win.removeEventListener("resize", this.measureSoon); 19263 for (let tooltipView of this.manager.tooltipViews) { 19264 tooltipView.dom.remove(); 19265 (_a3 = tooltipView.destroy) === null || _a3 === void 0 ? void 0 : _a3.call(tooltipView); 19266 } 19267 if (this.parent) 19268 this.container.remove(); 19269 (_b2 = this.intersectionObserver) === null || _b2 === void 0 ? void 0 : _b2.disconnect(); 19270 clearTimeout(this.measureTimeout); 19271 } 19272 readMeasure() { 19273 let editor = this.view.dom.getBoundingClientRect(); 19274 let scaleX = 1, scaleY = 1, makeAbsolute = false; 19275 if (this.position == "fixed" && this.manager.tooltipViews.length) { 19276 let { dom } = this.manager.tooltipViews[0]; 19277 if (browser.gecko) { 19278 makeAbsolute = dom.offsetParent != this.container.ownerDocument.body; 19279 } else { 19280 if (this.view.scaleX != 1 || this.view.scaleY != 1) { 19281 makeAbsolute = true; 19282 } else if (dom.style.top == Outside && dom.style.left == "0px") { 19283 let rect = dom.getBoundingClientRect(); 19284 makeAbsolute = Math.abs(rect.top + 1e4) > 1 || Math.abs(rect.left) > 1; 19285 } 19286 } 19287 } 19288 if (makeAbsolute || this.position == "absolute") { 19289 if (this.parent) { 19290 let rect = this.parent.getBoundingClientRect(); 19291 if (rect.width && rect.height) { 19292 scaleX = rect.width / this.parent.offsetWidth; 19293 scaleY = rect.height / this.parent.offsetHeight; 19294 } 19295 } else { 19296 ({ scaleX, scaleY } = this.view.viewState); 19297 } 19298 } 19299 return { 19300 editor, 19301 parent: this.parent ? this.container.getBoundingClientRect() : editor, 19302 pos: this.manager.tooltips.map((t3, i2) => { 19303 let tv = this.manager.tooltipViews[i2]; 19304 return tv.getCoords ? tv.getCoords(t3.pos) : this.view.coordsAtPos(t3.pos); 19305 }), 19306 size: this.manager.tooltipViews.map(({ dom }) => dom.getBoundingClientRect()), 19307 space: this.view.state.facet(tooltipConfig).tooltipSpace(this.view), 19308 scaleX, 19309 scaleY, 19310 makeAbsolute 19311 }; 19312 } 19313 writeMeasure(measured) { 19314 var _a3; 19315 if (measured.makeAbsolute) { 19316 this.madeAbsolute = true; 19317 this.position = "absolute"; 19318 for (let t3 of this.manager.tooltipViews) 19319 t3.dom.style.position = "absolute"; 19320 } 19321 let { editor, space: space5, scaleX, scaleY } = measured; 19322 let others = []; 19323 for (let i2 = 0; i2 < this.manager.tooltips.length; i2++) { 19324 let tooltip = this.manager.tooltips[i2], tView = this.manager.tooltipViews[i2], { dom } = tView; 19325 let pos = measured.pos[i2], size = measured.size[i2]; 19326 if (!pos || pos.bottom <= Math.max(editor.top, space5.top) || pos.top >= Math.min(editor.bottom, space5.bottom) || pos.right < Math.max(editor.left, space5.left) - 0.1 || pos.left > Math.min(editor.right, space5.right) + 0.1) { 19327 dom.style.top = Outside; 19328 continue; 19329 } 19330 let arrow = tooltip.arrow ? tView.dom.querySelector(".cm-tooltip-arrow") : null; 19331 let arrowHeight = arrow ? 7 : 0; 19332 let width = size.right - size.left, height = (_a3 = knownHeight.get(tView)) !== null && _a3 !== void 0 ? _a3 : size.bottom - size.top; 19333 let offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR; 19334 let left = size.width > space5.right - space5.left ? ltr ? space5.left : space5.right - size.width : ltr ? Math.min(pos.left - (arrow ? 14 : 0) + offset.x, space5.right - width) : Math.max(space5.left, pos.left - width + (arrow ? 14 : 0) - offset.x); 19335 let above = this.above[i2]; 19336 if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset.y < space5.top : pos.bottom + (size.bottom - size.top) + offset.y > space5.bottom) && above == space5.bottom - pos.bottom > pos.top - space5.top) 19337 above = this.above[i2] = !above; 19338 let spaceVert = (above ? pos.top - space5.top : space5.bottom - pos.bottom) - arrowHeight; 19339 if (spaceVert < height && tView.resize !== false) { 19340 if (spaceVert < this.view.defaultLineHeight) { 19341 dom.style.top = Outside; 19342 continue; 19343 } 19344 knownHeight.set(tView, height); 19345 dom.style.height = (height = spaceVert) / scaleY + "px"; 19346 } else if (dom.style.height) { 19347 dom.style.height = ""; 19348 } 19349 let top2 = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y; 19350 let right = left + width; 19351 if (tView.overlap !== true) { 19352 for (let r2 of others) 19353 if (r2.left < right && r2.right > left && r2.top < top2 + height && r2.bottom > top2) 19354 top2 = above ? r2.top - height - 2 - arrowHeight : r2.bottom + arrowHeight + 2; 19355 } 19356 if (this.position == "absolute") { 19357 dom.style.top = (top2 - measured.parent.top) / scaleY + "px"; 19358 dom.style.left = (left - measured.parent.left) / scaleX + "px"; 19359 } else { 19360 dom.style.top = top2 / scaleY + "px"; 19361 dom.style.left = left / scaleX + "px"; 19362 } 19363 if (arrow) { 19364 let arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 - 7); 19365 arrow.style.left = arrowLeft / scaleX + "px"; 19366 } 19367 if (tView.overlap !== true) 19368 others.push({ left, top: top2, right, bottom: top2 + height }); 19369 dom.classList.toggle("cm-tooltip-above", above); 19370 dom.classList.toggle("cm-tooltip-below", !above); 19371 if (tView.positioned) 19372 tView.positioned(measured.space); 19373 } 19374 } 19375 maybeMeasure() { 19376 if (this.manager.tooltips.length) { 19377 if (this.view.inView) 19378 this.view.requestMeasure(this.measureReq); 19379 if (this.inView != this.view.inView) { 19380 this.inView = this.view.inView; 19381 if (!this.inView) 19382 for (let tv of this.manager.tooltipViews) 19383 tv.dom.style.top = Outside; 19384 } 19385 } 19386 } 19387}, { 19388 eventObservers: { 19389 scroll() { 19390 this.maybeMeasure(); 19391 } 19392 } 19393}); 19394var baseTheme = /* @__PURE__ */ EditorView.baseTheme({ 19395 ".cm-tooltip": { 19396 zIndex: 100, 19397 boxSizing: "border-box" 19398 }, 19399 "&light .cm-tooltip": { 19400 border: "1px solid #bbb", 19401 backgroundColor: "#f5f5f5" 19402 }, 19403 "&light .cm-tooltip-section:not(:first-child)": { 19404 borderTop: "1px solid #bbb" 19405 }, 19406 "&dark .cm-tooltip": { 19407 backgroundColor: "#333338", 19408 color: "white" 19409 }, 19410 ".cm-tooltip-arrow": { 19411 height: `${7}px`, 19412 width: `${7 * 2}px`, 19413 position: "absolute", 19414 zIndex: -1, 19415 overflow: "hidden", 19416 "&:before, &:after": { 19417 content: "''", 19418 position: "absolute", 19419 width: 0, 19420 height: 0, 19421 borderLeft: `${7}px solid transparent`, 19422 borderRight: `${7}px solid transparent` 19423 }, 19424 ".cm-tooltip-above &": { 19425 bottom: `-${7}px`, 19426 "&:before": { 19427 borderTop: `${7}px solid #bbb` 19428 }, 19429 "&:after": { 19430 borderTop: `${7}px solid #f5f5f5`, 19431 bottom: "1px" 19432 } 19433 }, 19434 ".cm-tooltip-below &": { 19435 top: `-${7}px`, 19436 "&:before": { 19437 borderBottom: `${7}px solid #bbb` 19438 }, 19439 "&:after": { 19440 borderBottom: `${7}px solid #f5f5f5`, 19441 top: "1px" 19442 } 19443 } 19444 }, 19445 "&dark .cm-tooltip .cm-tooltip-arrow": { 19446 "&:before": { 19447 borderTopColor: "#333338", 19448 borderBottomColor: "#333338" 19449 }, 19450 "&:after": { 19451 borderTopColor: "transparent", 19452 borderBottomColor: "transparent" 19453 } 19454 } 19455}); 19456var noOffset = { x: 0, y: 0 }; 19457var showTooltip = /* @__PURE__ */ Facet.define({ 19458 enables: [tooltipPlugin, baseTheme] 19459}); 19460var showHoverTooltip = /* @__PURE__ */ Facet.define(); 19461var HoverTooltipHost = class _HoverTooltipHost { 19462 // Needs to be static so that host tooltip instances always match 19463 static create(view) { 19464 return new _HoverTooltipHost(view); 19465 } 19466 constructor(view) { 19467 this.view = view; 19468 this.mounted = false; 19469 this.dom = document.createElement("div"); 19470 this.dom.classList.add("cm-tooltip-hover"); 19471 this.manager = new TooltipViewManager(view, showHoverTooltip, (t3) => this.createHostedView(t3)); 19472 } 19473 createHostedView(tooltip) { 19474 let hostedView = tooltip.create(this.view); 19475 hostedView.dom.classList.add("cm-tooltip-section"); 19476 this.dom.appendChild(hostedView.dom); 19477 if (this.mounted && hostedView.mount) 19478 hostedView.mount(this.view); 19479 return hostedView; 19480 } 19481 mount(view) { 19482 for (let hostedView of this.manager.tooltipViews) { 19483 if (hostedView.mount) 19484 hostedView.mount(view); 19485 } 19486 this.mounted = true; 19487 } 19488 positioned(space5) { 19489 for (let hostedView of this.manager.tooltipViews) { 19490 if (hostedView.positioned) 19491 hostedView.positioned(space5); 19492 } 19493 } 19494 update(update) { 19495 this.manager.update(update); 19496 } 19497 destroy() { 19498 var _a3; 19499 for (let t3 of this.manager.tooltipViews) 19500 (_a3 = t3.destroy) === null || _a3 === void 0 ? void 0 : _a3.call(t3); 19501 } 19502 passProp(name2) { 19503 let value = void 0; 19504 for (let view of this.manager.tooltipViews) { 19505 let given = view[name2]; 19506 if (given !== void 0) { 19507 if (value === void 0) 19508 value = given; 19509 else if (value !== given) 19510 return void 0; 19511 } 19512 } 19513 return value; 19514 } 19515 get offset() { 19516 return this.passProp("offset"); 19517 } 19518 get getCoords() { 19519 return this.passProp("getCoords"); 19520 } 19521 get overlap() { 19522 return this.passProp("overlap"); 19523 } 19524 get resize() { 19525 return this.passProp("resize"); 19526 } 19527}; 19528var showHoverTooltipHost = /* @__PURE__ */ showTooltip.compute([showHoverTooltip], (state) => { 19529 let tooltips = state.facet(showHoverTooltip).filter((t3) => t3); 19530 if (tooltips.length === 0) 19531 return null; 19532 return { 19533 pos: Math.min(...tooltips.map((t3) => t3.pos)), 19534 end: Math.max(...tooltips.map((t3) => { 19535 var _a3; 19536 return (_a3 = t3.end) !== null && _a3 !== void 0 ? _a3 : t3.pos; 19537 })), 19538 create: HoverTooltipHost.create, 19539 above: tooltips[0].above, 19540 arrow: tooltips.some((t3) => t3.arrow) 19541 }; 19542}); 19543var HoverPlugin = class { 19544 constructor(view, source, field, setHover, hoverTime) { 19545 this.view = view; 19546 this.source = source; 19547 this.field = field; 19548 this.setHover = setHover; 19549 this.hoverTime = hoverTime; 19550 this.hoverTimeout = -1; 19551 this.restartTimeout = -1; 19552 this.pending = null; 19553 this.lastMove = { x: 0, y: 0, target: view.dom, time: 0 }; 19554 this.checkHover = this.checkHover.bind(this); 19555 view.dom.addEventListener("mouseleave", this.mouseleave = this.mouseleave.bind(this)); 19556 view.dom.addEventListener("mousemove", this.mousemove = this.mousemove.bind(this)); 19557 } 19558 update() { 19559 if (this.pending) { 19560 this.pending = null; 19561 clearTimeout(this.restartTimeout); 19562 this.restartTimeout = setTimeout(() => this.startHover(), 20); 19563 } 19564 } 19565 get active() { 19566 return this.view.state.field(this.field); 19567 } 19568 checkHover() { 19569 this.hoverTimeout = -1; 19570 if (this.active) 19571 return; 19572 let hovered = Date.now() - this.lastMove.time; 19573 if (hovered < this.hoverTime) 19574 this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime - hovered); 19575 else 19576 this.startHover(); 19577 } 19578 startHover() { 19579 clearTimeout(this.restartTimeout); 19580 let { view, lastMove } = this; 19581 let desc = view.docView.nearest(lastMove.target); 19582 if (!desc) 19583 return; 19584 let pos, side = 1; 19585 if (desc instanceof WidgetView) { 19586 pos = desc.posAtStart; 19587 } else { 19588 pos = view.posAtCoords(lastMove); 19589 if (pos == null) 19590 return; 19591 let posCoords = view.coordsAtPos(pos); 19592 if (!posCoords || lastMove.y < posCoords.top || lastMove.y > posCoords.bottom || lastMove.x < posCoords.left - view.defaultCharacterWidth || lastMove.x > posCoords.right + view.defaultCharacterWidth) 19593 return; 19594 let bidi = view.bidiSpans(view.state.doc.lineAt(pos)).find((s2) => s2.from <= pos && s2.to >= pos); 19595 let rtl = bidi && bidi.dir == Direction.RTL ? -1 : 1; 19596 side = lastMove.x < posCoords.left ? -rtl : rtl; 19597 } 19598 let open = this.source(view, pos, side); 19599 if (open === null || open === void 0 ? void 0 : open.then) { 19600 let pending = this.pending = { pos }; 19601 open.then((result) => { 19602 if (this.pending == pending) { 19603 this.pending = null; 19604 if (result) 19605 view.dispatch({ effects: this.setHover.of(result) }); 19606 } 19607 }, (e2) => logException(view.state, e2, "hover tooltip")); 19608 } else if (open) { 19609 view.dispatch({ effects: this.setHover.of(open) }); 19610 } 19611 } 19612 get tooltip() { 19613 let plugin = this.view.plugin(tooltipPlugin); 19614 let index = plugin ? plugin.manager.tooltips.findIndex((t3) => t3.create == HoverTooltipHost.create) : -1; 19615 return index > -1 ? plugin.manager.tooltipViews[index] : null; 19616 } 19617 mousemove(event) { 19618 var _a3; 19619 this.lastMove = { x: event.clientX, y: event.clientY, target: event.target, time: Date.now() }; 19620 if (this.hoverTimeout < 0) 19621 this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime); 19622 let { active, tooltip } = this; 19623 if (active && tooltip && !isInTooltip(tooltip.dom, event) || this.pending) { 19624 let { pos } = active || this.pending, end = (_a3 = active === null || active === void 0 ? void 0 : active.end) !== null && _a3 !== void 0 ? _a3 : pos; 19625 if (pos == end ? this.view.posAtCoords(this.lastMove) != pos : !isOverRange(this.view, pos, end, event.clientX, event.clientY)) { 19626 this.view.dispatch({ effects: this.setHover.of(null) }); 19627 this.pending = null; 19628 } 19629 } 19630 } 19631 mouseleave(event) { 19632 clearTimeout(this.hoverTimeout); 19633 this.hoverTimeout = -1; 19634 let { active } = this; 19635 if (active) { 19636 let { tooltip } = this; 19637 let inTooltip = tooltip && tooltip.dom.contains(event.relatedTarget); 19638 if (!inTooltip) 19639 this.view.dispatch({ effects: this.setHover.of(null) }); 19640 else 19641 this.watchTooltipLeave(tooltip.dom); 19642 } 19643 } 19644 watchTooltipLeave(tooltip) { 19645 let watch = (event) => { 19646 tooltip.removeEventListener("mouseleave", watch); 19647 if (this.active && !this.view.dom.contains(event.relatedTarget)) 19648 this.view.dispatch({ effects: this.setHover.of(null) }); 19649 }; 19650 tooltip.addEventListener("mouseleave", watch); 19651 } 19652 destroy() { 19653 clearTimeout(this.hoverTimeout); 19654 this.view.dom.removeEventListener("mouseleave", this.mouseleave); 19655 this.view.dom.removeEventListener("mousemove", this.mousemove); 19656 } 19657}; 19658var tooltipMargin = 4; 19659function isInTooltip(tooltip, event) { 19660 let rect = tooltip.getBoundingClientRect(); 19661 return event.clientX >= rect.left - tooltipMargin && event.clientX <= rect.right + tooltipMargin && event.clientY >= rect.top - tooltipMargin && event.clientY <= rect.bottom + tooltipMargin; 19662} 19663function isOverRange(view, from, to, x, y2, margin) { 19664 let rect = view.scrollDOM.getBoundingClientRect(); 19665 let docBottom = view.documentTop + view.documentPadding.top + view.contentHeight; 19666 if (rect.left > x || rect.right < x || rect.top > y2 || Math.min(rect.bottom, docBottom) < y2) 19667 return false; 19668 let pos = view.posAtCoords({ x, y: y2 }, false); 19669 return pos >= from && pos <= to; 19670} 19671function hoverTooltip(source, options2 = {}) { 19672 let setHover = StateEffect.define(); 19673 let hoverState = StateField.define({ 19674 create() { 19675 return null; 19676 }, 19677 update(value, tr) { 19678 if (value && (options2.hideOnChange && (tr.docChanged || tr.selection) || options2.hideOn && options2.hideOn(tr, value))) 19679 return null; 19680 if (value && tr.docChanged) { 19681 let newPos = tr.changes.mapPos(value.pos, -1, MapMode.TrackDel); 19682 if (newPos == null) 19683 return null; 19684 let copy = Object.assign(/* @__PURE__ */ Object.create(null), value); 19685 copy.pos = newPos; 19686 if (value.end != null) 19687 copy.end = tr.changes.mapPos(value.end); 19688 value = copy; 19689 } 19690 for (let effect of tr.effects) { 19691 if (effect.is(setHover)) 19692 value = effect.value; 19693 if (effect.is(closeHoverTooltipEffect)) 19694 value = null; 19695 } 19696 return value; 19697 }, 19698 provide: (f3) => showHoverTooltip.from(f3) 19699 }); 19700 return [ 19701 hoverState, 19702 ViewPlugin.define((view) => new HoverPlugin( 19703 view, 19704 source, 19705 hoverState, 19706 setHover, 19707 options2.hoverTime || 300 19708 /* Hover.Time */ 19709 )), 19710 showHoverTooltipHost 19711 ]; 19712} 19713function getTooltip(view, tooltip) { 19714 let plugin = view.plugin(tooltipPlugin); 19715 if (!plugin) 19716 return null; 19717 let found = plugin.manager.tooltips.indexOf(tooltip); 19718 return found < 0 ? null : plugin.manager.tooltipViews[found]; 19719} 19720var closeHoverTooltipEffect = /* @__PURE__ */ StateEffect.define(); 19721var panelConfig = /* @__PURE__ */ Facet.define({ 19722 combine(configs) { 19723 let topContainer, bottomContainer; 19724 for (let c2 of configs) { 19725 topContainer = topContainer || c2.topContainer; 19726 bottomContainer = bottomContainer || c2.bottomContainer; 19727 } 19728 return { topContainer, bottomContainer }; 19729 } 19730}); 19731function getPanel(view, panel) { 19732 let plugin = view.plugin(panelPlugin); 19733 let index = plugin ? plugin.specs.indexOf(panel) : -1; 19734 return index > -1 ? plugin.panels[index] : null; 19735} 19736var panelPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class { 19737 constructor(view) { 19738 this.input = view.state.facet(showPanel); 19739 this.specs = this.input.filter((s2) => s2); 19740 this.panels = this.specs.map((spec) => spec(view)); 19741 let conf = view.state.facet(panelConfig); 19742 this.top = new PanelGroup(view, true, conf.topContainer); 19743 this.bottom = new PanelGroup(view, false, conf.bottomContainer); 19744 this.top.sync(this.panels.filter((p2) => p2.top)); 19745 this.bottom.sync(this.panels.filter((p2) => !p2.top)); 19746 for (let p2 of this.panels) { 19747 p2.dom.classList.add("cm-panel"); 19748 if (p2.mount) 19749 p2.mount(); 19750 } 19751 } 19752 update(update) { 19753 let conf = update.state.facet(panelConfig); 19754 if (this.top.container != conf.topContainer) { 19755 this.top.sync([]); 19756 this.top = new PanelGroup(update.view, true, conf.topContainer); 19757 } 19758 if (this.bottom.container != conf.bottomContainer) { 19759 this.bottom.sync([]); 19760 this.bottom = new PanelGroup(update.view, false, conf.bottomContainer); 19761 } 19762 this.top.syncClasses(); 19763 this.bottom.syncClasses(); 19764 let input = update.state.facet(showPanel); 19765 if (input != this.input) { 19766 let specs = input.filter((x) => x); 19767 let panels = [], top2 = [], bottom = [], mount = []; 19768 for (let spec of specs) { 19769 let known = this.specs.indexOf(spec), panel; 19770 if (known < 0) { 19771 panel = spec(update.view); 19772 mount.push(panel); 19773 } else { 19774 panel = this.panels[known]; 19775 if (panel.update) 19776 panel.update(update); 19777 } 19778 panels.push(panel); 19779 (panel.top ? top2 : bottom).push(panel); 19780 } 19781 this.specs = specs; 19782 this.panels = panels; 19783 this.top.sync(top2); 19784 this.bottom.sync(bottom); 19785 for (let p2 of mount) { 19786 p2.dom.classList.add("cm-panel"); 19787 if (p2.mount) 19788 p2.mount(); 19789 } 19790 } else { 19791 for (let p2 of this.panels) 19792 if (p2.update) 19793 p2.update(update); 19794 } 19795 } 19796 destroy() { 19797 this.top.sync([]); 19798 this.bottom.sync([]); 19799 } 19800}, { 19801 provide: (plugin) => EditorView.scrollMargins.of((view) => { 19802 let value = view.plugin(plugin); 19803 return value && { top: value.top.scrollMargin(), bottom: value.bottom.scrollMargin() }; 19804 }) 19805}); 19806var PanelGroup = class { 19807 constructor(view, top2, container) { 19808 this.view = view; 19809 this.top = top2; 19810 this.container = container; 19811 this.dom = void 0; 19812 this.classes = ""; 19813 this.panels = []; 19814 this.syncClasses(); 19815 } 19816 sync(panels) { 19817 for (let p2 of this.panels) 19818 if (p2.destroy && panels.indexOf(p2) < 0) 19819 p2.destroy(); 19820 this.panels = panels; 19821 this.syncDOM(); 19822 } 19823 syncDOM() { 19824 if (this.panels.length == 0) { 19825 if (this.dom) { 19826 this.dom.remove(); 19827 this.dom = void 0; 19828 } 19829 return; 19830 } 19831 if (!this.dom) { 19832 this.dom = document.createElement("div"); 19833 this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom"; 19834 this.dom.style[this.top ? "top" : "bottom"] = "0"; 19835 let parent = this.container || this.view.dom; 19836 parent.insertBefore(this.dom, this.top ? parent.firstChild : null); 19837 } 19838 let curDOM = this.dom.firstChild; 19839 for (let panel of this.panels) { 19840 if (panel.dom.parentNode == this.dom) { 19841 while (curDOM != panel.dom) 19842 curDOM = rm(curDOM); 19843 curDOM = curDOM.nextSibling; 19844 } else { 19845 this.dom.insertBefore(panel.dom, curDOM); 19846 } 19847 } 19848 while (curDOM) 19849 curDOM = rm(curDOM); 19850 } 19851 scrollMargin() { 19852 return !this.dom || this.container ? 0 : Math.max(0, this.top ? this.dom.getBoundingClientRect().bottom - Math.max(0, this.view.scrollDOM.getBoundingClientRect().top) : Math.min(innerHeight, this.view.scrollDOM.getBoundingClientRect().bottom) - this.dom.getBoundingClientRect().top); 19853 } 19854 syncClasses() { 19855 if (!this.container || this.classes == this.view.themeClasses) 19856 return; 19857 for (let cls of this.classes.split(" ")) 19858 if (cls) 19859 this.container.classList.remove(cls); 19860 for (let cls of (this.classes = this.view.themeClasses).split(" ")) 19861 if (cls) 19862 this.container.classList.add(cls); 19863 } 19864}; 19865function rm(node) { 19866 let next = node.nextSibling; 19867 node.remove(); 19868 return next; 19869} 19870var showPanel = /* @__PURE__ */ Facet.define({ 19871 enables: panelPlugin 19872}); 19873var GutterMarker = class extends RangeValue { 19874 /** 19875 @internal 19876 */ 19877 compare(other) { 19878 return this == other || this.constructor == other.constructor && this.eq(other); 19879 } 19880 /** 19881 Compare this marker to another marker of the same type. 19882 */ 19883 eq(other) { 19884 return false; 19885 } 19886 /** 19887 Called if the marker has a `toDOM` method and its representation 19888 was removed from a gutter. 19889 */ 19890 destroy(dom) { 19891 } 19892}; 19893GutterMarker.prototype.elementClass = ""; 19894GutterMarker.prototype.toDOM = void 0; 19895GutterMarker.prototype.mapMode = MapMode.TrackBefore; 19896GutterMarker.prototype.startSide = GutterMarker.prototype.endSide = -1; 19897GutterMarker.prototype.point = true; 19898var gutterLineClass = /* @__PURE__ */ Facet.define(); 19899var defaults = { 19900 class: "", 19901 renderEmptyElements: false, 19902 elementStyle: "", 19903 markers: () => RangeSet.empty, 19904 lineMarker: () => null, 19905 widgetMarker: () => null, 19906 lineMarkerChange: null, 19907 initialSpacer: null, 19908 updateSpacer: null, 19909 domEventHandlers: {} 19910}; 19911var activeGutters = /* @__PURE__ */ Facet.define(); 19912function gutter(config2) { 19913 return [gutters(), activeGutters.of(Object.assign(Object.assign({}, defaults), config2))]; 19914} 19915var unfixGutters = /* @__PURE__ */ Facet.define({ 19916 combine: (values2) => values2.some((x) => x) 19917}); 19918function gutters(config2) { 19919 let result = [ 19920 gutterView 19921 ]; 19922 if (config2 && config2.fixed === false) 19923 result.push(unfixGutters.of(true)); 19924 return result; 19925} 19926var gutterView = /* @__PURE__ */ ViewPlugin.fromClass(class { 19927 constructor(view) { 19928 this.view = view; 19929 this.prevViewport = view.viewport; 19930 this.dom = document.createElement("div"); 19931 this.dom.className = "cm-gutters"; 19932 this.dom.setAttribute("aria-hidden", "true"); 19933 this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px"; 19934 this.gutters = view.state.facet(activeGutters).map((conf) => new SingleGutterView(view, conf)); 19935 for (let gutter2 of this.gutters) 19936 this.dom.appendChild(gutter2.dom); 19937 this.fixed = !view.state.facet(unfixGutters); 19938 if (this.fixed) { 19939 this.dom.style.position = "sticky"; 19940 } 19941 this.syncGutters(false); 19942 view.scrollDOM.insertBefore(this.dom, view.contentDOM); 19943 } 19944 update(update) { 19945 if (this.updateGutters(update)) { 19946 let vpA = this.prevViewport, vpB = update.view.viewport; 19947 let vpOverlap = Math.min(vpA.to, vpB.to) - Math.max(vpA.from, vpB.from); 19948 this.syncGutters(vpOverlap < (vpB.to - vpB.from) * 0.8); 19949 } 19950 if (update.geometryChanged) 19951 this.dom.style.minHeight = this.view.contentHeight + "px"; 19952 if (this.view.state.facet(unfixGutters) != !this.fixed) { 19953 this.fixed = !this.fixed; 19954 this.dom.style.position = this.fixed ? "sticky" : ""; 19955 } 19956 this.prevViewport = update.view.viewport; 19957 } 19958 syncGutters(detach) { 19959 let after = this.dom.nextSibling; 19960 if (detach) 19961 this.dom.remove(); 19962 let lineClasses = RangeSet.iter(this.view.state.facet(gutterLineClass), this.view.viewport.from); 19963 let classSet = []; 19964 let contexts = this.gutters.map((gutter2) => new UpdateContext(gutter2, this.view.viewport, -this.view.documentPadding.top)); 19965 for (let line of this.view.viewportLineBlocks) { 19966 if (classSet.length) 19967 classSet = []; 19968 if (Array.isArray(line.type)) { 19969 let first = true; 19970 for (let b3 of line.type) { 19971 if (b3.type == BlockType.Text && first) { 19972 advanceCursor(lineClasses, classSet, b3.from); 19973 for (let cx of contexts) 19974 cx.line(this.view, b3, classSet); 19975 first = false; 19976 } else if (b3.widget) { 19977 for (let cx of contexts) 19978 cx.widget(this.view, b3); 19979 } 19980 } 19981 } else if (line.type == BlockType.Text) { 19982 advanceCursor(lineClasses, classSet, line.from); 19983 for (let cx of contexts) 19984 cx.line(this.view, line, classSet); 19985 } else if (line.widget) { 19986 for (let cx of contexts) 19987 cx.widget(this.view, line); 19988 } 19989 } 19990 for (let cx of contexts) 19991 cx.finish(); 19992 if (detach) 19993 this.view.scrollDOM.insertBefore(this.dom, after); 19994 } 19995 updateGutters(update) { 19996 let prev = update.startState.facet(activeGutters), cur2 = update.state.facet(activeGutters); 19997 let change = update.docChanged || update.heightChanged || update.viewportChanged || !RangeSet.eq(update.startState.facet(gutterLineClass), update.state.facet(gutterLineClass), update.view.viewport.from, update.view.viewport.to); 19998 if (prev == cur2) { 19999 for (let gutter2 of this.gutters) 20000 if (gutter2.update(update)) 20001 change = true; 20002 } else { 20003 change = true; 20004 let gutters2 = []; 20005 for (let conf of cur2) { 20006 let known = prev.indexOf(conf); 20007 if (known < 0) { 20008 gutters2.push(new SingleGutterView(this.view, conf)); 20009 } else { 20010 this.gutters[known].update(update); 20011 gutters2.push(this.gutters[known]); 20012 } 20013 } 20014 for (let g2 of this.gutters) { 20015 g2.dom.remove(); 20016 if (gutters2.indexOf(g2) < 0) 20017 g2.destroy(); 20018 } 20019 for (let g2 of gutters2) 20020 this.dom.appendChild(g2.dom); 20021 this.gutters = gutters2; 20022 } 20023 return change; 20024 } 20025 destroy() { 20026 for (let view of this.gutters) 20027 view.destroy(); 20028 this.dom.remove(); 20029 } 20030}, { 20031 provide: (plugin) => EditorView.scrollMargins.of((view) => { 20032 let value = view.plugin(plugin); 20033 if (!value || value.gutters.length == 0 || !value.fixed) 20034 return null; 20035 return view.textDirection == Direction.LTR ? { left: value.dom.offsetWidth * view.scaleX } : { right: value.dom.offsetWidth * view.scaleX }; 20036 }) 20037}); 20038function asArray2(val) { 20039 return Array.isArray(val) ? val : [val]; 20040} 20041function advanceCursor(cursor, collect, pos) { 20042 while (cursor.value && cursor.from <= pos) { 20043 if (cursor.from == pos) 20044 collect.push(cursor.value); 20045 cursor.next(); 20046 } 20047} 20048var UpdateContext = class { 20049 constructor(gutter2, viewport, height) { 20050 this.gutter = gutter2; 20051 this.height = height; 20052 this.i = 0; 20053 this.cursor = RangeSet.iter(gutter2.markers, viewport.from); 20054 } 20055 addElement(view, block2, markers) { 20056 let { gutter: gutter2 } = this, above = (block2.top - this.height) / view.scaleY, height = block2.height / view.scaleY; 20057 if (this.i == gutter2.elements.length) { 20058 let newElt = new GutterElement(view, height, above, markers); 20059 gutter2.elements.push(newElt); 20060 gutter2.dom.appendChild(newElt.dom); 20061 } else { 20062 gutter2.elements[this.i].update(view, height, above, markers); 20063 } 20064 this.height = block2.bottom; 20065 this.i++; 20066 } 20067 line(view, line, extraMarkers) { 20068 let localMarkers = []; 20069 advanceCursor(this.cursor, localMarkers, line.from); 20070 if (extraMarkers.length) 20071 localMarkers = localMarkers.concat(extraMarkers); 20072 let forLine = this.gutter.config.lineMarker(view, line, localMarkers); 20073 if (forLine) 20074 localMarkers.unshift(forLine); 20075 let gutter2 = this.gutter; 20076 if (localMarkers.length == 0 && !gutter2.config.renderEmptyElements) 20077 return; 20078 this.addElement(view, line, localMarkers); 20079 } 20080 widget(view, block2) { 20081 let marker = this.gutter.config.widgetMarker(view, block2.widget, block2); 20082 if (marker) 20083 this.addElement(view, block2, [marker]); 20084 } 20085 finish() { 20086 let gutter2 = this.gutter; 20087 while (gutter2.elements.length > this.i) { 20088 let last = gutter2.elements.pop(); 20089 gutter2.dom.removeChild(last.dom); 20090 last.destroy(); 20091 } 20092 } 20093}; 20094var SingleGutterView = class { 20095 constructor(view, config2) { 20096 this.view = view; 20097 this.config = config2; 20098 this.elements = []; 20099 this.spacer = null; 20100 this.dom = document.createElement("div"); 20101 this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : ""); 20102 for (let prop in config2.domEventHandlers) { 20103 this.dom.addEventListener(prop, (event) => { 20104 let target = event.target, y2; 20105 if (target != this.dom && this.dom.contains(target)) { 20106 while (target.parentNode != this.dom) 20107 target = target.parentNode; 20108 let rect = target.getBoundingClientRect(); 20109 y2 = (rect.top + rect.bottom) / 2; 20110 } else { 20111 y2 = event.clientY; 20112 } 20113 let line = view.lineBlockAtHeight(y2 - view.documentTop); 20114 if (config2.domEventHandlers[prop](view, line, event)) 20115 event.preventDefault(); 20116 }); 20117 } 20118 this.markers = asArray2(config2.markers(view)); 20119 if (config2.initialSpacer) { 20120 this.spacer = new GutterElement(view, 0, 0, [config2.initialSpacer(view)]); 20121 this.dom.appendChild(this.spacer.dom); 20122 this.spacer.dom.style.cssText += "visibility: hidden; pointer-events: none"; 20123 } 20124 } 20125 update(update) { 20126 let prevMarkers = this.markers; 20127 this.markers = asArray2(this.config.markers(update.view)); 20128 if (this.spacer && this.config.updateSpacer) { 20129 let updated = this.config.updateSpacer(this.spacer.markers[0], update); 20130 if (updated != this.spacer.markers[0]) 20131 this.spacer.update(update.view, 0, 0, [updated]); 20132 } 20133 let vp = update.view.viewport; 20134 return !RangeSet.eq(this.markers, prevMarkers, vp.from, vp.to) || (this.config.lineMarkerChange ? this.config.lineMarkerChange(update) : false); 20135 } 20136 destroy() { 20137 for (let elt of this.elements) 20138 elt.destroy(); 20139 } 20140}; 20141var GutterElement = class { 20142 constructor(view, height, above, markers) { 20143 this.height = -1; 20144 this.above = 0; 20145 this.markers = []; 20146 this.dom = document.createElement("div"); 20147 this.dom.className = "cm-gutterElement"; 20148 this.update(view, height, above, markers); 20149 } 20150 update(view, height, above, markers) { 20151 if (this.height != height) { 20152 this.height = height; 20153 this.dom.style.height = height + "px"; 20154 } 20155 if (this.above != above) 20156 this.dom.style.marginTop = (this.above = above) ? above + "px" : ""; 20157 if (!sameMarkers(this.markers, markers)) 20158 this.setMarkers(view, markers); 20159 } 20160 setMarkers(view, markers) { 20161 let cls = "cm-gutterElement", domPos = this.dom.firstChild; 20162 for (let iNew = 0, iOld = 0; ; ) { 20163 let skipTo = iOld, marker = iNew < markers.length ? markers[iNew++] : null, matched = false; 20164 if (marker) { 20165 let c2 = marker.elementClass; 20166 if (c2) 20167 cls += " " + c2; 20168 for (let i2 = iOld; i2 < this.markers.length; i2++) 20169 if (this.markers[i2].compare(marker)) { 20170 skipTo = i2; 20171 matched = true; 20172 break; 20173 } 20174 } else { 20175 skipTo = this.markers.length; 20176 } 20177 while (iOld < skipTo) { 20178 let next = this.markers[iOld++]; 20179 if (next.toDOM) { 20180 next.destroy(domPos); 20181 let after = domPos.nextSibling; 20182 domPos.remove(); 20183 domPos = after; 20184 } 20185 } 20186 if (!marker) 20187 break; 20188 if (marker.toDOM) { 20189 if (matched) 20190 domPos = domPos.nextSibling; 20191 else 20192 this.dom.insertBefore(marker.toDOM(view), domPos); 20193 } 20194 if (matched) 20195 iOld++; 20196 } 20197 this.dom.className = cls; 20198 this.markers = markers; 20199 } 20200 destroy() { 20201 this.setMarkers(null, []); 20202 } 20203}; 20204function sameMarkers(a2, b3) { 20205 if (a2.length != b3.length) 20206 return false; 20207 for (let i2 = 0; i2 < a2.length; i2++) 20208 if (!a2[i2].compare(b3[i2])) 20209 return false; 20210 return true; 20211} 20212var lineNumberMarkers = /* @__PURE__ */ Facet.define(); 20213var lineNumberConfig = /* @__PURE__ */ Facet.define({ 20214 combine(values2) { 20215 return combineConfig(values2, { formatNumber: String, domEventHandlers: {} }, { 20216 domEventHandlers(a2, b3) { 20217 let result = Object.assign({}, a2); 20218 for (let event in b3) { 20219 let exists = result[event], add2 = b3[event]; 20220 result[event] = exists ? (view, line, event2) => exists(view, line, event2) || add2(view, line, event2) : add2; 20221 } 20222 return result; 20223 } 20224 }); 20225 } 20226}); 20227var NumberMarker = class extends GutterMarker { 20228 constructor(number2) { 20229 super(); 20230 this.number = number2; 20231 } 20232 eq(other) { 20233 return this.number == other.number; 20234 } 20235 toDOM() { 20236 return document.createTextNode(this.number); 20237 } 20238}; 20239function formatNumber(view, number2) { 20240 return view.state.facet(lineNumberConfig).formatNumber(number2, view.state); 20241} 20242var lineNumberGutter = /* @__PURE__ */ activeGutters.compute([lineNumberConfig], (state) => ({ 20243 class: "cm-lineNumbers", 20244 renderEmptyElements: false, 20245 markers(view) { 20246 return view.state.facet(lineNumberMarkers); 20247 }, 20248 lineMarker(view, line, others) { 20249 if (others.some((m2) => m2.toDOM)) 20250 return null; 20251 return new NumberMarker(formatNumber(view, view.state.doc.lineAt(line.from).number)); 20252 }, 20253 widgetMarker: () => null, 20254 lineMarkerChange: (update) => update.startState.facet(lineNumberConfig) != update.state.facet(lineNumberConfig), 20255 initialSpacer(view) { 20256 return new NumberMarker(formatNumber(view, maxLineNumber(view.state.doc.lines))); 20257 }, 20258 updateSpacer(spacer, update) { 20259 let max = formatNumber(update.view, maxLineNumber(update.view.state.doc.lines)); 20260 return max == spacer.number ? spacer : new NumberMarker(max); 20261 }, 20262 domEventHandlers: state.facet(lineNumberConfig).domEventHandlers 20263})); 20264function lineNumbers(config2 = {}) { 20265 return [ 20266 lineNumberConfig.of(config2), 20267 gutters(), 20268 lineNumberGutter 20269 ]; 20270} 20271function maxLineNumber(lines) { 20272 let last = 9; 20273 while (last < lines) 20274 last = last * 10 + 9; 20275 return last; 20276} 20277var activeLineGutterMarker = /* @__PURE__ */ new class extends GutterMarker { 20278 constructor() { 20279 super(...arguments); 20280 this.elementClass = "cm-activeLineGutter"; 20281 } 20282}(); 20283var activeLineGutterHighlighter = /* @__PURE__ */ gutterLineClass.compute(["selection"], (state) => { 20284 let marks = [], last = -1; 20285 for (let range of state.selection.ranges) { 20286 let linePos = state.doc.lineAt(range.head).from; 20287 if (linePos > last) { 20288 last = linePos; 20289 marks.push(activeLineGutterMarker.range(linePos)); 20290 } 20291 } 20292 return RangeSet.of(marks); 20293}); 20294function highlightActiveLineGutter() { 20295 return activeLineGutterHighlighter; 20296} 20297
vendor: 18,093 bytes, lines 20298-21003
20298// node_modules/fflate/esm/browser.js 20299var u8 = Uint8Array; 20300var u16 = Uint16Array; 20301var i32 = Int32Array; 20302var fleb = new u8([ 20303 0, 20304 0, 20305 0, 20306 0, 20307 0, 20308 0, 20309 0, 20310 0, 20311 1, 20312 1, 20313 1, 20314 1, 20315 2, 20316 2, 20317 2, 20318 2, 20319 3, 20320 3, 20321 3, 20322 3, 20323 4, 20324 4, 20325 4, 20326 4, 20327 5, 20328 5, 20329 5, 20330 5, 20331 0, 20332 /* unused */ 20333 0, 20334 0, 20335 /* impossible */ 20336 0 20337]); 20338var fdeb = new u8([ 20339 0, 20340 0, 20341 0, 20342 0, 20343 1, 20344 1, 20345 2, 20346 2, 20347 3, 20348 3, 20349 4, 20350 4, 20351 5, 20352 5, 20353 6, 20354 6, 20355 7, 20356 7, 20357 8, 20358 8, 20359 9, 20360 9, 20361 10, 20362 10, 20363 11, 20364 11, 20365 12, 20366 12, 20367 13, 20368 13, 20369 /* unused */ 20370 0, 20371 0 20372]); 20373var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 20374var freb = function(eb, start) { 20375 var b3 = new u16(31); 20376 for (var i2 = 0; i2 < 31; ++i2) { 20377 b3[i2] = start += 1 << eb[i2 - 1]; 20378 } 20379 var r2 = new i32(b3[30]); 20380 for (var i2 = 1; i2 < 30; ++i2) { 20381 for (var j3 = b3[i2]; j3 < b3[i2 + 1]; ++j3) { 20382 r2[j3] = j3 - b3[i2] << 5 | i2; 20383 } 20384 } 20385 return { b: b3, r: r2 }; 20386}; 20387var _a = freb(fleb, 2); 20388var fl = _a.b; 20389var revfl = _a.r; 20390fl[28] = 258, revfl[258] = 28; 20391var _b = freb(fdeb, 0); 20392var fd = _b.b; 20393var revfd = _b.r; 20394var rev = new u16(32768); 20395for (i2 = 0; i2 < 32768; ++i2) { 20396 x = (i2 & 43690) >> 1 | (i2 & 21845) << 1; 20397 x = (x & 52428) >> 2 | (x & 13107) << 2; 20398 x = (x & 61680) >> 4 | (x & 3855) << 4; 20399 rev[i2] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1; 20400} 20401var x; 20402var i2; 20403var hMap = function(cd, mb, r2) { 20404 var s2 = cd.length; 20405 var i2 = 0; 20406 var l3 = new u16(mb); 20407 for (; i2 < s2; ++i2) { 20408 if (cd[i2]) 20409 ++l3[cd[i2] - 1]; 20410 } 20411 var le2 = new u16(mb); 20412 for (i2 = 1; i2 < mb; ++i2) { 20413 le2[i2] = le2[i2 - 1] + l3[i2 - 1] << 1; 20414 } 20415 var co; 20416 if (r2) { 20417 co = new u16(1 << mb); 20418 var rvb = 15 - mb; 20419 for (i2 = 0; i2 < s2; ++i2) { 20420 if (cd[i2]) { 20421 var sv = i2 << 4 | cd[i2]; 20422 var r_1 = mb - cd[i2]; 20423 var v2 = le2[cd[i2] - 1]++ << r_1; 20424 for (var m2 = v2 | (1 << r_1) - 1; v2 <= m2; ++v2) { 20425 co[rev[v2] >> rvb] = sv; 20426 } 20427 } 20428 } 20429 } else { 20430 co = new u16(s2); 20431 for (i2 = 0; i2 < s2; ++i2) { 20432 if (cd[i2]) { 20433 co[i2] = rev[le2[cd[i2] - 1]++] >> 15 - cd[i2]; 20434 } 20435 } 20436 } 20437 return co; 20438}; 20439var flt = new u8(288); 20440for (i2 = 0; i2 < 144; ++i2) 20441 flt[i2] = 8; 20442var i2; 20443for (i2 = 144; i2 < 256; ++i2) 20444 flt[i2] = 9; 20445var i2; 20446for (i2 = 256; i2 < 280; ++i2) 20447 flt[i2] = 7; 20448var i2; 20449for (i2 = 280; i2 < 288; ++i2) 20450 flt[i2] = 8; 20451var i2; 20452var fdt = new u8(32); 20453for (i2 = 0; i2 < 32; ++i2) 20454 fdt[i2] = 5; 20455var i2; 20456var flm = /* @__PURE__ */ hMap(flt, 9, 0); 20457var fdm = /* @__PURE__ */ hMap(fdt, 5, 0); 20458var shft = function(p2) { 20459 return (p2 + 7) / 8 | 0; 20460}; 20461var slc = function(v2, s2, e2) { 20462 if (s2 == null || s2 < 0) 20463 s2 = 0; 20464 if (e2 == null || e2 > v2.length) 20465 e2 = v2.length; 20466 return new u8(v2.subarray(s2, e2)); 20467}; 20468var ec = [ 20469 "unexpected EOF", 20470 "invalid block type", 20471 "invalid length/literal", 20472 "invalid distance", 20473 "stream finished", 20474 "no stream handler", 20475 , 20476 "no callback", 20477 "invalid UTF-8 data", 20478 "extra field too long", 20479 "date not in range 1980-2099", 20480 "filename too long", 20481 "stream finishing", 20482 "invalid zip data" 20483 // determined by unknown compression method 20484]; 20485var err = function(ind, msg, nt) { 20486 var e2 = new Error(msg || ec[ind]); 20487 e2.code = ind; 20488 if (Error.captureStackTrace) 20489 Error.captureStackTrace(e2, err); 20490 if (!nt) 20491 throw e2; 20492 return e2; 20493}; 20494var wbits = function(d2, p2, v2) { 20495 v2 <<= p2 & 7; 20496 var o2 = p2 / 8 | 0; 20497 d2[o2] |= v2; 20498 d2[o2 + 1] |= v2 >> 8; 20499}; 20500var wbits16 = function(d2, p2, v2) { 20501 v2 <<= p2 & 7; 20502 var o2 = p2 / 8 | 0; 20503 d2[o2] |= v2; 20504 d2[o2 + 1] |= v2 >> 8; 20505 d2[o2 + 2] |= v2 >> 16; 20506}; 20507var hTree = function(d2, mb) { 20508 var t3 = []; 20509 for (var i2 = 0; i2 < d2.length; ++i2) { 20510 if (d2[i2]) 20511 t3.push({ s: i2, f: d2[i2] }); 20512 } 20513 var s2 = t3.length; 20514 var t22 = t3.slice(); 20515 if (!s2) 20516 return { t: et, l: 0 }; 20517 if (s2 == 1) { 20518 var v2 = new u8(t3[0].s + 1); 20519 v2[t3[0].s] = 1; 20520 return { t: v2, l: 1 }; 20521 } 20522 t3.sort(function(a2, b3) { 20523 return a2.f - b3.f; 20524 }); 20525 t3.push({ s: -1, f: 25001 }); 20526 var l3 = t3[0], r2 = t3[1], i0 = 0, i1 = 1, i22 = 2; 20527 t3[0] = { s: -1, f: l3.f + r2.f, l: l3, r: r2 }; 20528 while (i1 != s2 - 1) { 20529 l3 = t3[t3[i0].f < t3[i22].f ? i0++ : i22++]; 20530 r2 = t3[i0 != i1 && t3[i0].f < t3[i22].f ? i0++ : i22++]; 20531 t3[i1++] = { s: -1, f: l3.f + r2.f, l: l3, r: r2 }; 20532 } 20533 var maxSym = t22[0].s; 20534 for (var i2 = 1; i2 < s2; ++i2) { 20535 if (t22[i2].s > maxSym) 20536 maxSym = t22[i2].s; 20537 } 20538 var tr = new u16(maxSym + 1); 20539 var mbt = ln(t3[i1 - 1], tr, 0); 20540 if (mbt > mb) { 20541 var i2 = 0, dt = 0; 20542 var lft = mbt - mb, cst = 1 << lft; 20543 t22.sort(function(a2, b3) { 20544 return tr[b3.s] - tr[a2.s] || a2.f - b3.f; 20545 }); 20546 for (; i2 < s2; ++i2) { 20547 var i2_1 = t22[i2].s; 20548 if (tr[i2_1] > mb) { 20549 dt += cst - (1 << mbt - tr[i2_1]); 20550 tr[i2_1] = mb; 20551 } else 20552 break; 20553 } 20554 dt >>= lft; 20555 while (dt > 0) { 20556 var i2_2 = t22[i2].s; 20557 if (tr[i2_2] < mb) 20558 dt -= 1 << mb - tr[i2_2]++ - 1; 20559 else 20560 ++i2; 20561 } 20562 for (; i2 >= 0 && dt; --i2) { 20563 var i2_3 = t22[i2].s; 20564 if (tr[i2_3] == mb) { 20565 --tr[i2_3]; 20566 ++dt; 20567 } 20568 } 20569 mbt = mb; 20570 } 20571 return { t: new u8(tr), l: mbt }; 20572}; 20573var ln = function(n3, l3, d2) { 20574 return n3.s == -1 ? Math.max(ln(n3.l, l3, d2 + 1), ln(n3.r, l3, d2 + 1)) : l3[n3.s] = d2; 20575}; 20576var lc = function(c2) { 20577 var s2 = c2.length; 20578 while (s2 && !c2[--s2]) 20579 ; 20580 var cl = new u16(++s2); 20581 var cli = 0, cln = c2[0], cls = 1; 20582 var w2 = function(v2) { 20583 cl[cli++] = v2; 20584 }; 20585 for (var i2 = 1; i2 <= s2; ++i2) { 20586 if (c2[i2] == cln && i2 != s2) 20587 ++cls; 20588 else { 20589 if (!cln && cls > 2) { 20590 for (; cls > 138; cls -= 138) 20591 w2(32754); 20592 if (cls > 2) { 20593 w2(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305); 20594 cls = 0; 20595 } 20596 } else if (cls > 3) { 20597 w2(cln), --cls; 20598 for (; cls > 6; cls -= 6) 20599 w2(8304); 20600 if (cls > 2) 20601 w2(cls - 3 << 5 | 8208), cls = 0; 20602 } 20603 while (cls--) 20604 w2(cln); 20605 cls = 1; 20606 cln = c2[i2]; 20607 } 20608 } 20609 return { c: cl.subarray(0, cli), n: s2 }; 20610}; 20611var clen = function(cf, cl) { 20612 var l3 = 0; 20613 for (var i2 = 0; i2 < cl.length; ++i2) 20614 l3 += cf[i2] * cl[i2]; 20615 return l3; 20616}; 20617var wfblk = function(out, pos, dat) { 20618 var s2 = dat.length; 20619 var o2 = shft(pos + 2); 20620 out[o2] = s2 & 255; 20621 out[o2 + 1] = s2 >> 8; 20622 out[o2 + 2] = out[o2] ^ 255; 20623 out[o2 + 3] = out[o2 + 1] ^ 255; 20624 for (var i2 = 0; i2 < s2; ++i2) 20625 out[o2 + i2 + 4] = dat[i2]; 20626 return (o2 + 4 + s2) * 8; 20627}; 20628var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p2) { 20629 wbits(out, p2++, final); 20630 ++lf[256]; 20631 var _a3 = hTree(lf, 15), dlt = _a3.t, mlb = _a3.l; 20632 var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l; 20633 var _c = lc(dlt), lclt = _c.c, nlc = _c.n; 20634 var _d = lc(ddt), lcdt = _d.c, ndc = _d.n; 20635 var lcfreq = new u16(19); 20636 for (var i2 = 0; i2 < lclt.length; ++i2) 20637 ++lcfreq[lclt[i2] & 31]; 20638 for (var i2 = 0; i2 < lcdt.length; ++i2) 20639 ++lcfreq[lcdt[i2] & 31]; 20640 var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l; 20641 var nlcc = 19; 20642 for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc) 20643 ; 20644 var flen = bl + 5 << 3; 20645 var ftlen = clen(lf, flt) + clen(df, fdt) + eb; 20646 var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]; 20647 if (bs >= 0 && flen <= ftlen && flen <= dtlen) 20648 return wfblk(out, p2, dat.subarray(bs, bs + bl)); 20649 var lm, ll, dm, dl; 20650 wbits(out, p2, 1 + (dtlen < ftlen)), p2 += 2; 20651 if (dtlen < ftlen) { 20652 lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt; 20653 var llm = hMap(lct, mlcb, 0); 20654 wbits(out, p2, nlc - 257); 20655 wbits(out, p2 + 5, ndc - 1); 20656 wbits(out, p2 + 10, nlcc - 4); 20657 p2 += 14; 20658 for (var i2 = 0; i2 < nlcc; ++i2) 20659 wbits(out, p2 + 3 * i2, lct[clim[i2]]); 20660 p2 += 3 * nlcc; 20661 var lcts = [lclt, lcdt]; 20662 for (var it = 0; it < 2; ++it) { 20663 var clct = lcts[it]; 20664 for (var i2 = 0; i2 < clct.length; ++i2) { 20665 var len = clct[i2] & 31; 20666 wbits(out, p2, llm[len]), p2 += lct[len]; 20667 if (len > 15) 20668 wbits(out, p2, clct[i2] >> 5 & 127), p2 += clct[i2] >> 12; 20669 } 20670 } 20671 } else { 20672 lm = flm, ll = flt, dm = fdm, dl = fdt; 20673 } 20674 for (var i2 = 0; i2 < li; ++i2) { 20675 var sym = syms[i2]; 20676 if (sym > 255) { 20677 var len = sym >> 18 & 31; 20678 wbits16(out, p2, lm[len + 257]), p2 += ll[len + 257]; 20679 if (len > 7) 20680 wbits(out, p2, sym >> 23 & 31), p2 += fleb[len]; 20681 var dst = sym & 31; 20682 wbits16(out, p2, dm[dst]), p2 += dl[dst]; 20683 if (dst > 3) 20684 wbits16(out, p2, sym >> 5 & 8191), p2 += fdeb[dst]; 20685 } else { 20686 wbits16(out, p2, lm[sym]), p2 += ll[sym]; 20687 } 20688 } 20689 wbits16(out, p2, lm[256]); 20690 return p2 + ll[256]; 20691}; 20692var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]); 20693var et = /* @__PURE__ */ new u8(0); 20694var dflt = function(dat, lvl, plvl, pre, post, st) { 20695 var s2 = st.z || dat.length; 20696 var o2 = new u8(pre + s2 + 5 * (1 + Math.ceil(s2 / 7e3)) + post); 20697 var w2 = o2.subarray(pre, o2.length - post); 20698 var lst = st.l; 20699 var pos = (st.r || 0) & 7; 20700 if (lvl) { 20701 if (pos) 20702 w2[0] = st.r >> 3; 20703 var opt = deo[lvl - 1]; 20704 var n3 = opt >> 13, c2 = opt & 8191; 20705 var msk_1 = (1 << plvl) - 1; 20706 var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1); 20707 var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1; 20708 var hsh = function(i3) { 20709 return (dat[i3] ^ dat[i3 + 1] << bs1_1 ^ dat[i3 + 2] << bs2_1) & msk_1; 20710 }; 20711 var syms = new i32(25e3); 20712 var lf = new u16(288), df = new u16(32); 20713 var lc_1 = 0, eb = 0, i2 = st.i || 0, li = 0, wi = st.w || 0, bs = 0; 20714 for (; i2 + 2 < s2; ++i2) { 20715 var hv = hsh(i2); 20716 var imod = i2 & 32767, pimod = head[hv]; 20717 prev[imod] = pimod; 20718 head[hv] = imod; 20719 if (wi <= i2) { 20720 var rem = s2 - i2; 20721 if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) { 20722 pos = wblk(dat, w2, 0, syms, lf, df, eb, li, bs, i2 - bs, pos); 20723 li = lc_1 = eb = 0, bs = i2; 20724 for (var j3 = 0; j3 < 286; ++j3) 20725 lf[j3] = 0; 20726 for (var j3 = 0; j3 < 30; ++j3) 20727 df[j3] = 0; 20728 } 20729 var l3 = 2, d2 = 0, ch_1 = c2, dif = imod - pimod & 32767; 20730 if (rem > 2 && hv == hsh(i2 - dif)) { 20731 var maxn = Math.min(n3, rem) - 1; 20732 var maxd = Math.min(32767, i2); 20733 var ml = Math.min(258, rem); 20734 while (dif <= maxd && --ch_1 && imod != pimod) { 20735 if (dat[i2 + l3] == dat[i2 + l3 - dif]) { 20736 var nl = 0; 20737 for (; nl < ml && dat[i2 + nl] == dat[i2 + nl - dif]; ++nl) 20738 ; 20739 if (nl > l3) { 20740 l3 = nl, d2 = dif; 20741 if (nl > maxn) 20742 break; 20743 var mmd = Math.min(dif, nl - 2); 20744 var md = 0; 20745 for (var j3 = 0; j3 < mmd; ++j3) { 20746 var ti = i2 - dif + j3 & 32767; 20747 var pti = prev[ti]; 20748 var cd = ti - pti & 32767; 20749 if (cd > md) 20750 md = cd, pimod = ti; 20751 } 20752 } 20753 } 20754 imod = pimod, pimod = prev[imod]; 20755 dif += imod - pimod & 32767; 20756 } 20757 } 20758 if (d2) { 20759 syms[li++] = 268435456 | revfl[l3] << 18 | revfd[d2]; 20760 var lin = revfl[l3] & 31, din = revfd[d2] & 31; 20761 eb += fleb[lin] + fdeb[din]; 20762 ++lf[257 + lin]; 20763 ++df[din]; 20764 wi = i2 + l3; 20765 ++lc_1; 20766 } else { 20767 syms[li++] = dat[i2]; 20768 ++lf[dat[i2]]; 20769 } 20770 } 20771 } 20772 for (i2 = Math.max(i2, wi); i2 < s2; ++i2) { 20773 syms[li++] = dat[i2]; 20774 ++lf[dat[i2]]; 20775 } 20776 pos = wblk(dat, w2, lst, syms, lf, df, eb, li, bs, i2 - bs, pos); 20777 if (!lst) { 20778 st.r = pos & 7 | w2[pos / 8 | 0] << 3; 20779 pos -= 7; 20780 st.h = head, st.p = prev, st.i = i2, st.w = wi; 20781 } 20782 } else { 20783 for (var i2 = st.w || 0; i2 < s2 + lst; i2 += 65535) { 20784 var e2 = i2 + 65535; 20785 if (e2 >= s2) { 20786 w2[pos / 8 | 0] = lst; 20787 e2 = s2; 20788 } 20789 pos = wfblk(w2, pos + 1, dat.subarray(i2, e2)); 20790 } 20791 st.i = s2; 20792 } 20793 return slc(o2, 0, pre + shft(pos) + post); 20794}; 20795var crct = /* @__PURE__ */ function() { 20796 var t3 = new Int32Array(256); 20797 for (var i2 = 0; i2 < 256; ++i2) { 20798 var c2 = i2, k = 9; 20799 while (--k) 20800 c2 = (c2 & 1 && -306674912) ^ c2 >>> 1; 20801 t3[i2] = c2; 20802 } 20803 return t3; 20804}(); 20805var crc = function() { 20806 var c2 = -1; 20807 return { 20808 p: function(d2) { 20809 var cr = c2; 20810 for (var i2 = 0; i2 < d2.length; ++i2) 20811 cr = crct[cr & 255 ^ d2[i2]] ^ cr >>> 8; 20812 c2 = cr; 20813 }, 20814 d: function() { 20815 return ~c2; 20816 } 20817 }; 20818}; 20819var dopt = function(dat, opt, pre, post, st) { 20820 if (!st) { 20821 st = { l: 1 }; 20822 if (opt.dictionary) { 20823 var dict = opt.dictionary.subarray(-32768); 20824 var newDat = new u8(dict.length + dat.length); 20825 newDat.set(dict); 20826 newDat.set(dat, dict.length); 20827 dat = newDat; 20828 st.w = dict.length; 20829 } 20830 } 20831 return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 12 + opt.mem, pre, post, st); 20832}; 20833var mrg = function(a2, b3) { 20834 var o2 = {}; 20835 for (var k in a2) 20836 o2[k] = a2[k]; 20837 for (var k in b3) 20838 o2[k] = b3[k]; 20839 return o2; 20840}; 20841var wbytes = function(d2, b3, v2) { 20842 for (; v2; ++b3) 20843 d2[b3] = v2, v2 >>>= 8; 20844}; 20845function deflateSync(data, opts) { 20846 return dopt(data, opts || {}, 0, 0); 20847} 20848var fltn = function(d2, p2, t3, o2) { 20849 for (var k in d2) { 20850 var val = d2[k], n3 = p2 + k, op = o2; 20851 if (Array.isArray(val)) 20852 op = mrg(o2, val[1]), val = val[0]; 20853 if (val instanceof u8) 20854 t3[n3] = [val, op]; 20855 else { 20856 t3[n3 += "/"] = [new u8(0), op]; 20857 fltn(val, n3, t3, o2); 20858 } 20859 } 20860}; 20861var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder(); 20862var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder(); 20863var tds = 0; 20864try { 20865 td.decode(et, { stream: true }); 20866 tds = 1; 20867} catch (e2) { 20868} 20869function strToU8(str, latin1) { 20870 if (latin1) { 20871 var ar_1 = new u8(str.length); 20872 for (var i2 = 0; i2 < str.length; ++i2) 20873 ar_1[i2] = str.charCodeAt(i2); 20874 return ar_1; 20875 } 20876 if (te) 20877 return te.encode(str); 20878 var l3 = str.length; 20879 var ar = new u8(str.length + (str.length >> 1)); 20880 var ai = 0; 20881 var w2 = function(v2) { 20882 ar[ai++] = v2; 20883 }; 20884 for (var i2 = 0; i2 < l3; ++i2) { 20885 if (ai + 5 > ar.length) { 20886 var n3 = new u8(ai + 8 + (l3 - i2 << 1)); 20887 n3.set(ar); 20888 ar = n3; 20889 } 20890 var c2 = str.charCodeAt(i2); 20891 if (c2 < 128 || latin1) 20892 w2(c2); 20893 else if (c2 < 2048) 20894 w2(192 | c2 >> 6), w2(128 | c2 & 63); 20895 else if (c2 > 55295 && c2 < 57344) 20896 c2 = 65536 + (c2 & 1023 << 10) | str.charCodeAt(++i2) & 1023, w2(240 | c2 >> 18), w2(128 | c2 >> 12 & 63), w2(128 | c2 >> 6 & 63), w2(128 | c2 & 63); 20897 else 20898 w2(224 | c2 >> 12), w2(128 | c2 >> 6 & 63), w2(128 | c2 & 63); 20899 } 20900 return slc(ar, 0, ai); 20901} 20902var exfl = function(ex) { 20903 var le2 = 0; 20904 if (ex) { 20905 for (var k in ex) { 20906 var l3 = ex[k].length; 20907 if (l3 > 65535) 20908 err(9); 20909 le2 += l3 + 4; 20910 } 20911 } 20912 return le2; 20913}; 20914var wzh = function(d2, b3, f3, fn, u3, c2, ce, co) { 20915 var fl2 = fn.length, ex = f3.extra, col = co && co.length; 20916 var exl = exfl(ex); 20917 wbytes(d2, b3, ce != null ? 33639248 : 67324752), b3 += 4; 20918 if (ce != null) 20919 d2[b3++] = 20, d2[b3++] = f3.os; 20920 d2[b3] = 20, b3 += 2; 20921 d2[b3++] = f3.flag << 1 | (c2 < 0 && 8), d2[b3++] = u3 && 8; 20922 d2[b3++] = f3.compression & 255, d2[b3++] = f3.compression >> 8; 20923 var dt = new Date(f3.mtime == null ? Date.now() : f3.mtime), y2 = dt.getFullYear() - 1980; 20924 if (y2 < 0 || y2 > 119) 20925 err(10); 20926 wbytes(d2, b3, y2 << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b3 += 4; 20927 if (c2 != -1) { 20928 wbytes(d2, b3, f3.crc); 20929 wbytes(d2, b3 + 4, c2 < 0 ? -c2 - 2 : c2); 20930 wbytes(d2, b3 + 8, f3.size); 20931 } 20932 wbytes(d2, b3 + 12, fl2); 20933 wbytes(d2, b3 + 14, exl), b3 += 16; 20934 if (ce != null) { 20935 wbytes(d2, b3, col); 20936 wbytes(d2, b3 + 6, f3.attrs); 20937 wbytes(d2, b3 + 10, ce), b3 += 14; 20938 } 20939 d2.set(fn, b3); 20940 b3 += fl2; 20941 if (exl) { 20942 for (var k in ex) { 20943 var exf = ex[k], l3 = exf.length; 20944 wbytes(d2, b3, +k); 20945 wbytes(d2, b3 + 2, l3); 20946 d2.set(exf, b3 + 4), b3 += 4 + l3; 20947 } 20948 } 20949 if (col) 20950 d2.set(co, b3), b3 += col; 20951 return b3; 20952}; 20953var wzf = function(o2, b3, c2, d2, e2) { 20954 wbytes(o2, b3, 101010256); 20955 wbytes(o2, b3 + 8, c2); 20956 wbytes(o2, b3 + 10, c2); 20957 wbytes(o2, b3 + 12, d2); 20958 wbytes(o2, b3 + 16, e2); 20959}; 20960function zipSync(data, opts) { 20961 if (!opts) 20962 opts = {}; 20963 var r2 = {}; 20964 var files = []; 20965 fltn(data, "", r2, opts); 20966 var o2 = 0; 20967 var tot = 0; 20968 for (var fn in r2) { 20969 var _a3 = r2[fn], file = _a3[0], p2 = _a3[1]; 20970 var compression = p2.level == 0 ? 0 : 8; 20971 var f3 = strToU8(fn), s2 = f3.length; 20972 var com = p2.comment, m2 = com && strToU8(com), ms = m2 && m2.length; 20973 var exl = exfl(p2.extra); 20974 if (s2 > 65535) 20975 err(11); 20976 var d2 = compression ? deflateSync(file, p2) : file, l3 = d2.length; 20977 var c2 = crc(); 20978 c2.p(file); 20979 files.push(mrg(p2, { 20980 size: file.length, 20981 crc: c2.d(), 20982 c: d2, 20983 f: f3, 20984 m: m2, 20985 u: s2 != fn.length || m2 && com.length != ms, 20986 o: o2, 20987 compression 20988 })); 20989 o2 += 30 + s2 + exl + l3; 20990 tot += 76 + 2 * (s2 + exl) + (ms || 0) + l3; 20991 } 20992 var out = new u8(tot + 22), oe2 = o2, cdl = tot - o2; 20993 for (var i2 = 0; i2 < files.length; ++i2) { 20994 var f3 = files[i2]; 20995 wzh(out, f3.o, f3, f3.f, f3.u, f3.c.length); 20996 var badd = 30 + f3.f.length + exfl(f3.extra); 20997 out.set(f3.c, f3.o + badd); 20998 wzh(out, o2, f3, f3.f, f3.u, f3.c.length, f3.o, f3.m), o2 += 16 + badd + (f3.m ? f3.m.length : 0); 20999 } 21000 wzf(out, o2, files.length, cdl, oe2); 21001 return out; 21002} 21003
21004// src/Components/Editor.tsx 21005var React4 = __toESM(require_react()); 21006
vendor: 183 bytes, lines 21007-21011
21007// node_modules/react-hot-toast/dist/index.mjs 21008var import_react = __toESM(require_react(), 1); 21009var import_react2 = __toESM(require_react(), 1); 21010var l2 = __toESM(require_react(), 1); 21011
vendor: 3,327 bytes, lines 21012-21090
21012// node_modules/goober/dist/goober.modern.js 21013var e = { data: "" }; 21014var t = (t3) => "object" == typeof window ? ((t3 ? t3.querySelector("#_goober") : window._goober) || Object.assign((t3 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t3 || e; 21015var l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g; 21016var a = /\/\*[^]*?\*\/| +/g; 21017var n = /\n+/g; 21018var o = (e2, t3) => { 21019 let r2 = "", l3 = "", a2 = ""; 21020 for (let n3 in e2) { 21021 let c2 = e2[n3]; 21022 "@" == n3[0] ? "i" == n3[1] ? r2 = n3 + " " + c2 + ";" : l3 += "f" == n3[1] ? o(c2, n3) : n3 + "{" + o(c2, "k" == n3[1] ? "" : t3) + "}" : "object" == typeof c2 ? l3 += o(c2, t3 ? t3.replace(/([^,])+/g, (e3) => n3.replace(/(^:.*)|([^,])+/g, (t4) => /&/.test(t4) ? t4.replace(/&/g, e3) : e3 ? e3 + " " + t4 : t4)) : n3) : null != c2 && (n3 = /^--/.test(n3) ? n3 : n3.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o.p ? o.p(n3, c2) : n3 + ":" + c2 + ";"); 21023 } 21024 return r2 + (t3 && a2 ? t3 + "{" + a2 + "}" : a2) + l3; 21025}; 21026var c = {}; 21027var s = (e2) => { 21028 if ("object" == typeof e2) { 21029 let t3 = ""; 21030 for (let r2 in e2) 21031 t3 += r2 + s(e2[r2]); 21032 return t3; 21033 } 21034 return e2; 21035}; 21036var i = (e2, t3, r2, i2, p2) => { 21037 let u3 = s(e2), d2 = c[u3] || (c[u3] = ((e3) => { 21038 let t4 = 0, r3 = 11; 21039 for (; t4 < e3.length; ) 21040 r3 = 101 * r3 + e3.charCodeAt(t4++) >>> 0; 21041 return "go" + r3; 21042 })(u3)); 21043 if (!c[d2]) { 21044 let t4 = u3 !== e2 ? e2 : ((e3) => { 21045 let t5, r3, o2 = [{}]; 21046 for (; t5 = l.exec(e3.replace(a, "")); ) 21047 t5[4] ? o2.shift() : t5[3] ? (r3 = t5[3].replace(n, " ").trim(), o2.unshift(o2[0][r3] = o2[0][r3] || {})) : o2[0][t5[1]] = t5[2].replace(n, " ").trim(); 21048 return o2[0]; 21049 })(e2); 21050 c[d2] = o(p2 ? { ["@keyframes " + d2]: t4 } : t4, r2 ? "" : "." + d2); 21051 } 21052 let f3 = r2 && c.g ? c.g : null; 21053 return r2 && (c.g = c[d2]), ((e3, t4, r3, l3) => { 21054 l3 ? t4.data = t4.data.replace(l3, e3) : -1 === t4.data.indexOf(e3) && (t4.data = r3 ? e3 + t4.data : t4.data + e3); 21055 })(c[d2], t3, i2, f3), d2; 21056}; 21057var p = (e2, t3, r2) => e2.reduce((e3, l3, a2) => { 21058 let n3 = t3[a2]; 21059 if (n3 && n3.call) { 21060 let e4 = n3(r2), t4 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4; 21061 n3 = t4 ? "." + t4 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4; 21062 } 21063 return e3 + l3 + (null == n3 ? "" : n3); 21064}, ""); 21065function u(e2) { 21066 let r2 = this || {}, l3 = e2.call ? e2(r2.p) : e2; 21067 return i(l3.unshift ? l3.raw ? p(l3, [].slice.call(arguments, 1), r2.p) : l3.reduce((e3, t3) => Object.assign(e3, t3 && t3.call ? t3(r2.p) : t3), {}) : l3, t(r2.target), r2.g, r2.o, r2.k); 21068} 21069var d; 21070var f; 21071var g; 21072var b = u.bind({ g: 1 }); 21073var h = u.bind({ k: 1 }); 21074function m(e2, t3, r2, l3) { 21075 o.p = t3, d = e2, f = r2, g = l3; 21076} 21077function j(e2, t3) { 21078 let r2 = this || {}; 21079 return function() { 21080 let l3 = arguments; 21081 function a2(n3, o2) { 21082 let c2 = Object.assign({}, n3), s2 = c2.className || a2.className; 21083 r2.p = Object.assign({ theme: f && f() }, c2), r2.o = / *go\d+/.test(s2), c2.className = u.apply(r2, l3) + (s2 ? " " + s2 : ""), t3 && (c2.ref = o2); 21084 let i2 = e2; 21085 return e2[0] && (i2 = c2.as || e2, delete c2.as), g && i2[0] && g(c2), d(i2, c2); 21086 } 21087 return t3 ? t3(a2) : a2; 21088 }; 21089} 21090
vendor: 11,482 bytes, lines 21091-21455
21091// node_modules/react-hot-toast/dist/index.mjs 21092var y = __toESM(require_react(), 1); 21093var f2 = __toESM(require_react(), 1); 21094var W = (e2) => typeof e2 == "function"; 21095var T = (e2, t3) => W(e2) ? e2(t3) : e2; 21096var U = (() => { 21097 let e2 = 0; 21098 return () => (++e2).toString(); 21099})(); 21100var b2 = (() => { 21101 let e2; 21102 return () => { 21103 if (e2 === void 0 && typeof window < "u") { 21104 let t3 = matchMedia("(prefers-reduced-motion: reduce)"); 21105 e2 = !t3 || t3.matches; 21106 } 21107 return e2; 21108 }; 21109})(); 21110var Q = 20; 21111var S = /* @__PURE__ */ new Map(); 21112var X = 1e3; 21113var $ = (e2) => { 21114 if (S.has(e2)) 21115 return; 21116 let t3 = setTimeout(() => { 21117 S.delete(e2), u2({ type: 4, toastId: e2 }); 21118 }, X); 21119 S.set(e2, t3); 21120}; 21121var J = (e2) => { 21122 let t3 = S.get(e2); 21123 t3 && clearTimeout(t3); 21124}; 21125var v = (e2, t3) => { 21126 switch (t3.type) { 21127 case 0: 21128 return { ...e2, toasts: [t3.toast, ...e2.toasts].slice(0, Q) }; 21129 case 1: 21130 return t3.toast.id && J(t3.toast.id), { ...e2, toasts: e2.toasts.map((r2) => r2.id === t3.toast.id ? { ...r2, ...t3.toast } : r2) }; 21131 case 2: 21132 let { toast: o2 } = t3; 21133 return e2.toasts.find((r2) => r2.id === o2.id) ? v(e2, { type: 1, toast: o2 }) : v(e2, { type: 0, toast: o2 }); 21134 case 3: 21135 let { toastId: s2 } = t3; 21136 return s2 ? $(s2) : e2.toasts.forEach((r2) => { 21137 $(r2.id); 21138 }), { ...e2, toasts: e2.toasts.map((r2) => r2.id === s2 || s2 === void 0 ? { ...r2, visible: false } : r2) }; 21139 case 4: 21140 return t3.toastId === void 0 ? { ...e2, toasts: [] } : { ...e2, toasts: e2.toasts.filter((r2) => r2.id !== t3.toastId) }; 21141 case 5: 21142 return { ...e2, pausedAt: t3.time }; 21143 case 6: 21144 let a2 = t3.time - (e2.pausedAt || 0); 21145 return { ...e2, pausedAt: void 0, toasts: e2.toasts.map((r2) => ({ ...r2, pauseDuration: r2.pauseDuration + a2 })) }; 21146 } 21147}; 21148var A = []; 21149var P = { toasts: [], pausedAt: void 0 }; 21150var u2 = (e2) => { 21151 P = v(P, e2), A.forEach((t3) => { 21152 t3(P); 21153 }); 21154}; 21155var Y = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }; 21156var I = (e2 = {}) => { 21157 let [t3, o2] = (0, import_react.useState)(P); 21158 (0, import_react.useEffect)(() => (A.push(o2), () => { 21159 let a2 = A.indexOf(o2); 21160 a2 > -1 && A.splice(a2, 1); 21161 }), [t3]); 21162 let s2 = t3.toasts.map((a2) => { 21163 var r2, c2; 21164 return { ...e2, ...e2[a2.type], ...a2, duration: a2.duration || ((r2 = e2[a2.type]) == null ? void 0 : r2.duration) || (e2 == null ? void 0 : e2.duration) || Y[a2.type], style: { ...e2.style, ...(c2 = e2[a2.type]) == null ? void 0 : c2.style, ...a2.style } }; 21165 }); 21166 return { ...t3, toasts: s2 }; 21167}; 21168var G = (e2, t3 = "blank", o2) => ({ createdAt: Date.now(), visible: true, type: t3, ariaProps: { role: "status", "aria-live": "polite" }, message: e2, pauseDuration: 0, ...o2, id: (o2 == null ? void 0 : o2.id) || U() }); 21169var h2 = (e2) => (t3, o2) => { 21170 let s2 = G(t3, e2, o2); 21171 return u2({ type: 2, toast: s2 }), s2.id; 21172}; 21173var n2 = (e2, t3) => h2("blank")(e2, t3); 21174n2.error = h2("error"); 21175n2.success = h2("success"); 21176n2.loading = h2("loading"); 21177n2.custom = h2("custom"); 21178n2.dismiss = (e2) => { 21179 u2({ type: 3, toastId: e2 }); 21180}; 21181n2.remove = (e2) => u2({ type: 4, toastId: e2 }); 21182n2.promise = (e2, t3, o2) => { 21183 let s2 = n2.loading(t3.loading, { ...o2, ...o2 == null ? void 0 : o2.loading }); 21184 return e2.then((a2) => (n2.success(T(t3.success, a2), { id: s2, ...o2, ...o2 == null ? void 0 : o2.success }), a2)).catch((a2) => { 21185 n2.error(T(t3.error, a2), { id: s2, ...o2, ...o2 == null ? void 0 : o2.error }); 21186 }), e2; 21187}; 21188var Z = (e2, t3) => { 21189 u2({ type: 1, toast: { id: e2, height: t3 } }); 21190}; 21191var ee = () => { 21192 u2({ type: 5, time: Date.now() }); 21193}; 21194var D = (e2) => { 21195 let { toasts: t3, pausedAt: o2 } = I(e2); 21196 (0, import_react2.useEffect)(() => { 21197 if (o2) 21198 return; 21199 let r2 = Date.now(), c2 = t3.map((i2) => { 21200 if (i2.duration === 1 / 0) 21201 return; 21202 let d2 = (i2.duration || 0) + i2.pauseDuration - (r2 - i2.createdAt); 21203 if (d2 < 0) { 21204 i2.visible && n2.dismiss(i2.id); 21205 return; 21206 } 21207 return setTimeout(() => n2.dismiss(i2.id), d2); 21208 }); 21209 return () => { 21210 c2.forEach((i2) => i2 && clearTimeout(i2)); 21211 }; 21212 }, [t3, o2]); 21213 let s2 = (0, import_react2.useCallback)(() => { 21214 o2 && u2({ type: 6, time: Date.now() }); 21215 }, [o2]), a2 = (0, import_react2.useCallback)((r2, c2) => { 21216 let { reverseOrder: i2 = false, gutter: d2 = 8, defaultPosition: p2 } = c2 || {}, g2 = t3.filter((m2) => (m2.position || p2) === (r2.position || p2) && m2.height), E = g2.findIndex((m2) => m2.id === r2.id), x = g2.filter((m2, R) => R < E && m2.visible).length; 21217 return g2.filter((m2) => m2.visible).slice(...i2 ? [x + 1] : [0, x]).reduce((m2, R) => m2 + (R.height || 0) + d2, 0); 21218 }, [t3]); 21219 return { toasts: t3, handlers: { updateHeight: Z, startPause: ee, endPause: s2, calculateOffset: a2 } }; 21220}; 21221var oe = h` 21222from { 21223 transform: scale(0) rotate(45deg); 21224 opacity: 0; 21225} 21226to { 21227 transform: scale(1) rotate(45deg); 21228 opacity: 1; 21229}`; 21230var re = h` 21231from { 21232 transform: scale(0); 21233 opacity: 0; 21234} 21235to { 21236 transform: scale(1); 21237 opacity: 1; 21238}`; 21239var se = h` 21240from { 21241 transform: scale(0) rotate(90deg); 21242 opacity: 0; 21243} 21244to { 21245 transform: scale(1) rotate(90deg); 21246 opacity: 1; 21247}`; 21248var _ = j("div")` 21249 width: 20px; 21250 opacity: 0; 21251 height: 20px; 21252 border-radius: 10px; 21253 background: ${(e2) => e2.primary || "#ff4b4b"}; 21254 position: relative; 21255 transform: rotate(45deg); 21256 21257 animation: ${oe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 21258 forwards; 21259 animation-delay: 100ms; 21260 21261 &:after, 21262 &:before { 21263 content: ''; 21264 animation: ${re} 0.15s ease-out forwards; 21265 animation-delay: 150ms; 21266 position: absolute; 21267 border-radius: 3px; 21268 opacity: 0; 21269 background: ${(e2) => e2.secondary || "#fff"}; 21270 bottom: 9px; 21271 left: 4px; 21272 height: 2px; 21273 width: 12px; 21274 } 21275 21276 &:before { 21277 animation: ${se} 0.15s ease-out forwards; 21278 animation-delay: 180ms; 21279 transform: rotate(90deg); 21280 } 21281`; 21282var ne = h` 21283 from { 21284 transform: rotate(0deg); 21285 } 21286 to { 21287 transform: rotate(360deg); 21288 } 21289`; 21290var V = j("div")` 21291 width: 12px; 21292 height: 12px; 21293 box-sizing: border-box; 21294 border: 2px solid; 21295 border-radius: 100%; 21296 border-color: ${(e2) => e2.secondary || "#e0e0e0"}; 21297 border-right-color: ${(e2) => e2.primary || "#616161"}; 21298 animation: ${ne} 1s linear infinite; 21299`; 21300var pe = h` 21301from { 21302 transform: scale(0) rotate(45deg); 21303 opacity: 0; 21304} 21305to { 21306 transform: scale(1) rotate(45deg); 21307 opacity: 1; 21308}`; 21309var de = h` 213100% { 21311 height: 0; 21312 width: 0; 21313 opacity: 0; 21314} 2131540% { 21316 height: 0; 21317 width: 6px; 21318 opacity: 1; 21319} 21320100% { 21321 opacity: 1; 21322 height: 10px; 21323}`; 21324var w = j("div")` 21325 width: 20px; 21326 opacity: 0; 21327 height: 20px; 21328 border-radius: 10px; 21329 background: ${(e2) => e2.primary || "#61d345"}; 21330 position: relative; 21331 transform: rotate(45deg); 21332 21333 animation: ${pe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 21334 forwards; 21335 animation-delay: 100ms; 21336 &:after { 21337 content: ''; 21338 box-sizing: border-box; 21339 animation: ${de} 0.2s ease-out forwards; 21340 opacity: 0; 21341 animation-delay: 200ms; 21342 position: absolute; 21343 border-right: 2px solid; 21344 border-bottom: 2px solid; 21345 border-color: ${(e2) => e2.secondary || "#fff"}; 21346 bottom: 6px; 21347 left: 6px; 21348 height: 10px; 21349 width: 6px; 21350 } 21351`; 21352var ue = j("div")` 21353 position: absolute; 21354`; 21355var le = j("div")` 21356 position: relative; 21357 display: flex; 21358 justify-content: center; 21359 align-items: center; 21360 min-width: 20px; 21361 min-height: 20px; 21362`; 21363var Te = h` 21364from { 21365 transform: scale(0.6); 21366 opacity: 0.4; 21367} 21368to { 21369 transform: scale(1); 21370 opacity: 1; 21371}`; 21372var fe = j("div")` 21373 position: relative; 21374 transform: scale(0.6); 21375 opacity: 0.4; 21376 min-width: 20px; 21377 animation: ${Te} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) 21378 forwards; 21379`; 21380var M = ({ toast: e2 }) => { 21381 let { icon: t3, type: o2, iconTheme: s2 } = e2; 21382 return t3 !== void 0 ? typeof t3 == "string" ? y.createElement(fe, null, t3) : t3 : o2 === "blank" ? null : y.createElement(le, null, y.createElement(V, { ...s2 }), o2 !== "loading" && y.createElement(ue, null, o2 === "error" ? y.createElement(_, { ...s2 }) : y.createElement(w, { ...s2 }))); 21383}; 21384var ye = (e2) => ` 213850% {transform: translate3d(0,${e2 * -200}%,0) scale(.6); opacity:.5;} 21386100% {transform: translate3d(0,0,0) scale(1); opacity:1;} 21387`; 21388var ge = (e2) => ` 213890% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 21390100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;} 21391`; 21392var he = "0%{opacity:0;} 100%{opacity:1;}"; 21393var xe = "0%{opacity:1;} 100%{opacity:0;}"; 21394var be = j("div")` 21395 display: flex; 21396 align-items: center; 21397 background: #fff; 21398 color: #363636; 21399 line-height: 1.3; 21400 will-change: transform; 21401 box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); 21402 max-width: 350px; 21403 pointer-events: auto; 21404 padding: 8px 10px; 21405 border-radius: 8px; 21406`; 21407var Se = j("div")` 21408 display: flex; 21409 justify-content: center; 21410 margin: 4px 10px; 21411 color: inherit; 21412 flex: 1 1 auto; 21413 white-space: pre-line; 21414`; 21415var Ae = (e2, t3) => { 21416 let s2 = e2.includes("top") ? 1 : -1, [a2, r2] = b2() ? [he, xe] : [ye(s2), ge(s2)]; 21417 return { animation: t3 ? `${h(a2)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${h(r2)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` }; 21418}; 21419var F = l2.memo(({ toast: e2, position: t3, style: o2, children: s2 }) => { 21420 let a2 = e2.height ? Ae(e2.position || t3 || "top-center", e2.visible) : { opacity: 0 }, r2 = l2.createElement(M, { toast: e2 }), c2 = l2.createElement(Se, { ...e2.ariaProps }, T(e2.message, e2)); 21421 return l2.createElement(be, { className: e2.className, style: { ...a2, ...o2, ...e2.style } }, typeof s2 == "function" ? s2({ icon: r2, message: c2 }) : l2.createElement(l2.Fragment, null, r2, c2)); 21422}); 21423m(f2.createElement); 21424var Ee = ({ id: e2, className: t3, style: o2, onHeightUpdate: s2, children: a2 }) => { 21425 let r2 = f2.useCallback((c2) => { 21426 if (c2) { 21427 let i2 = () => { 21428 let d2 = c2.getBoundingClientRect().height; 21429 s2(e2, d2); 21430 }; 21431 i2(), new MutationObserver(i2).observe(c2, { subtree: true, childList: true, characterData: true }); 21432 } 21433 }, [e2, s2]); 21434 return f2.createElement("div", { ref: r2, className: t3, style: o2 }, a2); 21435}; 21436var Re = (e2, t3) => { 21437 let o2 = e2.includes("top"), s2 = o2 ? { top: 0 } : { bottom: 0 }, a2 = e2.includes("center") ? { justifyContent: "center" } : e2.includes("right") ? { justifyContent: "flex-end" } : {}; 21438 return { left: 0, right: 0, display: "flex", position: "absolute", transition: b2() ? void 0 : "all 230ms cubic-bezier(.21,1.02,.73,1)", transform: `translateY(${t3 * (o2 ? 1 : -1)}px)`, ...s2, ...a2 }; 21439}; 21440var ve = u` 21441 z-index: 9999; 21442 > * { 21443 pointer-events: auto; 21444 } 21445`; 21446var O = 16; 21447var Ie = ({ reverseOrder: e2, position: t3 = "top-center", toastOptions: o2, gutter: s2, children: a2, containerStyle: r2, containerClassName: c2 }) => { 21448 let { toasts: i2, handlers: d2 } = D(o2); 21449 return f2.createElement("div", { style: { position: "fixed", zIndex: 9999, top: O, left: O, right: O, bottom: O, pointerEvents: "none", ...r2 }, className: c2, onMouseEnter: d2.startPause, onMouseLeave: d2.endPause }, i2.map((p2) => { 21450 let g2 = p2.position || t3, E = d2.calculateOffset(p2, { reverseOrder: e2, gutter: s2, defaultPosition: t3 }), x = Re(g2, E); 21451 return f2.createElement(Ee, { id: p2.id, key: p2.id, onHeightUpdate: d2.updateHeight, className: p2.visible ? ve : "", style: x }, p2.type === "custom" ? T(p2.message, p2) : a2 ? a2(p2) : f2.createElement(F, { toast: p2, position: g2 })); 21452 })); 21453}; 21454var _t = n2; 21455
21456// src/fileio.ts 21457var MAX_FILE_SIZE = 20 * 1024 * 1024; 21458var MAX_FILES = 20; 21459var IGNORE_PATTERNS = [/^\./, /^_/]; 21460var FILE_SYSTEM_API_ERROR_MESSAGE = "Sorry, this browser does not support the File System Access API. This feature requires Chrome or Edge."; 21461function matches_ignore_pattern(s2) { 21462 for (const p2 of IGNORE_PATTERNS) { 21463 if (p2.test(s2)) 21464 return true; 21465 } 21466 return false; 21467} 21468async function loadDirectoryRecursive(dirHandle, dirPrefix = "", maxBytes = MAX_FILE_SIZE, maxFiles = MAX_FILES) { 21469 const files = []; 21470 for await (const fileHandle of dirHandle.values()) { 21471 if (files.length > maxFiles) { 21472 throw new Error( 21473 `Too many files in directory ${dirHandle.name}; maximum is ${maxFiles}.` 21474 ); 21475 } 21476 let filePath = fileHandle.name; 21477 if (matches_ignore_pattern(filePath)) 21478 continue; 21479 if (dirPrefix !== "") { 21480 filePath = dirPrefix + "/" + filePath; 21481 } 21482 if (fileHandle.kind === "file") { 21483 const fileContent = await loadFileContent(fileHandle, maxBytes); 21484 fileContent.name = filePath; 21485 files.push(fileContent); 21486 } else if (fileHandle.kind === "directory") { 21487 const subdirFiles = await loadDirectoryRecursive(fileHandle, filePath); 21488 files.push(...subdirFiles); 21489 } 21490 } 21491 return files; 21492} 21493async function loadFileContent(fileHandle, maxBytes = MAX_FILE_SIZE) { 21494 const fileData = await fileHandle.getFile(); 21495 if (fileData.size > maxBytes) { 21496 throw new Error(`File exceeds max size of ${maxBytes} bytes.`); 21497 } 21498 const contentArray = new Uint8Array(await fileData.arrayBuffer()); 21499 if (isBinary(contentArray)) { 21500 return { 21501 name: fileData.name, 21502 content: contentArray, 21503 type: "binary" 21504 }; 21505 } else { 21506 const contentString = new TextDecoder().decode(contentArray); 21507 return { 21508 name: fileData.name, 21509 content: contentString, 21510 type: "text" 21511 }; 21512 } 21513} 21514function assertHasFileAccessApiSupport() { 21515 if (!window.showOpenFilePicker) { 21516 alert(FILE_SYSTEM_API_ERROR_MESSAGE); 21517 throw new Error(FILE_SYSTEM_API_ERROR_MESSAGE); 21518 } 21519} 21520async function saveFileContentsToDirectory(files, dirHandle) { 21521 for (const file of files) { 21522 const filePathParts = file.name.split("/"); 21523 const dir = await ensureDirPathExists( 21524 filePathParts.slice(0, -1), 21525 dirHandle 21526 ); 21527 await saveFileContentToFile( 21528 // Use the stuff from the `file` object, but use just the filename, 21529 // without directory. 21530 { 21531 ...file, 21532 name: filePathParts.slice(-1)[0] 21533 }, 21534 dir 21535 ); 21536 } 21537} 21538async function downloadFile(filename, content2, type = "text/plain") { 21539 const element = document.createElement("a"); 21540 const file = new Blob([content2], { type }); 21541 element.href = URL.createObjectURL(file); 21542 element.download = filename; 21543 element.click(); 21544} 21545async function ensureDirPathExists(dirParts, dirHandle) { 21546 if (dirParts.length === 0) { 21547 return dirHandle; 21548 } 21549 const subdir = await dirHandle.getDirectoryHandle(dirParts[0], { 21550 create: true 21551 }); 21552 return ensureDirPathExists(dirParts.slice(1), subdir); 21553} 21554async function saveFileContentToFile(file, dirHandle) { 21555 const fileHandle = await dirHandle.getFileHandle(file.name, { 21556 create: true 21557 }); 21558 const fileStream = await fileHandle.createWritable(); 21559 if (file.type === "binary") { 21560 await fileStream.write(file.content); 21561 } else { 21562 await fileStream.write(file.content); 21563 } 21564 await fileStream.close(); 21565} 21566
21567// src/language-server/client.ts 21568var import_events = __toESM(require_events()); 21569var import_vscode_languageserver_protocol = __toESM(require_main2()); 21570var createUri = (name2) => `file:///src/${name2}`; 21571var LanguageServerClient = class extends import_events.EventEmitter { 21572 constructor(connection, locale, rootUri) { 21573 super(); 21574 this.connection = connection; 21575 this.locale = locale; 21576 this.rootUri = rootUri; 21577 this.versions = /* @__PURE__ */ new Map(); 21578 this.diagnostics = /* @__PURE__ */ new Map(); 21579 this.initPromise = (async () => { 21580 this.connection.onNotification( 21581 import_vscode_languageserver_protocol.PublishDiagnosticsNotification.type, 21582 (params) => { 21583 this.diagnostics.set(params.uri, params.diagnostics); 21584 this.emit("diagnostics", params); 21585 } 21586 ); 21587 this.connection.onRequest(import_vscode_languageserver_protocol.RegistrationRequest.type, () => { 21588 }); 21589 const initializeParams = { 21590 locale: this.locale, 21591 capabilities: { 21592 textDocument: { 21593 moniker: {}, 21594 synchronization: { 21595 willSave: false, 21596 didSave: false, 21597 willSaveWaitUntil: false 21598 }, 21599 completion: { 21600 completionItem: { 21601 snippetSupport: false, 21602 commitCharactersSupport: true, 21603 documentationFormat: ["markdown"], 21604 deprecatedSupport: false, 21605 preselectSupport: false 21606 }, 21607 contextSupport: true 21608 }, 21609 signatureHelp: { 21610 signatureInformation: { 21611 documentationFormat: ["markdown"], 21612 activeParameterSupport: true, 21613 parameterInformation: { 21614 labelOffsetSupport: true 21615 } 21616 } 21617 }, 21618 hover: { 21619 contentFormat: ["markdown"] 21620 }, 21621 publishDiagnostics: { 21622 tagSupport: { 21623 valueSet: [import_vscode_languageserver_protocol.DiagnosticTag.Unnecessary, import_vscode_languageserver_protocol.DiagnosticTag.Deprecated] 21624 } 21625 } 21626 }, 21627 workspace: { 21628 workspaceFolders: true, 21629 didChangeConfiguration: {}, 21630 configuration: true 21631 } 21632 }, 21633 initializationOptions: await this.getInitializationOptions(), 21634 processId: null, 21635 rootUri: null, 21636 workspaceFolders: [ 21637 { 21638 name: "src", 21639 uri: this.rootUri 21640 } 21641 ] 21642 }; 21643 const { capabilities } = await this.connection.sendRequest( 21644 import_vscode_languageserver_protocol.InitializeRequest.type, 21645 initializeParams 21646 ); 21647 this.capabilities = capabilities; 21648 await this.connection.sendNotification(import_vscode_languageserver_protocol.InitializedNotification.type, {}); 21649 })(); 21650 } 21651 on(event, listener) { 21652 this.initPromise.then(() => { 21653 super.on(event, listener); 21654 }).catch(() => { 21655 }); 21656 return this; 21657 } 21658 off(event, listener) { 21659 this.initPromise.then(() => { 21660 super.off(event, listener); 21661 }).catch(() => { 21662 }); 21663 return this; 21664 } 21665 currentDiagnostics(uri) { 21666 return this.diagnostics.get(uri) ?? []; 21667 } 21668 allDiagnostics() { 21669 return Array.from(this.diagnostics.values()).flat(); 21670 } 21671 errorCount() { 21672 return this.allDiagnostics().filter( 21673 (e2) => e2.severity === import_vscode_languageserver_protocol.DiagnosticSeverity.Error 21674 ).length; 21675 } 21676 // This can be overridden by subclasses. It's used to pass initialization 21677 // options to the server. 21678 async getInitializationOptions() { 21679 return null; 21680 } 21681 async createFile(filename, content2) { 21682 const languageId = inferFiletype(filename); 21683 if (!languageId) { 21684 console.log( 21685 `LanguageServerClientExtended: Could not infer language for ${filename}` 21686 ); 21687 return; 21688 } 21689 await this.didOpenTextDocument({ 21690 textDocument: { 21691 languageId, 21692 text: content2, 21693 uri: createUri(filename) 21694 } 21695 }); 21696 } 21697 async deleteFile(filename) { 21698 await this.didCloseTextDocument({ 21699 textDocument: { 21700 uri: createUri(filename) 21701 } 21702 }); 21703 }
21704 async changeFile(filename, changeEvent) { 21705 await this.didChangeTextDocument(createUri(filename), [changeEvent]); 21706 } 21707 async didOpenTextDocument(params) { 21708 await this.initPromise; 21709 await this.connection.sendNotification( 21710 import_vscode_languageserver_protocol.DidOpenTextDocumentNotification.type, 21711 { 21712 textDocument: { 21713 ...params.textDocument, 21714 version: this.nextVersion(params.textDocument.uri) 21715 } 21716 } 21717 ); 21718 } 21719 // We close Python files that are deleted. We never write to the file system, 21720 // so that way they're effectively deleted. 21721 async didCloseTextDocument(params) { 21722 await this.initPromise; 21723 await this.connection.sendNotification( 21724 import_vscode_languageserver_protocol.DidCloseTextDocumentNotification.type, 21725 params 21726 ); 21727 } 21728 async didChangeTextDocument(uri, contentChanges) { 21729 await this.initPromise; 21730 await this.connection.sendNotification( 21731 import_vscode_languageserver_protocol.DidChangeTextDocumentNotification.type, 21732 { 21733 textDocument: { 21734 uri, 21735 version: this.nextVersion(uri) 21736 }, 21737 contentChanges 21738 } 21739 ); 21740 } 21741 async completionRequest(params) { 21742 await this.initPromise; 21743 const results = await this.connection.sendRequest( 21744 import_vscode_languageserver_protocol.CompletionRequest.type, 21745 params 21746 ); 21747 if (!results) { 21748 return { items: [], isIncomplete: true }; 21749 } 21750 return "items" in results ? results : { items: results, isIncomplete: true }; 21751 } 21752 dispose() { 21753 this.connection.dispose(); 21754 } 21755 nextVersion(uri) { 21756 const version = (this.versions.get(uri) ?? 0) + 1; 21757 this.versions.set(uri, version); 21758 return version; 21759 } 21760}; 21761
21762// src/language-server/null-client.ts 21763var import_vscode_jsonrpc = __toESM(require_main()); 21764var nullClient = null; 21765function ensureNullClient() { 21766 if (!nullClient) { 21767 nullClient = new NullLspClient(); 21768 } 21769 return nullClient; 21770} 21771var NullMessageReader = class extends import_vscode_jsonrpc.AbstractMessageReader { 21772 listen() { 21773 return { dispose: () => { 21774 } }; 21775 } 21776}; 21777var NullMessageWriter = class extends import_vscode_jsonrpc.AbstractMessageWriter { 21778 async write() { 21779 } 21780 end() { 21781 } 21782}; 21783var NullLspClient = class extends LanguageServerClient { 21784 constructor() { 21785 const conn = (0, import_vscode_jsonrpc.createMessageConnection)( 21786 new NullMessageReader(), 21787 new NullMessageWriter() 21788 ); 21789 conn.listen(); 21790 super(conn, "en", createUri("")); 21791 } 21792}; 21793
21794// src/language-server/pyright-client.ts 21795var import_vscode_jsonrpc2 = __toESM(require_main()); 21796var import_browser = __toESM(require_browser()); 21797var workerScriptName = "pyright.worker.js"; 21798var pyrightClient = null; 21799function ensurePyrightClient() { 21800 if (!pyrightClient) { 21801 pyrightClient = new PyrightLspClient(); 21802 } 21803 return pyrightClient; 21804} 21805var PyrightLspClient = class extends LanguageServerClient { 21806 constructor() { 21807 const workerScript = currentScriptDir() + `/pyright/${workerScriptName}`; 21808 const foreground = new Worker(workerScript, { 21809 name: "pyright-foreground" 21810 }); 21811 const connection = (0, import_vscode_jsonrpc2.createMessageConnection)( 21812 new import_browser.BrowserMessageReader(foreground), 21813 new import_browser.BrowserMessageWriter(foreground) 21814 ); 21815 const workers = [foreground]; 21816 connection.onDispose(() => { 21817 workers.forEach((w2) => w2.terminate()); 21818 }); 21819 connection.listen(); 21820 super(connection, "en", createUri("")); 21821 } 21822 async createFile(filename, content2) { 21823 const params = { 21824 uri: createUri(filename), 21825 kind: "create" 21826 }; 21827 await this.connection.sendNotification("$/createFile", params); 21828 await super.createFile(filename, content2); 21829 } 21830 async deleteFile(filename) { 21831 const params = { 21832 uri: createUri(filename), 21833 kind: "delete" 21834 }; 21835 await this.connection.sendNotification("$/deleteFile", params); 21836 await super.deleteFile(filename); 21837 } 21838 /** 21839 * This uses fetch() instead of import() so that esbuild will not inline the 21840 * entire JSON file into the .js bundle. 21841 */ 21842 async getInitializationOptions() { 21843 const response = await fetch( 21844 currentScriptDir() + "/pyright/typeshed.en.json" 21845 ); 21846 const typeshed = await response.json(); 21847 return { 21848 files: typeshed 21849 }; 21850 } 21851}; 21852
21853// src/Components/ShareModal.tsx 21854var React2 = __toESM(require_react()); 21855
21856// src/hooks/useOnEscOrClickOutside.tsx 21857var import_react3 = __toESM(require_react()); 21858function useOnEscOrClickOutside(ref, handler) { 21859 import_react3.default.useEffect(() => { 21860 const listener = (event) => { 21861 if (event instanceof KeyboardEvent) { 21862 if (event.key === "Escape") { 21863 handler(event); 21864 } 21865 } else if (event instanceof PointerEvent) { 21866 if (!ref.current || ref.current.contains(event.target)) { 21867 return; 21868 } 21869 handler(event); 21870 } 21871 }; 21872 document.addEventListener("keydown", listener); 21873 document.addEventListener("pointerdown", listener); 21874 return () => { 21875 document.removeEventListener("keydown", listener); 21876 document.removeEventListener("pointerdown", listener); 21877 }; 21878 }, [ref, handler]); 21879} 21880
21881// src/Components/ShareModal.tsx 21882var import_jsx_runtime = __toESM(require_jsx_runtime()); 21883function ShareModal({ 21884 fileContents = [], 21885 setShareModalVisible, 21886 appEngine 21887}) { 21888 const showModalRef = React2.useRef(null); 21889 const encodedCode = fileContentsToUrlString(fileContents); 21890 const [hideHeaderChecked, setHideHeaderChecked] = React2.useState(false); 21891 const editorUrl = editorUrlPrefix(appEngine) + "#code=" + encodedCode; 21892 const appUrl = appUrlPrefix(appEngine) + "#" + (hideHeaderChecked ? "h=0&" : "") + "code=" + encodedCode; 21893 const editorUrlInputRef = React2.useRef(null); 21894 const appUrlInputRef = React2.useRef(null); 21895 const [editorButtonText, setEditorButtonText] = React2.useState("Copy URL"); 21896 const [appButtonText, setAppButtonText] = React2.useState("Copy URL"); 21897 useOnEscOrClickOutside(showModalRef, () => setShareModalVisible(false)); 21898 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 21899 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ShareModal-overlay" }), 21900 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal", ref: showModalRef, children: [
21901 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal--item", children: [ 21902 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [ 21903 "Editor URL (", 21904 editorUrl.length, 21905 " bytes)" 21906 ] }), 21907 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal--row", children: [ 21908 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ShareModal--url", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 21909 "input", 21910 { 21911 value: editorUrl, 21912 ref: editorUrlInputRef, 21913 className: "ShareModal--urlinput", 21914 onFocus: (e2) => e2.target.select(), 21915 readOnly: true 21916 } 21917 ) }), 21918 /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 21919 "button", 21920 { 21921 style: { whiteSpace: "nowrap", width: "8em" }, 21922 onClick: () => { 21923 if (!editorUrlInputRef.current) 21924 return; 21925 editorUrlInputRef.current.select(); 21926 navigator.clipboard.writeText(editorUrlInputRef.current.value); 21927 setEditorButtonText("\u2713"); 21928 setTimeout(() => setEditorButtonText("Copy URL"), 800); 21929 }, 21930 children: editorButtonText 21931 } 21932 ) 21933 ] }) 21934 ] }),
21935 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal--item", children: [ 21936 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal--row", children: [ 21937 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [ 21938 "Application URL (", 21939 appUrl.length, 21940 " bytes)" 21941 ] }), 21942 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( 21943 "label", 21944 { 21945 className: "ShareModal--checkbox", 21946 "aria-label": "Don't show the Shiny header with Edit button", 21947 "data-balloon-pos": "up", 21948 children: [ 21949 /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 21950 "input", 21951 { 21952 type: "checkbox", 21953 checked: hideHeaderChecked, 21954 onChange: () => setHideHeaderChecked(!hideHeaderChecked) 21955 } 21956 ), 21957 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Hide header" }) 21958 ] 21959 } 21960 ) 21961 ] }),
21962 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ShareModal--row", children: [ 21963 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ShareModal--url", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 21964 "input", 21965 { 21966 value: appUrl, 21967 ref: appUrlInputRef, 21968 className: "ShareModal--urlinput", 21969 onFocus: (e2) => e2.target.select(), 21970 readOnly: true 21971 } 21972 ) }), 21973 /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 21974 "button", 21975 { 21976 style: { whiteSpace: "nowrap", width: "8em" }, 21977 onClick: () => { 21978 if (!appUrlInputRef.current) 21979 return; 21980 appUrlInputRef.current.select(); 21981 navigator.clipboard.writeText(appUrlInputRef.current.value); 21982 setAppButtonText("\u2713"); 21983 setTimeout(() => setAppButtonText("Copy URL"), 800); 21984 }, 21985 children: appButtonText 21986 } 21987 ) 21988 ] }) 21989 ] }) 21990 ] }) 21991 ] }); 21992} 21993
21994// src/Components/codeMirror/FileTabs.tsx 21995var import_jsx_runtime2 = __toESM(require_jsx_runtime()); 21996function FileTabs({ 21997 files, 21998 activeFile, 21999 editingFilename, 22000 addFile, 22001 uploadFile, 22002 renameFile, 22003 closeFile, 22004 selectFile, 22005 enterNameEditMode, 22006 setFocusOnEditor 22007}) { 22008 const moreThanOneFile = files.length > 1; 22009 const inNameEditMode = editingFilename !== null; 22010 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "editor-files", children: [ 22011 files.map((f3, index) => { 22012 const isActiveFile = activeFile.name === f3.name; 22013 const editingCurrentFilename = inNameEditMode && isActiveFile; 22014 const validFileName = ( 22015 // It's not being edited 22016 !editingCurrentFilename || // or it has no conflicts with the names of the other files 22017 files.every( 22018 (file, i2) => i2 === index || // Can't conflict with its own name 22019 file.name.toLowerCase() !== editingFilename.toLowerCase() 22020 ) 22021 ); 22022 return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)( 22023 "button", 22024 { 22025 className: isActiveFile ? "selected" : void 0, 22026 onClick: () => { 22027 selectFile(f3.name); 22028 setFocusOnEditor(true); 22029 }, 22030 children: [
22031 /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "editor-filename", children: editingCurrentFilename ? editingFilename : f3.name }), 22032 moreThanOneFile ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( 22033 "span", 22034 { 22035 className: "editor-closebutton", 22036 "aria-label": "Close file", 22037 onClick: (e2) => { 22038 if (!confirm("Close " + f3.name + "?")) { 22039 e2.stopPropagation(); 22040 return; 22041 } 22042 closeFile(e2, index); 22043 }, 22044 children: "\xD7" 22045 } 22046 ) : null, 22047 editingCurrentFilename ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( 22048 "input", 22049 { 22050 autoFocus: true, 22051 "aria-label": "Name current file", 22052 className: validFileName ? void 0 : "invalid-filename", 22053 value: editingFilename, 22054 spellCheck: "false", 22055 onChange: (e2) => enterNameEditMode(e2.target.value), 22056 onKeyPress: (e2) => { 22057 if (e2.key === "Enter" && validFileName) { 22058 renameFile(activeFile.name, editingFilename); 22059 } else if (!/^[a-zA-Z0-9/_.-]$/.test(e2.key)) { 22060 e2.preventDefault(); 22061 } 22062 }, 22063 onKeyDown: (e2) => { 22064 if (e2.key === "Escape") { 22065 enterNameEditMode(null); 22066 } else if (e2.key == " ") { 22067 e2.preventDefault(); 22068 } 22069 }, 22070 onBlur: (e2) => { 22071 if (editingFilename) { 22072 if (validFileName) { 22073 renameFile(activeFile.name, editingFilename); 22074 } else { 22075 enterNameEditMode(null); 22076 } 22077 } 22078 } 22079 } 22080 ) : null 22081 ] 22082 }, 22083 f3.name 22084 ); 22085 }), 22086 /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "editor-addtab", children: [
22087 /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( 22088 "button", 22089 { 22090 className: "editor-addbutton", 22091 "aria-label": "Add a file", 22092 "data-balloon-pos": "down", 22093 onClick: () => addFile(), 22094 children: "+" 22095 } 22096 ), 22097 /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( 22098 "button", 22099 { 22100 className: "editor-uploadbutton", 22101 "aria-label": "Load a file from disk", 22102 "data-balloon-pos": "down", 22103 onClick: () => uploadFile(), 22104 children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { icon: "arrow-up-from-bracket" }) 22105 } 22106 ) 22107 ] }) 22108 ] }) }); 22109} 22110
vendor: 63,830 bytes, lines 22111-24137
22111// node_modules/@lezer/common/dist/index.js 22112var DefaultBufferLength = 1024; 22113var nextPropID = 0; 22114var Range3 = class { 22115 constructor(from, to) { 22116 this.from = from; 22117 this.to = to; 22118 } 22119}; 22120var NodeProp = class { 22121 /** 22122 Create a new node prop type. 22123 */ 22124 constructor(config2 = {}) { 22125 this.id = nextPropID++; 22126 this.perNode = !!config2.perNode; 22127 this.deserialize = config2.deserialize || (() => { 22128 throw new Error("This node type doesn't define a deserialize function"); 22129 }); 22130 } 22131 /** 22132 This is meant to be used with 22133 [`NodeSet.extend`](#common.NodeSet.extend) or 22134 [`LRParser.configure`](#lr.ParserConfig.props) to compute 22135 prop values for each node type in the set. Takes a [match 22136 object](#common.NodeType^match) or function that returns undefined 22137 if the node type doesn't get this prop, and the prop's value if 22138 it does. 22139 */ 22140 add(match) { 22141 if (this.perNode) 22142 throw new RangeError("Can't add per-node props to node types"); 22143 if (typeof match != "function") 22144 match = NodeType.match(match); 22145 return (type) => { 22146 let result = match(type); 22147 return result === void 0 ? null : [this, result]; 22148 }; 22149 } 22150}; 22151NodeProp.closedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); 22152NodeProp.openedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); 22153NodeProp.group = new NodeProp({ deserialize: (str) => str.split(" ") }); 22154NodeProp.isolate = new NodeProp({ deserialize: (value) => { 22155 if (value && value != "rtl" && value != "ltr" && value != "auto") 22156 throw new RangeError("Invalid value for isolate: " + value); 22157 return value || "auto"; 22158} }); 22159NodeProp.contextHash = new NodeProp({ perNode: true }); 22160NodeProp.lookAhead = new NodeProp({ perNode: true }); 22161NodeProp.mounted = new NodeProp({ perNode: true }); 22162var MountedTree = class { 22163 constructor(tree, overlay, parser10) { 22164 this.tree = tree; 22165 this.overlay = overlay; 22166 this.parser = parser10; 22167 } 22168 /** 22169 @internal 22170 */ 22171 static get(tree) { 22172 return tree && tree.props && tree.props[NodeProp.mounted.id]; 22173 } 22174}; 22175var noProps = /* @__PURE__ */ Object.create(null); 22176var NodeType = class _NodeType { 22177 /** 22178 @internal 22179 */ 22180 constructor(name2, props, id2, flags = 0) { 22181 this.name = name2; 22182 this.props = props; 22183 this.id = id2; 22184 this.flags = flags; 22185 } 22186 /** 22187 Define a node type. 22188 */ 22189 static define(spec) { 22190 let props = spec.props && spec.props.length ? /* @__PURE__ */ Object.create(null) : noProps; 22191 let flags = (spec.top ? 1 : 0) | (spec.skipped ? 2 : 0) | (spec.error ? 4 : 0) | (spec.name == null ? 8 : 0); 22192 let type = new _NodeType(spec.name || "", props, spec.id, flags); 22193 if (spec.props) 22194 for (let src of spec.props) { 22195 if (!Array.isArray(src)) 22196 src = src(type); 22197 if (src) { 22198 if (src[0].perNode) 22199 throw new RangeError("Can't store a per-node prop on a node type"); 22200 props[src[0].id] = src[1]; 22201 } 22202 } 22203 return type; 22204 } 22205 /** 22206 Retrieves a node prop for this type. Will return `undefined` if 22207 the prop isn't present on this node. 22208 */ 22209 prop(prop) { 22210 return this.props[prop.id]; 22211 } 22212 /** 22213 True when this is the top node of a grammar. 22214 */ 22215 get isTop() { 22216 return (this.flags & 1) > 0; 22217 } 22218 /** 22219 True when this node is produced by a skip rule. 22220 */ 22221 get isSkipped() { 22222 return (this.flags & 2) > 0; 22223 } 22224 /** 22225 Indicates whether this is an error node. 22226 */ 22227 get isError() { 22228 return (this.flags & 4) > 0; 22229 } 22230 /** 22231 When true, this node type doesn't correspond to a user-declared 22232 named node, for example because it is used to cache repetition. 22233 */ 22234 get isAnonymous() { 22235 return (this.flags & 8) > 0; 22236 } 22237 /** 22238 Returns true when this node's name or one of its 22239 [groups](#common.NodeProp^group) matches the given string. 22240 */ 22241 is(name2) { 22242 if (typeof name2 == "string") { 22243 if (this.name == name2) 22244 return true; 22245 let group = this.prop(NodeProp.group); 22246 return group ? group.indexOf(name2) > -1 : false; 22247 } 22248 return this.id == name2; 22249 } 22250 /** 22251 Create a function from node types to arbitrary values by 22252 specifying an object whose property names are node or 22253 [group](#common.NodeProp^group) names. Often useful with 22254 [`NodeProp.add`](#common.NodeProp.add). You can put multiple 22255 names, separated by spaces, in a single property name to map 22256 multiple node names to a single value. 22257 */ 22258 static match(map) { 22259 let direct = /* @__PURE__ */ Object.create(null); 22260 for (let prop in map) 22261 for (let name2 of prop.split(" ")) 22262 direct[name2] = map[prop]; 22263 return (node) => { 22264 for (let groups = node.prop(NodeProp.group), i2 = -1; i2 < (groups ? groups.length : 0); i2++) { 22265 let found = direct[i2 < 0 ? node.name : groups[i2]]; 22266 if (found) 22267 return found; 22268 } 22269 }; 22270 } 22271}; 22272NodeType.none = new NodeType( 22273 "", 22274 /* @__PURE__ */ Object.create(null), 22275 0, 22276 8 22277 /* NodeFlag.Anonymous */ 22278); 22279var NodeSet = class _NodeSet { 22280 /** 22281 Create a set with the given types. The `id` property of each 22282 type should correspond to its position within the array. 22283 */ 22284 constructor(types2) { 22285 this.types = types2; 22286 for (let i2 = 0; i2 < types2.length; i2++) 22287 if (types2[i2].id != i2) 22288 throw new RangeError("Node type ids should correspond to array positions when creating a node set"); 22289 } 22290 /** 22291 Create a copy of this set with some node properties added. The 22292 arguments to this method can be created with 22293 [`NodeProp.add`](#common.NodeProp.add). 22294 */ 22295 extend(...props) { 22296 let newTypes = []; 22297 for (let type of this.types) { 22298 let newProps = null; 22299 for (let source of props) { 22300 let add2 = source(type); 22301 if (add2) { 22302 if (!newProps) 22303 newProps = Object.assign({}, type.props); 22304 newProps[add2[0].id] = add2[1]; 22305 } 22306 } 22307 newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type); 22308 } 22309 return new _NodeSet(newTypes); 22310 } 22311}; 22312var CachedNode = /* @__PURE__ */ new WeakMap(); 22313var CachedInnerNode = /* @__PURE__ */ new WeakMap(); 22314var IterMode; 22315(function(IterMode2) { 22316 IterMode2[IterMode2["ExcludeBuffers"] = 1] = "ExcludeBuffers"; 22317 IterMode2[IterMode2["IncludeAnonymous"] = 2] = "IncludeAnonymous"; 22318 IterMode2[IterMode2["IgnoreMounts"] = 4] = "IgnoreMounts"; 22319 IterMode2[IterMode2["IgnoreOverlays"] = 8] = "IgnoreOverlays"; 22320})(IterMode || (IterMode = {})); 22321var Tree = class _Tree { 22322 /** 22323 Construct a new tree. See also [`Tree.build`](#common.Tree^build). 22324 */ 22325 constructor(type, children, positions, length, props) { 22326 this.type = type; 22327 this.children = children; 22328 this.positions = positions; 22329 this.length = length; 22330 this.props = null; 22331 if (props && props.length) { 22332 this.props = /* @__PURE__ */ Object.create(null); 22333 for (let [prop, value] of props) 22334 this.props[typeof prop == "number" ? prop : prop.id] = value; 22335 } 22336 } 22337 /** 22338 @internal 22339 */ 22340 toString() { 22341 let mounted = MountedTree.get(this); 22342 if (mounted && !mounted.overlay) 22343 return mounted.tree.toString(); 22344 let children = ""; 22345 for (let ch of this.children) { 22346 let str = ch.toString(); 22347 if (str) { 22348 if (children) 22349 children += ","; 22350 children += str; 22351 } 22352 } 22353 return !this.type.name ? children : (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (children.length ? "(" + children + ")" : ""); 22354 } 22355 /** 22356 Get a [tree cursor](#common.TreeCursor) positioned at the top of 22357 the tree. Mode can be used to [control](#common.IterMode) which 22358 nodes the cursor visits. 22359 */ 22360 cursor(mode = 0) { 22361 return new TreeCursor(this.topNode, mode); 22362 } 22363 /** 22364 Get a [tree cursor](#common.TreeCursor) pointing into this tree 22365 at the given position and side (see 22366 [`moveTo`](#common.TreeCursor.moveTo). 22367 */ 22368 cursorAt(pos, side = 0, mode = 0) { 22369 let scope = CachedNode.get(this) || this.topNode; 22370 let cursor = new TreeCursor(scope); 22371 cursor.moveTo(pos, side); 22372 CachedNode.set(this, cursor._tree); 22373 return cursor; 22374 } 22375 /** 22376 Get a [syntax node](#common.SyntaxNode) object for the top of the 22377 tree. 22378 */ 22379 get topNode() { 22380 return new TreeNode(this, 0, 0, null); 22381 } 22382 /** 22383 Get the [syntax node](#common.SyntaxNode) at the given position. 22384 If `side` is -1, this will move into nodes that end at the 22385 position. If 1, it'll move into nodes that start at the 22386 position. With 0, it'll only enter nodes that cover the position 22387 from both sides. 22388 22389 Note that this will not enter 22390 [overlays](#common.MountedTree.overlay), and you often want 22391 [`resolveInner`](#common.Tree.resolveInner) instead. 22392 */ 22393 resolve(pos, side = 0) { 22394 let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false); 22395 CachedNode.set(this, node); 22396 return node; 22397 } 22398 /** 22399 Like [`resolve`](#common.Tree.resolve), but will enter 22400 [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node 22401 pointing into the innermost overlaid tree at the given position 22402 (with parent links going through all parent structure, including 22403 the host trees). 22404 */ 22405 resolveInner(pos, side = 0) { 22406 let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true); 22407 CachedInnerNode.set(this, node); 22408 return node; 22409 } 22410 /** 22411 In some situations, it can be useful to iterate through all 22412 nodes around a position, including those in overlays that don't 22413 directly cover the position. This method gives you an iterator 22414 that will produce all nodes, from small to big, around the given 22415 position. 22416 */ 22417 resolveStack(pos, side = 0) { 22418 return stackIterator(this, pos, side); 22419 } 22420 /** 22421 Iterate over the tree and its children, calling `enter` for any 22422 node that touches the `from`/`to` region (if given) before 22423 running over such a node's children, and `leave` (if given) when 22424 leaving the node. When `enter` returns `false`, that node will 22425 not have its children iterated over (or `leave` called). 22426 */ 22427 iterate(spec) { 22428 let { enter, leave, from = 0, to = this.length } = spec; 22429 let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0; 22430 for (let c2 = this.cursor(mode | IterMode.IncludeAnonymous); ; ) { 22431 let entered = false; 22432 if (c2.from <= to && c2.to >= from && (!anon && c2.type.isAnonymous || enter(c2) !== false)) { 22433 if (c2.firstChild()) 22434 continue; 22435 entered = true; 22436 } 22437 for (; ; ) { 22438 if (entered && leave && (anon || !c2.type.isAnonymous)) 22439 leave(c2); 22440 if (c2.nextSibling()) 22441 break; 22442 if (!c2.parent()) 22443 return; 22444 entered = true; 22445 } 22446 } 22447 } 22448 /** 22449 Get the value of the given [node prop](#common.NodeProp) for this 22450 node. Works with both per-node and per-type props. 22451 */ 22452 prop(prop) { 22453 return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : void 0; 22454 } 22455 /** 22456 Returns the node's [per-node props](#common.NodeProp.perNode) in a 22457 format that can be passed to the [`Tree`](#common.Tree) 22458 constructor. 22459 */ 22460 get propValues() { 22461 let result = []; 22462 if (this.props) 22463 for (let id2 in this.props) 22464 result.push([+id2, this.props[id2]]); 22465 return result; 22466 } 22467 /** 22468 Balance the direct children of this tree, producing a copy of 22469 which may have children grouped into subtrees with type 22470 [`NodeType.none`](#common.NodeType^none). 22471 */ 22472 balance(config2 = {}) { 22473 return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new _Tree(this.type, children, positions, length, this.propValues), config2.makeTree || ((children, positions, length) => new _Tree(NodeType.none, children, positions, length))); 22474 } 22475 /** 22476 Build a tree from a postfix-ordered buffer of node information, 22477 or a cursor over such a buffer. 22478 */ 22479 static build(data) { 22480 return buildTree(data); 22481 } 22482}; 22483Tree.empty = new Tree(NodeType.none, [], [], 0); 22484var FlatBufferCursor = class _FlatBufferCursor { 22485 constructor(buffer, index) { 22486 this.buffer = buffer; 22487 this.index = index; 22488 } 22489 get id() { 22490 return this.buffer[this.index - 4]; 22491 } 22492 get start() { 22493 return this.buffer[this.index - 3]; 22494 } 22495 get end() { 22496 return this.buffer[this.index - 2]; 22497 } 22498 get size() { 22499 return this.buffer[this.index - 1]; 22500 } 22501 get pos() { 22502 return this.index; 22503 } 22504 next() { 22505 this.index -= 4; 22506 } 22507 fork() { 22508 return new _FlatBufferCursor(this.buffer, this.index); 22509 } 22510}; 22511var TreeBuffer = class _TreeBuffer { 22512 /** 22513 Create a tree buffer. 22514 */ 22515 constructor(buffer, length, set) { 22516 this.buffer = buffer; 22517 this.length = length; 22518 this.set = set; 22519 } 22520 /** 22521 @internal 22522 */ 22523 get type() { 22524 return NodeType.none; 22525 } 22526 /** 22527 @internal 22528 */ 22529 toString() { 22530 let result = []; 22531 for (let index = 0; index < this.buffer.length; ) { 22532 result.push(this.childString(index)); 22533 index = this.buffer[index + 3]; 22534 } 22535 return result.join(","); 22536 } 22537 /** 22538 @internal 22539 */ 22540 childString(index) { 22541 let id2 = this.buffer[index], endIndex = this.buffer[index + 3]; 22542 let type = this.set.types[id2], result = type.name; 22543 if (/\W/.test(result) && !type.isError) 22544 result = JSON.stringify(result); 22545 index += 4; 22546 if (endIndex == index) 22547 return result; 22548 let children = []; 22549 while (index < endIndex) { 22550 children.push(this.childString(index)); 22551 index = this.buffer[index + 3]; 22552 } 22553 return result + "(" + children.join(",") + ")"; 22554 } 22555 /** 22556 @internal 22557 */ 22558 findChild(startIndex, endIndex, dir, pos, side) { 22559 let { buffer } = this, pick = -1; 22560 for (let i2 = startIndex; i2 != endIndex; i2 = buffer[i2 + 3]) { 22561 if (checkSide(side, pos, buffer[i2 + 1], buffer[i2 + 2])) { 22562 pick = i2; 22563 if (dir > 0) 22564 break; 22565 } 22566 } 22567 return pick; 22568 } 22569 /** 22570 @internal 22571 */ 22572 slice(startI, endI, from) { 22573 let b3 = this.buffer; 22574 let copy = new Uint16Array(endI - startI), len = 0; 22575 for (let i2 = startI, j3 = 0; i2 < endI; ) { 22576 copy[j3++] = b3[i2++]; 22577 copy[j3++] = b3[i2++] - from; 22578 let to = copy[j3++] = b3[i2++] - from; 22579 copy[j3++] = b3[i2++] - startI; 22580 len = Math.max(len, to); 22581 } 22582 return new _TreeBuffer(copy, len, this.set); 22583 } 22584}; 22585function checkSide(side, pos, from, to) { 22586 switch (side) { 22587 case -2: 22588 return from < pos; 22589 case -1: 22590 return to >= pos && from < pos; 22591 case 0: 22592 return from < pos && to > pos; 22593 case 1: 22594 return from <= pos && to > pos; 22595 case 2: 22596 return to > pos; 22597 case 4: 22598 return true; 22599 } 22600} 22601function resolveNode(node, pos, side, overlays) { 22602 var _a3; 22603 while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { 22604 let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent; 22605 if (!parent) 22606 return node; 22607 node = parent; 22608 } 22609 let mode = overlays ? 0 : IterMode.IgnoreOverlays; 22610 if (overlays) 22611 for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { 22612 if (scan instanceof TreeNode && scan.index < 0 && ((_a3 = parent.enter(pos, side, mode)) === null || _a3 === void 0 ? void 0 : _a3.from) != scan.from) 22613 node = parent; 22614 } 22615 for (; ; ) { 22616 let inner = node.enter(pos, side, mode); 22617 if (!inner) 22618 return node; 22619 node = inner; 22620 } 22621} 22622var BaseNode = class { 22623 cursor(mode = 0) { 22624 return new TreeCursor(this, mode); 22625 } 22626 getChild(type, before = null, after = null) { 22627 let r2 = getChildren(this, type, before, after); 22628 return r2.length ? r2[0] : null; 22629 } 22630 getChildren(type, before = null, after = null) { 22631 return getChildren(this, type, before, after); 22632 } 22633 resolve(pos, side = 0) { 22634 return resolveNode(this, pos, side, false); 22635 } 22636 resolveInner(pos, side = 0) { 22637 return resolveNode(this, pos, side, true); 22638 } 22639 matchContext(context) { 22640 return matchNodeContext(this, context); 22641 } 22642 enterUnfinishedNodesBefore(pos) { 22643 let scan = this.childBefore(pos), node = this; 22644 while (scan) { 22645 let last = scan.lastChild; 22646 if (!last || last.to != scan.to) 22647 break; 22648 if (last.type.isError && last.from == last.to) { 22649 node = scan; 22650 scan = last.prevSibling; 22651 } else { 22652 scan = last; 22653 } 22654 } 22655 return node; 22656 } 22657 get node() { 22658 return this; 22659 } 22660 get next() { 22661 return this.parent; 22662 } 22663}; 22664var TreeNode = class _TreeNode extends BaseNode { 22665 constructor(_tree, from, index, _parent) { 22666 super(); 22667 this._tree = _tree; 22668 this.from = from; 22669 this.index = index; 22670 this._parent = _parent; 22671 } 22672 get type() { 22673 return this._tree.type; 22674 } 22675 get name() { 22676 return this._tree.type.name; 22677 } 22678 get to() { 22679 return this.from + this._tree.length; 22680 } 22681 nextChild(i2, dir, pos, side, mode = 0) { 22682 for (let parent = this; ; ) { 22683 for (let { children, positions } = parent._tree, e2 = dir > 0 ? children.length : -1; i2 != e2; i2 += dir) { 22684 let next = children[i2], start = positions[i2] + parent.from; 22685 if (!checkSide(side, pos, start, start + next.length)) 22686 continue; 22687 if (next instanceof TreeBuffer) { 22688 if (mode & IterMode.ExcludeBuffers) 22689 continue; 22690 let index = next.findChild(0, next.buffer.length, dir, pos - start, side); 22691 if (index > -1) 22692 return new BufferNode(new BufferContext(parent, next, i2, start), null, index); 22693 } else if (mode & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) { 22694 let mounted; 22695 if (!(mode & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay) 22696 return new _TreeNode(mounted.tree, start, i2, parent); 22697 let inner = new _TreeNode(next, start, i2, parent); 22698 return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side); 22699 } 22700 } 22701 if (mode & IterMode.IncludeAnonymous || !parent.type.isAnonymous) 22702 return null; 22703 if (parent.index >= 0) 22704 i2 = parent.index + dir; 22705 else 22706 i2 = dir < 0 ? -1 : parent._parent._tree.children.length; 22707 parent = parent._parent; 22708 if (!parent) 22709 return null; 22710 } 22711 } 22712 get firstChild() { 22713 return this.nextChild( 22714 0, 22715 1, 22716 0, 22717 4 22718 /* Side.DontCare */ 22719 ); 22720 } 22721 get lastChild() { 22722 return this.nextChild( 22723 this._tree.children.length - 1, 22724 -1, 22725 0, 22726 4 22727 /* Side.DontCare */ 22728 ); 22729 } 22730 childAfter(pos) { 22731 return this.nextChild( 22732 0, 22733 1, 22734 pos, 22735 2 22736 /* Side.After */ 22737 ); 22738 } 22739 childBefore(pos) { 22740 return this.nextChild( 22741 this._tree.children.length - 1, 22742 -1, 22743 pos, 22744 -2 22745 /* Side.Before */ 22746 ); 22747 } 22748 enter(pos, side, mode = 0) { 22749 let mounted; 22750 if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) { 22751 let rPos = pos - this.from; 22752 for (let { from, to } of mounted.overlay) { 22753 if ((side > 0 ? from <= rPos : from < rPos) && (side < 0 ? to >= rPos : to > rPos)) 22754 return new _TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this); 22755 } 22756 } 22757 return this.nextChild(0, 1, pos, side, mode); 22758 } 22759 nextSignificantParent() { 22760 let val = this; 22761 while (val.type.isAnonymous && val._parent) 22762 val = val._parent; 22763 return val; 22764 } 22765 get parent() { 22766 return this._parent ? this._parent.nextSignificantParent() : null; 22767 } 22768 get nextSibling() { 22769 return this._parent && this.index >= 0 ? this._parent.nextChild( 22770 this.index + 1, 22771 1, 22772 0, 22773 4 22774 /* Side.DontCare */ 22775 ) : null; 22776 } 22777 get prevSibling() { 22778 return this._parent && this.index >= 0 ? this._parent.nextChild( 22779 this.index - 1, 22780 -1, 22781 0, 22782 4 22783 /* Side.DontCare */ 22784 ) : null; 22785 } 22786 get tree() { 22787 return this._tree; 22788 } 22789 toTree() { 22790 return this._tree; 22791 } 22792 /** 22793 @internal 22794 */ 22795 toString() { 22796 return this._tree.toString(); 22797 } 22798}; 22799function getChildren(node, type, before, after) { 22800 let cur2 = node.cursor(), result = []; 22801 if (!cur2.firstChild()) 22802 return result; 22803 if (before != null) 22804 for (let found = false; !found; ) { 22805 found = cur2.type.is(before); 22806 if (!cur2.nextSibling()) 22807 return result; 22808 } 22809 for (; ; ) { 22810 if (after != null && cur2.type.is(after)) 22811 return result; 22812 if (cur2.type.is(type)) 22813 result.push(cur2.node); 22814 if (!cur2.nextSibling()) 22815 return after == null ? result : []; 22816 } 22817} 22818function matchNodeContext(node, context, i2 = context.length - 1) { 22819 for (let p2 = node.parent; i2 >= 0; p2 = p2.parent) { 22820 if (!p2) 22821 return false; 22822 if (!p2.type.isAnonymous) { 22823 if (context[i2] && context[i2] != p2.name) 22824 return false; 22825 i2--; 22826 } 22827 } 22828 return true; 22829} 22830var BufferContext = class { 22831 constructor(parent, buffer, index, start) { 22832 this.parent = parent; 22833 this.buffer = buffer; 22834 this.index = index; 22835 this.start = start; 22836 } 22837}; 22838var BufferNode = class _BufferNode extends BaseNode { 22839 get name() { 22840 return this.type.name; 22841 } 22842 get from() { 22843 return this.context.start + this.context.buffer.buffer[this.index + 1]; 22844 } 22845 get to() { 22846 return this.context.start + this.context.buffer.buffer[this.index + 2]; 22847 } 22848 constructor(context, _parent, index) { 22849 super(); 22850 this.context = context; 22851 this._parent = _parent; 22852 this.index = index; 22853 this.type = context.buffer.set.types[context.buffer.buffer[index]]; 22854 } 22855 child(dir, pos, side) { 22856 let { buffer } = this.context; 22857 let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); 22858 return index < 0 ? null : new _BufferNode(this.context, this, index); 22859 } 22860 get firstChild() { 22861 return this.child( 22862 1, 22863 0, 22864 4 22865 /* Side.DontCare */ 22866 ); 22867 } 22868 get lastChild() { 22869 return this.child( 22870 -1, 22871 0, 22872 4 22873 /* Side.DontCare */ 22874 ); 22875 } 22876 childAfter(pos) { 22877 return this.child( 22878 1, 22879 pos, 22880 2 22881 /* Side.After */ 22882 ); 22883 } 22884 childBefore(pos) { 22885 return this.child( 22886 -1, 22887 pos, 22888 -2 22889 /* Side.Before */ 22890 ); 22891 } 22892 enter(pos, side, mode = 0) { 22893 if (mode & IterMode.ExcludeBuffers) 22894 return null; 22895 let { buffer } = this.context; 22896 let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); 22897 return index < 0 ? null : new _BufferNode(this.context, this, index); 22898 } 22899 get parent() { 22900 return this._parent || this.context.parent.nextSignificantParent(); 22901 } 22902 externalSibling(dir) { 22903 return this._parent ? null : this.context.parent.nextChild( 22904 this.context.index + dir, 22905 dir, 22906 0, 22907 4 22908 /* Side.DontCare */ 22909 ); 22910 } 22911 get nextSibling() { 22912 let { buffer } = this.context; 22913 let after = buffer.buffer[this.index + 3]; 22914 if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) 22915 return new _BufferNode(this.context, this._parent, after); 22916 return this.externalSibling(1); 22917 } 22918 get prevSibling() { 22919 let { buffer } = this.context; 22920 let parentStart = this._parent ? this._parent.index + 4 : 0; 22921 if (this.index == parentStart) 22922 return this.externalSibling(-1); 22923 return new _BufferNode(this.context, this._parent, buffer.findChild( 22924 parentStart, 22925 this.index, 22926 -1, 22927 0, 22928 4 22929 /* Side.DontCare */ 22930 )); 22931 } 22932 get tree() { 22933 return null; 22934 } 22935 toTree() { 22936 let children = [], positions = []; 22937 let { buffer } = this.context; 22938 let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; 22939 if (endI > startI) { 22940 let from = buffer.buffer[this.index + 1]; 22941 children.push(buffer.slice(startI, endI, from)); 22942 positions.push(0); 22943 } 22944 return new Tree(this.type, children, positions, this.to - this.from); 22945 } 22946 /** 22947 @internal 22948 */ 22949 toString() { 22950 return this.context.buffer.childString(this.index); 22951 } 22952}; 22953function iterStack(heads) { 22954 if (!heads.length) 22955 return null; 22956 let pick = 0, picked = heads[0]; 22957 for (let i2 = 1; i2 < heads.length; i2++) { 22958 let node = heads[i2]; 22959 if (node.from > picked.from || node.to < picked.to) { 22960 picked = node; 22961 pick = i2; 22962 } 22963 } 22964 let next = picked instanceof TreeNode && picked.index < 0 ? null : picked.parent; 22965 let newHeads = heads.slice(); 22966 if (next) 22967 newHeads[pick] = next; 22968 else 22969 newHeads.splice(pick, 1); 22970 return new StackIterator(newHeads, picked); 22971} 22972var StackIterator = class { 22973 constructor(heads, node) { 22974 this.heads = heads; 22975 this.node = node; 22976 } 22977 get next() { 22978 return iterStack(this.heads); 22979 } 22980}; 22981function stackIterator(tree, pos, side) { 22982 let inner = tree.resolveInner(pos, side), layers = null; 22983 for (let scan = inner instanceof TreeNode ? inner : inner.context.parent; scan; scan = scan.parent) { 22984 if (scan.index < 0) { 22985 let parent = scan.parent; 22986 (layers || (layers = [inner])).push(parent.resolve(pos, side)); 22987 scan = parent; 22988 } else { 22989 let mount = MountedTree.get(scan.tree); 22990 if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) { 22991 let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, -1, scan); 22992 (layers || (layers = [inner])).push(resolveNode(root, pos, side, false)); 22993 } 22994 } 22995 } 22996 return layers ? iterStack(layers) : inner; 22997} 22998var TreeCursor = class { 22999 /** 23000 Shorthand for `.type.name`. 23001 */ 23002 get name() { 23003 return this.type.name; 23004 } 23005 /** 23006 @internal 23007 */ 23008 constructor(node, mode = 0) { 23009 this.mode = mode; 23010 this.buffer = null; 23011 this.stack = []; 23012 this.index = 0; 23013 this.bufferNode = null; 23014 if (node instanceof TreeNode) { 23015 this.yieldNode(node); 23016 } else { 23017 this._tree = node.context.parent; 23018 this.buffer = node.context; 23019 for (let n3 = node._parent; n3; n3 = n3._parent) 23020 this.stack.unshift(n3.index); 23021 this.bufferNode = node; 23022 this.yieldBuf(node.index); 23023 } 23024 } 23025 yieldNode(node) { 23026 if (!node) 23027 return false; 23028 this._tree = node; 23029 this.type = node.type; 23030 this.from = node.from; 23031 this.to = node.to; 23032 return true; 23033 } 23034 yieldBuf(index, type) { 23035 this.index = index; 23036 let { start, buffer } = this.buffer; 23037 this.type = type || buffer.set.types[buffer.buffer[index]]; 23038 this.from = start + buffer.buffer[index + 1]; 23039 this.to = start + buffer.buffer[index + 2]; 23040 return true; 23041 } 23042 /** 23043 @internal 23044 */ 23045 yield(node) { 23046 if (!node) 23047 return false; 23048 if (node instanceof TreeNode) { 23049 this.buffer = null; 23050 return this.yieldNode(node); 23051 } 23052 this.buffer = node.context; 23053 return this.yieldBuf(node.index, node.type); 23054 } 23055 /** 23056 @internal 23057 */ 23058 toString() { 23059 return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); 23060 } 23061 /** 23062 @internal 23063 */ 23064 enterChild(dir, pos, side) { 23065 if (!this.buffer) 23066 return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); 23067 let { buffer } = this.buffer; 23068 let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); 23069 if (index < 0) 23070 return false; 23071 this.stack.push(this.index); 23072 return this.yieldBuf(index); 23073 } 23074 /** 23075 Move the cursor to this node's first child. When this returns 23076 false, the node has no child, and the cursor has not been moved. 23077 */ 23078 firstChild() { 23079 return this.enterChild( 23080 1, 23081 0, 23082 4 23083 /* Side.DontCare */ 23084 ); 23085 } 23086 /** 23087 Move the cursor to this node's last child. 23088 */ 23089 lastChild() { 23090 return this.enterChild( 23091 -1, 23092 0, 23093 4 23094 /* Side.DontCare */ 23095 ); 23096 } 23097 /** 23098 Move the cursor to the first child that ends after `pos`. 23099 */ 23100 childAfter(pos) { 23101 return this.enterChild( 23102 1, 23103 pos, 23104 2 23105 /* Side.After */ 23106 ); 23107 } 23108 /** 23109 Move to the last child that starts before `pos`. 23110 */ 23111 childBefore(pos) { 23112 return this.enterChild( 23113 -1, 23114 pos, 23115 -2 23116 /* Side.Before */ 23117 ); 23118 } 23119 /** 23120 Move the cursor to the child around `pos`. If side is -1 the 23121 child may end at that position, when 1 it may start there. This 23122 will also enter [overlaid](#common.MountedTree.overlay) 23123 [mounted](#common.NodeProp^mounted) trees unless `overlays` is 23124 set to false. 23125 */ 23126 enter(pos, side, mode = this.mode) { 23127 if (!this.buffer) 23128 return this.yield(this._tree.enter(pos, side, mode)); 23129 return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side); 23130 } 23131 /** 23132 Move to the node's parent node, if this isn't the top node. 23133 */ 23134 parent() { 23135 if (!this.buffer) 23136 return this.yieldNode(this.mode & IterMode.IncludeAnonymous ? this._tree._parent : this._tree.parent); 23137 if (this.stack.length) 23138 return this.yieldBuf(this.stack.pop()); 23139 let parent = this.mode & IterMode.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); 23140 this.buffer = null; 23141 return this.yieldNode(parent); 23142 } 23143 /** 23144 @internal 23145 */ 23146 sibling(dir) { 23147 if (!this.buffer) 23148 return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); 23149 let { buffer } = this.buffer, d2 = this.stack.length - 1; 23150 if (dir < 0) { 23151 let parentStart = d2 < 0 ? 0 : this.stack[d2] + 4; 23152 if (this.index != parentStart) 23153 return this.yieldBuf(buffer.findChild( 23154 parentStart, 23155 this.index, 23156 -1, 23157 0, 23158 4 23159 /* Side.DontCare */ 23160 )); 23161 } else { 23162 let after = buffer.buffer[this.index + 3]; 23163 if (after < (d2 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d2] + 3])) 23164 return this.yieldBuf(after); 23165 } 23166 return d2 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; 23167 } 23168 /** 23169 Move to this node's next sibling, if any. 23170 */ 23171 nextSibling() { 23172 return this.sibling(1); 23173 } 23174 /** 23175 Move to this node's previous sibling, if any. 23176 */ 23177 prevSibling() { 23178 return this.sibling(-1); 23179 } 23180 atLastNode(dir) { 23181 let index, parent, { buffer } = this; 23182 if (buffer) { 23183 if (dir > 0) { 23184 if (this.index < buffer.buffer.buffer.length) 23185 return false; 23186 } else { 23187 for (let i2 = 0; i2 < this.index; i2++) 23188 if (buffer.buffer.buffer[i2 + 3] < this.index) 23189 return false; 23190 } 23191 ({ index, parent } = buffer); 23192 } else { 23193 ({ index, _parent: parent } = this._tree); 23194 } 23195 for (; parent; { index, _parent: parent } = parent) { 23196 if (index > -1) 23197 for (let i2 = index + dir, e2 = dir < 0 ? -1 : parent._tree.children.length; i2 != e2; i2 += dir) { 23198 let child = parent._tree.children[i2]; 23199 if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) 23200 return false; 23201 } 23202 } 23203 return true; 23204 } 23205 move(dir, enter) { 23206 if (enter && this.enterChild( 23207 dir, 23208 0, 23209 4 23210 /* Side.DontCare */ 23211 )) 23212 return true; 23213 for (; ; ) { 23214 if (this.sibling(dir)) 23215 return true; 23216 if (this.atLastNode(dir) || !this.parent()) 23217 return false; 23218 } 23219 } 23220 /** 23221 Move to the next node in a 23222 [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR) 23223 traversal, going from a node to its first child or, if the 23224 current node is empty or `enter` is false, its next sibling or 23225 the next sibling of the first parent node that has one. 23226 */ 23227 next(enter = true) { 23228 return this.move(1, enter); 23229 } 23230 /** 23231 Move to the next node in a last-to-first pre-order traveral. A 23232 node is followed by its last child or, if it has none, its 23233 previous sibling or the previous sibling of the first parent 23234 node that has one. 23235 */ 23236 prev(enter = true) { 23237 return this.move(-1, enter); 23238 } 23239 /** 23240 Move the cursor to the innermost node that covers `pos`. If 23241 `side` is -1, it will enter nodes that end at `pos`. If it is 1, 23242 it will enter nodes that start at `pos`. 23243 */ 23244 moveTo(pos, side = 0) { 23245 while (this.from == this.to || (side < 1 ? this.from >= pos : this.from > pos) || (side > -1 ? this.to <= pos : this.to < pos)) 23246 if (!this.parent()) 23247 break; 23248 while (this.enterChild(1, pos, side)) { 23249 } 23250 return this; 23251 } 23252 /** 23253 Get a [syntax node](#common.SyntaxNode) at the cursor's current 23254 position. 23255 */ 23256 get node() { 23257 if (!this.buffer) 23258 return this._tree; 23259 let cache3 = this.bufferNode, result = null, depth = 0; 23260 if (cache3 && cache3.context == this.buffer) { 23261 scan: 23262 for (let index = this.index, d2 = this.stack.length; d2 >= 0; ) { 23263 for (let c2 = cache3; c2; c2 = c2._parent) 23264 if (c2.index == index) { 23265 if (index == this.index) 23266 return c2; 23267 result = c2; 23268 depth = d2 + 1; 23269 break scan; 23270 } 23271 index = this.stack[--d2]; 23272 } 23273 } 23274 for (let i2 = depth; i2 < this.stack.length; i2++) 23275 result = new BufferNode(this.buffer, result, this.stack[i2]); 23276 return this.bufferNode = new BufferNode(this.buffer, result, this.index); 23277 } 23278 /** 23279 Get the [tree](#common.Tree) that represents the current node, if 23280 any. Will return null when the node is in a [tree 23281 buffer](#common.TreeBuffer). 23282 */ 23283 get tree() { 23284 return this.buffer ? null : this._tree._tree; 23285 } 23286 /** 23287 Iterate over the current node and all its descendants, calling 23288 `enter` when entering a node and `leave`, if given, when leaving 23289 one. When `enter` returns `false`, any children of that node are 23290 skipped, and `leave` isn't called for it. 23291 */ 23292 iterate(enter, leave) { 23293 for (let depth = 0; ; ) { 23294 let mustLeave = false; 23295 if (this.type.isAnonymous || enter(this) !== false) { 23296 if (this.firstChild()) { 23297 depth++; 23298 continue; 23299 } 23300 if (!this.type.isAnonymous) 23301 mustLeave = true; 23302 } 23303 for (; ; ) { 23304 if (mustLeave && leave) 23305 leave(this); 23306 mustLeave = this.type.isAnonymous; 23307 if (this.nextSibling()) 23308 break; 23309 if (!depth) 23310 return; 23311 this.parent(); 23312 depth--; 23313 mustLeave = true; 23314 } 23315 } 23316 } 23317 /** 23318 Test whether the current node matches a given context—a sequence 23319 of direct parent node names. Empty strings in the context array 23320 are treated as wildcards. 23321 */ 23322 matchContext(context) { 23323 if (!this.buffer) 23324 return matchNodeContext(this.node, context); 23325 let { buffer } = this.buffer, { types: types2 } = buffer.set; 23326 for (let i2 = context.length - 1, d2 = this.stack.length - 1; i2 >= 0; d2--) { 23327 if (d2 < 0) 23328 return matchNodeContext(this.node, context, i2); 23329 let type = types2[buffer.buffer[this.stack[d2]]]; 23330 if (!type.isAnonymous) { 23331 if (context[i2] && context[i2] != type.name) 23332 return false; 23333 i2--; 23334 } 23335 } 23336 return true; 23337 } 23338}; 23339function hasChild(tree) { 23340 return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch)); 23341} 23342function buildTree(data) { 23343 var _a3; 23344 let { buffer, nodeSet: nodeSet2, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet2.types.length } = data; 23345 let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer; 23346 let types2 = nodeSet2.types; 23347 let contextHash = 0, lookAhead = 0; 23348 function takeNode(parentStart, minPos, children2, positions2, inRepeat, depth) { 23349 let { id: id2, start, end, size } = cursor; 23350 let lookAheadAtStart = lookAhead; 23351 while (size < 0) { 23352 cursor.next(); 23353 if (size == -1) { 23354 let node2 = reused[id2]; 23355 children2.push(node2); 23356 positions2.push(start - parentStart); 23357 return; 23358 } else if (size == -3) { 23359 contextHash = id2; 23360 return; 23361 } else if (size == -4) { 23362 lookAhead = id2; 23363 return; 23364 } else { 23365 throw new RangeError(`Unrecognized record size: ${size}`); 23366 } 23367 } 23368 let type = types2[id2], node, buffer2; 23369 let startPos = start - parentStart; 23370 if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor.pos - minPos, inRepeat))) { 23371 let data2 = new Uint16Array(buffer2.size - buffer2.skip); 23372 let endPos = cursor.pos - buffer2.size, index = data2.length; 23373 while (cursor.pos > endPos) 23374 index = copyToBuffer(buffer2.start, data2, index); 23375 node = new TreeBuffer(data2, end - buffer2.start, nodeSet2); 23376 startPos = buffer2.start - parentStart; 23377 } else { 23378 let endPos = cursor.pos - size; 23379 cursor.next(); 23380 let localChildren = [], localPositions = []; 23381 let localInRepeat = id2 >= minRepeatType ? id2 : -1; 23382 let lastGroup = 0, lastEnd = end; 23383 while (cursor.pos > endPos) { 23384 if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) { 23385 if (cursor.end <= lastEnd - maxBufferLength) { 23386 makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart); 23387 lastGroup = localChildren.length; 23388 lastEnd = cursor.end; 23389 } 23390 cursor.next(); 23391 } else if (depth > 2500) { 23392 takeFlatNode(start, endPos, localChildren, localPositions); 23393 } else { 23394 takeNode(start, endPos, localChildren, localPositions, localInRepeat, depth + 1); 23395 } 23396 } 23397 if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length) 23398 makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart); 23399 localChildren.reverse(); 23400 localPositions.reverse(); 23401 if (localInRepeat > -1 && lastGroup > 0) { 23402 let make = makeBalanced(type); 23403 node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); 23404 } else { 23405 node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); 23406 } 23407 } 23408 children2.push(node); 23409 positions2.push(startPos); 23410 } 23411 function takeFlatNode(parentStart, minPos, children2, positions2) { 23412 let nodes = []; 23413 let nodeCount = 0, stopAt = -1; 23414 while (cursor.pos > minPos) { 23415 let { id: id2, start, end, size } = cursor; 23416 if (size > 4) { 23417 cursor.next(); 23418 } else if (stopAt > -1 && start < stopAt) { 23419 break; 23420 } else { 23421 if (stopAt < 0) 23422 stopAt = end - maxBufferLength; 23423 nodes.push(id2, start, end); 23424 nodeCount++; 23425 cursor.next(); 23426 } 23427 } 23428 if (nodeCount) { 23429 let buffer2 = new Uint16Array(nodeCount * 4); 23430 let start = nodes[nodes.length - 2]; 23431 for (let i2 = nodes.length - 3, j3 = 0; i2 >= 0; i2 -= 3) { 23432 buffer2[j3++] = nodes[i2]; 23433 buffer2[j3++] = nodes[i2 + 1] - start; 23434 buffer2[j3++] = nodes[i2 + 2] - start; 23435 buffer2[j3++] = j3; 23436 } 23437 children2.push(new TreeBuffer(buffer2, nodes[2] - start, nodeSet2)); 23438 positions2.push(start - parentStart); 23439 } 23440 } 23441 function makeBalanced(type) { 23442 return (children2, positions2, length2) => { 23443 let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp; 23444 if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) { 23445 if (!lastI && last.type == type && last.length == length2) 23446 return last; 23447 if (lookAheadProp = last.prop(NodeProp.lookAhead)) 23448 lookAhead2 = positions2[lastI] + last.length + lookAheadProp; 23449 } 23450 return makeTree(type, children2, positions2, length2, lookAhead2); 23451 }; 23452 } 23453 function makeRepeatLeaf(children2, positions2, base2, i2, from, to, type, lookAhead2) { 23454 let localChildren = [], localPositions = []; 23455 while (children2.length > i2) { 23456 localChildren.push(children2.pop()); 23457 localPositions.push(positions2.pop() + base2 - from); 23458 } 23459 children2.push(makeTree(nodeSet2.types[type], localChildren, localPositions, to - from, lookAhead2 - to)); 23460 positions2.push(from - base2); 23461 } 23462 function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) { 23463 if (contextHash) { 23464 let pair2 = [NodeProp.contextHash, contextHash]; 23465 props = props ? [pair2].concat(props) : [pair2]; 23466 } 23467 if (lookAhead2 > 25) { 23468 let pair2 = [NodeProp.lookAhead, lookAhead2]; 23469 props = props ? [pair2].concat(props) : [pair2]; 23470 } 23471 return new Tree(type, children2, positions2, length2, props); 23472 } 23473 function findBufferSize(maxSize, inRepeat) { 23474 let fork = cursor.fork(); 23475 let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength; 23476 let result = { size: 0, start: 0, skip: 0 }; 23477 scan: 23478 for (let minPos = fork.pos - maxSize; fork.pos > minPos; ) { 23479 let nodeSize2 = fork.size; 23480 if (fork.id == inRepeat && nodeSize2 >= 0) { 23481 result.size = size; 23482 result.start = start; 23483 result.skip = skip; 23484 skip += 4; 23485 size += 4; 23486 fork.next(); 23487 continue; 23488 } 23489 let startPos = fork.pos - nodeSize2; 23490 if (nodeSize2 < 0 || startPos < minPos || fork.start < minStart) 23491 break; 23492 let localSkipped = fork.id >= minRepeatType ? 4 : 0; 23493 let nodeStart2 = fork.start; 23494 fork.next(); 23495 while (fork.pos > startPos) { 23496 if (fork.size < 0) { 23497 if (fork.size == -3) 23498 localSkipped += 4; 23499 else 23500 break scan; 23501 } else if (fork.id >= minRepeatType) { 23502 localSkipped += 4; 23503 } 23504 fork.next(); 23505 } 23506 start = nodeStart2; 23507 size += nodeSize2; 23508 skip += localSkipped; 23509 } 23510 if (inRepeat < 0 || size == maxSize) { 23511 result.size = size; 23512 result.start = start; 23513 result.skip = skip; 23514 } 23515 return result.size > 4 ? result : void 0; 23516 } 23517 function copyToBuffer(bufferStart, buffer2, index) { 23518 let { id: id2, start, end, size } = cursor; 23519 cursor.next(); 23520 if (size >= 0 && id2 < minRepeatType) { 23521 let startIndex = index; 23522 if (size > 4) { 23523 let endPos = cursor.pos - (size - 4); 23524 while (cursor.pos > endPos) 23525 index = copyToBuffer(bufferStart, buffer2, index); 23526 } 23527 buffer2[--index] = startIndex; 23528 buffer2[--index] = end - bufferStart; 23529 buffer2[--index] = start - bufferStart; 23530 buffer2[--index] = id2; 23531 } else if (size == -3) { 23532 contextHash = id2; 23533 } else if (size == -4) { 23534 lookAhead = id2; 23535 } 23536 return index; 23537 } 23538 let children = [], positions = []; 23539 while (cursor.pos > 0) 23540 takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1, 0); 23541 let length = (_a3 = data.length) !== null && _a3 !== void 0 ? _a3 : children.length ? positions[0] + children[0].length : 0; 23542 return new Tree(types2[data.topID], children.reverse(), positions.reverse(), length); 23543} 23544var nodeSizeCache = /* @__PURE__ */ new WeakMap(); 23545function nodeSize(balanceType, node) { 23546 if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType) 23547 return 1; 23548 let size = nodeSizeCache.get(node); 23549 if (size == null) { 23550 size = 1; 23551 for (let child of node.children) { 23552 if (child.type != balanceType || !(child instanceof Tree)) { 23553 size = 1; 23554 break; 23555 } 23556 size += nodeSize(balanceType, child); 23557 } 23558 nodeSizeCache.set(node, size); 23559 } 23560 return size; 23561} 23562function balanceRange(balanceType, children, positions, from, to, start, length, mkTop, mkTree) { 23563 let total = 0; 23564 for (let i2 = from; i2 < to; i2++) 23565 total += nodeSize(balanceType, children[i2]); 23566 let maxChild = Math.ceil( 23567 total * 1.5 / 8 23568 /* Balance.BranchFactor */ 23569 ); 23570 let localChildren = [], localPositions = []; 23571 function divide(children2, positions2, from2, to2, offset) { 23572 for (let i2 = from2; i2 < to2; ) { 23573 let groupFrom = i2, groupStart = positions2[i2], groupSize = nodeSize(balanceType, children2[i2]); 23574 i2++; 23575 for (; i2 < to2; i2++) { 23576 let nextSize = nodeSize(balanceType, children2[i2]); 23577 if (groupSize + nextSize >= maxChild) 23578 break; 23579 groupSize += nextSize; 23580 } 23581 if (i2 == groupFrom + 1) { 23582 if (groupSize > maxChild) { 23583 let only = children2[groupFrom]; 23584 divide(only.children, only.positions, 0, only.children.length, positions2[groupFrom] + offset); 23585 continue; 23586 } 23587 localChildren.push(children2[groupFrom]); 23588 } else { 23589 let length2 = positions2[i2 - 1] + children2[i2 - 1].length - groupStart; 23590 localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i2, groupStart, length2, null, mkTree)); 23591 } 23592 localPositions.push(groupStart + offset - start); 23593 } 23594 } 23595 divide(children, positions, from, to, 0); 23596 return (mkTop || mkTree)(localChildren, localPositions, length); 23597} 23598var NodeWeakMap = class { 23599 constructor() { 23600 this.map = /* @__PURE__ */ new WeakMap(); 23601 } 23602 setBuffer(buffer, index, value) { 23603 let inner = this.map.get(buffer); 23604 if (!inner) 23605 this.map.set(buffer, inner = /* @__PURE__ */ new Map()); 23606 inner.set(index, value); 23607 } 23608 getBuffer(buffer, index) { 23609 let inner = this.map.get(buffer); 23610 return inner && inner.get(index); 23611 } 23612 /** 23613 Set the value for this syntax node. 23614 */ 23615 set(node, value) { 23616 if (node instanceof BufferNode) 23617 this.setBuffer(node.context.buffer, node.index, value); 23618 else if (node instanceof TreeNode) 23619 this.map.set(node.tree, value); 23620 } 23621 /** 23622 Retrieve value for this syntax node, if it exists in the map. 23623 */ 23624 get(node) { 23625 return node instanceof BufferNode ? this.getBuffer(node.context.buffer, node.index) : node instanceof TreeNode ? this.map.get(node.tree) : void 0; 23626 } 23627 /** 23628 Set the value for the node that a cursor currently points to. 23629 */ 23630 cursorSet(cursor, value) { 23631 if (cursor.buffer) 23632 this.setBuffer(cursor.buffer.buffer, cursor.index, value); 23633 else 23634 this.map.set(cursor.tree, value); 23635 } 23636 /** 23637 Retrieve the value for the node that a cursor currently points 23638 to. 23639 */ 23640 cursorGet(cursor) { 23641 return cursor.buffer ? this.getBuffer(cursor.buffer.buffer, cursor.index) : this.map.get(cursor.tree); 23642 } 23643}; 23644var TreeFragment = class _TreeFragment { 23645 /** 23646 Construct a tree fragment. You'll usually want to use 23647 [`addTree`](#common.TreeFragment^addTree) and 23648 [`applyChanges`](#common.TreeFragment^applyChanges) instead of 23649 calling this directly. 23650 */ 23651 constructor(from, to, tree, offset, openStart = false, openEnd = false) { 23652 this.from = from; 23653 this.to = to; 23654 this.tree = tree; 23655 this.offset = offset; 23656 this.open = (openStart ? 1 : 0) | (openEnd ? 2 : 0); 23657 } 23658 /** 23659 Whether the start of the fragment represents the start of a 23660 parse, or the end of a change. (In the second case, it may not 23661 be safe to reuse some nodes at the start, depending on the 23662 parsing algorithm.) 23663 */ 23664 get openStart() { 23665 return (this.open & 1) > 0; 23666 } 23667 /** 23668 Whether the end of the fragment represents the end of a 23669 full-document parse, or the start of a change. 23670 */ 23671 get openEnd() { 23672 return (this.open & 2) > 0; 23673 } 23674 /** 23675 Create a set of fragments from a freshly parsed tree, or update 23676 an existing set of fragments by replacing the ones that overlap 23677 with a tree with content from the new tree. When `partial` is 23678 true, the parse is treated as incomplete, and the resulting 23679 fragment has [`openEnd`](#common.TreeFragment.openEnd) set to 23680 true. 23681 */ 23682 static addTree(tree, fragments = [], partial = false) { 23683 let result = [new _TreeFragment(0, tree.length, tree, 0, false, partial)]; 23684 for (let f3 of fragments) 23685 if (f3.to > tree.length) 23686 result.push(f3); 23687 return result; 23688 } 23689 /** 23690 Apply a set of edits to an array of fragments, removing or 23691 splitting fragments as necessary to remove edited ranges, and 23692 adjusting offsets for fragments that moved. 23693 */ 23694 static applyChanges(fragments, changes, minGap = 128) { 23695 if (!changes.length) 23696 return fragments; 23697 let result = []; 23698 let fI = 1, nextF = fragments.length ? fragments[0] : null; 23699 for (let cI = 0, pos = 0, off = 0; ; cI++) { 23700 let nextC = cI < changes.length ? changes[cI] : null; 23701 let nextPos = nextC ? nextC.fromA : 1e9; 23702 if (nextPos - pos >= minGap) 23703 while (nextF && nextF.from < nextPos) { 23704 let cut = nextF; 23705 if (pos >= cut.from || nextPos <= cut.to || off) { 23706 let fFrom = Math.max(cut.from, pos) - off, fTo = Math.min(cut.to, nextPos) - off; 23707 cut = fFrom >= fTo ? null : new _TreeFragment(fFrom, fTo, cut.tree, cut.offset + off, cI > 0, !!nextC); 23708 } 23709 if (cut) 23710 result.push(cut); 23711 if (nextF.to > nextPos) 23712 break; 23713 nextF = fI < fragments.length ? fragments[fI++] : null; 23714 } 23715 if (!nextC) 23716 break; 23717 pos = nextC.toA; 23718 off = nextC.toA - nextC.toB; 23719 } 23720 return result; 23721 } 23722}; 23723var Parser = class { 23724 /** 23725 Start a parse, returning a [partial parse](#common.PartialParse) 23726 object. [`fragments`](#common.TreeFragment) can be passed in to 23727 make the parse incremental. 23728 23729 By default, the entire input is parsed. You can pass `ranges`, 23730 which should be a sorted array of non-empty, non-overlapping 23731 ranges, to parse only those ranges. The tree returned in that 23732 case will start at `ranges[0].from`. 23733 */ 23734 startParse(input, fragments, ranges) { 23735 if (typeof input == "string") 23736 input = new StringInput(input); 23737 ranges = !ranges ? [new Range3(0, input.length)] : ranges.length ? ranges.map((r2) => new Range3(r2.from, r2.to)) : [new Range3(0, 0)]; 23738 return this.createParse(input, fragments || [], ranges); 23739 } 23740 /** 23741 Run a full parse, returning the resulting tree. 23742 */ 23743 parse(input, fragments, ranges) { 23744 let parse = this.startParse(input, fragments, ranges); 23745 for (; ; ) { 23746 let done = parse.advance(); 23747 if (done) 23748 return done; 23749 } 23750 } 23751}; 23752var StringInput = class { 23753 constructor(string2) { 23754 this.string = string2; 23755 } 23756 get length() { 23757 return this.string.length; 23758 } 23759 chunk(from) { 23760 return this.string.slice(from); 23761 } 23762 get lineChunks() { 23763 return false; 23764 } 23765 read(from, to) { 23766 return this.string.slice(from, to); 23767 } 23768}; 23769function parseMixed(nest) { 23770 return (parse, input, fragments, ranges) => new MixedParse(parse, nest, input, fragments, ranges); 23771} 23772var InnerParse = class { 23773 constructor(parser10, parse, overlay, target, from) { 23774 this.parser = parser10; 23775 this.parse = parse; 23776 this.overlay = overlay; 23777 this.target = target; 23778 this.from = from; 23779 } 23780}; 23781function checkRanges(ranges) { 23782 if (!ranges.length || ranges.some((r2) => r2.from >= r2.to)) 23783 throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges)); 23784} 23785var ActiveOverlay = class { 23786 constructor(parser10, predicate, mounts, index, start, target, prev) { 23787 this.parser = parser10; 23788 this.predicate = predicate; 23789 this.mounts = mounts; 23790 this.index = index; 23791 this.start = start; 23792 this.target = target; 23793 this.prev = prev; 23794 this.depth = 0; 23795 this.ranges = []; 23796 } 23797}; 23798var stoppedInner = new NodeProp({ perNode: true }); 23799var MixedParse = class { 23800 constructor(base2, nest, input, fragments, ranges) { 23801 this.nest = nest; 23802 this.input = input; 23803 this.fragments = fragments; 23804 this.ranges = ranges; 23805 this.inner = []; 23806 this.innerDone = 0; 23807 this.baseTree = null; 23808 this.stoppedAt = null; 23809 this.baseParse = base2; 23810 } 23811 advance() { 23812 if (this.baseParse) { 23813 let done2 = this.baseParse.advance(); 23814 if (!done2) 23815 return null; 23816 this.baseParse = null; 23817 this.baseTree = done2; 23818 this.startInner(); 23819 if (this.stoppedAt != null) 23820 for (let inner2 of this.inner) 23821 inner2.parse.stopAt(this.stoppedAt); 23822 } 23823 if (this.innerDone == this.inner.length) { 23824 let result = this.baseTree; 23825 if (this.stoppedAt != null) 23826 result = new Tree(result.type, result.children, result.positions, result.length, result.propValues.concat([[stoppedInner, this.stoppedAt]])); 23827 return result; 23828 } 23829 let inner = this.inner[this.innerDone], done = inner.parse.advance(); 23830 if (done) { 23831 this.innerDone++; 23832 let props = Object.assign(/* @__PURE__ */ Object.create(null), inner.target.props); 23833 props[NodeProp.mounted.id] = new MountedTree(done, inner.overlay, inner.parser); 23834 inner.target.props = props; 23835 } 23836 return null; 23837 } 23838 get parsedPos() { 23839 if (this.baseParse) 23840 return 0; 23841 let pos = this.input.length; 23842 for (let i2 = this.innerDone; i2 < this.inner.length; i2++) { 23843 if (this.inner[i2].from < pos) 23844 pos = Math.min(pos, this.inner[i2].parse.parsedPos); 23845 } 23846 return pos; 23847 } 23848 stopAt(pos) { 23849 this.stoppedAt = pos; 23850 if (this.baseParse) 23851 this.baseParse.stopAt(pos); 23852 else 23853 for (let i2 = this.innerDone; i2 < this.inner.length; i2++) 23854 this.inner[i2].parse.stopAt(pos); 23855 } 23856 startInner() { 23857 let fragmentCursor = new FragmentCursor(this.fragments); 23858 let overlay = null; 23859 let covered = null; 23860 let cursor = new TreeCursor(new TreeNode(this.baseTree, this.ranges[0].from, 0, null), IterMode.IncludeAnonymous | IterMode.IgnoreMounts); 23861 scan: 23862 for (let nest, isCovered; ; ) { 23863 let enter = true, range; 23864 if (this.stoppedAt != null && cursor.from >= this.stoppedAt) { 23865 enter = false; 23866 } else if (fragmentCursor.hasNode(cursor)) { 23867 if (overlay) { 23868 let match = overlay.mounts.find((m2) => m2.frag.from <= cursor.from && m2.frag.to >= cursor.to && m2.mount.overlay); 23869 if (match) 23870 for (let r2 of match.mount.overlay) { 23871 let from = r2.from + match.pos, to = r2.to + match.pos; 23872 if (from >= cursor.from && to <= cursor.to && !overlay.ranges.some((r3) => r3.from < to && r3.to > from)) 23873 overlay.ranges.push({ from, to }); 23874 } 23875 } 23876 enter = false; 23877 } else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) { 23878 enter = isCovered != 2; 23879 } else if (!cursor.type.isAnonymous && (nest = this.nest(cursor, this.input)) && (cursor.from < cursor.to || !nest.overlay)) { 23880 if (!cursor.tree) 23881 materialize(cursor); 23882 let oldMounts = fragmentCursor.findMounts(cursor.from, nest.parser); 23883 if (typeof nest.overlay == "function") { 23884 overlay = new ActiveOverlay(nest.parser, nest.overlay, oldMounts, this.inner.length, cursor.from, cursor.tree, overlay); 23885 } else { 23886 let ranges = punchRanges(this.ranges, nest.overlay || (cursor.from < cursor.to ? [new Range3(cursor.from, cursor.to)] : [])); 23887 if (ranges.length) 23888 checkRanges(ranges); 23889 if (ranges.length || !nest.overlay) 23890 this.inner.push(new InnerParse(nest.parser, ranges.length ? nest.parser.startParse(this.input, enterFragments(oldMounts, ranges), ranges) : nest.parser.startParse(""), nest.overlay ? nest.overlay.map((r2) => new Range3(r2.from - cursor.from, r2.to - cursor.from)) : null, cursor.tree, ranges.length ? ranges[0].from : cursor.from)); 23891 if (!nest.overlay) 23892 enter = false; 23893 else if (ranges.length) 23894 covered = { ranges, depth: 0, prev: covered }; 23895 } 23896 } else if (overlay && (range = overlay.predicate(cursor))) { 23897 if (range === true) 23898 range = new Range3(cursor.from, cursor.to); 23899 if (range.from < range.to) 23900 overlay.ranges.push(range); 23901 } 23902 if (enter && cursor.firstChild()) { 23903 if (overlay) 23904 overlay.depth++; 23905 if (covered) 23906 covered.depth++; 23907 } else { 23908 for (; ; ) { 23909 if (cursor.nextSibling()) 23910 break; 23911 if (!cursor.parent()) 23912 break scan; 23913 if (overlay && !--overlay.depth) { 23914 let ranges = punchRanges(this.ranges, overlay.ranges); 23915 if (ranges.length) { 23916 checkRanges(ranges); 23917 this.inner.splice(overlay.index, 0, new InnerParse(overlay.parser, overlay.parser.startParse(this.input, enterFragments(overlay.mounts, ranges), ranges), overlay.ranges.map((r2) => new Range3(r2.from - overlay.start, r2.to - overlay.start)), overlay.target, ranges[0].from)); 23918 } 23919 overlay = overlay.prev; 23920 } 23921 if (covered && !--covered.depth) 23922 covered = covered.prev; 23923 } 23924 } 23925 } 23926 } 23927}; 23928function checkCover(covered, from, to) { 23929 for (let range of covered) { 23930 if (range.from >= to) 23931 break; 23932 if (range.to > from) 23933 return range.from <= from && range.to >= to ? 2 : 1; 23934 } 23935 return 0; 23936} 23937function sliceBuf(buf, startI, endI, nodes, positions, off) { 23938 if (startI < endI) { 23939 let from = buf.buffer[startI + 1]; 23940 nodes.push(buf.slice(startI, endI, from)); 23941 positions.push(from - off); 23942 } 23943} 23944function materialize(cursor) { 23945 let { node } = cursor, stack = []; 23946 let buffer = node.context.buffer; 23947 do { 23948 stack.push(cursor.index); 23949 cursor.parent(); 23950 } while (!cursor.tree); 23951 let base2 = cursor.tree, i2 = base2.children.indexOf(buffer); 23952 let buf = base2.children[i2], b3 = buf.buffer, newStack = [i2]; 23953 function split(startI, endI, type, innerOffset, length, stackPos) { 23954 let targetI = stack[stackPos]; 23955 let children = [], positions = []; 23956 sliceBuf(buf, startI, targetI, children, positions, innerOffset); 23957 let from = b3[targetI + 1], to = b3[targetI + 2]; 23958 newStack.push(children.length); 23959 let child = stackPos ? split(targetI + 4, b3[targetI + 3], buf.set.types[b3[targetI]], from, to - from, stackPos - 1) : node.toTree(); 23960 children.push(child); 23961 positions.push(from - innerOffset); 23962 sliceBuf(buf, b3[targetI + 3], endI, children, positions, innerOffset); 23963 return new Tree(type, children, positions, length); 23964 } 23965 base2.children[i2] = split(0, b3.length, NodeType.none, 0, buf.length, stack.length - 1); 23966 for (let index of newStack) { 23967 let tree = cursor.tree.children[index], pos = cursor.tree.positions[index]; 23968 cursor.yield(new TreeNode(tree, pos + cursor.from, index, cursor._tree)); 23969 } 23970} 23971var StructureCursor = class { 23972 constructor(root, offset) { 23973 this.offset = offset; 23974 this.done = false; 23975 this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts); 23976 } 23977 // Move to the first node (in pre-order) that starts at or after `pos`. 23978 moveTo(pos) { 23979 let { cursor } = this, p2 = pos - this.offset; 23980 while (!this.done && cursor.from < p2) { 23981 if (cursor.to >= pos && cursor.enter(p2, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) 23982 ; 23983 else if (!cursor.next(false)) 23984 this.done = true; 23985 } 23986 } 23987 hasNode(cursor) { 23988 this.moveTo(cursor.from); 23989 if (!this.done && this.cursor.from + this.offset == cursor.from && this.cursor.tree) { 23990 for (let tree = this.cursor.tree; ; ) { 23991 if (tree == cursor.tree) 23992 return true; 23993 if (tree.children.length && tree.positions[0] == 0 && tree.children[0] instanceof Tree) 23994 tree = tree.children[0]; 23995 else 23996 break; 23997 } 23998 } 23999 return false; 24000 } 24001}; 24002var FragmentCursor = class { 24003 constructor(fragments) { 24004 var _a3; 24005 this.fragments = fragments; 24006 this.curTo = 0; 24007 this.fragI = 0; 24008 if (fragments.length) { 24009 let first = this.curFrag = fragments[0]; 24010 this.curTo = (_a3 = first.tree.prop(stoppedInner)) !== null && _a3 !== void 0 ? _a3 : first.to; 24011 this.inner = new StructureCursor(first.tree, -first.offset); 24012 } else { 24013 this.curFrag = this.inner = null; 24014 } 24015 } 24016 hasNode(node) { 24017 while (this.curFrag && node.from >= this.curTo) 24018 this.nextFrag(); 24019 return this.curFrag && this.curFrag.from <= node.from && this.curTo >= node.to && this.inner.hasNode(node); 24020 } 24021 nextFrag() { 24022 var _a3; 24023 this.fragI++; 24024 if (this.fragI == this.fragments.length) { 24025 this.curFrag = this.inner = null; 24026 } else { 24027 let frag = this.curFrag = this.fragments[this.fragI]; 24028 this.curTo = (_a3 = frag.tree.prop(stoppedInner)) !== null && _a3 !== void 0 ? _a3 : frag.to; 24029 this.inner = new StructureCursor(frag.tree, -frag.offset); 24030 } 24031 } 24032 findMounts(pos, parser10) { 24033 var _a3; 24034 let result = []; 24035 if (this.inner) { 24036 this.inner.cursor.moveTo(pos, 1); 24037 for (let pos2 = this.inner.cursor.node; pos2; pos2 = pos2.parent) { 24038 let mount = (_a3 = pos2.tree) === null || _a3 === void 0 ? void 0 : _a3.prop(NodeProp.mounted); 24039 if (mount && mount.parser == parser10) { 24040 for (let i2 = this.fragI; i2 < this.fragments.length; i2++) { 24041 let frag = this.fragments[i2]; 24042 if (frag.from >= pos2.to) 24043 break; 24044 if (frag.tree == this.curFrag.tree) 24045 result.push({ 24046 frag, 24047 pos: pos2.from - frag.offset, 24048 mount 24049 }); 24050 } 24051 } 24052 } 24053 } 24054 return result; 24055 } 24056}; 24057function punchRanges(outer, ranges) { 24058 let copy = null, current = ranges; 24059 for (let i2 = 1, j3 = 0; i2 < outer.length; i2++) { 24060 let gapFrom = outer[i2 - 1].to, gapTo = outer[i2].from; 24061 for (; j3 < current.length; j3++) { 24062 let r2 = current[j3]; 24063 if (r2.from >= gapTo) 24064 break; 24065 if (r2.to <= gapFrom) 24066 continue; 24067 if (!copy) 24068 current = copy = ranges.slice(); 24069 if (r2.from < gapFrom) { 24070 copy[j3] = new Range3(r2.from, gapFrom); 24071 if (r2.to > gapTo) 24072 copy.splice(j3 + 1, 0, new Range3(gapTo, r2.to)); 24073 } else if (r2.to > gapTo) { 24074 copy[j3--] = new Range3(gapTo, r2.to); 24075 } else { 24076 copy.splice(j3--, 1); 24077 } 24078 } 24079 } 24080 return current; 24081} 24082function findCoverChanges(a2, b3, from, to) { 24083 let iA = 0, iB = 0, inA = false, inB = false, pos = -1e9; 24084 let result = []; 24085 for (; ; ) { 24086 let nextA = iA == a2.length ? 1e9 : inA ? a2[iA].to : a2[iA].from; 24087 let nextB = iB == b3.length ? 1e9 : inB ? b3[iB].to : b3[iB].from; 24088 if (inA != inB) { 24089 let start = Math.max(pos, from), end = Math.min(nextA, nextB, to); 24090 if (start < end) 24091 result.push(new Range3(start, end)); 24092 } 24093 pos = Math.min(nextA, nextB); 24094 if (pos == 1e9) 24095 break; 24096 if (nextA == pos) { 24097 if (!inA) 24098 inA = true; 24099 else { 24100 inA = false; 24101 iA++; 24102 } 24103 } 24104 if (nextB == pos) { 24105 if (!inB) 24106 inB = true; 24107 else { 24108 inB = false; 24109 iB++; 24110 } 24111 } 24112 } 24113 return result; 24114} 24115function enterFragments(mounts, ranges) { 24116 let result = []; 24117 for (let { pos, mount, frag } of mounts) { 24118 let startPos = pos + (mount.overlay ? mount.overlay[0].from : 0), endPos = startPos + mount.tree.length; 24119 let from = Math.max(frag.from, startPos), to = Math.min(frag.to, endPos); 24120 if (mount.overlay) { 24121 let overlay = mount.overlay.map((r2) => new Range3(r2.from + pos, r2.to + pos)); 24122 let changes = findCoverChanges(ranges, overlay, from, to); 24123 for (let i2 = 0, pos2 = from; ; i2++) { 24124 let last = i2 == changes.length, end = last ? to : changes[i2].from; 24125 if (end > pos2) 24126 result.push(new TreeFragment(pos2, end, mount.tree, -startPos, frag.from >= pos2 || frag.openStart, frag.to <= end || frag.openEnd)); 24127 if (last) 24128 break; 24129 pos2 = changes[i2].to; 24130 } 24131 } else { 24132 result.push(new TreeFragment(from, to, mount.tree, -startPos, frag.from >= startPos || frag.openStart, frag.to <= endPos || frag.openEnd)); 24133 } 24134 } 24135 return result; 24136} 24137
vendor: 19,160 bytes, lines 24138-24829
24138// node_modules/@lezer/highlight/dist/index.js 24139var nextTagID = 0; 24140var Tag = class _Tag { 24141 /** 24142 @internal 24143 */ 24144 constructor(set, base2, modified) { 24145 this.set = set; 24146 this.base = base2; 24147 this.modified = modified; 24148 this.id = nextTagID++; 24149 } 24150 /** 24151 Define a new tag. If `parent` is given, the tag is treated as a 24152 sub-tag of that parent, and 24153 [highlighters](#highlight.tagHighlighter) that don't mention 24154 this tag will try to fall back to the parent tag (or grandparent 24155 tag, etc). 24156 */ 24157 static define(parent) { 24158 if (parent === null || parent === void 0 ? void 0 : parent.base) 24159 throw new Error("Can not derive from a modified tag"); 24160 let tag = new _Tag([], null, []); 24161 tag.set.push(tag); 24162 if (parent) 24163 for (let t3 of parent.set) 24164 tag.set.push(t3); 24165 return tag; 24166 } 24167 /** 24168 Define a tag _modifier_, which is a function that, given a tag, 24169 will return a tag that is a subtag of the original. Applying the 24170 same modifier to a twice tag will return the same value (`m1(t1) 24171 == m1(t1)`) and applying multiple modifiers will, regardless or 24172 order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`). 24173 24174 When multiple modifiers are applied to a given base tag, each 24175 smaller set of modifiers is registered as a parent, so that for 24176 example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`, 24177 `m1(m3(t1)`, and so on. 24178 */ 24179 static defineModifier() { 24180 let mod = new Modifier(); 24181 return (tag) => { 24182 if (tag.modified.indexOf(mod) > -1) 24183 return tag; 24184 return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a2, b3) => a2.id - b3.id)); 24185 }; 24186 } 24187}; 24188var nextModifierID = 0; 24189var Modifier = class _Modifier { 24190 constructor() { 24191 this.instances = []; 24192 this.id = nextModifierID++; 24193 } 24194 static get(base2, mods) { 24195 if (!mods.length) 24196 return base2; 24197 let exists = mods[0].instances.find((t3) => t3.base == base2 && sameArray2(mods, t3.modified)); 24198 if (exists) 24199 return exists; 24200 let set = [], tag = new Tag(set, base2, mods); 24201 for (let m2 of mods) 24202 m2.instances.push(tag); 24203 let configs = powerSet(mods); 24204 for (let parent of base2.set) 24205 if (!parent.modified.length) 24206 for (let config2 of configs) 24207 set.push(_Modifier.get(parent, config2)); 24208 return tag; 24209 } 24210}; 24211function sameArray2(a2, b3) { 24212 return a2.length == b3.length && a2.every((x, i2) => x == b3[i2]); 24213} 24214function powerSet(array) { 24215 let sets = [[]]; 24216 for (let i2 = 0; i2 < array.length; i2++) { 24217 for (let j3 = 0, e2 = sets.length; j3 < e2; j3++) { 24218 sets.push(sets[j3].concat(array[i2])); 24219 } 24220 } 24221 return sets.sort((a2, b3) => b3.length - a2.length); 24222} 24223function styleTags(spec) { 24224 let byName = /* @__PURE__ */ Object.create(null); 24225 for (let prop in spec) { 24226 let tags3 = spec[prop]; 24227 if (!Array.isArray(tags3)) 24228 tags3 = [tags3]; 24229 for (let part of prop.split(" ")) 24230 if (part) { 24231 let pieces = [], mode = 2, rest = part; 24232 for (let pos = 0; ; ) { 24233 if (rest == "..." && pos > 0 && pos + 3 == part.length) { 24234 mode = 1; 24235 break; 24236 } 24237 let m2 = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest); 24238 if (!m2) 24239 throw new RangeError("Invalid path: " + part); 24240 pieces.push(m2[0] == "*" ? "" : m2[0][0] == '"' ? JSON.parse(m2[0]) : m2[0]); 24241 pos += m2[0].length; 24242 if (pos == part.length) 24243 break; 24244 let next = part[pos++]; 24245 if (pos == part.length && next == "!") { 24246 mode = 0; 24247 break; 24248 } 24249 if (next != "/") 24250 throw new RangeError("Invalid path: " + part); 24251 rest = part.slice(pos); 24252 } 24253 let last = pieces.length - 1, inner = pieces[last]; 24254 if (!inner) 24255 throw new RangeError("Invalid path: " + part); 24256 let rule = new Rule(tags3, mode, last > 0 ? pieces.slice(0, last) : null); 24257 byName[inner] = rule.sort(byName[inner]); 24258 } 24259 } 24260 return ruleNodeProp.add(byName); 24261} 24262var ruleNodeProp = new NodeProp(); 24263var Rule = class { 24264 constructor(tags3, mode, context, next) { 24265 this.tags = tags3; 24266 this.mode = mode; 24267 this.context = context; 24268 this.next = next; 24269 } 24270 get opaque() { 24271 return this.mode == 0; 24272 } 24273 get inherit() { 24274 return this.mode == 1; 24275 } 24276 sort(other) { 24277 if (!other || other.depth < this.depth) { 24278 this.next = other; 24279 return this; 24280 } 24281 other.next = this.sort(other.next); 24282 return other; 24283 } 24284 get depth() { 24285 return this.context ? this.context.length : 0; 24286 } 24287}; 24288Rule.empty = new Rule([], 2, null); 24289function tagHighlighter(tags3, options2) { 24290 let map = /* @__PURE__ */ Object.create(null); 24291 for (let style of tags3) { 24292 if (!Array.isArray(style.tag)) 24293 map[style.tag.id] = style.class; 24294 else 24295 for (let tag of style.tag) 24296 map[tag.id] = style.class; 24297 } 24298 let { scope, all = null } = options2 || {}; 24299 return { 24300 style: (tags4) => { 24301 let cls = all; 24302 for (let tag of tags4) { 24303 for (let sub of tag.set) { 24304 let tagClass = map[sub.id]; 24305 if (tagClass) { 24306 cls = cls ? cls + " " + tagClass : tagClass; 24307 break; 24308 } 24309 } 24310 } 24311 return cls; 24312 }, 24313 scope 24314 }; 24315} 24316function highlightTags(highlighters, tags3) { 24317 let result = null; 24318 for (let highlighter of highlighters) { 24319 let value = highlighter.style(tags3); 24320 if (value) 24321 result = result ? result + " " + value : value; 24322 } 24323 return result; 24324} 24325function highlightTree(tree, highlighter, putStyle, from = 0, to = tree.length) { 24326 let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle); 24327 builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters); 24328 builder.flush(to); 24329} 24330var HighlightBuilder = class { 24331 constructor(at, highlighters, span) { 24332 this.at = at; 24333 this.highlighters = highlighters; 24334 this.span = span; 24335 this.class = ""; 24336 } 24337 startSpan(at, cls) { 24338 if (cls != this.class) { 24339 this.flush(at); 24340 if (at > this.at) 24341 this.at = at; 24342 this.class = cls; 24343 } 24344 } 24345 flush(to) { 24346 if (to > this.at && this.class) 24347 this.span(this.at, to, this.class); 24348 } 24349 highlightRange(cursor, from, to, inheritedClass, highlighters) { 24350 let { type, from: start, to: end } = cursor; 24351 if (start >= to || end <= from) 24352 return; 24353 if (type.isTop) 24354 highlighters = this.highlighters.filter((h3) => !h3.scope || h3.scope(type)); 24355 let cls = inheritedClass; 24356 let rule = getStyleTags(cursor) || Rule.empty; 24357 let tagCls = highlightTags(highlighters, rule.tags); 24358 if (tagCls) { 24359 if (cls) 24360 cls += " "; 24361 cls += tagCls; 24362 if (rule.mode == 1) 24363 inheritedClass += (inheritedClass ? " " : "") + tagCls; 24364 } 24365 this.startSpan(Math.max(from, start), cls); 24366 if (rule.opaque) 24367 return; 24368 let mounted = cursor.tree && cursor.tree.prop(NodeProp.mounted); 24369 if (mounted && mounted.overlay) { 24370 let inner = cursor.node.enter(mounted.overlay[0].from + start, 1); 24371 let innerHighlighters = this.highlighters.filter((h3) => !h3.scope || h3.scope(mounted.tree.type)); 24372 let hasChild2 = cursor.firstChild(); 24373 for (let i2 = 0, pos = start; ; i2++) { 24374 let next = i2 < mounted.overlay.length ? mounted.overlay[i2] : null; 24375 let nextPos = next ? next.from + start : end; 24376 let rangeFrom = Math.max(from, pos), rangeTo = Math.min(to, nextPos); 24377 if (rangeFrom < rangeTo && hasChild2) { 24378 while (cursor.from < rangeTo) { 24379 this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters); 24380 this.startSpan(Math.min(rangeTo, cursor.to), cls); 24381 if (cursor.to >= nextPos || !cursor.nextSibling()) 24382 break; 24383 } 24384 } 24385 if (!next || nextPos > to) 24386 break; 24387 pos = next.to + start; 24388 if (pos > from) { 24389 this.highlightRange(inner.cursor(), Math.max(from, next.from + start), Math.min(to, pos), "", innerHighlighters); 24390 this.startSpan(Math.min(to, pos), cls); 24391 } 24392 } 24393 if (hasChild2) 24394 cursor.parent(); 24395 } else if (cursor.firstChild()) { 24396 if (mounted) 24397 inheritedClass = ""; 24398 do { 24399 if (cursor.to <= from) 24400 continue; 24401 if (cursor.from >= to) 24402 break; 24403 this.highlightRange(cursor, from, to, inheritedClass, highlighters); 24404 this.startSpan(Math.min(to, cursor.to), cls); 24405 } while (cursor.nextSibling()); 24406 cursor.parent(); 24407 } 24408 } 24409}; 24410function getStyleTags(node) { 24411 let rule = node.type.prop(ruleNodeProp); 24412 while (rule && rule.context && !node.matchContext(rule.context)) 24413 rule = rule.next; 24414 return rule || null; 24415} 24416var t2 = Tag.define; 24417var comment = t2(); 24418var name = t2(); 24419var typeName = t2(name); 24420var propertyName = t2(name); 24421var literal = t2(); 24422var string = t2(literal); 24423var number = t2(literal); 24424var content = t2(); 24425var heading = t2(content); 24426var keyword = t2(); 24427var operator = t2(); 24428var punctuation = t2(); 24429var bracket = t2(punctuation); 24430var meta = t2(); 24431var tags = { 24432 /** 24433 A comment. 24434 */ 24435 comment, 24436 /** 24437 A line [comment](#highlight.tags.comment). 24438 */ 24439 lineComment: t2(comment), 24440 /** 24441 A block [comment](#highlight.tags.comment). 24442 */ 24443 blockComment: t2(comment), 24444 /** 24445 A documentation [comment](#highlight.tags.comment). 24446 */ 24447 docComment: t2(comment), 24448 /** 24449 Any kind of identifier. 24450 */ 24451 name, 24452 /** 24453 The [name](#highlight.tags.name) of a variable. 24454 */ 24455 variableName: t2(name), 24456 /** 24457 A type [name](#highlight.tags.name). 24458 */ 24459 typeName, 24460 /** 24461 A tag name (subtag of [`typeName`](#highlight.tags.typeName)). 24462 */ 24463 tagName: t2(typeName), 24464 /** 24465 A property or field [name](#highlight.tags.name). 24466 */ 24467 propertyName, 24468 /** 24469 An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)). 24470 */ 24471 attributeName: t2(propertyName), 24472 /** 24473 The [name](#highlight.tags.name) of a class. 24474 */ 24475 className: t2(name), 24476 /** 24477 A label [name](#highlight.tags.name). 24478 */ 24479 labelName: t2(name), 24480 /** 24481 A namespace [name](#highlight.tags.name). 24482 */ 24483 namespace: t2(name), 24484 /** 24485 The [name](#highlight.tags.name) of a macro. 24486 */ 24487 macroName: t2(name), 24488 /** 24489 A literal value. 24490 */ 24491 literal, 24492 /** 24493 A string [literal](#highlight.tags.literal). 24494 */ 24495 string, 24496 /** 24497 A documentation [string](#highlight.tags.string). 24498 */ 24499 docString: t2(string), 24500 /** 24501 A character literal (subtag of [string](#highlight.tags.string)). 24502 */ 24503 character: t2(string), 24504 /** 24505 An attribute value (subtag of [string](#highlight.tags.string)). 24506 */ 24507 attributeValue: t2(string), 24508 /** 24509 A number [literal](#highlight.tags.literal). 24510 */ 24511 number, 24512 /** 24513 An integer [number](#highlight.tags.number) literal. 24514 */ 24515 integer: t2(number), 24516 /** 24517 A floating-point [number](#highlight.tags.number) literal. 24518 */ 24519 float: t2(number), 24520 /** 24521 A boolean [literal](#highlight.tags.literal). 24522 */ 24523 bool: t2(literal), 24524 /** 24525 Regular expression [literal](#highlight.tags.literal). 24526 */ 24527 regexp: t2(literal), 24528 /** 24529 An escape [literal](#highlight.tags.literal), for example a 24530 backslash escape in a string. 24531 */ 24532 escape: t2(literal), 24533 /** 24534 A color [literal](#highlight.tags.literal). 24535 */ 24536 color: t2(literal), 24537 /** 24538 A URL [literal](#highlight.tags.literal). 24539 */ 24540 url: t2(literal), 24541 /** 24542 A language keyword. 24543 */ 24544 keyword, 24545 /** 24546 The [keyword](#highlight.tags.keyword) for the self or this 24547 object. 24548 */ 24549 self: t2(keyword), 24550 /** 24551 The [keyword](#highlight.tags.keyword) for null. 24552 */ 24553 null: t2(keyword), 24554 /** 24555 A [keyword](#highlight.tags.keyword) denoting some atomic value. 24556 */ 24557 atom: t2(keyword), 24558 /** 24559 A [keyword](#highlight.tags.keyword) that represents a unit. 24560 */ 24561 unit: t2(keyword), 24562 /** 24563 A modifier [keyword](#highlight.tags.keyword). 24564 */ 24565 modifier: t2(keyword), 24566 /** 24567 A [keyword](#highlight.tags.keyword) that acts as an operator. 24568 */ 24569 operatorKeyword: t2(keyword), 24570 /** 24571 A control-flow related [keyword](#highlight.tags.keyword). 24572 */ 24573 controlKeyword: t2(keyword), 24574 /** 24575 A [keyword](#highlight.tags.keyword) that defines something. 24576 */ 24577 definitionKeyword: t2(keyword), 24578 /** 24579 A [keyword](#highlight.tags.keyword) related to defining or 24580 interfacing with modules. 24581 */ 24582 moduleKeyword: t2(keyword), 24583 /** 24584 An operator. 24585 */ 24586 operator, 24587 /** 24588 An [operator](#highlight.tags.operator) that dereferences something. 24589 */ 24590 derefOperator: t2(operator), 24591 /** 24592 Arithmetic-related [operator](#highlight.tags.operator). 24593 */ 24594 arithmeticOperator: t2(operator), 24595 /** 24596 Logical [operator](#highlight.tags.operator). 24597 */ 24598 logicOperator: t2(operator), 24599 /** 24600 Bit [operator](#highlight.tags.operator). 24601 */ 24602 bitwiseOperator: t2(operator), 24603 /** 24604 Comparison [operator](#highlight.tags.operator). 24605 */ 24606 compareOperator: t2(operator), 24607 /** 24608 [Operator](#highlight.tags.operator) that updates its operand. 24609 */ 24610 updateOperator: t2(operator), 24611 /** 24612 [Operator](#highlight.tags.operator) that defines something. 24613 */ 24614 definitionOperator: t2(operator), 24615 /** 24616 Type-related [operator](#highlight.tags.operator). 24617 */ 24618 typeOperator: t2(operator), 24619 /** 24620 Control-flow [operator](#highlight.tags.operator). 24621 */ 24622 controlOperator: t2(operator), 24623 /** 24624 Program or markup punctuation. 24625 */ 24626 punctuation, 24627 /** 24628 [Punctuation](#highlight.tags.punctuation) that separates 24629 things. 24630 */ 24631 separator: t2(punctuation), 24632 /** 24633 Bracket-style [punctuation](#highlight.tags.punctuation). 24634 */ 24635 bracket, 24636 /** 24637 Angle [brackets](#highlight.tags.bracket) (usually `<` and `>` 24638 tokens). 24639 */ 24640 angleBracket: t2(bracket), 24641 /** 24642 Square [brackets](#highlight.tags.bracket) (usually `[` and `]` 24643 tokens). 24644 */ 24645 squareBracket: t2(bracket), 24646 /** 24647 Parentheses (usually `(` and `)` tokens). Subtag of 24648 [bracket](#highlight.tags.bracket). 24649 */ 24650 paren: t2(bracket), 24651 /** 24652 Braces (usually `{` and `}` tokens). Subtag of 24653 [bracket](#highlight.tags.bracket). 24654 */ 24655 brace: t2(bracket), 24656 /** 24657 Content, for example plain text in XML or markup documents. 24658 */ 24659 content, 24660 /** 24661 [Content](#highlight.tags.content) that represents a heading. 24662 */ 24663 heading, 24664 /** 24665 A level 1 [heading](#highlight.tags.heading). 24666 */ 24667 heading1: t2(heading), 24668 /** 24669 A level 2 [heading](#highlight.tags.heading). 24670 */ 24671 heading2: t2(heading), 24672 /** 24673 A level 3 [heading](#highlight.tags.heading). 24674 */ 24675 heading3: t2(heading), 24676 /** 24677 A level 4 [heading](#highlight.tags.heading). 24678 */ 24679 heading4: t2(heading), 24680 /** 24681 A level 5 [heading](#highlight.tags.heading). 24682 */ 24683 heading5: t2(heading), 24684 /** 24685 A level 6 [heading](#highlight.tags.heading). 24686 */ 24687 heading6: t2(heading), 24688 /** 24689 A prose separator (such as a horizontal rule). 24690 */ 24691 contentSeparator: t2(content), 24692 /** 24693 [Content](#highlight.tags.content) that represents a list. 24694 */ 24695 list: t2(content), 24696 /** 24697 [Content](#highlight.tags.content) that represents a quote. 24698 */ 24699 quote: t2(content), 24700 /** 24701 [Content](#highlight.tags.content) that is emphasized. 24702 */ 24703 emphasis: t2(content), 24704 /** 24705 [Content](#highlight.tags.content) that is styled strong. 24706 */ 24707 strong: t2(content), 24708 /** 24709 [Content](#highlight.tags.content) that is part of a link. 24710 */ 24711 link: t2(content), 24712 /** 24713 [Content](#highlight.tags.content) that is styled as code or 24714 monospace. 24715 */ 24716 monospace: t2(content), 24717 /** 24718 [Content](#highlight.tags.content) that has a strike-through 24719 style. 24720 */ 24721 strikethrough: t2(content), 24722 /** 24723 Inserted text in a change-tracking format. 24724 */ 24725 inserted: t2(), 24726 /** 24727 Deleted text. 24728 */ 24729 deleted: t2(), 24730 /** 24731 Changed text. 24732 */ 24733 changed: t2(), 24734 /** 24735 An invalid or unsyntactic element. 24736 */ 24737 invalid: t2(), 24738 /** 24739 Metadata or meta-instruction. 24740 */ 24741 meta, 24742 /** 24743 [Metadata](#highlight.tags.meta) that applies to the entire 24744 document. 24745 */ 24746 documentMeta: t2(meta), 24747 /** 24748 [Metadata](#highlight.tags.meta) that annotates or adds 24749 attributes to a given syntactic element. 24750 */ 24751 annotation: t2(meta), 24752 /** 24753 Processing instruction or preprocessor directive. Subtag of 24754 [meta](#highlight.tags.meta). 24755 */ 24756 processingInstruction: t2(meta), 24757 /** 24758 [Modifier](#highlight.Tag^defineModifier) that indicates that a 24759 given element is being defined. Expected to be used with the 24760 various [name](#highlight.tags.name) tags. 24761 */ 24762 definition: Tag.defineModifier(), 24763 /** 24764 [Modifier](#highlight.Tag^defineModifier) that indicates that 24765 something is constant. Mostly expected to be used with 24766 [variable names](#highlight.tags.variableName). 24767 */ 24768 constant: Tag.defineModifier(), 24769 /** 24770 [Modifier](#highlight.Tag^defineModifier) used to indicate that 24771 a [variable](#highlight.tags.variableName) or [property 24772 name](#highlight.tags.propertyName) is being called or defined 24773 as a function. 24774 */ 24775 function: Tag.defineModifier(), 24776 /** 24777 [Modifier](#highlight.Tag^defineModifier) that can be applied to 24778 [names](#highlight.tags.name) to indicate that they belong to 24779 the language's standard environment. 24780 */ 24781 standard: Tag.defineModifier(), 24782 /** 24783 [Modifier](#highlight.Tag^defineModifier) that indicates a given 24784 [names](#highlight.tags.name) is local to some scope. 24785 */ 24786 local: Tag.defineModifier(), 24787 /** 24788 A generic variant [modifier](#highlight.Tag^defineModifier) that 24789 can be used to tag language-specific alternative variants of 24790 some common tag. It is recommended for themes to define special 24791 forms of at least the [string](#highlight.tags.string) and 24792 [variable name](#highlight.tags.variableName) tags, since those 24793 come up a lot. 24794 */ 24795 special: Tag.defineModifier() 24796}; 24797var classHighlighter = tagHighlighter([ 24798 { tag: tags.link, class: "tok-link" }, 24799 { tag: tags.heading, class: "tok-heading" }, 24800 { tag: tags.emphasis, class: "tok-emphasis" }, 24801 { tag: tags.strong, class: "tok-strong" }, 24802 { tag: tags.keyword, class: "tok-keyword" }, 24803 { tag: tags.atom, class: "tok-atom" }, 24804 { tag: tags.bool, class: "tok-bool" }, 24805 { tag: tags.url, class: "tok-url" }, 24806 { tag: tags.labelName, class: "tok-labelName" }, 24807 { tag: tags.inserted, class: "tok-inserted" }, 24808 { tag: tags.deleted, class: "tok-deleted" }, 24809 { tag: tags.literal, class: "tok-literal" }, 24810 { tag: tags.string, class: "tok-string" }, 24811 { tag: tags.number, class: "tok-number" }, 24812 { tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" }, 24813 { tag: tags.variableName, class: "tok-variableName" }, 24814 { tag: tags.local(tags.variableName), class: "tok-variableName tok-local" }, 24815 { tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" }, 24816 { tag: tags.special(tags.variableName), class: "tok-variableName2" }, 24817 { tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" }, 24818 { tag: tags.typeName, class: "tok-typeName" }, 24819 { tag: tags.namespace, class: "tok-namespace" }, 24820 { tag: tags.className, class: "tok-className" }, 24821 { tag: tags.macroName, class: "tok-macroName" }, 24822 { tag: tags.propertyName, class: "tok-propertyName" }, 24823 { tag: tags.operator, class: "tok-operator" }, 24824 { tag: tags.comment, class: "tok-comment" }, 24825 { tag: tags.meta, class: "tok-meta" }, 24826 { tag: tags.invalid, class: "tok-invalid" }, 24827 { tag: tags.punctuation, class: "tok-punctuation" } 24828]); 24829
vendor: 63,301 bytes, lines 24830-26751
24830// node_modules/@codemirror/language/dist/index.js 24831var _a2; 24832var languageDataProp = /* @__PURE__ */ new NodeProp(); 24833function defineLanguageFacet(baseData) { 24834 return Facet.define({ 24835 combine: baseData ? (values2) => values2.concat(baseData) : void 0 24836 }); 24837} 24838var sublanguageProp = /* @__PURE__ */ new NodeProp(); 24839var Language = class { 24840 /** 24841 Construct a language object. If you need to invoke this 24842 directly, first define a data facet with 24843 [`defineLanguageFacet`](https://codemirror.net/6/docs/ref/#language.defineLanguageFacet), and then 24844 configure your parser to [attach](https://codemirror.net/6/docs/ref/#language.languageDataProp) it 24845 to the language's outer syntax node. 24846 */ 24847 constructor(data, parser10, extraExtensions = [], name2 = "") { 24848 this.data = data; 24849 this.name = name2; 24850 if (!EditorState.prototype.hasOwnProperty("tree")) 24851 Object.defineProperty(EditorState.prototype, "tree", { get() { 24852 return syntaxTree(this); 24853 } }); 24854 this.parser = parser10; 24855 this.extension = [ 24856 language.of(this), 24857 EditorState.languageData.of((state, pos, side) => { 24858 let top2 = topNodeAt(state, pos, side), data2 = top2.type.prop(languageDataProp); 24859 if (!data2) 24860 return []; 24861 let base2 = state.facet(data2), sub = top2.type.prop(sublanguageProp); 24862 if (sub) { 24863 let innerNode = top2.resolve(pos - top2.from, side); 24864 for (let sublang of sub) 24865 if (sublang.test(innerNode, state)) { 24866 let data3 = state.facet(sublang.facet); 24867 return sublang.type == "replace" ? data3 : data3.concat(base2); 24868 } 24869 } 24870 return base2; 24871 }) 24872 ].concat(extraExtensions); 24873 } 24874 /** 24875 Query whether this language is active at the given position. 24876 */ 24877 isActiveAt(state, pos, side = -1) { 24878 return topNodeAt(state, pos, side).type.prop(languageDataProp) == this.data; 24879 } 24880 /** 24881 Find the document regions that were parsed using this language. 24882 The returned regions will _include_ any nested languages rooted 24883 in this language, when those exist. 24884 */ 24885 findRegions(state) { 24886 let lang = state.facet(language); 24887 if ((lang === null || lang === void 0 ? void 0 : lang.data) == this.data) 24888 return [{ from: 0, to: state.doc.length }]; 24889 if (!lang || !lang.allowsNesting) 24890 return []; 24891 let result = []; 24892 let explore = (tree, from) => { 24893 if (tree.prop(languageDataProp) == this.data) { 24894 result.push({ from, to: from + tree.length }); 24895 return; 24896 } 24897 let mount = tree.prop(NodeProp.mounted); 24898 if (mount) { 24899 if (mount.tree.prop(languageDataProp) == this.data) { 24900 if (mount.overlay) 24901 for (let r2 of mount.overlay) 24902 result.push({ from: r2.from + from, to: r2.to + from }); 24903 else 24904 result.push({ from, to: from + tree.length }); 24905 return; 24906 } else if (mount.overlay) { 24907 let size = result.length; 24908 explore(mount.tree, mount.overlay[0].from + from); 24909 if (result.length > size) 24910 return; 24911 } 24912 } 24913 for (let i2 = 0; i2 < tree.children.length; i2++) { 24914 let ch = tree.children[i2]; 24915 if (ch instanceof Tree) 24916 explore(ch, tree.positions[i2] + from); 24917 } 24918 }; 24919 explore(syntaxTree(state), 0); 24920 return result; 24921 } 24922 /** 24923 Indicates whether this language allows nested languages. The 24924 default implementation returns true. 24925 */ 24926 get allowsNesting() { 24927 return true; 24928 } 24929}; 24930Language.setState = /* @__PURE__ */ StateEffect.define(); 24931function topNodeAt(state, pos, side) { 24932 let topLang = state.facet(language), tree = syntaxTree(state).topNode; 24933 if (!topLang || topLang.allowsNesting) { 24934 for (let node = tree; node; node = node.enter(pos, side, IterMode.ExcludeBuffers)) 24935 if (node.type.isTop) 24936 tree = node; 24937 } 24938 return tree; 24939} 24940var LRLanguage = class _LRLanguage extends Language { 24941 constructor(data, parser10, name2) { 24942 super(data, parser10, [], name2); 24943 this.parser = parser10; 24944 } 24945 /** 24946 Define a language from a parser. 24947 */ 24948 static define(spec) { 24949 let data = defineLanguageFacet(spec.languageData); 24950 return new _LRLanguage(data, spec.parser.configure({ 24951 props: [languageDataProp.add((type) => type.isTop ? data : void 0)] 24952 }), spec.name); 24953 } 24954 /** 24955 Create a new instance of this language with a reconfigured 24956 version of its parser and optionally a new name. 24957 */ 24958 configure(options2, name2) { 24959 return new _LRLanguage(this.data, this.parser.configure(options2), name2 || this.name); 24960 } 24961 get allowsNesting() { 24962 return this.parser.hasWrappers(); 24963 } 24964}; 24965function syntaxTree(state) { 24966 let field = state.field(Language.state, false); 24967 return field ? field.tree : Tree.empty; 24968} 24969var DocInput = class { 24970 /** 24971 Create an input object for the given document. 24972 */ 24973 constructor(doc2) { 24974 this.doc = doc2; 24975 this.cursorPos = 0; 24976 this.string = ""; 24977 this.cursor = doc2.iter(); 24978 } 24979 get length() { 24980 return this.doc.length; 24981 } 24982 syncTo(pos) { 24983 this.string = this.cursor.next(pos - this.cursorPos).value; 24984 this.cursorPos = pos + this.string.length; 24985 return this.cursorPos - this.string.length; 24986 } 24987 chunk(pos) { 24988 this.syncTo(pos); 24989 return this.string; 24990 } 24991 get lineChunks() { 24992 return true; 24993 } 24994 read(from, to) { 24995 let stringStart = this.cursorPos - this.string.length; 24996 if (from < stringStart || to >= this.cursorPos) 24997 return this.doc.sliceString(from, to); 24998 else 24999 return this.string.slice(from - stringStart, to - stringStart); 25000 } 25001}; 25002var currentContext = null; 25003var ParseContext = class _ParseContext { 25004 constructor(parser10, state, fragments = [], tree, treeLen, viewport, skipped, scheduleOn) { 25005 this.parser = parser10; 25006 this.state = state; 25007 this.fragments = fragments; 25008 this.tree = tree; 25009 this.treeLen = treeLen; 25010 this.viewport = viewport; 25011 this.skipped = skipped; 25012 this.scheduleOn = scheduleOn; 25013 this.parse = null; 25014 this.tempSkipped = []; 25015 } 25016 /** 25017 @internal 25018 */ 25019 static create(parser10, state, viewport) { 25020 return new _ParseContext(parser10, state, [], Tree.empty, 0, viewport, [], null); 25021 } 25022 startParse() { 25023 return this.parser.startParse(new DocInput(this.state.doc), this.fragments); 25024 } 25025 /** 25026 @internal 25027 */ 25028 work(until, upto) { 25029 if (upto != null && upto >= this.state.doc.length) 25030 upto = void 0; 25031 if (this.tree != Tree.empty && this.isDone(upto !== null && upto !== void 0 ? upto : this.state.doc.length)) { 25032 this.takeTree(); 25033 return true; 25034 } 25035 return this.withContext(() => { 25036 var _a3; 25037 if (typeof until == "number") { 25038 let endTime = Date.now() + until; 25039 until = () => Date.now() > endTime; 25040 } 25041 if (!this.parse) 25042 this.parse = this.startParse(); 25043 if (upto != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > upto) && upto < this.state.doc.length) 25044 this.parse.stopAt(upto); 25045 for (; ; ) { 25046 let done = this.parse.advance(); 25047 if (done) { 25048 this.fragments = this.withoutTempSkipped(TreeFragment.addTree(done, this.fragments, this.parse.stoppedAt != null)); 25049 this.treeLen = (_a3 = this.parse.stoppedAt) !== null && _a3 !== void 0 ? _a3 : this.state.doc.length; 25050 this.tree = done; 25051 this.parse = null; 25052 if (this.treeLen < (upto !== null && upto !== void 0 ? upto : this.state.doc.length)) 25053 this.parse = this.startParse(); 25054 else 25055 return true; 25056 } 25057 if (until()) 25058 return false; 25059 } 25060 }); 25061 } 25062 /** 25063 @internal 25064 */ 25065 takeTree() { 25066 let pos, tree; 25067 if (this.parse && (pos = this.parse.parsedPos) >= this.treeLen) { 25068 if (this.parse.stoppedAt == null || this.parse.stoppedAt > pos) 25069 this.parse.stopAt(pos); 25070 this.withContext(() => { 25071 while (!(tree = this.parse.advance())) { 25072 } 25073 }); 25074 this.treeLen = pos; 25075 this.tree = tree; 25076 this.fragments = this.withoutTempSkipped(TreeFragment.addTree(this.tree, this.fragments, true)); 25077 this.parse = null; 25078 } 25079 } 25080 withContext(f3) { 25081 let prev = currentContext; 25082 currentContext = this; 25083 try { 25084 return f3(); 25085 } finally { 25086 currentContext = prev; 25087 } 25088 } 25089 withoutTempSkipped(fragments) { 25090 for (let r2; r2 = this.tempSkipped.pop(); ) 25091 fragments = cutFragments(fragments, r2.from, r2.to); 25092 return fragments; 25093 } 25094 /** 25095 @internal 25096 */ 25097 changes(changes, newState) { 25098 let { fragments, tree, treeLen, viewport, skipped } = this; 25099 this.takeTree(); 25100 if (!changes.empty) { 25101 let ranges = []; 25102 changes.iterChangedRanges((fromA, toA, fromB, toB) => ranges.push({ fromA, toA, fromB, toB })); 25103 fragments = TreeFragment.applyChanges(fragments, ranges); 25104 tree = Tree.empty; 25105 treeLen = 0; 25106 viewport = { from: changes.mapPos(viewport.from, -1), to: changes.mapPos(viewport.to, 1) }; 25107 if (this.skipped.length) { 25108 skipped = []; 25109 for (let r2 of this.skipped) { 25110 let from = changes.mapPos(r2.from, 1), to = changes.mapPos(r2.to, -1); 25111 if (from < to) 25112 skipped.push({ from, to }); 25113 } 25114 } 25115 } 25116 return new _ParseContext(this.parser, newState, fragments, tree, treeLen, viewport, skipped, this.scheduleOn); 25117 } 25118 /** 25119 @internal 25120 */ 25121 updateViewport(viewport) { 25122 if (this.viewport.from == viewport.from && this.viewport.to == viewport.to) 25123 return false; 25124 this.viewport = viewport; 25125 let startLen = this.skipped.length; 25126 for (let i2 = 0; i2 < this.skipped.length; i2++) { 25127 let { from, to } = this.skipped[i2]; 25128 if (from < viewport.to && to > viewport.from) { 25129 this.fragments = cutFragments(this.fragments, from, to); 25130 this.skipped.splice(i2--, 1); 25131 } 25132 } 25133 if (this.skipped.length >= startLen) 25134 return false; 25135 this.reset(); 25136 return true; 25137 } 25138 /** 25139 @internal 25140 */ 25141 reset() { 25142 if (this.parse) { 25143 this.takeTree(); 25144 this.parse = null; 25145 } 25146 } 25147 /** 25148 Notify the parse scheduler that the given region was skipped 25149 because it wasn't in view, and the parse should be restarted 25150 when it comes into view. 25151 */ 25152 skipUntilInView(from, to) { 25153 this.skipped.push({ from, to }); 25154 } 25155 /** 25156 Returns a parser intended to be used as placeholder when 25157 asynchronously loading a nested parser. It'll skip its input and 25158 mark it as not-really-parsed, so that the next update will parse 25159 it again. 25160 25161 When `until` is given, a reparse will be scheduled when that 25162 promise resolves. 25163 */ 25164 static getSkippingParser(until) { 25165 return new class extends Parser { 25166 createParse(input, fragments, ranges) { 25167 let from = ranges[0].from, to = ranges[ranges.length - 1].to; 25168 let parser10 = { 25169 parsedPos: from, 25170 advance() { 25171 let cx = currentContext; 25172 if (cx) { 25173 for (let r2 of ranges) 25174 cx.tempSkipped.push(r2); 25175 if (until) 25176 cx.scheduleOn = cx.scheduleOn ? Promise.all([cx.scheduleOn, until]) : until; 25177 } 25178 this.parsedPos = to; 25179 return new Tree(NodeType.none, [], [], to - from); 25180 }, 25181 stoppedAt: null, 25182 stopAt() { 25183 } 25184 }; 25185 return parser10; 25186 } 25187 }(); 25188 } 25189 /** 25190 @internal 25191 */ 25192 isDone(upto) { 25193 upto = Math.min(upto, this.state.doc.length); 25194 let frags = this.fragments; 25195 return this.treeLen >= upto && frags.length && frags[0].from == 0 && frags[0].to >= upto; 25196 } 25197 /** 25198 Get the context for the current parse, or `null` if no editor 25199 parse is in progress. 25200 */ 25201 static get() { 25202 return currentContext; 25203 } 25204}; 25205function cutFragments(fragments, from, to) { 25206 return TreeFragment.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]); 25207} 25208var LanguageState = class _LanguageState { 25209 constructor(context) { 25210 this.context = context; 25211 this.tree = context.tree; 25212 } 25213 apply(tr) { 25214 if (!tr.docChanged && this.tree == this.context.tree) 25215 return this; 25216 let newCx = this.context.changes(tr.changes, tr.state); 25217 let upto = this.context.treeLen == tr.startState.doc.length ? void 0 : Math.max(tr.changes.mapPos(this.context.treeLen), newCx.viewport.to); 25218 if (!newCx.work(20, upto)) 25219 newCx.takeTree(); 25220 return new _LanguageState(newCx); 25221 } 25222 static init(state) { 25223 let vpTo = Math.min(3e3, state.doc.length); 25224 let parseState = ParseContext.create(state.facet(language).parser, state, { from: 0, to: vpTo }); 25225 if (!parseState.work(20, vpTo)) 25226 parseState.takeTree(); 25227 return new _LanguageState(parseState); 25228 } 25229}; 25230Language.state = /* @__PURE__ */ StateField.define({ 25231 create: LanguageState.init, 25232 update(value, tr) { 25233 for (let e2 of tr.effects) 25234 if (e2.is(Language.setState)) 25235 return e2.value; 25236 if (tr.startState.facet(language) != tr.state.facet(language)) 25237 return LanguageState.init(tr.state); 25238 return value.apply(tr); 25239 } 25240}); 25241var requestIdle = (callback) => { 25242 let timeout = setTimeout( 25243 () => callback(), 25244 500 25245 /* Work.MaxPause */ 25246 ); 25247 return () => clearTimeout(timeout); 25248}; 25249if (typeof requestIdleCallback != "undefined") 25250 requestIdle = (callback) => { 25251 let idle = -1, timeout = setTimeout( 25252 () => { 25253 idle = requestIdleCallback(callback, { 25254 timeout: 500 - 100 25255 /* Work.MinPause */ 25256 }); 25257 }, 25258 100 25259 /* Work.MinPause */ 25260 ); 25261 return () => idle < 0 ? clearTimeout(timeout) : cancelIdleCallback(idle); 25262 }; 25263var isInputPending = typeof navigator != "undefined" && ((_a2 = navigator.scheduling) === null || _a2 === void 0 ? void 0 : _a2.isInputPending) ? () => navigator.scheduling.isInputPending() : null; 25264var parseWorker = /* @__PURE__ */ ViewPlugin.fromClass(class ParseWorker { 25265 constructor(view) { 25266 this.view = view; 25267 this.working = null; 25268 this.workScheduled = 0; 25269 this.chunkEnd = -1; 25270 this.chunkBudget = -1; 25271 this.work = this.work.bind(this); 25272 this.scheduleWork(); 25273 } 25274 update(update) { 25275 let cx = this.view.state.field(Language.state).context; 25276 if (cx.updateViewport(update.view.viewport) || this.view.viewport.to > cx.treeLen) 25277 this.scheduleWork(); 25278 if (update.docChanged || update.selectionSet) { 25279 if (this.view.hasFocus) 25280 this.chunkBudget += 50; 25281 this.scheduleWork(); 25282 } 25283 this.checkAsyncSchedule(cx); 25284 } 25285 scheduleWork() { 25286 if (this.working) 25287 return; 25288 let { state } = this.view, field = state.field(Language.state); 25289 if (field.tree != field.context.tree || !field.context.isDone(state.doc.length)) 25290 this.working = requestIdle(this.work); 25291 } 25292 work(deadline) { 25293 this.working = null; 25294 let now = Date.now(); 25295 if (this.chunkEnd < now && (this.chunkEnd < 0 || this.view.hasFocus)) { 25296 this.chunkEnd = now + 3e4; 25297 this.chunkBudget = 3e3; 25298 } 25299 if (this.chunkBudget <= 0) 25300 return; 25301 let { state, viewport: { to: vpTo } } = this.view, field = state.field(Language.state); 25302 if (field.tree == field.context.tree && field.context.isDone( 25303 vpTo + 1e5 25304 /* Work.MaxParseAhead */ 25305 )) 25306 return; 25307 let endTime = Date.now() + Math.min(this.chunkBudget, 100, deadline && !isInputPending ? Math.max(25, deadline.timeRemaining() - 5) : 1e9); 25308 let viewportFirst = field.context.treeLen < vpTo && state.doc.length > vpTo + 1e3; 25309 let done = field.context.work(() => { 25310 return isInputPending && isInputPending() || Date.now() > endTime; 25311 }, vpTo + (viewportFirst ? 0 : 1e5)); 25312 this.chunkBudget -= Date.now() - now; 25313 if (done || this.chunkBudget <= 0) { 25314 field.context.takeTree(); 25315 this.view.dispatch({ effects: Language.setState.of(new LanguageState(field.context)) }); 25316 } 25317 if (this.chunkBudget > 0 && !(done && !viewportFirst)) 25318 this.scheduleWork(); 25319 this.checkAsyncSchedule(field.context); 25320 } 25321 checkAsyncSchedule(cx) { 25322 if (cx.scheduleOn) { 25323 this.workScheduled++; 25324 cx.scheduleOn.then(() => this.scheduleWork()).catch((err2) => logException(this.view.state, err2)).then(() => this.workScheduled--); 25325 cx.scheduleOn = null; 25326 } 25327 } 25328 destroy() { 25329 if (this.working) 25330 this.working(); 25331 } 25332 isWorking() { 25333 return !!(this.working || this.workScheduled > 0); 25334 } 25335}, { 25336 eventHandlers: { focus() { 25337 this.scheduleWork(); 25338 } } 25339}); 25340var language = /* @__PURE__ */ Facet.define({ 25341 combine(languages) { 25342 return languages.length ? languages[0] : null; 25343 }, 25344 enables: (language2) => [ 25345 Language.state, 25346 parseWorker, 25347 EditorView.contentAttributes.compute([language2], (state) => { 25348 let lang = state.facet(language2); 25349 return lang && lang.name ? { "data-language": lang.name } : {}; 25350 }) 25351 ] 25352}); 25353var LanguageSupport = class { 25354 /** 25355 Create a language support object. 25356 */ 25357 constructor(language2, support = []) { 25358 this.language = language2; 25359 this.support = support; 25360 this.extension = [language2, support]; 25361 } 25362}; 25363var indentService = /* @__PURE__ */ Facet.define(); 25364var indentUnit = /* @__PURE__ */ Facet.define({ 25365 combine: (values2) => { 25366 if (!values2.length) 25367 return " "; 25368 let unit = values2[0]; 25369 if (!unit || /\S/.test(unit) || Array.from(unit).some((e2) => e2 != unit[0])) 25370 throw new Error("Invalid indent unit: " + JSON.stringify(values2[0])); 25371 return unit; 25372 } 25373}); 25374function getIndentUnit(state) { 25375 let unit = state.facet(indentUnit); 25376 return unit.charCodeAt(0) == 9 ? state.tabSize * unit.length : unit.length; 25377} 25378function indentString(state, cols) { 25379 let result = "", ts = state.tabSize, ch = state.facet(indentUnit)[0]; 25380 if (ch == " ") { 25381 while (cols >= ts) { 25382 result += " "; 25383 cols -= ts; 25384 } 25385 ch = " "; 25386 } 25387 for (let i2 = 0; i2 < cols; i2++) 25388 result += ch; 25389 return result; 25390} 25391function getIndentation(context, pos) { 25392 if (context instanceof EditorState) 25393 context = new IndentContext(context); 25394 for (let service of context.state.facet(indentService)) { 25395 let result = service(context, pos); 25396 if (result !== void 0) 25397 return result; 25398 } 25399 let tree = syntaxTree(context.state); 25400 return tree.length >= pos ? syntaxIndentation(context, tree, pos) : null; 25401} 25402var IndentContext = class { 25403 /** 25404 Create an indent context. 25405 */ 25406 constructor(state, options2 = {}) { 25407 this.state = state; 25408 this.options = options2; 25409 this.unit = getIndentUnit(state); 25410 } 25411 /** 25412 Get a description of the line at the given position, taking 25413 [simulated line 25414 breaks](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak) 25415 into account. If there is such a break at `pos`, the `bias` 25416 argument determines whether the part of the line line before or 25417 after the break is used. 25418 */ 25419 lineAt(pos, bias = 1) { 25420 let line = this.state.doc.lineAt(pos); 25421 let { simulateBreak, simulateDoubleBreak } = this.options; 25422 if (simulateBreak != null && simulateBreak >= line.from && simulateBreak <= line.to) { 25423 if (simulateDoubleBreak && simulateBreak == pos) 25424 return { text: "", from: pos }; 25425 else if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos) 25426 return { text: line.text.slice(simulateBreak - line.from), from: simulateBreak }; 25427 else 25428 return { text: line.text.slice(0, simulateBreak - line.from), from: line.from }; 25429 } 25430 return line; 25431 } 25432 /** 25433 Get the text directly after `pos`, either the entire line 25434 or the next 100 characters, whichever is shorter. 25435 */ 25436 textAfterPos(pos, bias = 1) { 25437 if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak) 25438 return ""; 25439 let { text, from } = this.lineAt(pos, bias); 25440 return text.slice(pos - from, Math.min(text.length, pos + 100 - from)); 25441 } 25442 /** 25443 Find the column for the given position. 25444 */ 25445 column(pos, bias = 1) { 25446 let { text, from } = this.lineAt(pos, bias); 25447 let result = this.countColumn(text, pos - from); 25448 let override = this.options.overrideIndentation ? this.options.overrideIndentation(from) : -1; 25449 if (override > -1) 25450 result += override - this.countColumn(text, text.search(/\S|$/)); 25451 return result; 25452 } 25453 /** 25454 Find the column position (taking tabs into account) of the given 25455 position in the given string. 25456 */ 25457 countColumn(line, pos = line.length) { 25458 return countColumn(line, this.state.tabSize, pos); 25459 } 25460 /** 25461 Find the indentation column of the line at the given point. 25462 */ 25463 lineIndent(pos, bias = 1) { 25464 let { text, from } = this.lineAt(pos, bias); 25465 let override = this.options.overrideIndentation; 25466 if (override) { 25467 let overriden = override(from); 25468 if (overriden > -1) 25469 return overriden; 25470 } 25471 return this.countColumn(text, text.search(/\S|$/)); 25472 } 25473 /** 25474 Returns the [simulated line 25475 break](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak) 25476 for this context, if any. 25477 */ 25478 get simulatedBreak() { 25479 return this.options.simulateBreak || null; 25480 } 25481}; 25482var indentNodeProp = /* @__PURE__ */ new NodeProp(); 25483function syntaxIndentation(cx, ast, pos) { 25484 let stack = ast.resolveStack(pos); 25485 let inner = stack.node.enterUnfinishedNodesBefore(pos); 25486 if (inner != stack.node) { 25487 let add2 = []; 25488 for (let cur2 = inner; cur2 != stack.node; cur2 = cur2.parent) 25489 add2.push(cur2); 25490 for (let i2 = add2.length - 1; i2 >= 0; i2--) 25491 stack = { node: add2[i2], next: stack }; 25492 } 25493 return indentFor(stack, cx, pos); 25494} 25495function indentFor(stack, cx, pos) { 25496 for (let cur2 = stack; cur2; cur2 = cur2.next) { 25497 let strategy = indentStrategy(cur2.node); 25498 if (strategy) 25499 return strategy(TreeIndentContext.create(cx, pos, cur2)); 25500 } 25501 return 0; 25502} 25503function ignoreClosed(cx) { 25504 return cx.pos == cx.options.simulateBreak && cx.options.simulateDoubleBreak; 25505} 25506function indentStrategy(tree) { 25507 let strategy = tree.type.prop(indentNodeProp); 25508 if (strategy) 25509 return strategy; 25510 let first = tree.firstChild, close; 25511 if (first && (close = first.type.prop(NodeProp.closedBy))) { 25512 let last = tree.lastChild, closed = last && close.indexOf(last.name) > -1; 25513 return (cx) => delimitedStrategy(cx, true, 1, void 0, closed && !ignoreClosed(cx) ? last.from : void 0); 25514 } 25515 return tree.parent == null ? topIndent : null; 25516} 25517function topIndent() { 25518 return 0; 25519} 25520var TreeIndentContext = class _TreeIndentContext extends IndentContext { 25521 constructor(base2, pos, context) { 25522 super(base2.state, base2.options); 25523 this.base = base2; 25524 this.pos = pos; 25525 this.context = context; 25526 } 25527 /** 25528 The syntax tree node to which the indentation strategy 25529 applies. 25530 */ 25531 get node() { 25532 return this.context.node; 25533 } 25534 /** 25535 @internal 25536 */ 25537 static create(base2, pos, context) { 25538 return new _TreeIndentContext(base2, pos, context); 25539 } 25540 /** 25541 Get the text directly after `this.pos`, either the entire line 25542 or the next 100 characters, whichever is shorter. 25543 */ 25544 get textAfter() { 25545 return this.textAfterPos(this.pos); 25546 } 25547 /** 25548 Get the indentation at the reference line for `this.node`, which 25549 is the line on which it starts, unless there is a node that is 25550 _not_ a parent of this node covering the start of that line. If 25551 so, the line at the start of that node is tried, again skipping 25552 on if it is covered by another such node. 25553 */ 25554 get baseIndent() { 25555 return this.baseIndentFor(this.node); 25556 } 25557 /** 25558 Get the indentation for the reference line of the given node 25559 (see [`baseIndent`](https://codemirror.net/6/docs/ref/#language.TreeIndentContext.baseIndent)). 25560 */ 25561 baseIndentFor(node) { 25562 let line = this.state.doc.lineAt(node.from); 25563 for (; ; ) { 25564 let atBreak = node.resolve(line.from); 25565 while (atBreak.parent && atBreak.parent.from == atBreak.from) 25566 atBreak = atBreak.parent; 25567 if (isParent(atBreak, node)) 25568 break; 25569 line = this.state.doc.lineAt(atBreak.from); 25570 } 25571 return this.lineIndent(line.from); 25572 } 25573 /** 25574 Continue looking for indentations in the node's parent nodes, 25575 and return the result of that. 25576 */ 25577 continue() { 25578 return indentFor(this.context.next, this.base, this.pos); 25579 } 25580}; 25581function isParent(parent, of) { 25582 for (let cur2 = of; cur2; cur2 = cur2.parent) 25583 if (parent == cur2) 25584 return true; 25585 return false; 25586} 25587function bracketedAligned(context) { 25588 let tree = context.node; 25589 let openToken = tree.childAfter(tree.from), last = tree.lastChild; 25590 if (!openToken) 25591 return null; 25592 let sim = context.options.simulateBreak; 25593 let openLine = context.state.doc.lineAt(openToken.from); 25594 let lineEnd = sim == null || sim <= openLine.from ? openLine.to : Math.min(openLine.to, sim); 25595 for (let pos = openToken.to; ; ) { 25596 let next = tree.childAfter(pos); 25597 if (!next || next == last) 25598 return null; 25599 if (!next.type.isSkipped) 25600 return next.from < lineEnd ? openToken : null; 25601 pos = next.to; 25602 } 25603} 25604function delimitedIndent({ closing: closing2, align = true, units = 1 }) { 25605 return (context) => delimitedStrategy(context, align, units, closing2); 25606} 25607function delimitedStrategy(context, align, units, closing2, closedAt) { 25608 let after = context.textAfter, space5 = after.match(/^\s*/)[0].length; 25609 let closed = closing2 && after.slice(space5, space5 + closing2.length) == closing2 || closedAt == context.pos + space5; 25610 let aligned = align ? bracketedAligned(context) : null; 25611 if (aligned) 25612 return closed ? context.column(aligned.from) : context.column(aligned.to); 25613 return context.baseIndent + (closed ? 0 : context.unit * units); 25614} 25615var flatIndent = (context) => context.baseIndent; 25616function continuedIndent({ except, units = 1 } = {}) { 25617 return (context) => { 25618 let matchExcept = except && except.test(context.textAfter); 25619 return context.baseIndent + (matchExcept ? 0 : units * context.unit); 25620 }; 25621} 25622var DontIndentBeyond = 200; 25623function indentOnInput() { 25624 return EditorState.transactionFilter.of((tr) => { 25625 if (!tr.docChanged || !tr.isUserEvent("input.type") && !tr.isUserEvent("input.complete")) 25626 return tr; 25627 let rules = tr.startState.languageDataAt("indentOnInput", tr.startState.selection.main.head); 25628 if (!rules.length) 25629 return tr; 25630 let doc2 = tr.newDoc, { head } = tr.newSelection.main, line = doc2.lineAt(head); 25631 if (head > line.from + DontIndentBeyond) 25632 return tr; 25633 let lineStart = doc2.sliceString(line.from, head); 25634 if (!rules.some((r2) => r2.test(lineStart))) 25635 return tr; 25636 let { state } = tr, last = -1, changes = []; 25637 for (let { head: head2 } of state.selection.ranges) { 25638 let line2 = state.doc.lineAt(head2); 25639 if (line2.from == last) 25640 continue; 25641 last = line2.from; 25642 let indent3 = getIndentation(state, line2.from); 25643 if (indent3 == null) 25644 continue; 25645 let cur2 = /^\s*/.exec(line2.text)[0]; 25646 let norm = indentString(state, indent3); 25647 if (cur2 != norm) 25648 changes.push({ from: line2.from, to: line2.from + cur2.length, insert: norm }); 25649 } 25650 return changes.length ? [tr, { changes, sequential: true }] : tr; 25651 }); 25652} 25653var foldService = /* @__PURE__ */ Facet.define(); 25654var foldNodeProp = /* @__PURE__ */ new NodeProp(); 25655function foldInside(node) { 25656 let first = node.firstChild, last = node.lastChild; 25657 return first && first.to < last.from ? { from: first.to, to: last.type.isError ? node.to : last.from } : null; 25658} 25659function syntaxFolding(state, start, end) { 25660 let tree = syntaxTree(state); 25661 if (tree.length < end) 25662 return null; 25663 let stack = tree.resolveStack(end, 1); 25664 let found = null; 25665 for (let iter = stack; iter; iter = iter.next) { 25666 let cur2 = iter.node; 25667 if (cur2.to <= end || cur2.from > end) 25668 continue; 25669 if (found && cur2.from < start) 25670 break; 25671 let prop = cur2.type.prop(foldNodeProp); 25672 if (prop && (cur2.to < tree.length - 50 || tree.length == state.doc.length || !isUnfinished(cur2))) { 25673 let value = prop(cur2, state); 25674 if (value && value.from <= end && value.from >= start && value.to > end) 25675 found = value; 25676 } 25677 } 25678 return found; 25679} 25680function isUnfinished(node) { 25681 let ch = node.lastChild; 25682 return ch && ch.to == node.to && ch.type.isError; 25683} 25684function foldable(state, lineStart, lineEnd) { 25685 for (let service of state.facet(foldService)) { 25686 let result = service(state, lineStart, lineEnd); 25687 if (result) 25688 return result; 25689 } 25690 return syntaxFolding(state, lineStart, lineEnd); 25691} 25692function mapRange(range, mapping) { 25693 let from = mapping.mapPos(range.from, 1), to = mapping.mapPos(range.to, -1); 25694 return from >= to ? void 0 : { from, to }; 25695} 25696var foldEffect = /* @__PURE__ */ StateEffect.define({ map: mapRange }); 25697var unfoldEffect = /* @__PURE__ */ StateEffect.define({ map: mapRange }); 25698function selectedLines(view) { 25699 let lines = []; 25700 for (let { head } of view.state.selection.ranges) { 25701 if (lines.some((l3) => l3.from <= head && l3.to >= head)) 25702 continue; 25703 lines.push(view.lineBlockAt(head)); 25704 } 25705 return lines; 25706} 25707var foldState = /* @__PURE__ */ StateField.define({ 25708 create() { 25709 return Decoration.none; 25710 }, 25711 update(folded, tr) { 25712 folded = folded.map(tr.changes); 25713 for (let e2 of tr.effects) { 25714 if (e2.is(foldEffect) && !foldExists(folded, e2.value.from, e2.value.to)) { 25715 let { preparePlaceholder } = tr.state.facet(foldConfig); 25716 let widget = !preparePlaceholder ? foldWidget : Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, e2.value)) }); 25717 folded = folded.update({ add: [widget.range(e2.value.from, e2.value.to)] }); 25718 } else if (e2.is(unfoldEffect)) { 25719 folded = folded.update({ 25720 filter: (from, to) => e2.value.from != from || e2.value.to != to, 25721 filterFrom: e2.value.from, 25722 filterTo: e2.value.to 25723 }); 25724 } 25725 } 25726 if (tr.selection) { 25727 let onSelection = false, { head } = tr.selection.main; 25728 folded.between(head, head, (a2, b3) => { 25729 if (a2 < head && b3 > head) 25730 onSelection = true; 25731 }); 25732 if (onSelection) 25733 folded = folded.update({ 25734 filterFrom: head, 25735 filterTo: head, 25736 filter: (a2, b3) => b3 <= head || a2 >= head 25737 }); 25738 } 25739 return folded; 25740 }, 25741 provide: (f3) => EditorView.decorations.from(f3), 25742 toJSON(folded, state) { 25743 let ranges = []; 25744 folded.between(0, state.doc.length, (from, to) => { 25745 ranges.push(from, to); 25746 }); 25747 return ranges; 25748 }, 25749 fromJSON(value) { 25750 if (!Array.isArray(value) || value.length % 2) 25751 throw new RangeError("Invalid JSON for fold state"); 25752 let ranges = []; 25753 for (let i2 = 0; i2 < value.length; ) { 25754 let from = value[i2++], to = value[i2++]; 25755 if (typeof from != "number" || typeof to != "number") 25756 throw new RangeError("Invalid JSON for fold state"); 25757 ranges.push(foldWidget.range(from, to)); 25758 } 25759 return Decoration.set(ranges, true); 25760 } 25761}); 25762function findFold(state, from, to) { 25763 var _a3; 25764 let found = null; 25765 (_a3 = state.field(foldState, false)) === null || _a3 === void 0 ? void 0 : _a3.between(from, to, (from2, to2) => { 25766 if (!found || found.from > from2) 25767 found = { from: from2, to: to2 }; 25768 }); 25769 return found; 25770} 25771function foldExists(folded, from, to) { 25772 let found = false; 25773 folded.between(from, from, (a2, b3) => { 25774 if (a2 == from && b3 == to) 25775 found = true; 25776 }); 25777 return found; 25778} 25779function maybeEnable(state, other) { 25780 return state.field(foldState, false) ? other : other.concat(StateEffect.appendConfig.of(codeFolding())); 25781} 25782var foldCode = (view) => { 25783 for (let line of selectedLines(view)) { 25784 let range = foldable(view.state, line.from, line.to); 25785 if (range) { 25786 view.dispatch({ effects: maybeEnable(view.state, [foldEffect.of(range), announceFold(view, range)]) }); 25787 return true; 25788 } 25789 } 25790 return false; 25791}; 25792var unfoldCode = (view) => { 25793 if (!view.state.field(foldState, false)) 25794 return false; 25795 let effects = []; 25796 for (let line of selectedLines(view)) { 25797 let folded = findFold(view.state, line.from, line.to); 25798 if (folded) 25799 effects.push(unfoldEffect.of(folded), announceFold(view, folded, false)); 25800 } 25801 if (effects.length) 25802 view.dispatch({ effects }); 25803 return effects.length > 0; 25804}; 25805function announceFold(view, range, fold = true) { 25806 let lineFrom = view.state.doc.lineAt(range.from).number, lineTo = view.state.doc.lineAt(range.to).number; 25807 return EditorView.announce.of(`${view.state.phrase(fold ? "Folded lines" : "Unfolded lines")} ${lineFrom} ${view.state.phrase("to")} ${lineTo}.`); 25808} 25809var foldAll = (view) => { 25810 let { state } = view, effects = []; 25811 for (let pos = 0; pos < state.doc.length; ) { 25812 let line = view.lineBlockAt(pos), range = foldable(state, line.from, line.to); 25813 if (range) 25814 effects.push(foldEffect.of(range)); 25815 pos = (range ? view.lineBlockAt(range.to) : line).to + 1; 25816 } 25817 if (effects.length) 25818 view.dispatch({ effects: maybeEnable(view.state, effects) }); 25819 return !!effects.length; 25820}; 25821var unfoldAll = (view) => { 25822 let field = view.state.field(foldState, false); 25823 if (!field || !field.size) 25824 return false; 25825 let effects = []; 25826 field.between(0, view.state.doc.length, (from, to) => { 25827 effects.push(unfoldEffect.of({ from, to })); 25828 }); 25829 view.dispatch({ effects }); 25830 return true; 25831}; 25832var foldKeymap = [ 25833 { key: "Ctrl-Shift-[", mac: "Cmd-Alt-[", run: foldCode }, 25834 { key: "Ctrl-Shift-]", mac: "Cmd-Alt-]", run: unfoldCode }, 25835 { key: "Ctrl-Alt-[", run: foldAll }, 25836 { key: "Ctrl-Alt-]", run: unfoldAll } 25837]; 25838var defaultConfig = { 25839 placeholderDOM: null, 25840 preparePlaceholder: null, 25841 placeholderText: "\u2026" 25842}; 25843var foldConfig = /* @__PURE__ */ Facet.define({ 25844 combine(values2) { 25845 return combineConfig(values2, defaultConfig); 25846 } 25847}); 25848function codeFolding(config2) { 25849 let result = [foldState, baseTheme$12]; 25850 if (config2) 25851 result.push(foldConfig.of(config2)); 25852 return result; 25853} 25854function widgetToDOM(view, prepared) { 25855 let { state } = view, conf = state.facet(foldConfig); 25856 let onclick = (event) => { 25857 let line = view.lineBlockAt(view.posAtDOM(event.target)); 25858 let folded = findFold(view.state, line.from, line.to); 25859 if (folded) 25860 view.dispatch({ effects: unfoldEffect.of(folded) }); 25861 event.preventDefault(); 25862 }; 25863 if (conf.placeholderDOM) 25864 return conf.placeholderDOM(view, onclick, prepared); 25865 let element = document.createElement("span"); 25866 element.textContent = conf.placeholderText; 25867 element.setAttribute("aria-label", state.phrase("folded code")); 25868 element.title = state.phrase("unfold"); 25869 element.className = "cm-foldPlaceholder"; 25870 element.onclick = onclick; 25871 return element; 25872} 25873var foldWidget = /* @__PURE__ */ Decoration.replace({ widget: /* @__PURE__ */ new class extends WidgetType { 25874 toDOM(view) { 25875 return widgetToDOM(view, null); 25876 } 25877}() }); 25878var PreparedFoldWidget = class extends WidgetType { 25879 constructor(value) { 25880 super(); 25881 this.value = value; 25882 } 25883 eq(other) { 25884 return this.value == other.value; 25885 } 25886 toDOM(view) { 25887 return widgetToDOM(view, this.value); 25888 } 25889}; 25890var baseTheme$12 = /* @__PURE__ */ EditorView.baseTheme({ 25891 ".cm-foldPlaceholder": { 25892 backgroundColor: "#eee", 25893 border: "1px solid #ddd", 25894 color: "#888", 25895 borderRadius: ".2em", 25896 margin: "0 1px", 25897 padding: "0 1px", 25898 cursor: "pointer" 25899 }, 25900 ".cm-foldGutter span": { 25901 padding: "0 1px", 25902 cursor: "pointer" 25903 } 25904}); 25905var HighlightStyle = class _HighlightStyle { 25906 constructor(specs, options2) { 25907 this.specs = specs; 25908 let modSpec; 25909 function def(spec) { 25910 let cls = StyleModule.newName(); 25911 (modSpec || (modSpec = /* @__PURE__ */ Object.create(null)))["." + cls] = spec; 25912 return cls; 25913 } 25914 const all = typeof options2.all == "string" ? options2.all : options2.all ? def(options2.all) : void 0; 25915 const scopeOpt = options2.scope; 25916 this.scope = scopeOpt instanceof Language ? (type) => type.prop(languageDataProp) == scopeOpt.data : scopeOpt ? (type) => type == scopeOpt : void 0; 25917 this.style = tagHighlighter(specs.map((style) => ({ 25918 tag: style.tag, 25919 class: style.class || def(Object.assign({}, style, { tag: null })) 25920 })), { 25921 all 25922 }).style; 25923 this.module = modSpec ? new StyleModule(modSpec) : null; 25924 this.themeType = options2.themeType; 25925 } 25926 /** 25927 Create a highlighter style that associates the given styles to 25928 the given tags. The specs must be objects that hold a style tag 25929 or array of tags in their `tag` property, and either a single 25930 `class` property providing a static CSS class (for highlighter 25931 that rely on external styling), or a 25932 [`style-mod`](https://github.com/marijnh/style-mod#documentation)-style 25933 set of CSS properties (which define the styling for those tags). 25934 25935 The CSS rules created for a highlighter will be emitted in the 25936 order of the spec's properties. That means that for elements that 25937 have multiple tags associated with them, styles defined further 25938 down in the list will have a higher CSS precedence than styles 25939 defined earlier. 25940 */ 25941 static define(specs, options2) { 25942 return new _HighlightStyle(specs, options2 || {}); 25943 } 25944}; 25945var highlighterFacet = /* @__PURE__ */ Facet.define(); 25946var fallbackHighlighter = /* @__PURE__ */ Facet.define({ 25947 combine(values2) { 25948 return values2.length ? [values2[0]] : null; 25949 } 25950}); 25951function getHighlighters(state) { 25952 let main = state.facet(highlighterFacet); 25953 return main.length ? main : state.facet(fallbackHighlighter); 25954} 25955function syntaxHighlighting(highlighter, options2) { 25956 let ext = [treeHighlighter], themeType; 25957 if (highlighter instanceof HighlightStyle) { 25958 if (highlighter.module) 25959 ext.push(EditorView.styleModule.of(highlighter.module)); 25960 themeType = highlighter.themeType; 25961 } 25962 if (options2 === null || options2 === void 0 ? void 0 : options2.fallback) 25963 ext.push(fallbackHighlighter.of(highlighter)); 25964 else if (themeType) 25965 ext.push(highlighterFacet.computeN([EditorView.darkTheme], (state) => { 25966 return state.facet(EditorView.darkTheme) == (themeType == "dark") ? [highlighter] : []; 25967 })); 25968 else 25969 ext.push(highlighterFacet.of(highlighter)); 25970 return ext; 25971} 25972var TreeHighlighter = class { 25973 constructor(view) { 25974 this.markCache = /* @__PURE__ */ Object.create(null); 25975 this.tree = syntaxTree(view.state); 25976 this.decorations = this.buildDeco(view, getHighlighters(view.state)); 25977 } 25978 update(update) { 25979 let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state); 25980 let styleChange = highlighters != getHighlighters(update.startState); 25981 if (tree.length < update.view.viewport.to && !styleChange && tree.type == this.tree.type) { 25982 this.decorations = this.decorations.map(update.changes); 25983 } else if (tree != this.tree || update.viewportChanged || styleChange) { 25984 this.tree = tree; 25985 this.decorations = this.buildDeco(update.view, highlighters); 25986 } 25987 } 25988 buildDeco(view, highlighters) { 25989 if (!highlighters || !this.tree.length) 25990 return Decoration.none; 25991 let builder = new RangeSetBuilder(); 25992 for (let { from, to } of view.visibleRanges) { 25993 highlightTree(this.tree, highlighters, (from2, to2, style) => { 25994 builder.add(from2, to2, this.markCache[style] || (this.markCache[style] = Decoration.mark({ class: style }))); 25995 }, from, to); 25996 } 25997 return builder.finish(); 25998 } 25999}; 26000var treeHighlighter = /* @__PURE__ */ Prec.high(/* @__PURE__ */ ViewPlugin.fromClass(TreeHighlighter, { 26001 decorations: (v2) => v2.decorations 26002})); 26003var defaultHighlightStyle = /* @__PURE__ */ HighlightStyle.define([ 26004 { 26005 tag: tags.meta, 26006 color: "#404740" 26007 }, 26008 { 26009 tag: tags.link, 26010 textDecoration: "underline" 26011 }, 26012 { 26013 tag: tags.heading, 26014 textDecoration: "underline", 26015 fontWeight: "bold" 26016 }, 26017 { 26018 tag: tags.emphasis, 26019 fontStyle: "italic" 26020 }, 26021 { 26022 tag: tags.strong, 26023 fontWeight: "bold" 26024 }, 26025 { 26026 tag: tags.strikethrough, 26027 textDecoration: "line-through" 26028 }, 26029 { 26030 tag: tags.keyword, 26031 color: "#708" 26032 }, 26033 { 26034 tag: [tags.atom, tags.bool, tags.url, tags.contentSeparator, tags.labelName], 26035 color: "#219" 26036 }, 26037 { 26038 tag: [tags.literal, tags.inserted], 26039 color: "#164" 26040 }, 26041 { 26042 tag: [tags.string, tags.deleted], 26043 color: "#a11" 26044 }, 26045 { 26046 tag: [tags.regexp, tags.escape, /* @__PURE__ */ tags.special(tags.string)], 26047 color: "#e40" 26048 }, 26049 { 26050 tag: /* @__PURE__ */ tags.definition(tags.variableName), 26051 color: "#00f" 26052 }, 26053 { 26054 tag: /* @__PURE__ */ tags.local(tags.variableName), 26055 color: "#30a" 26056 }, 26057 { 26058 tag: [tags.typeName, tags.namespace], 26059 color: "#085" 26060 }, 26061 { 26062 tag: tags.className, 26063 color: "#167" 26064 }, 26065 { 26066 tag: [/* @__PURE__ */ tags.special(tags.variableName), tags.macroName], 26067 color: "#256" 26068 }, 26069 { 26070 tag: /* @__PURE__ */ tags.definition(tags.propertyName), 26071 color: "#00c" 26072 }, 26073 { 26074 tag: tags.comment, 26075 color: "#940" 26076 }, 26077 { 26078 tag: tags.invalid, 26079 color: "#f00" 26080 } 26081]); 26082var baseTheme2 = /* @__PURE__ */ EditorView.baseTheme({ 26083 "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" }, 26084 "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" } 26085}); 26086var DefaultScanDist = 1e4; 26087var DefaultBrackets = "()[]{}"; 26088var bracketMatchingConfig = /* @__PURE__ */ Facet.define({ 26089 combine(configs) { 26090 return combineConfig(configs, { 26091 afterCursor: true, 26092 brackets: DefaultBrackets, 26093 maxScanDistance: DefaultScanDist, 26094 renderMatch: defaultRenderMatch 26095 }); 26096 } 26097}); 26098var matchingMark = /* @__PURE__ */ Decoration.mark({ class: "cm-matchingBracket" }); 26099var nonmatchingMark = /* @__PURE__ */ Decoration.mark({ class: "cm-nonmatchingBracket" }); 26100function defaultRenderMatch(match) { 26101 let decorations2 = []; 26102 let mark = match.matched ? matchingMark : nonmatchingMark; 26103 decorations2.push(mark.range(match.start.from, match.start.to)); 26104 if (match.end) 26105 decorations2.push(mark.range(match.end.from, match.end.to)); 26106 return decorations2; 26107} 26108var bracketMatchingState = /* @__PURE__ */ StateField.define({ 26109 create() { 26110 return Decoration.none; 26111 }, 26112 update(deco, tr) { 26113 if (!tr.docChanged && !tr.selection) 26114 return deco; 26115 let decorations2 = []; 26116 let config2 = tr.state.facet(bracketMatchingConfig); 26117 for (let range of tr.state.selection.ranges) { 26118 if (!range.empty) 26119 continue; 26120 let match = matchBrackets(tr.state, range.head, -1, config2) || range.head > 0 && matchBrackets(tr.state, range.head - 1, 1, config2) || config2.afterCursor && (matchBrackets(tr.state, range.head, 1, config2) || range.head < tr.state.doc.length && matchBrackets(tr.state, range.head + 1, -1, config2)); 26121 if (match) 26122 decorations2 = decorations2.concat(config2.renderMatch(match, tr.state)); 26123 } 26124 return Decoration.set(decorations2, true); 26125 }, 26126 provide: (f3) => EditorView.decorations.from(f3) 26127}); 26128var bracketMatchingUnique = [ 26129 bracketMatchingState, 26130 baseTheme2 26131]; 26132function bracketMatching(config2 = {}) { 26133 return [bracketMatchingConfig.of(config2), bracketMatchingUnique]; 26134} 26135var bracketMatchingHandle = /* @__PURE__ */ new NodeProp(); 26136function matchingNodes(node, dir, brackets) { 26137 let byProp = node.prop(dir < 0 ? NodeProp.openedBy : NodeProp.closedBy); 26138 if (byProp) 26139 return byProp; 26140 if (node.name.length == 1) { 26141 let index = brackets.indexOf(node.name); 26142 if (index > -1 && index % 2 == (dir < 0 ? 1 : 0)) 26143 return [brackets[index + dir]]; 26144 } 26145 return null; 26146} 26147function findHandle(node) { 26148 let hasHandle = node.type.prop(bracketMatchingHandle); 26149 return hasHandle ? hasHandle(node.node) : node; 26150} 26151function matchBrackets(state, pos, dir, config2 = {}) { 26152 let maxScanDistance = config2.maxScanDistance || DefaultScanDist, brackets = config2.brackets || DefaultBrackets; 26153 let tree = syntaxTree(state), node = tree.resolveInner(pos, dir); 26154 for (let cur2 = node; cur2; cur2 = cur2.parent) { 26155 let matches = matchingNodes(cur2.type, dir, brackets); 26156 if (matches && cur2.from < cur2.to) { 26157 let handle = findHandle(cur2); 26158 if (handle && (dir > 0 ? pos >= handle.from && pos < handle.to : pos > handle.from && pos <= handle.to)) 26159 return matchMarkedBrackets(state, pos, dir, cur2, handle, matches, brackets); 26160 } 26161 } 26162 return matchPlainBrackets(state, pos, dir, tree, node.type, maxScanDistance, brackets); 26163} 26164function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, brackets) { 26165 let parent = token.parent, firstToken = { from: handle.from, to: handle.to }; 26166 let depth = 0, cursor = parent === null || parent === void 0 ? void 0 : parent.cursor(); 26167 if (cursor && (dir < 0 ? cursor.childBefore(token.from) : cursor.childAfter(token.to))) 26168 do { 26169 if (dir < 0 ? cursor.to <= token.from : cursor.from >= token.to) { 26170 if (depth == 0 && matching.indexOf(cursor.type.name) > -1 && cursor.from < cursor.to) { 26171 let endHandle = findHandle(cursor); 26172 return { start: firstToken, end: endHandle ? { from: endHandle.from, to: endHandle.to } : void 0, matched: true }; 26173 } else if (matchingNodes(cursor.type, dir, brackets)) { 26174 depth++; 26175 } else if (matchingNodes(cursor.type, -dir, brackets)) { 26176 if (depth == 0) { 26177 let endHandle = findHandle(cursor); 26178 return { 26179 start: firstToken, 26180 end: endHandle && endHandle.from < endHandle.to ? { from: endHandle.from, to: endHandle.to } : void 0, 26181 matched: false 26182 }; 26183 } 26184 depth--; 26185 } 26186 } 26187 } while (dir < 0 ? cursor.prevSibling() : cursor.nextSibling()); 26188 return { start: firstToken, matched: false }; 26189} 26190function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, brackets) { 26191 let startCh = dir < 0 ? state.sliceDoc(pos - 1, pos) : state.sliceDoc(pos, pos + 1); 26192 let bracket2 = brackets.indexOf(startCh); 26193 if (bracket2 < 0 || bracket2 % 2 == 0 != dir > 0) 26194 return null; 26195 let startToken = { from: dir < 0 ? pos - 1 : pos, to: dir > 0 ? pos + 1 : pos }; 26196 let iter = state.doc.iterRange(pos, dir > 0 ? state.doc.length : 0), depth = 0; 26197 for (let distance = 0; !iter.next().done && distance <= maxScanDistance; ) { 26198 let text = iter.value; 26199 if (dir < 0) 26200 distance += text.length; 26201 let basePos = pos + distance * dir; 26202 for (let pos2 = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos2 != end; pos2 += dir) { 26203 let found = brackets.indexOf(text[pos2]); 26204 if (found < 0 || tree.resolveInner(basePos + pos2, 1).type != tokenType) 26205 continue; 26206 if (found % 2 == 0 == dir > 0) { 26207 depth++; 26208 } else if (depth == 1) { 26209 return { start: startToken, end: { from: basePos + pos2, to: basePos + pos2 + 1 }, matched: found >> 1 == bracket2 >> 1 }; 26210 } else { 26211 depth--; 26212 } 26213 } 26214 if (dir > 0) 26215 distance += text.length; 26216 } 26217 return iter.done ? { start: startToken, matched: false } : null; 26218} 26219function countCol(string2, end, tabSize, startIndex = 0, startValue = 0) { 26220 if (end == null) { 26221 end = string2.search(/[^\s\u00a0]/); 26222 if (end == -1) 26223 end = string2.length; 26224 } 26225 let n3 = startValue; 26226 for (let i2 = startIndex; i2 < end; i2++) { 26227 if (string2.charCodeAt(i2) == 9) 26228 n3 += tabSize - n3 % tabSize; 26229 else 26230 n3++; 26231 } 26232 return n3; 26233} 26234var StringStream = class { 26235 /** 26236 Create a stream. 26237 */ 26238 constructor(string2, tabSize, indentUnit2, overrideIndent) { 26239 this.string = string2; 26240 this.tabSize = tabSize; 26241 this.indentUnit = indentUnit2; 26242 this.overrideIndent = overrideIndent; 26243 this.pos = 0; 26244 this.start = 0; 26245 this.lastColumnPos = 0; 26246 this.lastColumnValue = 0; 26247 } 26248 /** 26249 True if we are at the end of the line. 26250 */ 26251 eol() { 26252 return this.pos >= this.string.length; 26253 } 26254 /** 26255 True if we are at the start of the line. 26256 */ 26257 sol() { 26258 return this.pos == 0; 26259 } 26260 /** 26261 Get the next code unit after the current position, or undefined 26262 if we're at the end of the line. 26263 */ 26264 peek() { 26265 return this.string.charAt(this.pos) || void 0; 26266 } 26267 /** 26268 Read the next code unit and advance `this.pos`. 26269 */ 26270 next() { 26271 if (this.pos < this.string.length) 26272 return this.string.charAt(this.pos++); 26273 } 26274 /** 26275 Match the next character against the given string, regular 26276 expression, or predicate. Consume and return it if it matches. 26277 */ 26278 eat(match) { 26279 let ch = this.string.charAt(this.pos); 26280 let ok; 26281 if (typeof match == "string") 26282 ok = ch == match; 26283 else 26284 ok = ch && (match instanceof RegExp ? match.test(ch) : match(ch)); 26285 if (ok) { 26286 ++this.pos; 26287 return ch; 26288 } 26289 } 26290 /** 26291 Continue matching characters that match the given string, 26292 regular expression, or predicate function. Return true if any 26293 characters were consumed. 26294 */ 26295 eatWhile(match) { 26296 let start = this.pos; 26297 while (this.eat(match)) { 26298 } 26299 return this.pos > start; 26300 } 26301 /** 26302 Consume whitespace ahead of `this.pos`. Return true if any was 26303 found. 26304 */ 26305 eatSpace() { 26306 let start = this.pos; 26307 while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) 26308 ++this.pos; 26309 return this.pos > start; 26310 } 26311 /** 26312 Move to the end of the line. 26313 */ 26314 skipToEnd() { 26315 this.pos = this.string.length; 26316 } 26317 /** 26318 Move to directly before the given character, if found on the 26319 current line. 26320 */ 26321 skipTo(ch) { 26322 let found = this.string.indexOf(ch, this.pos); 26323 if (found > -1) { 26324 this.pos = found; 26325 return true; 26326 } 26327 } 26328 /** 26329 Move back `n` characters. 26330 */ 26331 backUp(n3) { 26332 this.pos -= n3; 26333 } 26334 /** 26335 Get the column position at `this.pos`. 26336 */ 26337 column() { 26338 if (this.lastColumnPos < this.start) { 26339 this.lastColumnValue = countCol(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); 26340 this.lastColumnPos = this.start; 26341 } 26342 return this.lastColumnValue; 26343 } 26344 /** 26345 Get the indentation column of the current line. 26346 */ 26347 indentation() { 26348 var _a3; 26349 return (_a3 = this.overrideIndent) !== null && _a3 !== void 0 ? _a3 : countCol(this.string, null, this.tabSize); 26350 } 26351 /** 26352 Match the input against the given string or regular expression 26353 (which should start with a `^`). Return true or the regexp match 26354 if it matches. 26355 26356 Unless `consume` is set to `false`, this will move `this.pos` 26357 past the matched text. 26358 26359 When matching a string `caseInsensitive` can be set to true to 26360 make the match case-insensitive. 26361 */ 26362 match(pattern, consume, caseInsensitive) { 26363 if (typeof pattern == "string") { 26364 let cased = (str) => caseInsensitive ? str.toLowerCase() : str; 26365 let substr = this.string.substr(this.pos, pattern.length); 26366 if (cased(substr) == cased(pattern)) { 26367 if (consume !== false) 26368 this.pos += pattern.length; 26369 return true; 26370 } else 26371 return null; 26372 } else { 26373 let match = this.string.slice(this.pos).match(pattern); 26374 if (match && match.index > 0) 26375 return null; 26376 if (match && consume !== false) 26377 this.pos += match[0].length; 26378 return match; 26379 } 26380 } 26381 /** 26382 Get the current token. 26383 */ 26384 current() { 26385 return this.string.slice(this.start, this.pos); 26386 } 26387}; 26388function fullParser(spec) { 26389 return { 26390 name: spec.name || "", 26391 token: spec.token, 26392 blankLine: spec.blankLine || (() => { 26393 }), 26394 startState: spec.startState || (() => true), 26395 copyState: spec.copyState || defaultCopyState, 26396 indent: spec.indent || (() => null), 26397 languageData: spec.languageData || {}, 26398 tokenTable: spec.tokenTable || noTokens 26399 }; 26400} 26401function defaultCopyState(state) { 26402 if (typeof state != "object") 26403 return state; 26404 let newState = {}; 26405 for (let prop in state) { 26406 let val = state[prop]; 26407 newState[prop] = val instanceof Array ? val.slice() : val; 26408 } 26409 return newState; 26410} 26411var IndentedFrom = /* @__PURE__ */ new WeakMap(); 26412var StreamLanguage = class _StreamLanguage extends Language { 26413 constructor(parser10) { 26414 let data = defineLanguageFacet(parser10.languageData); 26415 let p2 = fullParser(parser10), self2; 26416 let impl = new class extends Parser { 26417 createParse(input, fragments, ranges) { 26418 return new Parse(self2, input, fragments, ranges); 26419 } 26420 }(); 26421 super(data, impl, [indentService.of((cx, pos) => this.getIndent(cx, pos))], parser10.name); 26422 this.topNode = docID(data); 26423 self2 = this; 26424 this.streamParser = p2; 26425 this.stateAfter = new NodeProp({ perNode: true }); 26426 this.tokenTable = parser10.tokenTable ? new TokenTable(p2.tokenTable) : defaultTokenTable; 26427 } 26428 /** 26429 Define a stream language. 26430 */ 26431 static define(spec) { 26432 return new _StreamLanguage(spec); 26433 } 26434 getIndent(cx, pos) { 26435 let tree = syntaxTree(cx.state), at = tree.resolve(pos); 26436 while (at && at.type != this.topNode) 26437 at = at.parent; 26438 if (!at) 26439 return null; 26440 let from = void 0; 26441 let { overrideIndentation } = cx.options; 26442 if (overrideIndentation) { 26443 from = IndentedFrom.get(cx.state); 26444 if (from != null && from < pos - 1e4) 26445 from = void 0; 26446 } 26447 let start = findState(this, tree, 0, at.from, from !== null && from !== void 0 ? from : pos), statePos, state; 26448 if (start) { 26449 state = start.state; 26450 statePos = start.pos + 1; 26451 } else { 26452 state = this.streamParser.startState(cx.unit); 26453 statePos = 0; 26454 } 26455 if (pos - statePos > 1e4) 26456 return null; 26457 while (statePos < pos) { 26458 let line2 = cx.state.doc.lineAt(statePos), end = Math.min(pos, line2.to); 26459 if (line2.length) { 26460 let indentation4 = overrideIndentation ? overrideIndentation(line2.from) : -1; 26461 let stream = new StringStream(line2.text, cx.state.tabSize, cx.unit, indentation4 < 0 ? void 0 : indentation4); 26462 while (stream.pos < end - line2.from) 26463 readToken(this.streamParser.token, stream, state); 26464 } else { 26465 this.streamParser.blankLine(state, cx.unit); 26466 } 26467 if (end == pos) 26468 break; 26469 statePos = line2.to + 1; 26470 } 26471 let line = cx.lineAt(pos); 26472 if (overrideIndentation && from == null) 26473 IndentedFrom.set(cx.state, line.from); 26474 return this.streamParser.indent(state, /^\s*(.*)/.exec(line.text)[1], cx); 26475 } 26476 get allowsNesting() { 26477 return false; 26478 } 26479}; 26480function findState(lang, tree, off, startPos, before) { 26481 let state = off >= startPos && off + tree.length <= before && tree.prop(lang.stateAfter); 26482 if (state) 26483 return { state: lang.streamParser.copyState(state), pos: off + tree.length }; 26484 for (let i2 = tree.children.length - 1; i2 >= 0; i2--) { 26485 let child = tree.children[i2], pos = off + tree.positions[i2]; 26486 let found = child instanceof Tree && pos < before && findState(lang, child, pos, startPos, before); 26487 if (found) 26488 return found; 26489 } 26490 return null; 26491} 26492function cutTree(lang, tree, from, to, inside2) { 26493 if (inside2 && from <= 0 && to >= tree.length) 26494 return tree; 26495 if (!inside2 && tree.type == lang.topNode) 26496 inside2 = true; 26497 for (let i2 = tree.children.length - 1; i2 >= 0; i2--) { 26498 let pos = tree.positions[i2], child = tree.children[i2], inner; 26499 if (pos < to && child instanceof Tree) { 26500 if (!(inner = cutTree(lang, child, from - pos, to - pos, inside2))) 26501 break; 26502 return !inside2 ? inner : new Tree(tree.type, tree.children.slice(0, i2).concat(inner), tree.positions.slice(0, i2 + 1), pos + inner.length); 26503 } 26504 } 26505 return null; 26506} 26507function findStartInFragments(lang, fragments, startPos, editorState) { 26508 for (let f3 of fragments) { 26509 let from = f3.from + (f3.openStart ? 25 : 0), to = f3.to - (f3.openEnd ? 25 : 0); 26510 let found = from <= startPos && to > startPos && findState(lang, f3.tree, 0 - f3.offset, startPos, to), tree; 26511 if (found && (tree = cutTree(lang, f3.tree, startPos + f3.offset, found.pos + f3.offset, false))) 26512 return { state: found.state, tree }; 26513 } 26514 return { state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4), tree: Tree.empty }; 26515} 26516var Parse = class { 26517 constructor(lang, input, fragments, ranges) { 26518 this.lang = lang; 26519 this.input = input; 26520 this.fragments = fragments; 26521 this.ranges = ranges; 26522 this.stoppedAt = null; 26523 this.chunks = []; 26524 this.chunkPos = []; 26525 this.chunk = []; 26526 this.chunkReused = void 0; 26527 this.rangeIndex = 0; 26528 this.to = ranges[ranges.length - 1].to; 26529 let context = ParseContext.get(), from = ranges[0].from; 26530 let { state, tree } = findStartInFragments(lang, fragments, from, context === null || context === void 0 ? void 0 : context.state); 26531 this.state = state; 26532 this.parsedPos = this.chunkStart = from + tree.length; 26533 for (let i2 = 0; i2 < tree.children.length; i2++) { 26534 this.chunks.push(tree.children[i2]); 26535 this.chunkPos.push(tree.positions[i2]); 26536 } 26537 if (context && this.parsedPos < context.viewport.from - 1e5) { 26538 this.state = this.lang.streamParser.startState(getIndentUnit(context.state)); 26539 context.skipUntilInView(this.parsedPos, context.viewport.from); 26540 this.parsedPos = context.viewport.from; 26541 } 26542 this.moveRangeIndex(); 26543 } 26544 advance() { 26545 let context = ParseContext.get(); 26546 let parseEnd = this.stoppedAt == null ? this.to : Math.min(this.to, this.stoppedAt); 26547 let end = Math.min( 26548 parseEnd, 26549 this.chunkStart + 2048 26550 /* C.ChunkSize */ 26551 ); 26552 if (context) 26553 end = Math.min(end, context.viewport.to); 26554 while (this.parsedPos < end) 26555 this.parseLine(context); 26556 if (this.chunkStart < this.parsedPos) 26557 this.finishChunk(); 26558 if (this.parsedPos >= parseEnd) 26559 return this.finish(); 26560 if (context && this.parsedPos >= context.viewport.to) { 26561 context.skipUntilInView(this.parsedPos, parseEnd); 26562 return this.finish(); 26563 } 26564 return null; 26565 } 26566 stopAt(pos) { 26567 this.stoppedAt = pos; 26568 } 26569 lineAfter(pos) { 26570 let chunk = this.input.chunk(pos); 26571 if (!this.input.lineChunks) { 26572 let eol2 = chunk.indexOf("\n"); 26573 if (eol2 > -1) 26574 chunk = chunk.slice(0, eol2); 26575 } else if (chunk == "\n") { 26576 chunk = ""; 26577 } 26578 return pos + chunk.length <= this.to ? chunk : chunk.slice(0, this.to - pos); 26579 } 26580 nextLine() { 26581 let from = this.parsedPos, line = this.lineAfter(from), end = from + line.length; 26582 for (let index = this.rangeIndex; ; ) { 26583 let rangeEnd2 = this.ranges[index].to; 26584 if (rangeEnd2 >= end) 26585 break; 26586 line = line.slice(0, rangeEnd2 - (end - line.length)); 26587 index++; 26588 if (index == this.ranges.length) 26589 break; 26590 let rangeStart = this.ranges[index].from; 26591 let after = this.lineAfter(rangeStart); 26592 line += after; 26593 end = rangeStart + after.length; 26594 } 26595 return { line, end }; 26596 } 26597 skipGapsTo(pos, offset, side) { 26598 for (; ; ) { 26599 let end = this.ranges[this.rangeIndex].to, offPos = pos + offset; 26600 if (side > 0 ? end > offPos : end >= offPos) 26601 break; 26602 let start = this.ranges[++this.rangeIndex].from; 26603 offset += start - end; 26604 } 26605 return offset; 26606 } 26607 moveRangeIndex() { 26608 while (this.ranges[this.rangeIndex].to < this.parsedPos) 26609 this.rangeIndex++; 26610 } 26611 emitToken(id2, from, to, size, offset) { 26612 if (this.ranges.length > 1) { 26613 offset = this.skipGapsTo(from, offset, 1); 26614 from += offset; 26615 let len0 = this.chunk.length; 26616 offset = this.skipGapsTo(to, offset, -1); 26617 to += offset; 26618 size += this.chunk.length - len0; 26619 } 26620 this.chunk.push(id2, from, to, size); 26621 return offset; 26622 } 26623 parseLine(context) { 26624 let { line, end } = this.nextLine(), offset = 0, { streamParser } = this.lang; 26625 let stream = new StringStream(line, context ? context.state.tabSize : 4, context ? getIndentUnit(context.state) : 2); 26626 if (stream.eol()) { 26627 streamParser.blankLine(this.state, stream.indentUnit); 26628 } else { 26629 while (!stream.eol()) { 26630 let token = readToken(streamParser.token, stream, this.state); 26631 if (token) 26632 offset = this.emitToken(this.lang.tokenTable.resolve(token), this.parsedPos + stream.start, this.parsedPos + stream.pos, 4, offset); 26633 if (stream.start > 1e4) 26634 break; 26635 } 26636 } 26637 this.parsedPos = end; 26638 this.moveRangeIndex(); 26639 if (this.parsedPos < this.to) 26640 this.parsedPos++; 26641 } 26642 finishChunk() { 26643 let tree = Tree.build({ 26644 buffer: this.chunk, 26645 start: this.chunkStart, 26646 length: this.parsedPos - this.chunkStart, 26647 nodeSet, 26648 topID: 0, 26649 maxBufferLength: 2048, 26650 reused: this.chunkReused 26651 }); 26652 tree = new Tree(tree.type, tree.children, tree.positions, tree.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]); 26653 this.chunks.push(tree); 26654 this.chunkPos.push(this.chunkStart - this.ranges[0].from); 26655 this.chunk = []; 26656 this.chunkReused = void 0; 26657 this.chunkStart = this.parsedPos; 26658 } 26659 finish() { 26660 return new Tree(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance(); 26661 } 26662}; 26663function readToken(token, stream, state) { 26664 stream.start = stream.pos; 26665 for (let i2 = 0; i2 < 10; i2++) { 26666 let result = token(stream, state); 26667 if (stream.pos > stream.start) 26668 return result; 26669 } 26670 throw new Error("Stream parser failed to advance stream."); 26671} 26672var noTokens = /* @__PURE__ */ Object.create(null); 26673var typeArray = [NodeType.none]; 26674var nodeSet = /* @__PURE__ */ new NodeSet(typeArray); 26675var warned = []; 26676var byTag = /* @__PURE__ */ Object.create(null); 26677var defaultTable = /* @__PURE__ */ Object.create(null); 26678for (let [legacyName, name2] of [ 26679 ["variable", "variableName"], 26680 ["variable-2", "variableName.special"], 26681 ["string-2", "string.special"], 26682 ["def", "variableName.definition"], 26683 ["tag", "tagName"], 26684 ["attribute", "attributeName"], 26685 ["type", "typeName"], 26686 ["builtin", "variableName.standard"], 26687 ["qualifier", "modifier"], 26688 ["error", "invalid"], 26689 ["header", "heading"], 26690 ["property", "propertyName"] 26691]) 26692 defaultTable[legacyName] = /* @__PURE__ */ createTokenType(noTokens, name2); 26693var TokenTable = class { 26694 constructor(extra) { 26695 this.extra = extra; 26696 this.table = Object.assign(/* @__PURE__ */ Object.create(null), defaultTable); 26697 } 26698 resolve(tag) { 26699 return !tag ? 0 : this.table[tag] || (this.table[tag] = createTokenType(this.extra, tag)); 26700 } 26701}; 26702var defaultTokenTable = /* @__PURE__ */ new TokenTable(noTokens); 26703function warnForPart(part, msg) { 26704 if (warned.indexOf(part) > -1) 26705 return; 26706 warned.push(part); 26707 console.warn(msg); 26708} 26709function createTokenType(extra, tagStr) { 26710 let tags$1 = []; 26711 for (let name3 of tagStr.split(" ")) { 26712 let found = []; 26713 for (let part of name3.split(".")) { 26714 let value = extra[part] || tags[part]; 26715 if (!value) { 26716 warnForPart(part, `Unknown highlighting tag ${part}`); 26717 } else if (typeof value == "function") { 26718 if (!found.length) 26719 warnForPart(part, `Modifier ${part} used at start of tag`); 26720 else 26721 found = found.map(value); 26722 } else { 26723 if (found.length) 26724 warnForPart(part, `Tag ${part} used as modifier`); 26725 else 26726 found = Array.isArray(value) ? value : [value]; 26727 } 26728 } 26729 for (let tag of found) 26730 tags$1.push(tag); 26731 } 26732 if (!tags$1.length) 26733 return 0; 26734 let name2 = tagStr.replace(/ /g, "_"), key = name2 + " " + tags$1.map((t3) => t3.id); 26735 let known = byTag[key]; 26736 if (known) 26737 return known.id; 26738 let type = byTag[key] = NodeType.define({ 26739 id: typeArray.length, 26740 name: name2, 26741 props: [styleTags({ [name2]: tags$1 })] 26742 }); 26743 typeArray.push(type); 26744 return type.id; 26745} 26746function docID(data) { 26747 let type = NodeType.define({ id: typeArray.length, name: "Document", props: [languageDataProp.add(() => data)], top: true }); 26748 typeArray.push(type); 26749 return type; 26750} 26751
vendor: 62,649 bytes, lines 26752-28450
26752// node_modules/@codemirror/autocomplete/dist/index.js 26753var CompletionContext = class { 26754 /** 26755 Create a new completion context. (Mostly useful for testing 26756 completion sources—in the editor, the extension will create 26757 these for you.) 26758 */ 26759 constructor(state, pos, explicit) { 26760 this.state = state; 26761 this.pos = pos; 26762 this.explicit = explicit; 26763 this.abortListeners = []; 26764 } 26765 /** 26766 Get the extent, content, and (if there is a token) type of the 26767 token before `this.pos`. 26768 */ 26769 tokenBefore(types2) { 26770 let token = syntaxTree(this.state).resolveInner(this.pos, -1); 26771 while (token && types2.indexOf(token.name) < 0) 26772 token = token.parent; 26773 return token ? { 26774 from: token.from, 26775 to: this.pos, 26776 text: this.state.sliceDoc(token.from, this.pos), 26777 type: token.type 26778 } : null; 26779 } 26780 /** 26781 Get the match of the given expression directly before the 26782 cursor. 26783 */ 26784 matchBefore(expr) { 26785 let line = this.state.doc.lineAt(this.pos); 26786 let start = Math.max(line.from, this.pos - 250); 26787 let str = line.text.slice(start - line.from, this.pos - line.from); 26788 let found = str.search(ensureAnchor(expr, false)); 26789 return found < 0 ? null : { from: start + found, to: this.pos, text: str.slice(found) }; 26790 } 26791 /** 26792 Yields true when the query has been aborted. Can be useful in 26793 asynchronous queries to avoid doing work that will be ignored. 26794 */ 26795 get aborted() { 26796 return this.abortListeners == null; 26797 } 26798 /** 26799 Allows you to register abort handlers, which will be called when 26800 the query is 26801 [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted). 26802 */ 26803 addEventListener(type, listener) { 26804 if (type == "abort" && this.abortListeners) 26805 this.abortListeners.push(listener); 26806 } 26807}; 26808function toSet(chars) { 26809 let flat = Object.keys(chars).join(""); 26810 let words = /\w/.test(flat); 26811 if (words) 26812 flat = flat.replace(/\w/g, ""); 26813 return `[${words ? "\\w" : ""}${flat.replace(/[^\w\s]/g, "\\$&")}]`; 26814} 26815function prefixMatch(options2) { 26816 let first = /* @__PURE__ */ Object.create(null), rest = /* @__PURE__ */ Object.create(null); 26817 for (let { label } of options2) { 26818 first[label[0]] = true; 26819 for (let i2 = 1; i2 < label.length; i2++) 26820 rest[label[i2]] = true; 26821 } 26822 let source = toSet(first) + toSet(rest) + "*$"; 26823 return [new RegExp("^" + source), new RegExp(source)]; 26824} 26825function completeFromList(list) { 26826 let options2 = list.map((o2) => typeof o2 == "string" ? { label: o2 } : o2); 26827 let [validFor, match] = options2.every((o2) => /^\w+$/.test(o2.label)) ? [/\w*$/, /\w+$/] : prefixMatch(options2); 26828 return (context) => { 26829 let token = context.matchBefore(match); 26830 return token || context.explicit ? { from: token ? token.from : context.pos, options: options2, validFor } : null; 26831 }; 26832} 26833function ifNotIn(nodes, source) { 26834 return (context) => { 26835 for (let pos = syntaxTree(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) { 26836 if (nodes.indexOf(pos.name) > -1) 26837 return null; 26838 if (pos.type.isTop) 26839 break; 26840 } 26841 return source(context); 26842 }; 26843} 26844var Option = class { 26845 constructor(completion, source, match, score2) { 26846 this.completion = completion; 26847 this.source = source; 26848 this.match = match; 26849 this.score = score2; 26850 } 26851}; 26852function cur(state) { 26853 return state.selection.main.from; 26854} 26855function ensureAnchor(expr, start) { 26856 var _a3; 26857 let { source } = expr; 26858 let addStart = start && source[0] != "^", addEnd = source[source.length - 1] != "$"; 26859 if (!addStart && !addEnd) 26860 return expr; 26861 return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a3 = expr.flags) !== null && _a3 !== void 0 ? _a3 : expr.ignoreCase ? "i" : ""); 26862} 26863var pickedCompletion = /* @__PURE__ */ Annotation.define(); 26864function insertCompletionText(state, text, from, to) { 26865 let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from; 26866 return Object.assign(Object.assign({}, state.changeByRange((range) => { 26867 if (range != main && from != to && state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to)) 26868 return { range }; 26869 return { 26870 changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: text }, 26871 range: EditorSelection.cursor(range.from + fromOff + text.length) 26872 }; 26873 })), { scrollIntoView: true, userEvent: "input.complete" }); 26874} 26875var SourceCache = /* @__PURE__ */ new WeakMap(); 26876function asSource(source) { 26877 if (!Array.isArray(source)) 26878 return source; 26879 let known = SourceCache.get(source); 26880 if (!known) 26881 SourceCache.set(source, known = completeFromList(source)); 26882 return known; 26883} 26884var startCompletionEffect = /* @__PURE__ */ StateEffect.define(); 26885var closeCompletionEffect = /* @__PURE__ */ StateEffect.define(); 26886var FuzzyMatcher = class { 26887 constructor(pattern) { 26888 this.pattern = pattern; 26889 this.chars = []; 26890 this.folded = []; 26891 this.any = []; 26892 this.precise = []; 26893 this.byWord = []; 26894 this.score = 0; 26895 this.matched = []; 26896 for (let p2 = 0; p2 < pattern.length; ) { 26897 let char = codePointAt(pattern, p2), size = codePointSize(char); 26898 this.chars.push(char); 26899 let part = pattern.slice(p2, p2 + size), upper = part.toUpperCase(); 26900 this.folded.push(codePointAt(upper == part ? part.toLowerCase() : upper, 0)); 26901 p2 += size; 26902 } 26903 this.astral = pattern.length != this.chars.length; 26904 } 26905 ret(score2, matched) { 26906 this.score = score2; 26907 this.matched = matched; 26908 return true; 26909 } 26910 // Matches a given word (completion) against the pattern (input). 26911 // Will return a boolean indicating whether there was a match and, 26912 // on success, set `this.score` to the score, `this.matched` to an 26913 // array of `from, to` pairs indicating the matched parts of `word`. 26914 // 26915 // The score is a number that is more negative the worse the match 26916 // is. See `Penalty` above. 26917 match(word) { 26918 if (this.pattern.length == 0) 26919 return this.ret(-100, []); 26920 if (word.length < this.pattern.length) 26921 return false; 26922 let { chars, folded, any, precise, byWord } = this; 26923 if (chars.length == 1) { 26924 let first = codePointAt(word, 0), firstSize = codePointSize(first); 26925 let score2 = firstSize == word.length ? 0 : -100; 26926 if (first == chars[0]) 26927 ; 26928 else if (first == folded[0]) 26929 score2 += -200; 26930 else 26931 return false; 26932 return this.ret(score2, [0, firstSize]); 26933 } 26934 let direct = word.indexOf(this.pattern); 26935 if (direct == 0) 26936 return this.ret(word.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]); 26937 let len = chars.length, anyTo = 0; 26938 if (direct < 0) { 26939 for (let i2 = 0, e2 = Math.min(word.length, 200); i2 < e2 && anyTo < len; ) { 26940 let next = codePointAt(word, i2); 26941 if (next == chars[anyTo] || next == folded[anyTo]) 26942 any[anyTo++] = i2; 26943 i2 += codePointSize(next); 26944 } 26945 if (anyTo < len) 26946 return false; 26947 } 26948 let preciseTo = 0; 26949 let byWordTo = 0, byWordFolded = false; 26950 let adjacentTo = 0, adjacentStart = -1, adjacentEnd = -1; 26951 let hasLower = /[a-z]/.test(word), wordAdjacent = true; 26952 for (let i2 = 0, e2 = Math.min(word.length, 200), prevType = 0; i2 < e2 && byWordTo < len; ) { 26953 let next = codePointAt(word, i2); 26954 if (direct < 0) { 26955 if (preciseTo < len && next == chars[preciseTo]) 26956 precise[preciseTo++] = i2; 26957 if (adjacentTo < len) { 26958 if (next == chars[adjacentTo] || next == folded[adjacentTo]) { 26959 if (adjacentTo == 0) 26960 adjacentStart = i2; 26961 adjacentEnd = i2 + 1; 26962 adjacentTo++; 26963 } else { 26964 adjacentTo = 0; 26965 } 26966 } 26967 } 26968 let ch, type = next < 255 ? next >= 48 && next <= 57 || next >= 97 && next <= 122 ? 2 : next >= 65 && next <= 90 ? 1 : 0 : (ch = fromCodePoint(next)) != ch.toLowerCase() ? 1 : ch != ch.toUpperCase() ? 2 : 0; 26969 if (!i2 || type == 1 && hasLower || prevType == 0 && type != 0) { 26970 if (chars[byWordTo] == next || folded[byWordTo] == next && (byWordFolded = true)) 26971 byWord[byWordTo++] = i2; 26972 else if (byWord.length) 26973 wordAdjacent = false; 26974 } 26975 prevType = type; 26976 i2 += codePointSize(next); 26977 } 26978 if (byWordTo == len && byWord[0] == 0 && wordAdjacent) 26979 return this.result(-100 + (byWordFolded ? -200 : 0), byWord, word); 26980 if (adjacentTo == len && adjacentStart == 0) 26981 return this.ret(-200 - word.length + (adjacentEnd == word.length ? 0 : -100), [0, adjacentEnd]); 26982 if (direct > -1) 26983 return this.ret(-700 - word.length, [direct, direct + this.pattern.length]); 26984 if (adjacentTo == len) 26985 return this.ret(-200 + -700 - word.length, [adjacentStart, adjacentEnd]); 26986 if (byWordTo == len) 26987 return this.result(-100 + (byWordFolded ? -200 : 0) + -700 + (wordAdjacent ? 0 : -1100), byWord, word); 26988 return chars.length == 2 ? false : this.result((any[0] ? -700 : 0) + -200 + -1100, any, word); 26989 } 26990 result(score2, positions, word) { 26991 let result = [], i2 = 0; 26992 for (let pos of positions) { 26993 let to = pos + (this.astral ? codePointSize(codePointAt(word, pos)) : 1); 26994 if (i2 && result[i2 - 1] == pos) 26995 result[i2 - 1] = to; 26996 else { 26997 result[i2++] = pos; 26998 result[i2++] = to; 26999 } 27000 } 27001 return this.ret(score2 - word.length, result); 27002 } 27003}; 27004var completionConfig = /* @__PURE__ */ Facet.define({ 27005 combine(configs) { 27006 return combineConfig(configs, { 27007 activateOnTyping: true, 27008 selectOnOpen: true, 27009 override: null, 27010 closeOnBlur: true, 27011 maxRenderedOptions: 100, 27012 defaultKeymap: true, 27013 tooltipClass: () => "", 27014 optionClass: () => "", 27015 aboveCursor: false, 27016 icons: true, 27017 addToOptions: [], 27018 positionInfo: defaultPositionInfo, 27019 compareCompletions: (a2, b3) => a2.label.localeCompare(b3.label), 27020 interactionDelay: 75, 27021 updateSyncTime: 100 27022 }, { 27023 defaultKeymap: (a2, b3) => a2 && b3, 27024 closeOnBlur: (a2, b3) => a2 && b3, 27025 icons: (a2, b3) => a2 && b3, 27026 tooltipClass: (a2, b3) => (c2) => joinClass(a2(c2), b3(c2)), 27027 optionClass: (a2, b3) => (c2) => joinClass(a2(c2), b3(c2)), 27028 addToOptions: (a2, b3) => a2.concat(b3) 27029 }); 27030 } 27031}); 27032function joinClass(a2, b3) { 27033 return a2 ? b3 ? a2 + " " + b3 : a2 : b3; 27034} 27035function defaultPositionInfo(view, list, option, info, space5, tooltip) { 27036 let rtl = view.textDirection == Direction.RTL, left = rtl, narrow = false; 27037 let side = "top", offset, maxWidth; 27038 let spaceLeft = list.left - space5.left, spaceRight = space5.right - list.right; 27039 let infoWidth = info.right - info.left, infoHeight = info.bottom - info.top; 27040 if (left && spaceLeft < Math.min(infoWidth, spaceRight)) 27041 left = false; 27042 else if (!left && spaceRight < Math.min(infoWidth, spaceLeft)) 27043 left = true; 27044 if (infoWidth <= (left ? spaceLeft : spaceRight)) { 27045 offset = Math.max(space5.top, Math.min(option.top, space5.bottom - infoHeight)) - list.top; 27046 maxWidth = Math.min(400, left ? spaceLeft : spaceRight); 27047 } else { 27048 narrow = true; 27049 maxWidth = Math.min( 27050 400, 27051 (rtl ? list.right : space5.right - list.left) - 30 27052 /* Info.Margin */ 27053 ); 27054 let spaceBelow = space5.bottom - list.bottom; 27055 if (spaceBelow >= infoHeight || spaceBelow > list.top) { 27056 offset = option.bottom - list.top; 27057 } else { 27058 side = "bottom"; 27059 offset = list.bottom - option.top; 27060 } 27061 } 27062 let scaleY = (list.bottom - list.top) / tooltip.offsetHeight; 27063 let scaleX = (list.right - list.left) / tooltip.offsetWidth; 27064 return { 27065 style: `${side}: ${offset / scaleY}px; max-width: ${maxWidth / scaleX}px`, 27066 class: "cm-completionInfo-" + (narrow ? rtl ? "left-narrow" : "right-narrow" : left ? "left" : "right") 27067 }; 27068} 27069function optionContent(config2) { 27070 let content2 = config2.addToOptions.slice(); 27071 if (config2.icons) 27072 content2.push({ 27073 render(completion) { 27074 let icon = document.createElement("div"); 27075 icon.classList.add("cm-completionIcon"); 27076 if (completion.type) 27077 icon.classList.add(...completion.type.split(/\s+/g).map((cls) => "cm-completionIcon-" + cls)); 27078 icon.setAttribute("aria-hidden", "true"); 27079 return icon; 27080 }, 27081 position: 20 27082 }); 27083 content2.push({ 27084 render(completion, _s, _v, match) { 27085 let labelElt = document.createElement("span"); 27086 labelElt.className = "cm-completionLabel"; 27087 let label = completion.displayLabel || completion.label, off = 0; 27088 for (let j3 = 0; j3 < match.length; ) { 27089 let from = match[j3++], to = match[j3++]; 27090 if (from > off) 27091 labelElt.appendChild(document.createTextNode(label.slice(off, from))); 27092 let span = labelElt.appendChild(document.createElement("span")); 27093 span.appendChild(document.createTextNode(label.slice(from, to))); 27094 span.className = "cm-completionMatchedText"; 27095 off = to; 27096 } 27097 if (off < label.length) 27098 labelElt.appendChild(document.createTextNode(label.slice(off))); 27099 return labelElt; 27100 }, 27101 position: 50 27102 }, { 27103 render(completion) { 27104 if (!completion.detail) 27105 return null; 27106 let detailElt = document.createElement("span"); 27107 detailElt.className = "cm-completionDetail"; 27108 detailElt.textContent = completion.detail; 27109 return detailElt; 27110 }, 27111 position: 80 27112 }); 27113 return content2.sort((a2, b3) => a2.position - b3.position).map((a2) => a2.render); 27114} 27115function rangeAroundSelected(total, selected, max) { 27116 if (total <= max) 27117 return { from: 0, to: total }; 27118 if (selected < 0) 27119 selected = 0; 27120 if (selected <= total >> 1) { 27121 let off2 = Math.floor(selected / max); 27122 return { from: off2 * max, to: (off2 + 1) * max }; 27123 } 27124 let off = Math.floor((total - selected) / max); 27125 return { from: total - (off + 1) * max, to: total - off * max }; 27126} 27127var CompletionTooltip = class { 27128 constructor(view, stateField, applyCompletion2) { 27129 this.view = view; 27130 this.stateField = stateField; 27131 this.applyCompletion = applyCompletion2; 27132 this.info = null; 27133 this.infoDestroy = null; 27134 this.placeInfoReq = { 27135 read: () => this.measureInfo(), 27136 write: (pos) => this.placeInfo(pos), 27137 key: this 27138 }; 27139 this.space = null; 27140 this.currentClass = ""; 27141 let cState = view.state.field(stateField); 27142 let { options: options2, selected } = cState.open; 27143 let config2 = view.state.facet(completionConfig); 27144 this.optionContent = optionContent(config2); 27145 this.optionClass = config2.optionClass; 27146 this.tooltipClass = config2.tooltipClass; 27147 this.range = rangeAroundSelected(options2.length, selected, config2.maxRenderedOptions); 27148 this.dom = document.createElement("div"); 27149 this.dom.className = "cm-tooltip-autocomplete"; 27150 this.updateTooltipClass(view.state); 27151 this.dom.addEventListener("mousedown", (e2) => { 27152 let { options: options3 } = view.state.field(stateField).open; 27153 for (let dom = e2.target, match; dom && dom != this.dom; dom = dom.parentNode) { 27154 if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options3.length) { 27155 this.applyCompletion(view, options3[+match[1]]); 27156 e2.preventDefault(); 27157 return; 27158 } 27159 } 27160 }); 27161 this.dom.addEventListener("focusout", (e2) => { 27162 let state = view.state.field(this.stateField, false); 27163 if (state && state.tooltip && view.state.facet(completionConfig).closeOnBlur && e2.relatedTarget != view.contentDOM) 27164 view.dispatch({ effects: closeCompletionEffect.of(null) }); 27165 }); 27166 this.showOptions(options2, cState.id); 27167 } 27168 mount() { 27169 this.updateSel(); 27170 } 27171 showOptions(options2, id2) { 27172 if (this.list) 27173 this.list.remove(); 27174 this.list = this.dom.appendChild(this.createListBox(options2, id2, this.range)); 27175 this.list.addEventListener("scroll", () => { 27176 if (this.info) 27177 this.view.requestMeasure(this.placeInfoReq); 27178 }); 27179 } 27180 update(update) { 27181 var _a3; 27182 let cState = update.state.field(this.stateField); 27183 let prevState = update.startState.field(this.stateField); 27184 this.updateTooltipClass(update.state); 27185 if (cState != prevState) { 27186 let { options: options2, selected, disabled } = cState.open; 27187 if (!prevState.open || prevState.open.options != options2) { 27188 this.range = rangeAroundSelected(options2.length, selected, update.state.facet(completionConfig).maxRenderedOptions); 27189 this.showOptions(options2, cState.id); 27190 } 27191 this.updateSel(); 27192 if (disabled != ((_a3 = prevState.open) === null || _a3 === void 0 ? void 0 : _a3.disabled)) 27193 this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!disabled); 27194 } 27195 } 27196 updateTooltipClass(state) { 27197 let cls = this.tooltipClass(state); 27198 if (cls != this.currentClass) { 27199 for (let c2 of this.currentClass.split(" ")) 27200 if (c2) 27201 this.dom.classList.remove(c2); 27202 for (let c2 of cls.split(" ")) 27203 if (c2) 27204 this.dom.classList.add(c2); 27205 this.currentClass = cls; 27206 } 27207 } 27208 positioned(space5) { 27209 this.space = space5; 27210 if (this.info) 27211 this.view.requestMeasure(this.placeInfoReq); 27212 } 27213 updateSel() { 27214 let cState = this.view.state.field(this.stateField), open = cState.open; 27215 if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) { 27216 this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions); 27217 this.showOptions(open.options, cState.id); 27218 } 27219 if (this.updateSelectedOption(open.selected)) { 27220 this.destroyInfo(); 27221 let { completion } = open.options[open.selected]; 27222 let { info } = completion; 27223 if (!info) 27224 return; 27225 let infoResult = typeof info === "string" ? document.createTextNode(info) : info(completion); 27226 if (!infoResult) 27227 return; 27228 if ("then" in infoResult) { 27229 infoResult.then((obj) => { 27230 if (obj && this.view.state.field(this.stateField, false) == cState) 27231 this.addInfoPane(obj, completion); 27232 }).catch((e2) => logException(this.view.state, e2, "completion info")); 27233 } else { 27234 this.addInfoPane(infoResult, completion); 27235 } 27236 } 27237 } 27238 addInfoPane(content2, completion) { 27239 this.destroyInfo(); 27240 let wrap = this.info = document.createElement("div"); 27241 wrap.className = "cm-tooltip cm-completionInfo"; 27242 if (content2.nodeType != null) { 27243 wrap.appendChild(content2); 27244 this.infoDestroy = null; 27245 } else { 27246 let { dom, destroy } = content2; 27247 wrap.appendChild(dom); 27248 this.infoDestroy = destroy || null; 27249 } 27250 this.dom.appendChild(wrap); 27251 this.view.requestMeasure(this.placeInfoReq); 27252 } 27253 updateSelectedOption(selected) { 27254 let set = null; 27255 for (let opt = this.list.firstChild, i2 = this.range.from; opt; opt = opt.nextSibling, i2++) { 27256 if (opt.nodeName != "LI" || !opt.id) { 27257 i2--; 27258 } else if (i2 == selected) { 27259 if (!opt.hasAttribute("aria-selected")) { 27260 opt.setAttribute("aria-selected", "true"); 27261 set = opt; 27262 } 27263 } else { 27264 if (opt.hasAttribute("aria-selected")) 27265 opt.removeAttribute("aria-selected"); 27266 } 27267 } 27268 if (set) 27269 scrollIntoView2(this.list, set); 27270 return set; 27271 } 27272 measureInfo() { 27273 let sel = this.dom.querySelector("[aria-selected]"); 27274 if (!sel || !this.info) 27275 return null; 27276 let listRect = this.dom.getBoundingClientRect(); 27277 let infoRect = this.info.getBoundingClientRect(); 27278 let selRect = sel.getBoundingClientRect(); 27279 let space5 = this.space; 27280 if (!space5) { 27281 let win = this.dom.ownerDocument.defaultView || window; 27282 space5 = { left: 0, top: 0, right: win.innerWidth, bottom: win.innerHeight }; 27283 } 27284 if (selRect.top > Math.min(space5.bottom, listRect.bottom) - 10 || selRect.bottom < Math.max(space5.top, listRect.top) + 10) 27285 return null; 27286 return this.view.state.facet(completionConfig).positionInfo(this.view, listRect, selRect, infoRect, space5, this.dom); 27287 } 27288 placeInfo(pos) { 27289 if (this.info) { 27290 if (pos) { 27291 if (pos.style) 27292 this.info.style.cssText = pos.style; 27293 this.info.className = "cm-tooltip cm-completionInfo " + (pos.class || ""); 27294 } else { 27295 this.info.style.cssText = "top: -1e6px"; 27296 } 27297 } 27298 } 27299 createListBox(options2, id2, range) { 27300 const ul = document.createElement("ul"); 27301 ul.id = id2; 27302 ul.setAttribute("role", "listbox"); 27303 ul.setAttribute("aria-expanded", "true"); 27304 ul.setAttribute("aria-label", this.view.state.phrase("Completions")); 27305 let curSection = null; 27306 for (let i2 = range.from; i2 < range.to; i2++) { 27307 let { completion, match } = options2[i2], { section } = completion; 27308 if (section) { 27309 let name2 = typeof section == "string" ? section : section.name; 27310 if (name2 != curSection && (i2 > range.from || range.from == 0)) { 27311 curSection = name2; 27312 if (typeof section != "string" && section.header) { 27313 ul.appendChild(section.header(section)); 27314 } else { 27315 let header = ul.appendChild(document.createElement("completion-section")); 27316 header.textContent = name2; 27317 } 27318 } 27319 } 27320 const li = ul.appendChild(document.createElement("li")); 27321 li.id = id2 + "-" + i2; 27322 li.setAttribute("role", "option"); 27323 let cls = this.optionClass(completion); 27324 if (cls) 27325 li.className = cls; 27326 for (let source of this.optionContent) { 27327 let node = source(completion, this.view.state, this.view, match); 27328 if (node) 27329 li.appendChild(node); 27330 } 27331 } 27332 if (range.from) 27333 ul.classList.add("cm-completionListIncompleteTop"); 27334 if (range.to < options2.length) 27335 ul.classList.add("cm-completionListIncompleteBottom"); 27336 return ul; 27337 } 27338 destroyInfo() { 27339 if (this.info) { 27340 if (this.infoDestroy) 27341 this.infoDestroy(); 27342 this.info.remove(); 27343 this.info = null; 27344 } 27345 } 27346 destroy() { 27347 this.destroyInfo(); 27348 } 27349}; 27350function completionTooltip(stateField, applyCompletion2) { 27351 return (view) => new CompletionTooltip(view, stateField, applyCompletion2); 27352} 27353function scrollIntoView2(container, element) { 27354 let parent = container.getBoundingClientRect(); 27355 let self2 = element.getBoundingClientRect(); 27356 let scaleY = parent.height / container.offsetHeight; 27357 if (self2.top < parent.top) 27358 container.scrollTop -= (parent.top - self2.top) / scaleY; 27359 else if (self2.bottom > parent.bottom) 27360 container.scrollTop += (self2.bottom - parent.bottom) / scaleY; 27361} 27362function score(option) { 27363 return (option.boost || 0) * 100 + (option.apply ? 10 : 0) + (option.info ? 5 : 0) + (option.type ? 1 : 0); 27364} 27365function sortOptions(active, state) { 27366 let options2 = []; 27367 let sections = null; 27368 let addOption = (option) => { 27369 options2.push(option); 27370 let { section } = option.completion; 27371 if (section) { 27372 if (!sections) 27373 sections = []; 27374 let name2 = typeof section == "string" ? section : section.name; 27375 if (!sections.some((s2) => s2.name == name2)) 27376 sections.push(typeof section == "string" ? { name: name2 } : section); 27377 } 27378 }; 27379 for (let a2 of active) 27380 if (a2.hasResult()) { 27381 let getMatch = a2.result.getMatch; 27382 if (a2.result.filter === false) { 27383 for (let option of a2.result.options) { 27384 addOption(new Option(option, a2.source, getMatch ? getMatch(option) : [], 1e9 - options2.length)); 27385 } 27386 } else { 27387 let matcher = new FuzzyMatcher(state.sliceDoc(a2.from, a2.to)); 27388 for (let option of a2.result.options) 27389 if (matcher.match(option.label)) { 27390 let matched = !option.displayLabel ? matcher.matched : getMatch ? getMatch(option, matcher.matched) : []; 27391 addOption(new Option(option, a2.source, matched, matcher.score + (option.boost || 0))); 27392 } 27393 } 27394 } 27395 if (sections) { 27396 let sectionOrder = /* @__PURE__ */ Object.create(null), pos = 0; 27397 let cmp = (a2, b3) => { 27398 var _a3, _b2; 27399 return ((_a3 = a2.rank) !== null && _a3 !== void 0 ? _a3 : 1e9) - ((_b2 = b3.rank) !== null && _b2 !== void 0 ? _b2 : 1e9) || (a2.name < b3.name ? -1 : 1); 27400 }; 27401 for (let s2 of sections.sort(cmp)) { 27402 pos -= 1e5; 27403 sectionOrder[s2.name] = pos; 27404 } 27405 for (let option of options2) { 27406 let { section } = option.completion; 27407 if (section) 27408 option.score += sectionOrder[typeof section == "string" ? section : section.name]; 27409 } 27410 } 27411 let result = [], prev = null; 27412 let compare2 = state.facet(completionConfig).compareCompletions; 27413 for (let opt of options2.sort((a2, b3) => b3.score - a2.score || compare2(a2.completion, b3.completion))) { 27414 let cur2 = opt.completion; 27415 if (!prev || prev.label != cur2.label || prev.detail != cur2.detail || prev.type != null && cur2.type != null && prev.type != cur2.type || prev.apply != cur2.apply || prev.boost != cur2.boost) 27416 result.push(opt); 27417 else if (score(opt.completion) > score(prev)) 27418 result[result.length - 1] = opt; 27419 prev = opt.completion; 27420 } 27421 return result; 27422} 27423var CompletionDialog = class _CompletionDialog { 27424 constructor(options2, attrs, tooltip, timestamp, selected, disabled) { 27425 this.options = options2; 27426 this.attrs = attrs; 27427 this.tooltip = tooltip; 27428 this.timestamp = timestamp; 27429 this.selected = selected; 27430 this.disabled = disabled; 27431 } 27432 setSelected(selected, id2) { 27433 return selected == this.selected || selected >= this.options.length ? this : new _CompletionDialog(this.options, makeAttrs(id2, selected), this.tooltip, this.timestamp, selected, this.disabled); 27434 } 27435 static build(active, state, id2, prev, conf) { 27436 let options2 = sortOptions(active, state); 27437 if (!options2.length) { 27438 return prev && active.some( 27439 (a2) => a2.state == 1 27440 /* State.Pending */ 27441 ) ? new _CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null; 27442 } 27443 let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1; 27444 if (prev && prev.selected != selected && prev.selected != -1) { 27445 let selectedValue = prev.options[prev.selected].completion; 27446 for (let i2 = 0; i2 < options2.length; i2++) 27447 if (options2[i2].completion == selectedValue) { 27448 selected = i2; 27449 break; 27450 } 27451 } 27452 return new _CompletionDialog(options2, makeAttrs(id2, selected), { 27453 pos: active.reduce((a2, b3) => b3.hasResult() ? Math.min(a2, b3.from) : a2, 1e8), 27454 create: createTooltip, 27455 above: conf.aboveCursor 27456 }, prev ? prev.timestamp : Date.now(), selected, false); 27457 } 27458 map(changes) { 27459 return new _CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled); 27460 } 27461}; 27462var CompletionState = class _CompletionState { 27463 constructor(active, id2, open) { 27464 this.active = active; 27465 this.id = id2; 27466 this.open = open; 27467 } 27468 static start() { 27469 return new _CompletionState(none2, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null); 27470 } 27471 update(tr) { 27472 let { state } = tr, conf = state.facet(completionConfig); 27473 let sources = conf.override || state.languageDataAt("autocomplete", cur(state)).map(asSource); 27474 let active = sources.map((source) => { 27475 let value = this.active.find((s2) => s2.source == source) || new ActiveSource( 27476 source, 27477 this.active.some( 27478 (a2) => a2.state != 0 27479 /* State.Inactive */ 27480 ) ? 1 : 0 27481 /* State.Inactive */ 27482 ); 27483 return value.update(tr, conf); 27484 }); 27485 if (active.length == this.active.length && active.every((a2, i2) => a2 == this.active[i2])) 27486 active = this.active; 27487 let open = this.open; 27488 if (open && tr.docChanged) 27489 open = open.map(tr.changes); 27490 if (tr.selection || active.some((a2) => a2.hasResult() && tr.changes.touchesRange(a2.from, a2.to)) || !sameResults(active, this.active)) 27491 open = CompletionDialog.build(active, state, this.id, open, conf); 27492 else if (open && open.disabled && !active.some( 27493 (a2) => a2.state == 1 27494 /* State.Pending */ 27495 )) 27496 open = null; 27497 if (!open && active.every( 27498 (a2) => a2.state != 1 27499 /* State.Pending */ 27500 ) && active.some((a2) => a2.hasResult())) 27501 active = active.map((a2) => a2.hasResult() ? new ActiveSource( 27502 a2.source, 27503 0 27504 /* State.Inactive */ 27505 ) : a2); 27506 for (let effect of tr.effects) 27507 if (effect.is(setSelectedEffect)) 27508 open = open && open.setSelected(effect.value, this.id); 27509 return active == this.active && open == this.open ? this : new _CompletionState(active, this.id, open); 27510 } 27511 get tooltip() { 27512 return this.open ? this.open.tooltip : null; 27513 } 27514 get attrs() { 27515 return this.open ? this.open.attrs : baseAttrs; 27516 } 27517}; 27518function sameResults(a2, b3) { 27519 if (a2 == b3) 27520 return true; 27521 for (let iA = 0, iB = 0; ; ) { 27522 while (iA < a2.length && !a2[iA].hasResult) 27523 iA++; 27524 while (iB < b3.length && !b3[iB].hasResult) 27525 iB++; 27526 let endA = iA == a2.length, endB = iB == b3.length; 27527 if (endA || endB) 27528 return endA == endB; 27529 if (a2[iA++].result != b3[iB++].result) 27530 return false; 27531 } 27532} 27533var baseAttrs = { 27534 "aria-autocomplete": "list" 27535}; 27536function makeAttrs(id2, selected) { 27537 let result = { 27538 "aria-autocomplete": "list", 27539 "aria-haspopup": "listbox", 27540 "aria-controls": id2 27541 }; 27542 if (selected > -1) 27543 result["aria-activedescendant"] = id2 + "-" + selected; 27544 return result; 27545} 27546var none2 = []; 27547function getUserEvent(tr) { 27548 return tr.isUserEvent("input.type") ? "input" : tr.isUserEvent("delete.backward") ? "delete" : null; 27549} 27550var ActiveSource = class _ActiveSource { 27551 constructor(source, state, explicitPos = -1) { 27552 this.source = source; 27553 this.state = state; 27554 this.explicitPos = explicitPos; 27555 } 27556 hasResult() { 27557 return false; 27558 } 27559 update(tr, conf) { 27560 let event = getUserEvent(tr), value = this; 27561 if (event) 27562 value = value.handleUserEvent(tr, event, conf); 27563 else if (tr.docChanged) 27564 value = value.handleChange(tr); 27565 else if (tr.selection && value.state != 0) 27566 value = new _ActiveSource( 27567 value.source, 27568 0 27569 /* State.Inactive */ 27570 ); 27571 for (let effect of tr.effects) { 27572 if (effect.is(startCompletionEffect)) 27573 value = new _ActiveSource(value.source, 1, effect.value ? cur(tr.state) : -1); 27574 else if (effect.is(closeCompletionEffect)) 27575 value = new _ActiveSource( 27576 value.source, 27577 0 27578 /* State.Inactive */ 27579 ); 27580 else if (effect.is(setActiveEffect)) { 27581 for (let active of effect.value) 27582 if (active.source == value.source) 27583 value = active; 27584 } 27585 } 27586 return value; 27587 } 27588 handleUserEvent(tr, type, conf) { 27589 return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new _ActiveSource( 27590 this.source, 27591 1 27592 /* State.Pending */ 27593 ); 27594 } 27595 handleChange(tr) { 27596 return tr.changes.touchesRange(cur(tr.startState)) ? new _ActiveSource( 27597 this.source, 27598 0 27599 /* State.Inactive */ 27600 ) : this.map(tr.changes); 27601 } 27602 map(changes) { 27603 return changes.empty || this.explicitPos < 0 ? this : new _ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos)); 27604 } 27605}; 27606var ActiveResult = class _ActiveResult extends ActiveSource { 27607 constructor(source, explicitPos, result, from, to) { 27608 super(source, 2, explicitPos); 27609 this.result = result; 27610 this.from = from; 27611 this.to = to; 27612 } 27613 hasResult() { 27614 return true; 27615 } 27616 handleUserEvent(tr, type, conf) { 27617 var _a3; 27618 let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1); 27619 let pos = cur(tr.state); 27620 if ((this.explicitPos < 0 ? pos <= from : pos < this.from) || pos > to || type == "delete" && cur(tr.startState) == this.from) 27621 return new ActiveSource( 27622 this.source, 27623 type == "input" && conf.activateOnTyping ? 1 : 0 27624 /* State.Inactive */ 27625 ); 27626 let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos), updated; 27627 if (checkValid(this.result.validFor, tr.state, from, to)) 27628 return new _ActiveResult(this.source, explicitPos, this.result, from, to); 27629 if (this.result.update && (updated = this.result.update(this.result, from, to, new CompletionContext(tr.state, pos, explicitPos >= 0)))) 27630 return new _ActiveResult(this.source, explicitPos, updated, updated.from, (_a3 = updated.to) !== null && _a3 !== void 0 ? _a3 : cur(tr.state)); 27631 return new ActiveSource(this.source, 1, explicitPos); 27632 } 27633 handleChange(tr) { 27634 return tr.changes.touchesRange(this.from, this.to) ? new ActiveSource( 27635 this.source, 27636 0 27637 /* State.Inactive */ 27638 ) : this.map(tr.changes); 27639 } 27640 map(mapping) { 27641 return mapping.empty ? this : new _ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1)); 27642 } 27643}; 27644function checkValid(validFor, state, from, to) { 27645 if (!validFor) 27646 return false; 27647 let text = state.sliceDoc(from, to); 27648 return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text); 27649} 27650var setActiveEffect = /* @__PURE__ */ StateEffect.define({ 27651 map(sources, mapping) { 27652 return sources.map((s2) => s2.map(mapping)); 27653 } 27654}); 27655var setSelectedEffect = /* @__PURE__ */ StateEffect.define(); 27656var completionState = /* @__PURE__ */ StateField.define({ 27657 create() { 27658 return CompletionState.start(); 27659 }, 27660 update(value, tr) { 27661 return value.update(tr); 27662 }, 27663 provide: (f3) => [ 27664 showTooltip.from(f3, (val) => val.tooltip), 27665 EditorView.contentAttributes.from(f3, (state) => state.attrs) 27666 ] 27667}); 27668function applyCompletion(view, option) { 27669 const apply = option.completion.apply || option.completion.label; 27670 let result = view.state.field(completionState).active.find((a2) => a2.source == option.source); 27671 if (!(result instanceof ActiveResult)) 27672 return false; 27673 if (typeof apply == "string") 27674 view.dispatch(Object.assign(Object.assign({}, insertCompletionText(view.state, apply, result.from, result.to)), { annotations: pickedCompletion.of(option.completion) })); 27675 else 27676 apply(view, option.completion, result.from, result.to); 27677 return true; 27678} 27679var createTooltip = /* @__PURE__ */ completionTooltip(completionState, applyCompletion); 27680function moveCompletionSelection(forward, by = "option") { 27681 return (view) => { 27682 let cState = view.state.field(completionState, false); 27683 if (!cState || !cState.open || cState.open.disabled || Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay) 27684 return false; 27685 let step = 1, tooltip; 27686 if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip))) 27687 step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1); 27688 let { length } = cState.open.options; 27689 let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1; 27690 if (selected < 0) 27691 selected = by == "page" ? 0 : length - 1; 27692 else if (selected >= length) 27693 selected = by == "page" ? length - 1 : 0; 27694 view.dispatch({ effects: setSelectedEffect.of(selected) }); 27695 return true; 27696 }; 27697} 27698var acceptCompletion = (view) => { 27699 let cState = view.state.field(completionState, false); 27700 if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled || Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay) 27701 return false; 27702 return applyCompletion(view, cState.open.options[cState.open.selected]); 27703}; 27704var startCompletion = (view) => { 27705 let cState = view.state.field(completionState, false); 27706 if (!cState) 27707 return false; 27708 view.dispatch({ effects: startCompletionEffect.of(true) }); 27709 return true; 27710}; 27711var closeCompletion = (view) => { 27712 let cState = view.state.field(completionState, false); 27713 if (!cState || !cState.active.some( 27714 (a2) => a2.state != 0 27715 /* State.Inactive */ 27716 )) 27717 return false; 27718 view.dispatch({ effects: closeCompletionEffect.of(null) }); 27719 return true; 27720}; 27721var RunningQuery = class { 27722 constructor(active, context) { 27723 this.active = active; 27724 this.context = context; 27725 this.time = Date.now(); 27726 this.updates = []; 27727 this.done = void 0; 27728 } 27729}; 27730var MaxUpdateCount = 50; 27731var MinAbortTime = 1e3; 27732var completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class { 27733 constructor(view) { 27734 this.view = view; 27735 this.debounceUpdate = -1; 27736 this.running = []; 27737 this.debounceAccept = -1; 27738 this.composing = 0; 27739 for (let active of view.state.field(completionState).active) 27740 if (active.state == 1) 27741 this.startQuery(active); 27742 } 27743 update(update) { 27744 let cState = update.state.field(completionState); 27745 if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState) 27746 return; 27747 let doesReset = update.transactions.some((tr) => { 27748 return (tr.selection || tr.docChanged) && !getUserEvent(tr); 27749 }); 27750 for (let i2 = 0; i2 < this.running.length; i2++) { 27751 let query = this.running[i2]; 27752 if (doesReset || query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) { 27753 for (let handler of query.context.abortListeners) { 27754 try { 27755 handler(); 27756 } catch (e2) { 27757 logException(this.view.state, e2); 27758 } 27759 } 27760 query.context.abortListeners = null; 27761 this.running.splice(i2--, 1); 27762 } else { 27763 query.updates.push(...update.transactions); 27764 } 27765 } 27766 if (this.debounceUpdate > -1) 27767 clearTimeout(this.debounceUpdate); 27768 this.debounceUpdate = cState.active.some((a2) => a2.state == 1 && !this.running.some((q) => q.active.source == a2.source)) ? setTimeout(() => this.startUpdate(), 50) : -1; 27769 if (this.composing != 0) 27770 for (let tr of update.transactions) { 27771 if (getUserEvent(tr) == "input") 27772 this.composing = 2; 27773 else if (this.composing == 2 && tr.selection) 27774 this.composing = 3; 27775 } 27776 } 27777 startUpdate() { 27778 this.debounceUpdate = -1; 27779 let { state } = this.view, cState = state.field(completionState); 27780 for (let active of cState.active) { 27781 if (active.state == 1 && !this.running.some((r2) => r2.active.source == active.source)) 27782 this.startQuery(active); 27783 } 27784 } 27785 startQuery(active) { 27786 let { state } = this.view, pos = cur(state); 27787 let context = new CompletionContext(state, pos, active.explicitPos == pos); 27788 let pending = new RunningQuery(active, context); 27789 this.running.push(pending); 27790 Promise.resolve(active.source(context)).then((result) => { 27791 if (!pending.context.aborted) { 27792 pending.done = result || null; 27793 this.scheduleAccept(); 27794 } 27795 }, (err2) => { 27796 this.view.dispatch({ effects: closeCompletionEffect.of(null) }); 27797 logException(this.view.state, err2); 27798 }); 27799 } 27800 scheduleAccept() { 27801 if (this.running.every((q) => q.done !== void 0)) 27802 this.accept(); 27803 else if (this.debounceAccept < 0) 27804 this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime); 27805 } 27806 // For each finished query in this.running, try to create a result 27807 // or, if appropriate, restart the query. 27808 accept() { 27809 var _a3; 27810 if (this.debounceAccept > -1) 27811 clearTimeout(this.debounceAccept); 27812 this.debounceAccept = -1; 27813 let updated = []; 27814 let conf = this.view.state.facet(completionConfig); 27815 for (let i2 = 0; i2 < this.running.length; i2++) { 27816 let query = this.running[i2]; 27817 if (query.done === void 0) 27818 continue; 27819 this.running.splice(i2--, 1); 27820 if (query.done) { 27821 let active = new ActiveResult(query.active.source, query.active.explicitPos, query.done, query.done.from, (_a3 = query.done.to) !== null && _a3 !== void 0 ? _a3 : cur(query.updates.length ? query.updates[0].startState : this.view.state)); 27822 for (let tr of query.updates) 27823 active = active.update(tr, conf); 27824 if (active.hasResult()) { 27825 updated.push(active); 27826 continue; 27827 } 27828 } 27829 let current = this.view.state.field(completionState).active.find((a2) => a2.source == query.active.source); 27830 if (current && current.state == 1) { 27831 if (query.done == null) { 27832 let active = new ActiveSource( 27833 query.active.source, 27834 0 27835 /* State.Inactive */ 27836 ); 27837 for (let tr of query.updates) 27838 active = active.update(tr, conf); 27839 if (active.state != 1) 27840 updated.push(active); 27841 } else { 27842 this.startQuery(current); 27843 } 27844 } 27845 } 27846 if (updated.length) 27847 this.view.dispatch({ effects: setActiveEffect.of(updated) }); 27848 } 27849}, { 27850 eventHandlers: { 27851 blur(event) { 27852 let state = this.view.state.field(completionState, false); 27853 if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) { 27854 let dialog = state.open && getTooltip(this.view, state.open.tooltip); 27855 if (!dialog || !dialog.dom.contains(event.relatedTarget)) 27856 this.view.dispatch({ effects: closeCompletionEffect.of(null) }); 27857 } 27858 }, 27859 compositionstart() { 27860 this.composing = 1; 27861 }, 27862 compositionend() { 27863 if (this.composing == 3) { 27864 setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20); 27865 } 27866 this.composing = 0; 27867 } 27868 } 27869}); 27870var baseTheme3 = /* @__PURE__ */ EditorView.baseTheme({ 27871 ".cm-tooltip.cm-tooltip-autocomplete": { 27872 "& > ul": { 27873 fontFamily: "monospace", 27874 whiteSpace: "nowrap", 27875 overflow: "hidden auto", 27876 maxWidth_fallback: "700px", 27877 maxWidth: "min(700px, 95vw)", 27878 minWidth: "250px", 27879 maxHeight: "10em", 27880 height: "100%", 27881 listStyle: "none", 27882 margin: 0, 27883 padding: 0, 27884 "& > li, & > completion-section": { 27885 padding: "1px 3px", 27886 lineHeight: 1.2 27887 }, 27888 "& > li": { 27889 overflowX: "hidden", 27890 textOverflow: "ellipsis", 27891 cursor: "pointer" 27892 }, 27893 "& > completion-section": { 27894 display: "list-item", 27895 borderBottom: "1px solid silver", 27896 paddingLeft: "0.5em", 27897 opacity: 0.7 27898 } 27899 } 27900 }, 27901 "&light .cm-tooltip-autocomplete ul li[aria-selected]": { 27902 background: "#17c", 27903 color: "white" 27904 }, 27905 "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { 27906 background: "#777" 27907 }, 27908 "&dark .cm-tooltip-autocomplete ul li[aria-selected]": { 27909 background: "#347", 27910 color: "white" 27911 }, 27912 "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { 27913 background: "#444" 27914 }, 27915 ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": { 27916 content: '"\xB7\xB7\xB7"', 27917 opacity: 0.5, 27918 display: "block", 27919 textAlign: "center" 27920 }, 27921 ".cm-tooltip.cm-completionInfo": { 27922 position: "absolute", 27923 padding: "3px 9px", 27924 width: "max-content", 27925 maxWidth: `${400}px`, 27926 boxSizing: "border-box" 27927 }, 27928 ".cm-completionInfo.cm-completionInfo-left": { right: "100%" }, 27929 ".cm-completionInfo.cm-completionInfo-right": { left: "100%" }, 27930 ".cm-completionInfo.cm-completionInfo-left-narrow": { right: `${30}px` }, 27931 ".cm-completionInfo.cm-completionInfo-right-narrow": { left: `${30}px` }, 27932 "&light .cm-snippetField": { backgroundColor: "#00000022" }, 27933 "&dark .cm-snippetField": { backgroundColor: "#ffffff22" }, 27934 ".cm-snippetFieldPosition": { 27935 verticalAlign: "text-top", 27936 width: 0, 27937 height: "1.15em", 27938 display: "inline-block", 27939 margin: "0 -0.7px -.7em", 27940 borderLeft: "1.4px dotted #888" 27941 }, 27942 ".cm-completionMatchedText": { 27943 textDecoration: "underline" 27944 }, 27945 ".cm-completionDetail": { 27946 marginLeft: "0.5em", 27947 fontStyle: "italic" 27948 }, 27949 ".cm-completionIcon": { 27950 fontSize: "90%", 27951 width: ".8em", 27952 display: "inline-block", 27953 textAlign: "center", 27954 paddingRight: ".6em", 27955 opacity: "0.6", 27956 boxSizing: "content-box" 27957 }, 27958 ".cm-completionIcon-function, .cm-completionIcon-method": { 27959 "&:after": { content: "'\u0192'" } 27960 }, 27961 ".cm-completionIcon-class": { 27962 "&:after": { content: "'\u25CB'" } 27963 }, 27964 ".cm-completionIcon-interface": { 27965 "&:after": { content: "'\u25CC'" } 27966 }, 27967 ".cm-completionIcon-variable": { 27968 "&:after": { content: "'\u{1D465}'" } 27969 }, 27970 ".cm-completionIcon-constant": { 27971 "&:after": { content: "'\u{1D436}'" } 27972 }, 27973 ".cm-completionIcon-type": { 27974 "&:after": { content: "'\u{1D461}'" } 27975 }, 27976 ".cm-completionIcon-enum": { 27977 "&:after": { content: "'\u222A'" } 27978 }, 27979 ".cm-completionIcon-property": { 27980 "&:after": { content: "'\u25A1'" } 27981 }, 27982 ".cm-completionIcon-keyword": { 27983 "&:after": { content: "'\u{1F511}\uFE0E'" } 27984 // Disable emoji rendering 27985 }, 27986 ".cm-completionIcon-namespace": { 27987 "&:after": { content: "'\u25A2'" } 27988 }, 27989 ".cm-completionIcon-text": { 27990 "&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" } 27991 } 27992}); 27993var FieldPos = class { 27994 constructor(field, line, from, to) { 27995 this.field = field; 27996 this.line = line; 27997 this.from = from; 27998 this.to = to; 27999 } 28000}; 28001var FieldRange = class _FieldRange { 28002 constructor(field, from, to) { 28003 this.field = field; 28004 this.from = from; 28005 this.to = to; 28006 } 28007 map(changes) { 28008 let from = changes.mapPos(this.from, -1, MapMode.TrackDel); 28009 let to = changes.mapPos(this.to, 1, MapMode.TrackDel); 28010 return from == null || to == null ? null : new _FieldRange(this.field, from, to); 28011 } 28012}; 28013var Snippet = class _Snippet { 28014 constructor(lines, fieldPositions) { 28015 this.lines = lines; 28016 this.fieldPositions = fieldPositions; 28017 } 28018 instantiate(state, pos) { 28019 let text = [], lineStart = [pos]; 28020 let lineObj = state.doc.lineAt(pos), baseIndent = /^\s*/.exec(lineObj.text)[0]; 28021 for (let line of this.lines) { 28022 if (text.length) { 28023 let indent3 = baseIndent, tabs = /^\t*/.exec(line)[0].length; 28024 for (let i2 = 0; i2 < tabs; i2++) 28025 indent3 += state.facet(indentUnit); 28026 lineStart.push(pos + indent3.length - tabs); 28027 line = indent3 + line.slice(tabs); 28028 } 28029 text.push(line); 28030 pos += line.length + 1; 28031 } 28032 let ranges = this.fieldPositions.map((pos2) => new FieldRange(pos2.field, lineStart[pos2.line] + pos2.from, lineStart[pos2.line] + pos2.to)); 28033 return { text, ranges }; 28034 } 28035 static parse(template) { 28036 let fields = []; 28037 let lines = [], positions = [], m2; 28038 for (let line of template.split(/\r\n?|\n/)) { 28039 while (m2 = /[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(line)) { 28040 let seq = m2[1] ? +m2[1] : null, name2 = m2[2] || m2[3] || "", found = -1; 28041 for (let i2 = 0; i2 < fields.length; i2++) { 28042 if (seq != null ? fields[i2].seq == seq : name2 ? fields[i2].name == name2 : false) 28043 found = i2; 28044 } 28045 if (found < 0) { 28046 let i2 = 0; 28047 while (i2 < fields.length && (seq == null || fields[i2].seq != null && fields[i2].seq < seq)) 28048 i2++; 28049 fields.splice(i2, 0, { seq, name: name2 }); 28050 found = i2; 28051 for (let pos of positions) 28052 if (pos.field >= found) 28053 pos.field++; 28054 } 28055 positions.push(new FieldPos(found, lines.length, m2.index, m2.index + name2.length)); 28056 line = line.slice(0, m2.index) + name2 + line.slice(m2.index + m2[0].length); 28057 } 28058 for (let esc; esc = /\\([{}])/.exec(line); ) { 28059 line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length); 28060 for (let pos of positions) 28061 if (pos.line == lines.length && pos.from > esc.index) { 28062 pos.from--; 28063 pos.to--; 28064 } 28065 } 28066 lines.push(line); 28067 } 28068 return new _Snippet(lines, positions); 28069 } 28070}; 28071var fieldMarker = /* @__PURE__ */ Decoration.widget({ widget: /* @__PURE__ */ new class extends WidgetType { 28072 toDOM() { 28073 let span = document.createElement("span"); 28074 span.className = "cm-snippetFieldPosition"; 28075 return span; 28076 } 28077 ignoreEvent() { 28078 return false; 28079 } 28080}() }); 28081var fieldRange = /* @__PURE__ */ Decoration.mark({ class: "cm-snippetField" }); 28082var ActiveSnippet = class _ActiveSnippet { 28083 constructor(ranges, active) { 28084 this.ranges = ranges; 28085 this.active = active; 28086 this.deco = Decoration.set(ranges.map((r2) => (r2.from == r2.to ? fieldMarker : fieldRange).range(r2.from, r2.to))); 28087 } 28088 map(changes) { 28089 let ranges = []; 28090 for (let r2 of this.ranges) { 28091 let mapped = r2.map(changes); 28092 if (!mapped) 28093 return null; 28094 ranges.push(mapped); 28095 } 28096 return new _ActiveSnippet(ranges, this.active); 28097 } 28098 selectionInsideField(sel) { 28099 return sel.ranges.every((range) => this.ranges.some((r2) => r2.field == this.active && r2.from <= range.from && r2.to >= range.to)); 28100 } 28101}; 28102var setActive = /* @__PURE__ */ StateEffect.define({ 28103 map(value, changes) { 28104 return value && value.map(changes); 28105 } 28106}); 28107var moveToField = /* @__PURE__ */ StateEffect.define(); 28108var snippetState = /* @__PURE__ */ StateField.define({ 28109 create() { 28110 return null; 28111 }, 28112 update(value, tr) { 28113 for (let effect of tr.effects) { 28114 if (effect.is(setActive)) 28115 return effect.value; 28116 if (effect.is(moveToField) && value) 28117 return new ActiveSnippet(value.ranges, effect.value); 28118 } 28119 if (value && tr.docChanged) 28120 value = value.map(tr.changes); 28121 if (value && tr.selection && !value.selectionInsideField(tr.selection)) 28122 value = null; 28123 return value; 28124 }, 28125 provide: (f3) => EditorView.decorations.from(f3, (val) => val ? val.deco : Decoration.none) 28126}); 28127function fieldSelection(ranges, field) { 28128 return EditorSelection.create(ranges.filter((r2) => r2.field == field).map((r2) => EditorSelection.range(r2.from, r2.to))); 28129} 28130function snippet(template) { 28131 let snippet2 = Snippet.parse(template); 28132 return (editor, completion, from, to) => { 28133 let { text, ranges } = snippet2.instantiate(editor.state, from); 28134 let spec = { 28135 changes: { from, to, insert: Text2.of(text) }, 28136 scrollIntoView: true, 28137 annotations: completion ? pickedCompletion.of(completion) : void 0 28138 }; 28139 if (ranges.length) 28140 spec.selection = fieldSelection(ranges, 0); 28141 if (ranges.length > 1) { 28142 let active = new ActiveSnippet(ranges, 0); 28143 let effects = spec.effects = [setActive.of(active)]; 28144 if (editor.state.field(snippetState, false) === void 0) 28145 effects.push(StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme3])); 28146 } 28147 editor.dispatch(editor.state.update(spec)); 28148 }; 28149} 28150function moveField(dir) { 28151 return ({ state, dispatch }) => { 28152 let active = state.field(snippetState, false); 28153 if (!active || dir < 0 && active.active == 0) 28154 return false; 28155 let next = active.active + dir, last = dir > 0 && !active.ranges.some((r2) => r2.field == next + dir); 28156 dispatch(state.update({ 28157 selection: fieldSelection(active.ranges, next), 28158 effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)), 28159 scrollIntoView: true 28160 })); 28161 return true; 28162 }; 28163} 28164var clearSnippet = ({ state, dispatch }) => { 28165 let active = state.field(snippetState, false); 28166 if (!active) 28167 return false; 28168 dispatch(state.update({ effects: setActive.of(null) })); 28169 return true; 28170}; 28171var nextSnippetField = /* @__PURE__ */ moveField(1); 28172var prevSnippetField = /* @__PURE__ */ moveField(-1); 28173var defaultSnippetKeymap = [ 28174 { key: "Tab", run: nextSnippetField, shift: prevSnippetField }, 28175 { key: "Escape", run: clearSnippet } 28176]; 28177var snippetKeymap = /* @__PURE__ */ Facet.define({ 28178 combine(maps) { 28179 return maps.length ? maps[0] : defaultSnippetKeymap; 28180 } 28181}); 28182var addSnippetKeymap = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ keymap.compute([snippetKeymap], (state) => state.facet(snippetKeymap))); 28183function snippetCompletion(template, completion) { 28184 return Object.assign(Object.assign({}, completion), { apply: snippet(template) }); 28185} 28186var snippetPointerHandler = /* @__PURE__ */ EditorView.domEventHandlers({ 28187 mousedown(event, view) { 28188 let active = view.state.field(snippetState, false), pos; 28189 if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null) 28190 return false; 28191 let match = active.ranges.find((r2) => r2.from <= pos && r2.to >= pos); 28192 if (!match || match.field == active.active) 28193 return false; 28194 view.dispatch({ 28195 selection: fieldSelection(active.ranges, match.field), 28196 effects: setActive.of(active.ranges.some((r2) => r2.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null), 28197 scrollIntoView: true 28198 }); 28199 return true; 28200 } 28201}); 28202var defaults2 = { 28203 brackets: ["(", "[", "{", "'", '"'], 28204 before: ")]}:;>", 28205 stringPrefixes: [] 28206}; 28207var closeBracketEffect = /* @__PURE__ */ StateEffect.define({ 28208 map(value, mapping) { 28209 let mapped = mapping.mapPos(value, -1, MapMode.TrackAfter); 28210 return mapped == null ? void 0 : mapped; 28211 } 28212}); 28213var closedBracket = /* @__PURE__ */ new class extends RangeValue { 28214}(); 28215closedBracket.startSide = 1; 28216closedBracket.endSide = -1; 28217var bracketState = /* @__PURE__ */ StateField.define({ 28218 create() { 28219 return RangeSet.empty; 28220 }, 28221 update(value, tr) { 28222 value = value.map(tr.changes); 28223 if (tr.selection) { 28224 let line = tr.state.doc.lineAt(tr.selection.main.head); 28225 value = value.update({ filter: (from) => from >= line.from && from <= line.to }); 28226 } 28227 for (let effect of tr.effects) 28228 if (effect.is(closeBracketEffect)) 28229 value = value.update({ add: [closedBracket.range(effect.value, effect.value + 1)] }); 28230 return value; 28231 } 28232}); 28233function closeBrackets() { 28234 return [inputHandler2, bracketState]; 28235} 28236var definedClosing = "()[]{}<>"; 28237function closing(ch) { 28238 for (let i2 = 0; i2 < definedClosing.length; i2 += 2) 28239 if (definedClosing.charCodeAt(i2) == ch) 28240 return definedClosing.charAt(i2 + 1); 28241 return fromCodePoint(ch < 128 ? ch : ch + 1); 28242} 28243function config(state, pos) { 28244 return state.languageDataAt("closeBrackets", pos)[0] || defaults2; 28245} 28246var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent); 28247var inputHandler2 = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, insert2) => { 28248 if ((android ? view.composing : view.compositionStarted) || view.state.readOnly) 28249 return false; 28250 let sel = view.state.selection.main; 28251 if (insert2.length > 2 || insert2.length == 2 && codePointSize(codePointAt(insert2, 0)) == 1 || from != sel.from || to != sel.to) 28252 return false; 28253 let tr = insertBracket(view.state, insert2); 28254 if (!tr) 28255 return false; 28256 view.dispatch(tr); 28257 return true; 28258}); 28259var deleteBracketPair = ({ state, dispatch }) => { 28260 if (state.readOnly) 28261 return false; 28262 let conf = config(state, state.selection.main.head); 28263 let tokens2 = conf.brackets || defaults2.brackets; 28264 let dont = null, changes = state.changeByRange((range) => { 28265 if (range.empty) { 28266 let before = prevChar(state.doc, range.head); 28267 for (let token of tokens2) { 28268 if (token == before && nextChar(state.doc, range.head) == closing(codePointAt(token, 0))) 28269 return { 28270 changes: { from: range.head - token.length, to: range.head + token.length }, 28271 range: EditorSelection.cursor(range.head - token.length) 28272 }; 28273 } 28274 } 28275 return { range: dont = range }; 28276 }); 28277 if (!dont) 28278 dispatch(state.update(changes, { scrollIntoView: true, userEvent: "delete.backward" })); 28279 return !dont; 28280}; 28281var closeBracketsKeymap = [ 28282 { key: "Backspace", run: deleteBracketPair } 28283]; 28284function insertBracket(state, bracket2) { 28285 let conf = config(state, state.selection.main.head); 28286 let tokens2 = conf.brackets || defaults2.brackets; 28287 for (let tok of tokens2) { 28288 let closed = closing(codePointAt(tok, 0)); 28289 if (bracket2 == tok) 28290 return closed == tok ? handleSame(state, tok, tokens2.indexOf(tok + tok + tok) > -1, conf) : handleOpen(state, tok, closed, conf.before || defaults2.before); 28291 if (bracket2 == closed && closedBracketAt(state, state.selection.main.from)) 28292 return handleClose(state, tok, closed); 28293 } 28294 return null; 28295} 28296function closedBracketAt(state, pos) { 28297 let found = false; 28298 state.field(bracketState).between(0, state.doc.length, (from) => { 28299 if (from == pos) 28300 found = true; 28301 }); 28302 return found; 28303} 28304function nextChar(doc2, pos) { 28305 let next = doc2.sliceString(pos, pos + 2); 28306 return next.slice(0, codePointSize(codePointAt(next, 0))); 28307} 28308function prevChar(doc2, pos) { 28309 let prev = doc2.sliceString(pos - 2, pos); 28310 return codePointSize(codePointAt(prev, 0)) == prev.length ? prev : prev.slice(1); 28311} 28312function handleOpen(state, open, close, closeBefore) { 28313 let dont = null, changes = state.changeByRange((range) => { 28314 if (!range.empty) 28315 return { 28316 changes: [{ insert: open, from: range.from }, { insert: close, from: range.to }], 28317 effects: closeBracketEffect.of(range.to + open.length), 28318 range: EditorSelection.range(range.anchor + open.length, range.head + open.length) 28319 }; 28320 let next = nextChar(state.doc, range.head); 28321 if (!next || /\s/.test(next) || closeBefore.indexOf(next) > -1) 28322 return { 28323 changes: { insert: open + close, from: range.head }, 28324 effects: closeBracketEffect.of(range.head + open.length), 28325 range: EditorSelection.cursor(range.head + open.length) 28326 }; 28327 return { range: dont = range }; 28328 }); 28329 return dont ? null : state.update(changes, { 28330 scrollIntoView: true, 28331 userEvent: "input.type" 28332 }); 28333} 28334function handleClose(state, _open, close) { 28335 let dont = null, changes = state.changeByRange((range) => { 28336 if (range.empty && nextChar(state.doc, range.head) == close) 28337 return { 28338 changes: { from: range.head, to: range.head + close.length, insert: close }, 28339 range: EditorSelection.cursor(range.head + close.length) 28340 }; 28341 return dont = { range }; 28342 }); 28343 return dont ? null : state.update(changes, { 28344 scrollIntoView: true, 28345 userEvent: "input.type" 28346 }); 28347} 28348function handleSame(state, token, allowTriple, config2) { 28349 let stringPrefixes = config2.stringPrefixes || defaults2.stringPrefixes; 28350 let dont = null, changes = state.changeByRange((range) => { 28351 if (!range.empty) 28352 return { 28353 changes: [{ insert: token, from: range.from }, { insert: token, from: range.to }], 28354 effects: closeBracketEffect.of(range.to + token.length), 28355 range: EditorSelection.range(range.anchor + token.length, range.head + token.length) 28356 }; 28357 let pos = range.head, next = nextChar(state.doc, pos), start; 28358 if (next == token) { 28359 if (nodeStart(state, pos)) { 28360 return { 28361 changes: { insert: token + token, from: pos }, 28362 effects: closeBracketEffect.of(pos + token.length), 28363 range: EditorSelection.cursor(pos + token.length) 28364 }; 28365 } else if (closedBracketAt(state, pos)) { 28366 let isTriple = allowTriple && state.sliceDoc(pos, pos + token.length * 3) == token + token + token; 28367 let content2 = isTriple ? token + token + token : token; 28368 return { 28369 changes: { from: pos, to: pos + content2.length, insert: content2 }, 28370 range: EditorSelection.cursor(pos + content2.length) 28371 }; 28372 } 28373 } else if (allowTriple && state.sliceDoc(pos - 2 * token.length, pos) == token + token && (start = canStartStringAt(state, pos - 2 * token.length, stringPrefixes)) > -1 && nodeStart(state, start)) { 28374 return { 28375 changes: { insert: token + token + token + token, from: pos }, 28376 effects: closeBracketEffect.of(pos + token.length), 28377 range: EditorSelection.cursor(pos + token.length) 28378 }; 28379 } else if (state.charCategorizer(pos)(next) != CharCategory.Word) { 28380 if (canStartStringAt(state, pos, stringPrefixes) > -1 && !probablyInString(state, pos, token, stringPrefixes)) 28381 return { 28382 changes: { insert: token + token, from: pos }, 28383 effects: closeBracketEffect.of(pos + token.length), 28384 range: EditorSelection.cursor(pos + token.length) 28385 }; 28386 } 28387 return { range: dont = range }; 28388 }); 28389 return dont ? null : state.update(changes, { 28390 scrollIntoView: true, 28391 userEvent: "input.type" 28392 }); 28393} 28394function nodeStart(state, pos) { 28395 let tree = syntaxTree(state).resolveInner(pos + 1); 28396 return tree.parent && tree.from == pos; 28397} 28398function probablyInString(state, pos, quoteToken, prefixes) { 28399 let node = syntaxTree(state).resolveInner(pos, -1); 28400 let maxPrefix = prefixes.reduce((m2, p2) => Math.max(m2, p2.length), 0); 28401 for (let i2 = 0; i2 < 5; i2++) { 28402 let start = state.sliceDoc(node.from, Math.min(node.to, node.from + quoteToken.length + maxPrefix)); 28403 let quotePos = start.indexOf(quoteToken); 28404 if (!quotePos || quotePos > -1 && prefixes.indexOf(start.slice(0, quotePos)) > -1) { 28405 let first = node.firstChild; 28406 while (first && first.from == node.from && first.to - first.from > quoteToken.length + quotePos) { 28407 if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken) 28408 return false; 28409 first = first.firstChild; 28410 } 28411 return true; 28412 } 28413 let parent = node.to == pos && node.parent; 28414 if (!parent) 28415 break; 28416 node = parent; 28417 } 28418 return false; 28419} 28420function canStartStringAt(state, pos, prefixes) { 28421 let charCat = state.charCategorizer(pos); 28422 if (charCat(state.sliceDoc(pos - 1, pos)) != CharCategory.Word) 28423 return pos; 28424 for (let prefix of prefixes) { 28425 let start = pos - prefix.length; 28426 if (state.sliceDoc(start, pos) == prefix && charCat(state.sliceDoc(start - 1, start)) != CharCategory.Word) 28427 return start; 28428 } 28429 return -1; 28430} 28431function autocompletion(config2 = {}) { 28432 return [ 28433 completionState, 28434 completionConfig.of(config2), 28435 completionPlugin, 28436 completionKeymapExt, 28437 baseTheme3 28438 ]; 28439} 28440var completionKeymap = [ 28441 { key: "Ctrl-Space", run: startCompletion }, 28442 { key: "Escape", run: closeCompletion }, 28443 { key: "ArrowDown", run: /* @__PURE__ */ moveCompletionSelection(true) }, 28444 { key: "ArrowUp", run: /* @__PURE__ */ moveCompletionSelection(false) }, 28445 { key: "PageDown", run: /* @__PURE__ */ moveCompletionSelection(true, "page") }, 28446 { key: "PageUp", run: /* @__PURE__ */ moveCompletionSelection(false, "page") }, 28447 { key: "Enter", run: acceptCompletion } 28448]; 28449var completionKeymapExt = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ keymap.computeN([completionConfig], (state) => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : [])); 28450
vendor: 44,538 bytes, lines 28451-29471
28451// node_modules/@codemirror/commands/dist/index.js 28452var toggleComment = (target) => { 28453 let { state } = target, line = state.doc.lineAt(state.selection.main.head), config2 = getConfig(target.state, line.from); 28454 return config2.line ? toggleLineComment(target) : config2.block ? toggleBlockCommentByLine(target) : false; 28455}; 28456function command(f3, option) { 28457 return ({ state, dispatch }) => { 28458 if (state.readOnly) 28459 return false; 28460 let tr = f3(option, state); 28461 if (!tr) 28462 return false; 28463 dispatch(state.update(tr)); 28464 return true; 28465 }; 28466} 28467var toggleLineComment = /* @__PURE__ */ command( 28468 changeLineComment, 28469 0 28470 /* CommentOption.Toggle */ 28471); 28472var toggleBlockComment = /* @__PURE__ */ command( 28473 changeBlockComment, 28474 0 28475 /* CommentOption.Toggle */ 28476); 28477var toggleBlockCommentByLine = /* @__PURE__ */ command( 28478 (o2, s2) => changeBlockComment(o2, s2, selectedLineRanges(s2)), 28479 0 28480 /* CommentOption.Toggle */ 28481); 28482function getConfig(state, pos) { 28483 let data = state.languageDataAt("commentTokens", pos); 28484 return data.length ? data[0] : {}; 28485} 28486var SearchMargin = 50; 28487function findBlockComment(state, { open, close }, from, to) { 28488 let textBefore = state.sliceDoc(from - SearchMargin, from); 28489 let textAfter = state.sliceDoc(to, to + SearchMargin); 28490 let spaceBefore = /\s*$/.exec(textBefore)[0].length, spaceAfter = /^\s*/.exec(textAfter)[0].length; 28491 let beforeOff = textBefore.length - spaceBefore; 28492 if (textBefore.slice(beforeOff - open.length, beforeOff) == open && textAfter.slice(spaceAfter, spaceAfter + close.length) == close) { 28493 return { 28494 open: { pos: from - spaceBefore, margin: spaceBefore && 1 }, 28495 close: { pos: to + spaceAfter, margin: spaceAfter && 1 } 28496 }; 28497 } 28498 let startText, endText; 28499 if (to - from <= 2 * SearchMargin) { 28500 startText = endText = state.sliceDoc(from, to); 28501 } else { 28502 startText = state.sliceDoc(from, from + SearchMargin); 28503 endText = state.sliceDoc(to - SearchMargin, to); 28504 } 28505 let startSpace = /^\s*/.exec(startText)[0].length, endSpace = /\s*$/.exec(endText)[0].length; 28506 let endOff = endText.length - endSpace - close.length; 28507 if (startText.slice(startSpace, startSpace + open.length) == open && endText.slice(endOff, endOff + close.length) == close) { 28508 return { 28509 open: { 28510 pos: from + startSpace + open.length, 28511 margin: /\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0 28512 }, 28513 close: { 28514 pos: to - endSpace - close.length, 28515 margin: /\s/.test(endText.charAt(endOff - 1)) ? 1 : 0 28516 } 28517 }; 28518 } 28519 return null; 28520} 28521function selectedLineRanges(state) { 28522 let ranges = []; 28523 for (let r2 of state.selection.ranges) { 28524 let fromLine = state.doc.lineAt(r2.from); 28525 let toLine = r2.to <= fromLine.to ? fromLine : state.doc.lineAt(r2.to); 28526 let last = ranges.length - 1; 28527 if (last >= 0 && ranges[last].to > fromLine.from) 28528 ranges[last].to = toLine.to; 28529 else 28530 ranges.push({ from: fromLine.from, to: toLine.to }); 28531 } 28532 return ranges; 28533} 28534function changeBlockComment(option, state, ranges = state.selection.ranges) { 28535 let tokens2 = ranges.map((r2) => getConfig(state, r2.from).block); 28536 if (!tokens2.every((c2) => c2)) 28537 return null; 28538 let comments2 = ranges.map((r2, i2) => findBlockComment(state, tokens2[i2], r2.from, r2.to)); 28539 if (option != 2 && !comments2.every((c2) => c2)) { 28540 return { changes: state.changes(ranges.map((range, i2) => { 28541 if (comments2[i2]) 28542 return []; 28543 return [{ from: range.from, insert: tokens2[i2].open + " " }, { from: range.to, insert: " " + tokens2[i2].close }]; 28544 })) }; 28545 } else if (option != 1 && comments2.some((c2) => c2)) { 28546 let changes = []; 28547 for (let i2 = 0, comment2; i2 < comments2.length; i2++) 28548 if (comment2 = comments2[i2]) { 28549 let token = tokens2[i2], { open, close } = comment2; 28550 changes.push({ from: open.pos - token.open.length, to: open.pos + open.margin }, { from: close.pos - close.margin, to: close.pos + token.close.length }); 28551 } 28552 return { changes }; 28553 } 28554 return null; 28555} 28556function changeLineComment(option, state, ranges = state.selection.ranges) { 28557 let lines = []; 28558 let prevLine = -1; 28559 for (let { from, to } of ranges) { 28560 let startI = lines.length, minIndent = 1e9; 28561 for (let pos = from; pos <= to; ) { 28562 let line = state.doc.lineAt(pos); 28563 if (line.from > prevLine && (from == to || to > line.from)) { 28564 prevLine = line.from; 28565 let token = getConfig(state, line.from).line; 28566 if (!token) 28567 continue; 28568 let indent3 = /^\s*/.exec(line.text)[0].length; 28569 let empty2 = indent3 == line.length; 28570 let comment2 = line.text.slice(indent3, indent3 + token.length) == token ? indent3 : -1; 28571 if (indent3 < line.text.length && indent3 < minIndent) 28572 minIndent = indent3; 28573 lines.push({ line, comment: comment2, token, indent: indent3, empty: empty2, single: false }); 28574 } 28575 pos = line.to + 1; 28576 } 28577 if (minIndent < 1e9) { 28578 for (let i2 = startI; i2 < lines.length; i2++) 28579 if (lines[i2].indent < lines[i2].line.text.length) 28580 lines[i2].indent = minIndent; 28581 } 28582 if (lines.length == startI + 1) 28583 lines[startI].single = true; 28584 } 28585 if (option != 2 && lines.some((l3) => l3.comment < 0 && (!l3.empty || l3.single))) { 28586 let changes = []; 28587 for (let { line, token, indent: indent3, empty: empty2, single } of lines) 28588 if (single || !empty2) 28589 changes.push({ from: line.from + indent3, insert: token + " " }); 28590 let changeSet = state.changes(changes); 28591 return { changes: changeSet, selection: state.selection.map(changeSet, 1) }; 28592 } else if (option != 1 && lines.some((l3) => l3.comment >= 0)) { 28593 let changes = []; 28594 for (let { line, comment: comment2, token } of lines) 28595 if (comment2 >= 0) { 28596 let from = line.from + comment2, to = from + token.length; 28597 if (line.text[to - line.from] == " ") 28598 to++; 28599 changes.push({ from, to }); 28600 } 28601 return { changes }; 28602 } 28603 return null; 28604} 28605var fromHistory = /* @__PURE__ */ Annotation.define(); 28606var isolateHistory = /* @__PURE__ */ Annotation.define(); 28607var invertedEffects = /* @__PURE__ */ Facet.define(); 28608var historyConfig = /* @__PURE__ */ Facet.define({ 28609 combine(configs) { 28610 return combineConfig(configs, { 28611 minDepth: 100, 28612 newGroupDelay: 500, 28613 joinToEvent: (_t2, isAdjacent2) => isAdjacent2 28614 }, { 28615 minDepth: Math.max, 28616 newGroupDelay: Math.min, 28617 joinToEvent: (a2, b3) => (tr, adj) => a2(tr, adj) || b3(tr, adj) 28618 }); 28619 } 28620}); 28621function changeEnd(changes) { 28622 let end = 0; 28623 changes.iterChangedRanges((_2, to) => end = to); 28624 return end; 28625} 28626var historyField_ = /* @__PURE__ */ StateField.define({ 28627 create() { 28628 return HistoryState.empty; 28629 }, 28630 update(state, tr) { 28631 let config2 = tr.state.facet(historyConfig); 28632 let fromHist = tr.annotation(fromHistory); 28633 if (fromHist) { 28634 let selection = tr.docChanged ? EditorSelection.single(changeEnd(tr.changes)) : void 0; 28635 let item = HistEvent.fromTransaction(tr, selection), from = fromHist.side; 28636 let other = from == 0 ? state.undone : state.done; 28637 if (item) 28638 other = updateBranch(other, other.length, config2.minDepth, item); 28639 else 28640 other = addSelection(other, tr.startState.selection); 28641 return new HistoryState(from == 0 ? fromHist.rest : other, from == 0 ? other : fromHist.rest); 28642 } 28643 let isolate = tr.annotation(isolateHistory); 28644 if (isolate == "full" || isolate == "before") 28645 state = state.isolate(); 28646 if (tr.annotation(Transaction.addToHistory) === false) 28647 return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state; 28648 let event = HistEvent.fromTransaction(tr); 28649 let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent); 28650 if (event) 28651 state = state.addChanges(event, time, userEvent, config2, tr); 28652 else if (tr.selection) 28653 state = state.addSelection(tr.startState.selection, time, userEvent, config2.newGroupDelay); 28654 if (isolate == "full" || isolate == "after") 28655 state = state.isolate(); 28656 return state; 28657 }, 28658 toJSON(value) { 28659 return { done: value.done.map((e2) => e2.toJSON()), undone: value.undone.map((e2) => e2.toJSON()) }; 28660 }, 28661 fromJSON(json) { 28662 return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON)); 28663 } 28664}); 28665function history2(config2 = {}) { 28666 return [ 28667 historyField_, 28668 historyConfig.of(config2), 28669 EditorView.domEventHandlers({ 28670 beforeinput(e2, view) { 28671 let command2 = e2.inputType == "historyUndo" ? undo : e2.inputType == "historyRedo" ? redo : null; 28672 if (!command2) 28673 return false; 28674 e2.preventDefault(); 28675 return command2(view); 28676 } 28677 }) 28678 ]; 28679} 28680function cmd(side, selection) { 28681 return function({ state, dispatch }) { 28682 if (!selection && state.readOnly) 28683 return false; 28684 let historyState = state.field(historyField_, false); 28685 if (!historyState) 28686 return false; 28687 let tr = historyState.pop(side, state, selection); 28688 if (!tr) 28689 return false; 28690 dispatch(tr); 28691 return true; 28692 }; 28693} 28694var undo = /* @__PURE__ */ cmd(0, false); 28695var redo = /* @__PURE__ */ cmd(1, false); 28696var undoSelection = /* @__PURE__ */ cmd(0, true); 28697var redoSelection = /* @__PURE__ */ cmd(1, true); 28698var HistEvent = class _HistEvent { 28699 constructor(changes, effects, mapped, startSelection, selectionsAfter) { 28700 this.changes = changes; 28701 this.effects = effects; 28702 this.mapped = mapped; 28703 this.startSelection = startSelection; 28704 this.selectionsAfter = selectionsAfter; 28705 } 28706 setSelAfter(after) { 28707 return new _HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after); 28708 } 28709 toJSON() { 28710 var _a3, _b2, _c; 28711 return { 28712 changes: (_a3 = this.changes) === null || _a3 === void 0 ? void 0 : _a3.toJSON(), 28713 mapped: (_b2 = this.mapped) === null || _b2 === void 0 ? void 0 : _b2.toJSON(), 28714 startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(), 28715 selectionsAfter: this.selectionsAfter.map((s2) => s2.toJSON()) 28716 }; 28717 } 28718 static fromJSON(json) { 28719 return new _HistEvent(json.changes && ChangeSet.fromJSON(json.changes), [], json.mapped && ChangeDesc.fromJSON(json.mapped), json.startSelection && EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(EditorSelection.fromJSON)); 28720 } 28721 // This does not check `addToHistory` and such, it assumes the 28722 // transaction needs to be converted to an item. Returns null when 28723 // there are no changes or effects in the transaction. 28724 static fromTransaction(tr, selection) { 28725 let effects = none3; 28726 for (let invert of tr.startState.facet(invertedEffects)) { 28727 let result = invert(tr); 28728 if (result.length) 28729 effects = effects.concat(result); 28730 } 28731 if (!effects.length && tr.changes.empty) 28732 return null; 28733 return new _HistEvent(tr.changes.invert(tr.startState.doc), effects, void 0, selection || tr.startState.selection, none3); 28734 } 28735 static selection(selections) { 28736 return new _HistEvent(void 0, none3, void 0, void 0, selections); 28737 } 28738}; 28739function updateBranch(branch, to, maxLen, newEvent) { 28740 let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0; 28741 let newBranch = branch.slice(start, to); 28742 newBranch.push(newEvent); 28743 return newBranch; 28744} 28745function isAdjacent(a2, b3) { 28746 let ranges = [], isAdjacent2 = false; 28747 a2.iterChangedRanges((f3, t3) => ranges.push(f3, t3)); 28748 b3.iterChangedRanges((_f, _t2, f3, t3) => { 28749 for (let i2 = 0; i2 < ranges.length; ) { 28750 let from = ranges[i2++], to = ranges[i2++]; 28751 if (t3 >= from && f3 <= to) 28752 isAdjacent2 = true; 28753 } 28754 }); 28755 return isAdjacent2; 28756} 28757function eqSelectionShape(a2, b3) { 28758 return a2.ranges.length == b3.ranges.length && a2.ranges.filter((r2, i2) => r2.empty != b3.ranges[i2].empty).length === 0; 28759} 28760function conc(a2, b3) { 28761 return !a2.length ? b3 : !b3.length ? a2 : a2.concat(b3); 28762} 28763var none3 = []; 28764var MaxSelectionsPerEvent = 200; 28765function addSelection(branch, selection) { 28766 if (!branch.length) { 28767 return [HistEvent.selection([selection])]; 28768 } else { 28769 let lastEvent = branch[branch.length - 1]; 28770 let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent)); 28771 if (sels.length && sels[sels.length - 1].eq(selection)) 28772 return branch; 28773 sels.push(selection); 28774 return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels)); 28775 } 28776} 28777function popSelection(branch) { 28778 let last = branch[branch.length - 1]; 28779 let newBranch = branch.slice(); 28780 newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1)); 28781 return newBranch; 28782} 28783function addMappingToBranch(branch, mapping) { 28784 if (!branch.length) 28785 return branch; 28786 let length = branch.length, selections = none3; 28787 while (length) { 28788 let event = mapEvent(branch[length - 1], mapping, selections); 28789 if (event.changes && !event.changes.empty || event.effects.length) { 28790 let result = branch.slice(0, length); 28791 result[length - 1] = event; 28792 return result; 28793 } else { 28794 mapping = event.mapped; 28795 length--; 28796 selections = event.selectionsAfter; 28797 } 28798 } 28799 return selections.length ? [HistEvent.selection(selections)] : none3; 28800} 28801function mapEvent(event, mapping, extraSelections) { 28802 let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map((s2) => s2.map(mapping)) : none3, extraSelections); 28803 if (!event.changes) 28804 return HistEvent.selection(selections); 28805 let mappedChanges = event.changes.map(mapping), before = mapping.mapDesc(event.changes, true); 28806 let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before; 28807 return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections); 28808} 28809var joinableUserEvent = /^(input\.type|delete)($|\.)/; 28810var HistoryState = class _HistoryState { 28811 constructor(done, undone, prevTime = 0, prevUserEvent = void 0) { 28812 this.done = done; 28813 this.undone = undone; 28814 this.prevTime = prevTime; 28815 this.prevUserEvent = prevUserEvent; 28816 } 28817 isolate() { 28818 return this.prevTime ? new _HistoryState(this.done, this.undone) : this; 28819 } 28820 addChanges(event, time, userEvent, config2, tr) { 28821 let done = this.done, lastEvent = done[done.length - 1]; 28822 if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes && (!userEvent || joinableUserEvent.test(userEvent)) && (!lastEvent.selectionsAfter.length && time - this.prevTime < config2.newGroupDelay && config2.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes)) || // For compose (but not compose.start) events, always join with previous event 28823 userEvent == "input.type.compose")) { 28824 done = updateBranch(done, done.length - 1, config2.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none3)); 28825 } else { 28826 done = updateBranch(done, done.length, config2.minDepth, event); 28827 } 28828 return new _HistoryState(done, none3, time, userEvent); 28829 } 28830 addSelection(selection, time, userEvent, newGroupDelay) { 28831 let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none3; 28832 if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection)) 28833 return this; 28834 return new _HistoryState(addSelection(this.done, selection), this.undone, time, userEvent); 28835 } 28836 addMapping(mapping) { 28837 return new _HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent); 28838 } 28839 pop(side, state, selection) { 28840 let branch = side == 0 ? this.done : this.undone; 28841 if (branch.length == 0) 28842 return null; 28843 let event = branch[branch.length - 1]; 28844 if (selection && event.selectionsAfter.length) { 28845 return state.update({ 28846 selection: event.selectionsAfter[event.selectionsAfter.length - 1], 28847 annotations: fromHistory.of({ side, rest: popSelection(branch) }), 28848 userEvent: side == 0 ? "select.undo" : "select.redo", 28849 scrollIntoView: true 28850 }); 28851 } else if (!event.changes) { 28852 return null; 28853 } else { 28854 let rest = branch.length == 1 ? none3 : branch.slice(0, branch.length - 1); 28855 if (event.mapped) 28856 rest = addMappingToBranch(rest, event.mapped); 28857 return state.update({ 28858 changes: event.changes, 28859 selection: event.startSelection, 28860 effects: event.effects, 28861 annotations: fromHistory.of({ side, rest }), 28862 filter: false, 28863 userEvent: side == 0 ? "undo" : "redo", 28864 scrollIntoView: true 28865 }); 28866 } 28867 } 28868}; 28869HistoryState.empty = /* @__PURE__ */ new HistoryState(none3, none3); 28870var historyKeymap = [ 28871 { key: "Mod-z", run: undo, preventDefault: true }, 28872 { key: "Mod-y", mac: "Mod-Shift-z", run: redo, preventDefault: true }, 28873 { linux: "Ctrl-Shift-z", run: redo, preventDefault: true }, 28874 { key: "Mod-u", run: undoSelection, preventDefault: true }, 28875 { key: "Alt-u", mac: "Mod-Shift-u", run: redoSelection, preventDefault: true } 28876]; 28877function updateSel(sel, by) { 28878 return EditorSelection.create(sel.ranges.map(by), sel.mainIndex); 28879} 28880function setSel(state, selection) { 28881 return state.update({ selection, scrollIntoView: true, userEvent: "select" }); 28882} 28883function moveSel({ state, dispatch }, how) { 28884 let selection = updateSel(state.selection, how); 28885 if (selection.eq(state.selection)) 28886 return false; 28887 dispatch(setSel(state, selection)); 28888 return true; 28889} 28890function rangeEnd(range, forward) { 28891 return EditorSelection.cursor(forward ? range.to : range.from); 28892} 28893function cursorByChar(view, forward) { 28894 return moveSel(view, (range) => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward)); 28895} 28896function ltrAtCursor(view) { 28897 return view.textDirectionAt(view.state.selection.main.head) == Direction.LTR; 28898} 28899var cursorCharLeft = (view) => cursorByChar(view, !ltrAtCursor(view)); 28900var cursorCharRight = (view) => cursorByChar(view, ltrAtCursor(view)); 28901function cursorByGroup(view, forward) { 28902 return moveSel(view, (range) => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward)); 28903} 28904var cursorGroupLeft = (view) => cursorByGroup(view, !ltrAtCursor(view)); 28905var cursorGroupRight = (view) => cursorByGroup(view, ltrAtCursor(view)); 28906function interestingNode(state, node, bracketProp) { 28907 if (node.type.prop(bracketProp)) 28908 return true; 28909 let len = node.to - node.from; 28910 return len && (len > 2 || /[^\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild; 28911} 28912function moveBySyntax(state, start, forward) { 28913 let pos = syntaxTree(state).resolveInner(start.head); 28914 let bracketProp = forward ? NodeProp.closedBy : NodeProp.openedBy; 28915 for (let at = start.head; ; ) { 28916 let next = forward ? pos.childAfter(at) : pos.childBefore(at); 28917 if (!next) 28918 break; 28919 if (interestingNode(state, next, bracketProp)) 28920 pos = next; 28921 else 28922 at = forward ? next.to : next.from; 28923 } 28924 let bracket2 = pos.type.prop(bracketProp), match, newPos; 28925 if (bracket2 && (match = forward ? matchBrackets(state, pos.from, 1) : matchBrackets(state, pos.to, -1)) && match.matched) 28926 newPos = forward ? match.end.to : match.end.from; 28927 else 28928 newPos = forward ? pos.to : pos.from; 28929 return EditorSelection.cursor(newPos, forward ? -1 : 1); 28930} 28931var cursorSyntaxLeft = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, !ltrAtCursor(view))); 28932var cursorSyntaxRight = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, ltrAtCursor(view))); 28933function cursorByLine(view, forward) { 28934 return moveSel(view, (range) => { 28935 if (!range.empty) 28936 return rangeEnd(range, forward); 28937 let moved = view.moveVertically(range, forward); 28938 return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward); 28939 }); 28940} 28941var cursorLineUp = (view) => cursorByLine(view, false); 28942var cursorLineDown = (view) => cursorByLine(view, true); 28943function pageInfo(view) { 28944 let selfScroll = view.scrollDOM.clientHeight < view.scrollDOM.scrollHeight - 2; 28945 let marginTop = 0, marginBottom = 0, height; 28946 if (selfScroll) { 28947 for (let source of view.state.facet(EditorView.scrollMargins)) { 28948 let margins = source(view); 28949 if (margins === null || margins === void 0 ? void 0 : margins.top) 28950 marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop); 28951 if (margins === null || margins === void 0 ? void 0 : margins.bottom) 28952 marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom); 28953 } 28954 height = view.scrollDOM.clientHeight - marginTop - marginBottom; 28955 } else { 28956 height = (view.dom.ownerDocument.defaultView || window).innerHeight; 28957 } 28958 return { 28959 marginTop, 28960 marginBottom, 28961 selfScroll, 28962 height: Math.max(view.defaultLineHeight, height - 5) 28963 }; 28964} 28965function cursorByPage(view, forward) { 28966 let page = pageInfo(view); 28967 let { state } = view, selection = updateSel(state.selection, (range) => { 28968 return range.empty ? view.moveVertically(range, forward, page.height) : rangeEnd(range, forward); 28969 }); 28970 if (selection.eq(state.selection)) 28971 return false; 28972 let effect; 28973 if (page.selfScroll) { 28974 let startPos = view.coordsAtPos(state.selection.main.head); 28975 let scrollRect = view.scrollDOM.getBoundingClientRect(); 28976 let scrollTop = scrollRect.top + page.marginTop, scrollBottom = scrollRect.bottom - page.marginBottom; 28977 if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom) 28978 effect = EditorView.scrollIntoView(selection.main.head, { y: "start", yMargin: startPos.top - scrollTop }); 28979 } 28980 view.dispatch(setSel(state, selection), { effects: effect }); 28981 return true; 28982} 28983var cursorPageUp = (view) => cursorByPage(view, false); 28984var cursorPageDown = (view) => cursorByPage(view, true); 28985function moveByLineBoundary(view, start, forward) { 28986 let line = view.lineBlockAt(start.head), moved = view.moveToLineBoundary(start, forward); 28987 if (moved.head == start.head && moved.head != (forward ? line.to : line.from)) 28988 moved = view.moveToLineBoundary(start, forward, false); 28989 if (!forward && moved.head == line.from && line.length) { 28990 let space5 = /^\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length; 28991 if (space5 && start.head != line.from + space5) 28992 moved = EditorSelection.cursor(line.from + space5); 28993 } 28994 return moved; 28995} 28996var cursorLineBoundaryForward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, true)); 28997var cursorLineBoundaryBackward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, false)); 28998var cursorLineBoundaryLeft = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, !ltrAtCursor(view))); 28999var cursorLineBoundaryRight = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, ltrAtCursor(view))); 29000var cursorLineStart = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from, 1)); 29001var cursorLineEnd = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to, -1)); 29002function toMatchingBracket(state, dispatch, extend2) { 29003 let found = false, selection = updateSel(state.selection, (range) => { 29004 let matching = matchBrackets(state, range.head, -1) || matchBrackets(state, range.head, 1) || range.head > 0 && matchBrackets(state, range.head - 1, 1) || range.head < state.doc.length && matchBrackets(state, range.head + 1, -1); 29005 if (!matching || !matching.end) 29006 return range; 29007 found = true; 29008 let head = matching.start.from == range.head ? matching.end.to : matching.end.from; 29009 return extend2 ? EditorSelection.range(range.anchor, head) : EditorSelection.cursor(head); 29010 }); 29011 if (!found) 29012 return false; 29013 dispatch(setSel(state, selection)); 29014 return true; 29015} 29016var cursorMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, false); 29017function extendSel(view, how) { 29018 let selection = updateSel(view.state.selection, (range) => { 29019 let head = how(range); 29020 return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || void 0); 29021 }); 29022 if (selection.eq(view.state.selection)) 29023 return false; 29024 view.dispatch(setSel(view.state, selection)); 29025 return true; 29026} 29027function selectByChar(view, forward) { 29028 return extendSel(view, (range) => view.moveByChar(range, forward)); 29029} 29030var selectCharLeft = (view) => selectByChar(view, !ltrAtCursor(view)); 29031var selectCharRight = (view) => selectByChar(view, ltrAtCursor(view)); 29032function selectByGroup(view, forward) { 29033 return extendSel(view, (range) => view.moveByGroup(range, forward)); 29034} 29035var selectGroupLeft = (view) => selectByGroup(view, !ltrAtCursor(view)); 29036var selectGroupRight = (view) => selectByGroup(view, ltrAtCursor(view)); 29037var selectSyntaxLeft = (view) => extendSel(view, (range) => moveBySyntax(view.state, range, !ltrAtCursor(view))); 29038var selectSyntaxRight = (view) => extendSel(view, (range) => moveBySyntax(view.state, range, ltrAtCursor(view))); 29039function selectByLine(view, forward) { 29040 return extendSel(view, (range) => view.moveVertically(range, forward)); 29041} 29042var selectLineUp = (view) => selectByLine(view, false); 29043var selectLineDown = (view) => selectByLine(view, true); 29044function selectByPage(view, forward) { 29045 return extendSel(view, (range) => view.moveVertically(range, forward, pageInfo(view).height)); 29046} 29047var selectPageUp = (view) => selectByPage(view, false); 29048var selectPageDown = (view) => selectByPage(view, true); 29049var selectLineBoundaryForward = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, true)); 29050var selectLineBoundaryBackward = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, false)); 29051var selectLineBoundaryLeft = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, !ltrAtCursor(view))); 29052var selectLineBoundaryRight = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, ltrAtCursor(view))); 29053var selectLineStart = (view) => extendSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from)); 29054var selectLineEnd = (view) => extendSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to)); 29055var cursorDocStart = ({ state, dispatch }) => { 29056 dispatch(setSel(state, { anchor: 0 })); 29057 return true; 29058}; 29059var cursorDocEnd = ({ state, dispatch }) => { 29060 dispatch(setSel(state, { anchor: state.doc.length })); 29061 return true; 29062}; 29063var selectDocStart = ({ state, dispatch }) => { 29064 dispatch(setSel(state, { anchor: state.selection.main.anchor, head: 0 })); 29065 return true; 29066}; 29067var selectDocEnd = ({ state, dispatch }) => { 29068 dispatch(setSel(state, { anchor: state.selection.main.anchor, head: state.doc.length })); 29069 return true; 29070}; 29071var selectAll = ({ state, dispatch }) => { 29072 dispatch(state.update({ selection: { anchor: 0, head: state.doc.length }, userEvent: "select" })); 29073 return true; 29074}; 29075var selectLine = ({ state, dispatch }) => { 29076 let ranges = selectedLineBlocks(state).map(({ from, to }) => EditorSelection.range(from, Math.min(to + 1, state.doc.length))); 29077 dispatch(state.update({ selection: EditorSelection.create(ranges), userEvent: "select" })); 29078 return true; 29079}; 29080var selectParentSyntax = ({ state, dispatch }) => { 29081 let selection = updateSel(state.selection, (range) => { 29082 var _a3; 29083 let context = syntaxTree(state).resolveInner(range.head, 1); 29084 while (!(context.from < range.from && context.to >= range.to || context.to > range.to && context.from <= range.from || !((_a3 = context.parent) === null || _a3 === void 0 ? void 0 : _a3.parent))) 29085 context = context.parent; 29086 return EditorSelection.range(context.to, context.from); 29087 }); 29088 dispatch(setSel(state, selection)); 29089 return true; 29090}; 29091var simplifySelection = ({ state, dispatch }) => { 29092 let cur2 = state.selection, selection = null; 29093 if (cur2.ranges.length > 1) 29094 selection = EditorSelection.create([cur2.main]); 29095 else if (!cur2.main.empty) 29096 selection = EditorSelection.create([EditorSelection.cursor(cur2.main.head)]); 29097 if (!selection) 29098 return false; 29099 dispatch(setSel(state, selection)); 29100 return true; 29101}; 29102function deleteBy(target, by) { 29103 if (target.state.readOnly) 29104 return false; 29105 let event = "delete.selection", { state } = target; 29106 let changes = state.changeByRange((range) => { 29107 let { from, to } = range; 29108 if (from == to) { 29109 let towards = by(from); 29110 if (towards < from) { 29111 event = "delete.backward"; 29112 towards = skipAtomic(target, towards, false); 29113 } else if (towards > from) { 29114 event = "delete.forward"; 29115 towards = skipAtomic(target, towards, true); 29116 } 29117 from = Math.min(from, towards); 29118 to = Math.max(to, towards); 29119 } else { 29120 from = skipAtomic(target, from, false); 29121 to = skipAtomic(target, to, true); 29122 } 29123 return from == to ? { range } : { changes: { from, to }, range: EditorSelection.cursor(from) }; 29124 }); 29125 if (changes.changes.empty) 29126 return false; 29127 target.dispatch(state.update(changes, { 29128 scrollIntoView: true, 29129 userEvent: event, 29130 effects: event == "delete.selection" ? EditorView.announce.of(state.phrase("Selection deleted")) : void 0 29131 })); 29132 return true; 29133} 29134function skipAtomic(target, pos, forward) { 29135 if (target instanceof EditorView) 29136 for (let ranges of target.state.facet(EditorView.atomicRanges).map((f3) => f3(target))) 29137 ranges.between(pos, pos, (from, to) => { 29138 if (from < pos && to > pos) 29139 pos = forward ? to : from; 29140 }); 29141 return pos; 29142} 29143var deleteByChar = (target, forward) => deleteBy(target, (pos) => { 29144 let { state } = target, line = state.doc.lineAt(pos), before, targetPos; 29145 if (!forward && pos > line.from && pos < line.from + 200 && !/[^ \t]/.test(before = line.text.slice(0, pos - line.from))) { 29146 if (before[before.length - 1] == " ") 29147 return pos - 1; 29148 let col = countColumn(before, state.tabSize), drop = col % getIndentUnit(state) || getIndentUnit(state); 29149 for (let i2 = 0; i2 < drop && before[before.length - 1 - i2] == " "; i2++) 29150 pos--; 29151 targetPos = pos; 29152 } else { 29153 targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from; 29154 if (targetPos == pos && line.number != (forward ? state.doc.lines : 1)) 29155 targetPos += forward ? 1 : -1; 29156 } 29157 return targetPos; 29158}); 29159var deleteCharBackward = (view) => deleteByChar(view, false); 29160var deleteCharForward = (view) => deleteByChar(view, true); 29161var deleteByGroup = (target, forward) => deleteBy(target, (start) => { 29162 let pos = start, { state } = target, line = state.doc.lineAt(pos); 29163 let categorize = state.charCategorizer(pos); 29164 for (let cat = null; ; ) { 29165 if (pos == (forward ? line.to : line.from)) { 29166 if (pos == start && line.number != (forward ? state.doc.lines : 1)) 29167 pos += forward ? 1 : -1; 29168 break; 29169 } 29170 let next = findClusterBreak(line.text, pos - line.from, forward) + line.from; 29171 let nextChar2 = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from); 29172 let nextCat = categorize(nextChar2); 29173 if (cat != null && nextCat != cat) 29174 break; 29175 if (nextChar2 != " " || pos != start) 29176 cat = nextCat; 29177 pos = next; 29178 } 29179 return pos; 29180}); 29181var deleteGroupBackward = (target) => deleteByGroup(target, false); 29182var deleteGroupForward = (target) => deleteByGroup(target, true); 29183var deleteToLineEnd = (view) => deleteBy(view, (pos) => { 29184 let lineEnd = view.lineBlockAt(pos).to; 29185 return pos < lineEnd ? lineEnd : Math.min(view.state.doc.length, pos + 1); 29186}); 29187var deleteToLineStart = (view) => deleteBy(view, (pos) => { 29188 let lineStart = view.lineBlockAt(pos).from; 29189 return pos > lineStart ? lineStart : Math.max(0, pos - 1); 29190}); 29191var splitLine = ({ state, dispatch }) => { 29192 if (state.readOnly) 29193 return false; 29194 let changes = state.changeByRange((range) => { 29195 return { 29196 changes: { from: range.from, to: range.to, insert: Text2.of(["", ""]) }, 29197 range: EditorSelection.cursor(range.from) 29198 }; 29199 }); 29200 dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" })); 29201 return true; 29202}; 29203var transposeChars = ({ state, dispatch }) => { 29204 if (state.readOnly) 29205 return false; 29206 let changes = state.changeByRange((range) => { 29207 if (!range.empty || range.from == 0 || range.from == state.doc.length) 29208 return { range }; 29209 let pos = range.from, line = state.doc.lineAt(pos); 29210 let from = pos == line.from ? pos - 1 : findClusterBreak(line.text, pos - line.from, false) + line.from; 29211 let to = pos == line.to ? pos + 1 : findClusterBreak(line.text, pos - line.from, true) + line.from; 29212 return { 29213 changes: { from, to, insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos)) }, 29214 range: EditorSelection.cursor(to) 29215 }; 29216 }); 29217 if (changes.changes.empty) 29218 return false; 29219 dispatch(state.update(changes, { scrollIntoView: true, userEvent: "move.character" })); 29220 return true; 29221}; 29222function selectedLineBlocks(state) { 29223 let blocks = [], upto = -1; 29224 for (let range of state.selection.ranges) { 29225 let startLine = state.doc.lineAt(range.from), endLine = state.doc.lineAt(range.to); 29226 if (!range.empty && range.to == endLine.from) 29227 endLine = state.doc.lineAt(range.to - 1); 29228 if (upto >= startLine.number) { 29229 let prev = blocks[blocks.length - 1]; 29230 prev.to = endLine.to; 29231 prev.ranges.push(range); 29232 } else { 29233 blocks.push({ from: startLine.from, to: endLine.to, ranges: [range] }); 29234 } 29235 upto = endLine.number + 1; 29236 } 29237 return blocks; 29238} 29239function moveLine(state, dispatch, forward) { 29240 if (state.readOnly) 29241 return false; 29242 let changes = [], ranges = []; 29243 for (let block2 of selectedLineBlocks(state)) { 29244 if (forward ? block2.to == state.doc.length : block2.from == 0) 29245 continue; 29246 let nextLine = state.doc.lineAt(forward ? block2.to + 1 : block2.from - 1); 29247 let size = nextLine.length + 1; 29248 if (forward) { 29249 changes.push({ from: block2.to, to: nextLine.to }, { from: block2.from, insert: nextLine.text + state.lineBreak }); 29250 for (let r2 of block2.ranges) 29251 ranges.push(EditorSelection.range(Math.min(state.doc.length, r2.anchor + size), Math.min(state.doc.length, r2.head + size))); 29252 } else { 29253 changes.push({ from: nextLine.from, to: block2.from }, { from: block2.to, insert: state.lineBreak + nextLine.text }); 29254 for (let r2 of block2.ranges) 29255 ranges.push(EditorSelection.range(r2.anchor - size, r2.head - size)); 29256 } 29257 } 29258 if (!changes.length) 29259 return false; 29260 dispatch(state.update({ 29261 changes, 29262 scrollIntoView: true, 29263 selection: EditorSelection.create(ranges, state.selection.mainIndex), 29264 userEvent: "move.line" 29265 })); 29266 return true; 29267} 29268var moveLineUp = ({ state, dispatch }) => moveLine(state, dispatch, false); 29269var moveLineDown = ({ state, dispatch }) => moveLine(state, dispatch, true); 29270function copyLine(state, dispatch, forward) { 29271 if (state.readOnly) 29272 return false; 29273 let changes = []; 29274 for (let block2 of selectedLineBlocks(state)) { 29275 if (forward) 29276 changes.push({ from: block2.from, insert: state.doc.slice(block2.from, block2.to) + state.lineBreak }); 29277 else 29278 changes.push({ from: block2.to, insert: state.lineBreak + state.doc.slice(block2.from, block2.to) }); 29279 } 29280 dispatch(state.update({ changes, scrollIntoView: true, userEvent: "input.copyline" })); 29281 return true; 29282} 29283var copyLineUp = ({ state, dispatch }) => copyLine(state, dispatch, false); 29284var copyLineDown = ({ state, dispatch }) => copyLine(state, dispatch, true); 29285var deleteLine = (view) => { 29286 if (view.state.readOnly) 29287 return false; 29288 let { state } = view, changes = state.changes(selectedLineBlocks(state).map(({ from, to }) => { 29289 if (from > 0) 29290 from--; 29291 else if (to < state.doc.length) 29292 to++; 29293 return { from, to }; 29294 })); 29295 let selection = updateSel(state.selection, (range) => view.moveVertically(range, true)).map(changes); 29296 view.dispatch({ changes, selection, scrollIntoView: true, userEvent: "delete.line" }); 29297 return true; 29298}; 29299function isBetweenBrackets(state, pos) { 29300 if (/\(\)|\[\]|\{\}/.test(state.sliceDoc(pos - 1, pos + 1))) 29301 return { from: pos, to: pos }; 29302 let context = syntaxTree(state).resolveInner(pos); 29303 let before = context.childBefore(pos), after = context.childAfter(pos), closedBy; 29304 if (before && after && before.to <= pos && after.from >= pos && (closedBy = before.type.prop(NodeProp.closedBy)) && closedBy.indexOf(after.name) > -1 && state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from) 29305 return { from: before.to, to: after.from }; 29306 return null; 29307} 29308var insertNewlineAndIndent = /* @__PURE__ */ newlineAndIndent(false); 29309var insertBlankLine = /* @__PURE__ */ newlineAndIndent(true); 29310function newlineAndIndent(atEof) { 29311 return ({ state, dispatch }) => { 29312 if (state.readOnly) 29313 return false; 29314 let changes = state.changeByRange((range) => { 29315 let { from, to } = range, line = state.doc.lineAt(from); 29316 let explode = !atEof && from == to && isBetweenBrackets(state, from); 29317 if (atEof) 29318 from = to = (to <= line.to ? line : state.doc.lineAt(to)).to; 29319 let cx = new IndentContext(state, { simulateBreak: from, simulateDoubleBreak: !!explode }); 29320 let indent3 = getIndentation(cx, from); 29321 if (indent3 == null) 29322 indent3 = /^\s*/.exec(state.doc.lineAt(from).text)[0].length; 29323 while (to < line.to && /\s/.test(line.text[to - line.from])) 29324 to++; 29325 if (explode) 29326 ({ from, to } = explode); 29327 else if (from > line.from && from < line.from + 100 && !/\S/.test(line.text.slice(0, from))) 29328 from = line.from; 29329 let insert2 = ["", indentString(state, indent3)]; 29330 if (explode) 29331 insert2.push(indentString(state, cx.lineIndent(line.from, -1))); 29332 return { 29333 changes: { from, to, insert: Text2.of(insert2) }, 29334 range: EditorSelection.cursor(from + 1 + insert2[1].length) 29335 }; 29336 }); 29337 dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" })); 29338 return true; 29339 }; 29340} 29341function changeBySelectedLine(state, f3) { 29342 let atLine = -1; 29343 return state.changeByRange((range) => { 29344 let changes = []; 29345 for (let pos = range.from; pos <= range.to; ) { 29346 let line = state.doc.lineAt(pos); 29347 if (line.number > atLine && (range.empty || range.to > line.from)) { 29348 f3(line, changes, range); 29349 atLine = line.number; 29350 } 29351 pos = line.to + 1; 29352 } 29353 let changeSet = state.changes(changes); 29354 return { 29355 changes, 29356 range: EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1)) 29357 }; 29358 }); 29359} 29360var indentSelection = ({ state, dispatch }) => { 29361 if (state.readOnly) 29362 return false; 29363 let updated = /* @__PURE__ */ Object.create(null); 29364 let context = new IndentContext(state, { overrideIndentation: (start) => { 29365 let found = updated[start]; 29366 return found == null ? -1 : found; 29367 } }); 29368 let changes = changeBySelectedLine(state, (line, changes2, range) => { 29369 let indent3 = getIndentation(context, line.from); 29370 if (indent3 == null) 29371 return; 29372 if (!/\S/.test(line.text)) 29373 indent3 = 0; 29374 let cur2 = /^\s*/.exec(line.text)[0]; 29375 let norm = indentString(state, indent3); 29376 if (cur2 != norm || range.from < line.from + cur2.length) { 29377 updated[line.from] = indent3; 29378 changes2.push({ from: line.from, to: line.from + cur2.length, insert: norm }); 29379 } 29380 }); 29381 if (!changes.changes.empty) 29382 dispatch(state.update(changes, { userEvent: "indent" })); 29383 return true; 29384}; 29385var indentMore = ({ state, dispatch }) => { 29386 if (state.readOnly) 29387 return false; 29388 dispatch(state.update(changeBySelectedLine(state, (line, changes) => { 29389 changes.push({ from: line.from, insert: state.facet(indentUnit) }); 29390 }), { userEvent: "input.indent" })); 29391 return true; 29392}; 29393var indentLess = ({ state, dispatch }) => { 29394 if (state.readOnly) 29395 return false; 29396 dispatch(state.update(changeBySelectedLine(state, (line, changes) => { 29397 let space5 = /^\s*/.exec(line.text)[0]; 29398 if (!space5) 29399 return; 29400 let col = countColumn(space5, state.tabSize), keep = 0; 29401 let insert2 = indentString(state, Math.max(0, col - getIndentUnit(state))); 29402 while (keep < space5.length && keep < insert2.length && space5.charCodeAt(keep) == insert2.charCodeAt(keep)) 29403 keep++; 29404 changes.push({ from: line.from + keep, to: line.from + space5.length, insert: insert2.slice(keep) }); 29405 }), { userEvent: "delete.dedent" })); 29406 return true; 29407}; 29408var emacsStyleKeymap = [ 29409 { key: "Ctrl-b", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true }, 29410 { key: "Ctrl-f", run: cursorCharRight, shift: selectCharRight }, 29411 { key: "Ctrl-p", run: cursorLineUp, shift: selectLineUp }, 29412 { key: "Ctrl-n", run: cursorLineDown, shift: selectLineDown }, 29413 { key: "Ctrl-a", run: cursorLineStart, shift: selectLineStart }, 29414 { key: "Ctrl-e", run: cursorLineEnd, shift: selectLineEnd }, 29415 { key: "Ctrl-d", run: deleteCharForward }, 29416 { key: "Ctrl-h", run: deleteCharBackward }, 29417 { key: "Ctrl-k", run: deleteToLineEnd }, 29418 { key: "Ctrl-Alt-h", run: deleteGroupBackward }, 29419 { key: "Ctrl-o", run: splitLine }, 29420 { key: "Ctrl-t", run: transposeChars }, 29421 { key: "Ctrl-v", run: cursorPageDown } 29422]; 29423var standardKeymap = /* @__PURE__ */ [ 29424 { key: "ArrowLeft", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true }, 29425 { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: cursorGroupLeft, shift: selectGroupLeft, preventDefault: true }, 29426 { mac: "Cmd-ArrowLeft", run: cursorLineBoundaryLeft, shift: selectLineBoundaryLeft, preventDefault: true }, 29427 { key: "ArrowRight", run: cursorCharRight, shift: selectCharRight, preventDefault: true }, 29428 { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: cursorGroupRight, shift: selectGroupRight, preventDefault: true }, 29429 { mac: "Cmd-ArrowRight", run: cursorLineBoundaryRight, shift: selectLineBoundaryRight, preventDefault: true }, 29430 { key: "ArrowUp", run: cursorLineUp, shift: selectLineUp, preventDefault: true }, 29431 { mac: "Cmd-ArrowUp", run: cursorDocStart, shift: selectDocStart }, 29432 { mac: "Ctrl-ArrowUp", run: cursorPageUp, shift: selectPageUp }, 29433 { key: "ArrowDown", run: cursorLineDown, shift: selectLineDown, preventDefault: true }, 29434 { mac: "Cmd-ArrowDown", run: cursorDocEnd, shift: selectDocEnd }, 29435 { mac: "Ctrl-ArrowDown", run: cursorPageDown, shift: selectPageDown }, 29436 { key: "PageUp", run: cursorPageUp, shift: selectPageUp }, 29437 { key: "PageDown", run: cursorPageDown, shift: selectPageDown }, 29438 { key: "Home", run: cursorLineBoundaryBackward, shift: selectLineBoundaryBackward, preventDefault: true }, 29439 { key: "Mod-Home", run: cursorDocStart, shift: selectDocStart }, 29440 { key: "End", run: cursorLineBoundaryForward, shift: selectLineBoundaryForward, preventDefault: true }, 29441 { key: "Mod-End", run: cursorDocEnd, shift: selectDocEnd }, 29442 { key: "Enter", run: insertNewlineAndIndent }, 29443 { key: "Mod-a", run: selectAll }, 29444 { key: "Backspace", run: deleteCharBackward, shift: deleteCharBackward }, 29445 { key: "Delete", run: deleteCharForward }, 29446 { key: "Mod-Backspace", mac: "Alt-Backspace", run: deleteGroupBackward }, 29447 { key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward }, 29448 { mac: "Mod-Backspace", run: deleteToLineStart }, 29449 { mac: "Mod-Delete", run: deleteToLineEnd } 29450].concat(/* @__PURE__ */ emacsStyleKeymap.map((b3) => ({ mac: b3.key, run: b3.run, shift: b3.shift }))); 29451var defaultKeymap = /* @__PURE__ */ [ 29452 { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: cursorSyntaxLeft, shift: selectSyntaxLeft }, 29453 { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: cursorSyntaxRight, shift: selectSyntaxRight }, 29454 { key: "Alt-ArrowUp", run: moveLineUp }, 29455 { key: "Shift-Alt-ArrowUp", run: copyLineUp }, 29456 { key: "Alt-ArrowDown", run: moveLineDown }, 29457 { key: "Shift-Alt-ArrowDown", run: copyLineDown }, 29458 { key: "Escape", run: simplifySelection }, 29459 { key: "Mod-Enter", run: insertBlankLine }, 29460 { key: "Alt-l", mac: "Ctrl-l", run: selectLine }, 29461 { key: "Mod-i", run: selectParentSyntax, preventDefault: true }, 29462 { key: "Mod-[", run: indentLess }, 29463 { key: "Mod-]", run: indentMore }, 29464 { key: "Mod-Alt-\\", run: indentSelection }, 29465 { key: "Shift-Mod-k", run: deleteLine }, 29466 { key: "Shift-Mod-\\", run: cursorMatchingBracket }, 29467 { key: "Mod-/", run: toggleComment }, 29468 { key: "Alt-A", run: toggleBlockComment } 29469].concat(standardKeymap); 29470var indentWithTab = { key: "Tab", run: indentMore, shift: indentLess }; 29471
vendor: 55,143 bytes, lines 29472-31233
29472// node_modules/@lezer/lr/dist/index.js 29473var Stack = class _Stack { 29474 /** 29475 @internal 29476 */ 29477 constructor(p2, stack, state, reducePos, pos, score2, buffer, bufferBase, curContext, lookAhead = 0, parent) { 29478 this.p = p2; 29479 this.stack = stack; 29480 this.state = state; 29481 this.reducePos = reducePos; 29482 this.pos = pos; 29483 this.score = score2; 29484 this.buffer = buffer; 29485 this.bufferBase = bufferBase; 29486 this.curContext = curContext; 29487 this.lookAhead = lookAhead; 29488 this.parent = parent; 29489 } 29490 /** 29491 @internal 29492 */ 29493 toString() { 29494 return `[${this.stack.filter((_2, i2) => i2 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; 29495 } 29496 // Start an empty stack 29497 /** 29498 @internal 29499 */ 29500 static start(p2, state, pos = 0) { 29501 let cx = p2.parser.context; 29502 return new _Stack(p2, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null); 29503 } 29504 /** 29505 The stack's current [context](#lr.ContextTracker) value, if 29506 any. Its type will depend on the context tracker's type 29507 parameter, or it will be `null` if there is no context 29508 tracker. 29509 */ 29510 get context() { 29511 return this.curContext ? this.curContext.context : null; 29512 } 29513 // Push a state onto the stack, tracking its start position as well 29514 // as the buffer base at that point. 29515 /** 29516 @internal 29517 */ 29518 pushState(state, start) { 29519 this.stack.push(this.state, start, this.bufferBase + this.buffer.length); 29520 this.state = state; 29521 } 29522 // Apply a reduce action 29523 /** 29524 @internal 29525 */ 29526 reduce(action) { 29527 var _a3; 29528 let depth = action >> 19, type = action & 65535; 29529 let { parser: parser10 } = this.p; 29530 let lookaheadRecord = this.reducePos < this.pos - 25; 29531 if (lookaheadRecord) 29532 this.setLookAhead(this.pos); 29533 let dPrec = parser10.dynamicPrecedence(type); 29534 if (dPrec) 29535 this.score += dPrec; 29536 if (depth == 0) { 29537 this.pushState(parser10.getGoto(this.state, type, true), this.reducePos); 29538 if (type < parser10.minRepeatTerm) 29539 this.storeNode(type, this.reducePos, this.reducePos, lookaheadRecord ? 8 : 4, true); 29540 this.reduceContext(type, this.reducePos); 29541 return; 29542 } 29543 let base2 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0); 29544 let start = base2 ? this.stack[base2 - 2] : this.p.ranges[0].from, size = this.reducePos - start; 29545 if (size >= 2e3 && !((_a3 = this.p.parser.nodeSet.types[type]) === null || _a3 === void 0 ? void 0 : _a3.isAnonymous)) { 29546 if (start == this.p.lastBigReductionStart) { 29547 this.p.bigReductionCount++; 29548 this.p.lastBigReductionSize = size; 29549 } else if (this.p.lastBigReductionSize < size) { 29550 this.p.bigReductionCount = 1; 29551 this.p.lastBigReductionStart = start; 29552 this.p.lastBigReductionSize = size; 29553 } 29554 } 29555 let bufferBase = base2 ? this.stack[base2 - 1] : 0, count = this.bufferBase + this.buffer.length - bufferBase; 29556 if (type < parser10.minRepeatTerm || action & 131072) { 29557 let pos = parser10.stateFlag( 29558 this.state, 29559 1 29560 /* StateFlag.Skipped */ 29561 ) ? this.pos : this.reducePos; 29562 this.storeNode(type, start, pos, count + 4, true); 29563 } 29564 if (action & 262144) { 29565 this.state = this.stack[base2]; 29566 } else { 29567 let baseStateID = this.stack[base2 - 3]; 29568 this.state = parser10.getGoto(baseStateID, type, true); 29569 } 29570 while (this.stack.length > base2) 29571 this.stack.pop(); 29572 this.reduceContext(type, start); 29573 } 29574 // Shift a value into the buffer 29575 /** 29576 @internal 29577 */ 29578 storeNode(term, start, end, size = 4, mustSink = false) { 29579 if (term == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { 29580 let cur2 = this, top2 = this.buffer.length; 29581 if (top2 == 0 && cur2.parent) { 29582 top2 = cur2.bufferBase - cur2.parent.bufferBase; 29583 cur2 = cur2.parent; 29584 } 29585 if (top2 > 0 && cur2.buffer[top2 - 4] == 0 && cur2.buffer[top2 - 1] > -1) { 29586 if (start == end) 29587 return; 29588 if (cur2.buffer[top2 - 2] >= start) { 29589 cur2.buffer[top2 - 2] = end; 29590 return; 29591 } 29592 } 29593 } 29594 if (!mustSink || this.pos == end) { 29595 this.buffer.push(term, start, end, size); 29596 } else { 29597 let index = this.buffer.length; 29598 if (index > 0 && this.buffer[index - 4] != 0) { 29599 let mustMove = false; 29600 for (let scan = index; scan > 0 && this.buffer[scan - 2] > end; scan -= 4) { 29601 if (this.buffer[scan - 1] >= 0) { 29602 mustMove = true; 29603 break; 29604 } 29605 } 29606 if (mustMove) 29607 while (index > 0 && this.buffer[index - 2] > end) { 29608 this.buffer[index] = this.buffer[index - 4]; 29609 this.buffer[index + 1] = this.buffer[index - 3]; 29610 this.buffer[index + 2] = this.buffer[index - 2]; 29611 this.buffer[index + 3] = this.buffer[index - 1]; 29612 index -= 4; 29613 if (size > 4) 29614 size -= 4; 29615 } 29616 } 29617 this.buffer[index] = term; 29618 this.buffer[index + 1] = start; 29619 this.buffer[index + 2] = end; 29620 this.buffer[index + 3] = size; 29621 } 29622 } 29623 // Apply a shift action 29624 /** 29625 @internal 29626 */ 29627 shift(action, type, start, end) { 29628 if (action & 131072) { 29629 this.pushState(action & 65535, this.pos); 29630 } else if ((action & 262144) == 0) { 29631 let nextState = action, { parser: parser10 } = this.p; 29632 if (end > this.pos || type <= parser10.maxNode) { 29633 this.pos = end; 29634 if (!parser10.stateFlag( 29635 nextState, 29636 1 29637 /* StateFlag.Skipped */ 29638 )) 29639 this.reducePos = end; 29640 } 29641 this.pushState(nextState, start); 29642 this.shiftContext(type, start); 29643 if (type <= parser10.maxNode) 29644 this.buffer.push(type, start, end, 4); 29645 } else { 29646 this.pos = end; 29647 this.shiftContext(type, start); 29648 if (type <= this.p.parser.maxNode) 29649 this.buffer.push(type, start, end, 4); 29650 } 29651 } 29652 // Apply an action 29653 /** 29654 @internal 29655 */ 29656 apply(action, next, nextStart, nextEnd) { 29657 if (action & 65536) 29658 this.reduce(action); 29659 else 29660 this.shift(action, next, nextStart, nextEnd); 29661 } 29662 // Add a prebuilt (reused) node into the buffer. 29663 /** 29664 @internal 29665 */ 29666 useNode(value, next) { 29667 let index = this.p.reused.length - 1; 29668 if (index < 0 || this.p.reused[index] != value) { 29669 this.p.reused.push(value); 29670 index++; 29671 } 29672 let start = this.pos; 29673 this.reducePos = this.pos = start + value.length; 29674 this.pushState(next, start); 29675 this.buffer.push( 29676 index, 29677 start, 29678 this.reducePos, 29679 -1 29680 /* size == -1 means this is a reused value */ 29681 ); 29682 if (this.curContext) 29683 this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length))); 29684 } 29685 // Split the stack. Due to the buffer sharing and the fact 29686 // that `this.stack` tends to stay quite shallow, this isn't very 29687 // expensive. 29688 /** 29689 @internal 29690 */ 29691 split() { 29692 let parent = this; 29693 let off = parent.buffer.length; 29694 while (off > 0 && parent.buffer[off - 2] > parent.reducePos) 29695 off -= 4; 29696 let buffer = parent.buffer.slice(off), base2 = parent.bufferBase + off; 29697 while (parent && base2 == parent.bufferBase) 29698 parent = parent.parent; 29699 return new _Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base2, this.curContext, this.lookAhead, parent); 29700 } 29701 // Try to recover from an error by 'deleting' (ignoring) one token. 29702 /** 29703 @internal 29704 */ 29705 recoverByDelete(next, nextEnd) { 29706 let isNode = next <= this.p.parser.maxNode; 29707 if (isNode) 29708 this.storeNode(next, this.pos, nextEnd, 4); 29709 this.storeNode(0, this.pos, nextEnd, isNode ? 8 : 4); 29710 this.pos = this.reducePos = nextEnd; 29711 this.score -= 190; 29712 } 29713 /** 29714 Check if the given term would be able to be shifted (optionally 29715 after some reductions) on this stack. This can be useful for 29716 external tokenizers that want to make sure they only provide a 29717 given token when it applies. 29718 */ 29719 canShift(term) { 29720 for (let sim = new SimulatedStack(this); ; ) { 29721 let action = this.p.parser.stateSlot( 29722 sim.state, 29723 4 29724 /* ParseState.DefaultReduce */ 29725 ) || this.p.parser.hasAction(sim.state, term); 29726 if (action == 0) 29727 return false; 29728 if ((action & 65536) == 0) 29729 return true; 29730 sim.reduce(action); 29731 } 29732 } 29733 // Apply up to Recover.MaxNext recovery actions that conceptually 29734 // inserts some missing token or rule. 29735 /** 29736 @internal 29737 */ 29738 recoverByInsert(next) { 29739 if (this.stack.length >= 300) 29740 return []; 29741 let nextStates = this.p.parser.nextStates(this.state); 29742 if (nextStates.length > 4 << 1 || this.stack.length >= 120) { 29743 let best = []; 29744 for (let i2 = 0, s2; i2 < nextStates.length; i2 += 2) { 29745 if ((s2 = nextStates[i2 + 1]) != this.state && this.p.parser.hasAction(s2, next)) 29746 best.push(nextStates[i2], s2); 29747 } 29748 if (this.stack.length < 120) 29749 for (let i2 = 0; best.length < 4 << 1 && i2 < nextStates.length; i2 += 2) { 29750 let s2 = nextStates[i2 + 1]; 29751 if (!best.some((v2, i3) => i3 & 1 && v2 == s2)) 29752 best.push(nextStates[i2], s2); 29753 } 29754 nextStates = best; 29755 } 29756 let result = []; 29757 for (let i2 = 0; i2 < nextStates.length && result.length < 4; i2 += 2) { 29758 let s2 = nextStates[i2 + 1]; 29759 if (s2 == this.state) 29760 continue; 29761 let stack = this.split(); 29762 stack.pushState(s2, this.pos); 29763 stack.storeNode(0, stack.pos, stack.pos, 4, true); 29764 stack.shiftContext(nextStates[i2], this.pos); 29765 stack.reducePos = this.pos; 29766 stack.score -= 200; 29767 result.push(stack); 29768 } 29769 return result; 29770 } 29771 // Force a reduce, if possible. Return false if that can't 29772 // be done. 29773 /** 29774 @internal 29775 */ 29776 forceReduce() { 29777 let { parser: parser10 } = this.p; 29778 let reduce = parser10.stateSlot( 29779 this.state, 29780 5 29781 /* ParseState.ForcedReduce */ 29782 ); 29783 if ((reduce & 65536) == 0) 29784 return false; 29785 if (!parser10.validAction(this.state, reduce)) { 29786 let depth = reduce >> 19, term = reduce & 65535; 29787 let target = this.stack.length - depth * 3; 29788 if (target < 0 || parser10.getGoto(this.stack[target], term, false) < 0) { 29789 let backup = this.findForcedReduction(); 29790 if (backup == null) 29791 return false; 29792 reduce = backup; 29793 } 29794 this.storeNode(0, this.pos, this.pos, 4, true); 29795 this.score -= 100; 29796 } 29797 this.reducePos = this.pos; 29798 this.reduce(reduce); 29799 return true; 29800 } 29801 /** 29802 Try to scan through the automaton to find some kind of reduction 29803 that can be applied. Used when the regular ForcedReduce field 29804 isn't a valid action. @internal 29805 */ 29806 findForcedReduction() { 29807 let { parser: parser10 } = this.p, seen = []; 29808 let explore = (state, depth) => { 29809 if (seen.includes(state)) 29810 return; 29811 seen.push(state); 29812 return parser10.allActions(state, (action) => { 29813 if (action & (262144 | 131072)) 29814 ; 29815 else if (action & 65536) { 29816 let rDepth = (action >> 19) - depth; 29817 if (rDepth > 1) { 29818 let term = action & 65535, target = this.stack.length - rDepth * 3; 29819 if (target >= 0 && parser10.getGoto(this.stack[target], term, false) >= 0) 29820 return rDepth << 19 | 65536 | term; 29821 } 29822 } else { 29823 let found = explore(action, depth + 1); 29824 if (found != null) 29825 return found; 29826 } 29827 }); 29828 }; 29829 return explore(this.state, 0); 29830 } 29831 /** 29832 @internal 29833 */ 29834 forceAll() { 29835 while (!this.p.parser.stateFlag( 29836 this.state, 29837 2 29838 /* StateFlag.Accepting */ 29839 )) { 29840 if (!this.forceReduce()) { 29841 this.storeNode(0, this.pos, this.pos, 4, true); 29842 break; 29843 } 29844 } 29845 return this; 29846 } 29847 /** 29848 Check whether this state has no further actions (assumed to be a direct descendant of the 29849 top state, since any other states must be able to continue 29850 somehow). @internal 29851 */ 29852 get deadEnd() { 29853 if (this.stack.length != 3) 29854 return false; 29855 let { parser: parser10 } = this.p; 29856 return parser10.data[parser10.stateSlot( 29857 this.state, 29858 1 29859 /* ParseState.Actions */ 29860 )] == 65535 && !parser10.stateSlot( 29861 this.state, 29862 4 29863 /* ParseState.DefaultReduce */ 29864 ); 29865 } 29866 /** 29867 Restart the stack (put it back in its start state). Only safe 29868 when this.stack.length == 3 (state is directly below the top 29869 state). @internal 29870 */ 29871 restart() { 29872 this.storeNode(0, this.pos, this.pos, 4, true); 29873 this.state = this.stack[0]; 29874 this.stack.length = 0; 29875 } 29876 /** 29877 @internal 29878 */ 29879 sameState(other) { 29880 if (this.state != other.state || this.stack.length != other.stack.length) 29881 return false; 29882 for (let i2 = 0; i2 < this.stack.length; i2 += 3) 29883 if (this.stack[i2] != other.stack[i2]) 29884 return false; 29885 return true; 29886 } 29887 /** 29888 Get the parser used by this stack. 29889 */ 29890 get parser() { 29891 return this.p.parser; 29892 } 29893 /** 29894 Test whether a given dialect (by numeric ID, as exported from 29895 the terms file) is enabled. 29896 */ 29897 dialectEnabled(dialectID) { 29898 return this.p.parser.dialect.flags[dialectID]; 29899 } 29900 shiftContext(term, start) { 29901 if (this.curContext) 29902 this.updateContext(this.curContext.tracker.shift(this.curContext.context, term, this, this.p.stream.reset(start))); 29903 } 29904 reduceContext(term, start) { 29905 if (this.curContext) 29906 this.updateContext(this.curContext.tracker.reduce(this.curContext.context, term, this, this.p.stream.reset(start))); 29907 } 29908 /** 29909 @internal 29910 */ 29911 emitContext() { 29912 let last = this.buffer.length - 1; 29913 if (last < 0 || this.buffer[last] != -3) 29914 this.buffer.push(this.curContext.hash, this.pos, this.pos, -3); 29915 } 29916 /** 29917 @internal 29918 */ 29919 emitLookAhead() { 29920 let last = this.buffer.length - 1; 29921 if (last < 0 || this.buffer[last] != -4) 29922 this.buffer.push(this.lookAhead, this.pos, this.pos, -4); 29923 } 29924 updateContext(context) { 29925 if (context != this.curContext.context) { 29926 let newCx = new StackContext(this.curContext.tracker, context); 29927 if (newCx.hash != this.curContext.hash) 29928 this.emitContext(); 29929 this.curContext = newCx; 29930 } 29931 } 29932 /** 29933 @internal 29934 */ 29935 setLookAhead(lookAhead) { 29936 if (lookAhead > this.lookAhead) { 29937 this.emitLookAhead(); 29938 this.lookAhead = lookAhead; 29939 } 29940 } 29941 /** 29942 @internal 29943 */ 29944 close() { 29945 if (this.curContext && this.curContext.tracker.strict) 29946 this.emitContext(); 29947 if (this.lookAhead > 0) 29948 this.emitLookAhead(); 29949 } 29950}; 29951var StackContext = class { 29952 constructor(tracker, context) { 29953 this.tracker = tracker; 29954 this.context = context; 29955 this.hash = tracker.strict ? tracker.hash(context) : 0; 29956 } 29957}; 29958var SimulatedStack = class { 29959 constructor(start) { 29960 this.start = start; 29961 this.state = start.state; 29962 this.stack = start.stack; 29963 this.base = this.stack.length; 29964 } 29965 reduce(action) { 29966 let term = action & 65535, depth = action >> 19; 29967 if (depth == 0) { 29968 if (this.stack == this.start.stack) 29969 this.stack = this.stack.slice(); 29970 this.stack.push(this.state, 0, 0); 29971 this.base += 3; 29972 } else { 29973 this.base -= (depth - 1) * 3; 29974 } 29975 let goto = this.start.p.parser.getGoto(this.stack[this.base - 3], term, true); 29976 this.state = goto; 29977 } 29978}; 29979var StackBufferCursor = class _StackBufferCursor { 29980 constructor(stack, pos, index) { 29981 this.stack = stack; 29982 this.pos = pos; 29983 this.index = index; 29984 this.buffer = stack.buffer; 29985 if (this.index == 0) 29986 this.maybeNext(); 29987 } 29988 static create(stack, pos = stack.bufferBase + stack.buffer.length) { 29989 return new _StackBufferCursor(stack, pos, pos - stack.bufferBase); 29990 } 29991 maybeNext() { 29992 let next = this.stack.parent; 29993 if (next != null) { 29994 this.index = this.stack.bufferBase - next.bufferBase; 29995 this.stack = next; 29996 this.buffer = next.buffer; 29997 } 29998 } 29999 get id() { 30000 return this.buffer[this.index - 4]; 30001 } 30002 get start() { 30003 return this.buffer[this.index - 3]; 30004 } 30005 get end() { 30006 return this.buffer[this.index - 2]; 30007 } 30008 get size() { 30009 return this.buffer[this.index - 1]; 30010 } 30011 next() { 30012 this.index -= 4; 30013 this.pos -= 4; 30014 if (this.index == 0) 30015 this.maybeNext(); 30016 } 30017 fork() { 30018 return new _StackBufferCursor(this.stack, this.pos, this.index); 30019 } 30020}; 30021function decodeArray(input, Type2 = Uint16Array) { 30022 if (typeof input != "string") 30023 return input; 30024 let array = null; 30025 for (let pos = 0, out = 0; pos < input.length; ) { 30026 let value = 0; 30027 for (; ; ) { 30028 let next = input.charCodeAt(pos++), stop = false; 30029 if (next == 126) { 30030 value = 65535; 30031 break; 30032 } 30033 if (next >= 92) 30034 next--; 30035 if (next >= 34) 30036 next--; 30037 let digit = next - 32; 30038 if (digit >= 46) { 30039 digit -= 46; 30040 stop = true; 30041 } 30042 value += digit; 30043 if (stop) 30044 break; 30045 value *= 46; 30046 } 30047 if (array) 30048 array[out++] = value; 30049 else 30050 array = new Type2(value); 30051 } 30052 return array; 30053} 30054var CachedToken = class { 30055 constructor() { 30056 this.start = -1; 30057 this.value = -1; 30058 this.end = -1; 30059 this.extended = -1; 30060 this.lookAhead = 0; 30061 this.mask = 0; 30062 this.context = 0; 30063 } 30064}; 30065var nullToken = new CachedToken(); 30066var InputStream = class { 30067 /** 30068 @internal 30069 */ 30070 constructor(input, ranges) { 30071 this.input = input; 30072 this.ranges = ranges; 30073 this.chunk = ""; 30074 this.chunkOff = 0; 30075 this.chunk2 = ""; 30076 this.chunk2Pos = 0; 30077 this.next = -1; 30078 this.token = nullToken; 30079 this.rangeIndex = 0; 30080 this.pos = this.chunkPos = ranges[0].from; 30081 this.range = ranges[0]; 30082 this.end = ranges[ranges.length - 1].to; 30083 this.readNext(); 30084 } 30085 /** 30086 @internal 30087 */ 30088 resolveOffset(offset, assoc) { 30089 let range = this.range, index = this.rangeIndex; 30090 let pos = this.pos + offset; 30091 while (pos < range.from) { 30092 if (!index) 30093 return null; 30094 let next = this.ranges[--index]; 30095 pos -= range.from - next.to; 30096 range = next; 30097 } 30098 while (assoc < 0 ? pos > range.to : pos >= range.to) { 30099 if (index == this.ranges.length - 1) 30100 return null; 30101 let next = this.ranges[++index]; 30102 pos += next.from - range.to; 30103 range = next; 30104 } 30105 return pos; 30106 } 30107 /** 30108 @internal 30109 */ 30110 clipPos(pos) { 30111 if (pos >= this.range.from && pos < this.range.to) 30112 return pos; 30113 for (let range of this.ranges) 30114 if (range.to > pos) 30115 return Math.max(pos, range.from); 30116 return this.end; 30117 } 30118 /** 30119 Look at a code unit near the stream position. `.peek(0)` equals 30120 `.next`, `.peek(-1)` gives you the previous character, and so 30121 on. 30122 30123 Note that looking around during tokenizing creates dependencies 30124 on potentially far-away content, which may reduce the 30125 effectiveness incremental parsing—when looking forward—or even 30126 cause invalid reparses when looking backward more than 25 code 30127 units, since the library does not track lookbehind. 30128 */ 30129 peek(offset) { 30130 let idx = this.chunkOff + offset, pos, result; 30131 if (idx >= 0 && idx < this.chunk.length) { 30132 pos = this.pos + offset; 30133 result = this.chunk.charCodeAt(idx); 30134 } else { 30135 let resolved = this.resolveOffset(offset, 1); 30136 if (resolved == null) 30137 return -1; 30138 pos = resolved; 30139 if (pos >= this.chunk2Pos && pos < this.chunk2Pos + this.chunk2.length) { 30140 result = this.chunk2.charCodeAt(pos - this.chunk2Pos); 30141 } else { 30142 let i2 = this.rangeIndex, range = this.range; 30143 while (range.to <= pos) 30144 range = this.ranges[++i2]; 30145 this.chunk2 = this.input.chunk(this.chunk2Pos = pos); 30146 if (pos + this.chunk2.length > range.to) 30147 this.chunk2 = this.chunk2.slice(0, range.to - pos); 30148 result = this.chunk2.charCodeAt(0); 30149 } 30150 } 30151 if (pos >= this.token.lookAhead) 30152 this.token.lookAhead = pos + 1; 30153 return result; 30154 } 30155 /** 30156 Accept a token. By default, the end of the token is set to the 30157 current stream position, but you can pass an offset (relative to 30158 the stream position) to change that. 30159 */ 30160 acceptToken(token, endOffset = 0) { 30161 let end = endOffset ? this.resolveOffset(endOffset, -1) : this.pos; 30162 if (end == null || end < this.token.start) 30163 throw new RangeError("Token end out of bounds"); 30164 this.token.value = token; 30165 this.token.end = end; 30166 } 30167 /** 30168 Accept a token ending at a specific given position. 30169 */ 30170 acceptTokenTo(token, endPos) { 30171 this.token.value = token; 30172 this.token.end = endPos; 30173 } 30174 getChunk() { 30175 if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) { 30176 let { chunk, chunkPos } = this; 30177 this.chunk = this.chunk2; 30178 this.chunkPos = this.chunk2Pos; 30179 this.chunk2 = chunk; 30180 this.chunk2Pos = chunkPos; 30181 this.chunkOff = this.pos - this.chunkPos; 30182 } else { 30183 this.chunk2 = this.chunk; 30184 this.chunk2Pos = this.chunkPos; 30185 let nextChunk = this.input.chunk(this.pos); 30186 let end = this.pos + nextChunk.length; 30187 this.chunk = end > this.range.to ? nextChunk.slice(0, this.range.to - this.pos) : nextChunk; 30188 this.chunkPos = this.pos; 30189 this.chunkOff = 0; 30190 } 30191 } 30192 readNext() { 30193 if (this.chunkOff >= this.chunk.length) { 30194 this.getChunk(); 30195 if (this.chunkOff == this.chunk.length) 30196 return this.next = -1; 30197 } 30198 return this.next = this.chunk.charCodeAt(this.chunkOff); 30199 } 30200 /** 30201 Move the stream forward N (defaults to 1) code units. Returns 30202 the new value of [`next`](#lr.InputStream.next). 30203 */ 30204 advance(n3 = 1) { 30205 this.chunkOff += n3; 30206 while (this.pos + n3 >= this.range.to) { 30207 if (this.rangeIndex == this.ranges.length - 1) 30208 return this.setDone(); 30209 n3 -= this.range.to - this.pos; 30210 this.range = this.ranges[++this.rangeIndex]; 30211 this.pos = this.range.from; 30212 } 30213 this.pos += n3; 30214 if (this.pos >= this.token.lookAhead) 30215 this.token.lookAhead = this.pos + 1; 30216 return this.readNext(); 30217 } 30218 setDone() { 30219 this.pos = this.chunkPos = this.end; 30220 this.range = this.ranges[this.rangeIndex = this.ranges.length - 1]; 30221 this.chunk = ""; 30222 return this.next = -1; 30223 } 30224 /** 30225 @internal 30226 */ 30227 reset(pos, token) { 30228 if (token) { 30229 this.token = token; 30230 token.start = pos; 30231 token.lookAhead = pos + 1; 30232 token.value = token.extended = -1; 30233 } else { 30234 this.token = nullToken; 30235 } 30236 if (this.pos != pos) { 30237 this.pos = pos; 30238 if (pos == this.end) { 30239 this.setDone(); 30240 return this; 30241 } 30242 while (pos < this.range.from) 30243 this.range = this.ranges[--this.rangeIndex]; 30244 while (pos >= this.range.to) 30245 this.range = this.ranges[++this.rangeIndex]; 30246 if (pos >= this.chunkPos && pos < this.chunkPos + this.chunk.length) { 30247 this.chunkOff = pos - this.chunkPos; 30248 } else { 30249 this.chunk = ""; 30250 this.chunkOff = 0; 30251 } 30252 this.readNext(); 30253 } 30254 return this; 30255 } 30256 /** 30257 @internal 30258 */ 30259 read(from, to) { 30260 if (from >= this.chunkPos && to <= this.chunkPos + this.chunk.length) 30261 return this.chunk.slice(from - this.chunkPos, to - this.chunkPos); 30262 if (from >= this.chunk2Pos && to <= this.chunk2Pos + this.chunk2.length) 30263 return this.chunk2.slice(from - this.chunk2Pos, to - this.chunk2Pos); 30264 if (from >= this.range.from && to <= this.range.to) 30265 return this.input.read(from, to); 30266 let result = ""; 30267 for (let r2 of this.ranges) { 30268 if (r2.from >= to) 30269 break; 30270 if (r2.to > from) 30271 result += this.input.read(Math.max(r2.from, from), Math.min(r2.to, to)); 30272 } 30273 return result; 30274 } 30275}; 30276var TokenGroup = class { 30277 constructor(data, id2) { 30278 this.data = data; 30279 this.id = id2; 30280 } 30281 token(input, stack) { 30282 let { parser: parser10 } = stack.p; 30283 readToken2(this.data, input, stack, this.id, parser10.data, parser10.tokenPrecTable); 30284 } 30285}; 30286TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; 30287var LocalTokenGroup = class { 30288 constructor(data, precTable, elseToken) { 30289 this.precTable = precTable; 30290 this.elseToken = elseToken; 30291 this.data = typeof data == "string" ? decodeArray(data) : data; 30292 } 30293 token(input, stack) { 30294 let start = input.pos, skipped = 0; 30295 for (; ; ) { 30296 let atEof = input.next < 0, nextPos = input.resolveOffset(1, 1); 30297 readToken2(this.data, input, stack, 0, this.data, this.precTable); 30298 if (input.token.value > -1) 30299 break; 30300 if (this.elseToken == null) 30301 return; 30302 if (!atEof) 30303 skipped++; 30304 if (nextPos == null) 30305 break; 30306 input.reset(nextPos, input.token); 30307 } 30308 if (skipped) { 30309 input.reset(start, input.token); 30310 input.acceptToken(this.elseToken, skipped); 30311 } 30312 } 30313}; 30314LocalTokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; 30315var ExternalTokenizer = class { 30316 /** 30317 Create a tokenizer. The first argument is the function that, 30318 given an input stream, scans for the types of tokens it 30319 recognizes at the stream's position, and calls 30320 [`acceptToken`](#lr.InputStream.acceptToken) when it finds 30321 one. 30322 */ 30323 constructor(token, options2 = {}) { 30324 this.token = token; 30325 this.contextual = !!options2.contextual; 30326 this.fallback = !!options2.fallback; 30327 this.extend = !!options2.extend; 30328 } 30329}; 30330function readToken2(data, input, stack, group, precTable, precOffset) { 30331 let state = 0, groupMask = 1 << group, { dialect: dialect2 } = stack.p.parser; 30332 scan: 30333 for (; ; ) { 30334 if ((groupMask & data[state]) == 0) 30335 break; 30336 let accEnd = data[state + 1]; 30337 for (let i2 = state + 3; i2 < accEnd; i2 += 2) 30338 if ((data[i2 + 1] & groupMask) > 0) { 30339 let term = data[i2]; 30340 if (dialect2.allows(term) && (input.token.value == -1 || input.token.value == term || overrides(term, input.token.value, precTable, precOffset))) { 30341 input.acceptToken(term); 30342 break; 30343 } 30344 } 30345 let next = input.next, low = 0, high = data[state + 2]; 30346 if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535) { 30347 state = data[accEnd + high * 3 - 1]; 30348 continue scan; 30349 } 30350 for (; low < high; ) { 30351 let mid = low + high >> 1; 30352 let index = accEnd + mid + (mid << 1); 30353 let from = data[index], to = data[index + 1] || 65536; 30354 if (next < from) 30355 high = mid; 30356 else if (next >= to) 30357 low = mid + 1; 30358 else { 30359 state = data[index + 2]; 30360 input.advance(); 30361 continue scan; 30362 } 30363 } 30364 break; 30365 } 30366} 30367function findOffset(data, start, term) { 30368 for (let i2 = start, next; (next = data[i2]) != 65535; i2++) 30369 if (next == term) 30370 return i2 - start; 30371 return -1; 30372} 30373function overrides(token, prev, tableData, tableOffset) { 30374 let iPrev = findOffset(tableData, tableOffset, prev); 30375 return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev; 30376} 30377var verbose = typeof process != "undefined" && process.env && /\bparse\b/.test(process.env.LOG); 30378var stackIDs = null; 30379function cutAt(tree, pos, side) { 30380 let cursor = tree.cursor(IterMode.IncludeAnonymous); 30381 cursor.moveTo(pos); 30382 for (; ; ) { 30383 if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) 30384 for (; ; ) { 30385 if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) 30386 return side < 0 ? Math.max(0, Math.min( 30387 cursor.to - 1, 30388 pos - 25 30389 /* Lookahead.Margin */ 30390 )) : Math.min(tree.length, Math.max( 30391 cursor.from + 1, 30392 pos + 25 30393 /* Lookahead.Margin */ 30394 )); 30395 if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) 30396 break; 30397 if (!cursor.parent()) 30398 return side < 0 ? 0 : tree.length; 30399 } 30400 } 30401} 30402var FragmentCursor2 = class { 30403 constructor(fragments, nodeSet2) { 30404 this.fragments = fragments; 30405 this.nodeSet = nodeSet2; 30406 this.i = 0; 30407 this.fragment = null; 30408 this.safeFrom = -1; 30409 this.safeTo = -1; 30410 this.trees = []; 30411 this.start = []; 30412 this.index = []; 30413 this.nextFragment(); 30414 } 30415 nextFragment() { 30416 let fr = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; 30417 if (fr) { 30418 this.safeFrom = fr.openStart ? cutAt(fr.tree, fr.from + fr.offset, 1) - fr.offset : fr.from; 30419 this.safeTo = fr.openEnd ? cutAt(fr.tree, fr.to + fr.offset, -1) - fr.offset : fr.to; 30420 while (this.trees.length) { 30421 this.trees.pop(); 30422 this.start.pop(); 30423 this.index.pop(); 30424 } 30425 this.trees.push(fr.tree); 30426 this.start.push(-fr.offset); 30427 this.index.push(0); 30428 this.nextStart = this.safeFrom; 30429 } else { 30430 this.nextStart = 1e9; 30431 } 30432 } 30433 // `pos` must be >= any previously given `pos` for this cursor 30434 nodeAt(pos) { 30435 if (pos < this.nextStart) 30436 return null; 30437 while (this.fragment && this.safeTo <= pos) 30438 this.nextFragment(); 30439 if (!this.fragment) 30440 return null; 30441 for (; ; ) { 30442 let last = this.trees.length - 1; 30443 if (last < 0) { 30444 this.nextFragment(); 30445 return null; 30446 } 30447 let top2 = this.trees[last], index = this.index[last]; 30448 if (index == top2.children.length) { 30449 this.trees.pop(); 30450 this.start.pop(); 30451 this.index.pop(); 30452 continue; 30453 } 30454 let next = top2.children[index]; 30455 let start = this.start[last] + top2.positions[index]; 30456 if (start > pos) { 30457 this.nextStart = start; 30458 return null; 30459 } 30460 if (next instanceof Tree) { 30461 if (start == pos) { 30462 if (start < this.safeFrom) 30463 return null; 30464 let end = start + next.length; 30465 if (end <= this.safeTo) { 30466 let lookAhead = next.prop(NodeProp.lookAhead); 30467 if (!lookAhead || end + lookAhead < this.fragment.to) 30468 return next; 30469 } 30470 } 30471 this.index[last]++; 30472 if (start + next.length >= Math.max(this.safeFrom, pos)) { 30473 this.trees.push(next); 30474 this.start.push(start); 30475 this.index.push(0); 30476 } 30477 } else { 30478 this.index[last]++; 30479 this.nextStart = start + next.length; 30480 } 30481 } 30482 } 30483}; 30484var TokenCache = class { 30485 constructor(parser10, stream) { 30486 this.stream = stream; 30487 this.tokens = []; 30488 this.mainToken = null; 30489 this.actions = []; 30490 this.tokens = parser10.tokenizers.map((_2) => new CachedToken()); 30491 } 30492 getActions(stack) { 30493 let actionIndex = 0; 30494 let main = null; 30495 let { parser: parser10 } = stack.p, { tokenizers } = parser10; 30496 let mask = parser10.stateSlot( 30497 stack.state, 30498 3 30499 /* ParseState.TokenizerMask */ 30500 ); 30501 let context = stack.curContext ? stack.curContext.hash : 0; 30502 let lookAhead = 0; 30503 for (let i2 = 0; i2 < tokenizers.length; i2++) { 30504 if ((1 << i2 & mask) == 0) 30505 continue; 30506 let tokenizer = tokenizers[i2], token = this.tokens[i2]; 30507 if (main && !tokenizer.fallback) 30508 continue; 30509 if (tokenizer.contextual || token.start != stack.pos || token.mask != mask || token.context != context) { 30510 this.updateCachedToken(token, tokenizer, stack); 30511 token.mask = mask; 30512 token.context = context; 30513 } 30514 if (token.lookAhead > token.end + 25) 30515 lookAhead = Math.max(token.lookAhead, lookAhead); 30516 if (token.value != 0) { 30517 let startIndex = actionIndex; 30518 if (token.extended > -1) 30519 actionIndex = this.addActions(stack, token.extended, token.end, actionIndex); 30520 actionIndex = this.addActions(stack, token.value, token.end, actionIndex); 30521 if (!tokenizer.extend) { 30522 main = token; 30523 if (actionIndex > startIndex) 30524 break; 30525 } 30526 } 30527 } 30528 while (this.actions.length > actionIndex) 30529 this.actions.pop(); 30530 if (lookAhead) 30531 stack.setLookAhead(lookAhead); 30532 if (!main && stack.pos == this.stream.end) { 30533 main = new CachedToken(); 30534 main.value = stack.p.parser.eofTerm; 30535 main.start = main.end = stack.pos; 30536 actionIndex = this.addActions(stack, main.value, main.end, actionIndex); 30537 } 30538 this.mainToken = main; 30539 return this.actions; 30540 } 30541 getMainToken(stack) { 30542 if (this.mainToken) 30543 return this.mainToken; 30544 let main = new CachedToken(), { pos, p: p2 } = stack; 30545 main.start = pos; 30546 main.end = Math.min(pos + 1, p2.stream.end); 30547 main.value = pos == p2.stream.end ? p2.parser.eofTerm : 0; 30548 return main; 30549 } 30550 updateCachedToken(token, tokenizer, stack) { 30551 let start = this.stream.clipPos(stack.pos); 30552 tokenizer.token(this.stream.reset(start, token), stack); 30553 if (token.value > -1) { 30554 let { parser: parser10 } = stack.p; 30555 for (let i2 = 0; i2 < parser10.specialized.length; i2++) 30556 if (parser10.specialized[i2] == token.value) { 30557 let result = parser10.specializers[i2](this.stream.read(token.start, token.end), stack); 30558 if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) { 30559 if ((result & 1) == 0) 30560 token.value = result >> 1; 30561 else 30562 token.extended = result >> 1; 30563 break; 30564 } 30565 } 30566 } else { 30567 token.value = 0; 30568 token.end = this.stream.clipPos(start + 1); 30569 } 30570 } 30571 putAction(action, token, end, index) { 30572 for (let i2 = 0; i2 < index; i2 += 3) 30573 if (this.actions[i2] == action) 30574 return index; 30575 this.actions[index++] = action; 30576 this.actions[index++] = token; 30577 this.actions[index++] = end; 30578 return index; 30579 } 30580 addActions(stack, token, end, index) { 30581 let { state } = stack, { parser: parser10 } = stack.p, { data } = parser10; 30582 for (let set = 0; set < 2; set++) { 30583 for (let i2 = parser10.stateSlot( 30584 state, 30585 set ? 2 : 1 30586 /* ParseState.Actions */ 30587 ); ; i2 += 3) { 30588 if (data[i2] == 65535) { 30589 if (data[i2 + 1] == 1) { 30590 i2 = pair(data, i2 + 2); 30591 } else { 30592 if (index == 0 && data[i2 + 1] == 2) 30593 index = this.putAction(pair(data, i2 + 2), token, end, index); 30594 break; 30595 } 30596 } 30597 if (data[i2] == token) 30598 index = this.putAction(pair(data, i2 + 1), token, end, index); 30599 } 30600 } 30601 return index; 30602 } 30603}; 30604var Parse2 = class { 30605 constructor(parser10, input, fragments, ranges) { 30606 this.parser = parser10; 30607 this.input = input; 30608 this.ranges = ranges; 30609 this.recovering = 0; 30610 this.nextStackID = 9812; 30611 this.minStackPos = 0; 30612 this.reused = []; 30613 this.stoppedAt = null; 30614 this.lastBigReductionStart = -1; 30615 this.lastBigReductionSize = 0; 30616 this.bigReductionCount = 0; 30617 this.stream = new InputStream(input, ranges); 30618 this.tokens = new TokenCache(parser10, this.stream); 30619 this.topTerm = parser10.top[1]; 30620 let { from } = ranges[0]; 30621 this.stacks = [Stack.start(this, parser10.top[0], from)]; 30622 this.fragments = fragments.length && this.stream.end - from > parser10.bufferLength * 4 ? new FragmentCursor2(fragments, parser10.nodeSet) : null; 30623 } 30624 get parsedPos() { 30625 return this.minStackPos; 30626 } 30627 // Move the parser forward. This will process all parse stacks at 30628 // `this.pos` and try to advance them to a further position. If no 30629 // stack for such a position is found, it'll start error-recovery. 30630 // 30631 // When the parse is finished, this will return a syntax tree. When 30632 // not, it returns `null`. 30633 advance() { 30634 let stacks = this.stacks, pos = this.minStackPos; 30635 let newStacks = this.stacks = []; 30636 let stopped, stoppedTokens; 30637 if (this.bigReductionCount > 300 && stacks.length == 1) { 30638 let [s2] = stacks; 30639 while (s2.forceReduce() && s2.stack.length && s2.stack[s2.stack.length - 2] >= this.lastBigReductionStart) { 30640 } 30641 this.bigReductionCount = this.lastBigReductionSize = 0; 30642 } 30643 for (let i2 = 0; i2 < stacks.length; i2++) { 30644 let stack = stacks[i2]; 30645 for (; ; ) { 30646 this.tokens.mainToken = null; 30647 if (stack.pos > pos) { 30648 newStacks.push(stack); 30649 } else if (this.advanceStack(stack, newStacks, stacks)) { 30650 continue; 30651 } else { 30652 if (!stopped) { 30653 stopped = []; 30654 stoppedTokens = []; 30655 } 30656 stopped.push(stack); 30657 let tok = this.tokens.getMainToken(stack); 30658 stoppedTokens.push(tok.value, tok.end); 30659 } 30660 break; 30661 } 30662 } 30663 if (!newStacks.length) { 30664 let finished = stopped && findFinished(stopped); 30665 if (finished) { 30666 if (verbose) 30667 console.log("Finish with " + this.stackID(finished)); 30668 return this.stackToTree(finished); 30669 } 30670 if (this.parser.strict) { 30671 if (verbose && stopped) 30672 console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")); 30673 throw new SyntaxError("No parse at " + pos); 30674 } 30675 if (!this.recovering) 30676 this.recovering = 5; 30677 } 30678 if (this.recovering && stopped) { 30679 let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0] : this.runRecovery(stopped, stoppedTokens, newStacks); 30680 if (finished) { 30681 if (verbose) 30682 console.log("Force-finish " + this.stackID(finished)); 30683 return this.stackToTree(finished.forceAll()); 30684 } 30685 } 30686 if (this.recovering) { 30687 let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3; 30688 if (newStacks.length > maxRemaining) { 30689 newStacks.sort((a2, b3) => b3.score - a2.score); 30690 while (newStacks.length > maxRemaining) 30691 newStacks.pop(); 30692 } 30693 if (newStacks.some((s2) => s2.reducePos > pos)) 30694 this.recovering--; 30695 } else if (newStacks.length > 1) { 30696 outer: 30697 for (let i2 = 0; i2 < newStacks.length - 1; i2++) { 30698 let stack = newStacks[i2]; 30699 for (let j3 = i2 + 1; j3 < newStacks.length; j3++) { 30700 let other = newStacks[j3]; 30701 if (stack.sameState(other) || stack.buffer.length > 500 && other.buffer.length > 500) { 30702 if ((stack.score - other.score || stack.buffer.length - other.buffer.length) > 0) { 30703 newStacks.splice(j3--, 1); 30704 } else { 30705 newStacks.splice(i2--, 1); 30706 continue outer; 30707 } 30708 } 30709 } 30710 } 30711 if (newStacks.length > 12) 30712 newStacks.splice( 30713 12, 30714 newStacks.length - 12 30715 /* Rec.MaxStackCount */ 30716 ); 30717 } 30718 this.minStackPos = newStacks[0].pos; 30719 for (let i2 = 1; i2 < newStacks.length; i2++) 30720 if (newStacks[i2].pos < this.minStackPos) 30721 this.minStackPos = newStacks[i2].pos; 30722 return null; 30723 } 30724 stopAt(pos) { 30725 if (this.stoppedAt != null && this.stoppedAt < pos) 30726 throw new RangeError("Can't move stoppedAt forward"); 30727 this.stoppedAt = pos; 30728 } 30729 // Returns an updated version of the given stack, or null if the 30730 // stack can't advance normally. When `split` and `stacks` are 30731 // given, stacks split off by ambiguous operations will be pushed to 30732 // `split`, or added to `stacks` if they move `pos` forward. 30733 advanceStack(stack, stacks, split) { 30734 let start = stack.pos, { parser: parser10 } = this; 30735 let base2 = verbose ? this.stackID(stack) + " -> " : ""; 30736 if (this.stoppedAt != null && start > this.stoppedAt) 30737 return stack.forceReduce() ? stack : null; 30738 if (this.fragments) { 30739 let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0; 30740 for (let cached = this.fragments.nodeAt(start); cached; ) { 30741 let match = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser10.getGoto(stack.state, cached.type.id) : -1; 30742 if (match > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) { 30743 stack.useNode(cached, match); 30744 if (verbose) 30745 console.log(base2 + this.stackID(stack) + ` (via reuse of ${parser10.getName(cached.type.id)})`); 30746 return true; 30747 } 30748 if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0) 30749 break; 30750 let inner = cached.children[0]; 30751 if (inner instanceof Tree && cached.positions[0] == 0) 30752 cached = inner; 30753 else 30754 break; 30755 } 30756 } 30757 let defaultReduce = parser10.stateSlot( 30758 stack.state, 30759 4 30760 /* ParseState.DefaultReduce */ 30761 ); 30762 if (defaultReduce > 0) { 30763 stack.reduce(defaultReduce); 30764 if (verbose) 30765 console.log(base2 + this.stackID(stack) + ` (via always-reduce ${parser10.getName( 30766 defaultReduce & 65535 30767 /* Action.ValueMask */ 30768 )})`); 30769 return true; 30770 } 30771 if (stack.stack.length >= 8400) { 30772 while (stack.stack.length > 6e3 && stack.forceReduce()) { 30773 } 30774 } 30775 let actions = this.tokens.getActions(stack); 30776 for (let i2 = 0; i2 < actions.length; ) { 30777 let action = actions[i2++], term = actions[i2++], end = actions[i2++]; 30778 let last = i2 == actions.length || !split; 30779 let localStack = last ? stack : stack.split(); 30780 let main = this.tokens.mainToken; 30781 localStack.apply(action, term, main ? main.start : localStack.pos, end); 30782 if (verbose) 30783 console.log(base2 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser10.getName( 30784 action & 65535 30785 /* Action.ValueMask */ 30786 )}`} for ${parser10.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`); 30787 if (last) 30788 return true; 30789 else if (localStack.pos > start) 30790 stacks.push(localStack); 30791 else 30792 split.push(localStack); 30793 } 30794 return false; 30795 } 30796 // Advance a given stack forward as far as it will go. Returns the 30797 // (possibly updated) stack if it got stuck, or null if it moved 30798 // forward and was given to `pushStackDedup`. 30799 advanceFully(stack, newStacks) { 30800 let pos = stack.pos; 30801 for (; ; ) { 30802 if (!this.advanceStack(stack, null, null)) 30803 return false; 30804 if (stack.pos > pos) { 30805 pushStackDedup(stack, newStacks); 30806 return true; 30807 } 30808 } 30809 } 30810 runRecovery(stacks, tokens2, newStacks) { 30811 let finished = null, restarted = false; 30812 for (let i2 = 0; i2 < stacks.length; i2++) { 30813 let stack = stacks[i2], token = tokens2[i2 << 1], tokenEnd = tokens2[(i2 << 1) + 1]; 30814 let base2 = verbose ? this.stackID(stack) + " -> " : ""; 30815 if (stack.deadEnd) { 30816 if (restarted) 30817 continue; 30818 restarted = true; 30819 stack.restart(); 30820 if (verbose) 30821 console.log(base2 + this.stackID(stack) + " (restarted)"); 30822 let done = this.advanceFully(stack, newStacks); 30823 if (done) 30824 continue; 30825 } 30826 let force = stack.split(), forceBase = base2; 30827 for (let j3 = 0; force.forceReduce() && j3 < 10; j3++) { 30828 if (verbose) 30829 console.log(forceBase + this.stackID(force) + " (via force-reduce)"); 30830 let done = this.advanceFully(force, newStacks); 30831 if (done) 30832 break; 30833 if (verbose) 30834 forceBase = this.stackID(force) + " -> "; 30835 } 30836 for (let insert2 of stack.recoverByInsert(token)) { 30837 if (verbose) 30838 console.log(base2 + this.stackID(insert2) + " (via recover-insert)"); 30839 this.advanceFully(insert2, newStacks); 30840 } 30841 if (this.stream.end > stack.pos) { 30842 if (tokenEnd == stack.pos) { 30843 tokenEnd++; 30844 token = 0; 30845 } 30846 stack.recoverByDelete(token, tokenEnd); 30847 if (verbose) 30848 console.log(base2 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`); 30849 pushStackDedup(stack, newStacks); 30850 } else if (!finished || finished.score < stack.score) { 30851 finished = stack; 30852 } 30853 } 30854 return finished; 30855 } 30856 // Convert the stack's buffer to a syntax tree. 30857 stackToTree(stack) { 30858 stack.close(); 30859 return Tree.build({ 30860 buffer: StackBufferCursor.create(stack), 30861 nodeSet: this.parser.nodeSet, 30862 topID: this.topTerm, 30863 maxBufferLength: this.parser.bufferLength, 30864 reused: this.reused, 30865 start: this.ranges[0].from, 30866 length: stack.pos - this.ranges[0].from, 30867 minRepeatType: this.parser.minRepeatTerm 30868 }); 30869 } 30870 stackID(stack) { 30871 let id2 = (stackIDs || (stackIDs = /* @__PURE__ */ new WeakMap())).get(stack); 30872 if (!id2) 30873 stackIDs.set(stack, id2 = String.fromCodePoint(this.nextStackID++)); 30874 return id2 + stack; 30875 } 30876}; 30877function pushStackDedup(stack, newStacks) { 30878 for (let i2 = 0; i2 < newStacks.length; i2++) { 30879 let other = newStacks[i2]; 30880 if (other.pos == stack.pos && other.sameState(stack)) { 30881 if (newStacks[i2].score < stack.score) 30882 newStacks[i2] = stack; 30883 return; 30884 } 30885 } 30886 newStacks.push(stack); 30887} 30888var Dialect = class { 30889 constructor(source, flags, disabled) { 30890 this.source = source; 30891 this.flags = flags; 30892 this.disabled = disabled; 30893 } 30894 allows(term) { 30895 return !this.disabled || this.disabled[term] == 0; 30896 } 30897}; 30898var id = (x) => x; 30899var ContextTracker = class { 30900 /** 30901 Define a context tracker. 30902 */ 30903 constructor(spec) { 30904 this.start = spec.start; 30905 this.shift = spec.shift || id; 30906 this.reduce = spec.reduce || id; 30907 this.reuse = spec.reuse || id; 30908 this.hash = spec.hash || (() => 0); 30909 this.strict = spec.strict !== false; 30910 } 30911}; 30912var LRParser = class _LRParser extends Parser { 30913 /** 30914 @internal 30915 */ 30916 constructor(spec) { 30917 super(); 30918 this.wrappers = []; 30919 if (spec.version != 14) 30920 throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14})`); 30921 let nodeNames = spec.nodeNames.split(" "); 30922 this.minRepeatTerm = nodeNames.length; 30923 for (let i2 = 0; i2 < spec.repeatNodeCount; i2++) 30924 nodeNames.push(""); 30925 let topTerms = Object.keys(spec.topRules).map((r2) => spec.topRules[r2][1]); 30926 let nodeProps = []; 30927 for (let i2 = 0; i2 < nodeNames.length; i2++) 30928 nodeProps.push([]); 30929 function setProp(nodeID, prop, value) { 30930 nodeProps[nodeID].push([prop, prop.deserialize(String(value))]); 30931 } 30932 if (spec.nodeProps) 30933 for (let propSpec of spec.nodeProps) { 30934 let prop = propSpec[0]; 30935 if (typeof prop == "string") 30936 prop = NodeProp[prop]; 30937 for (let i2 = 1; i2 < propSpec.length; ) { 30938 let next = propSpec[i2++]; 30939 if (next >= 0) { 30940 setProp(next, prop, propSpec[i2++]); 30941 } else { 30942 let value = propSpec[i2 + -next]; 30943 for (let j3 = -next; j3 > 0; j3--) 30944 setProp(propSpec[i2++], prop, value); 30945 i2++; 30946 } 30947 } 30948 } 30949 this.nodeSet = new NodeSet(nodeNames.map((name2, i2) => NodeType.define({ 30950 name: i2 >= this.minRepeatTerm ? void 0 : name2, 30951 id: i2, 30952 props: nodeProps[i2], 30953 top: topTerms.indexOf(i2) > -1, 30954 error: i2 == 0, 30955 skipped: spec.skippedNodes && spec.skippedNodes.indexOf(i2) > -1 30956 }))); 30957 if (spec.propSources) 30958 this.nodeSet = this.nodeSet.extend(...spec.propSources); 30959 this.strict = false; 30960 this.bufferLength = DefaultBufferLength; 30961 let tokenArray = decodeArray(spec.tokenData); 30962 this.context = spec.context; 30963 this.specializerSpecs = spec.specialized || []; 30964 this.specialized = new Uint16Array(this.specializerSpecs.length); 30965 for (let i2 = 0; i2 < this.specializerSpecs.length; i2++) 30966 this.specialized[i2] = this.specializerSpecs[i2].term; 30967 this.specializers = this.specializerSpecs.map(getSpecializer); 30968 this.states = decodeArray(spec.states, Uint32Array); 30969 this.data = decodeArray(spec.stateData); 30970 this.goto = decodeArray(spec.goto); 30971 this.maxTerm = spec.maxTerm; 30972 this.tokenizers = spec.tokenizers.map((value) => typeof value == "number" ? new TokenGroup(tokenArray, value) : value); 30973 this.topRules = spec.topRules; 30974 this.dialects = spec.dialects || {}; 30975 this.dynamicPrecedences = spec.dynamicPrecedences || null; 30976 this.tokenPrecTable = spec.tokenPrec; 30977 this.termNames = spec.termNames || null; 30978 this.maxNode = this.nodeSet.types.length - 1; 30979 this.dialect = this.parseDialect(); 30980 this.top = this.topRules[Object.keys(this.topRules)[0]]; 30981 } 30982 createParse(input, fragments, ranges) { 30983 let parse = new Parse2(this, input, fragments, ranges); 30984 for (let w2 of this.wrappers) 30985 parse = w2(parse, input, fragments, ranges); 30986 return parse; 30987 } 30988 /** 30989 Get a goto table entry @internal 30990 */ 30991 getGoto(state, term, loose = false) { 30992 let table = this.goto; 30993 if (term >= table[0]) 30994 return -1; 30995 for (let pos = table[term + 1]; ; ) { 30996 let groupTag = table[pos++], last = groupTag & 1; 30997 let target = table[pos++]; 30998 if (last && loose) 30999 return target; 31000 for (let end = pos + (groupTag >> 1); pos < end; pos++) 31001 if (table[pos] == state) 31002 return target; 31003 if (last) 31004 return -1; 31005 } 31006 } 31007 /** 31008 Check if this state has an action for a given terminal @internal 31009 */ 31010 hasAction(state, terminal) { 31011 let data = this.data; 31012 for (let set = 0; set < 2; set++) { 31013 for (let i2 = this.stateSlot( 31014 state, 31015 set ? 2 : 1 31016 /* ParseState.Actions */ 31017 ), next; ; i2 += 3) { 31018 if ((next = data[i2]) == 65535) { 31019 if (data[i2 + 1] == 1) 31020 next = data[i2 = pair(data, i2 + 2)]; 31021 else if (data[i2 + 1] == 2) 31022 return pair(data, i2 + 2); 31023 else 31024 break; 31025 } 31026 if (next == terminal || next == 0) 31027 return pair(data, i2 + 1); 31028 } 31029 } 31030 return 0; 31031 } 31032 /** 31033 @internal 31034 */ 31035 stateSlot(state, slot) { 31036 return this.states[state * 6 + slot]; 31037 } 31038 /** 31039 @internal 31040 */ 31041 stateFlag(state, flag) { 31042 return (this.stateSlot( 31043 state, 31044 0 31045 /* ParseState.Flags */ 31046 ) & flag) > 0; 31047 } 31048 /** 31049 @internal 31050 */ 31051 validAction(state, action) { 31052 return !!this.allActions(state, (a2) => a2 == action ? true : null); 31053 } 31054 /** 31055 @internal 31056 */ 31057 allActions(state, action) { 31058 let deflt = this.stateSlot( 31059 state, 31060 4 31061 /* ParseState.DefaultReduce */ 31062 ); 31063 let result = deflt ? action(deflt) : void 0; 31064 for (let i2 = this.stateSlot( 31065 state, 31066 1 31067 /* ParseState.Actions */ 31068 ); result == null; i2 += 3) { 31069 if (this.data[i2] == 65535) { 31070 if (this.data[i2 + 1] == 1) 31071 i2 = pair(this.data, i2 + 2); 31072 else 31073 break; 31074 } 31075 result = action(pair(this.data, i2 + 1)); 31076 } 31077 return result; 31078 } 31079 /** 31080 Get the states that can follow this one through shift actions or 31081 goto jumps. @internal 31082 */ 31083 nextStates(state) { 31084 let result = []; 31085 for (let i2 = this.stateSlot( 31086 state, 31087 1 31088 /* ParseState.Actions */ 31089 ); ; i2 += 3) { 31090 if (this.data[i2] == 65535) { 31091 if (this.data[i2 + 1] == 1) 31092 i2 = pair(this.data, i2 + 2); 31093 else 31094 break; 31095 } 31096 if ((this.data[i2 + 2] & 65536 >> 16) == 0) { 31097 let value = this.data[i2 + 1]; 31098 if (!result.some((v2, i3) => i3 & 1 && v2 == value)) 31099 result.push(this.data[i2], value); 31100 } 31101 } 31102 return result; 31103 } 31104 /** 31105 Configure the parser. Returns a new parser instance that has the 31106 given settings modified. Settings not provided in `config` are 31107 kept from the original parser. 31108 */ 31109 configure(config2) { 31110 let copy = Object.assign(Object.create(_LRParser.prototype), this); 31111 if (config2.props) 31112 copy.nodeSet = this.nodeSet.extend(...config2.props); 31113 if (config2.top) { 31114 let info = this.topRules[config2.top]; 31115 if (!info) 31116 throw new RangeError(`Invalid top rule name ${config2.top}`); 31117 copy.top = info; 31118 } 31119 if (config2.tokenizers) 31120 copy.tokenizers = this.tokenizers.map((t3) => { 31121 let found = config2.tokenizers.find((r2) => r2.from == t3); 31122 return found ? found.to : t3; 31123 }); 31124 if (config2.specializers) { 31125 copy.specializers = this.specializers.slice(); 31126 copy.specializerSpecs = this.specializerSpecs.map((s2, i2) => { 31127 let found = config2.specializers.find((r2) => r2.from == s2.external); 31128 if (!found) 31129 return s2; 31130 let spec = Object.assign(Object.assign({}, s2), { external: found.to }); 31131 copy.specializers[i2] = getSpecializer(spec); 31132 return spec; 31133 }); 31134 } 31135 if (config2.contextTracker) 31136 copy.context = config2.contextTracker; 31137 if (config2.dialect) 31138 copy.dialect = this.parseDialect(config2.dialect); 31139 if (config2.strict != null) 31140 copy.strict = config2.strict; 31141 if (config2.wrap) 31142 copy.wrappers = copy.wrappers.concat(config2.wrap); 31143 if (config2.bufferLength != null) 31144 copy.bufferLength = config2.bufferLength; 31145 return copy; 31146 } 31147 /** 31148 Tells you whether any [parse wrappers](#lr.ParserConfig.wrap) 31149 are registered for this parser. 31150 */ 31151 hasWrappers() { 31152 return this.wrappers.length > 0; 31153 } 31154 /** 31155 Returns the name associated with a given term. This will only 31156 work for all terms when the parser was generated with the 31157 `--names` option. By default, only the names of tagged terms are 31158 stored. 31159 */ 31160 getName(term) { 31161 return this.termNames ? this.termNames[term] : String(term <= this.maxNode && this.nodeSet.types[term].name || term); 31162 } 31163 /** 31164 The eof term id is always allocated directly after the node 31165 types. @internal 31166 */ 31167 get eofTerm() { 31168 return this.maxNode + 1; 31169 } 31170 /** 31171 The type of top node produced by the parser. 31172 */ 31173 get topNode() { 31174 return this.nodeSet.types[this.top[1]]; 31175 } 31176 /** 31177 @internal 31178 */ 31179 dynamicPrecedence(term) { 31180 let prec2 = this.dynamicPrecedences; 31181 return prec2 == null ? 0 : prec2[term] || 0; 31182 } 31183 /** 31184 @internal 31185 */ 31186 parseDialect(dialect2) { 31187 let values2 = Object.keys(this.dialects), flags = values2.map(() => false); 31188 if (dialect2) 31189 for (let part of dialect2.split(" ")) { 31190 let id2 = values2.indexOf(part); 31191 if (id2 >= 0) 31192 flags[id2] = true; 31193 } 31194 let disabled = null; 31195 for (let i2 = 0; i2 < values2.length; i2++) 31196 if (!flags[i2]) { 31197 for (let j3 = this.dialects[values2[i2]], id2; (id2 = this.data[j3++]) != 65535; ) 31198 (disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id2] = 1; 31199 } 31200 return new Dialect(dialect2, flags, disabled); 31201 } 31202 /** 31203 Used by the output of the parser generator. Not available to 31204 user code. @hide 31205 */ 31206 static deserialize(spec) { 31207 return new _LRParser(spec); 31208 } 31209}; 31210function pair(data, off) { 31211 return data[off] | data[off + 1] << 16; 31212} 31213function findFinished(stacks) { 31214 let best = null; 31215 for (let stack of stacks) { 31216 let stopped = stack.p.stoppedAt; 31217 if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) && stack.p.parser.stateFlag( 31218 stack.state, 31219 2 31220 /* StateFlag.Accepting */ 31221 ) && (!best || best.score < stack.score)) 31222 best = stack; 31223 } 31224 return best; 31225} 31226function getSpecializer(spec) { 31227 if (spec.external) { 31228 let mask = spec.extend ? 1 : 0; 31229 return (value, stack) => spec.external(value, stack) << 1 | mask; 31230 } 31231 return spec.get; 31232} 31233
vendor: 13,357 bytes, lines 31234-31384
31234// node_modules/@lezer/css/dist/index.js 31235var descendantOp = 96; 31236var Unit = 1; 31237var callee = 97; 31238var identifier = 98; 31239var VariableName = 2; 31240var space = [ 31241 9, 31242 10, 31243 11, 31244 12, 31245 13, 31246 32, 31247 133, 31248 160, 31249 5760, 31250 8192, 31251 8193, 31252 8194, 31253 8195, 31254 8196, 31255 8197, 31256 8198, 31257 8199, 31258 8200, 31259 8201, 31260 8202, 31261 8232, 31262 8233, 31263 8239, 31264 8287, 31265 12288 31266]; 31267var colon = 58; 31268var parenL = 40; 31269var underscore = 95; 31270var bracketL = 91; 31271var dash = 45; 31272var period = 46; 31273var hash = 35; 31274var percent = 37; 31275var ampersand = 38; 31276var backslash = 92; 31277var newline = 10; 31278function isAlpha(ch) { 31279 return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161; 31280} 31281function isDigit(ch) { 31282 return ch >= 48 && ch <= 57; 31283} 31284var identifiers = new ExternalTokenizer((input, stack) => { 31285 for (let inside2 = false, dashes = 0, i2 = 0; ; i2++) { 31286 let { next } = input; 31287 if (isAlpha(next) || next == dash || next == underscore || inside2 && isDigit(next)) { 31288 if (!inside2 && (next != dash || i2 > 0)) 31289 inside2 = true; 31290 if (dashes === i2 && next == dash) 31291 dashes++; 31292 input.advance(); 31293 } else if (next == backslash && input.peek(1) != newline) { 31294 input.advance(); 31295 if (input.next > -1) 31296 input.advance(); 31297 inside2 = true; 31298 } else { 31299 if (inside2) 31300 input.acceptToken(next == parenL ? callee : dashes == 2 && stack.canShift(VariableName) ? VariableName : identifier); 31301 break; 31302 } 31303 } 31304}); 31305var descendant = new ExternalTokenizer((input) => { 31306 if (space.includes(input.peek(-1))) { 31307 let { next } = input; 31308 if (isAlpha(next) || next == underscore || next == hash || next == period || next == bracketL || next == colon || next == dash || next == ampersand) 31309 input.acceptToken(descendantOp); 31310 } 31311}); 31312var unitToken = new ExternalTokenizer((input) => { 31313 if (!space.includes(input.peek(-1))) { 31314 let { next } = input; 31315 if (next == percent) { 31316 input.advance(); 31317 input.acceptToken(Unit); 31318 } 31319 if (isAlpha(next)) { 31320 do { 31321 input.advance(); 31322 } while (isAlpha(input.next)); 31323 input.acceptToken(Unit); 31324 } 31325 } 31326}); 31327var cssHighlighting = styleTags({ 31328 "AtKeyword import charset namespace keyframes media supports": tags.definitionKeyword, 31329 "from to selector": tags.keyword, 31330 NamespaceName: tags.namespace, 31331 KeyframeName: tags.labelName, 31332 KeyframeRangeName: tags.operatorKeyword, 31333 TagName: tags.tagName, 31334 ClassName: tags.className, 31335 PseudoClassName: tags.constant(tags.className), 31336 IdName: tags.labelName, 31337 "FeatureName PropertyName": tags.propertyName, 31338 AttributeName: tags.attributeName, 31339 NumberLiteral: tags.number, 31340 KeywordQuery: tags.keyword, 31341 UnaryQueryOp: tags.operatorKeyword, 31342 "CallTag ValueName": tags.atom, 31343 VariableName: tags.variableName, 31344 Callee: tags.operatorKeyword, 31345 Unit: tags.unit, 31346 "UniversalSelector NestingSelector": tags.definitionOperator, 31347 MatchOp: tags.compareOperator, 31348 "ChildOp SiblingOp, LogicOp": tags.logicOperator, 31349 BinOp: tags.arithmeticOperator, 31350 Important: tags.modifier, 31351 Comment: tags.blockComment, 31352 ColorLiteral: tags.color, 31353 "ParenthesizedContent StringLiteral": tags.string, 31354 ":": tags.punctuation, 31355 "PseudoOp #": tags.derefOperator, 31356 "; ,": tags.separator, 31357 "( )": tags.paren, 31358 "[ ]": tags.squareBracket, 31359 "{ }": tags.brace 31360}); 31361var spec_callee = { __proto__: null, lang: 32, "nth-child": 32, "nth-last-child": 32, "nth-of-type": 32, "nth-last-of-type": 32, dir: 32, "host-context": 32, url: 60, "url-prefix": 60, domain: 60, regexp: 60, selector: 134 }; 31362var spec_AtKeyword = { __proto__: null, "@import": 114, "@media": 138, "@charset": 142, "@namespace": 146, "@keyframes": 152, "@supports": 164 }; 31363var spec_identifier = { __proto__: null, not: 128, only: 128 }; 31364var parser = LRParser.deserialize({ 31365 version: 14, 31366 states: "9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ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j!iQ#k!jQ$t$^R%Q$sSgPwQ!ohQ#m!mR$e#nZfPhw!m#na!a[`a!V!]!_#_#`R#]!]R!f^R!h_R#i!hS$^#h$_R%O$rV$[#h$_$rQ!qjR#q!qQdOShPwU!kdh#nR#n!mQ#z#RU$i#z$o${Q$o$RR${$jQ$k#zR$|$kQpUS!up$gR$g#wQ$c#lR$x$cQ!ngS#o!n#pR#p!oQ#a!^R$V#aQ$_#hR$u$_Q$s$^R%P$s_cOPdhw!m#n^UOPdhw!m#nQ!toQ!|tQ!}uQ#OvQ#w#QR$W#cR#{#RQ!VZQ!c]Q#U!TQ#l!l[#y#R#z$R$j$o${Q#|#TQ$O#WS$a#l$cQ$f#uR$w$bR#x#QQiPR#PwQ!b[Q!jaR#X!VU!^[a!VQ!i`Q#^!]Q#b!_Q$T#_R$U#`", 31369 nodeNames: "\u26A0 Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports AtRule Styles", 31370 maxTerm: 114, 31371 nodeProps: [ 31372 ["openedBy", 17, "(", 48, "{"], 31373 ["closedBy", 18, ")", 49, "}"] 31374 ], 31375 propSources: [cssHighlighting], 31376 skippedNodes: [0, 3, 85], 31377 repeatNodeCount: 10, 31378 tokenData: "J^~R!^OX$}X^%u^p$}pq%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%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS|Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!YQo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bFfSxQOy%^z;'S%^;'S;=`%o<%lO%^lFwSv[Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!`Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!RUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!Q^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!PQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}", 31379 tokenizers: [descendant, unitToken, identifiers, 1, 2, 3, 4, new LocalTokenGroup("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~", 28, 102)], 31380 topRules: { "StyleSheet": [0, 4], "Styles": [1, 84] }, 31381 specialized: [{ term: 97, get: (value) => spec_callee[value] || -1 }, { term: 56, get: (value) => spec_AtKeyword[value] || -1 }, { term: 98, get: (value) => spec_identifier[value] || -1 }], 31382 tokenPrec: 1169 31383}); 31384
vendor: 15,359 bytes, lines 31385-32222
31385// node_modules/@codemirror/lang-css/dist/index.js 31386var _properties = null; 31387function properties() { 31388 if (!_properties && typeof document == "object" && document.body) { 31389 let { style } = document.body, names = [], seen = /* @__PURE__ */ new Set(); 31390 for (let prop in style) 31391 if (prop != "cssText" && prop != "cssFloat") { 31392 if (typeof style[prop] == "string") { 31393 if (/[A-Z]/.test(prop)) 31394 prop = prop.replace(/[A-Z]/g, (ch) => "-" + ch.toLowerCase()); 31395 if (!seen.has(prop)) { 31396 names.push(prop); 31397 seen.add(prop); 31398 } 31399 } 31400 } 31401 _properties = names.sort().map((name2) => ({ type: "property", label: name2 })); 31402 } 31403 return _properties || []; 31404} 31405var pseudoClasses = /* @__PURE__ */ [ 31406 "active", 31407 "after", 31408 "any-link", 31409 "autofill", 31410 "backdrop", 31411 "before", 31412 "checked", 31413 "cue", 31414 "default", 31415 "defined", 31416 "disabled", 31417 "empty", 31418 "enabled", 31419 "file-selector-button", 31420 "first", 31421 "first-child", 31422 "first-letter", 31423 "first-line", 31424 "first-of-type", 31425 "focus", 31426 "focus-visible", 31427 "focus-within", 31428 "fullscreen", 31429 "has", 31430 "host", 31431 "host-context", 31432 "hover", 31433 "in-range", 31434 "indeterminate", 31435 "invalid", 31436 "is", 31437 "lang", 31438 "last-child", 31439 "last-of-type", 31440 "left", 31441 "link", 31442 "marker", 31443 "modal", 31444 "not", 31445 "nth-child", 31446 "nth-last-child", 31447 "nth-last-of-type", 31448 "nth-of-type", 31449 "only-child", 31450 "only-of-type", 31451 "optional", 31452 "out-of-range", 31453 "part", 31454 "placeholder", 31455 "placeholder-shown", 31456 "read-only", 31457 "read-write", 31458 "required", 31459 "right", 31460 "root", 31461 "scope", 31462 "selection", 31463 "slotted", 31464 "target", 31465 "target-text", 31466 "valid", 31467 "visited", 31468 "where" 31469].map((name2) => ({ type: "class", label: name2 })); 31470var values = /* @__PURE__ */ [ 31471 "above", 31472 "absolute", 31473 "activeborder", 31474 "additive", 31475 "activecaption", 31476 "after-white-space", 31477 "ahead", 31478 "alias", 31479 "all", 31480 "all-scroll", 31481 "alphabetic", 31482 "alternate", 31483 "always", 31484 "antialiased", 31485 "appworkspace", 31486 "asterisks", 31487 "attr", 31488 "auto", 31489 "auto-flow", 31490 "avoid", 31491 "avoid-column", 31492 "avoid-page", 31493 "avoid-region", 31494 "axis-pan", 31495 "background", 31496 "backwards", 31497 "baseline", 31498 "below", 31499 "bidi-override", 31500 "blink", 31501 "block", 31502 "block-axis", 31503 "bold", 31504 "bolder", 31505 "border", 31506 "border-box", 31507 "both", 31508 "bottom", 31509 "break", 31510 "break-all", 31511 "break-word", 31512 "bullets", 31513 "button", 31514 "button-bevel", 31515 "buttonface", 31516 "buttonhighlight", 31517 "buttonshadow", 31518 "buttontext", 31519 "calc", 31520 "capitalize", 31521 "caps-lock-indicator", 31522 "caption", 31523 "captiontext", 31524 "caret", 31525 "cell", 31526 "center", 31527 "checkbox", 31528 "circle", 31529 "cjk-decimal", 31530 "clear", 31531 "clip", 31532 "close-quote", 31533 "col-resize", 31534 "collapse", 31535 "color", 31536 "color-burn", 31537 "color-dodge", 31538 "column", 31539 "column-reverse", 31540 "compact", 31541 "condensed", 31542 "contain", 31543 "content", 31544 "contents", 31545 "content-box", 31546 "context-menu", 31547 "continuous", 31548 "copy", 31549 "counter", 31550 "counters", 31551 "cover", 31552 "crop", 31553 "cross", 31554 "crosshair", 31555 "currentcolor", 31556 "cursive", 31557 "cyclic", 31558 "darken", 31559 "dashed", 31560 "decimal", 31561 "decimal-leading-zero", 31562 "default", 31563 "default-button", 31564 "dense", 31565 "destination-atop", 31566 "destination-in", 31567 "destination-out", 31568 "destination-over", 31569 "difference", 31570 "disc", 31571 "discard", 31572 "disclosure-closed", 31573 "disclosure-open", 31574 "document", 31575 "dot-dash", 31576 "dot-dot-dash", 31577 "dotted", 31578 "double", 31579 "down", 31580 "e-resize", 31581 "ease", 31582 "ease-in", 31583 "ease-in-out", 31584 "ease-out", 31585 "element", 31586 "ellipse", 31587 "ellipsis", 31588 "embed", 31589 "end", 31590 "ethiopic-abegede-gez", 31591 "ethiopic-halehame-aa-er", 31592 "ethiopic-halehame-gez", 31593 "ew-resize", 31594 "exclusion", 31595 "expanded", 31596 "extends", 31597 "extra-condensed", 31598 "extra-expanded", 31599 "fantasy", 31600 "fast", 31601 "fill", 31602 "fill-box", 31603 "fixed", 31604 "flat", 31605 "flex", 31606 "flex-end", 31607 "flex-start", 31608 "footnotes", 31609 "forwards", 31610 "from", 31611 "geometricPrecision", 31612 "graytext", 31613 "grid", 31614 "groove", 31615 "hand", 31616 "hard-light", 31617 "help", 31618 "hidden", 31619 "hide", 31620 "higher", 31621 "highlight", 31622 "highlighttext", 31623 "horizontal", 31624 "hsl", 31625 "hsla", 31626 "hue", 31627 "icon", 31628 "ignore", 31629 "inactiveborder", 31630 "inactivecaption", 31631 "inactivecaptiontext", 31632 "infinite", 31633 "infobackground", 31634 "infotext", 31635 "inherit", 31636 "initial", 31637 "inline", 31638 "inline-axis", 31639 "inline-block", 31640 "inline-flex", 31641 "inline-grid", 31642 "inline-table", 31643 "inset", 31644 "inside", 31645 "intrinsic", 31646 "invert", 31647 "italic", 31648 "justify", 31649 "keep-all", 31650 "landscape", 31651 "large", 31652 "larger", 31653 "left", 31654 "level", 31655 "lighter", 31656 "lighten", 31657 "line-through", 31658 "linear", 31659 "linear-gradient", 31660 "lines", 31661 "list-item", 31662 "listbox", 31663 "listitem", 31664 "local", 31665 "logical", 31666 "loud", 31667 "lower", 31668 "lower-hexadecimal", 31669 "lower-latin", 31670 "lower-norwegian", 31671 "lowercase", 31672 "ltr", 31673 "luminosity", 31674 "manipulation", 31675 "match", 31676 "matrix", 31677 "matrix3d", 31678 "medium", 31679 "menu", 31680 "menutext", 31681 "message-box", 31682 "middle", 31683 "min-intrinsic", 31684 "mix", 31685 "monospace", 31686 "move", 31687 "multiple", 31688 "multiple_mask_images", 31689 "multiply", 31690 "n-resize", 31691 "narrower", 31692 "ne-resize", 31693 "nesw-resize", 31694 "no-close-quote", 31695 "no-drop", 31696 "no-open-quote", 31697 "no-repeat", 31698 "none", 31699 "normal", 31700 "not-allowed", 31701 "nowrap", 31702 "ns-resize", 31703 "numbers", 31704 "numeric", 31705 "nw-resize", 31706 "nwse-resize", 31707 "oblique", 31708 "opacity", 31709 "open-quote", 31710 "optimizeLegibility", 31711 "optimizeSpeed", 31712 "outset", 31713 "outside", 31714 "outside-shape", 31715 "overlay", 31716 "overline", 31717 "padding", 31718 "padding-box", 31719 "painted", 31720 "page", 31721 "paused", 31722 "perspective", 31723 "pinch-zoom", 31724 "plus-darker", 31725 "plus-lighter", 31726 "pointer", 31727 "polygon", 31728 "portrait", 31729 "pre", 31730 "pre-line", 31731 "pre-wrap", 31732 "preserve-3d", 31733 "progress", 31734 "push-button", 31735 "radial-gradient", 31736 "radio", 31737 "read-only", 31738 "read-write", 31739 "read-write-plaintext-only", 31740 "rectangle", 31741 "region", 31742 "relative", 31743 "repeat", 31744 "repeating-linear-gradient", 31745 "repeating-radial-gradient", 31746 "repeat-x", 31747 "repeat-y", 31748 "reset", 31749 "reverse", 31750 "rgb", 31751 "rgba", 31752 "ridge", 31753 "right", 31754 "rotate", 31755 "rotate3d", 31756 "rotateX", 31757 "rotateY", 31758 "rotateZ", 31759 "round", 31760 "row", 31761 "row-resize", 31762 "row-reverse", 31763 "rtl", 31764 "run-in", 31765 "running", 31766 "s-resize", 31767 "sans-serif", 31768 "saturation", 31769 "scale", 31770 "scale3d", 31771 "scaleX", 31772 "scaleY", 31773 "scaleZ", 31774 "screen", 31775 "scroll", 31776 "scrollbar", 31777 "scroll-position", 31778 "se-resize", 31779 "self-start", 31780 "self-end", 31781 "semi-condensed", 31782 "semi-expanded", 31783 "separate", 31784 "serif", 31785 "show", 31786 "single", 31787 "skew", 31788 "skewX", 31789 "skewY", 31790 "skip-white-space", 31791 "slide", 31792 "slider-horizontal", 31793 "slider-vertical", 31794 "sliderthumb-horizontal", 31795 "sliderthumb-vertical", 31796 "slow", 31797 "small", 31798 "small-caps", 31799 "small-caption", 31800 "smaller", 31801 "soft-light", 31802 "solid", 31803 "source-atop", 31804 "source-in", 31805 "source-out", 31806 "source-over", 31807 "space", 31808 "space-around", 31809 "space-between", 31810 "space-evenly", 31811 "spell-out", 31812 "square", 31813 "start", 31814 "static", 31815 "status-bar", 31816 "stretch", 31817 "stroke", 31818 "stroke-box", 31819 "sub", 31820 "subpixel-antialiased", 31821 "svg_masks", 31822 "super", 31823 "sw-resize", 31824 "symbolic", 31825 "symbols", 31826 "system-ui", 31827 "table", 31828 "table-caption", 31829 "table-cell", 31830 "table-column", 31831 "table-column-group", 31832 "table-footer-group", 31833 "table-header-group", 31834 "table-row", 31835 "table-row-group", 31836 "text", 31837 "text-bottom", 31838 "text-top", 31839 "textarea", 31840 "textfield", 31841 "thick", 31842 "thin", 31843 "threeddarkshadow", 31844 "threedface", 31845 "threedhighlight", 31846 "threedlightshadow", 31847 "threedshadow", 31848 "to", 31849 "top", 31850 "transform", 31851 "translate", 31852 "translate3d", 31853 "translateX", 31854 "translateY", 31855 "translateZ", 31856 "transparent", 31857 "ultra-condensed", 31858 "ultra-expanded", 31859 "underline", 31860 "unidirectional-pan", 31861 "unset", 31862 "up", 31863 "upper-latin", 31864 "uppercase", 31865 "url", 31866 "var", 31867 "vertical", 31868 "vertical-text", 31869 "view-box", 31870 "visible", 31871 "visibleFill", 31872 "visiblePainted", 31873 "visibleStroke", 31874 "visual", 31875 "w-resize", 31876 "wait", 31877 "wave", 31878 "wider", 31879 "window", 31880 "windowframe", 31881 "windowtext", 31882 "words", 31883 "wrap", 31884 "wrap-reverse", 31885 "x-large", 31886 "x-small", 31887 "xor", 31888 "xx-large", 31889 "xx-small" 31890].map((name2) => ({ type: "keyword", label: name2 })).concat(/* @__PURE__ */ [ 31891 "aliceblue", 31892 "antiquewhite", 31893 "aqua", 31894 "aquamarine", 31895 "azure", 31896 "beige", 31897 "bisque", 31898 "black", 31899 "blanchedalmond", 31900 "blue", 31901 "blueviolet", 31902 "brown", 31903 "burlywood", 31904 "cadetblue", 31905 "chartreuse", 31906 "chocolate", 31907 "coral", 31908 "cornflowerblue", 31909 "cornsilk", 31910 "crimson", 31911 "cyan", 31912 "darkblue", 31913 "darkcyan", 31914 "darkgoldenrod", 31915 "darkgray", 31916 "darkgreen", 31917 "darkkhaki", 31918 "darkmagenta", 31919 "darkolivegreen", 31920 "darkorange", 31921 "darkorchid", 31922 "darkred", 31923 "darksalmon", 31924 "darkseagreen", 31925 "darkslateblue", 31926 "darkslategray", 31927 "darkturquoise", 31928 "darkviolet", 31929 "deeppink", 31930 "deepskyblue", 31931 "dimgray", 31932 "dodgerblue", 31933 "firebrick", 31934 "floralwhite", 31935 "forestgreen", 31936 "fuchsia", 31937 "gainsboro", 31938 "ghostwhite", 31939 "gold", 31940 "goldenrod", 31941 "gray", 31942 "grey", 31943 "green", 31944 "greenyellow", 31945 "honeydew", 31946 "hotpink", 31947 "indianred", 31948 "indigo", 31949 "ivory", 31950 "khaki", 31951 "lavender", 31952 "lavenderblush", 31953 "lawngreen", 31954 "lemonchiffon", 31955 "lightblue", 31956 "lightcoral", 31957 "lightcyan", 31958 "lightgoldenrodyellow", 31959 "lightgray", 31960 "lightgreen", 31961 "lightpink", 31962 "lightsalmon", 31963 "lightseagreen", 31964 "lightskyblue", 31965 "lightslategray", 31966 "lightsteelblue", 31967 "lightyellow", 31968 "lime", 31969 "limegreen", 31970 "linen", 31971 "magenta", 31972 "maroon", 31973 "mediumaquamarine", 31974 "mediumblue", 31975 "mediumorchid", 31976 "mediumpurple", 31977 "mediumseagreen", 31978 "mediumslateblue", 31979 "mediumspringgreen", 31980 "mediumturquoise", 31981 "mediumvioletred", 31982 "midnightblue", 31983 "mintcream", 31984 "mistyrose", 31985 "moccasin", 31986 "navajowhite", 31987 "navy", 31988 "oldlace", 31989 "olive", 31990 "olivedrab", 31991 "orange", 31992 "orangered", 31993 "orchid", 31994 "palegoldenrod", 31995 "palegreen", 31996 "paleturquoise", 31997 "palevioletred", 31998 "papayawhip", 31999 "peachpuff", 32000 "peru", 32001 "pink", 32002 "plum", 32003 "powderblue", 32004 "purple", 32005 "rebeccapurple", 32006 "red", 32007 "rosybrown", 32008 "royalblue", 32009 "saddlebrown", 32010 "salmon", 32011 "sandybrown", 32012 "seagreen", 32013 "seashell", 32014 "sienna", 32015 "silver", 32016 "skyblue", 32017 "slateblue", 32018 "slategray", 32019 "snow", 32020 "springgreen", 32021 "steelblue", 32022 "tan", 32023 "teal", 32024 "thistle", 32025 "tomato", 32026 "turquoise", 32027 "violet", 32028 "wheat", 32029 "white", 32030 "whitesmoke", 32031 "yellow", 32032 "yellowgreen" 32033].map((name2) => ({ type: "constant", label: name2 }))); 32034var tags2 = /* @__PURE__ */ [ 32035 "a", 32036 "abbr", 32037 "address", 32038 "article", 32039 "aside", 32040 "b", 32041 "bdi", 32042 "bdo", 32043 "blockquote", 32044 "body", 32045 "br", 32046 "button", 32047 "canvas", 32048 "caption", 32049 "cite", 32050 "code", 32051 "col", 32052 "colgroup", 32053 "dd", 32054 "del", 32055 "details", 32056 "dfn", 32057 "dialog", 32058 "div", 32059 "dl", 32060 "dt", 32061 "em", 32062 "figcaption", 32063 "figure", 32064 "footer", 32065 "form", 32066 "header", 32067 "hgroup", 32068 "h1", 32069 "h2", 32070 "h3", 32071 "h4", 32072 "h5", 32073 "h6", 32074 "hr", 32075 "html", 32076 "i", 32077 "iframe", 32078 "img", 32079 "input", 32080 "ins", 32081 "kbd", 32082 "label", 32083 "legend", 32084 "li", 32085 "main", 32086 "meter", 32087 "nav", 32088 "ol", 32089 "output", 32090 "p", 32091 "pre", 32092 "ruby", 32093 "section", 32094 "select", 32095 "small", 32096 "source", 32097 "span", 32098 "strong", 32099 "sub", 32100 "summary", 32101 "sup", 32102 "table", 32103 "tbody", 32104 "td", 32105 "template", 32106 "textarea", 32107 "tfoot", 32108 "th", 32109 "thead", 32110 "tr", 32111 "u", 32112 "ul" 32113].map((name2) => ({ type: "type", label: name2 })); 32114var identifier2 = /^(\w[\w-]*|-\w[\w-]*|)$/; 32115var variable = /^-(-[\w-]*)?$/; 32116function isVarArg(node, doc2) { 32117 var _a3; 32118 if (node.name == "(" || node.type.isError) 32119 node = node.parent || node; 32120 if (node.name != "ArgList") 32121 return false; 32122 let callee3 = (_a3 = node.parent) === null || _a3 === void 0 ? void 0 : _a3.firstChild; 32123 if ((callee3 === null || callee3 === void 0 ? void 0 : callee3.name) != "Callee") 32124 return false; 32125 return doc2.sliceString(callee3.from, callee3.to) == "var"; 32126} 32127var VariablesByNode = /* @__PURE__ */ new NodeWeakMap(); 32128var declSelector = ["Declaration"]; 32129function astTop(node) { 32130 for (let cur2 = node; ; ) { 32131 if (cur2.type.isTop) 32132 return cur2; 32133 if (!(cur2 = cur2.parent)) 32134 return node; 32135 } 32136} 32137function variableNames(doc2, node, isVariable) { 32138 if (node.to - node.from > 4096) { 32139 let known = VariablesByNode.get(node); 32140 if (known) 32141 return known; 32142 let result = [], seen = /* @__PURE__ */ new Set(), cursor = node.cursor(IterMode.IncludeAnonymous); 32143 if (cursor.firstChild()) 32144 do { 32145 for (let option of variableNames(doc2, cursor.node, isVariable)) 32146 if (!seen.has(option.label)) { 32147 seen.add(option.label); 32148 result.push(option); 32149 } 32150 } while (cursor.nextSibling()); 32151 VariablesByNode.set(node, result); 32152 return result; 32153 } else { 32154 let result = [], seen = /* @__PURE__ */ new Set(); 32155 node.cursor().iterate((node2) => { 32156 var _a3; 32157 if (isVariable(node2) && node2.matchContext(declSelector) && ((_a3 = node2.node.nextSibling) === null || _a3 === void 0 ? void 0 : _a3.name) == ":") { 32158 let name2 = doc2.sliceString(node2.from, node2.to); 32159 if (!seen.has(name2)) { 32160 seen.add(name2); 32161 result.push({ label: name2, type: "variable" }); 32162 } 32163 } 32164 }); 32165 return result; 32166 } 32167} 32168var defineCSSCompletionSource = (isVariable) => (context) => { 32169 let { state, pos } = context, node = syntaxTree(state).resolveInner(pos, -1); 32170 let isDash = node.type.isError && node.from == node.to - 1 && state.doc.sliceString(node.from, node.to) == "-"; 32171 if (node.name == "PropertyName" || (isDash || node.name == "TagName") && /^(Block|Styles)$/.test(node.resolve(node.to).name)) 32172 return { from: node.from, options: properties(), validFor: identifier2 }; 32173 if (node.name == "ValueName") 32174 return { from: node.from, options: values, validFor: identifier2 }; 32175 if (node.name == "PseudoClassName") 32176 return { from: node.from, options: pseudoClasses, validFor: identifier2 }; 32177 if (isVariable(node) || (context.explicit || isDash) && isVarArg(node, state.doc)) 32178 return { 32179 from: isVariable(node) || isDash ? node.from : pos, 32180 options: variableNames(state.doc, astTop(node), isVariable), 32181 validFor: variable 32182 }; 32183 if (node.name == "TagName") { 32184 for (let { parent } = node; parent; parent = parent.parent) 32185 if (parent.name == "Block") 32186 return { from: node.from, options: properties(), validFor: identifier2 }; 32187 return { from: node.from, options: tags2, validFor: identifier2 }; 32188 } 32189 if (!context.explicit) 32190 return null; 32191 let above = node.resolve(pos), before = above.childBefore(pos); 32192 if (before && before.name == ":" && above.name == "PseudoClassSelector") 32193 return { from: pos, options: pseudoClasses, validFor: identifier2 }; 32194 if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") 32195 return { from: pos, options: values, validFor: identifier2 }; 32196 if (above.name == "Block" || above.name == "Styles") 32197 return { from: pos, options: properties(), validFor: identifier2 }; 32198 return null; 32199}; 32200var cssCompletionSource = /* @__PURE__ */ defineCSSCompletionSource((n3) => n3.name == "VariableName"); 32201var cssLanguage = /* @__PURE__ */ LRLanguage.define({ 32202 name: "css", 32203 parser: /* @__PURE__ */ parser.configure({ 32204 props: [ 32205 /* @__PURE__ */ indentNodeProp.add({ 32206 Declaration: /* @__PURE__ */ continuedIndent() 32207 }), 32208 /* @__PURE__ */ foldNodeProp.add({ 32209 "Block KeyframeList": foldInside 32210 }) 32211 ] 32212 }), 32213 languageData: { 32214 commentTokens: { block: { open: "/*", close: "*/" } }, 32215 indentOnInput: /^\s*\}$/, 32216 wordChars: "-" 32217 } 32218}); 32219function css() { 32220 return new LanguageSupport(cssLanguage, cssLanguage.data.of({ autocomplete: cssCompletionSource })); 32221} 32222
vendor: 20,838 bytes, lines 32223-32608
32223// node_modules/@lezer/html/dist/index.js 32224var scriptText = 54; 32225var StartCloseScriptTag = 1; 32226var styleText = 55; 32227var StartCloseStyleTag = 2; 32228var textareaText = 56; 32229var StartCloseTextareaTag = 3; 32230var EndTag = 4; 32231var SelfClosingEndTag = 5; 32232var StartTag = 6; 32233var StartScriptTag = 7; 32234var StartStyleTag = 8; 32235var StartTextareaTag = 9; 32236var StartSelfClosingTag = 10; 32237var StartCloseTag = 11; 32238var NoMatchStartCloseTag = 12; 32239var MismatchedStartCloseTag = 13; 32240var missingCloseTag = 57; 32241var IncompleteCloseTag = 14; 32242var commentContent$1 = 58; 32243var Element = 20; 32244var TagName = 22; 32245var Attribute = 23; 32246var AttributeName = 24; 32247var AttributeValue = 26; 32248var UnquotedAttributeValue = 27; 32249var ScriptText = 28; 32250var StyleText = 31; 32251var TextareaText = 34; 32252var OpenTag = 36; 32253var CloseTag = 37; 32254var Dialect_noMatch = 0; 32255var Dialect_selfClosing = 1; 32256var selfClosers = { 32257 area: true, 32258 base: true, 32259 br: true, 32260 col: true, 32261 command: true, 32262 embed: true, 32263 frame: true, 32264 hr: true, 32265 img: true, 32266 input: true, 32267 keygen: true, 32268 link: true, 32269 meta: true, 32270 param: true, 32271 source: true, 32272 track: true, 32273 wbr: true, 32274 menuitem: true 32275}; 32276var implicitlyClosed = { 32277 dd: true, 32278 li: true, 32279 optgroup: true, 32280 option: true, 32281 p: true, 32282 rp: true, 32283 rt: true, 32284 tbody: true, 32285 td: true, 32286 tfoot: true, 32287 th: true, 32288 tr: true 32289}; 32290var closeOnOpen = { 32291 dd: { dd: true, dt: true }, 32292 dt: { dd: true, dt: true }, 32293 li: { li: true }, 32294 option: { option: true, optgroup: true }, 32295 optgroup: { optgroup: true }, 32296 p: { 32297 address: true, 32298 article: true, 32299 aside: true, 32300 blockquote: true, 32301 dir: true, 32302 div: true, 32303 dl: true, 32304 fieldset: true, 32305 footer: true, 32306 form: true, 32307 h1: true, 32308 h2: true, 32309 h3: true, 32310 h4: true, 32311 h5: true, 32312 h6: true, 32313 header: true, 32314 hgroup: true, 32315 hr: true, 32316 menu: true, 32317 nav: true, 32318 ol: true, 32319 p: true, 32320 pre: true, 32321 section: true, 32322 table: true, 32323 ul: true 32324 }, 32325 rp: { rp: true, rt: true }, 32326 rt: { rp: true, rt: true }, 32327 tbody: { tbody: true, tfoot: true }, 32328 td: { td: true, th: true }, 32329 tfoot: { tbody: true }, 32330 th: { td: true, th: true }, 32331 thead: { tbody: true, tfoot: true }, 32332 tr: { tr: true } 32333}; 32334function nameChar(ch) { 32335 return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161; 32336} 32337function isSpace(ch) { 32338 return ch == 9 || ch == 10 || ch == 13 || ch == 32; 32339} 32340var cachedName = null; 32341var cachedInput = null; 32342var cachedPos = 0; 32343function tagNameAfter(input, offset) { 32344 let pos = input.pos + offset; 32345 if (cachedPos == pos && cachedInput == input) 32346 return cachedName; 32347 let next = input.peek(offset); 32348 while (isSpace(next)) 32349 next = input.peek(++offset); 32350 let name2 = ""; 32351 for (; ; ) { 32352 if (!nameChar(next)) 32353 break; 32354 name2 += String.fromCharCode(next); 32355 next = input.peek(++offset); 32356 } 32357 cachedInput = input; 32358 cachedPos = pos; 32359 return cachedName = name2 ? name2.toLowerCase() : next == question || next == bang ? void 0 : null; 32360} 32361var lessThan = 60; 32362var greaterThan = 62; 32363var slash = 47; 32364var question = 63; 32365var bang = 33; 32366var dash2 = 45; 32367function ElementContext(name2, parent) { 32368 this.name = name2; 32369 this.parent = parent; 32370 this.hash = parent ? parent.hash : 0; 32371 for (let i2 = 0; i2 < name2.length; i2++) 32372 this.hash += (this.hash << 4) + name2.charCodeAt(i2) + (name2.charCodeAt(i2) << 8); 32373} 32374var startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag]; 32375var elementContext = new ContextTracker({ 32376 start: null, 32377 shift(context, term, stack, input) { 32378 return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context; 32379 }, 32380 reduce(context, term) { 32381 return term == Element && context ? context.parent : context; 32382 }, 32383 reuse(context, node, stack, input) { 32384 let type = node.type.id; 32385 return type == StartTag || type == OpenTag ? new ElementContext(tagNameAfter(input, 1) || "", context) : context; 32386 }, 32387 hash(context) { 32388 return context ? context.hash : 0; 32389 }, 32390 strict: false 32391}); 32392var tagStart = new ExternalTokenizer((input, stack) => { 32393 if (input.next != lessThan) { 32394 if (input.next < 0 && stack.context) 32395 input.acceptToken(missingCloseTag); 32396 return; 32397 } 32398 input.advance(); 32399 let close = input.next == slash; 32400 if (close) 32401 input.advance(); 32402 let name2 = tagNameAfter(input, 0); 32403 if (name2 === void 0) 32404 return; 32405 if (!name2) 32406 return input.acceptToken(close ? IncompleteCloseTag : StartTag); 32407 let parent = stack.context ? stack.context.name : null; 32408 if (close) { 32409 if (name2 == parent) 32410 return input.acceptToken(StartCloseTag); 32411 if (parent && implicitlyClosed[parent]) 32412 return input.acceptToken(missingCloseTag, -2); 32413 if (stack.dialectEnabled(Dialect_noMatch)) 32414 return input.acceptToken(NoMatchStartCloseTag); 32415 for (let cx = stack.context; cx; cx = cx.parent) 32416 if (cx.name == name2) 32417 return; 32418 input.acceptToken(MismatchedStartCloseTag); 32419 } else { 32420 if (name2 == "script") 32421 return input.acceptToken(StartScriptTag); 32422 if (name2 == "style") 32423 return input.acceptToken(StartStyleTag); 32424 if (name2 == "textarea") 32425 return input.acceptToken(StartTextareaTag); 32426 if (selfClosers.hasOwnProperty(name2)) 32427 return input.acceptToken(StartSelfClosingTag); 32428 if (parent && closeOnOpen[parent] && closeOnOpen[parent][name2]) 32429 input.acceptToken(missingCloseTag, -1); 32430 else 32431 input.acceptToken(StartTag); 32432 } 32433}, { contextual: true }); 32434var commentContent = new ExternalTokenizer((input) => { 32435 for (let dashes = 0, i2 = 0; ; i2++) { 32436 if (input.next < 0) { 32437 if (i2) 32438 input.acceptToken(commentContent$1); 32439 break; 32440 } 32441 if (input.next == dash2) { 32442 dashes++; 32443 } else if (input.next == greaterThan && dashes >= 2) { 32444 if (i2 >= 3) 32445 input.acceptToken(commentContent$1, -2); 32446 break; 32447 } else { 32448 dashes = 0; 32449 } 32450 input.advance(); 32451 } 32452}); 32453function inForeignElement(context) { 32454 for (; context; context = context.parent) 32455 if (context.name == "svg" || context.name == "math") 32456 return true; 32457 return false; 32458} 32459var endTag = new ExternalTokenizer((input, stack) => { 32460 if (input.next == slash && input.peek(1) == greaterThan) { 32461 let selfClosing = stack.dialectEnabled(Dialect_selfClosing) || inForeignElement(stack.context); 32462 input.acceptToken(selfClosing ? SelfClosingEndTag : EndTag, 2); 32463 } else if (input.next == greaterThan) { 32464 input.acceptToken(EndTag, 1); 32465 } 32466}); 32467function contentTokenizer(tag, textToken, endToken) { 32468 let lastState = 2 + tag.length; 32469 return new ExternalTokenizer((input) => { 32470 for (let state = 0, matchedLen = 0, i2 = 0; ; i2++) { 32471 if (input.next < 0) { 32472 if (i2) 32473 input.acceptToken(textToken); 32474 break; 32475 } 32476 if (state == 0 && input.next == lessThan || state == 1 && input.next == slash || state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) { 32477 state++; 32478 matchedLen++; 32479 } else if ((state == 2 || state == lastState) && isSpace(input.next)) { 32480 matchedLen++; 32481 } else if (state == lastState && input.next == greaterThan) { 32482 if (i2 > matchedLen) 32483 input.acceptToken(textToken, -matchedLen); 32484 else 32485 input.acceptToken(endToken, -(matchedLen - 2)); 32486 break; 32487 } else if ((input.next == 10 || input.next == 13) && i2) { 32488 input.acceptToken(textToken, 1); 32489 break; 32490 } else { 32491 state = matchedLen = 0; 32492 } 32493 input.advance(); 32494 } 32495 }); 32496} 32497var scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag); 32498var styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag); 32499var textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag); 32500var htmlHighlighting = styleTags({ 32501 "Text RawText": tags.content, 32502 "StartTag StartCloseTag SelfClosingEndTag EndTag": tags.angleBracket, 32503 TagName: tags.tagName, 32504 "MismatchedCloseTag/TagName": [tags.tagName, tags.invalid], 32505 AttributeName: tags.attributeName, 32506 "AttributeValue UnquotedAttributeValue": tags.attributeValue, 32507 Is: tags.definitionOperator, 32508 "EntityReference CharacterReference": tags.character, 32509 Comment: tags.blockComment, 32510 ProcessingInst: tags.processingInstruction, 32511 DoctypeDecl: tags.documentMeta 32512}); 32513var parser2 = LRParser.deserialize({ 32514 version: 14, 32515 states: ",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO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QgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp", 32518 nodeNames: "\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl", 32519 maxTerm: 67, 32520 context: elementContext, 32521 nodeProps: [ 32522 ["closedBy", -10, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, "EndTag", 6, "EndTag SelfClosingEndTag", -4, 21, 30, 33, 36, "CloseTag"], 32523 ["openedBy", 4, "StartTag StartCloseTag", 5, "StartTag", -4, 29, 32, 35, 37, "OpenTag"], 32524 ["group", -9, 14, 17, 18, 19, 20, 39, 40, 41, 42, "Entity", 16, "Entity TextContent", -3, 28, 31, 34, "TextContent Entity"] 32525 ], 32526 propSources: [htmlHighlighting], 32527 skippedNodes: [0], 32528 repeatNodeCount: 9, 32529 tokenData: "!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&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, 4, 5], 32531 topRules: { "Document": [0, 15] }, 32532 dialects: { noMatch: 0, selfClosing: 485 }, 32533 tokenPrec: 487 32534}); 32535function getAttrs2(openTag, input) { 32536 let attrs = /* @__PURE__ */ Object.create(null); 32537 for (let att of openTag.getChildren(Attribute)) { 32538 let name2 = att.getChild(AttributeName), value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue); 32539 if (name2) 32540 attrs[input.read(name2.from, name2.to)] = !value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to); 32541 } 32542 return attrs; 32543} 32544function findTagName(openTag, input) { 32545 let tagNameNode = openTag.getChild(TagName); 32546 return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " "; 32547} 32548function maybeNest(node, input, tags3) { 32549 let attrs; 32550 for (let tag of tags3) { 32551 if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs2(node.node.parent.firstChild, input)))) 32552 return { parser: tag.parser }; 32553 } 32554 return null; 32555} 32556function configureNesting(tags3 = [], attributes = []) { 32557 let script = [], style = [], textarea = [], other = []; 32558 for (let tag of tags3) { 32559 let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other; 32560 array.push(tag); 32561 } 32562 let attrs = attributes.length ? /* @__PURE__ */ Object.create(null) : null; 32563 for (let attr of attributes) 32564 (attrs[attr.name] || (attrs[attr.name] = [])).push(attr); 32565 return parseMixed((node, input) => { 32566 let id2 = node.type.id; 32567 if (id2 == ScriptText) 32568 return maybeNest(node, input, script); 32569 if (id2 == StyleText) 32570 return maybeNest(node, input, style); 32571 if (id2 == TextareaText) 32572 return maybeNest(node, input, textarea); 32573 if (id2 == Element && other.length) { 32574 let n3 = node.node, open = n3.firstChild, tagName = open && findTagName(open, input), attrs2; 32575 if (tagName) 32576 for (let tag of other) { 32577 if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs2 || (attrs2 = getAttrs2(n3, input))))) { 32578 let close = n3.lastChild; 32579 let to = close.type.id == CloseTag ? close.from : n3.to; 32580 if (to > open.to) 32581 return { parser: tag.parser, overlay: [{ from: open.to, to }] }; 32582 } 32583 } 32584 } 32585 if (attrs && id2 == Attribute) { 32586 let n3 = node.node, nameNode; 32587 if (nameNode = n3.firstChild) { 32588 let matches = attrs[input.read(nameNode.from, nameNode.to)]; 32589 if (matches) 32590 for (let attr of matches) { 32591 if (attr.tagName && attr.tagName != findTagName(n3.parent, input)) 32592 continue; 32593 let value = n3.lastChild; 32594 if (value.type.id == AttributeValue) { 32595 let from = value.from + 1; 32596 let last = value.lastChild, to = value.to - (last && last.isError ? 0 : 1); 32597 if (to > from) 32598 return { parser: attr.parser, overlay: [{ from, to }] }; 32599 } else if (value.type.id == UnquotedAttributeValue) { 32600 return { parser: attr.parser, overlay: [{ from: value.from, to: value.to }] }; 32601 } 32602 } 32603 } 32604 } 32605 return null; 32606 }); 32607} 32608
vendor: 71,765 bytes, lines 32609-32767
32609// node_modules/@lezer/javascript/dist/index.js 32610var noSemi = 304; 32611var incdec = 1; 32612var incdecPrefix = 2; 32613var insertSemi = 305; 32614var spaces = 307; 32615var newline2 = 308; 32616var LineComment = 3; 32617var BlockComment = 4; 32618var space2 = [ 32619 9, 32620 10, 32621 11, 32622 12, 32623 13, 32624 32, 32625 133, 32626 160, 32627 5760, 32628 8192, 32629 8193, 32630 8194, 32631 8195, 32632 8196, 32633 8197, 32634 8198, 32635 8199, 32636 8200, 32637 8201, 32638 8202, 32639 8232, 32640 8233, 32641 8239, 32642 8287, 32643 12288 32644]; 32645var braceR = 125; 32646var semicolon = 59; 32647var slash2 = 47; 32648var star = 42; 32649var plus = 43; 32650var minus = 45; 32651var trackNewline = new ContextTracker({ 32652 start: false, 32653 shift(context, term) { 32654 return term == LineComment || term == BlockComment || term == spaces ? context : term == newline2; 32655 }, 32656 strict: false 32657}); 32658var insertSemicolon = new ExternalTokenizer((input, stack) => { 32659 let { next } = input; 32660 if (next == braceR || next == -1 || stack.context) 32661 input.acceptToken(insertSemi); 32662}, { contextual: true, fallback: true }); 32663var noSemicolon = new ExternalTokenizer((input, stack) => { 32664 let { next } = input, after; 32665 if (space2.indexOf(next) > -1) 32666 return; 32667 if (next == slash2 && ((after = input.peek(1)) == slash2 || after == star)) 32668 return; 32669 if (next != braceR && next != semicolon && next != -1 && !stack.context) 32670 input.acceptToken(noSemi); 32671}, { contextual: true }); 32672var incdecToken = new ExternalTokenizer((input, stack) => { 32673 let { next } = input; 32674 if (next == plus || next == minus) { 32675 input.advance(); 32676 if (next == input.next) { 32677 input.advance(); 32678 let mayPostfix = !stack.context && stack.canShift(incdec); 32679 input.acceptToken(mayPostfix ? incdec : incdecPrefix); 32680 } 32681 } 32682}, { contextual: true }); 32683var jsHighlight = styleTags({ 32684 "get set async static": tags.modifier, 32685 "for while do if else switch try catch finally return throw break continue default case": tags.controlKeyword, 32686 "in of await yield void typeof delete instanceof": tags.operatorKeyword, 32687 "let var const using function class extends": tags.definitionKeyword, 32688 "import export from": tags.moduleKeyword, 32689 "with debugger as new": tags.keyword, 32690 TemplateString: tags.special(tags.string), 32691 super: tags.atom, 32692 BooleanLiteral: tags.bool, 32693 this: tags.self, 32694 null: tags.null, 32695 Star: tags.modifier, 32696 VariableName: tags.variableName, 32697 "CallExpression/VariableName TaggedTemplateExpression/VariableName": tags.function(tags.variableName), 32698 VariableDefinition: tags.definition(tags.variableName), 32699 Label: tags.labelName, 32700 PropertyName: tags.propertyName, 32701 PrivatePropertyName: tags.special(tags.propertyName), 32702 "CallExpression/MemberExpression/PropertyName": tags.function(tags.propertyName), 32703 "FunctionDeclaration/VariableDefinition": tags.function(tags.definition(tags.variableName)), 32704 "ClassDeclaration/VariableDefinition": tags.definition(tags.className), 32705 PropertyDefinition: tags.definition(tags.propertyName), 32706 PrivatePropertyDefinition: tags.definition(tags.special(tags.propertyName)), 32707 UpdateOp: tags.updateOperator, 32708 "LineComment Hashbang": tags.lineComment, 32709 BlockComment: tags.blockComment, 32710 Number: tags.number, 32711 String: tags.string, 32712 Escape: tags.escape, 32713 ArithOp: tags.arithmeticOperator, 32714 LogicOp: tags.logicOperator, 32715 BitOp: tags.bitwiseOperator, 32716 CompareOp: tags.compareOperator, 32717 RegExp: tags.regexp, 32718 Equals: tags.definitionOperator, 32719 Arrow: tags.function(tags.punctuation), 32720 ": Spread": tags.punctuation, 32721 "( )": tags.paren, 32722 "[ ]": tags.squareBracket, 32723 "{ }": tags.brace, 32724 "InterpolationStart InterpolationEnd": tags.special(tags.brace), 32725 ".": tags.derefOperator, 32726 ", ;": tags.separator, 32727 "@": tags.meta, 32728 TypeName: tags.typeName, 32729 TypeDefinition: tags.definition(tags.typeName), 32730 "type enum interface implements namespace module declare": tags.definitionKeyword, 32731 "abstract global Privacy readonly override": tags.modifier, 32732 "is keyof unique infer": tags.operatorKeyword, 32733 JSXAttributeValue: tags.attributeValue, 32734 JSXText: tags.content, 32735 "JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": tags.angleBracket, 32736 "JSXIdentifier JSXNameSpacedName": tags.tagName, 32737 "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName, 32738 "JSXBuiltin/JSXIdentifier": tags.standard(tags.tagName) 32739}); 32740var spec_identifier2 = { __proto__: null, export: 16, as: 21, from: 29, default: 32, async: 37, function: 38, extends: 48, this: 52, true: 60, false: 60, null: 72, void: 76, typeof: 80, super: 98, new: 132, delete: 148, yield: 157, await: 161, class: 166, public: 223, private: 223, protected: 223, readonly: 225, instanceof: 244, satisfies: 247, in: 248, const: 250, import: 282, keyof: 337, unique: 341, infer: 347, is: 383, abstract: 403, implements: 405, type: 407, let: 410, var: 412, using: 415, interface: 421, enum: 425, namespace: 431, module: 433, declare: 437, global: 441, for: 460, of: 469, while: 472, with: 476, do: 480, if: 484, else: 486, switch: 490, case: 496, try: 502, catch: 506, finally: 510, return: 514, throw: 518, break: 522, continue: 526, debugger: 530 }; 32741var spec_word = { __proto__: null, async: 119, get: 121, set: 123, declare: 183, public: 185, private: 185, protected: 185, static: 187, abstract: 189, override: 191, readonly: 197, accessor: 199, new: 387 }; 32742var spec_LessThan = { __proto__: null, "<": 139 }; 32743var parser3 = LRParser.deserialize({ 32744 version: 14, 32745 states: "$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#KQ'#KQO9`QSO'#IQO9eQ(C[O'#IROOQQ'#JR'#JROOQQ'#IV'#IVQ`QUOOO`QUOOO%[QUO'#DoO9mQUO'#D{O9tQUO'#D}O9ZQSO'#GlO9{Q,UO'#CmO:ZQSO'#EhO:fQSO'#EsO:kQ,UO'#F`O;YQSO'#GlOOQO'#KR'#KRO;_QSO'#KRO;mQSO'#GtO;mQSO'#GuO;mQSO'#GwO9ZQSO'#GzO<dQSO'#G}O={QSO'#CcO>]QSO'#HZO>eQSO'#HaO>eQSO'#HcO`QUO'#HeO>eQSO'#HgO>eQSO'#HjO>jQSO'#HpO>oQ(C]O'#HvO%[QUO'#HxO>zQ(C]O'#HzO?VQ(C]O'#H|O9eQ(C[O'#IOO?bQ(CjO'#CgO@dQWO'#DgQOQSOOO%[QUO'#D}O@zQSO'#EQO9{Q,UO'#EhOAVQSO'#EhOAbQ`O'#F`OOQQ'#Ce'#CeOOQ(CW'#Dl'#DlOOQ(CW'#Ji'#JiO%[QUO'#JiOOQO'#Jm'#JmOOQO'#Ia'#IaOBbQWO'#EaOOQ(CW'#E`'#E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{T#`W%aS#_W%aS'z#V(SS(P#Y*zS,y'O*{T-m'y-rT'T!e%bQ$kfR)o$pT)d$k)eR3`.pT*T$x*VR*]${Q0V+VQ2j.TQ4x0|Q6Q2nQ7^4{Q7}6PQ8j7]Q8|7|Q9]8lQ9e9OQ9j9^R9m9fnqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&c!VR,V&`tmOXst!U!V!Z#c%f&`&i&k&l&n,b,g1g1jR,^&fT%em,^R0v+vR,U&^Q%||R+n%}R+d%wT&g!W&jT&h!W&jT1i,g1j", 32748 nodeNames: "\u26A0 ArithOp ArithOp LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem", 32749 maxTerm: 367, 32750 context: trackNewline, 32751 nodeProps: [ 32752 ["group", -26, 7, 15, 17, 63, 200, 204, 208, 209, 211, 214, 217, 227, 229, 235, 237, 239, 241, 244, 250, 256, 258, 260, 262, 264, 266, 267, "Statement", -32, 11, 12, 26, 29, 30, 36, 46, 49, 50, 52, 57, 65, 73, 77, 79, 81, 82, 104, 105, 114, 115, 132, 135, 137, 138, 139, 140, 142, 143, 163, 164, 166, "Expression", -23, 25, 27, 31, 35, 37, 39, 167, 169, 171, 172, 174, 175, 176, 178, 179, 180, 182, 183, 184, 194, 196, 198, 199, "Type", -3, 85, 97, 103, "ClassItem"], 32753 ["openedBy", 32, "InterpolationStart", 51, "[", 55, "{", 70, "(", 144, "JSXStartTag", 156, "JSXStartTag JSXStartCloseTag"], 32754 ["closedBy", 34, "InterpolationEnd", 45, "]", 56, "}", 71, ")", 145, "JSXSelfCloseEndTag JSXEndTag", 161, "JS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{ "67": 1, "77": 1, "79": 1, "164": 1, "192": 1 }, 32764 specialized: [{ term: 314, get: (value) => spec_identifier2[value] || -1 }, { term: 330, get: (value) => spec_word[value] || -1 }, { term: 68, get: (value) => spec_LessThan[value] || -1 }], 32765 tokenPrec: 12868 32766}); 32767
vendor: 11,015 bytes, lines 32768-33061
32768// node_modules/@codemirror/lang-javascript/dist/index.js 32769var snippets = [ 32770 /* @__PURE__ */ snippetCompletion("function ${name}(${params}) {\n ${}\n}", { 32771 label: "function", 32772 detail: "definition", 32773 type: "keyword" 32774 }), 32775 /* @__PURE__ */ snippetCompletion("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}", { 32776 label: "for", 32777 detail: "loop", 32778 type: "keyword" 32779 }), 32780 /* @__PURE__ */ snippetCompletion("for (let ${name} of ${collection}) {\n ${}\n}", { 32781 label: "for", 32782 detail: "of loop", 32783 type: "keyword" 32784 }), 32785 /* @__PURE__ */ snippetCompletion("do {\n ${}\n} while (${})", { 32786 label: "do", 32787 detail: "loop", 32788 type: "keyword" 32789 }), 32790 /* @__PURE__ */ snippetCompletion("while (${}) {\n ${}\n}", { 32791 label: "while", 32792 detail: "loop", 32793 type: "keyword" 32794 }), 32795 /* @__PURE__ */ snippetCompletion("try {\n ${}\n} catch (${error}) {\n ${}\n}", { 32796 label: "try", 32797 detail: "/ catch block", 32798 type: "keyword" 32799 }), 32800 /* @__PURE__ */ snippetCompletion("if (${}) {\n ${}\n}", { 32801 label: "if", 32802 detail: "block", 32803 type: "keyword" 32804 }), 32805 /* @__PURE__ */ snippetCompletion("if (${}) {\n ${}\n} else {\n ${}\n}", { 32806 label: "if", 32807 detail: "/ else block", 32808 type: "keyword" 32809 }), 32810 /* @__PURE__ */ snippetCompletion("class ${name} {\n constructor(${params}) {\n ${}\n }\n}", { 32811 label: "class", 32812 detail: "definition", 32813 type: "keyword" 32814 }), 32815 /* @__PURE__ */ snippetCompletion('import {${names}} from "${module}"\n${}', { 32816 label: "import", 32817 detail: "named", 32818 type: "keyword" 32819 }), 32820 /* @__PURE__ */ snippetCompletion('import ${name} from "${module}"\n${}', { 32821 label: "import", 32822 detail: "default", 32823 type: "keyword" 32824 }) 32825]; 32826var typescriptSnippets = /* @__PURE__ */ snippets.concat([ 32827 /* @__PURE__ */ snippetCompletion("interface ${name} {\n ${}\n}", { 32828 label: "interface", 32829 detail: "definition", 32830 type: "keyword" 32831 }), 32832 /* @__PURE__ */ snippetCompletion("type ${name} = ${type}", { 32833 label: "type", 32834 detail: "definition", 32835 type: "keyword" 32836 }), 32837 /* @__PURE__ */ snippetCompletion("enum ${name} {\n ${}\n}", { 32838 label: "enum", 32839 detail: "definition", 32840 type: "keyword" 32841 }) 32842]); 32843var cache = /* @__PURE__ */ new NodeWeakMap(); 32844var ScopeNodes = /* @__PURE__ */ new Set([ 32845 "Script", 32846 "Block", 32847 "FunctionExpression", 32848 "FunctionDeclaration", 32849 "ArrowFunction", 32850 "MethodDeclaration", 32851 "ForStatement" 32852]); 32853function defID(type) { 32854 return (node, def) => { 32855 let id2 = node.node.getChild("VariableDefinition"); 32856 if (id2) 32857 def(id2, type); 32858 return true; 32859 }; 32860} 32861var functionContext = ["FunctionDeclaration"]; 32862var gatherCompletions = { 32863 FunctionDeclaration: /* @__PURE__ */ defID("function"), 32864 ClassDeclaration: /* @__PURE__ */ defID("class"), 32865 ClassExpression: () => true, 32866 EnumDeclaration: /* @__PURE__ */ defID("constant"), 32867 TypeAliasDeclaration: /* @__PURE__ */ defID("type"), 32868 NamespaceDeclaration: /* @__PURE__ */ defID("namespace"), 32869 VariableDefinition(node, def) { 32870 if (!node.matchContext(functionContext)) 32871 def(node, "variable"); 32872 }, 32873 TypeDefinition(node, def) { 32874 def(node, "type"); 32875 }, 32876 __proto__: null 32877}; 32878function getScope(doc2, node) { 32879 let cached = cache.get(node); 32880 if (cached) 32881 return cached; 32882 let completions = [], top2 = true; 32883 function def(node2, type) { 32884 let name2 = doc2.sliceString(node2.from, node2.to); 32885 completions.push({ label: name2, type }); 32886 } 32887 node.cursor(IterMode.IncludeAnonymous).iterate((node2) => { 32888 if (top2) { 32889 top2 = false; 32890 } else if (node2.name) { 32891 let gather = gatherCompletions[node2.name]; 32892 if (gather && gather(node2, def) || ScopeNodes.has(node2.name)) 32893 return false; 32894 } else if (node2.to - node2.from > 8192) { 32895 for (let c2 of getScope(doc2, node2.node)) 32896 completions.push(c2); 32897 return false; 32898 } 32899 }); 32900 cache.set(node, completions); 32901 return completions; 32902} 32903var Identifier = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/; 32904var dontComplete = [ 32905 "TemplateString", 32906 "String", 32907 "RegExp", 32908 "LineComment", 32909 "BlockComment", 32910 "VariableDefinition", 32911 "TypeDefinition", 32912 "Label", 32913 "PropertyDefinition", 32914 "PropertyName", 32915 "PrivatePropertyDefinition", 32916 "PrivatePropertyName", 32917 ".", 32918 "?." 32919]; 32920function localCompletionSource(context) { 32921 let inner = syntaxTree(context.state).resolveInner(context.pos, -1); 32922 if (dontComplete.indexOf(inner.name) > -1) 32923 return null; 32924 let isWord = inner.name == "VariableName" || inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to)); 32925 if (!isWord && !context.explicit) 32926 return null; 32927 let options2 = []; 32928 for (let pos = inner; pos; pos = pos.parent) { 32929 if (ScopeNodes.has(pos.name)) 32930 options2 = options2.concat(getScope(context.state.doc, pos)); 32931 } 32932 return { 32933 options: options2, 32934 from: isWord ? inner.from : context.pos, 32935 validFor: Identifier 32936 }; 32937} 32938var javascriptLanguage = /* @__PURE__ */ LRLanguage.define({ 32939 name: "javascript", 32940 parser: /* @__PURE__ */ parser3.configure({ 32941 props: [ 32942 /* @__PURE__ */ indentNodeProp.add({ 32943 IfStatement: /* @__PURE__ */ continuedIndent({ except: /^\s*({|else\b)/ }), 32944 TryStatement: /* @__PURE__ */ continuedIndent({ except: /^\s*({|catch\b|finally\b)/ }), 32945 LabeledStatement: flatIndent, 32946 SwitchBody: (context) => { 32947 let after = context.textAfter, closed = /^\s*\}/.test(after), isCase = /^\s*(case|default)\b/.test(after); 32948 return context.baseIndent + (closed ? 0 : isCase ? 1 : 2) * context.unit; 32949 }, 32950 Block: /* @__PURE__ */ delimitedIndent({ closing: "}" }), 32951 ArrowFunction: (cx) => cx.baseIndent + cx.unit, 32952 "TemplateString BlockComment": () => null, 32953 "Statement Property": /* @__PURE__ */ continuedIndent({ except: /^{/ }), 32954 JSXElement(context) { 32955 let closed = /^\s*<\//.test(context.textAfter); 32956 return context.lineIndent(context.node.from) + (closed ? 0 : context.unit); 32957 }, 32958 JSXEscape(context) { 32959 let closed = /\s*\}/.test(context.textAfter); 32960 return context.lineIndent(context.node.from) + (closed ? 0 : context.unit); 32961 }, 32962 "JSXOpenTag JSXSelfClosingTag"(context) { 32963 return context.column(context.node.from) + context.unit; 32964 } 32965 }), 32966 /* @__PURE__ */ foldNodeProp.add({ 32967 "Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType": foldInside, 32968 BlockComment(tree) { 32969 return { from: tree.from + 2, to: tree.to - 2 }; 32970 } 32971 }) 32972 ] 32973 }), 32974 languageData: { 32975 closeBrackets: { brackets: ["(", "[", "{", "'", '"', "`"] }, 32976 commentTokens: { line: "//", block: { open: "/*", close: "*/" } }, 32977 indentOnInput: /^\s*(?:case |default:|\{|\}|<\/)$/, 32978 wordChars: "$" 32979 } 32980}); 32981var jsxSublanguage = { 32982 test: (node) => /^JSX/.test(node.name), 32983 facet: /* @__PURE__ */ defineLanguageFacet({ commentTokens: { block: { open: "{/*", close: "*/}" } } }) 32984}; 32985var typescriptLanguage = /* @__PURE__ */ javascriptLanguage.configure({ dialect: "ts" }, "typescript"); 32986var jsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ 32987 dialect: "jsx", 32988 props: [/* @__PURE__ */ sublanguageProp.add((n3) => n3.isTop ? [jsxSublanguage] : void 0)] 32989}); 32990var tsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ 32991 dialect: "jsx ts", 32992 props: [/* @__PURE__ */ sublanguageProp.add((n3) => n3.isTop ? [jsxSublanguage] : void 0)] 32993}, "typescript"); 32994var kwCompletion = (name2) => ({ label: name2, type: "keyword" }); 32995var keywords = /* @__PURE__ */ "break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(kwCompletion); 32996var typescriptKeywords = /* @__PURE__ */ keywords.concat(/* @__PURE__ */ ["declare", "implements", "private", "protected", "public"].map(kwCompletion)); 32997function javascript(config2 = {}) { 32998 let lang = config2.jsx ? config2.typescript ? tsxLanguage : jsxLanguage : config2.typescript ? typescriptLanguage : javascriptLanguage; 32999 let completions = config2.typescript ? typescriptSnippets.concat(typescriptKeywords) : snippets.concat(keywords); 33000 return new LanguageSupport(lang, [ 33001 javascriptLanguage.data.of({ 33002 autocomplete: ifNotIn(dontComplete, completeFromList(completions)) 33003 }), 33004 javascriptLanguage.data.of({ 33005 autocomplete: localCompletionSource 33006 }), 33007 config2.jsx ? autoCloseTags : [] 33008 ]); 33009} 33010function findOpenTag(node) { 33011 for (; ; ) { 33012 if (node.name == "JSXOpenTag" || node.name == "JSXSelfClosingTag" || node.name == "JSXFragmentTag") 33013 return node; 33014 if (node.name == "JSXEscape" || !node.parent) 33015 return null; 33016 node = node.parent; 33017 } 33018} 33019function elementName(doc2, tree, max = doc2.length) { 33020 for (let ch = tree === null || tree === void 0 ? void 0 : tree.firstChild; ch; ch = ch.nextSibling) { 33021 if (ch.name == "JSXIdentifier" || ch.name == "JSXBuiltin" || ch.name == "JSXNamespacedName" || ch.name == "JSXMemberExpression") 33022 return doc2.sliceString(ch.from, Math.min(ch.to, max)); 33023 } 33024 return ""; 33025} 33026var android2 = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent); 33027var autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, text, defaultInsert) => { 33028 if ((android2 ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text != ">" && text != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1)) 33029 return false; 33030 let base2 = defaultInsert(), { state } = base2; 33031 let closeTags = state.changeByRange((range) => { 33032 var _a3; 33033 let { head } = range, around = syntaxTree(state).resolveInner(head - 1, -1), name2; 33034 if (around.name == "JSXStartTag") 33035 around = around.parent; 33036 if (state.doc.sliceString(head - 1, head) != text || around.name == "JSXAttributeValue" && around.to > head) 33037 ; 33038 else if (text == ">" && around.name == "JSXFragmentTag") { 33039 return { range, changes: { from: head, insert: `</>` } }; 33040 } else if (text == "/" && around.name == "JSXStartCloseTag") { 33041 let empty2 = around.parent, base3 = empty2.parent; 33042 if (base3 && empty2.from == head - 2 && ((name2 = elementName(state.doc, base3.firstChild, head)) || ((_a3 = base3.firstChild) === null || _a3 === void 0 ? void 0 : _a3.name) == "JSXFragmentTag")) { 33043 let insert2 = `${name2}>`; 33044 return { range: EditorSelection.cursor(head + insert2.length, -1), changes: { from: head, insert: insert2 } }; 33045 } 33046 } else if (text == ">") { 33047 let openTag = findOpenTag(around); 33048 if (openTag && !/^\/?>|^<\//.test(state.doc.sliceString(head, head + 2)) && (name2 = elementName(state.doc, openTag, head))) 33049 return { range, changes: { from: head, insert: `</${name2}>` } }; 33050 } 33051 return { range }; 33052 }); 33053 if (closeTags.changes.empty) 33054 return false; 33055 view.dispatch([ 33056 base2, 33057 state.update(closeTags, { userEvent: "input.complete", scrollIntoView: true }) 33058 ]); 33059 return true; 33060}); 33061
vendor: 23,314 bytes, lines 33062-33788
33062// node_modules/@codemirror/lang-html/dist/index.js 33063var Targets = ["_blank", "_self", "_top", "_parent"]; 33064var Charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"]; 33065var Methods = ["get", "post", "put", "delete"]; 33066var Encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]; 33067var Bool = ["true", "false"]; 33068var S2 = {}; 33069var Tags = { 33070 a: { 33071 attrs: { 33072 href: null, 33073 ping: null, 33074 type: null, 33075 media: null, 33076 target: Targets, 33077 hreflang: null 33078 } 33079 }, 33080 abbr: S2, 33081 address: S2, 33082 area: { 33083 attrs: { 33084 alt: null, 33085 coords: null, 33086 href: null, 33087 target: null, 33088 ping: null, 33089 media: null, 33090 hreflang: null, 33091 type: null, 33092 shape: ["default", "rect", "circle", "poly"] 33093 } 33094 }, 33095 article: S2, 33096 aside: S2, 33097 audio: { 33098 attrs: { 33099 src: null, 33100 mediagroup: null, 33101 crossorigin: ["anonymous", "use-credentials"], 33102 preload: ["none", "metadata", "auto"], 33103 autoplay: ["autoplay"], 33104 loop: ["loop"], 33105 controls: ["controls"] 33106 } 33107 }, 33108 b: S2, 33109 base: { attrs: { href: null, target: Targets } }, 33110 bdi: S2, 33111 bdo: S2, 33112 blockquote: { attrs: { cite: null } }, 33113 body: S2, 33114 br: S2, 33115 button: { 33116 attrs: { 33117 form: null, 33118 formaction: null, 33119 name: null, 33120 value: null, 33121 autofocus: ["autofocus"], 33122 disabled: ["autofocus"], 33123 formenctype: Encs, 33124 formmethod: Methods, 33125 formnovalidate: ["novalidate"], 33126 formtarget: Targets, 33127 type: ["submit", "reset", "button"] 33128 } 33129 }, 33130 canvas: { attrs: { width: null, height: null } }, 33131 caption: S2, 33132 center: S2, 33133 cite: S2, 33134 code: S2, 33135 col: { attrs: { span: null } }, 33136 colgroup: { attrs: { span: null } }, 33137 command: { 33138 attrs: { 33139 type: ["command", "checkbox", "radio"], 33140 label: null, 33141 icon: null, 33142 radiogroup: null, 33143 command: null, 33144 title: null, 33145 disabled: ["disabled"], 33146 checked: ["checked"] 33147 } 33148 }, 33149 data: { attrs: { value: null } }, 33150 datagrid: { attrs: { disabled: ["disabled"], multiple: ["multiple"] } }, 33151 datalist: { attrs: { data: null } }, 33152 dd: S2, 33153 del: { attrs: { cite: null, datetime: null } }, 33154 details: { attrs: { open: ["open"] } }, 33155 dfn: S2, 33156 div: S2, 33157 dl: S2, 33158 dt: S2, 33159 em: S2, 33160 embed: { attrs: { src: null, type: null, width: null, height: null } }, 33161 eventsource: { attrs: { src: null } }, 33162 fieldset: { attrs: { disabled: ["disabled"], form: null, name: null } }, 33163 figcaption: S2, 33164 figure: S2, 33165 footer: S2, 33166 form: { 33167 attrs: { 33168 action: null, 33169 name: null, 33170 "accept-charset": Charsets, 33171 autocomplete: ["on", "off"], 33172 enctype: Encs, 33173 method: Methods, 33174 novalidate: ["novalidate"], 33175 target: Targets 33176 } 33177 }, 33178 h1: S2, 33179 h2: S2, 33180 h3: S2, 33181 h4: S2, 33182 h5: S2, 33183 h6: S2, 33184 head: { 33185 children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"] 33186 }, 33187 header: S2, 33188 hgroup: S2, 33189 hr: S2, 33190 html: { 33191 attrs: { manifest: null } 33192 }, 33193 i: S2, 33194 iframe: { 33195 attrs: { 33196 src: null, 33197 srcdoc: null, 33198 name: null, 33199 width: null, 33200 height: null, 33201 sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"], 33202 seamless: ["seamless"] 33203 } 33204 }, 33205 img: { 33206 attrs: { 33207 alt: null, 33208 src: null, 33209 ismap: null, 33210 usemap: null, 33211 width: null, 33212 height: null, 33213 crossorigin: ["anonymous", "use-credentials"] 33214 } 33215 }, 33216 input: { 33217 attrs: { 33218 alt: null, 33219 dirname: null, 33220 form: null, 33221 formaction: null, 33222 height: null, 33223 list: null, 33224 max: null, 33225 maxlength: null, 33226 min: null, 33227 name: null, 33228 pattern: null, 33229 placeholder: null, 33230 size: null, 33231 src: null, 33232 step: null, 33233 value: null, 33234 width: null, 33235 accept: ["audio/*", "video/*", "image/*"], 33236 autocomplete: ["on", "off"], 33237 autofocus: ["autofocus"], 33238 checked: ["checked"], 33239 disabled: ["disabled"], 33240 formenctype: Encs, 33241 formmethod: Methods, 33242 formnovalidate: ["novalidate"], 33243 formtarget: Targets, 33244 multiple: ["multiple"], 33245 readonly: ["readonly"], 33246 required: ["required"], 33247 type: [ 33248 "hidden", 33249 "text", 33250 "search", 33251 "tel", 33252 "url", 33253 "email", 33254 "password", 33255 "datetime", 33256 "date", 33257 "month", 33258 "week", 33259 "time", 33260 "datetime-local", 33261 "number", 33262 "range", 33263 "color", 33264 "checkbox", 33265 "radio", 33266 "file", 33267 "submit", 33268 "image", 33269 "reset", 33270 "button" 33271 ] 33272 } 33273 }, 33274 ins: { attrs: { cite: null, datetime: null } }, 33275 kbd: S2, 33276 keygen: { 33277 attrs: { 33278 challenge: null, 33279 form: null, 33280 name: null, 33281 autofocus: ["autofocus"], 33282 disabled: ["disabled"], 33283 keytype: ["RSA"] 33284 } 33285 }, 33286 label: { attrs: { for: null, form: null } }, 33287 legend: S2, 33288 li: { attrs: { value: null } }, 33289 link: { 33290 attrs: { 33291 href: null, 33292 type: null, 33293 hreflang: null, 33294 media: null, 33295 sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"] 33296 } 33297 }, 33298 map: { attrs: { name: null } }, 33299 mark: S2, 33300 menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } }, 33301 meta: { 33302 attrs: { 33303 content: null, 33304 charset: Charsets, 33305 name: ["viewport", "application-name", "author", "description", "generator", "keywords"], 33306 "http-equiv": ["content-language", "content-type", "default-style", "refresh"] 33307 } 33308 }, 33309 meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } }, 33310 nav: S2, 33311 noscript: S2, 33312 object: { 33313 attrs: { 33314 data: null, 33315 type: null, 33316 name: null, 33317 usemap: null, 33318 form: null, 33319 width: null, 33320 height: null, 33321 typemustmatch: ["typemustmatch"] 33322 } 33323 }, 33324 ol: { 33325 attrs: { reversed: ["reversed"], start: null, type: ["1", "a", "A", "i", "I"] }, 33326 children: ["li", "script", "template", "ul", "ol"] 33327 }, 33328 optgroup: { attrs: { disabled: ["disabled"], label: null } }, 33329 option: { attrs: { disabled: ["disabled"], label: null, selected: ["selected"], value: null } }, 33330 output: { attrs: { for: null, form: null, name: null } }, 33331 p: S2, 33332 param: { attrs: { name: null, value: null } }, 33333 pre: S2, 33334 progress: { attrs: { value: null, max: null } }, 33335 q: { attrs: { cite: null } }, 33336 rp: S2, 33337 rt: S2, 33338 ruby: S2, 33339 samp: S2, 33340 script: { 33341 attrs: { 33342 type: ["text/javascript"], 33343 src: null, 33344 async: ["async"], 33345 defer: ["defer"], 33346 charset: Charsets 33347 } 33348 }, 33349 section: S2, 33350 select: { 33351 attrs: { 33352 form: null, 33353 name: null, 33354 size: null, 33355 autofocus: ["autofocus"], 33356 disabled: ["disabled"], 33357 multiple: ["multiple"] 33358 } 33359 }, 33360 slot: { attrs: { name: null } }, 33361 small: S2, 33362 source: { attrs: { src: null, type: null, media: null } }, 33363 span: S2, 33364 strong: S2, 33365 style: { 33366 attrs: { 33367 type: ["text/css"], 33368 media: null, 33369 scoped: null 33370 } 33371 }, 33372 sub: S2, 33373 summary: S2, 33374 sup: S2, 33375 table: S2, 33376 tbody: S2, 33377 td: { attrs: { colspan: null, rowspan: null, headers: null } }, 33378 template: S2, 33379 textarea: { 33380 attrs: { 33381 dirname: null, 33382 form: null, 33383 maxlength: null, 33384 name: null, 33385 placeholder: null, 33386 rows: null, 33387 cols: null, 33388 autofocus: ["autofocus"], 33389 disabled: ["disabled"], 33390 readonly: ["readonly"], 33391 required: ["required"], 33392 wrap: ["soft", "hard"] 33393 } 33394 }, 33395 tfoot: S2, 33396 th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } }, 33397 thead: S2, 33398 time: { attrs: { datetime: null } }, 33399 title: S2, 33400 tr: S2, 33401 track: { 33402 attrs: { 33403 src: null, 33404 label: null, 33405 default: null, 33406 kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"], 33407 srclang: null 33408 } 33409 }, 33410 ul: { children: ["li", "script", "template", "ul", "ol"] }, 33411 var: S2, 33412 video: { 33413 attrs: { 33414 src: null, 33415 poster: null, 33416 width: null, 33417 height: null, 33418 crossorigin: ["anonymous", "use-credentials"], 33419 preload: ["auto", "metadata", "none"], 33420 autoplay: ["autoplay"], 33421 mediagroup: ["movie"], 33422 muted: ["muted"], 33423 controls: ["controls"] 33424 } 33425 }, 33426 wbr: S2 33427}; 33428var GlobalAttrs = { 33429 accesskey: null, 33430 class: null, 33431 contenteditable: Bool, 33432 contextmenu: null, 33433 dir: ["ltr", "rtl", "auto"], 33434 draggable: ["true", "false", "auto"], 33435 dropzone: ["copy", "move", "link", "string:", "file:"], 33436 hidden: ["hidden"], 33437 id: null, 33438 inert: ["inert"], 33439 itemid: null, 33440 itemprop: null, 33441 itemref: null, 33442 itemscope: ["itemscope"], 33443 itemtype: null, 33444 lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"], 33445 spellcheck: Bool, 33446 autocorrect: Bool, 33447 autocapitalize: Bool, 33448 style: null, 33449 tabindex: null, 33450 title: null, 33451 translate: ["yes", "no"], 33452 rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"], 33453 role: /* @__PURE__ */ "alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "), 33454 "aria-activedescendant": null, 33455 "aria-atomic": Bool, 33456 "aria-autocomplete": ["inline", "list", "both", "none"], 33457 "aria-busy": Bool, 33458 "aria-checked": ["true", "false", "mixed", "undefined"], 33459 "aria-controls": null, 33460 "aria-describedby": null, 33461 "aria-disabled": Bool, 33462 "aria-dropeffect": null, 33463 "aria-expanded": ["true", "false", "undefined"], 33464 "aria-flowto": null, 33465 "aria-grabbed": ["true", "false", "undefined"], 33466 "aria-haspopup": Bool, 33467 "aria-hidden": Bool, 33468 "aria-invalid": ["true", "false", "grammar", "spelling"], 33469 "aria-label": null, 33470 "aria-labelledby": null, 33471 "aria-level": null, 33472 "aria-live": ["off", "polite", "assertive"], 33473 "aria-multiline": Bool, 33474 "aria-multiselectable": Bool, 33475 "aria-owns": null, 33476 "aria-posinset": null, 33477 "aria-pressed": ["true", "false", "mixed", "undefined"], 33478 "aria-readonly": Bool, 33479 "aria-relevant": null, 33480 "aria-required": Bool, 33481 "aria-selected": ["true", "false", "undefined"], 33482 "aria-setsize": null, 33483 "aria-sort": ["ascending", "descending", "none", "other"], 33484 "aria-valuemax": null, 33485 "aria-valuemin": null, 33486 "aria-valuenow": null, 33487 "aria-valuetext": null 33488}; 33489var eventAttributes = /* @__PURE__ */ "beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((n3) => "on" + n3); 33490for (let a2 of eventAttributes) 33491 GlobalAttrs[a2] = null; 33492var Schema = class { 33493 constructor(extraTags, extraAttrs) { 33494 this.tags = Object.assign(Object.assign({}, Tags), extraTags); 33495 this.globalAttrs = Object.assign(Object.assign({}, GlobalAttrs), extraAttrs); 33496 this.allTags = Object.keys(this.tags); 33497 this.globalAttrNames = Object.keys(this.globalAttrs); 33498 } 33499}; 33500Schema.default = /* @__PURE__ */ new Schema(); 33501function elementName2(doc2, tree, max = doc2.length) { 33502 if (!tree) 33503 return ""; 33504 let tag = tree.firstChild; 33505 let name2 = tag && tag.getChild("TagName"); 33506 return name2 ? doc2.sliceString(name2.from, Math.min(name2.to, max)) : ""; 33507} 33508function findParentElement(tree, skip = false) { 33509 for (; tree; tree = tree.parent) 33510 if (tree.name == "Element") { 33511 if (skip) 33512 skip = false; 33513 else 33514 return tree; 33515 } 33516 return null; 33517} 33518function allowedChildren(doc2, tree, schema) { 33519 let parentInfo = schema.tags[elementName2(doc2, findParentElement(tree))]; 33520 return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags; 33521} 33522function openTags(doc2, tree) { 33523 let open = []; 33524 for (let parent = findParentElement(tree); parent && !parent.type.isTop; parent = findParentElement(parent.parent)) { 33525 let tagName = elementName2(doc2, parent); 33526 if (tagName && parent.lastChild.name == "CloseTag") 33527 break; 33528 if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) 33529 open.push(tagName); 33530 } 33531 return open; 33532} 33533var identifier3 = /^[:\-\.\w\u00b7-\uffff]*$/; 33534function completeTag(state, schema, tree, from, to) { 33535 let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">"; 33536 let parent = findParentElement(tree, true); 33537 return { 33538 from, 33539 to, 33540 options: allowedChildren(state.doc, parent, schema).map((tagName) => ({ label: tagName, type: "type" })).concat(openTags(state.doc, tree).map((tag, i2) => ({ 33541 label: "/" + tag, 33542 apply: "/" + tag + end, 33543 type: "type", 33544 boost: 99 - i2 33545 }))), 33546 validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/ 33547 }; 33548} 33549function completeCloseTag(state, tree, from, to) { 33550 let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">"; 33551 return { 33552 from, 33553 to, 33554 options: openTags(state.doc, tree).map((tag, i2) => ({ label: tag, apply: tag + end, type: "type", boost: 99 - i2 })), 33555 validFor: identifier3 33556 }; 33557} 33558function completeStartTag(state, schema, tree, pos) { 33559 let options2 = [], level = 0; 33560 for (let tagName of allowedChildren(state.doc, tree, schema)) 33561 options2.push({ label: "<" + tagName, type: "type" }); 33562 for (let open of openTags(state.doc, tree)) 33563 options2.push({ label: "</" + open + ">", type: "type", boost: 99 - level++ }); 33564 return { from: pos, to: pos, options: options2, validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/ }; 33565} 33566function completeAttrName(state, schema, tree, from, to) { 33567 let elt = findParentElement(tree), info = elt ? schema.tags[elementName2(state.doc, elt)] : null; 33568 let localAttrs = info && info.attrs ? Object.keys(info.attrs) : []; 33569 let names = info && info.globalAttrs === false ? localAttrs : localAttrs.length ? localAttrs.concat(schema.globalAttrNames) : schema.globalAttrNames; 33570 return { 33571 from, 33572 to, 33573 options: names.map((attrName) => ({ label: attrName, type: "property" })), 33574 validFor: identifier3 33575 }; 33576} 33577function completeAttrValue(state, schema, tree, from, to) { 33578 var _a3; 33579 let nameNode = (_a3 = tree.parent) === null || _a3 === void 0 ? void 0 : _a3.getChild("AttributeName"); 33580 let options2 = [], token = void 0; 33581 if (nameNode) { 33582 let attrName = state.sliceDoc(nameNode.from, nameNode.to); 33583 let attrs = schema.globalAttrs[attrName]; 33584 if (!attrs) { 33585 let elt = findParentElement(tree), info = elt ? schema.tags[elementName2(state.doc, elt)] : null; 33586 attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName]; 33587 } 33588 if (attrs) { 33589 let base2 = state.sliceDoc(from, to).toLowerCase(), quoteStart = '"', quoteEnd = '"'; 33590 if (/^['"]/.test(base2)) { 33591 token = base2[0] == '"' ? /^[^"]*$/ : /^[^']*$/; 33592 quoteStart = ""; 33593 quoteEnd = state.sliceDoc(to, to + 1) == base2[0] ? "" : base2[0]; 33594 base2 = base2.slice(1); 33595 from++; 33596 } else { 33597 token = /^[^\s<>='"]*$/; 33598 } 33599 for (let value of attrs) 33600 options2.push({ label: value, apply: quoteStart + value + quoteEnd, type: "constant" }); 33601 } 33602 } 33603 return { from, to, options: options2, validFor: token }; 33604} 33605function htmlCompletionFor(schema, context) { 33606 let { state, pos } = context, tree = syntaxTree(state).resolveInner(pos, -1), around = tree.resolve(pos); 33607 for (let scan = pos, before; around == tree && (before = tree.childBefore(scan)); ) { 33608 let last = before.lastChild; 33609 if (!last || !last.type.isError || last.from < last.to) 33610 break; 33611 around = tree = before; 33612 scan = last.from; 33613 } 33614 if (tree.name == "TagName") { 33615 return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos); 33616 } else if (tree.name == "StartTag") { 33617 return completeTag(state, schema, tree, pos, pos); 33618 } else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") { 33619 return completeCloseTag(state, tree, pos, pos); 33620 } else if (context.explicit && (tree.name == "OpenTag" || tree.name == "SelfClosingTag") || tree.name == "AttributeName") { 33621 return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos); 33622 } else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") { 33623 return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos); 33624 } else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) { 33625 return completeStartTag(state, schema, tree, pos); 33626 } else { 33627 return null; 33628 } 33629} 33630function htmlCompletionSourceWith(config2) { 33631 let { extraTags, extraGlobalAttributes: extraAttrs } = config2; 33632 let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default; 33633 return (context) => htmlCompletionFor(schema, context); 33634} 33635var jsonParser = /* @__PURE__ */ javascriptLanguage.parser.configure({ top: "SingleExpression" }); 33636var defaultNesting = [ 33637 { 33638 tag: "script", 33639 attrs: (attrs) => attrs.type == "text/typescript" || attrs.lang == "ts", 33640 parser: typescriptLanguage.parser 33641 }, 33642 { 33643 tag: "script", 33644 attrs: (attrs) => attrs.type == "text/babel" || attrs.type == "text/jsx", 33645 parser: jsxLanguage.parser 33646 }, 33647 { 33648 tag: "script", 33649 attrs: (attrs) => attrs.type == "text/typescript-jsx", 33650 parser: tsxLanguage.parser 33651 }, 33652 { 33653 tag: "script", 33654 attrs(attrs) { 33655 return /^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(attrs.type); 33656 }, 33657 parser: jsonParser 33658 }, 33659 { 33660 tag: "script", 33661 attrs(attrs) { 33662 return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type); 33663 }, 33664 parser: javascriptLanguage.parser 33665 }, 33666 { 33667 tag: "style", 33668 attrs(attrs) { 33669 return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type)); 33670 }, 33671 parser: cssLanguage.parser 33672 } 33673]; 33674var defaultAttrs = /* @__PURE__ */ [ 33675 { 33676 name: "style", 33677 parser: /* @__PURE__ */ cssLanguage.parser.configure({ top: "Styles" }) 33678 } 33679].concat(/* @__PURE__ */ eventAttributes.map((name2) => ({ name: name2, parser: javascriptLanguage.parser }))); 33680var htmlPlain = /* @__PURE__ */ LRLanguage.define({ 33681 name: "html", 33682 parser: /* @__PURE__ */ parser2.configure({ 33683 props: [ 33684 /* @__PURE__ */ indentNodeProp.add({ 33685 Element(context) { 33686 let after = /^(\s*)(<\/)?/.exec(context.textAfter); 33687 if (context.node.to <= context.pos + after[0].length) 33688 return context.continue(); 33689 return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit); 33690 }, 33691 "OpenTag CloseTag SelfClosingTag"(context) { 33692 return context.column(context.node.from) + context.unit; 33693 }, 33694 Document(context) { 33695 if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) 33696 return context.continue(); 33697 let endElt = null, close; 33698 for (let cur2 = context.node; ; ) { 33699 let last = cur2.lastChild; 33700 if (!last || last.name != "Element" || last.to != cur2.to) 33701 break; 33702 endElt = cur2 = last; 33703 } 33704 if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) 33705 return context.lineIndent(endElt.from) + context.unit; 33706 return null; 33707 } 33708 }), 33709 /* @__PURE__ */ foldNodeProp.add({ 33710 Element(node) { 33711 let first = node.firstChild, last = node.lastChild; 33712 if (!first || first.name != "OpenTag") 33713 return null; 33714 return { from: first.to, to: last.name == "CloseTag" ? last.from : node.to }; 33715 } 33716 }), 33717 /* @__PURE__ */ bracketMatchingHandle.add({ 33718 "OpenTag CloseTag": (node) => node.getChild("TagName") 33719 }) 33720 ] 33721 }), 33722 languageData: { 33723 commentTokens: { block: { open: "<!--", close: "-->" } }, 33724 indentOnInput: /^\s*<\/\w+\W$/, 33725 wordChars: "-._" 33726 } 33727}); 33728var htmlLanguage = /* @__PURE__ */ htmlPlain.configure({ 33729 wrap: /* @__PURE__ */ configureNesting(defaultNesting, defaultAttrs) 33730}); 33731function html(config2 = {}) { 33732 let dialect2 = "", wrap; 33733 if (config2.matchClosingTags === false) 33734 dialect2 = "noMatch"; 33735 if (config2.selfClosingTags === true) 33736 dialect2 = (dialect2 ? dialect2 + " " : "") + "selfClosing"; 33737 if (config2.nestedLanguages && config2.nestedLanguages.length || config2.nestedAttributes && config2.nestedAttributes.length) 33738 wrap = configureNesting((config2.nestedLanguages || []).concat(defaultNesting), (config2.nestedAttributes || []).concat(defaultAttrs)); 33739 let lang = wrap ? htmlPlain.configure({ wrap, dialect: dialect2 }) : dialect2 ? htmlLanguage.configure({ dialect: dialect2 }) : htmlLanguage; 33740 return new LanguageSupport(lang, [ 33741 htmlLanguage.data.of({ autocomplete: htmlCompletionSourceWith(config2) }), 33742 config2.autoCloseTags !== false ? autoCloseTags2 : [], 33743 javascript().support, 33744 css().support 33745 ]); 33746} 33747var selfClosers2 = /* @__PURE__ */ new Set(/* @__PURE__ */ "area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")); 33748var autoCloseTags2 = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, text, insertTransaction) => { 33749 if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) 33750 return false; 33751 let base2 = insertTransaction(), { state } = base2; 33752 let closeTags = state.changeByRange((range) => { 33753 var _a3, _b2, _c; 33754 let didType = state.doc.sliceString(range.from - 1, range.to) == text; 33755 let { head } = range, around = syntaxTree(state).resolveInner(head - 1, -1), name2; 33756 if (around.name == "TagName" || around.name == "StartTag") 33757 around = around.parent; 33758 if (didType && text == ">" && around.name == "OpenTag") { 33759 if (((_b2 = (_a3 = around.parent) === null || _a3 === void 0 ? void 0 : _a3.lastChild) === null || _b2 === void 0 ? void 0 : _b2.name) != "CloseTag" && (name2 = elementName2(state.doc, around.parent, head)) && !selfClosers2.has(name2)) { 33760 let to2 = head + (state.doc.sliceString(head, head + 1) === ">" ? 1 : 0); 33761 let insert2 = `</${name2}>`; 33762 return { range, changes: { from: head, to: to2, insert: insert2 } }; 33763 } 33764 } else if (didType && text == "/" && around.name == "IncompleteCloseTag") { 33765 let base3 = around.parent; 33766 if (around.from == head - 2 && ((_c = base3.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name2 = elementName2(state.doc, base3, head)) && !selfClosers2.has(name2)) { 33767 let to2 = head + (state.doc.sliceString(head, head + 1) === ">" ? 1 : 0); 33768 let insert2 = `${name2}>`; 33769 return { 33770 range: EditorSelection.cursor(head + insert2.length, -1), 33771 changes: { from: head, to: to2, insert: insert2 } 33772 }; 33773 } 33774 } 33775 return { range }; 33776 }); 33777 if (closeTags.changes.empty) 33778 return false; 33779 view.dispatch([ 33780 base2, 33781 state.update(closeTags, { 33782 userEvent: "input.complete", 33783 scrollIntoView: true 33784 }) 33785 ]); 33786 return true; 33787}); 33788
vendor: 53,572 bytes, lines 33789-34048
33789// node_modules/@lezer/python/dist/index.js 33790var printKeyword = 1; 33791var indent = 201; 33792var dedent = 202; 33793var newline$1 = 203; 33794var blankLineStart = 204; 33795var newlineBracketed = 205; 33796var eof = 206; 33797var formatString1Content = 207; 33798var formatString1Brace = 2; 33799var formatString1End = 208; 33800var formatString2Content = 209; 33801var formatString2Brace = 3; 33802var formatString2End = 210; 33803var formatString1lContent = 211; 33804var formatString1lBrace = 4; 33805var formatString1lEnd = 212; 33806var formatString2lContent = 213; 33807var formatString2lBrace = 5; 33808var formatString2lEnd = 214; 33809var ParenL = 26; 33810var ParenthesizedExpression = 27; 33811var TupleExpression = 51; 33812var ComprehensionExpression = 52; 33813var BracketL = 57; 33814var ArrayExpression = 58; 33815var ArrayComprehensionExpression = 59; 33816var BraceL = 61; 33817var DictionaryExpression = 62; 33818var DictionaryComprehensionExpression = 63; 33819var SetExpression = 64; 33820var SetComprehensionExpression = 65; 33821var ArgList = 67; 33822var subscript = 251; 33823var FormatString = 74; 33824var importList = 270; 33825var TypeParamList = 115; 33826var ParamList = 133; 33827var SequencePattern = 154; 33828var MappingPattern = 155; 33829var PatternArgList = 158; 33830var newline3 = 10; 33831var carriageReturn = 13; 33832var space3 = 32; 33833var tab = 9; 33834var hash2 = 35; 33835var parenOpen = 40; 33836var dot = 46; 33837var braceOpen = 123; 33838var singleQuote = 39; 33839var doubleQuote = 34; 33840var backslash2 = 92; 33841var bracketed = /* @__PURE__ */ new Set([ 33842 ParenthesizedExpression, 33843 TupleExpression, 33844 ComprehensionExpression, 33845 importList, 33846 ArgList, 33847 ParamList, 33848 ArrayExpression, 33849 ArrayComprehensionExpression, 33850 subscript, 33851 SetExpression, 33852 SetComprehensionExpression, 33853 FormatString, 33854 DictionaryExpression, 33855 DictionaryComprehensionExpression, 33856 SequencePattern, 33857 MappingPattern, 33858 PatternArgList, 33859 TypeParamList 33860]); 33861function isLineBreak(ch) { 33862 return ch == newline3 || ch == carriageReturn; 33863} 33864var newlines = new ExternalTokenizer((input, stack) => { 33865 let prev; 33866 if (input.next < 0) { 33867 input.acceptToken(eof); 33868 } else if (stack.context.depth < 0) { 33869 if (isLineBreak(input.next)) 33870 input.acceptToken(newlineBracketed, 1); 33871 } else if (((prev = input.peek(-1)) < 0 || isLineBreak(prev)) && stack.canShift(blankLineStart)) { 33872 let spaces3 = 0; 33873 while (input.next == space3 || input.next == tab) { 33874 input.advance(); 33875 spaces3++; 33876 } 33877 if (input.next == newline3 || input.next == carriageReturn || input.next == hash2) 33878 input.acceptToken(blankLineStart, -spaces3); 33879 } else if (isLineBreak(input.next)) { 33880 input.acceptToken(newline$1, 1); 33881 } 33882}, { contextual: true }); 33883var indentation = new ExternalTokenizer((input, stack) => { 33884 let cDepth = stack.context.depth; 33885 if (cDepth < 0) 33886 return; 33887 let prev = input.peek(-1); 33888 if (prev == newline3 || prev == carriageReturn) { 33889 let depth = 0, chars = 0; 33890 for (; ; ) { 33891 if (input.next == space3) 33892 depth++; 33893 else if (input.next == tab) 33894 depth += 8 - depth % 8; 33895 else 33896 break; 33897 input.advance(); 33898 chars++; 33899 } 33900 if (depth != cDepth && input.next != newline3 && input.next != carriageReturn && input.next != hash2) { 33901 if (depth < cDepth) 33902 input.acceptToken(dedent, -chars); 33903 else 33904 input.acceptToken(indent); 33905 } 33906 } 33907}); 33908function IndentLevel(parent, depth) { 33909 this.parent = parent; 33910 this.depth = depth; 33911 this.hash = (parent ? parent.hash + parent.hash << 8 : 0) + depth + (depth << 4); 33912} 33913var topIndent2 = new IndentLevel(null, 0); 33914function countIndent(space5) { 33915 let depth = 0; 33916 for (let i2 = 0; i2 < space5.length; i2++) 33917 depth += space5.charCodeAt(i2) == tab ? 8 - depth % 8 : 1; 33918 return depth; 33919} 33920var trackIndent = new ContextTracker({ 33921 start: topIndent2, 33922 reduce(context, term) { 33923 return context.depth < 0 && bracketed.has(term) ? context.parent : context; 33924 }, 33925 shift(context, term, stack, input) { 33926 if (term == indent) 33927 return new IndentLevel(context, countIndent(input.read(input.pos, stack.pos))); 33928 if (term == dedent) 33929 return context.parent; 33930 if (term == ParenL || term == BracketL || term == BraceL) 33931 return new IndentLevel(context, -1); 33932 return context; 33933 }, 33934 hash(context) { 33935 return context.hash; 33936 } 33937}); 33938var legacyPrint = new ExternalTokenizer((input) => { 33939 for (let i2 = 0; i2 < 5; i2++) { 33940 if (input.next != "print".charCodeAt(i2)) 33941 return; 33942 input.advance(); 33943 } 33944 if (/\w/.test(String.fromCharCode(input.next))) 33945 return; 33946 for (let off = 0; ; off++) { 33947 let next = input.peek(off); 33948 if (next == space3 || next == tab) 33949 continue; 33950 if (next != parenOpen && next != dot && next != newline3 && next != carriageReturn && next != hash2) 33951 input.acceptToken(printKeyword); 33952 return; 33953 } 33954}); 33955function formatString(quote, len, content2, brace, end) { 33956 return new ExternalTokenizer((input) => { 33957 let start = input.pos; 33958 for (; ; ) { 33959 if (input.next < 0) { 33960 break; 33961 } else if (input.next == braceOpen) { 33962 if (input.peek(1) == braceOpen) { 33963 input.advance(2); 33964 } else { 33965 if (input.pos == start) { 33966 input.acceptToken(brace, 1); 33967 return; 33968 } 33969 break; 33970 } 33971 } else if (input.next == backslash2) { 33972 input.advance(); 33973 if (input.next >= 0) 33974 input.advance(); 33975 } else if (input.next == quote && (len == 1 || input.peek(1) == quote && input.peek(2) == quote)) { 33976 if (input.pos == start) { 33977 input.acceptToken(end, len); 33978 return; 33979 } 33980 break; 33981 } else { 33982 input.advance(); 33983 } 33984 } 33985 if (input.pos > start) 33986 input.acceptToken(content2); 33987 }); 33988} 33989var formatString1 = formatString(singleQuote, 1, formatString1Content, formatString1Brace, formatString1End); 33990var formatString2 = formatString(doubleQuote, 1, formatString2Content, formatString2Brace, formatString2End); 33991var formatString1l = formatString(singleQuote, 3, formatString1lContent, formatString1lBrace, formatString1lEnd); 33992var formatString2l = formatString(doubleQuote, 3, formatString2lContent, formatString2lBrace, formatString2lEnd); 33993var pythonHighlighting = styleTags({ 33994 'async "*" "**" FormatConversion FormatSpec': tags.modifier, 33995 "for while if elif else try except finally return raise break continue with pass assert await yield match case": tags.controlKeyword, 33996 "in not and or is del": tags.operatorKeyword, 33997 "from def class global nonlocal lambda": tags.definitionKeyword, 33998 import: tags.moduleKeyword, 33999 "with as print": tags.keyword, 34000 Boolean: tags.bool, 34001 None: tags.null, 34002 VariableName: tags.variableName, 34003 "CallExpression/VariableName": tags.function(tags.variableName), 34004 "FunctionDefinition/VariableName": tags.function(tags.definition(tags.variableName)), 34005 "ClassDefinition/VariableName": tags.definition(tags.className), 34006 PropertyName: tags.propertyName, 34007 "CallExpression/MemberExpression/PropertyName": tags.function(tags.propertyName), 34008 Comment: tags.lineComment, 34009 Number: tags.number, 34010 String: tags.string, 34011 FormatString: tags.special(tags.string), 34012 UpdateOp: tags.updateOperator, 34013 "ArithOp!": tags.arithmeticOperator, 34014 BitOp: tags.bitwiseOperator, 34015 CompareOp: tags.compareOperator, 34016 AssignOp: tags.definitionOperator, 34017 Ellipsis: tags.punctuation, 34018 At: tags.meta, 34019 "( )": tags.paren, 34020 "[ ]": tags.squareBracket, 34021 "{ }": tags.brace, 34022 ".": tags.derefOperator, 34023 ", ;": tags.separator 34024}); 34025var spec_identifier3 = { __proto__: null, await: 48, or: 58, and: 60, in: 64, not: 66, is: 68, if: 74, else: 76, lambda: 80, yield: 98, from: 100, async: 106, for: 108, None: 168, True: 170, False: 170, del: 184, pass: 188, break: 192, continue: 196, return: 200, raise: 208, import: 212, as: 214, global: 218, nonlocal: 220, assert: 224, type: 229, elif: 242, while: 246, try: 252, except: 254, finally: 256, with: 260, def: 264, class: 274, match: 285, case: 291 }; 34026var parser4 = LRParser.deserialize({ 34027 version: 14, 34028 states: "#&jO`Q#yOOP$bOSOOO%kQ&nO'#HcOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HbOOQS'#Hc'#HcOOQS'#DW'#DWOOQS'#Hb'#HbO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HSOOQS'#HS'#HSO'ZQ#xO'#HRO/ZQ&nO'#HROOQS'#Ee'#EeO/rQ#xO'#EfOOQS'#HQ'#HQO/|Q#xO'#HPOOQV'#HP'#HPO0XQ#xO'#F]OOQS'#Ge'#GeO0^Q#xO'#F[OOQV'#IY'#IYOOQV'#HO'#HOOOQV'#Ft'#FtQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HgO1cQ&nO'#EYO'ZQ#xO'#EZOOQS'#E]'#E]OOQS'#E_'#E_OOQS'#Ea'#EaO1wQ#xO'#EcO2_Q#xO'#EgO0XQ#xO'#EiO2rQ&nO'#EiO0XQ#xO'#ElO/rQ#xO'#EoO0XQ#xO'#EqO/rQ#xO'#EwO/rQ#xO'#EzO2}Q#xO'#E|O3UQ#xO'#FRO3aQ#xO'#E}O/rQ#xO'#FRO0XQ#xO'#FTO0XQ#xO'#FYO3fQ#xO'#F_P3mO#xO'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SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+`(qQ,y*tQ.Z-TQ/U.[R/u/TQ$cyQ(d%pR+V(eQ/T.YR0f0[R#VZR#[[R%_!nQ%]!nV*u(O*v,z!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1OR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-`+lQ(}&WQ)P&ZQ)R&]Q)T&_Q+p)OQ+q)QQ+r)SQ+s)UQ.^-`R/V._Q$m!SQ&{$aQ*R'bR,`*SQ#zmQ$f!PQ$i!QR'T$hQ)h'SR+|)kQ)h'SQ+{)jR+|)kR$k!RR)u'YXqOs*W,dQ$s!WR'c$tQ$z!ZR'd$uR*k'pQ*i'pV-|,s-}.lQ.{.RQ/i.uR/j.vU.t.R.u.vQ/n.xQ/y/^Q0O/dU0Q/f0R0bQ0V/kQ0e0WQ0g0]U0i0^0k0sQ0t0mQ0x0rR0y0uR/m.wR/{/^", 34031 nodeNames: "\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatConversion FormatSpec FormatReplacement FormatReplacement FormatReplacement FormatReplacement ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard", 34032 maxTerm: 283, 34033 context: trackIndent, 34034 nodeProps: [ 34035 ["group", -15, 8, 88, 90, 91, 93, 95, 97, 99, 101, 102, 103, 105, 108, 111, 113, "Statement Statement", -22, 10, 20, 23, 27, 42, 51, 52, 58, 59, 62, 63, 64, 65, 66, 69, 72, 73, 74, 82, 83, 84, 85, "Expression", -10, 117, 119, 122, 124, 125, 129, 131, 136, 138, 141, "Statement", -9, 146, 147, 150, 151, 153, 154, 155, 156, 157, "Pattern"], 34036 ["openedBy", 25, "(", 56, "[", 60, "{"], 34037 ["closedBy", 26, ")", 57, "]", 61, "}"] 34038 ], 34039 propSources: [pythonHighlighting], 34040 skippedNodes: [0, 6], 34041 repeatNodeCount: 38, 34042 tokenData: "%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$<b!d!e$>W!e!h$<b!h!i$H[!i!t$<b!t!u%#r!u!w$<b!w!x$Fl!x!}$<b!}#O%%z#O#P?d#P#Q%'O#Q#R%(S#R#S$<b#S#T%T#T#U$<b#U#V$>W#V#Y$<b#Y#Z$H[#Z#f$<b#f#g%#r#g#i$<b#i#j$Fl#j#o$<b#o#p%)^#p#q%*S#q#r%+^#r#s%,S#s$g%T$g;'S$<b;'S;=`$>Q<%lO$<b!n%^]&r!b&jS&mWOr%Trs&Vsw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(value) => spec_identifier3[value] || -1 }], 34046 tokenPrec: 7372 34047}); 34048
vendor: 10,714 bytes, lines 34049-34442
34049// node_modules/@codemirror/lang-python/dist/index.js 34050var cache2 = /* @__PURE__ */ new NodeWeakMap(); 34051var ScopeNodes2 = /* @__PURE__ */ new Set([ 34052 "Script", 34053 "Body", 34054 "FunctionDefinition", 34055 "ClassDefinition", 34056 "LambdaExpression", 34057 "ForStatement", 34058 "MatchClause" 34059]); 34060function defID2(type) { 34061 return (node, def, outer) => { 34062 if (outer) 34063 return false; 34064 let id2 = node.node.getChild("VariableName"); 34065 if (id2) 34066 def(id2, type); 34067 return true; 34068 }; 34069} 34070var gatherCompletions2 = { 34071 FunctionDefinition: /* @__PURE__ */ defID2("function"), 34072 ClassDefinition: /* @__PURE__ */ defID2("class"), 34073 ForStatement(node, def, outer) { 34074 if (outer) 34075 for (let child = node.node.firstChild; child; child = child.nextSibling) { 34076 if (child.name == "VariableName") 34077 def(child, "variable"); 34078 else if (child.name == "in") 34079 break; 34080 } 34081 }, 34082 ImportStatement(_node, def) { 34083 var _a3, _b2; 34084 let { node } = _node; 34085 let isFrom = ((_a3 = node.firstChild) === null || _a3 === void 0 ? void 0 : _a3.name) == "from"; 34086 for (let ch = node.getChild("import"); ch; ch = ch.nextSibling) { 34087 if (ch.name == "VariableName" && ((_b2 = ch.nextSibling) === null || _b2 === void 0 ? void 0 : _b2.name) != "as") 34088 def(ch, isFrom ? "variable" : "namespace"); 34089 } 34090 }, 34091 AssignStatement(node, def) { 34092 for (let child = node.node.firstChild; child; child = child.nextSibling) { 34093 if (child.name == "VariableName") 34094 def(child, "variable"); 34095 else if (child.name == ":" || child.name == "AssignOp") 34096 break; 34097 } 34098 }, 34099 ParamList(node, def) { 34100 for (let prev = null, child = node.node.firstChild; child; child = child.nextSibling) { 34101 if (child.name == "VariableName" && (!prev || !/\*|AssignOp/.test(prev.name))) 34102 def(child, "variable"); 34103 prev = child; 34104 } 34105 }, 34106 CapturePattern: /* @__PURE__ */ defID2("variable"), 34107 AsPattern: /* @__PURE__ */ defID2("variable"), 34108 __proto__: null 34109}; 34110function getScope2(doc2, node) { 34111 let cached = cache2.get(node); 34112 if (cached) 34113 return cached; 34114 let completions = [], top2 = true; 34115 function def(node2, type) { 34116 let name2 = doc2.sliceString(node2.from, node2.to); 34117 completions.push({ label: name2, type }); 34118 } 34119 node.cursor(IterMode.IncludeAnonymous).iterate((node2) => { 34120 if (node2.name) { 34121 let gather = gatherCompletions2[node2.name]; 34122 if (gather && gather(node2, def, top2) || !top2 && ScopeNodes2.has(node2.name)) 34123 return false; 34124 top2 = false; 34125 } else if (node2.to - node2.from > 8192) { 34126 for (let c2 of getScope2(doc2, node2.node)) 34127 completions.push(c2); 34128 return false; 34129 } 34130 }); 34131 cache2.set(node, completions); 34132 return completions; 34133} 34134var Identifier2 = /^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/; 34135var dontComplete2 = ["String", "FormatString", "Comment", "PropertyName"]; 34136function localCompletionSource2(context) { 34137 let inner = syntaxTree(context.state).resolveInner(context.pos, -1); 34138 if (dontComplete2.indexOf(inner.name) > -1) 34139 return null; 34140 let isWord = inner.name == "VariableName" || inner.to - inner.from < 20 && Identifier2.test(context.state.sliceDoc(inner.from, inner.to)); 34141 if (!isWord && !context.explicit) 34142 return null; 34143 let options2 = []; 34144 for (let pos = inner; pos; pos = pos.parent) { 34145 if (ScopeNodes2.has(pos.name)) 34146 options2 = options2.concat(getScope2(context.state.doc, pos)); 34147 } 34148 return { 34149 options: options2, 34150 from: isWord ? inner.from : context.pos, 34151 validFor: Identifier2 34152 }; 34153} 34154var globals = /* @__PURE__ */ [ 34155 "__annotations__", 34156 "__builtins__", 34157 "__debug__", 34158 "__doc__", 34159 "__import__", 34160 "__name__", 34161 "__loader__", 34162 "__package__", 34163 "__spec__", 34164 "False", 34165 "None", 34166 "True" 34167].map((n3) => ({ label: n3, type: "constant" })).concat(/* @__PURE__ */ [ 34168 "ArithmeticError", 34169 "AssertionError", 34170 "AttributeError", 34171 "BaseException", 34172 "BlockingIOError", 34173 "BrokenPipeError", 34174 "BufferError", 34175 "BytesWarning", 34176 "ChildProcessError", 34177 "ConnectionAbortedError", 34178 "ConnectionError", 34179 "ConnectionRefusedError", 34180 "ConnectionResetError", 34181 "DeprecationWarning", 34182 "EOFError", 34183 "Ellipsis", 34184 "EncodingWarning", 34185 "EnvironmentError", 34186 "Exception", 34187 "FileExistsError", 34188 "FileNotFoundError", 34189 "FloatingPointError", 34190 "FutureWarning", 34191 "GeneratorExit", 34192 "IOError", 34193 "ImportError", 34194 "ImportWarning", 34195 "IndentationError", 34196 "IndexError", 34197 "InterruptedError", 34198 "IsADirectoryError", 34199 "KeyError", 34200 "KeyboardInterrupt", 34201 "LookupError", 34202 "MemoryError", 34203 "ModuleNotFoundError", 34204 "NameError", 34205 "NotADirectoryError", 34206 "NotImplemented", 34207 "NotImplementedError", 34208 "OSError", 34209 "OverflowError", 34210 "PendingDeprecationWarning", 34211 "PermissionError", 34212 "ProcessLookupError", 34213 "RecursionError", 34214 "ReferenceError", 34215 "ResourceWarning", 34216 "RuntimeError", 34217 "RuntimeWarning", 34218 "StopAsyncIteration", 34219 "StopIteration", 34220 "SyntaxError", 34221 "SyntaxWarning", 34222 "SystemError", 34223 "SystemExit", 34224 "TabError", 34225 "TimeoutError", 34226 "TypeError", 34227 "UnboundLocalError", 34228 "UnicodeDecodeError", 34229 "UnicodeEncodeError", 34230 "UnicodeError", 34231 "UnicodeTranslateError", 34232 "UnicodeWarning", 34233 "UserWarning", 34234 "ValueError", 34235 "Warning", 34236 "ZeroDivisionError" 34237].map((n3) => ({ label: n3, type: "type" }))).concat(/* @__PURE__ */ [ 34238 "bool", 34239 "bytearray", 34240 "bytes", 34241 "classmethod", 34242 "complex", 34243 "float", 34244 "frozenset", 34245 "int", 34246 "list", 34247 "map", 34248 "memoryview", 34249 "object", 34250 "range", 34251 "set", 34252 "staticmethod", 34253 "str", 34254 "super", 34255 "tuple", 34256 "type" 34257].map((n3) => ({ label: n3, type: "class" }))).concat(/* @__PURE__ */ [ 34258 "abs", 34259 "aiter", 34260 "all", 34261 "anext", 34262 "any", 34263 "ascii", 34264 "bin", 34265 "breakpoint", 34266 "callable", 34267 "chr", 34268 "compile", 34269 "delattr", 34270 "dict", 34271 "dir", 34272 "divmod", 34273 "enumerate", 34274 "eval", 34275 "exec", 34276 "exit", 34277 "filter", 34278 "format", 34279 "getattr", 34280 "globals", 34281 "hasattr", 34282 "hash", 34283 "help", 34284 "hex", 34285 "id", 34286 "input", 34287 "isinstance", 34288 "issubclass", 34289 "iter", 34290 "len", 34291 "license", 34292 "locals", 34293 "max", 34294 "min", 34295 "next", 34296 "oct", 34297 "open", 34298 "ord", 34299 "pow", 34300 "print", 34301 "property", 34302 "quit", 34303 "repr", 34304 "reversed", 34305 "round", 34306 "setattr", 34307 "slice", 34308 "sorted", 34309 "sum", 34310 "vars", 34311 "zip" 34312].map((n3) => ({ label: n3, type: "function" }))); 34313var snippets2 = [ 34314 /* @__PURE__ */ snippetCompletion("def ${name}(${params}):\n ${}", { 34315 label: "def", 34316 detail: "function", 34317 type: "keyword" 34318 }), 34319 /* @__PURE__ */ snippetCompletion("for ${name} in ${collection}:\n ${}", { 34320 label: "for", 34321 detail: "loop", 34322 type: "keyword" 34323 }), 34324 /* @__PURE__ */ snippetCompletion("while ${}:\n ${}", { 34325 label: "while", 34326 detail: "loop", 34327 type: "keyword" 34328 }), 34329 /* @__PURE__ */ snippetCompletion("try:\n ${}\nexcept ${error}:\n ${}", { 34330 label: "try", 34331 detail: "/ except block", 34332 type: "keyword" 34333 }), 34334 /* @__PURE__ */ snippetCompletion("if ${}:\n \n", { 34335 label: "if", 34336 detail: "block", 34337 type: "keyword" 34338 }), 34339 /* @__PURE__ */ snippetCompletion("if ${}:\n ${}\nelse:\n ${}", { 34340 label: "if", 34341 detail: "/ else block", 34342 type: "keyword" 34343 }), 34344 /* @__PURE__ */ snippetCompletion("class ${name}:\n def __init__(self, ${params}):\n ${}", { 34345 label: "class", 34346 detail: "definition", 34347 type: "keyword" 34348 }), 34349 /* @__PURE__ */ snippetCompletion("import ${module}", { 34350 label: "import", 34351 detail: "statement", 34352 type: "keyword" 34353 }), 34354 /* @__PURE__ */ snippetCompletion("from ${module} import ${names}", { 34355 label: "from", 34356 detail: "import", 34357 type: "keyword" 34358 }) 34359]; 34360var globalCompletion = /* @__PURE__ */ ifNotIn(dontComplete2, /* @__PURE__ */ completeFromList(/* @__PURE__ */ globals.concat(snippets2))); 34361function indentBody(context, node) { 34362 let base2 = context.baseIndentFor(node); 34363 let line = context.lineAt(context.pos, -1), to = line.from + line.text.length; 34364 if (/^\s*($|#)/.test(line.text) && context.node.to < to + 100 && !/\S/.test(context.state.sliceDoc(to, context.node.to)) && context.lineIndent(context.pos, -1) <= base2) 34365 return null; 34366 if (/^\s*(else:|elif |except |finally:)/.test(context.textAfter) && context.lineIndent(context.pos, -1) > base2) 34367 return null; 34368 return base2 + context.unit; 34369} 34370var pythonLanguage = /* @__PURE__ */ LRLanguage.define({ 34371 name: "python", 34372 parser: /* @__PURE__ */ parser4.configure({ 34373 props: [ 34374 /* @__PURE__ */ indentNodeProp.add({ 34375 Body: (context) => { 34376 var _a3; 34377 return (_a3 = indentBody(context, context.node)) !== null && _a3 !== void 0 ? _a3 : context.continue(); 34378 }, 34379 IfStatement: (cx) => /^\s*(else:|elif )/.test(cx.textAfter) ? cx.baseIndent : cx.continue(), 34380 TryStatement: (cx) => /^\s*(except |finally:|else:)/.test(cx.textAfter) ? cx.baseIndent : cx.continue(), 34381 "TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression": /* @__PURE__ */ delimitedIndent({ closing: ")" }), 34382 "DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression": /* @__PURE__ */ delimitedIndent({ closing: "}" }), 34383 "ArrayExpression ArrayComprehensionExpression": /* @__PURE__ */ delimitedIndent({ closing: "]" }), 34384 "String FormatString": () => null, 34385 Script: (context) => { 34386 if (context.pos + /\s*/.exec(context.textAfter)[0].length >= context.node.to) { 34387 let endBody = null; 34388 for (let cur2 = context.node, to = cur2.to; ; ) { 34389 cur2 = cur2.lastChild; 34390 if (!cur2 || cur2.to != to) 34391 break; 34392 if (cur2.type.name == "Body") 34393 endBody = cur2; 34394 } 34395 if (endBody) { 34396 let bodyIndent = indentBody(context, endBody); 34397 if (bodyIndent != null) 34398 return bodyIndent; 34399 } 34400 } 34401 return context.continue(); 34402 } 34403 }), 34404 /* @__PURE__ */ foldNodeProp.add({ 34405 "ArrayExpression DictionaryExpression SetExpression TupleExpression": foldInside, 34406 Body: (node, state) => ({ from: node.from + 1, to: node.to - (node.to == state.doc.length ? 0 : 1) }) 34407 }) 34408 ] 34409 }), 34410 languageData: { 34411 closeBrackets: { 34412 brackets: ["(", "[", "{", "'", '"', "'''", '"""'], 34413 stringPrefixes: [ 34414 "f", 34415 "fr", 34416 "rf", 34417 "r", 34418 "u", 34419 "b", 34420 "br", 34421 "rb", 34422 "F", 34423 "FR", 34424 "RF", 34425 "R", 34426 "U", 34427 "B", 34428 "BR", 34429 "RB" 34430 ] 34431 }, 34432 commentTokens: { line: "#" }, 34433 indentOnInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/ 34434 } 34435}); 34436function python() { 34437 return new LanguageSupport(pythonLanguage, [ 34438 pythonLanguage.data.of({ autocomplete: localCompletionSource2 }), 34439 pythonLanguage.data.of({ autocomplete: globalCompletion }) 34440 ]); 34441} 34442
vendor: 25,927 bytes, lines 34443-34768
34443// node_modules/@lezer/sass/dist/index.js 34444var indent2 = 154; 34445var dedent2 = 155; 34446var descendantOp2 = 156; 34447var InterpolationEnd = 1; 34448var InterpolationContinue = 2; 34449var Unit2 = 3; 34450var callee2 = 157; 34451var identifier4 = 158; 34452var VariableName2 = 4; 34453var InterpolationStart = 5; 34454var newline4 = 159; 34455var blankLineStart2 = 160; 34456var eof2 = 161; 34457var whitespace = 162; 34458var LineComment2 = 6; 34459var Comment = 7; 34460var IndentedMixin = 8; 34461var IndentedInclude = 9; 34462var Dialect_indented = 0; 34463var space4 = [ 34464 9, 34465 10, 34466 11, 34467 12, 34468 13, 34469 32, 34470 133, 34471 160, 34472 5760, 34473 8192, 34474 8193, 34475 8194, 34476 8195, 34477 8196, 34478 8197, 34479 8198, 34480 8199, 34481 8200, 34482 8201, 34483 8202, 34484 8232, 34485 8233, 34486 8239, 34487 8287, 34488 12288 34489]; 34490var colon2 = 58; 34491var parenL2 = 40; 34492var underscore2 = 95; 34493var bracketL2 = 91; 34494var dash3 = 45; 34495var period2 = 46; 34496var hash3 = 35; 34497var percent2 = 37; 34498var braceL = 123; 34499var braceR2 = 125; 34500var slash3 = 47; 34501var asterisk = 42; 34502var newlineChar = 10; 34503var equals = 61; 34504var plus2 = 43; 34505var and = 38; 34506function isAlpha2(ch) { 34507 return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161; 34508} 34509function isDigit2(ch) { 34510 return ch >= 48 && ch <= 57; 34511} 34512function startOfComment(input) { 34513 let next; 34514 return input.next == slash3 && ((next = input.peek(1)) == slash3 || next == asterisk); 34515} 34516var spaces2 = new ExternalTokenizer((input, stack) => { 34517 if (stack.dialectEnabled(Dialect_indented)) { 34518 let prev; 34519 if (input.next < 0 && stack.canShift(eof2)) { 34520 input.acceptToken(eof2); 34521 } else if (((prev = input.peek(-1)) == newlineChar || prev < 0) && stack.canShift(blankLineStart2)) { 34522 let spaces3 = 0; 34523 while (input.next != newlineChar && space4.includes(input.next)) { 34524 input.advance(); 34525 spaces3++; 34526 } 34527 if (input.next == newlineChar || startOfComment(input)) 34528 input.acceptToken(blankLineStart2, -spaces3); 34529 else if (spaces3) 34530 input.acceptToken(whitespace); 34531 } else if (input.next == newlineChar) { 34532 input.acceptToken(newline4, 1); 34533 } else if (space4.includes(input.next)) { 34534 input.advance(); 34535 while (input.next != newlineChar && space4.includes(input.next)) 34536 input.advance(); 34537 input.acceptToken(whitespace); 34538 } 34539 } else { 34540 let length = 0; 34541 while (space4.includes(input.next)) { 34542 input.advance(); 34543 length++; 34544 } 34545 if (length) 34546 input.acceptToken(whitespace); 34547 } 34548}, { contextual: true }); 34549var comments = new ExternalTokenizer((input, stack) => { 34550 if (!startOfComment(input)) 34551 return; 34552 input.advance(); 34553 if (stack.dialectEnabled(Dialect_indented)) { 34554 let indentedComment = -1; 34555 for (let off = 1; ; off++) { 34556 let prev = input.peek(-off - 1); 34557 if (prev == newlineChar || prev < 0) { 34558 indentedComment = off + 1; 34559 break; 34560 } else if (!space4.includes(prev)) { 34561 break; 34562 } 34563 } 34564 if (indentedComment > -1) { 34565 let block2 = input.next == asterisk, end = 0; 34566 input.advance(); 34567 while (input.next >= 0) { 34568 if (input.next == newlineChar) { 34569 input.advance(); 34570 let indented = 0; 34571 while (input.next != newlineChar && space4.includes(input.next)) { 34572 indented++; 34573 input.advance(); 34574 } 34575 if (indented < indentedComment) { 34576 end = -indented - 1; 34577 break; 34578 } 34579 } else if (block2 && input.next == asterisk && input.peek(1) == slash3) { 34580 end = 2; 34581 break; 34582 } else { 34583 input.advance(); 34584 } 34585 } 34586 input.acceptToken(block2 ? Comment : LineComment2, end); 34587 return; 34588 } 34589 } 34590 if (input.next == slash3) { 34591 while (input.next != newlineChar && input.next >= 0) 34592 input.advance(); 34593 input.acceptToken(LineComment2); 34594 } else { 34595 input.advance(); 34596 while (input.next >= 0) { 34597 let { next } = input; 34598 input.advance(); 34599 if (next == asterisk && input.next == slash3) { 34600 input.advance(); 34601 break; 34602 } 34603 } 34604 input.acceptToken(Comment); 34605 } 34606}); 34607var indentedMixins = new ExternalTokenizer((input, stack) => { 34608 if ((input.next == plus2 || input.next == equals) && stack.dialectEnabled(Dialect_indented)) 34609 input.acceptToken(input.next == equals ? IndentedMixin : IndentedInclude, 1); 34610}); 34611var indentation2 = new ExternalTokenizer((input, stack) => { 34612 if (!stack.dialectEnabled(Dialect_indented)) 34613 return; 34614 let cDepth = stack.context.depth; 34615 if (input.next < 0 && cDepth) { 34616 input.acceptToken(dedent2); 34617 return; 34618 } 34619 let prev = input.peek(-1); 34620 if (prev == newlineChar) { 34621 let depth = 0; 34622 while (input.next != newlineChar && space4.includes(input.next)) { 34623 input.advance(); 34624 depth++; 34625 } 34626 if (depth != cDepth && input.next != newlineChar && !startOfComment(input)) { 34627 if (depth < cDepth) 34628 input.acceptToken(dedent2, -depth); 34629 else 34630 input.acceptToken(indent2); 34631 } 34632 } 34633}); 34634var identifiers2 = new ExternalTokenizer((input, stack) => { 34635 for (let inside2 = false, dashes = 0, i2 = 0; ; i2++) { 34636 let { next } = input; 34637 if (isAlpha2(next) || next == dash3 || next == underscore2 || inside2 && isDigit2(next)) { 34638 if (!inside2 && (next != dash3 || i2 > 0)) 34639 inside2 = true; 34640 if (dashes === i2 && next == dash3) 34641 dashes++; 34642 input.advance(); 34643 } else if (next == hash3 && input.peek(1) == braceL) { 34644 input.acceptToken(InterpolationStart, 2); 34645 break; 34646 } else { 34647 if (inside2) 34648 input.acceptToken(next == parenL2 ? callee2 : dashes == 2 && stack.canShift(VariableName2) ? VariableName2 : identifier4); 34649 break; 34650 } 34651 } 34652}); 34653var interpolationEnd = new ExternalTokenizer((input) => { 34654 if (input.next == braceR2) { 34655 input.advance(); 34656 while (isAlpha2(input.next) || input.next == dash3 || input.next == underscore2 || isDigit2(input.next)) 34657 input.advance(); 34658 if (input.next == hash3 && input.peek(1) == braceL) 34659 input.acceptToken(InterpolationContinue, 2); 34660 else 34661 input.acceptToken(InterpolationEnd); 34662 } 34663}); 34664var descendant2 = new ExternalTokenizer((input) => { 34665 if (space4.includes(input.peek(-1))) { 34666 let { next } = input; 34667 if (isAlpha2(next) || next == underscore2 || next == hash3 || next == period2 || next == bracketL2 || next == colon2 || next == dash3 || next == and) 34668 input.acceptToken(descendantOp2); 34669 } 34670}); 34671var unitToken2 = new ExternalTokenizer((input) => { 34672 if (!space4.includes(input.peek(-1))) { 34673 let { next } = input; 34674 if (next == percent2) { 34675 input.advance(); 34676 input.acceptToken(Unit2); 34677 } 34678 if (isAlpha2(next)) { 34679 do { 34680 input.advance(); 34681 } while (isAlpha2(input.next)); 34682 input.acceptToken(Unit2); 34683 } 34684 } 34685}); 34686function IndentLevel2(parent, depth) { 34687 this.parent = parent; 34688 this.depth = depth; 34689 this.hash = (parent ? parent.hash + parent.hash << 8 : 0) + depth + (depth << 4); 34690} 34691var topIndent3 = new IndentLevel2(null, 0); 34692var trackIndent2 = new ContextTracker({ 34693 start: topIndent3, 34694 shift(context, term, stack, input) { 34695 if (term == indent2) 34696 return new IndentLevel2(context, stack.pos - input.pos); 34697 if (term == dedent2) 34698 return context.parent; 34699 return context; 34700 }, 34701 hash(context) { 34702 return context.hash; 34703 } 34704}); 34705var cssHighlighting2 = styleTags({ 34706 "AtKeyword import charset namespace keyframes media supports include mixin use forward extend at-root": tags.definitionKeyword, 34707 "Keyword selector": tags.keyword, 34708 "ControlKeyword": tags.controlKeyword, 34709 NamespaceName: tags.namespace, 34710 KeyframeName: tags.labelName, 34711 TagName: tags.tagName, 34712 "ClassName Suffix": tags.className, 34713 PseudoClassName: tags.constant(tags.className), 34714 IdName: tags.labelName, 34715 "FeatureName PropertyName": tags.propertyName, 34716 AttributeName: tags.attributeName, 34717 NumberLiteral: tags.number, 34718 KeywordQuery: tags.keyword, 34719 UnaryQueryOp: tags.operatorKeyword, 34720 "CallTag ValueName": tags.atom, 34721 VariableName: tags.variableName, 34722 SassVariableName: tags.special(tags.variableName), 34723 Callee: tags.operatorKeyword, 34724 Unit: tags.unit, 34725 "UniversalSelector NestingSelector IndentedMixin IndentedInclude": tags.definitionOperator, 34726 MatchOp: tags.compareOperator, 34727 "ChildOp SiblingOp, LogicOp": tags.logicOperator, 34728 BinOp: tags.arithmeticOperator, 34729 "Important Global Default": tags.modifier, 34730 Comment: tags.blockComment, 34731 LineComment: tags.lineComment, 34732 ColorLiteral: tags.color, 34733 "ParenthesizedContent StringLiteral": tags.string, 34734 "InterpolationStart InterpolationContinue InterpolationEnd": tags.meta, 34735 ': "..."': tags.punctuation, 34736 "PseudoOp #": tags.derefOperator, 34737 "; ,": tags.separator, 34738 "( )": tags.paren, 34739 "[ ]": tags.squareBracket, 34740 "{ }": tags.brace 34741}); 34742var spec_identifier4 = { __proto__: null, not: 62, only: 62, using: 179, as: 189, with: 193, without: 193, hide: 207, show: 207, from: 230, to: 232, if: 245, through: 251, in: 257 }; 34743var spec_callee2 = { __proto__: null, url: 80, "url-prefix": 80, domain: 80, regexp: 80, lang: 94, "nth-child": 94, "nth-last-child": 94, "nth-of-type": 94, "nth-last-of-type": 94, dir: 94, "host-context": 94, selector: 172 }; 34744var spec_AtKeyword2 = { __proto__: null, "@import": 156, "@include": 176, "@mixin": 182, "@function": 182, "@use": 186, "@extend": 196, "@at-root": 200, "@forward": 204, "@media": 210, "@charset": 214, "@namespace": 218, "@keyframes": 224, "@supports": 236, "@if": 240, "@else": 242, "@for": 248, "@each": 254, "@while": 260, "@debug": 264, "@warn": 264, "@error": 264, "@return": 264 }; 34745var parser5 = LRParser.deserialize({ 34746 version: 14, 34747 states: "L|Q`Q+tOOO#fQ+tOOP#mOpOOOOQ#U'#Ch'#ChO#rQ(pO'#CjOOQ#U'#Ci'#CiO%_Q)QO'#FxO%rQ.jO'#CnO&jQ#dO'#DWO'aQ(pO'#CgO'hQ)OO'#DYO'sQ#dO'#DaO'xQ#dO'#DeO'}Q#dO'#DnOOQ#U'#Fx'#FxO(SQ(pO'#FxO(ZQ(nO'#DrO%rQ.jO'#DzO%rQ.jO'#EVO%rQ.jO'#EYO%rQ.jO'#E[O(`Q)OO'#EaO)QQ)OO'#EcO%rQ.jO'#EeO)_Q)OO'#EhO%rQ.jO'#EjO)yQ)OO'#ElO*UQ#dO'#EoO*ZQ)OO'#EuO*oQ)OO'#FVOOQ&Z'#Fw'#FwOOQ&Y'#FY'#FYO*yQ(nO'#FYQ`Q+tOOO%rQ.jO'#EwO+UQ(nO'#E{O+ZQ)OO'#FOO%rQ.jO'#FRO%rQ.jO'#FTOOQ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StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector SuffixedSelector Suffix Interpolation SassVariableName ValueName ) ( ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp LogicOp UnaryExpression LogicOp NamespacedValue CallExpression Callee ArgList : ... , CallLiteral CallTag ParenthesizedContent ClassSelector ClassName PseudoClassSelector :: PseudoClassName PseudoClassName ArgList PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp PlaceholderSelector ClassName Block { Declaration PropertyName Map Important Global Default ; } ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery UnaryQuery ParenthesizedQuery SelectorQuery selector IncludeStatement include Keyword MixinStatement mixin UseStatement use Keyword Star Keyword ExtendStatement extend RootStatement at-root ForwardStatement forward Keyword MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList Keyword Keyword SupportsStatement supports IfStatement ControlKeyword ControlKeyword Keyword ForStatement ControlKeyword Keyword EachStatement ControlKeyword Keyword WhileStatement ControlKeyword OutputStatement ControlKeyword AtRule Styles", 34751 maxTerm: 181, 34752 context: trackIndent2, 34753 nodeProps: [ 34754 ["openedBy", 1, "InterpolationStart", 5, "InterpolationEnd", 21, "(", 75, "{"], 34755 ["isolate", -3, 6, 7, 26, ""], 34756 ["closedBy", 22, ")", 67, "}"] 34757 ], 34758 propSources: [cssHighlighting2], 34759 skippedNodes: [0, 6, 7, 135], 34760 repeatNodeCount: 18, 34761 tokenData: "!!p~RyOq#rqr$jrs0jst2^tu8{uv;hvw;{wx<^xy={yz>^z{>c{|>||}Co}!ODQ!O!PDo!P!QFY!Q![Fk![!]Gf!]!^Hb!^!_Hs!_!`I[!`!aIs!a!b#r!b!cJt!c!}#r!}#OL^#O#P#r#P#QLo#Q#RMQ#R#T#r#T#UMg#U#c#r#c#dNx#d#o#r#o#p! _#p#qMQ#q#r! p#r#s!!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rz!O$R!O!P@U!P!Q$R!Q![Br![!g$R!g!h@{!h#X$R#X#Y@{#Y;'S$R;'S;=`$d<%lO$RZGkUtROy$Rz![$R![!]G}!];'S$R;'S;=`$d<%lO$RXHUS}PyWOy$Rz;'S$R;'S;=`$d<%lO$RZHgS!lROy$Rz;'S$R;'S;=`$d<%lO$RYHxUlQOy$Rz!_$R!_!`%c!`;'S$R;'S;=`$d<%lO$R^IaU![SOy$Rz!_$R!_!`%c!`;'S$R;'S;=`$d<%lO$RZIzV!^PlQOy$Rz!_$R!_!`%c!`!aJa!a;'S$R;'S;=`$d<%lO$RXJhS!^PyWOy$Rz;'S$R;'S;=`$d<%lO$RXJwWOy$Rz!c$R!c!}Ka!}#T$R#T#oKa#o;'S$R;'S;=`$d<%lO$RXKh[!oPyWOy$Rz}$R}!OKa!O!Q$R!Q![Ka![!c$R!c!}Ka!}#T$R#T#oKa#o;'S$R;'S;=`$d<%lO$RXLcS!YPOy$Rz;'S$R;'S;=`$d<%lO$R^LtS!WUOy$Rz;'S$R;'S;=`$d<%lO$R[MTUOy$Rz!_$R!_!`;T!`;'S$R;'S;=`$d<%lO$RZMjUOy$Rz#b$R#b#cM|#c;'S$R;'S;=`$d<%lO$RZNRUyWOy$Rz#W$R#W#XNe#X;'S$R;'S;=`$d<%lO$RZNlSmRyWOy$Rz;'S$R;'S;=`$d<%lO$RZN{UOy$Rz#f$R#f#gNe#g;'S$R;'S;=`$d<%lO$RZ! dS!eROy$Rz;'S$R;'S;=`$d<%lO$RZ! uS!mROy$Rz;'S$R;'S;=`$d<%lO$R]!!WU!aPOy$Rz!_$R!_!`;T!`;'S$R;'S;=`$d<%lO$RW!!mP;=`<%l#r", 34762 tokenizers: [indentation2, descendant2, interpolationEnd, unitToken2, identifiers2, spaces2, comments, indentedMixins, 0, 1, 2, 3], 34763 topRules: { "StyleSheet": [0, 10], "Styles": [1, 134] }, 34764 dialects: { indented: 0 }, 34765 specialized: [{ term: 158, get: (value) => spec_identifier4[value] || -1 }, { term: 157, get: (value) => spec_callee2[value] || -1 }, { term: 77, get: (value) => spec_AtKeyword2[value] || -1 }], 34766 tokenPrec: 3003 34767}); 34768
vendor: 1,373 bytes, lines 34769-34806
34769// node_modules/@codemirror/lang-sass/dist/index.js 34770var sassLanguage = /* @__PURE__ */ LRLanguage.define({ 34771 name: "sass", 34772 parser: /* @__PURE__ */ parser5.configure({ 34773 props: [ 34774 /* @__PURE__ */ foldNodeProp.add({ 34775 Block: foldInside, 34776 Comment(node, state) { 34777 return { from: node.from + 2, to: state.sliceDoc(node.to - 2, node.to) == "*/" ? node.to - 2 : node.to }; 34778 } 34779 }), 34780 /* @__PURE__ */ indentNodeProp.add({ 34781 Declaration: /* @__PURE__ */ continuedIndent() 34782 }) 34783 ] 34784 }), 34785 languageData: { 34786 commentTokens: { block: { open: "/*", close: "*/" }, line: "//" }, 34787 indentOnInput: /^\s*\}$/, 34788 wordChars: "$-" 34789 } 34790}); 34791var indentedSassLanguage = /* @__PURE__ */ sassLanguage.configure({ 34792 dialect: "indented", 34793 props: [ 34794 /* @__PURE__ */ indentNodeProp.add({ 34795 "Block RuleSet": (cx) => cx.baseIndent + cx.unit 34796 }), 34797 /* @__PURE__ */ foldNodeProp.add({ 34798 Block: (node) => ({ from: node.from, to: node.to }) 34799 }) 34800 ] 34801}); 34802var sassCompletionSource = /* @__PURE__ */ defineCSSCompletionSource((node) => node.name == "VariableName" || node.name == "SassVariableName"); 34803function sass(config2) { 34804 return new LanguageSupport((config2 === null || config2 === void 0 ? void 0 : config2.indented) ? indentedSassLanguage : sassLanguage, sassLanguage.data.of({ autocomplete: sassCompletionSource })); 34805} 34806
vendor: 37,733 bytes, lines 34807-35495
34807// node_modules/@codemirror/lang-sql/dist/index.js 34808var whitespace2 = 36; 34809var LineComment3 = 1; 34810var BlockComment2 = 2; 34811var String$1 = 3; 34812var Number2 = 4; 34813var Bool2 = 5; 34814var Null = 6; 34815var ParenL2 = 7; 34816var ParenR = 8; 34817var BraceL2 = 9; 34818var BraceR = 10; 34819var BracketL2 = 11; 34820var BracketR = 12; 34821var Semi = 13; 34822var Dot = 14; 34823var Operator = 15; 34824var Punctuation = 16; 34825var SpecialVar = 17; 34826var Identifier3 = 18; 34827var QuotedIdentifier = 19; 34828var Keyword = 20; 34829var Type = 21; 34830var Bits = 22; 34831var Bytes = 23; 34832var Builtin = 24; 34833function isAlpha3(ch) { 34834 return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57; 34835} 34836function isHexDigit(ch) { 34837 return ch >= 48 && ch <= 57 || ch >= 97 && ch <= 102 || ch >= 65 && ch <= 70; 34838} 34839function readLiteral(input, endQuote, backslashEscapes) { 34840 for (let escaped = false; ; ) { 34841 if (input.next < 0) 34842 return; 34843 if (input.next == endQuote && !escaped) { 34844 input.advance(); 34845 return; 34846 } 34847 escaped = backslashEscapes && !escaped && input.next == 92; 34848 input.advance(); 34849 } 34850} 34851function readDoubleDollarLiteral(input, tag) { 34852 scan: 34853 for (; ; ) { 34854 if (input.next < 0) 34855 return console.log("exit at end", input.pos); 34856 if (input.next == 36) { 34857 input.advance(); 34858 for (let i2 = 0; i2 < tag.length; i2++) { 34859 if (input.next != tag.charCodeAt(i2)) 34860 continue scan; 34861 input.advance(); 34862 } 34863 if (input.next == 36) { 34864 input.advance(); 34865 return; 34866 } 34867 } else { 34868 input.advance(); 34869 } 34870 } 34871} 34872function readPLSQLQuotedLiteral(input, openDelim) { 34873 let matchingDelim = "[{<(".indexOf(String.fromCharCode(openDelim)); 34874 let closeDelim = matchingDelim < 0 ? openDelim : "]}>)".charCodeAt(matchingDelim); 34875 for (; ; ) { 34876 if (input.next < 0) 34877 return; 34878 if (input.next == closeDelim && input.peek(1) == 39) { 34879 input.advance(2); 34880 return; 34881 } 34882 input.advance(); 34883 } 34884} 34885function readWord(input, result) { 34886 for (; ; ) { 34887 if (input.next != 95 && !isAlpha3(input.next)) 34888 break; 34889 if (result != null) 34890 result += String.fromCharCode(input.next); 34891 input.advance(); 34892 } 34893 return result; 34894} 34895function readWordOrQuoted(input) { 34896 if (input.next == 39 || input.next == 34 || input.next == 96) { 34897 let quote = input.next; 34898 input.advance(); 34899 readLiteral(input, quote, false); 34900 } else { 34901 readWord(input); 34902 } 34903} 34904function readBits(input, endQuote) { 34905 while (input.next == 48 || input.next == 49) 34906 input.advance(); 34907 if (endQuote && input.next == endQuote) 34908 input.advance(); 34909} 34910function readNumber(input, sawDot) { 34911 for (; ; ) { 34912 if (input.next == 46) { 34913 if (sawDot) 34914 break; 34915 sawDot = true; 34916 } else if (input.next < 48 || input.next > 57) { 34917 break; 34918 } 34919 input.advance(); 34920 } 34921 if (input.next == 69 || input.next == 101) { 34922 input.advance(); 34923 if (input.next == 43 || input.next == 45) 34924 input.advance(); 34925 while (input.next >= 48 && input.next <= 57) 34926 input.advance(); 34927 } 34928} 34929function eol(input) { 34930 while (!(input.next < 0 || input.next == 10)) 34931 input.advance(); 34932} 34933function inString(ch, str) { 34934 for (let i2 = 0; i2 < str.length; i2++) 34935 if (str.charCodeAt(i2) == ch) 34936 return true; 34937 return false; 34938} 34939var Space = " \r\n"; 34940function keywords2(keywords4, types2, builtin) { 34941 let result = /* @__PURE__ */ Object.create(null); 34942 result["true"] = result["false"] = Bool2; 34943 result["null"] = result["unknown"] = Null; 34944 for (let kw of keywords4.split(" ")) 34945 if (kw) 34946 result[kw] = Keyword; 34947 for (let tp of types2.split(" ")) 34948 if (tp) 34949 result[tp] = Type; 34950 for (let kw of (builtin || "").split(" ")) 34951 if (kw) 34952 result[kw] = Builtin; 34953 return result; 34954} 34955var SQLTypes = "array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying "; 34956var SQLKeywords = "absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone "; 34957var defaults3 = { 34958 backslashEscapes: false, 34959 hashComments: false, 34960 spaceAfterDashes: false, 34961 slashComments: false, 34962 doubleQuotedStrings: false, 34963 doubleDollarQuotedStrings: false, 34964 unquotedBitLiterals: false, 34965 treatBitsAsBytes: false, 34966 charSetCasts: false, 34967 plsqlQuotingMechanism: false, 34968 operatorChars: "*+-%<>!=&|~^/", 34969 specialVar: "?", 34970 identifierQuotes: '"', 34971 caseInsensitiveIdentifiers: false, 34972 words: /* @__PURE__ */ keywords2(SQLKeywords, SQLTypes) 34973}; 34974function dialect(spec, kws, types2, builtin) { 34975 let dialect2 = {}; 34976 for (let prop in defaults3) 34977 dialect2[prop] = (spec.hasOwnProperty(prop) ? spec : defaults3)[prop]; 34978 if (kws) 34979 dialect2.words = keywords2(kws, types2 || "", builtin); 34980 return dialect2; 34981} 34982function tokensFor(d2) { 34983 return new ExternalTokenizer((input) => { 34984 var _a3; 34985 let { next } = input; 34986 input.advance(); 34987 if (inString(next, Space)) { 34988 while (inString(input.next, Space)) 34989 input.advance(); 34990 input.acceptToken(whitespace2); 34991 } else if (next == 36 && d2.doubleDollarQuotedStrings) { 34992 let tag = readWord(input, ""); 34993 if (input.next == 36) { 34994 input.advance(); 34995 readDoubleDollarLiteral(input, tag); 34996 input.acceptToken(String$1); 34997 } 34998 } else if (next == 39 || next == 34 && d2.doubleQuotedStrings) { 34999 readLiteral(input, next, d2.backslashEscapes); 35000 input.acceptToken(String$1); 35001 } else if (next == 35 && d2.hashComments || next == 47 && input.next == 47 && d2.slashComments) { 35002 eol(input); 35003 input.acceptToken(LineComment3); 35004 } else if (next == 45 && input.next == 45 && (!d2.spaceAfterDashes || input.peek(1) == 32)) { 35005 eol(input); 35006 input.acceptToken(LineComment3); 35007 } else if (next == 47 && input.next == 42) { 35008 input.advance(); 35009 for (let depth = 1; ; ) { 35010 let cur2 = input.next; 35011 if (input.next < 0) 35012 break; 35013 input.advance(); 35014 if (cur2 == 42 && input.next == 47) { 35015 depth--; 35016 input.advance(); 35017 if (!depth) 35018 break; 35019 } else if (cur2 == 47 && input.next == 42) { 35020 depth++; 35021 input.advance(); 35022 } 35023 } 35024 input.acceptToken(BlockComment2); 35025 } else if ((next == 101 || next == 69) && input.next == 39) { 35026 input.advance(); 35027 readLiteral(input, 39, true); 35028 input.acceptToken(String$1); 35029 } else if ((next == 110 || next == 78) && input.next == 39 && d2.charSetCasts) { 35030 input.advance(); 35031 readLiteral(input, 39, d2.backslashEscapes); 35032 input.acceptToken(String$1); 35033 } else if (next == 95 && d2.charSetCasts) { 35034 for (let i2 = 0; ; i2++) { 35035 if (input.next == 39 && i2 > 1) { 35036 input.advance(); 35037 readLiteral(input, 39, d2.backslashEscapes); 35038 input.acceptToken(String$1); 35039 break; 35040 } 35041 if (!isAlpha3(input.next)) 35042 break; 35043 input.advance(); 35044 } 35045 } else if (d2.plsqlQuotingMechanism && (next == 113 || next == 81) && input.next == 39 && input.peek(1) > 0 && !inString(input.peek(1), Space)) { 35046 let openDelim = input.peek(1); 35047 input.advance(2); 35048 readPLSQLQuotedLiteral(input, openDelim); 35049 input.acceptToken(String$1); 35050 } else if (next == 40) { 35051 input.acceptToken(ParenL2); 35052 } else if (next == 41) { 35053 input.acceptToken(ParenR); 35054 } else if (next == 123) { 35055 input.acceptToken(BraceL2); 35056 } else if (next == 125) { 35057 input.acceptToken(BraceR); 35058 } else if (next == 91) { 35059 input.acceptToken(BracketL2); 35060 } else if (next == 93) { 35061 input.acceptToken(BracketR); 35062 } else if (next == 59) { 35063 input.acceptToken(Semi); 35064 } else if (d2.unquotedBitLiterals && next == 48 && input.next == 98) { 35065 input.advance(); 35066 readBits(input); 35067 input.acceptToken(Bits); 35068 } else if ((next == 98 || next == 66) && (input.next == 39 || input.next == 34)) { 35069 const quoteStyle = input.next; 35070 input.advance(); 35071 if (d2.treatBitsAsBytes) { 35072 readLiteral(input, quoteStyle, d2.backslashEscapes); 35073 input.acceptToken(Bytes); 35074 } else { 35075 readBits(input, quoteStyle); 35076 input.acceptToken(Bits); 35077 } 35078 } else if (next == 48 && (input.next == 120 || input.next == 88) || (next == 120 || next == 88) && input.next == 39) { 35079 let quoted = input.next == 39; 35080 input.advance(); 35081 while (isHexDigit(input.next)) 35082 input.advance(); 35083 if (quoted && input.next == 39) 35084 input.advance(); 35085 input.acceptToken(Number2); 35086 } else if (next == 46 && input.next >= 48 && input.next <= 57) { 35087 readNumber(input, true); 35088 input.acceptToken(Number2); 35089 } else if (next == 46) { 35090 input.acceptToken(Dot); 35091 } else if (next >= 48 && next <= 57) { 35092 readNumber(input, false); 35093 input.acceptToken(Number2); 35094 } else if (inString(next, d2.operatorChars)) { 35095 while (inString(input.next, d2.operatorChars)) 35096 input.advance(); 35097 input.acceptToken(Operator); 35098 } else if (inString(next, d2.specialVar)) { 35099 if (input.next == next) 35100 input.advance(); 35101 readWordOrQuoted(input); 35102 input.acceptToken(SpecialVar); 35103 } else if (inString(next, d2.identifierQuotes)) { 35104 readLiteral(input, next, false); 35105 input.acceptToken(QuotedIdentifier); 35106 } else if (next == 58 || next == 44) { 35107 input.acceptToken(Punctuation); 35108 } else if (isAlpha3(next)) { 35109 let word = readWord(input, String.fromCharCode(next)); 35110 input.acceptToken(input.next == 46 || input.peek(-word.length - 1) == 46 ? Identifier3 : (_a3 = d2.words[word.toLowerCase()]) !== null && _a3 !== void 0 ? _a3 : Identifier3); 35111 } 35112 }); 35113} 35114var tokens = /* @__PURE__ */ tokensFor(defaults3); 35115var parser$1 = /* @__PURE__ */ LRParser.deserialize({ 35116 version: 14, 35117 states: "%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw", 35118 stateData: ",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O", 35119 goto: "#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq", 35120 nodeNames: "\u26A0 LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement", 35121 maxTerm: 38, 35122 nodeProps: [ 35123 ["isolate", -4, 1, 2, 3, 19, ""] 35124 ], 35125 skippedNodes: [0, 1, 2], 35126 repeatNodeCount: 3, 35127 tokenData: "RORO", 35128 tokenizers: [0, tokens], 35129 topRules: { "Script": [0, 25] }, 35130 tokenPrec: 0 35131}); 35132function tokenBefore(tree) { 35133 let cursor = tree.cursor().moveTo(tree.from, -1); 35134 while (/Comment/.test(cursor.name)) 35135 cursor.moveTo(cursor.from, -1); 35136 return cursor.node; 35137} 35138function idName(doc2, node) { 35139 let text = doc2.sliceString(node.from, node.to); 35140 let quoted = /^([`'"])(.*)\1$/.exec(text); 35141 return quoted ? quoted[2] : text; 35142} 35143function plainID(node) { 35144 return node && (node.name == "Identifier" || node.name == "QuotedIdentifier"); 35145} 35146function pathFor(doc2, id2) { 35147 if (id2.name == "CompositeIdentifier") { 35148 let path = []; 35149 for (let ch = id2.firstChild; ch; ch = ch.nextSibling) 35150 if (plainID(ch)) 35151 path.push(idName(doc2, ch)); 35152 return path; 35153 } 35154 return [idName(doc2, id2)]; 35155} 35156function parentsFor(doc2, node) { 35157 for (let path = []; ; ) { 35158 if (!node || node.name != ".") 35159 return path; 35160 let name2 = tokenBefore(node); 35161 if (!plainID(name2)) 35162 return path; 35163 path.unshift(idName(doc2, name2)); 35164 node = tokenBefore(name2); 35165 } 35166} 35167function sourceContext(state, startPos) { 35168 let pos = syntaxTree(state).resolveInner(startPos, -1); 35169 let aliases = getAliases(state.doc, pos); 35170 if (pos.name == "Identifier" || pos.name == "QuotedIdentifier" || pos.name == "Keyword") { 35171 return { 35172 from: pos.from, 35173 quoted: pos.name == "QuotedIdentifier" ? state.doc.sliceString(pos.from, pos.from + 1) : null, 35174 parents: parentsFor(state.doc, tokenBefore(pos)), 35175 aliases 35176 }; 35177 } 35178 if (pos.name == ".") { 35179 return { from: startPos, quoted: null, parents: parentsFor(state.doc, pos), aliases }; 35180 } else { 35181 return { from: startPos, quoted: null, parents: [], empty: true, aliases }; 35182 } 35183} 35184var EndFrom = /* @__PURE__ */ new Set(/* @__PURE__ */ "where group having order union intersect except all distinct limit offset fetch for".split(" ")); 35185function getAliases(doc2, at) { 35186 let statement; 35187 for (let parent = at; !statement; parent = parent.parent) { 35188 if (!parent) 35189 return null; 35190 if (parent.name == "Statement") 35191 statement = parent; 35192 } 35193 let aliases = null; 35194 for (let scan = statement.firstChild, sawFrom = false, prevID = null; scan; scan = scan.nextSibling) { 35195 let kw = scan.name == "Keyword" ? doc2.sliceString(scan.from, scan.to).toLowerCase() : null; 35196 let alias = null; 35197 if (!sawFrom) { 35198 sawFrom = kw == "from"; 35199 } else if (kw == "as" && prevID && plainID(scan.nextSibling)) { 35200 alias = idName(doc2, scan.nextSibling); 35201 } else if (kw && EndFrom.has(kw)) { 35202 break; 35203 } else if (prevID && plainID(scan)) { 35204 alias = idName(doc2, scan); 35205 } 35206 if (alias) { 35207 if (!aliases) 35208 aliases = /* @__PURE__ */ Object.create(null); 35209 aliases[alias] = pathFor(doc2, prevID); 35210 } 35211 prevID = /Identifier$/.test(scan.name) ? scan : null; 35212 } 35213 return aliases; 35214} 35215function maybeQuoteCompletions(quote, completions) { 35216 if (!quote) 35217 return completions; 35218 return completions.map((c2) => Object.assign(Object.assign({}, c2), { label: c2.label[0] == quote ? c2.label : quote + c2.label + quote, apply: void 0 })); 35219} 35220var Span = /^\w*$/; 35221var QuotedSpan = /^[`'"]?\w*[`'"]?$/; 35222function isSelfTag(namespace) { 35223 return namespace.self && typeof namespace.self.label == "string"; 35224} 35225var CompletionLevel = class _CompletionLevel { 35226 constructor(idQuote, idCaseInsensitive) { 35227 this.idQuote = idQuote; 35228 this.idCaseInsensitive = idCaseInsensitive; 35229 this.list = []; 35230 this.children = void 0; 35231 } 35232 child(name2) { 35233 let children = this.children || (this.children = /* @__PURE__ */ Object.create(null)); 35234 let found = children[name2]; 35235 if (found) 35236 return found; 35237 if (name2 && !this.list.some((c2) => c2.label == name2)) 35238 this.list.push(nameCompletion(name2, "type", this.idQuote, this.idCaseInsensitive)); 35239 return children[name2] = new _CompletionLevel(this.idQuote, this.idCaseInsensitive); 35240 } 35241 maybeChild(name2) { 35242 return this.children ? this.children[name2] : null; 35243 } 35244 addCompletion(option) { 35245 let found = this.list.findIndex((o2) => o2.label == option.label); 35246 if (found > -1) 35247 this.list[found] = option; 35248 else 35249 this.list.push(option); 35250 } 35251 addCompletions(completions) { 35252 for (let option of completions) 35253 this.addCompletion(typeof option == "string" ? nameCompletion(option, "property", this.idQuote, this.idCaseInsensitive) : option); 35254 } 35255 addNamespace(namespace) { 35256 if (Array.isArray(namespace)) { 35257 this.addCompletions(namespace); 35258 } else if (isSelfTag(namespace)) { 35259 this.addNamespace(namespace.children); 35260 } else { 35261 this.addNamespaceObject(namespace); 35262 } 35263 } 35264 addNamespaceObject(namespace) { 35265 for (let name2 of Object.keys(namespace)) { 35266 let children = namespace[name2], self2 = null; 35267 let parts = name2.replace(/\\?\./g, (p2) => p2 == "." ? "\0" : p2).split("\0"); 35268 let scope = this; 35269 if (isSelfTag(children)) { 35270 self2 = children.self; 35271 children = children.children; 35272 } 35273 for (let i2 = 0; i2 < parts.length; i2++) { 35274 if (self2 && i2 == parts.length - 1) 35275 scope.addCompletion(self2); 35276 scope = scope.child(parts[i2].replace(/\\\./g, ".")); 35277 } 35278 scope.addNamespace(children); 35279 } 35280 } 35281}; 35282function nameCompletion(label, type, idQuote, idCaseInsensitive) { 35283 if (new RegExp("^[a-z_][a-z_\\d]*$", idCaseInsensitive ? "i" : "").test(label)) 35284 return { label, type }; 35285 return { label, type, apply: idQuote + label + idQuote }; 35286} 35287function completeFromSchema(schema, tables, schemas, defaultTableName, defaultSchemaName, dialect2) { 35288 var _a3; 35289 let idQuote = ((_a3 = dialect2 === null || dialect2 === void 0 ? void 0 : dialect2.spec.identifierQuotes) === null || _a3 === void 0 ? void 0 : _a3[0]) || '"'; 35290 let top2 = new CompletionLevel(idQuote, !!(dialect2 === null || dialect2 === void 0 ? void 0 : dialect2.spec.caseInsensitiveIdentifiers)); 35291 let defaultSchema = defaultSchemaName ? top2.child(defaultSchemaName) : null; 35292 top2.addNamespace(schema); 35293 if (tables) 35294 (defaultSchema || top2).addCompletions(tables); 35295 if (schemas) 35296 top2.addCompletions(schemas); 35297 if (defaultSchema) 35298 top2.addCompletions(defaultSchema.list); 35299 if (defaultTableName) 35300 top2.addCompletions((defaultSchema || top2).child(defaultTableName).list); 35301 return (context) => { 35302 let { parents, from, quoted, empty: empty2, aliases } = sourceContext(context.state, context.pos); 35303 if (empty2 && !context.explicit) 35304 return null; 35305 if (aliases && parents.length == 1) 35306 parents = aliases[parents[0]] || parents; 35307 let level = top2; 35308 for (let name2 of parents) { 35309 while (!level.children || !level.children[name2]) { 35310 if (level == top2 && defaultSchema) 35311 level = defaultSchema; 35312 else if (level == defaultSchema && defaultTableName) 35313 level = level.child(defaultTableName); 35314 else 35315 return null; 35316 } 35317 let next = level.maybeChild(name2); 35318 if (!next) 35319 return null; 35320 level = next; 35321 } 35322 let quoteAfter = quoted && context.state.sliceDoc(context.pos, context.pos + 1) == quoted; 35323 let options2 = level.list; 35324 if (level == top2 && aliases) 35325 options2 = options2.concat(Object.keys(aliases).map((name2) => ({ label: name2, type: "constant" }))); 35326 return { 35327 from, 35328 to: quoteAfter ? context.pos + 1 : void 0, 35329 options: maybeQuoteCompletions(quoted, options2), 35330 validFor: quoted ? QuotedSpan : Span 35331 }; 35332 }; 35333} 35334function completeKeywords(keywords4, upperCase) { 35335 let completions = Object.keys(keywords4).map((keyword2) => ({ 35336 label: upperCase ? keyword2.toUpperCase() : keyword2, 35337 type: keywords4[keyword2] == Type ? "type" : keywords4[keyword2] == Keyword ? "keyword" : "variable", 35338 boost: -1 35339 })); 35340 return ifNotIn(["QuotedIdentifier", "SpecialVar", "String", "LineComment", "BlockComment", "."], completeFromList(completions)); 35341} 35342var parser6 = /* @__PURE__ */ parser$1.configure({ 35343 props: [ 35344 /* @__PURE__ */ indentNodeProp.add({ 35345 Statement: /* @__PURE__ */ continuedIndent() 35346 }), 35347 /* @__PURE__ */ foldNodeProp.add({ 35348 Statement(tree, state) { 35349 return { from: Math.min(tree.from + 100, state.doc.lineAt(tree.from).to), to: tree.to }; 35350 }, 35351 BlockComment(tree) { 35352 return { from: tree.from + 2, to: tree.to - 2 }; 35353 } 35354 }), 35355 /* @__PURE__ */ styleTags({ 35356 Keyword: tags.keyword, 35357 Type: tags.typeName, 35358 Builtin: /* @__PURE__ */ tags.standard(tags.name), 35359 Bits: tags.number, 35360 Bytes: tags.string, 35361 Bool: tags.bool, 35362 Null: tags.null, 35363 Number: tags.number, 35364 String: tags.string, 35365 Identifier: tags.name, 35366 QuotedIdentifier: /* @__PURE__ */ tags.special(tags.string), 35367 SpecialVar: /* @__PURE__ */ tags.special(tags.name), 35368 LineComment: tags.lineComment, 35369 BlockComment: tags.blockComment, 35370 Operator: tags.operator, 35371 "Semi Punctuation": tags.punctuation, 35372 "( )": tags.paren, 35373 "{ }": tags.brace, 35374 "[ ]": tags.squareBracket 35375 }) 35376 ] 35377}); 35378var SQLDialect = class _SQLDialect { 35379 constructor(dialect2, language2, spec) { 35380 this.dialect = dialect2; 35381 this.language = language2; 35382 this.spec = spec; 35383 } 35384 /** 35385 Returns the language for this dialect as an extension. 35386 */ 35387 get extension() { 35388 return this.language.extension; 35389 } 35390 /** 35391 Define a new dialect. 35392 */ 35393 static define(spec) { 35394 let d2 = dialect(spec, spec.keywords, spec.types, spec.builtin); 35395 let language2 = LRLanguage.define({ 35396 name: "sql", 35397 parser: parser6.configure({ 35398 tokenizers: [{ from: tokens, to: tokensFor(d2) }] 35399 }), 35400 languageData: { 35401 commentTokens: { line: "--", block: { open: "/*", close: "*/" } }, 35402 closeBrackets: { brackets: ["(", "[", "{", "'", '"', "`"] } 35403 } 35404 }); 35405 return new _SQLDialect(d2, language2, spec); 35406 } 35407}; 35408function keywordCompletionSource(dialect2, upperCase = false) { 35409 return completeKeywords(dialect2.dialect.words, upperCase); 35410} 35411function keywordCompletion(dialect2, upperCase = false) { 35412 return dialect2.language.data.of({ 35413 autocomplete: keywordCompletionSource(dialect2, upperCase) 35414 }); 35415} 35416function schemaCompletionSource(config2) { 35417 return config2.schema ? completeFromSchema(config2.schema, config2.tables, config2.schemas, config2.defaultTable, config2.defaultSchema, config2.dialect || StandardSQL) : () => null; 35418} 35419function schemaCompletion(config2) { 35420 return config2.schema ? (config2.dialect || StandardSQL).language.data.of({ 35421 autocomplete: schemaCompletionSource(config2) 35422 }) : []; 35423} 35424function sql(config2 = {}) { 35425 let lang = config2.dialect || StandardSQL; 35426 return new LanguageSupport(lang.language, [schemaCompletion(config2), keywordCompletion(lang, !!config2.upperCaseKeywords)]); 35427} 35428var StandardSQL = /* @__PURE__ */ SQLDialect.define({}); 35429var PostgreSQL = /* @__PURE__ */ SQLDialect.define({ 35430 charSetCasts: true, 35431 doubleDollarQuotedStrings: true, 35432 operatorChars: "+-*/<>=~!@#%^&|`?", 35433 specialVar: "", 35434 keywords: SQLKeywords + "a abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom c cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion g generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull k key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower m mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner p parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time t table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes", 35435 types: SQLTypes + "bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml" 35436}); 35437var MySQLKeywords = "accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill"; 35438var MySQLTypes = SQLTypes + "bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed"; 35439var MySQLBuiltin = "charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee"; 35440var MySQL = /* @__PURE__ */ SQLDialect.define({ 35441 operatorChars: "*+-%<>!=&|^", 35442 charSetCasts: true, 35443 doubleQuotedStrings: true, 35444 unquotedBitLiterals: true, 35445 hashComments: true, 35446 spaceAfterDashes: true, 35447 specialVar: "@?", 35448 identifierQuotes: "`", 35449 keywords: SQLKeywords + "group_concat " + MySQLKeywords, 35450 types: MySQLTypes, 35451 builtin: MySQLBuiltin 35452}); 35453var MariaSQL = /* @__PURE__ */ SQLDialect.define({ 35454 operatorChars: "*+-%<>!=&|^", 35455 charSetCasts: true, 35456 doubleQuotedStrings: true, 35457 unquotedBitLiterals: true, 35458 hashComments: true, 35459 spaceAfterDashes: true, 35460 specialVar: "@?", 35461 identifierQuotes: "`", 35462 keywords: SQLKeywords + "always generated groupby_concat hard persistent shutdown soft virtual " + MySQLKeywords, 35463 types: MySQLTypes, 35464 builtin: MySQLBuiltin 35465}); 35466var MSSQL = /* @__PURE__ */ SQLDialect.define({ 35467 keywords: SQLKeywords + "trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock pivot readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx unpivot updlock with", 35468 types: SQLTypes + "bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml", 35469 builtin: "binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id", 35470 operatorChars: "*+-%<>!=^&|/", 35471 specialVar: "@" 35472}); 35473var SQLite = /* @__PURE__ */ SQLDialect.define({ 35474 keywords: SQLKeywords + "abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual", 35475 types: SQLTypes + "bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real", 35476 builtin: "auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width", 35477 operatorChars: "*+-%<>!=&|/~", 35478 identifierQuotes: '`"', 35479 specialVar: "@:?$" 35480}); 35481var Cassandra = /* @__PURE__ */ SQLDialect.define({ 35482 keywords: "add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime infinity NaN", 35483 types: SQLTypes + "ascii bigint blob counter frozen inet list map static text timeuuid tuple uuid varint", 35484 slashComments: true 35485}); 35486var PLSQL = /* @__PURE__ */ SQLDialect.define({ 35487 keywords: SQLKeywords + "abort accept access add all alter and any arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body by case cast char_base check close cluster clusters colauth column comment commit compress connected constant constraint crash create current currval cursor data_base database dba deallocate debugoff debugon declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry exception exception_init exchange exclusive exists external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base of off offline on online only option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw rebuild record ref references refresh rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work", 35488 builtin: "appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define echo editfile embedded feedback flagger flush heading headsep instance linesize lno loboffset logsource longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar repfooter repheader serveroutput shiftinout show showmode spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout timing trimout trimspool ttitle underline verify version wrap", 35489 types: SQLTypes + "ascii bfile bfilename bigserial bit blob dec long number nvarchar nvarchar2 serial smallint string text uid varchar2 xml", 35490 operatorChars: "*/+-%<>!=~", 35491 doubleQuotedStrings: true, 35492 charSetCasts: true, 35493 plsqlQuotingMechanism: true 35494}); 35495
vendor: 16,938 bytes, lines 35496-35889
35496// node_modules/@lezer/yaml/dist/index.js 35497var blockEnd = 63; 35498var eof3 = 64; 35499var DirectiveEnd = 1; 35500var DocEnd = 2; 35501var sequenceStartMark = 3; 35502var sequenceContinueMark = 4; 35503var explicitMapStartMark = 5; 35504var explicitMapContinueMark = 6; 35505var flowMapMark = 7; 35506var mapStartMark = 65; 35507var mapContinueMark = 66; 35508var Literal = 8; 35509var QuotedLiteral = 9; 35510var Anchor = 10; 35511var Alias = 11; 35512var Tag2 = 12; 35513var BlockLiteralContent = 13; 35514var BracketL3 = 19; 35515var FlowSequence = 20; 35516var Colon = 29; 35517var BraceL3 = 33; 35518var FlowMapping = 34; 35519var BlockLiteralHeader = 47; 35520var type_Top = 0; 35521var type_Seq = 1; 35522var type_Map = 2; 35523var type_Flow = 3; 35524var type_Lit = 4; 35525var Context = class { 35526 constructor(parent, depth, type) { 35527 this.parent = parent; 35528 this.depth = depth; 35529 this.type = type; 35530 this.hash = (parent ? parent.hash + parent.hash << 8 : 0) + depth + (depth << 4) + type; 35531 } 35532}; 35533Context.top = new Context(null, -1, type_Top); 35534function findColumn2(input, pos) { 35535 for (let col = 0, p2 = pos - input.pos - 1; ; p2--, col++) { 35536 let ch = input.peek(p2); 35537 if (isBreakSpace(ch) || ch == -1) 35538 return col; 35539 } 35540} 35541function isNonBreakSpace(ch) { 35542 return ch == 32 || ch == 9; 35543} 35544function isBreakSpace(ch) { 35545 return ch == 10 || ch == 13; 35546} 35547function isSpace2(ch) { 35548 return isNonBreakSpace(ch) || isBreakSpace(ch); 35549} 35550function isSep(ch) { 35551 return ch < 0 || isSpace2(ch); 35552} 35553var indentation3 = new ContextTracker({ 35554 start: Context.top, 35555 reduce(context, term) { 35556 return context.type == type_Flow && (term == FlowSequence || term == FlowMapping) ? context.parent : context; 35557 }, 35558 shift(context, term, stack, input) { 35559 if (term == sequenceStartMark) 35560 return new Context(context, findColumn2(input, input.pos), type_Seq); 35561 if (term == mapStartMark || term == explicitMapStartMark) 35562 return new Context(context, findColumn2(input, input.pos), type_Map); 35563 if (term == blockEnd) 35564 return context.parent; 35565 if (term == BracketL3 || term == BraceL3) 35566 return new Context(context, 0, type_Flow); 35567 if (term == BlockLiteralContent && context.type == type_Lit) 35568 return context.parent; 35569 if (term == BlockLiteralHeader) { 35570 let indent3 = /[1-9]/.exec(input.read(input.pos, stack.pos)); 35571 if (indent3) 35572 return new Context(context, context.depth + +indent3[0], type_Lit); 35573 } 35574 return context; 35575 }, 35576 hash(context) { 35577 return context.hash; 35578 } 35579}); 35580function three(input, ch, off = 0) { 35581 return input.peek(off) == ch && input.peek(off + 1) == ch && input.peek(off + 2) == ch && isSep(input.peek(off + 3)); 35582} 35583var newlines2 = new ExternalTokenizer((input, stack) => { 35584 if (input.next == -1 && stack.canShift(eof3)) 35585 return input.acceptToken(eof3); 35586 let prev = input.peek(-1); 35587 if ((isBreakSpace(prev) || prev < 0) && stack.context.type != type_Flow) { 35588 if (three( 35589 input, 35590 45 35591 /* '-' */ 35592 )) { 35593 if (stack.canShift(blockEnd)) 35594 input.acceptToken(blockEnd); 35595 else 35596 return input.acceptToken(DirectiveEnd, 3); 35597 } 35598 if (three( 35599 input, 35600 46 35601 /* '.' */ 35602 )) { 35603 if (stack.canShift(blockEnd)) 35604 input.acceptToken(blockEnd); 35605 else 35606 return input.acceptToken(DocEnd, 3); 35607 } 35608 let depth = 0; 35609 while (input.next == 32) { 35610 depth++; 35611 input.advance(); 35612 } 35613 if ((depth < stack.context.depth || depth == stack.context.depth && stack.context.type == type_Seq && (input.next != 45 || !isSep(input.peek(1)))) && // Not blank 35614 input.next != -1 && !isBreakSpace(input.next) && input.next != 35) 35615 input.acceptToken(blockEnd, -depth); 35616 } 35617}, { contextual: true }); 35618var blockMark = new ExternalTokenizer((input, stack) => { 35619 if (stack.context.type == type_Flow) { 35620 if (input.next == 63) { 35621 input.advance(); 35622 if (isSep(input.next)) 35623 input.acceptToken(flowMapMark); 35624 } 35625 return; 35626 } 35627 if (input.next == 45) { 35628 input.advance(); 35629 if (isSep(input.next)) 35630 input.acceptToken(stack.context.type == type_Seq && stack.context.depth == findColumn2(input, input.pos - 1) ? sequenceContinueMark : sequenceStartMark); 35631 } else if (input.next == 63) { 35632 input.advance(); 35633 if (isSep(input.next)) 35634 input.acceptToken(stack.context.type == type_Map && stack.context.depth == findColumn2(input, input.pos - 1) ? explicitMapContinueMark : explicitMapStartMark); 35635 } else { 35636 let start = input.pos; 35637 for (; ; ) { 35638 if (isNonBreakSpace(input.next)) { 35639 if (input.pos == start) 35640 return; 35641 input.advance(); 35642 } else if (input.next == 33) { 35643 readTag(input); 35644 } else if (input.next == 38) { 35645 readAnchor(input); 35646 } else if (input.next == 42) { 35647 readAnchor(input); 35648 break; 35649 } else if (input.next == 39 || input.next == 34) { 35650 if (readQuoted(input, true)) 35651 break; 35652 return; 35653 } else if (input.next == 91 || input.next == 123) { 35654 if (!scanBrackets(input)) 35655 return; 35656 break; 35657 } else { 35658 readPlain(input, true, false, 0); 35659 break; 35660 } 35661 } 35662 while (isNonBreakSpace(input.next)) 35663 input.advance(); 35664 if (input.next == 58) { 35665 if (input.pos == start && stack.canShift(Colon)) 35666 return; 35667 let after = input.peek(1); 35668 if (isSep(after)) 35669 input.acceptTokenTo(stack.context.type == type_Map && stack.context.depth == findColumn2(input, start) ? mapContinueMark : mapStartMark, start); 35670 } 35671 } 35672}, { contextual: true }); 35673function uriChar(ch) { 35674 return ch > 32 && ch < 127 && ch != 34 && ch != 37 && ch != 44 && ch != 60 && ch != 62 && ch != 92 && ch != 94 && ch != 96 && ch != 123 && ch != 124 && ch != 125; 35675} 35676function hexChar(ch) { 35677 return ch >= 48 && ch <= 57 || ch >= 97 && ch <= 102 || ch >= 65 && ch <= 70; 35678} 35679function readUriChar(input, quoted) { 35680 if (input.next == 37) { 35681 input.advance(); 35682 if (hexChar(input.next)) 35683 input.advance(); 35684 if (hexChar(input.next)) 35685 input.advance(); 35686 return true; 35687 } else if (uriChar(input.next) || quoted && input.next == 44) { 35688 input.advance(); 35689 return true; 35690 } 35691 return false; 35692} 35693function readTag(input) { 35694 input.advance(); 35695 if (input.next == 60) { 35696 input.advance(); 35697 for (; ; ) { 35698 if (!readUriChar(input, true)) { 35699 if (input.next == 62) 35700 input.advance(); 35701 break; 35702 } 35703 } 35704 } else { 35705 while (readUriChar(input, false)) { 35706 } 35707 } 35708} 35709function readAnchor(input) { 35710 input.advance(); 35711 while (!isSep(input.next) && charTag(input.tag) != "f") 35712 input.advance(); 35713} 35714function readQuoted(input, scan) { 35715 let quote = input.next, lineBreak = false, start = input.pos; 35716 input.advance(); 35717 for (; ; ) { 35718 let ch = input.next; 35719 if (ch < 0) 35720 break; 35721 input.advance(); 35722 if (ch == quote) { 35723 if (ch == 39) { 35724 if (input.next == 39) 35725 input.advance(); 35726 else 35727 break; 35728 } else { 35729 break; 35730 } 35731 } else if (ch == 92 && quote == 34) { 35732 if (input.next >= 0) 35733 input.advance(); 35734 } else if (isBreakSpace(ch)) { 35735 if (scan) 35736 return false; 35737 lineBreak = true; 35738 } else if (scan && input.pos >= start + 1024) { 35739 return false; 35740 } 35741 } 35742 return !lineBreak; 35743} 35744function scanBrackets(input) { 35745 for (let stack = [], end = input.pos + 1024; ; ) { 35746 if (input.next == 91 || input.next == 123) { 35747 stack.push(input.next); 35748 input.advance(); 35749 } else if (input.next == 39 || input.next == 34) { 35750 if (!readQuoted(input, true)) 35751 return false; 35752 } else if (input.next == 93 || input.next == 125) { 35753 if (stack[stack.length - 1] != input.next - 2) 35754 return false; 35755 stack.pop(); 35756 input.advance(); 35757 if (!stack.length) 35758 return true; 35759 } else if (input.next < 0 || input.pos > end || isBreakSpace(input.next)) { 35760 return false; 35761 } else { 35762 input.advance(); 35763 } 35764 } 35765} 35766var charTable = "iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif"; 35767function charTag(ch) { 35768 if (ch < 33) 35769 return "u"; 35770 if (ch > 125) 35771 return "s"; 35772 return charTable[ch - 33]; 35773} 35774function isSafe(ch, inFlow) { 35775 let tag = charTag(ch); 35776 return tag != "u" && !(inFlow && tag == "f"); 35777} 35778function readPlain(input, scan, inFlow, indent3) { 35779 if (charTag(input.next) == "s" || (input.next == 63 || input.next == 58 || input.next == 45) && isSafe(input.peek(1), inFlow)) { 35780 input.advance(); 35781 } else { 35782 return false; 35783 } 35784 let start = input.pos; 35785 for (; ; ) { 35786 let next = input.next, off = 0, lineIndent = indent3 + 1; 35787 while (isSpace2(next)) { 35788 if (isBreakSpace(next)) { 35789 if (scan) 35790 return false; 35791 lineIndent = 0; 35792 } else { 35793 lineIndent++; 35794 } 35795 next = input.peek(++off); 35796 } 35797 let safe = next >= 0 && (next == 58 ? isSafe(input.peek(off + 1), inFlow) : next == 35 ? input.peek(off - 1) != 32 : isSafe(next, inFlow)); 35798 if (!safe || !inFlow && lineIndent <= indent3 || lineIndent == 0 && !inFlow && (three(input, 45, off) || three(input, 46, off))) 35799 break; 35800 if (scan && charTag(next) == "f") 35801 return false; 35802 for (let i2 = off; i2 >= 0; i2--) 35803 input.advance(); 35804 if (scan && input.pos > start + 1024) 35805 return false; 35806 } 35807 return true; 35808} 35809var literals = new ExternalTokenizer((input, stack) => { 35810 if (input.next == 33) { 35811 readTag(input); 35812 input.acceptToken(Tag2); 35813 } else if (input.next == 38 || input.next == 42) { 35814 let token = input.next == 38 ? Anchor : Alias; 35815 readAnchor(input); 35816 input.acceptToken(token); 35817 } else if (input.next == 39 || input.next == 34) { 35818 readQuoted(input, false); 35819 input.acceptToken(QuotedLiteral); 35820 } else if (readPlain(input, false, stack.context.type == type_Flow, stack.context.depth)) { 35821 input.acceptToken(Literal); 35822 } 35823}); 35824var blockLiteral = new ExternalTokenizer((input, stack) => { 35825 let indent3 = stack.context.type == type_Lit ? stack.context.depth : -1, upto = input.pos; 35826 scan: 35827 for (; ; ) { 35828 let depth = 0, next = input.next; 35829 while (next == 32) 35830 next = input.peek(++depth); 35831 if (!depth && (three(input, 45, depth) || three(input, 46, depth))) 35832 break; 35833 if (!isBreakSpace(next)) { 35834 if (indent3 < 0) 35835 indent3 = Math.max(stack.context.depth + 1, depth); 35836 if (depth < indent3) 35837 break; 35838 } 35839 for (; ; ) { 35840 if (input.next < 0) 35841 break scan; 35842 let isBreak = isBreakSpace(input.next); 35843 input.advance(); 35844 if (isBreak) 35845 continue scan; 35846 upto = input.pos; 35847 } 35848 } 35849 input.acceptTokenTo(BlockLiteralContent, upto); 35850}); 35851var yamlHighlighting = styleTags({ 35852 DirectiveName: tags.keyword, 35853 DirectiveContent: tags.attributeValue, 35854 "DirectiveEnd DocEnd": tags.meta, 35855 QuotedLiteral: tags.string, 35856 BlockLiteralHeader: tags.special(tags.string), 35857 BlockLiteralContent: tags.content, 35858 Literal: tags.content, 35859 "Key/Literal Key/QuotedLiteral": tags.definition(tags.propertyName), 35860 "Anchor Alias": tags.labelName, 35861 Tag: tags.typeName, 35862 Comment: tags.lineComment, 35863 ": , -": tags.separator, 35864 "?": tags.punctuation, 35865 "[ ]": tags.squareBracket, 35866 "{ }": tags.brace 35867}); 35868var parser7 = LRParser.deserialize({ 35869 version: 14, 35870 states: "5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#D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#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv", 35873 nodeNames: "\u26A0 DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document", 35874 maxTerm: 74, 35875 context: indentation3, 35876 nodeProps: [ 35877 ["isolate", -3, 8, 9, 14, ""], 35878 ["openedBy", 18, "[", 32, "{"], 35879 ["closedBy", 19, "]", 33, "}"] 35880 ], 35881 propSources: [yamlHighlighting], 35882 skippedNodes: [0], 35883 repeatNodeCount: 6, 35884 tokenData: "-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P", 35885 tokenizers: [newlines2, blockMark, literals, blockLiteral, 0, 1], 35886 topRules: { "Stream": [0, 15] }, 35887 tokenPrec: 0 35888}); 35889
vendor: 2,702 bytes, lines 35890-35953
35890// node_modules/@codemirror/lang-yaml/dist/index.js 35891var parser8 = /* @__PURE__ */ LRParser.deserialize({ 35892 version: 14, 35893 states: "!vOQOPOOO]OPO'#C_OhOPO'#C^OOOO'#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d", 35894 stateData: "!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~", 35895 goto: "vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS", 35896 nodeNames: "\u26A0 Document Frontmatter DashLine FrontmatterContent Body", 35897 maxTerm: 10, 35898 skippedNodes: [0], 35899 repeatNodeCount: 2, 35900 tokenData: "$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~", 35901 tokenizers: [0], 35902 topRules: { "Document": [0, 1] }, 35903 tokenPrec: 67 35904}); 35905var yamlLanguage = /* @__PURE__ */ LRLanguage.define({ 35906 name: "yaml", 35907 parser: /* @__PURE__ */ parser7.configure({ 35908 props: [ 35909 /* @__PURE__ */ indentNodeProp.add({ 35910 Stream: (cx) => { 35911 for (let before = cx.node.resolve(cx.pos, -1); before && before.to >= cx.pos; before = before.parent) { 35912 if (before.name == "BlockLiteralContent" && before.from < before.to) 35913 return cx.baseIndentFor(before); 35914 if (before.name == "BlockLiteral") 35915 return cx.baseIndentFor(before) + cx.unit; 35916 if (before.name == "BlockSequence" || before.name == "BlockMapping") 35917 return cx.column(before.from, 1); 35918 if (before.name == "QuotedLiteral") 35919 return null; 35920 if (before.name == "Literal") { 35921 let col = cx.column(before.from, 1); 35922 if (col == cx.lineIndent(before.from, 1)) 35923 return col; 35924 if (before.to > cx.pos) 35925 return null; 35926 } 35927 } 35928 return null; 35929 }, 35930 FlowMapping: /* @__PURE__ */ delimitedIndent({ closing: "}" }), 35931 FlowSequence: /* @__PURE__ */ delimitedIndent({ closing: "]" }) 35932 }), 35933 /* @__PURE__ */ foldNodeProp.add({ 35934 "FlowMapping FlowSequence": foldInside, 35935 "BlockSequence Pair BlockLiteral": (node, state) => ({ from: state.doc.lineAt(node.from).to, to: node.to }) 35936 }) 35937 ] 35938 }), 35939 languageData: { 35940 commentTokens: { line: "#" }, 35941 indentOnInput: /^\s*[\]\}]$/ 35942 } 35943}); 35944function yaml() { 35945 return new LanguageSupport(yamlLanguage); 35946} 35947var frontmatterLanguage = /* @__PURE__ */ LRLanguage.define({ 35948 name: "yaml-frontmatter", 35949 parser: /* @__PURE__ */ parser8.configure({ 35950 props: [/* @__PURE__ */ styleTags({ DashLine: tags.meta })] 35951 }) 35952}); 35953
vendor: 5,868 bytes, lines 35954-36151
35954// node_modules/@codemirror/legacy-modes/mode/r.js 35955function wordObj(words) { 35956 var res = {}; 35957 for (var i2 = 0; i2 < words.length; ++i2) 35958 res[words[i2]] = true; 35959 return res; 35960} 35961var commonAtoms = ["NULL", "NA", "Inf", "NaN", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_", "TRUE", "FALSE"]; 35962var commonBuiltins = ["list", "quote", "bquote", "eval", "return", "call", "parse", "deparse"]; 35963var commonKeywords = ["if", "else", "repeat", "while", "function", "for", "in", "next", "break"]; 35964var commonBlockKeywords = ["if", "else", "repeat", "while", "function", "for"]; 35965var atoms = wordObj(commonAtoms); 35966var builtins = wordObj(commonBuiltins); 35967var keywords3 = wordObj(commonKeywords); 35968var blockkeywords = wordObj(commonBlockKeywords); 35969var opChars = /[+\-*\/^<>=!&|~$:]/; 35970var curPunc; 35971function tokenBase(stream, state) { 35972 curPunc = null; 35973 var ch = stream.next(); 35974 if (ch == "#") { 35975 stream.skipToEnd(); 35976 return "comment"; 35977 } else if (ch == "0" && stream.eat("x")) { 35978 stream.eatWhile(/[\da-f]/i); 35979 return "number"; 35980 } else if (ch == "." && stream.eat(/\d/)) { 35981 stream.match(/\d*(?:e[+\-]?\d+)?/); 35982 return "number"; 35983 } else if (/\d/.test(ch)) { 35984 stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); 35985 return "number"; 35986 } else if (ch == "'" || ch == '"') { 35987 state.tokenize = tokenString(ch); 35988 return "string"; 35989 } else if (ch == "`") { 35990 stream.match(/[^`]+`/); 35991 return "string.special"; 35992 } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) { 35993 return "keyword"; 35994 } else if (/[a-zA-Z\.]/.test(ch)) { 35995 stream.eatWhile(/[\w\.]/); 35996 var word = stream.current(); 35997 if (atoms.propertyIsEnumerable(word)) 35998 return "atom"; 35999 if (keywords3.propertyIsEnumerable(word)) { 36000 if (blockkeywords.propertyIsEnumerable(word) && !stream.match(/\s*if(\s+|$)/, false)) 36001 curPunc = "block"; 36002 return "keyword"; 36003 } 36004 if (builtins.propertyIsEnumerable(word)) 36005 return "builtin"; 36006 return "variable"; 36007 } else if (ch == "%") { 36008 if (stream.skipTo("%")) 36009 stream.next(); 36010 return "variableName.special"; 36011 } else if (ch == "<" && stream.eat("-") || ch == "<" && stream.match("<-") || ch == "-" && stream.match(/>>?/)) { 36012 return "operator"; 36013 } else if (ch == "=" && state.ctx.argList) { 36014 return "operator"; 36015 } else if (opChars.test(ch)) { 36016 if (ch == "$") 36017 return "operator"; 36018 stream.eatWhile(opChars); 36019 return "operator"; 36020 } else if (/[\(\){}\[\];]/.test(ch)) { 36021 curPunc = ch; 36022 if (ch == ";") 36023 return "punctuation"; 36024 return null; 36025 } else { 36026 return null; 36027 } 36028} 36029function tokenString(quote) { 36030 return function(stream, state) { 36031 if (stream.eat("\\")) { 36032 var ch = stream.next(); 36033 if (ch == "x") 36034 stream.match(/^[a-f0-9]{2}/i); 36035 else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) 36036 stream.next(); 36037 else if (ch == "u") 36038 stream.match(/^[a-f0-9]{4}/i); 36039 else if (ch == "U") 36040 stream.match(/^[a-f0-9]{8}/i); 36041 else if (/[0-7]/.test(ch)) 36042 stream.match(/^[0-7]{1,2}/); 36043 return "string.special"; 36044 } else { 36045 var next; 36046 while ((next = stream.next()) != null) { 36047 if (next == quote) { 36048 state.tokenize = tokenBase; 36049 break; 36050 } 36051 if (next == "\\") { 36052 stream.backUp(1); 36053 break; 36054 } 36055 } 36056 return "string"; 36057 } 36058 }; 36059} 36060var ALIGN_YES = 1; 36061var ALIGN_NO = 2; 36062var BRACELESS = 4; 36063function push(state, type, stream) { 36064 state.ctx = { 36065 type, 36066 indent: state.indent, 36067 flags: 0, 36068 column: stream.column(), 36069 prev: state.ctx 36070 }; 36071} 36072function setFlag(state, flag) { 36073 var ctx = state.ctx; 36074 state.ctx = { 36075 type: ctx.type, 36076 indent: ctx.indent, 36077 flags: ctx.flags | flag, 36078 column: ctx.column, 36079 prev: ctx.prev 36080 }; 36081} 36082function pop(state) { 36083 state.indent = state.ctx.indent; 36084 state.ctx = state.ctx.prev; 36085} 36086var r = { 36087 name: "r", 36088 startState: function(indentUnit2) { 36089 return { 36090 tokenize: tokenBase, 36091 ctx: { 36092 type: "top", 36093 indent: -indentUnit2, 36094 flags: ALIGN_NO 36095 }, 36096 indent: 0, 36097 afterIdent: false 36098 }; 36099 }, 36100 token: function(stream, state) { 36101 if (stream.sol()) { 36102 if ((state.ctx.flags & 3) == 0) 36103 state.ctx.flags |= ALIGN_NO; 36104 if (state.ctx.flags & BRACELESS) 36105 pop(state); 36106 state.indent = stream.indentation(); 36107 } 36108 if (stream.eatSpace()) 36109 return null; 36110 var style = state.tokenize(stream, state); 36111 if (style != "comment" && (state.ctx.flags & ALIGN_NO) == 0) 36112 setFlag(state, ALIGN_YES); 36113 if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && state.ctx.type == "block") 36114 pop(state); 36115 if (curPunc == "{") 36116 push(state, "}", stream); 36117 else if (curPunc == "(") { 36118 push(state, ")", stream); 36119 if (state.afterIdent) 36120 state.ctx.argList = true; 36121 } else if (curPunc == "[") 36122 push(state, "]", stream); 36123 else if (curPunc == "block") 36124 push(state, "block", stream); 36125 else if (curPunc == state.ctx.type) 36126 pop(state); 36127 else if (state.ctx.type == "block" && style != "comment") 36128 setFlag(state, BRACELESS); 36129 state.afterIdent = style == "variable" || style == "keyword"; 36130 return style; 36131 }, 36132 indent: function(state, textAfter, cx) { 36133 if (state.tokenize != tokenBase) 36134 return 0; 36135 var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, closing2 = firstChar == ctx.type; 36136 if (ctx.flags & BRACELESS) 36137 ctx = ctx.prev; 36138 if (ctx.type == "block") 36139 return ctx.indent + (firstChar == "{" ? 0 : cx.unit); 36140 else if (ctx.flags & ALIGN_YES) 36141 return ctx.column + (closing2 ? 0 : 1); 36142 else 36143 return ctx.indent + (closing2 ? 0 : cx.unit); 36144 }, 36145 languageData: { 36146 wordChars: ".", 36147 commentTokens: { line: "#" }, 36148 autocomplete: commonAtoms.concat(commonBuiltins, commonKeywords) 36149 } 36150}; 36151
vendor: 1,042 bytes, lines 36152-36186
36152// node_modules/crelt/index.js 36153function crelt() { 36154 var elt = arguments[0]; 36155 if (typeof elt == "string") 36156 elt = document.createElement(elt); 36157 var i2 = 1, next = arguments[1]; 36158 if (next && typeof next == "object" && next.nodeType == null && !Array.isArray(next)) { 36159 for (var name2 in next) 36160 if (Object.prototype.hasOwnProperty.call(next, name2)) { 36161 var value = next[name2]; 36162 if (typeof value == "string") 36163 elt.setAttribute(name2, value); 36164 else if (value != null) 36165 elt[name2] = value; 36166 } 36167 i2++; 36168 } 36169 for (; i2 < arguments.length; i2++) 36170 add(elt, arguments[i2]); 36171 return elt; 36172} 36173function add(elt, child) { 36174 if (typeof child == "string") { 36175 elt.appendChild(document.createTextNode(child)); 36176 } else if (child == null) { 36177 } else if (child.nodeType != null) { 36178 elt.appendChild(child); 36179 } else if (Array.isArray(child)) { 36180 for (var i2 = 0; i2 < child.length; i2++) 36181 add(elt, child[i2]); 36182 } else { 36183 throw new RangeError("Unsupported child node: " + child); 36184 } 36185} 36186
vendor: 22,186 bytes, lines 36187-36823
36187// node_modules/@codemirror/lint/dist/index.js 36188var SelectedDiagnostic = class { 36189 constructor(from, to, diagnostic) { 36190 this.from = from; 36191 this.to = to; 36192 this.diagnostic = diagnostic; 36193 } 36194}; 36195var LintState = class _LintState { 36196 constructor(diagnostics, panel, selected) { 36197 this.diagnostics = diagnostics; 36198 this.panel = panel; 36199 this.selected = selected; 36200 } 36201 static init(diagnostics, panel, state) { 36202 let markedDiagnostics = diagnostics; 36203 let diagnosticFilter2 = state.facet(lintConfig).markerFilter; 36204 if (diagnosticFilter2) 36205 markedDiagnostics = diagnosticFilter2(markedDiagnostics); 36206 let ranges = Decoration.set(markedDiagnostics.map((d2) => { 36207 return d2.from == d2.to || d2.from == d2.to - 1 && state.doc.lineAt(d2.from).to == d2.from ? Decoration.widget({ 36208 widget: new DiagnosticWidget(d2), 36209 diagnostic: d2 36210 }).range(d2.from) : Decoration.mark({ 36211 attributes: { class: "cm-lintRange cm-lintRange-" + d2.severity + (d2.markClass ? " " + d2.markClass : "") }, 36212 diagnostic: d2 36213 }).range(d2.from, d2.to); 36214 }), true); 36215 return new _LintState(ranges, panel, findDiagnostic(ranges)); 36216 } 36217}; 36218function findDiagnostic(diagnostics, diagnostic = null, after = 0) { 36219 let found = null; 36220 diagnostics.between(after, 1e9, (from, to, { spec }) => { 36221 if (diagnostic && spec.diagnostic != diagnostic) 36222 return; 36223 found = new SelectedDiagnostic(from, to, spec.diagnostic); 36224 return false; 36225 }); 36226 return found; 36227} 36228function hideTooltip(tr, tooltip) { 36229 let line = tr.startState.doc.lineAt(tooltip.pos); 36230 return !!(tr.effects.some((e2) => e2.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, line.to)); 36231} 36232function maybeEnableLint(state, effects) { 36233 return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions)); 36234} 36235function setDiagnostics(state, diagnostics) { 36236 return { 36237 effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)]) 36238 }; 36239} 36240var setDiagnosticsEffect = /* @__PURE__ */ StateEffect.define(); 36241var togglePanel = /* @__PURE__ */ StateEffect.define(); 36242var movePanelSelection = /* @__PURE__ */ StateEffect.define(); 36243var lintState = /* @__PURE__ */ StateField.define({ 36244 create() { 36245 return new LintState(Decoration.none, null, null); 36246 }, 36247 update(value, tr) { 36248 if (tr.docChanged) { 36249 let mapped = value.diagnostics.map(tr.changes), selected = null; 36250 if (value.selected) { 36251 let selPos = tr.changes.mapPos(value.selected.from, 1); 36252 selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos); 36253 } 36254 value = new LintState(mapped, value.panel, selected); 36255 } 36256 for (let effect of tr.effects) { 36257 if (effect.is(setDiagnosticsEffect)) { 36258 value = LintState.init(effect.value, value.panel, tr.state); 36259 } else if (effect.is(togglePanel)) { 36260 value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected); 36261 } else if (effect.is(movePanelSelection)) { 36262 value = new LintState(value.diagnostics, value.panel, effect.value); 36263 } 36264 } 36265 return value; 36266 }, 36267 provide: (f3) => [ 36268 showPanel.from(f3, (val) => val.panel), 36269 EditorView.decorations.from(f3, (s2) => s2.diagnostics) 36270 ] 36271}); 36272var activeMark = /* @__PURE__ */ Decoration.mark({ class: "cm-lintRange cm-lintRange-active" }); 36273function lintTooltip(view, pos, side) { 36274 let { diagnostics } = view.state.field(lintState); 36275 let found = [], stackStart = 2e8, stackEnd = 0; 36276 diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, { spec }) => { 36277 if (pos >= from && pos <= to && (from == to || (pos > from || side > 0) && (pos < to || side < 0))) { 36278 found.push(spec.diagnostic); 36279 stackStart = Math.min(from, stackStart); 36280 stackEnd = Math.max(to, stackEnd); 36281 } 36282 }); 36283 let diagnosticFilter2 = view.state.facet(lintConfig).tooltipFilter; 36284 if (diagnosticFilter2) 36285 found = diagnosticFilter2(found); 36286 if (!found.length) 36287 return null; 36288 return { 36289 pos: stackStart, 36290 end: stackEnd, 36291 above: view.state.doc.lineAt(stackStart).to < stackEnd, 36292 create() { 36293 return { dom: diagnosticsTooltip(view, found) }; 36294 } 36295 }; 36296} 36297function diagnosticsTooltip(view, diagnostics) { 36298 return crelt("ul", { class: "cm-tooltip-lint" }, diagnostics.map((d2) => renderDiagnostic(view, d2, false))); 36299} 36300var openLintPanel = (view) => { 36301 let field = view.state.field(lintState, false); 36302 if (!field || !field.panel) 36303 view.dispatch({ effects: maybeEnableLint(view.state, [togglePanel.of(true)]) }); 36304 let panel = getPanel(view, LintPanel.open); 36305 if (panel) 36306 panel.dom.querySelector(".cm-panel-lint ul").focus(); 36307 return true; 36308}; 36309var closeLintPanel = (view) => { 36310 let field = view.state.field(lintState, false); 36311 if (!field || !field.panel) 36312 return false; 36313 view.dispatch({ effects: togglePanel.of(false) }); 36314 return true; 36315}; 36316var nextDiagnostic = (view) => { 36317 let field = view.state.field(lintState, false); 36318 if (!field) 36319 return false; 36320 let sel = view.state.selection.main, next = field.diagnostics.iter(sel.to + 1); 36321 if (!next.value) { 36322 next = field.diagnostics.iter(0); 36323 if (!next.value || next.from == sel.from && next.to == sel.to) 36324 return false; 36325 } 36326 view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true }); 36327 return true; 36328}; 36329var lintKeymap = [ 36330 { key: "Mod-Shift-m", run: openLintPanel, preventDefault: true }, 36331 { key: "F8", run: nextDiagnostic } 36332]; 36333var lintConfig = /* @__PURE__ */ Facet.define({ 36334 combine(input) { 36335 return Object.assign({ sources: input.map((i2) => i2.source) }, combineConfig(input.map((i2) => i2.config), { 36336 delay: 750, 36337 markerFilter: null, 36338 tooltipFilter: null, 36339 needsRefresh: null 36340 }, { 36341 needsRefresh: (a2, b3) => !a2 ? b3 : !b3 ? a2 : (u3) => a2(u3) || b3(u3) 36342 })); 36343 } 36344}); 36345function assignKeys(actions) { 36346 let assigned = []; 36347 if (actions) 36348 actions: 36349 for (let { name: name2 } of actions) { 36350 for (let i2 = 0; i2 < name2.length; i2++) { 36351 let ch = name2[i2]; 36352 if (/[a-zA-Z]/.test(ch) && !assigned.some((c2) => c2.toLowerCase() == ch.toLowerCase())) { 36353 assigned.push(ch); 36354 continue actions; 36355 } 36356 } 36357 assigned.push(""); 36358 } 36359 return assigned; 36360} 36361function renderDiagnostic(view, diagnostic, inPanel) { 36362 var _a3; 36363 let keys = inPanel ? assignKeys(diagnostic.actions) : []; 36364 return crelt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, crelt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a3 = diagnostic.actions) === null || _a3 === void 0 ? void 0 : _a3.map((action, i2) => { 36365 let fired = false, click = (e2) => { 36366 e2.preventDefault(); 36367 if (fired) 36368 return; 36369 fired = true; 36370 let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic); 36371 if (found) 36372 action.apply(view, found.from, found.to); 36373 }; 36374 let { name: name2 } = action, keyIndex = keys[i2] ? name2.indexOf(keys[i2]) : -1; 36375 let nameElt = keyIndex < 0 ? name2 : [ 36376 name2.slice(0, keyIndex), 36377 crelt("u", name2.slice(keyIndex, keyIndex + 1)), 36378 name2.slice(keyIndex + 1) 36379 ]; 36380 return crelt("button", { 36381 type: "button", 36382 class: "cm-diagnosticAction", 36383 onclick: click, 36384 onmousedown: click, 36385 "aria-label": ` Action: ${name2}${keyIndex < 0 ? "" : ` (access key "${keys[i2]})"`}.` 36386 }, nameElt); 36387 }), diagnostic.source && crelt("div", { class: "cm-diagnosticSource" }, diagnostic.source)); 36388} 36389var DiagnosticWidget = class extends WidgetType { 36390 constructor(diagnostic) { 36391 super(); 36392 this.diagnostic = diagnostic; 36393 } 36394 eq(other) { 36395 return other.diagnostic == this.diagnostic; 36396 } 36397 toDOM() { 36398 return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity }); 36399 } 36400}; 36401var PanelItem = class { 36402 constructor(view, diagnostic) { 36403 this.diagnostic = diagnostic; 36404 this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16); 36405 this.dom = renderDiagnostic(view, diagnostic, true); 36406 this.dom.id = this.id; 36407 this.dom.setAttribute("role", "option"); 36408 } 36409}; 36410var LintPanel = class _LintPanel { 36411 constructor(view) { 36412 this.view = view; 36413 this.items = []; 36414 let onkeydown = (event) => { 36415 if (event.keyCode == 27) { 36416 closeLintPanel(this.view); 36417 this.view.focus(); 36418 } else if (event.keyCode == 38 || event.keyCode == 33) { 36419 this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length); 36420 } else if (event.keyCode == 40 || event.keyCode == 34) { 36421 this.moveSelection((this.selectedIndex + 1) % this.items.length); 36422 } else if (event.keyCode == 36) { 36423 this.moveSelection(0); 36424 } else if (event.keyCode == 35) { 36425 this.moveSelection(this.items.length - 1); 36426 } else if (event.keyCode == 13) { 36427 this.view.focus(); 36428 } else if (event.keyCode >= 65 && event.keyCode <= 90 && this.selectedIndex >= 0) { 36429 let { diagnostic } = this.items[this.selectedIndex], keys = assignKeys(diagnostic.actions); 36430 for (let i2 = 0; i2 < keys.length; i2++) 36431 if (keys[i2].toUpperCase().charCodeAt(0) == event.keyCode) { 36432 let found = findDiagnostic(this.view.state.field(lintState).diagnostics, diagnostic); 36433 if (found) 36434 diagnostic.actions[i2].apply(view, found.from, found.to); 36435 } 36436 } else { 36437 return; 36438 } 36439 event.preventDefault(); 36440 }; 36441 let onclick = (event) => { 36442 for (let i2 = 0; i2 < this.items.length; i2++) { 36443 if (this.items[i2].dom.contains(event.target)) 36444 this.moveSelection(i2); 36445 } 36446 }; 36447 this.list = crelt("ul", { 36448 tabIndex: 0, 36449 role: "listbox", 36450 "aria-label": this.view.state.phrase("Diagnostics"), 36451 onkeydown, 36452 onclick 36453 }); 36454 this.dom = crelt("div", { class: "cm-panel-lint" }, this.list, crelt("button", { 36455 type: "button", 36456 name: "close", 36457 "aria-label": this.view.state.phrase("close"), 36458 onclick: () => closeLintPanel(this.view) 36459 }, "\xD7")); 36460 this.update(); 36461 } 36462 get selectedIndex() { 36463 let selected = this.view.state.field(lintState).selected; 36464 if (!selected) 36465 return -1; 36466 for (let i2 = 0; i2 < this.items.length; i2++) 36467 if (this.items[i2].diagnostic == selected.diagnostic) 36468 return i2; 36469 return -1; 36470 } 36471 update() { 36472 let { diagnostics, selected } = this.view.state.field(lintState); 36473 let i2 = 0, needsSync = false, newSelectedItem = null; 36474 diagnostics.between(0, this.view.state.doc.length, (_start, _end, { spec }) => { 36475 let found = -1, item; 36476 for (let j3 = i2; j3 < this.items.length; j3++) 36477 if (this.items[j3].diagnostic == spec.diagnostic) { 36478 found = j3; 36479 break; 36480 } 36481 if (found < 0) { 36482 item = new PanelItem(this.view, spec.diagnostic); 36483 this.items.splice(i2, 0, item); 36484 needsSync = true; 36485 } else { 36486 item = this.items[found]; 36487 if (found > i2) { 36488 this.items.splice(i2, found - i2); 36489 needsSync = true; 36490 } 36491 } 36492 if (selected && item.diagnostic == selected.diagnostic) { 36493 if (!item.dom.hasAttribute("aria-selected")) { 36494 item.dom.setAttribute("aria-selected", "true"); 36495 newSelectedItem = item; 36496 } 36497 } else if (item.dom.hasAttribute("aria-selected")) { 36498 item.dom.removeAttribute("aria-selected"); 36499 } 36500 i2++; 36501 }); 36502 while (i2 < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) { 36503 needsSync = true; 36504 this.items.pop(); 36505 } 36506 if (this.items.length == 0) { 36507 this.items.push(new PanelItem(this.view, { 36508 from: -1, 36509 to: -1, 36510 severity: "info", 36511 message: this.view.state.phrase("No diagnostics") 36512 })); 36513 needsSync = true; 36514 } 36515 if (newSelectedItem) { 36516 this.list.setAttribute("aria-activedescendant", newSelectedItem.id); 36517 this.view.requestMeasure({ 36518 key: this, 36519 read: () => ({ sel: newSelectedItem.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }), 36520 write: ({ sel, panel }) => { 36521 let scaleY = panel.height / this.list.offsetHeight; 36522 if (sel.top < panel.top) 36523 this.list.scrollTop -= (panel.top - sel.top) / scaleY; 36524 else if (sel.bottom > panel.bottom) 36525 this.list.scrollTop += (sel.bottom - panel.bottom) / scaleY; 36526 } 36527 }); 36528 } else if (this.selectedIndex < 0) { 36529 this.list.removeAttribute("aria-activedescendant"); 36530 } 36531 if (needsSync) 36532 this.sync(); 36533 } 36534 sync() { 36535 let domPos = this.list.firstChild; 36536 function rm2() { 36537 let prev = domPos; 36538 domPos = prev.nextSibling; 36539 prev.remove(); 36540 } 36541 for (let item of this.items) { 36542 if (item.dom.parentNode == this.list) { 36543 while (domPos != item.dom) 36544 rm2(); 36545 domPos = item.dom.nextSibling; 36546 } else { 36547 this.list.insertBefore(item.dom, domPos); 36548 } 36549 } 36550 while (domPos) 36551 rm2(); 36552 } 36553 moveSelection(selectedIndex) { 36554 if (this.selectedIndex < 0) 36555 return; 36556 let field = this.view.state.field(lintState); 36557 let selection = findDiagnostic(field.diagnostics, this.items[selectedIndex].diagnostic); 36558 if (!selection) 36559 return; 36560 this.view.dispatch({ 36561 selection: { anchor: selection.from, head: selection.to }, 36562 scrollIntoView: true, 36563 effects: movePanelSelection.of(selection) 36564 }); 36565 } 36566 static open(view) { 36567 return new _LintPanel(view); 36568 } 36569}; 36570function svg(content2, attrs = `viewBox="0 0 40 40"`) { 36571 return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${attrs}>${encodeURIComponent(content2)}</svg>')`; 36572} 36573function underline(color) { 36574 return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${color}" fill="none" stroke-width=".7"/>`, `width="6" height="3"`); 36575} 36576var baseTheme4 = /* @__PURE__ */ EditorView.baseTheme({ 36577 ".cm-diagnostic": { 36578 padding: "3px 6px 3px 8px", 36579 marginLeft: "-1px", 36580 display: "block", 36581 whiteSpace: "pre-wrap" 36582 }, 36583 ".cm-diagnostic-error": { borderLeft: "5px solid #d11" }, 36584 ".cm-diagnostic-warning": { borderLeft: "5px solid orange" }, 36585 ".cm-diagnostic-info": { borderLeft: "5px solid #999" }, 36586 ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" }, 36587 ".cm-diagnosticAction": { 36588 font: "inherit", 36589 border: "none", 36590 padding: "2px 4px", 36591 backgroundColor: "#444", 36592 color: "white", 36593 borderRadius: "3px", 36594 marginLeft: "8px", 36595 cursor: "pointer" 36596 }, 36597 ".cm-diagnosticSource": { 36598 fontSize: "70%", 36599 opacity: 0.7 36600 }, 36601 ".cm-lintRange": { 36602 backgroundPosition: "left bottom", 36603 backgroundRepeat: "repeat-x", 36604 paddingBottom: "0.7px" 36605 }, 36606 ".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ underline("#d11") }, 36607 ".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ underline("orange") }, 36608 ".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ underline("#999") }, 36609 ".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ underline("#66d") }, 36610 ".cm-lintRange-active": { backgroundColor: "#ffdd9980" }, 36611 ".cm-tooltip-lint": { 36612 padding: 0, 36613 margin: 0 36614 }, 36615 ".cm-lintPoint": { 36616 position: "relative", 36617 "&:after": { 36618 content: '""', 36619 position: "absolute", 36620 bottom: 0, 36621 left: "-2px", 36622 borderLeft: "3px solid transparent", 36623 borderRight: "3px solid transparent", 36624 borderBottom: "4px solid #d11" 36625 } 36626 }, 36627 ".cm-lintPoint-warning": { 36628 "&:after": { borderBottomColor: "orange" } 36629 }, 36630 ".cm-lintPoint-info": { 36631 "&:after": { borderBottomColor: "#999" } 36632 }, 36633 ".cm-lintPoint-hint": { 36634 "&:after": { borderBottomColor: "#66d" } 36635 }, 36636 ".cm-panel.cm-panel-lint": { 36637 position: "relative", 36638 "& ul": { 36639 maxHeight: "100px", 36640 overflowY: "auto", 36641 "& [aria-selected]": { 36642 backgroundColor: "#ddd", 36643 "& u": { textDecoration: "underline" } 36644 }, 36645 "&:focus [aria-selected]": { 36646 background_fallback: "#bdf", 36647 backgroundColor: "Highlight", 36648 color_fallback: "white", 36649 color: "HighlightText" 36650 }, 36651 "& u": { textDecoration: "none" }, 36652 padding: 0, 36653 margin: 0 36654 }, 36655 "& [name=close]": { 36656 position: "absolute", 36657 top: "0", 36658 right: "2px", 36659 background: "inherit", 36660 border: "none", 36661 font: "inherit", 36662 padding: 0, 36663 margin: 0 36664 } 36665 } 36666}); 36667function severityWeight(sev) { 36668 return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1; 36669} 36670var LintGutterMarker = class extends GutterMarker { 36671 constructor(diagnostics) { 36672 super(); 36673 this.diagnostics = diagnostics; 36674 this.severity = diagnostics.reduce((max, d2) => severityWeight(max) < severityWeight(d2.severity) ? d2.severity : max, "hint"); 36675 } 36676 toDOM(view) { 36677 let elt = document.createElement("div"); 36678 elt.className = "cm-lint-marker cm-lint-marker-" + this.severity; 36679 let diagnostics = this.diagnostics; 36680 let diagnosticsFilter = view.state.facet(lintGutterConfig).tooltipFilter; 36681 if (diagnosticsFilter) 36682 diagnostics = diagnosticsFilter(diagnostics); 36683 if (diagnostics.length) 36684 elt.onmouseover = () => gutterMarkerMouseOver(view, elt, diagnostics); 36685 return elt; 36686 } 36687}; 36688function trackHoverOn(view, marker) { 36689 let mousemove = (event) => { 36690 let rect = marker.getBoundingClientRect(); 36691 if (event.clientX > rect.left - 10 && event.clientX < rect.right + 10 && event.clientY > rect.top - 10 && event.clientY < rect.bottom + 10) 36692 return; 36693 for (let target = event.target; target; target = target.parentNode) { 36694 if (target.nodeType == 1 && target.classList.contains("cm-tooltip-lint")) 36695 return; 36696 } 36697 window.removeEventListener("mousemove", mousemove); 36698 if (view.state.field(lintGutterTooltip)) 36699 view.dispatch({ effects: setLintGutterTooltip.of(null) }); 36700 }; 36701 window.addEventListener("mousemove", mousemove); 36702} 36703function gutterMarkerMouseOver(view, marker, diagnostics) { 36704 function hovered() { 36705 let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop); 36706 const linePos = view.coordsAtPos(line.from); 36707 if (linePos) { 36708 view.dispatch({ effects: setLintGutterTooltip.of({ 36709 pos: line.from, 36710 above: false, 36711 create() { 36712 return { 36713 dom: diagnosticsTooltip(view, diagnostics), 36714 getCoords: () => marker.getBoundingClientRect() 36715 }; 36716 } 36717 }) }); 36718 } 36719 marker.onmouseout = marker.onmousemove = null; 36720 trackHoverOn(view, marker); 36721 } 36722 let { hoverTime } = view.state.facet(lintGutterConfig); 36723 let hoverTimeout = setTimeout(hovered, hoverTime); 36724 marker.onmouseout = () => { 36725 clearTimeout(hoverTimeout); 36726 marker.onmouseout = marker.onmousemove = null; 36727 }; 36728 marker.onmousemove = () => { 36729 clearTimeout(hoverTimeout); 36730 hoverTimeout = setTimeout(hovered, hoverTime); 36731 }; 36732} 36733function markersForDiagnostics(doc2, diagnostics) { 36734 let byLine = /* @__PURE__ */ Object.create(null); 36735 for (let diagnostic of diagnostics) { 36736 let line = doc2.lineAt(diagnostic.from); 36737 (byLine[line.from] || (byLine[line.from] = [])).push(diagnostic); 36738 } 36739 let markers = []; 36740 for (let line in byLine) { 36741 markers.push(new LintGutterMarker(byLine[line]).range(+line)); 36742 } 36743 return RangeSet.of(markers, true); 36744} 36745var lintGutterExtension = /* @__PURE__ */ gutter({ 36746 class: "cm-gutter-lint", 36747 markers: (view) => view.state.field(lintGutterMarkers) 36748}); 36749var lintGutterMarkers = /* @__PURE__ */ StateField.define({ 36750 create() { 36751 return RangeSet.empty; 36752 }, 36753 update(markers, tr) { 36754 markers = markers.map(tr.changes); 36755 let diagnosticFilter2 = tr.state.facet(lintGutterConfig).markerFilter; 36756 for (let effect of tr.effects) { 36757 if (effect.is(setDiagnosticsEffect)) { 36758 let diagnostics = effect.value; 36759 if (diagnosticFilter2) 36760 diagnostics = diagnosticFilter2(diagnostics || []); 36761 markers = markersForDiagnostics(tr.state.doc, diagnostics.slice(0)); 36762 } 36763 } 36764 return markers; 36765 } 36766}); 36767var setLintGutterTooltip = /* @__PURE__ */ StateEffect.define(); 36768var lintGutterTooltip = /* @__PURE__ */ StateField.define({ 36769 create() { 36770 return null; 36771 }, 36772 update(tooltip, tr) { 36773 if (tooltip && tr.docChanged) 36774 tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), { pos: tr.changes.mapPos(tooltip.pos) }); 36775 return tr.effects.reduce((t3, e2) => e2.is(setLintGutterTooltip) ? e2.value : t3, tooltip); 36776 }, 36777 provide: (field) => showTooltip.from(field) 36778}); 36779var lintGutterTheme = /* @__PURE__ */ EditorView.baseTheme({ 36780 ".cm-gutter-lint": { 36781 width: "1.4em", 36782 "& .cm-gutterElement": { 36783 padding: ".2em" 36784 } 36785 }, 36786 ".cm-lint-marker": { 36787 width: "1em", 36788 height: "1em" 36789 }, 36790 ".cm-lint-marker-info": { 36791 content: /* @__PURE__ */ svg(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`) 36792 }, 36793 ".cm-lint-marker-warning": { 36794 content: /* @__PURE__ */ svg(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`) 36795 }, 36796 ".cm-lint-marker-error": { 36797 content: /* @__PURE__ */ svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`) 36798 } 36799}); 36800var lintExtensions = [ 36801 lintState, 36802 /* @__PURE__ */ EditorView.decorations.compute([lintState], (state) => { 36803 let { selected, panel } = state.field(lintState); 36804 return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([ 36805 activeMark.range(selected.from, selected.to) 36806 ]); 36807 }), 36808 /* @__PURE__ */ hoverTooltip(lintTooltip, { hideOn: hideTooltip }), 36809 baseTheme4 36810]; 36811var lintGutterConfig = /* @__PURE__ */ Facet.define({ 36812 combine(configs) { 36813 return combineConfig(configs, { 36814 hoverTime: 300, 36815 markerFilter: null, 36816 tooltipFilter: null 36817 }); 36818 } 36819}); 36820function lintGutter(config2 = {}) { 36821 return [lintGutterConfig.of(config2), lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip]; 36822} 36823
vendor: 38,575 bytes, lines 36824-37903
36824// node_modules/@codemirror/search/dist/index.js 36825var basicNormalize = typeof String.prototype.normalize == "function" ? (x) => x.normalize("NFKD") : (x) => x; 36826var SearchCursor = class { 36827 /** 36828 Create a text cursor. The query is the search string, `from` to 36829 `to` provides the region to search. 36830 36831 When `normalize` is given, it will be called, on both the query 36832 string and the content it is matched against, before comparing. 36833 You can, for example, create a case-insensitive search by 36834 passing `s => s.toLowerCase()`. 36835 36836 Text is always normalized with 36837 [`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) 36838 (when supported). 36839 */ 36840 constructor(text, query, from = 0, to = text.length, normalize, test) { 36841 this.test = test; 36842 this.value = { from: 0, to: 0 }; 36843 this.done = false; 36844 this.matches = []; 36845 this.buffer = ""; 36846 this.bufferPos = 0; 36847 this.iter = text.iterRange(from, to); 36848 this.bufferStart = from; 36849 this.normalize = normalize ? (x) => normalize(basicNormalize(x)) : basicNormalize; 36850 this.query = this.normalize(query); 36851 } 36852 peek() { 36853 if (this.bufferPos == this.buffer.length) { 36854 this.bufferStart += this.buffer.length; 36855 this.iter.next(); 36856 if (this.iter.done) 36857 return -1; 36858 this.bufferPos = 0; 36859 this.buffer = this.iter.value; 36860 } 36861 return codePointAt(this.buffer, this.bufferPos); 36862 } 36863 /** 36864 Look for the next match. Updates the iterator's 36865 [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and 36866 [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called 36867 at least once before using the cursor. 36868 */ 36869 next() { 36870 while (this.matches.length) 36871 this.matches.pop(); 36872 return this.nextOverlapping(); 36873 } 36874 /** 36875 The `next` method will ignore matches that partially overlap a 36876 previous match. This method behaves like `next`, but includes 36877 such matches. 36878 */ 36879 nextOverlapping() { 36880 for (; ; ) { 36881 let next = this.peek(); 36882 if (next < 0) { 36883 this.done = true; 36884 return this; 36885 } 36886 let str = fromCodePoint(next), start = this.bufferStart + this.bufferPos; 36887 this.bufferPos += codePointSize(next); 36888 let norm = this.normalize(str); 36889 for (let i2 = 0, pos = start; ; i2++) { 36890 let code = norm.charCodeAt(i2); 36891 let match = this.match(code, pos); 36892 if (i2 == norm.length - 1) { 36893 if (match) { 36894 this.value = match; 36895 return this; 36896 } 36897 break; 36898 } 36899 if (pos == start && i2 < str.length && str.charCodeAt(i2) == code) 36900 pos++; 36901 } 36902 } 36903 } 36904 match(code, pos) { 36905 let match = null; 36906 for (let i2 = 0; i2 < this.matches.length; i2 += 2) { 36907 let index = this.matches[i2], keep = false; 36908 if (this.query.charCodeAt(index) == code) { 36909 if (index == this.query.length - 1) { 36910 match = { from: this.matches[i2 + 1], to: pos + 1 }; 36911 } else { 36912 this.matches[i2]++; 36913 keep = true; 36914 } 36915 } 36916 if (!keep) { 36917 this.matches.splice(i2, 2); 36918 i2 -= 2; 36919 } 36920 } 36921 if (this.query.charCodeAt(0) == code) { 36922 if (this.query.length == 1) 36923 match = { from: pos, to: pos + 1 }; 36924 else 36925 this.matches.push(1, pos); 36926 } 36927 if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferStart)) 36928 match = null; 36929 return match; 36930 } 36931}; 36932if (typeof Symbol != "undefined") 36933 SearchCursor.prototype[Symbol.iterator] = function() { 36934 return this; 36935 }; 36936var empty = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }; 36937var baseFlags = "gm" + (/x/.unicode == null ? "" : "u"); 36938var RegExpCursor = class { 36939 /** 36940 Create a cursor that will search the given range in the given 36941 document. `query` should be the raw pattern (as you'd pass it to 36942 `new RegExp`). 36943 */ 36944 constructor(text, query, options2, from = 0, to = text.length) { 36945 this.text = text; 36946 this.to = to; 36947 this.curLine = ""; 36948 this.done = false; 36949 this.value = empty; 36950 if (/\\[sWDnr]|\n|\r|\[\^/.test(query)) 36951 return new MultilineRegExpCursor(text, query, options2, from, to); 36952 this.re = new RegExp(query, baseFlags + ((options2 === null || options2 === void 0 ? void 0 : options2.ignoreCase) ? "i" : "")); 36953 this.test = options2 === null || options2 === void 0 ? void 0 : options2.test; 36954 this.iter = text.iter(); 36955 let startLine = text.lineAt(from); 36956 this.curLineStart = startLine.from; 36957 this.matchPos = toCharEnd(text, from); 36958 this.getLine(this.curLineStart); 36959 } 36960 getLine(skip) { 36961 this.iter.next(skip); 36962 if (this.iter.lineBreak) { 36963 this.curLine = ""; 36964 } else { 36965 this.curLine = this.iter.value; 36966 if (this.curLineStart + this.curLine.length > this.to) 36967 this.curLine = this.curLine.slice(0, this.to - this.curLineStart); 36968 this.iter.next(); 36969 } 36970 } 36971 nextLine() { 36972 this.curLineStart = this.curLineStart + this.curLine.length + 1; 36973 if (this.curLineStart > this.to) 36974 this.curLine = ""; 36975 else 36976 this.getLine(0); 36977 } 36978 /** 36979 Move to the next match, if there is one. 36980 */ 36981 next() { 36982 for (let off = this.matchPos - this.curLineStart; ; ) { 36983 this.re.lastIndex = off; 36984 let match = this.matchPos <= this.to && this.re.exec(this.curLine); 36985 if (match) { 36986 let from = this.curLineStart + match.index, to = from + match[0].length; 36987 this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0)); 36988 if (from == this.curLineStart + this.curLine.length) 36989 this.nextLine(); 36990 if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) { 36991 this.value = { from, to, match }; 36992 return this; 36993 } 36994 off = this.matchPos - this.curLineStart; 36995 } else if (this.curLineStart + this.curLine.length < this.to) { 36996 this.nextLine(); 36997 off = 0; 36998 } else { 36999 this.done = true; 37000 return this; 37001 } 37002 } 37003 } 37004}; 37005var flattened = /* @__PURE__ */ new WeakMap(); 37006var FlattenedDoc = class _FlattenedDoc { 37007 constructor(from, text) { 37008 this.from = from; 37009 this.text = text; 37010 } 37011 get to() { 37012 return this.from + this.text.length; 37013 } 37014 static get(doc2, from, to) { 37015 let cached = flattened.get(doc2); 37016 if (!cached || cached.from >= to || cached.to <= from) { 37017 let flat = new _FlattenedDoc(from, doc2.sliceString(from, to)); 37018 flattened.set(doc2, flat); 37019 return flat; 37020 } 37021 if (cached.from == from && cached.to == to) 37022 return cached; 37023 let { text, from: cachedFrom } = cached; 37024 if (cachedFrom > from) { 37025 text = doc2.sliceString(from, cachedFrom) + text; 37026 cachedFrom = from; 37027 } 37028 if (cached.to < to) 37029 text += doc2.sliceString(cached.to, to); 37030 flattened.set(doc2, new _FlattenedDoc(cachedFrom, text)); 37031 return new _FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom)); 37032 } 37033}; 37034var MultilineRegExpCursor = class { 37035 constructor(text, query, options2, from, to) { 37036 this.text = text; 37037 this.to = to; 37038 this.done = false; 37039 this.value = empty; 37040 this.matchPos = toCharEnd(text, from); 37041 this.re = new RegExp(query, baseFlags + ((options2 === null || options2 === void 0 ? void 0 : options2.ignoreCase) ? "i" : "")); 37042 this.test = options2 === null || options2 === void 0 ? void 0 : options2.test; 37043 this.flat = FlattenedDoc.get(text, from, this.chunkEnd( 37044 from + 5e3 37045 /* Chunk.Base */ 37046 )); 37047 } 37048 chunkEnd(pos) { 37049 return pos >= this.to ? this.to : this.text.lineAt(pos).to; 37050 } 37051 next() { 37052 for (; ; ) { 37053 let off = this.re.lastIndex = this.matchPos - this.flat.from; 37054 let match = this.re.exec(this.flat.text); 37055 if (match && !match[0] && match.index == off) { 37056 this.re.lastIndex = off + 1; 37057 match = this.re.exec(this.flat.text); 37058 } 37059 if (match) { 37060 let from = this.flat.from + match.index, to = from + match[0].length; 37061 if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) && (!this.test || this.test(from, to, match))) { 37062 this.value = { from, to, match }; 37063 this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0)); 37064 return this; 37065 } 37066 } 37067 if (this.flat.to == this.to) { 37068 this.done = true; 37069 return this; 37070 } 37071 this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2)); 37072 } 37073 } 37074}; 37075if (typeof Symbol != "undefined") { 37076 RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = function() { 37077 return this; 37078 }; 37079} 37080function validRegExp(source) { 37081 try { 37082 new RegExp(source, baseFlags); 37083 return true; 37084 } catch (_a3) { 37085 return false; 37086 } 37087} 37088function toCharEnd(text, pos) { 37089 if (pos >= text.length) 37090 return pos; 37091 let line = text.lineAt(pos), next; 37092 while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 56320 && next < 57344) 37093 pos++; 37094 return pos; 37095} 37096function createLineDialog(view) { 37097 let line = String(view.state.doc.lineAt(view.state.selection.main.head).number); 37098 let input = crelt("input", { class: "cm-textfield", name: "line", value: line }); 37099 let dom = crelt("form", { 37100 class: "cm-gotoLine", 37101 onkeydown: (event) => { 37102 if (event.keyCode == 27) { 37103 event.preventDefault(); 37104 view.dispatch({ effects: dialogEffect.of(false) }); 37105 view.focus(); 37106 } else if (event.keyCode == 13) { 37107 event.preventDefault(); 37108 go(); 37109 } 37110 }, 37111 onsubmit: (event) => { 37112 event.preventDefault(); 37113 go(); 37114 } 37115 }, crelt("label", view.state.phrase("Go to line"), ": ", input), " ", crelt("button", { class: "cm-button", type: "submit" }, view.state.phrase("go"))); 37116 function go() { 37117 let match = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(input.value); 37118 if (!match) 37119 return; 37120 let { state } = view, startLine = state.doc.lineAt(state.selection.main.head); 37121 let [, sign, ln2, cl, percent3] = match; 37122 let col = cl ? +cl.slice(1) : 0; 37123 let line2 = ln2 ? +ln2 : startLine.number; 37124 if (ln2 && percent3) { 37125 let pc = line2 / 100; 37126 if (sign) 37127 pc = pc * (sign == "-" ? -1 : 1) + startLine.number / state.doc.lines; 37128 line2 = Math.round(state.doc.lines * pc); 37129 } else if (ln2 && sign) { 37130 line2 = line2 * (sign == "-" ? -1 : 1) + startLine.number; 37131 } 37132 let docLine = state.doc.line(Math.max(1, Math.min(state.doc.lines, line2))); 37133 let selection = EditorSelection.cursor(docLine.from + Math.max(0, Math.min(col, docLine.length))); 37134 view.dispatch({ 37135 effects: [dialogEffect.of(false), EditorView.scrollIntoView(selection.from, { y: "center" })], 37136 selection 37137 }); 37138 view.focus(); 37139 } 37140 return { dom }; 37141} 37142var dialogEffect = /* @__PURE__ */ StateEffect.define(); 37143var dialogField = /* @__PURE__ */ StateField.define({ 37144 create() { 37145 return true; 37146 }, 37147 update(value, tr) { 37148 for (let e2 of tr.effects) 37149 if (e2.is(dialogEffect)) 37150 value = e2.value; 37151 return value; 37152 }, 37153 provide: (f3) => showPanel.from(f3, (val) => val ? createLineDialog : null) 37154}); 37155var gotoLine = (view) => { 37156 let panel = getPanel(view, createLineDialog); 37157 if (!panel) { 37158 let effects = [dialogEffect.of(true)]; 37159 if (view.state.field(dialogField, false) == null) 37160 effects.push(StateEffect.appendConfig.of([dialogField, baseTheme$13])); 37161 view.dispatch({ effects }); 37162 panel = getPanel(view, createLineDialog); 37163 } 37164 if (panel) 37165 panel.dom.querySelector("input").select(); 37166 return true; 37167}; 37168var baseTheme$13 = /* @__PURE__ */ EditorView.baseTheme({ 37169 ".cm-panel.cm-gotoLine": { 37170 padding: "2px 6px 4px", 37171 "& label": { fontSize: "80%" } 37172 } 37173}); 37174var defaultHighlightOptions = { 37175 highlightWordAroundCursor: false, 37176 minSelectionLength: 1, 37177 maxMatches: 100, 37178 wholeWords: false 37179}; 37180var highlightConfig = /* @__PURE__ */ Facet.define({ 37181 combine(options2) { 37182 return combineConfig(options2, defaultHighlightOptions, { 37183 highlightWordAroundCursor: (a2, b3) => a2 || b3, 37184 minSelectionLength: Math.min, 37185 maxMatches: Math.min 37186 }); 37187 } 37188}); 37189function highlightSelectionMatches(options2) { 37190 let ext = [defaultTheme, matchHighlighter]; 37191 if (options2) 37192 ext.push(highlightConfig.of(options2)); 37193 return ext; 37194} 37195var matchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch" }); 37196var mainMatchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" }); 37197function insideWordBoundaries(check, state, from, to) { 37198 return (from == 0 || check(state.sliceDoc(from - 1, from)) != CharCategory.Word) && (to == state.doc.length || check(state.sliceDoc(to, to + 1)) != CharCategory.Word); 37199} 37200function insideWord(check, state, from, to) { 37201 return check(state.sliceDoc(from, from + 1)) == CharCategory.Word && check(state.sliceDoc(to - 1, to)) == CharCategory.Word; 37202} 37203var matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class { 37204 constructor(view) { 37205 this.decorations = this.getDeco(view); 37206 } 37207 update(update) { 37208 if (update.selectionSet || update.docChanged || update.viewportChanged) 37209 this.decorations = this.getDeco(update.view); 37210 } 37211 getDeco(view) { 37212 let conf = view.state.facet(highlightConfig); 37213 let { state } = view, sel = state.selection; 37214 if (sel.ranges.length > 1) 37215 return Decoration.none; 37216 let range = sel.main, query, check = null; 37217 if (range.empty) { 37218 if (!conf.highlightWordAroundCursor) 37219 return Decoration.none; 37220 let word = state.wordAt(range.head); 37221 if (!word) 37222 return Decoration.none; 37223 check = state.charCategorizer(range.head); 37224 query = state.sliceDoc(word.from, word.to); 37225 } else { 37226 let len = range.to - range.from; 37227 if (len < conf.minSelectionLength || len > 200) 37228 return Decoration.none; 37229 if (conf.wholeWords) { 37230 query = state.sliceDoc(range.from, range.to); 37231 check = state.charCategorizer(range.head); 37232 if (!(insideWordBoundaries(check, state, range.from, range.to) && insideWord(check, state, range.from, range.to))) 37233 return Decoration.none; 37234 } else { 37235 query = state.sliceDoc(range.from, range.to).trim(); 37236 if (!query) 37237 return Decoration.none; 37238 } 37239 } 37240 let deco = []; 37241 for (let part of view.visibleRanges) { 37242 let cursor = new SearchCursor(state.doc, query, part.from, part.to); 37243 while (!cursor.next().done) { 37244 let { from, to } = cursor.value; 37245 if (!check || insideWordBoundaries(check, state, from, to)) { 37246 if (range.empty && from <= range.from && to >= range.to) 37247 deco.push(mainMatchDeco.range(from, to)); 37248 else if (from >= range.to || to <= range.from) 37249 deco.push(matchDeco.range(from, to)); 37250 if (deco.length > conf.maxMatches) 37251 return Decoration.none; 37252 } 37253 } 37254 } 37255 return Decoration.set(deco); 37256 } 37257}, { 37258 decorations: (v2) => v2.decorations 37259}); 37260var defaultTheme = /* @__PURE__ */ EditorView.baseTheme({ 37261 ".cm-selectionMatch": { backgroundColor: "#99ff7780" }, 37262 ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" } 37263}); 37264var selectWord = ({ state, dispatch }) => { 37265 let { selection } = state; 37266 let newSel = EditorSelection.create(selection.ranges.map((range) => state.wordAt(range.head) || EditorSelection.cursor(range.head)), selection.mainIndex); 37267 if (newSel.eq(selection)) 37268 return false; 37269 dispatch(state.update({ selection: newSel })); 37270 return true; 37271}; 37272function findNextOccurrence(state, query) { 37273 let { main, ranges } = state.selection; 37274 let word = state.wordAt(main.head), fullWord = word && word.from == main.from && word.to == main.to; 37275 for (let cycled = false, cursor = new SearchCursor(state.doc, query, ranges[ranges.length - 1].to); ; ) { 37276 cursor.next(); 37277 if (cursor.done) { 37278 if (cycled) 37279 return null; 37280 cursor = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1)); 37281 cycled = true; 37282 } else { 37283 if (cycled && ranges.some((r2) => r2.from == cursor.value.from)) 37284 continue; 37285 if (fullWord) { 37286 let word2 = state.wordAt(cursor.value.from); 37287 if (!word2 || word2.from != cursor.value.from || word2.to != cursor.value.to) 37288 continue; 37289 } 37290 return cursor.value; 37291 } 37292 } 37293} 37294var selectNextOccurrence = ({ state, dispatch }) => { 37295 let { ranges } = state.selection; 37296 if (ranges.some((sel) => sel.from === sel.to)) 37297 return selectWord({ state, dispatch }); 37298 let searchedText = state.sliceDoc(ranges[0].from, ranges[0].to); 37299 if (state.selection.ranges.some((r2) => state.sliceDoc(r2.from, r2.to) != searchedText)) 37300 return false; 37301 let range = findNextOccurrence(state, searchedText); 37302 if (!range) 37303 return false; 37304 dispatch(state.update({ 37305 selection: state.selection.addRange(EditorSelection.range(range.from, range.to), false), 37306 effects: EditorView.scrollIntoView(range.to) 37307 })); 37308 return true; 37309}; 37310var searchConfigFacet = /* @__PURE__ */ Facet.define({ 37311 combine(configs) { 37312 return combineConfig(configs, { 37313 top: false, 37314 caseSensitive: false, 37315 literal: false, 37316 regexp: false, 37317 wholeWord: false, 37318 createPanel: (view) => new SearchPanel(view), 37319 scrollToMatch: (range) => EditorView.scrollIntoView(range) 37320 }); 37321 } 37322}); 37323var SearchQuery = class { 37324 /** 37325 Create a query object. 37326 */ 37327 constructor(config2) { 37328 this.search = config2.search; 37329 this.caseSensitive = !!config2.caseSensitive; 37330 this.literal = !!config2.literal; 37331 this.regexp = !!config2.regexp; 37332 this.replace = config2.replace || ""; 37333 this.valid = !!this.search && (!this.regexp || validRegExp(this.search)); 37334 this.unquoted = this.unquote(this.search); 37335 this.wholeWord = !!config2.wholeWord; 37336 } 37337 /** 37338 @internal 37339 */ 37340 unquote(text) { 37341 return this.literal ? text : text.replace(/\\([nrt\\])/g, (_2, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\"); 37342 } 37343 /** 37344 Compare this query to another query. 37345 */ 37346 eq(other) { 37347 return this.search == other.search && this.replace == other.replace && this.caseSensitive == other.caseSensitive && this.regexp == other.regexp && this.wholeWord == other.wholeWord; 37348 } 37349 /** 37350 @internal 37351 */ 37352 create() { 37353 return this.regexp ? new RegExpQuery(this) : new StringQuery(this); 37354 } 37355 /** 37356 Get a search cursor for this query, searching through the given 37357 range in the given state. 37358 */ 37359 getCursor(state, from = 0, to) { 37360 let st = state.doc ? state : EditorState.create({ doc: state }); 37361 if (to == null) 37362 to = st.doc.length; 37363 return this.regexp ? regexpCursor(this, st, from, to) : stringCursor(this, st, from, to); 37364 } 37365}; 37366var QueryType2 = class { 37367 constructor(spec) { 37368 this.spec = spec; 37369 } 37370}; 37371function stringCursor(spec, state, from, to) { 37372 return new SearchCursor(state.doc, spec.unquoted, from, to, spec.caseSensitive ? void 0 : (x) => x.toLowerCase(), spec.wholeWord ? stringWordTest(state.doc, state.charCategorizer(state.selection.main.head)) : void 0); 37373} 37374function stringWordTest(doc2, categorizer) { 37375 return (from, to, buf, bufPos) => { 37376 if (bufPos > from || bufPos + buf.length < to) { 37377 bufPos = Math.max(0, from - 2); 37378 buf = doc2.sliceString(bufPos, Math.min(doc2.length, to + 2)); 37379 } 37380 return (categorizer(charBefore(buf, from - bufPos)) != CharCategory.Word || categorizer(charAfter(buf, from - bufPos)) != CharCategory.Word) && (categorizer(charAfter(buf, to - bufPos)) != CharCategory.Word || categorizer(charBefore(buf, to - bufPos)) != CharCategory.Word); 37381 }; 37382} 37383var StringQuery = class extends QueryType2 { 37384 constructor(spec) { 37385 super(spec); 37386 } 37387 nextMatch(state, curFrom, curTo) { 37388 let cursor = stringCursor(this.spec, state, curTo, state.doc.length).nextOverlapping(); 37389 if (cursor.done) 37390 cursor = stringCursor(this.spec, state, 0, curFrom).nextOverlapping(); 37391 return cursor.done ? null : cursor.value; 37392 } 37393 // Searching in reverse is, rather than implementing an inverted search 37394 // cursor, done by scanning chunk after chunk forward. 37395 prevMatchInRange(state, from, to) { 37396 for (let pos = to; ; ) { 37397 let start = Math.max(from, pos - 1e4 - this.spec.unquoted.length); 37398 let cursor = stringCursor(this.spec, state, start, pos), range = null; 37399 while (!cursor.nextOverlapping().done) 37400 range = cursor.value; 37401 if (range) 37402 return range; 37403 if (start == from) 37404 return null; 37405 pos -= 1e4; 37406 } 37407 } 37408 prevMatch(state, curFrom, curTo) { 37409 return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length); 37410 } 37411 getReplacement(_result) { 37412 return this.spec.unquote(this.spec.replace); 37413 } 37414 matchAll(state, limit) { 37415 let cursor = stringCursor(this.spec, state, 0, state.doc.length), ranges = []; 37416 while (!cursor.next().done) { 37417 if (ranges.length >= limit) 37418 return null; 37419 ranges.push(cursor.value); 37420 } 37421 return ranges; 37422 } 37423 highlight(state, from, to, add2) { 37424 let cursor = stringCursor(this.spec, state, Math.max(0, from - this.spec.unquoted.length), Math.min(to + this.spec.unquoted.length, state.doc.length)); 37425 while (!cursor.next().done) 37426 add2(cursor.value.from, cursor.value.to); 37427 } 37428}; 37429function regexpCursor(spec, state, from, to) { 37430 return new RegExpCursor(state.doc, spec.search, { 37431 ignoreCase: !spec.caseSensitive, 37432 test: spec.wholeWord ? regexpWordTest(state.charCategorizer(state.selection.main.head)) : void 0 37433 }, from, to); 37434} 37435function charBefore(str, index) { 37436 return str.slice(findClusterBreak(str, index, false), index); 37437} 37438function charAfter(str, index) { 37439 return str.slice(index, findClusterBreak(str, index)); 37440} 37441function regexpWordTest(categorizer) { 37442 return (_from, _to, match) => !match[0].length || (categorizer(charBefore(match.input, match.index)) != CharCategory.Word || categorizer(charAfter(match.input, match.index)) != CharCategory.Word) && (categorizer(charAfter(match.input, match.index + match[0].length)) != CharCategory.Word || categorizer(charBefore(match.input, match.index + match[0].length)) != CharCategory.Word); 37443} 37444var RegExpQuery = class extends QueryType2 { 37445 nextMatch(state, curFrom, curTo) { 37446 let cursor = regexpCursor(this.spec, state, curTo, state.doc.length).next(); 37447 if (cursor.done) 37448 cursor = regexpCursor(this.spec, state, 0, curFrom).next(); 37449 return cursor.done ? null : cursor.value; 37450 } 37451 prevMatchInRange(state, from, to) { 37452 for (let size = 1; ; size++) { 37453 let start = Math.max( 37454 from, 37455 to - size * 1e4 37456 /* FindPrev.ChunkSize */ 37457 ); 37458 let cursor = regexpCursor(this.spec, state, start, to), range = null; 37459 while (!cursor.next().done) 37460 range = cursor.value; 37461 if (range && (start == from || range.from > start + 10)) 37462 return range; 37463 if (start == from) 37464 return null; 37465 } 37466 } 37467 prevMatch(state, curFrom, curTo) { 37468 return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length); 37469 } 37470 getReplacement(result) { 37471 return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g, (m2, i2) => i2 == "$" ? "$" : i2 == "&" ? result.match[0] : i2 != "0" && +i2 < result.match.length ? result.match[i2] : m2); 37472 } 37473 matchAll(state, limit) { 37474 let cursor = regexpCursor(this.spec, state, 0, state.doc.length), ranges = []; 37475 while (!cursor.next().done) { 37476 if (ranges.length >= limit) 37477 return null; 37478 ranges.push(cursor.value); 37479 } 37480 return ranges; 37481 } 37482 highlight(state, from, to, add2) { 37483 let cursor = regexpCursor(this.spec, state, Math.max( 37484 0, 37485 from - 250 37486 /* RegExp.HighlightMargin */ 37487 ), Math.min(to + 250, state.doc.length)); 37488 while (!cursor.next().done) 37489 add2(cursor.value.from, cursor.value.to); 37490 } 37491}; 37492var setSearchQuery = /* @__PURE__ */ StateEffect.define(); 37493var togglePanel2 = /* @__PURE__ */ StateEffect.define(); 37494var searchState = /* @__PURE__ */ StateField.define({ 37495 create(state) { 37496 return new SearchState(defaultQuery(state).create(), null); 37497 }, 37498 update(value, tr) { 37499 for (let effect of tr.effects) { 37500 if (effect.is(setSearchQuery)) 37501 value = new SearchState(effect.value.create(), value.panel); 37502 else if (effect.is(togglePanel2)) 37503 value = new SearchState(value.query, effect.value ? createSearchPanel : null); 37504 } 37505 return value; 37506 }, 37507 provide: (f3) => showPanel.from(f3, (val) => val.panel) 37508}); 37509var SearchState = class { 37510 constructor(query, panel) { 37511 this.query = query; 37512 this.panel = panel; 37513 } 37514}; 37515var matchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch" }); 37516var selectedMatchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" }); 37517var searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class { 37518 constructor(view) { 37519 this.view = view; 37520 this.decorations = this.highlight(view.state.field(searchState)); 37521 } 37522 update(update) { 37523 let state = update.state.field(searchState); 37524 if (state != update.startState.field(searchState) || update.docChanged || update.selectionSet || update.viewportChanged) 37525 this.decorations = this.highlight(state); 37526 } 37527 highlight({ query, panel }) { 37528 if (!panel || !query.spec.valid) 37529 return Decoration.none; 37530 let { view } = this; 37531 let builder = new RangeSetBuilder(); 37532 for (let i2 = 0, ranges = view.visibleRanges, l3 = ranges.length; i2 < l3; i2++) { 37533 let { from, to } = ranges[i2]; 37534 while (i2 < l3 - 1 && to > ranges[i2 + 1].from - 2 * 250) 37535 to = ranges[++i2].to; 37536 query.highlight(view.state, from, to, (from2, to2) => { 37537 let selected = view.state.selection.ranges.some((r2) => r2.from == from2 && r2.to == to2); 37538 builder.add(from2, to2, selected ? selectedMatchMark : matchMark); 37539 }); 37540 } 37541 return builder.finish(); 37542 } 37543}, { 37544 decorations: (v2) => v2.decorations 37545}); 37546function searchCommand(f3) { 37547 return (view) => { 37548 let state = view.state.field(searchState, false); 37549 return state && state.query.spec.valid ? f3(view, state) : openSearchPanel(view); 37550 }; 37551} 37552var findNext = /* @__PURE__ */ searchCommand((view, { query }) => { 37553 let { to } = view.state.selection.main; 37554 let next = query.nextMatch(view.state, to, to); 37555 if (!next) 37556 return false; 37557 let selection = EditorSelection.single(next.from, next.to); 37558 let config2 = view.state.facet(searchConfigFacet); 37559 view.dispatch({ 37560 selection, 37561 effects: [announceMatch(view, next), config2.scrollToMatch(selection.main, view)], 37562 userEvent: "select.search" 37563 }); 37564 selectSearchInput(view); 37565 return true; 37566}); 37567var findPrevious = /* @__PURE__ */ searchCommand((view, { query }) => { 37568 let { state } = view, { from } = state.selection.main; 37569 let prev = query.prevMatch(state, from, from); 37570 if (!prev) 37571 return false; 37572 let selection = EditorSelection.single(prev.from, prev.to); 37573 let config2 = view.state.facet(searchConfigFacet); 37574 view.dispatch({ 37575 selection, 37576 effects: [announceMatch(view, prev), config2.scrollToMatch(selection.main, view)], 37577 userEvent: "select.search" 37578 }); 37579 selectSearchInput(view); 37580 return true; 37581}); 37582var selectMatches = /* @__PURE__ */ searchCommand((view, { query }) => { 37583 let ranges = query.matchAll(view.state, 1e3); 37584 if (!ranges || !ranges.length) 37585 return false; 37586 view.dispatch({ 37587 selection: EditorSelection.create(ranges.map((r2) => EditorSelection.range(r2.from, r2.to))), 37588 userEvent: "select.search.matches" 37589 }); 37590 return true; 37591}); 37592var selectSelectionMatches = ({ state, dispatch }) => { 37593 let sel = state.selection; 37594 if (sel.ranges.length > 1 || sel.main.empty) 37595 return false; 37596 let { from, to } = sel.main; 37597 let ranges = [], main = 0; 37598 for (let cur2 = new SearchCursor(state.doc, state.sliceDoc(from, to)); !cur2.next().done; ) { 37599 if (ranges.length > 1e3) 37600 return false; 37601 if (cur2.value.from == from) 37602 main = ranges.length; 37603 ranges.push(EditorSelection.range(cur2.value.from, cur2.value.to)); 37604 } 37605 dispatch(state.update({ 37606 selection: EditorSelection.create(ranges, main), 37607 userEvent: "select.search.matches" 37608 })); 37609 return true; 37610}; 37611var replaceNext = /* @__PURE__ */ searchCommand((view, { query }) => { 37612 let { state } = view, { from, to } = state.selection.main; 37613 if (state.readOnly) 37614 return false; 37615 let next = query.nextMatch(state, from, from); 37616 if (!next) 37617 return false; 37618 let changes = [], selection, replacement; 37619 let effects = []; 37620 if (next.from == from && next.to == to) { 37621 replacement = state.toText(query.getReplacement(next)); 37622 changes.push({ from: next.from, to: next.to, insert: replacement }); 37623 next = query.nextMatch(state, next.from, next.to); 37624 effects.push(EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + ".")); 37625 } 37626 if (next) { 37627 let off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length; 37628 selection = EditorSelection.single(next.from - off, next.to - off); 37629 effects.push(announceMatch(view, next)); 37630 effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view)); 37631 } 37632 view.dispatch({ 37633 changes, 37634 selection, 37635 effects, 37636 userEvent: "input.replace" 37637 }); 37638 return true; 37639}); 37640var replaceAll = /* @__PURE__ */ searchCommand((view, { query }) => { 37641 if (view.state.readOnly) 37642 return false; 37643 let changes = query.matchAll(view.state, 1e9).map((match) => { 37644 let { from, to } = match; 37645 return { from, to, insert: query.getReplacement(match) }; 37646 }); 37647 if (!changes.length) 37648 return false; 37649 let announceText = view.state.phrase("replaced $ matches", changes.length) + "."; 37650 view.dispatch({ 37651 changes, 37652 effects: EditorView.announce.of(announceText), 37653 userEvent: "input.replace.all" 37654 }); 37655 return true; 37656}); 37657function createSearchPanel(view) { 37658 return view.state.facet(searchConfigFacet).createPanel(view); 37659} 37660function defaultQuery(state, fallback) { 37661 var _a3, _b2, _c, _d, _e; 37662 let sel = state.selection.main; 37663 let selText = sel.empty || sel.to > sel.from + 100 ? "" : state.sliceDoc(sel.from, sel.to); 37664 if (fallback && !selText) 37665 return fallback; 37666 let config2 = state.facet(searchConfigFacet); 37667 return new SearchQuery({ 37668 search: ((_a3 = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _a3 !== void 0 ? _a3 : config2.literal) ? selText : selText.replace(/\n/g, "\\n"), 37669 caseSensitive: (_b2 = fallback === null || fallback === void 0 ? void 0 : fallback.caseSensitive) !== null && _b2 !== void 0 ? _b2 : config2.caseSensitive, 37670 literal: (_c = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _c !== void 0 ? _c : config2.literal, 37671 regexp: (_d = fallback === null || fallback === void 0 ? void 0 : fallback.regexp) !== null && _d !== void 0 ? _d : config2.regexp, 37672 wholeWord: (_e = fallback === null || fallback === void 0 ? void 0 : fallback.wholeWord) !== null && _e !== void 0 ? _e : config2.wholeWord 37673 }); 37674} 37675function getSearchInput(view) { 37676 let panel = getPanel(view, createSearchPanel); 37677 return panel && panel.dom.querySelector("[main-field]"); 37678} 37679function selectSearchInput(view) { 37680 let input = getSearchInput(view); 37681 if (input && input == view.root.activeElement) 37682 input.select(); 37683} 37684var openSearchPanel = (view) => { 37685 let state = view.state.field(searchState, false); 37686 if (state && state.panel) { 37687 let searchInput = getSearchInput(view); 37688 if (searchInput && searchInput != view.root.activeElement) { 37689 let query = defaultQuery(view.state, state.query.spec); 37690 if (query.valid) 37691 view.dispatch({ effects: setSearchQuery.of(query) }); 37692 searchInput.focus(); 37693 searchInput.select(); 37694 } 37695 } else { 37696 view.dispatch({ effects: [ 37697 togglePanel2.of(true), 37698 state ? setSearchQuery.of(defaultQuery(view.state, state.query.spec)) : StateEffect.appendConfig.of(searchExtensions) 37699 ] }); 37700 } 37701 return true; 37702}; 37703var closeSearchPanel = (view) => { 37704 let state = view.state.field(searchState, false); 37705 if (!state || !state.panel) 37706 return false; 37707 let panel = getPanel(view, createSearchPanel); 37708 if (panel && panel.dom.contains(view.root.activeElement)) 37709 view.focus(); 37710 view.dispatch({ effects: togglePanel2.of(false) }); 37711 return true; 37712}; 37713var searchKeymap = [ 37714 { key: "Mod-f", run: openSearchPanel, scope: "editor search-panel" }, 37715 { key: "F3", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true }, 37716 { key: "Mod-g", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true }, 37717 { key: "Escape", run: closeSearchPanel, scope: "editor search-panel" }, 37718 { key: "Mod-Shift-l", run: selectSelectionMatches }, 37719 { key: "Mod-Alt-g", run: gotoLine }, 37720 { key: "Mod-d", run: selectNextOccurrence, preventDefault: true } 37721]; 37722var SearchPanel = class { 37723 constructor(view) { 37724 this.view = view; 37725 let query = this.query = view.state.field(searchState).query.spec; 37726 this.commit = this.commit.bind(this); 37727 this.searchField = crelt("input", { 37728 value: query.search, 37729 placeholder: phrase(view, "Find"), 37730 "aria-label": phrase(view, "Find"), 37731 class: "cm-textfield", 37732 name: "search", 37733 form: "", 37734 "main-field": "true", 37735 onchange: this.commit, 37736 onkeyup: this.commit 37737 }); 37738 this.replaceField = crelt("input", { 37739 value: query.replace, 37740 placeholder: phrase(view, "Replace"), 37741 "aria-label": phrase(view, "Replace"), 37742 class: "cm-textfield", 37743 name: "replace", 37744 form: "", 37745 onchange: this.commit, 37746 onkeyup: this.commit 37747 }); 37748 this.caseField = crelt("input", { 37749 type: "checkbox", 37750 name: "case", 37751 form: "", 37752 checked: query.caseSensitive, 37753 onchange: this.commit 37754 }); 37755 this.reField = crelt("input", { 37756 type: "checkbox", 37757 name: "re", 37758 form: "", 37759 checked: query.regexp, 37760 onchange: this.commit 37761 }); 37762 this.wordField = crelt("input", { 37763 type: "checkbox", 37764 name: "word", 37765 form: "", 37766 checked: query.wholeWord, 37767 onchange: this.commit 37768 }); 37769 function button(name2, onclick, content2) { 37770 return crelt("button", { class: "cm-button", name: name2, onclick, type: "button" }, content2); 37771 } 37772 this.dom = crelt("div", { onkeydown: (e2) => this.keydown(e2), class: "cm-search" }, [ 37773 this.searchField, 37774 button("next", () => findNext(view), [phrase(view, "next")]), 37775 button("prev", () => findPrevious(view), [phrase(view, "previous")]), 37776 button("select", () => selectMatches(view), [phrase(view, "all")]), 37777 crelt("label", null, [this.caseField, phrase(view, "match case")]), 37778 crelt("label", null, [this.reField, phrase(view, "regexp")]), 37779 crelt("label", null, [this.wordField, phrase(view, "by word")]), 37780 ...view.state.readOnly ? [] : [ 37781 crelt("br"), 37782 this.replaceField, 37783 button("replace", () => replaceNext(view), [phrase(view, "replace")]), 37784 button("replaceAll", () => replaceAll(view), [phrase(view, "replace all")]) 37785 ], 37786 crelt("button", { 37787 name: "close", 37788 onclick: () => closeSearchPanel(view), 37789 "aria-label": phrase(view, "close"), 37790 type: "button" 37791 }, ["\xD7"]) 37792 ]); 37793 } 37794 commit() { 37795 let query = new SearchQuery({ 37796 search: this.searchField.value, 37797 caseSensitive: this.caseField.checked, 37798 regexp: this.reField.checked, 37799 wholeWord: this.wordField.checked, 37800 replace: this.replaceField.value 37801 }); 37802 if (!query.eq(this.query)) { 37803 this.query = query; 37804 this.view.dispatch({ effects: setSearchQuery.of(query) }); 37805 } 37806 } 37807 keydown(e2) { 37808 if (runScopeHandlers(this.view, e2, "search-panel")) { 37809 e2.preventDefault(); 37810 } else if (e2.keyCode == 13 && e2.target == this.searchField) { 37811 e2.preventDefault(); 37812 (e2.shiftKey ? findPrevious : findNext)(this.view); 37813 } else if (e2.keyCode == 13 && e2.target == this.replaceField) { 37814 e2.preventDefault(); 37815 replaceNext(this.view); 37816 } 37817 } 37818 update(update) { 37819 for (let tr of update.transactions) 37820 for (let effect of tr.effects) { 37821 if (effect.is(setSearchQuery) && !effect.value.eq(this.query)) 37822 this.setQuery(effect.value); 37823 } 37824 } 37825 setQuery(query) { 37826 this.query = query; 37827 this.searchField.value = query.search; 37828 this.replaceField.value = query.replace; 37829 this.caseField.checked = query.caseSensitive; 37830 this.reField.checked = query.regexp; 37831 this.wordField.checked = query.wholeWord; 37832 } 37833 mount() { 37834 this.searchField.select(); 37835 } 37836 get pos() { 37837 return 80; 37838 } 37839 get top() { 37840 return this.view.state.facet(searchConfigFacet).top; 37841 } 37842}; 37843function phrase(view, phrase2) { 37844 return view.state.phrase(phrase2); 37845} 37846var AnnounceMargin = 30; 37847var Break = /[\s\.,:;?!]/; 37848function announceMatch(view, { from, to }) { 37849 let line = view.state.doc.lineAt(from), lineEnd = view.state.doc.lineAt(to).to; 37850 let start = Math.max(line.from, from - AnnounceMargin), end = Math.min(lineEnd, to + AnnounceMargin); 37851 let text = view.state.sliceDoc(start, end); 37852 if (start != line.from) { 37853 for (let i2 = 0; i2 < AnnounceMargin; i2++) 37854 if (!Break.test(text[i2 + 1]) && Break.test(text[i2])) { 37855 text = text.slice(i2); 37856 break; 37857 } 37858 } 37859 if (end != lineEnd) { 37860 for (let i2 = text.length - 1; i2 > text.length - AnnounceMargin; i2--) 37861 if (!Break.test(text[i2 - 1]) && Break.test(text[i2])) { 37862 text = text.slice(0, i2); 37863 break; 37864 } 37865 } 37866 return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`); 37867} 37868var baseTheme5 = /* @__PURE__ */ EditorView.baseTheme({ 37869 ".cm-panel.cm-search": { 37870 padding: "2px 6px 4px", 37871 position: "relative", 37872 "& [name=close]": { 37873 position: "absolute", 37874 top: "0", 37875 right: "4px", 37876 backgroundColor: "inherit", 37877 border: "none", 37878 font: "inherit", 37879 padding: 0, 37880 margin: 0 37881 }, 37882 "& input, & button, & label": { 37883 margin: ".2em .6em .2em 0" 37884 }, 37885 "& input[type=checkbox]": { 37886 marginRight: ".2em" 37887 }, 37888 "& label": { 37889 fontSize: "80%", 37890 whiteSpace: "pre" 37891 } 37892 }, 37893 "&light .cm-searchMatch": { backgroundColor: "#ffff0054" }, 37894 "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" }, 37895 "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" }, 37896 "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" } 37897}); 37898var searchExtensions = [ 37899 searchState, 37900 /* @__PURE__ */ Prec.low(searchHighlighter), 37901 baseTheme5 37902]; 37903
37904// src/Components/codeMirror/extensions.ts 37905function getExtensions({ 37906 indentSpaces = 4, 37907 lineNumbers: lineNumbers2 = true 37908} = {}) { 37909 const extensions = [ 37910 // lineNumbers(), 37911 highlightActiveLineGutter(), 37912 highlightSpecialChars(), 37913 history2(), 37914 // foldGutter(), 37915 drawSelection(), 37916 dropCursor(), 37917 EditorState.allowMultipleSelections.of(true), 37918 indentOnInput(), 37919 indentUnit.of(" ".repeat(indentSpaces)), 37920 syntaxHighlighting(defaultHighlightStyle, { fallback: true }), 37921 bracketMatching(), 37922 closeBrackets(), 37923 autocompletion(), 37924 rectangularSelection(), 37925 // highlightActiveLine(), 37926 highlightSelectionMatches(), 37927 keymap.of([ 37928 autocompleteWithTab, 37929 indentWithTab, 37930 ...closeBracketsKeymap, 37931 ...defaultKeymap, 37932 ...searchKeymap, 37933 ...historyKeymap, 37934 ...foldKeymap, 37935 ...completionKeymap, 37936 ...lintKeymap 37937 ]) 37938 ]; 37939 if (lineNumbers2) { 37940 extensions.push(lineNumbers(), lintGutterWithCustomTheme()); 37941 } 37942 return extensions; 37943} 37944var autocompleteWithTab = { key: "Tab", run: acceptCompletion }; 37945function getBinaryFileExtensions() { 37946 return [EditorView.editable.of(false)]; 37947} 37948function getMinimalExtensions() { 37949 return [history2()]; 37950} 37951var LANG_EXTENSIONS = { 37952 python, 37953 javascript, 37954 html, 37955 css, 37956 sql, 37957 sass, 37958 yaml, 37959 r: () => StreamLanguage.define(r) 37960}; 37961function getLanguageExtension(filetype) { 37962 if (filetype === null) 37963 return []; 37964 if (!(filetype in LANG_EXTENSIONS)) 37965 return []; 37966 return LANG_EXTENSIONS[filetype](); 37967} 37968function lintGutterWithCustomTheme() { 37969 let extensions = lintGutter(); 37970 extensions = extensions.filter( 37971 // Compare .constructor to see if the classes match. 37972 (ext) => ext.constructor !== lintGutterCustomTheme.constructor 37973 ); 37974 extensions.push(lintGutterCustomTheme); 37975 return extensions; 37976} 37977var lintGutterCustomTheme = EditorView.baseTheme({ 37978 ".cm-gutter-lint": { 37979 width: "0.3em", 37980 "& .cm-gutterElement": { 37981 padding: "0 0 0 0.1em" 37982 } 37983 }, 37984 ".cm-lint-marker": { 37985 opacity: "0.6", 37986 height: "100%" 37987 }, 37988 ".cm-lint-marker-info": { 37989 "background-color": "#999" 37990 }, 37991 ".cm-lint-marker-warning": { 37992 "background-color": "orange" 37993 }, 37994 ".cm-lint-marker-error": { 37995 "background-color": "#d11" 37996 } 37997}); 37998
37999// src/Components/codeMirror/language-server/diagnostics.ts 38000var LSP = __toESM(require_main2()); 38001
38002// src/Components/codeMirror/language-server/positions.ts 38003var positionToOffset = (document2, position) => { 38004 if (position.line >= document2.lines) { 38005 return void 0; 38006 } 38007 const offset = document2.line(position.line + 1).from + position.character; 38008 if (offset > document2.length) 38009 return; 38010 return offset; 38011}; 38012var offsetToPosition = (document2, offset) => { 38013 const line = document2.lineAt(offset); 38014 return { 38015 line: line.number - 1, 38016 character: offset - line.from 38017 }; 38018}; 38019
38020// src/Components/codeMirror/language-server/diagnostics.ts 38021var severityMapping = { 38022 [LSP.DiagnosticSeverity.Error]: "error", 38023 [LSP.DiagnosticSeverity.Warning]: "warning", 38024 [LSP.DiagnosticSeverity.Information]: "info", 38025 // [LSP.DiagnosticSeverity.Hint]: "hint", 38026 [LSP.DiagnosticSeverity.Hint]: "info" 38027}; 38028var diagnosticsMapping = (document2, lspDiagnostics) => lspDiagnostics.map(({ range, message, severity, tags: tags3 }) => { 38029 const from = positionToOffset(document2, range.start); 38030 const to = positionToOffset(document2, range.end); 38031 if (from !== void 0 && to !== void 0) { 38032 return { 38033 from, 38034 to, 38035 // Missing severity is client defined. Warn for now. 38036 severity: severityMapping[severity ?? LSP.DiagnosticSeverity.Warning], 38037 message 38038 }; 38039 } 38040 return void 0; 38041}).filter((x) => Boolean(x)); 38042function diagnosticToTransaction(editorState, lspDiagnostics) { 38043 const diagnostics = diagnosticsMapping(editorState.doc, lspDiagnostics); 38044 const diagnosticsTransaction = editorState.update( 38045 setDiagnostics(editorState, diagnostics) 38046 ); 38047 return diagnosticsTransaction; 38048} 38049
38050// src/Components/codeMirror/language-server/autocompletion.ts 38051var import_vscode_languageserver_protocol2 = __toESM(require_main2()); 38052
38053// src/Components/codeMirror/language-server/regexp-util.ts 38054var escapeRegExp = (unescaped) => { 38055 return unescaped.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); 38056}; 38057
38058// src/Components/codeMirror/language-server/autocompletion.ts 38059var identifierLike = /[a-zA-Z0-9_\u{a1}-\u{10ffff}]+/u; 38060function autocompletion2(lspClient, filename) { 38061 const client = lspClient; 38062 const uri = createUri(filename); 38063 const findCompletion = async (context) => { 38064 if (!client || !uri || !client.capabilities?.completionProvider) { 38065 return null; 38066 } 38067 let triggerKind; 38068 let triggerCharacter; 38069 const before = context.matchBefore(identifierLike); 38070 if (context.explicit || before) { 38071 triggerKind = import_vscode_languageserver_protocol2.CompletionTriggerKind.Invoked; 38072 } else { 38073 const triggerCharactersRegExp = createTriggerCharactersRegExp(client); 38074 const match = triggerCharactersRegExp && context.matchBefore(triggerCharactersRegExp); 38075 if (match) { 38076 triggerKind = import_vscode_languageserver_protocol2.CompletionTriggerKind.TriggerCharacter; 38077 triggerCharacter = match.text; 38078 } else { 38079 return null; 38080 } 38081 } 38082 const lspCompletionList = await client.completionRequest({ 38083 textDocument: { 38084 uri 38085 }, 38086 position: offsetToPosition(context.state.doc, context.pos), 38087 context: { 38088 triggerKind, 38089 triggerCharacter 38090 } 38091 }); 38092 const completionItems = lspCompletionList.items.filter((x) => !x.additionalTextEdits).map(LSPCompletionItemToCMCompletion); 38093 const result = { 38094 from: before ? before.from : context.pos, 38095 // Could vary these based on isIncomplete? Needs investigation. 38096 // Very desirable to set most of the time to remove flicker. 38097 filter: true, 38098 validFor: identifierLike, 38099 options: completionItems 38100 }; 38101 return result; 38102 }; 38103 return autocompletion({ 38104 override: [findCompletion] 38105 }); 38106} 38107function LSPCompletionItemToCMCompletion(item) { 38108 const completion = { 38109 // In practice we don't get textEdit fields back from Pyright so the label is used. 38110 label: item.label, 38111 apply: (view, completion2, from, to) => { 38112 const insert2 = item.label; 38113 const transactions = [ 38114 { 38115 changes: { from, to, insert: insert2 }, 38116 selection: { anchor: from + insert2.length } 38117 } 38118 ]; 38119 if ( 38120 // funcParensDisabled is set to true by Pyright for e.g. a function completion in an import 38121 completion2.type === "function" && !item.data.funcParensDisabled || completion2.type === "method" 38122 ) { 38123 const bracketTransaction = insertBracket(view.state, "("); 38124 if (bracketTransaction) { 38125 transactions.push(bracketTransaction); 38126 } 38127 } 38128 view.dispatch(...transactions); 38129 }, 38130 type: item.kind ? mapCompletionKind[item.kind] : void 0, 38131 detail: item.detail, 38132 // info: documentationResolver, 38133 boost: boost(item), 38134 // Needed later for resolving. 38135 item 38136 }; 38137 return completion; 38138} 38139var createTriggerCharactersRegExp = (client) => { 38140 const characters = client.capabilities?.completionProvider?.triggerCharacters; 38141 if (characters && characters.length > 0) { 38142 return new RegExp("[" + escapeRegExp(characters.join("")) + "]"); 38143 } 38144 return void 0; 38145}; 38146var mapCompletionKind = Object.fromEntries( 38147 Object.entries(import_vscode_languageserver_protocol2.CompletionItemKind).map(([key, value]) => [ 38148 value, 38149 key.toLowerCase() 38150 ]) 38151); 38152var boost = (item) => { 38153 if (item.label.startsWith("__")) { 38154 return -99; 38155 } 38156 if (item.label.startsWith("_")) { 38157 return -9; 38158 } 38159 if (item.label.endsWith("=")) { 38160 return -200 - "image=".length; 38161 } 38162 return void 0; 38163}; 38164
38165// src/Components/codeMirror/language-server/hover.ts 38166var import_vscode_languageserver_protocol3 = __toESM(require_main2()); 38167
38168// src/Components/codeMirror/language-server/documentation.ts 38169var import_dompurify = __toESM(require_purify()); 38170
vendor: 74,234 bytes, lines 38171-40394
38171// node_modules/marked/lib/marked.esm.js 38172function getDefaults() { 38173 return { 38174 async: false, 38175 baseUrl: null, 38176 breaks: false, 38177 extensions: null, 38178 gfm: true, 38179 headerIds: true, 38180 headerPrefix: "", 38181 highlight: null, 38182 hooks: null, 38183 langPrefix: "language-", 38184 mangle: true, 38185 pedantic: false, 38186 renderer: null, 38187 sanitize: false, 38188 sanitizer: null, 38189 silent: false, 38190 smartypants: false, 38191 tokenizer: null, 38192 walkTokens: null, 38193 xhtml: false 38194 }; 38195} 38196var defaults4 = getDefaults(); 38197function changeDefaults(newDefaults) { 38198 defaults4 = newDefaults; 38199} 38200var escapeTest = /[&<>"']/; 38201var escapeReplace = new RegExp(escapeTest.source, "g"); 38202var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/; 38203var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"); 38204var escapeReplacements = { 38205 "&": "&", 38206 "<": "<", 38207 ">": ">", 38208 '"': """, 38209 "'": "'" 38210}; 38211var getEscapeReplacement = (ch) => escapeReplacements[ch]; 38212function escape(html2, encode) { 38213 if (encode) { 38214 if (escapeTest.test(html2)) { 38215 return html2.replace(escapeReplace, getEscapeReplacement); 38216 } 38217 } else { 38218 if (escapeTestNoEncode.test(html2)) { 38219 return html2.replace(escapeReplaceNoEncode, getEscapeReplacement); 38220 } 38221 } 38222 return html2; 38223} 38224var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; 38225function unescape(html2) { 38226 return html2.replace(unescapeTest, (_2, n3) => { 38227 n3 = n3.toLowerCase(); 38228 if (n3 === "colon") 38229 return ":"; 38230 if (n3.charAt(0) === "#") { 38231 return n3.charAt(1) === "x" ? String.fromCharCode(parseInt(n3.substring(2), 16)) : String.fromCharCode(+n3.substring(1)); 38232 } 38233 return ""; 38234 }); 38235} 38236var caret = /(^|[^\[])\^/g; 38237function edit(regex, opt) { 38238 regex = typeof regex === "string" ? regex : regex.source; 38239 opt = opt || ""; 38240 const obj = { 38241 replace: (name2, val) => { 38242 val = val.source || val; 38243 val = val.replace(caret, "$1"); 38244 regex = regex.replace(name2, val); 38245 return obj; 38246 }, 38247 getRegex: () => { 38248 return new RegExp(regex, opt); 38249 } 38250 }; 38251 return obj; 38252} 38253var nonWordAndColonTest = /[^\w:]/g; 38254var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; 38255function cleanUrl(sanitize, base2, href) { 38256 if (sanitize) { 38257 let prot; 38258 try { 38259 prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, "").toLowerCase(); 38260 } catch (e2) { 38261 return null; 38262 } 38263 if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) { 38264 return null; 38265 } 38266 } 38267 if (base2 && !originIndependentUrl.test(href)) { 38268 href = resolveUrl(base2, href); 38269 } 38270 try { 38271 href = encodeURI(href).replace(/%25/g, "%"); 38272 } catch (e2) { 38273 return null; 38274 } 38275 return href; 38276} 38277var baseUrls = {}; 38278var justDomain = /^[^:]+:\/*[^/]*$/; 38279var protocol = /^([^:]+:)[\s\S]*$/; 38280var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; 38281function resolveUrl(base2, href) { 38282 if (!baseUrls[" " + base2]) { 38283 if (justDomain.test(base2)) { 38284 baseUrls[" " + base2] = base2 + "/"; 38285 } else { 38286 baseUrls[" " + base2] = rtrim(base2, "/", true); 38287 } 38288 } 38289 base2 = baseUrls[" " + base2]; 38290 const relativeBase = base2.indexOf(":") === -1; 38291 if (href.substring(0, 2) === "//") { 38292 if (relativeBase) { 38293 return href; 38294 } 38295 return base2.replace(protocol, "$1") + href; 38296 } else if (href.charAt(0) === "/") { 38297 if (relativeBase) { 38298 return href; 38299 } 38300 return base2.replace(domain, "$1") + href; 38301 } else { 38302 return base2 + href; 38303 } 38304} 38305var noopTest = { exec: function noopTest2() { 38306} }; 38307function splitCells(tableRow, count) { 38308 const row = tableRow.replace(/\|/g, (match, offset, str) => { 38309 let escaped = false, curr = offset; 38310 while (--curr >= 0 && str[curr] === "\\") 38311 escaped = !escaped; 38312 if (escaped) { 38313 return "|"; 38314 } else { 38315 return " |"; 38316 } 38317 }), cells = row.split(/ \|/); 38318 let i2 = 0; 38319 if (!cells[0].trim()) { 38320 cells.shift(); 38321 } 38322 if (cells.length > 0 && !cells[cells.length - 1].trim()) { 38323 cells.pop(); 38324 } 38325 if (cells.length > count) { 38326 cells.splice(count); 38327 } else { 38328 while (cells.length < count) 38329 cells.push(""); 38330 } 38331 for (; i2 < cells.length; i2++) { 38332 cells[i2] = cells[i2].trim().replace(/\\\|/g, "|"); 38333 } 38334 return cells; 38335} 38336function rtrim(str, c2, invert) { 38337 const l3 = str.length; 38338 if (l3 === 0) { 38339 return ""; 38340 } 38341 let suffLen = 0; 38342 while (suffLen < l3) { 38343 const currChar = str.charAt(l3 - suffLen - 1); 38344 if (currChar === c2 && !invert) { 38345 suffLen++; 38346 } else if (currChar !== c2 && invert) { 38347 suffLen++; 38348 } else { 38349 break; 38350 } 38351 } 38352 return str.slice(0, l3 - suffLen); 38353} 38354function findClosingBracket(str, b3) { 38355 if (str.indexOf(b3[1]) === -1) { 38356 return -1; 38357 } 38358 const l3 = str.length; 38359 let level = 0, i2 = 0; 38360 for (; i2 < l3; i2++) { 38361 if (str[i2] === "\\") { 38362 i2++; 38363 } else if (str[i2] === b3[0]) { 38364 level++; 38365 } else if (str[i2] === b3[1]) { 38366 level--; 38367 if (level < 0) { 38368 return i2; 38369 } 38370 } 38371 } 38372 return -1; 38373} 38374function checkDeprecations(opt, callback) { 38375 if (!opt || opt.silent) { 38376 return; 38377 } 38378 if (callback) { 38379 console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"); 38380 } 38381 if (opt.sanitize || opt.sanitizer) { 38382 console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"); 38383 } 38384 if (opt.highlight || opt.langPrefix !== "language-") { 38385 console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."); 38386 } 38387 if (opt.mangle) { 38388 console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."); 38389 } 38390 if (opt.baseUrl) { 38391 console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."); 38392 } 38393 if (opt.smartypants) { 38394 console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."); 38395 } 38396 if (opt.xhtml) { 38397 console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."); 38398 } 38399 if (opt.headerIds || opt.headerPrefix) { 38400 console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."); 38401 } 38402} 38403function outputLink(cap, link, raw, lexer2) { 38404 const href = link.href; 38405 const title = link.title ? escape(link.title) : null; 38406 const text = cap[1].replace(/\\([\[\]])/g, "$1"); 38407 if (cap[0].charAt(0) !== "!") { 38408 lexer2.state.inLink = true; 38409 const token = { 38410 type: "link", 38411 raw, 38412 href, 38413 title, 38414 text, 38415 tokens: lexer2.inlineTokens(text) 38416 }; 38417 lexer2.state.inLink = false; 38418 return token; 38419 } 38420 return { 38421 type: "image", 38422 raw, 38423 href, 38424 title, 38425 text: escape(text) 38426 }; 38427} 38428function indentCodeCompensation(raw, text) { 38429 const matchIndentToCode = raw.match(/^(\s+)(?:```)/); 38430 if (matchIndentToCode === null) { 38431 return text; 38432 } 38433 const indentToCode = matchIndentToCode[1]; 38434 return text.split("\n").map((node) => { 38435 const matchIndentInNode = node.match(/^\s+/); 38436 if (matchIndentInNode === null) { 38437 return node; 38438 } 38439 const [indentInNode] = matchIndentInNode; 38440 if (indentInNode.length >= indentToCode.length) { 38441 return node.slice(indentToCode.length); 38442 } 38443 return node; 38444 }).join("\n"); 38445} 38446var Tokenizer = class { 38447 constructor(options2) { 38448 this.options = options2 || defaults4; 38449 } 38450 space(src) { 38451 const cap = this.rules.block.newline.exec(src); 38452 if (cap && cap[0].length > 0) { 38453 return { 38454 type: "space", 38455 raw: cap[0] 38456 }; 38457 } 38458 } 38459 code(src) { 38460 const cap = this.rules.block.code.exec(src); 38461 if (cap) { 38462 const text = cap[0].replace(/^ {1,4}/gm, ""); 38463 return { 38464 type: "code", 38465 raw: cap[0], 38466 codeBlockStyle: "indented", 38467 text: !this.options.pedantic ? rtrim(text, "\n") : text 38468 }; 38469 } 38470 } 38471 fences(src) { 38472 const cap = this.rules.block.fences.exec(src); 38473 if (cap) { 38474 const raw = cap[0]; 38475 const text = indentCodeCompensation(raw, cap[3] || ""); 38476 return { 38477 type: "code", 38478 raw, 38479 lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2], 38480 text 38481 }; 38482 } 38483 } 38484 heading(src) { 38485 const cap = this.rules.block.heading.exec(src); 38486 if (cap) { 38487 let text = cap[2].trim(); 38488 if (/#$/.test(text)) { 38489 const trimmed = rtrim(text, "#"); 38490 if (this.options.pedantic) { 38491 text = trimmed.trim(); 38492 } else if (!trimmed || / $/.test(trimmed)) { 38493 text = trimmed.trim(); 38494 } 38495 } 38496 return { 38497 type: "heading", 38498 raw: cap[0], 38499 depth: cap[1].length, 38500 text, 38501 tokens: this.lexer.inline(text) 38502 }; 38503 } 38504 } 38505 hr(src) { 38506 const cap = this.rules.block.hr.exec(src); 38507 if (cap) { 38508 return { 38509 type: "hr", 38510 raw: cap[0] 38511 }; 38512 } 38513 } 38514 blockquote(src) { 38515 const cap = this.rules.block.blockquote.exec(src); 38516 if (cap) { 38517 const text = cap[0].replace(/^ *>[ \t]?/gm, ""); 38518 const top2 = this.lexer.state.top; 38519 this.lexer.state.top = true; 38520 const tokens2 = this.lexer.blockTokens(text); 38521 this.lexer.state.top = top2; 38522 return { 38523 type: "blockquote", 38524 raw: cap[0], 38525 tokens: tokens2, 38526 text 38527 }; 38528 } 38529 } 38530 list(src) { 38531 let cap = this.rules.block.list.exec(src); 38532 if (cap) { 38533 let raw, istask, ischecked, indent3, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly; 38534 let bull = cap[1].trim(); 38535 const isordered = bull.length > 1; 38536 const list = { 38537 type: "list", 38538 raw: "", 38539 ordered: isordered, 38540 start: isordered ? +bull.slice(0, -1) : "", 38541 loose: false, 38542 items: [] 38543 }; 38544 bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`; 38545 if (this.options.pedantic) { 38546 bull = isordered ? bull : "[*+-]"; 38547 } 38548 const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`); 38549 while (src) { 38550 endEarly = false; 38551 if (!(cap = itemRegex.exec(src))) { 38552 break; 38553 } 38554 if (this.rules.block.hr.test(src)) { 38555 break; 38556 } 38557 raw = cap[0]; 38558 src = src.substring(raw.length); 38559 line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t3) => " ".repeat(3 * t3.length)); 38560 nextLine = src.split("\n", 1)[0]; 38561 if (this.options.pedantic) { 38562 indent3 = 2; 38563 itemContents = line.trimLeft(); 38564 } else { 38565 indent3 = cap[2].search(/[^ ]/); 38566 indent3 = indent3 > 4 ? 1 : indent3; 38567 itemContents = line.slice(indent3); 38568 indent3 += cap[1].length; 38569 } 38570 blankLine = false; 38571 if (!line && /^ *$/.test(nextLine)) { 38572 raw += nextLine + "\n"; 38573 src = src.substring(nextLine.length + 1); 38574 endEarly = true; 38575 } 38576 if (!endEarly) { 38577 const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`); 38578 const hrRegex = new RegExp(`^ {0,${Math.min(3, indent3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`); 38579 const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent3 - 1)}}(?:\`\`\`|~~~)`); 38580 const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent3 - 1)}}#`); 38581 while (src) { 38582 rawLine = src.split("\n", 1)[0]; 38583 nextLine = rawLine; 38584 if (this.options.pedantic) { 38585 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "); 38586 } 38587 if (fencesBeginRegex.test(nextLine)) { 38588 break; 38589 } 38590 if (headingBeginRegex.test(nextLine)) { 38591 break; 38592 } 38593 if (nextBulletRegex.test(nextLine)) { 38594 break; 38595 } 38596 if (hrRegex.test(src)) { 38597 break; 38598 } 38599 if (nextLine.search(/[^ ]/) >= indent3 || !nextLine.trim()) { 38600 itemContents += "\n" + nextLine.slice(indent3); 38601 } else { 38602 if (blankLine) { 38603 break; 38604 } 38605 if (line.search(/[^ ]/) >= 4) { 38606 break; 38607 } 38608 if (fencesBeginRegex.test(line)) { 38609 break; 38610 } 38611 if (headingBeginRegex.test(line)) { 38612 break; 38613 } 38614 if (hrRegex.test(line)) { 38615 break; 38616 } 38617 itemContents += "\n" + nextLine; 38618 } 38619 if (!blankLine && !nextLine.trim()) { 38620 blankLine = true; 38621 } 38622 raw += rawLine + "\n"; 38623 src = src.substring(rawLine.length + 1); 38624 line = nextLine.slice(indent3); 38625 } 38626 } 38627 if (!list.loose) { 38628 if (endsWithBlankLine) { 38629 list.loose = true; 38630 } else if (/\n *\n *$/.test(raw)) { 38631 endsWithBlankLine = true; 38632 } 38633 } 38634 if (this.options.gfm) { 38635 istask = /^\[[ xX]\] /.exec(itemContents); 38636 if (istask) { 38637 ischecked = istask[0] !== "[ ] "; 38638 itemContents = itemContents.replace(/^\[[ xX]\] +/, ""); 38639 } 38640 } 38641 list.items.push({ 38642 type: "list_item", 38643 raw, 38644 task: !!istask, 38645 checked: ischecked, 38646 loose: false, 38647 text: itemContents 38648 }); 38649 list.raw += raw; 38650 } 38651 list.items[list.items.length - 1].raw = raw.trimRight(); 38652 list.items[list.items.length - 1].text = itemContents.trimRight(); 38653 list.raw = list.raw.trimRight(); 38654 const l3 = list.items.length; 38655 for (i2 = 0; i2 < l3; i2++) { 38656 this.lexer.state.top = false; 38657 list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []); 38658 if (!list.loose) { 38659 const spacers = list.items[i2].tokens.filter((t3) => t3.type === "space"); 38660 const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t3) => /\n.*\n/.test(t3.raw)); 38661 list.loose = hasMultipleLineBreaks; 38662 } 38663 } 38664 if (list.loose) { 38665 for (i2 = 0; i2 < l3; i2++) { 38666 list.items[i2].loose = true; 38667 } 38668 } 38669 return list; 38670 } 38671 } 38672 html(src) { 38673 const cap = this.rules.block.html.exec(src); 38674 if (cap) { 38675 const token = { 38676 type: "html", 38677 block: true, 38678 raw: cap[0], 38679 pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"), 38680 text: cap[0] 38681 }; 38682 if (this.options.sanitize) { 38683 const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]); 38684 token.type = "paragraph"; 38685 token.text = text; 38686 token.tokens = this.lexer.inline(text); 38687 } 38688 return token; 38689 } 38690 } 38691 def(src) { 38692 const cap = this.rules.block.def.exec(src); 38693 if (cap) { 38694 const tag = cap[1].toLowerCase().replace(/\s+/g, " "); 38695 const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : ""; 38696 const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3]; 38697 return { 38698 type: "def", 38699 tag, 38700 raw: cap[0], 38701 href, 38702 title 38703 }; 38704 } 38705 } 38706 table(src) { 38707 const cap = this.rules.block.table.exec(src); 38708 if (cap) { 38709 const item = { 38710 type: "table", 38711 header: splitCells(cap[1]).map((c2) => { 38712 return { text: c2 }; 38713 }), 38714 align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */), 38715 rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [] 38716 }; 38717 if (item.header.length === item.align.length) { 38718 item.raw = cap[0]; 38719 let l3 = item.align.length; 38720 let i2, j3, k, row; 38721 for (i2 = 0; i2 < l3; i2++) { 38722 if (/^ *-+: *$/.test(item.align[i2])) { 38723 item.align[i2] = "right"; 38724 } else if (/^ *:-+: *$/.test(item.align[i2])) { 38725 item.align[i2] = "center"; 38726 } else if (/^ *:-+ *$/.test(item.align[i2])) { 38727 item.align[i2] = "left"; 38728 } else { 38729 item.align[i2] = null; 38730 } 38731 } 38732 l3 = item.rows.length; 38733 for (i2 = 0; i2 < l3; i2++) { 38734 item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c2) => { 38735 return { text: c2 }; 38736 }); 38737 } 38738 l3 = item.header.length; 38739 for (j3 = 0; j3 < l3; j3++) { 38740 item.header[j3].tokens = this.lexer.inline(item.header[j3].text); 38741 } 38742 l3 = item.rows.length; 38743 for (j3 = 0; j3 < l3; j3++) { 38744 row = item.rows[j3]; 38745 for (k = 0; k < row.length; k++) { 38746 row[k].tokens = this.lexer.inline(row[k].text); 38747 } 38748 } 38749 return item; 38750 } 38751 } 38752 } 38753 lheading(src) { 38754 const cap = this.rules.block.lheading.exec(src); 38755 if (cap) { 38756 return { 38757 type: "heading", 38758 raw: cap[0], 38759 depth: cap[2].charAt(0) === "=" ? 1 : 2, 38760 text: cap[1], 38761 tokens: this.lexer.inline(cap[1]) 38762 }; 38763 } 38764 } 38765 paragraph(src) { 38766 const cap = this.rules.block.paragraph.exec(src); 38767 if (cap) { 38768 const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1]; 38769 return { 38770 type: "paragraph", 38771 raw: cap[0], 38772 text, 38773 tokens: this.lexer.inline(text) 38774 }; 38775 } 38776 } 38777 text(src) { 38778 const cap = this.rules.block.text.exec(src); 38779 if (cap) { 38780 return { 38781 type: "text", 38782 raw: cap[0], 38783 text: cap[0], 38784 tokens: this.lexer.inline(cap[0]) 38785 }; 38786 } 38787 } 38788 escape(src) { 38789 const cap = this.rules.inline.escape.exec(src); 38790 if (cap) { 38791 return { 38792 type: "escape", 38793 raw: cap[0], 38794 text: escape(cap[1]) 38795 }; 38796 } 38797 } 38798 tag(src) { 38799 const cap = this.rules.inline.tag.exec(src); 38800 if (cap) { 38801 if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) { 38802 this.lexer.state.inLink = true; 38803 } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) { 38804 this.lexer.state.inLink = false; 38805 } 38806 if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { 38807 this.lexer.state.inRawBlock = true; 38808 } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { 38809 this.lexer.state.inRawBlock = false; 38810 } 38811 return { 38812 type: this.options.sanitize ? "text" : "html", 38813 raw: cap[0], 38814 inLink: this.lexer.state.inLink, 38815 inRawBlock: this.lexer.state.inRawBlock, 38816 block: false, 38817 text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0] 38818 }; 38819 } 38820 } 38821 link(src) { 38822 const cap = this.rules.inline.link.exec(src); 38823 if (cap) { 38824 const trimmedUrl = cap[2].trim(); 38825 if (!this.options.pedantic && /^</.test(trimmedUrl)) { 38826 if (!/>$/.test(trimmedUrl)) { 38827 return; 38828 } 38829 const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\"); 38830 if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { 38831 return; 38832 } 38833 } else { 38834 const lastParenIndex = findClosingBracket(cap[2], "()"); 38835 if (lastParenIndex > -1) { 38836 const start = cap[0].indexOf("!") === 0 ? 5 : 4; 38837 const linkLen = start + cap[1].length + lastParenIndex; 38838 cap[2] = cap[2].substring(0, lastParenIndex); 38839 cap[0] = cap[0].substring(0, linkLen).trim(); 38840 cap[3] = ""; 38841 } 38842 } 38843 let href = cap[2]; 38844 let title = ""; 38845 if (this.options.pedantic) { 38846 const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); 38847 if (link) { 38848 href = link[1]; 38849 title = link[3]; 38850 } 38851 } else { 38852 title = cap[3] ? cap[3].slice(1, -1) : ""; 38853 } 38854 href = href.trim(); 38855 if (/^</.test(href)) { 38856 if (this.options.pedantic && !/>$/.test(trimmedUrl)) { 38857 href = href.slice(1); 38858 } else { 38859 href = href.slice(1, -1); 38860 } 38861 } 38862 return outputLink(cap, { 38863 href: href ? href.replace(this.rules.inline._escapes, "$1") : href, 38864 title: title ? title.replace(this.rules.inline._escapes, "$1") : title 38865 }, cap[0], this.lexer); 38866 } 38867 } 38868 reflink(src, links) { 38869 let cap; 38870 if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { 38871 let link = (cap[2] || cap[1]).replace(/\s+/g, " "); 38872 link = links[link.toLowerCase()]; 38873 if (!link) { 38874 const text = cap[0].charAt(0); 38875 return { 38876 type: "text", 38877 raw: text, 38878 text 38879 }; 38880 } 38881 return outputLink(cap, link, cap[0], this.lexer); 38882 } 38883 } 38884 emStrong(src, maskedSrc, prevChar2 = "") { 38885 let match = this.rules.inline.emStrong.lDelim.exec(src); 38886 if (!match) 38887 return; 38888 if (match[3] && prevChar2.match(/[\p{L}\p{N}]/u)) 38889 return; 38890 const nextChar2 = match[1] || match[2] || ""; 38891 if (!nextChar2 || !prevChar2 || this.rules.inline.punctuation.exec(prevChar2)) { 38892 const lLength = match[0].length - 1; 38893 let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; 38894 const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd; 38895 endReg.lastIndex = 0; 38896 maskedSrc = maskedSrc.slice(-1 * src.length + lLength); 38897 while ((match = endReg.exec(maskedSrc)) != null) { 38898 rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; 38899 if (!rDelim) 38900 continue; 38901 rLength = rDelim.length; 38902 if (match[3] || match[4]) { 38903 delimTotal += rLength; 38904 continue; 38905 } else if (match[5] || match[6]) { 38906 if (lLength % 3 && !((lLength + rLength) % 3)) { 38907 midDelimTotal += rLength; 38908 continue; 38909 } 38910 } 38911 delimTotal -= rLength; 38912 if (delimTotal > 0) 38913 continue; 38914 rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); 38915 const raw = src.slice(0, lLength + match.index + rLength + 1); 38916 if (Math.min(lLength, rLength) % 2) { 38917 const text2 = raw.slice(1, -1); 38918 return { 38919 type: "em", 38920 raw, 38921 text: text2, 38922 tokens: this.lexer.inlineTokens(text2) 38923 }; 38924 } 38925 const text = raw.slice(2, -2); 38926 return { 38927 type: "strong", 38928 raw, 38929 text, 38930 tokens: this.lexer.inlineTokens(text) 38931 }; 38932 } 38933 } 38934 } 38935 codespan(src) { 38936 const cap = this.rules.inline.code.exec(src); 38937 if (cap) { 38938 let text = cap[2].replace(/\n/g, " "); 38939 const hasNonSpaceChars = /[^ ]/.test(text); 38940 const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text); 38941 if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { 38942 text = text.substring(1, text.length - 1); 38943 } 38944 text = escape(text, true); 38945 return { 38946 type: "codespan", 38947 raw: cap[0], 38948 text 38949 }; 38950 } 38951 } 38952 br(src) { 38953 const cap = this.rules.inline.br.exec(src); 38954 if (cap) { 38955 return { 38956 type: "br", 38957 raw: cap[0] 38958 }; 38959 } 38960 } 38961 del(src) { 38962 const cap = this.rules.inline.del.exec(src); 38963 if (cap) { 38964 return { 38965 type: "del", 38966 raw: cap[0], 38967 text: cap[2], 38968 tokens: this.lexer.inlineTokens(cap[2]) 38969 }; 38970 } 38971 } 38972 autolink(src, mangle2) { 38973 const cap = this.rules.inline.autolink.exec(src); 38974 if (cap) { 38975 let text, href; 38976 if (cap[2] === "@") { 38977 text = escape(this.options.mangle ? mangle2(cap[1]) : cap[1]); 38978 href = "mailto:" + text; 38979 } else { 38980 text = escape(cap[1]); 38981 href = text; 38982 } 38983 return { 38984 type: "link", 38985 raw: cap[0], 38986 text, 38987 href, 38988 tokens: [ 38989 { 38990 type: "text", 38991 raw: text, 38992 text 38993 } 38994 ] 38995 }; 38996 } 38997 } 38998 url(src, mangle2) { 38999 let cap; 39000 if (cap = this.rules.inline.url.exec(src)) { 39001 let text, href; 39002 if (cap[2] === "@") { 39003 text = escape(this.options.mangle ? mangle2(cap[0]) : cap[0]); 39004 href = "mailto:" + text; 39005 } else { 39006 let prevCapZero; 39007 do { 39008 prevCapZero = cap[0]; 39009 cap[0] = this.rules.inline._backpedal.exec(cap[0])[0]; 39010 } while (prevCapZero !== cap[0]); 39011 text = escape(cap[0]); 39012 if (cap[1] === "www.") { 39013 href = "http://" + cap[0]; 39014 } else { 39015 href = cap[0]; 39016 } 39017 } 39018 return { 39019 type: "link", 39020 raw: cap[0], 39021 text, 39022 href, 39023 tokens: [ 39024 { 39025 type: "text", 39026 raw: text, 39027 text 39028 } 39029 ] 39030 }; 39031 } 39032 } 39033 inlineText(src, smartypants2) { 39034 const cap = this.rules.inline.text.exec(src); 39035 if (cap) { 39036 let text; 39037 if (this.lexer.state.inRawBlock) { 39038 text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]; 39039 } else { 39040 text = escape(this.options.smartypants ? smartypants2(cap[0]) : cap[0]); 39041 } 39042 return { 39043 type: "text", 39044 raw: cap[0], 39045 text 39046 }; 39047 } 39048 } 39049}; 39050var block = { 39051 newline: /^(?: *(?:\n|$))+/, 39052 code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, 39053 fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, 39054 hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, 39055 heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, 39056 blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, 39057 list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/, 39058 html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", 39059 def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/, 39060 table: noopTest, 39061 lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, 39062 // regex template, placeholders will be replaced according to different paragraph 39063 // interruption rules of commonmark and the original markdown spec: 39064 _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, 39065 text: /^[^\n]+/ 39066}; 39067block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/; 39068block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; 39069block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex(); 39070block.bullet = /(?:[*+-]|\d{1,9}[.)])/; 39071block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex(); 39072block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex(); 39073block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; 39074block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/; 39075block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); 39076block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex(); 39077block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); 39078block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex(); 39079block.normal = { ...block }; 39080block.gfm = { 39081 ...block.normal, 39082 table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)" 39083 // Cells 39084}; 39085block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); 39086block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); 39087block.pedantic = { 39088 ...block.normal, 39089 html: edit( 39090 `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))` 39091 ).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), 39092 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, 39093 heading: /^(#{1,6})(.*)(?:\n+|$)/, 39094 fences: noopTest, 39095 // fences not supported 39096 lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, 39097 paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex() 39098}; 39099var inline = { 39100 escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, 39101 autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, 39102 url: noopTest, 39103 tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>", 39104 // CDATA section 39105 link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/, 39106 reflink: /^!?\[(label)\]\[(ref)\]/, 39107 nolink: /^!?\[(ref)\](?:\[\])?/, 39108 reflinkSearch: "reflink|nolink(?!\\()", 39109 emStrong: { 39110 lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 39111 // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right. 39112 // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a 39113 rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/, 39114 rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ 39115 // ^- Not allowed for _ 39116 }, 39117 code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, 39118 br: /^( {2,}|\\)\n(?!\s*$)/, 39119 del: noopTest, 39120 text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, 39121 punctuation: /^((?![*_])[\spunctuation])/ 39122}; 39123inline._punctuation = "\\p{P}$+<=>`^|~"; 39124inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex(); 39125inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g; 39126inline.anyPunctuation = /\\[punct]/g; 39127inline._escapes = /\\([punct])/g; 39128inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex(); 39129inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex(); 39130inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex(); 39131inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex(); 39132inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex(); 39133inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex(); 39134inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; 39135inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; 39136inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex(); 39137inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; 39138inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex(); 39139inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; 39140inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/; 39141inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; 39142inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex(); 39143inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex(); 39144inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex(); 39145inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex(); 39146inline.normal = { ...inline }; 39147inline.pedantic = { 39148 ...inline.normal, 39149 strong: { 39150 start: /^__|\*\*/, 39151 middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, 39152 endAst: /\*\*(?!\*)/g, 39153 endUnd: /__(?!_)/g 39154 }, 39155 em: { 39156 start: /^_|\*/, 39157 middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/, 39158 endAst: /\*(?!\*)/g, 39159 endUnd: /_(?!_)/g 39160 }, 39161 link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(), 39162 reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex() 39163}; 39164inline.gfm = { 39165 ...inline.normal, 39166 escape: edit(inline.escape).replace("])", "~|])").getRegex(), 39167 _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, 39168 url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 39169 _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, 39170 del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, 39171 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ 39172}; 39173inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex(); 39174inline.breaks = { 39175 ...inline.gfm, 39176 br: edit(inline.br).replace("{2,}", "*").getRegex(), 39177 text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() 39178}; 39179function smartypants(text) { 39180 return text.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026"); 39181} 39182function mangle(text) { 39183 let out = "", i2, ch; 39184 const l3 = text.length; 39185 for (i2 = 0; i2 < l3; i2++) { 39186 ch = text.charCodeAt(i2); 39187 if (Math.random() > 0.5) { 39188 ch = "x" + ch.toString(16); 39189 } 39190 out += "&#" + ch + ";"; 39191 } 39192 return out; 39193} 39194var Lexer = class _Lexer { 39195 constructor(options2) { 39196 this.tokens = []; 39197 this.tokens.links = /* @__PURE__ */ Object.create(null); 39198 this.options = options2 || defaults4; 39199 this.options.tokenizer = this.options.tokenizer || new Tokenizer(); 39200 this.tokenizer = this.options.tokenizer; 39201 this.tokenizer.options = this.options; 39202 this.tokenizer.lexer = this; 39203 this.inlineQueue = []; 39204 this.state = { 39205 inLink: false, 39206 inRawBlock: false, 39207 top: true 39208 }; 39209 const rules = { 39210 block: block.normal, 39211 inline: inline.normal 39212 }; 39213 if (this.options.pedantic) { 39214 rules.block = block.pedantic; 39215 rules.inline = inline.pedantic; 39216 } else if (this.options.gfm) { 39217 rules.block = block.gfm; 39218 if (this.options.breaks) { 39219 rules.inline = inline.breaks; 39220 } else { 39221 rules.inline = inline.gfm; 39222 } 39223 } 39224 this.tokenizer.rules = rules; 39225 } 39226 /** 39227 * Expose Rules 39228 */ 39229 static get rules() { 39230 return { 39231 block, 39232 inline 39233 }; 39234 } 39235 /** 39236 * Static Lex Method 39237 */ 39238 static lex(src, options2) { 39239 const lexer2 = new _Lexer(options2); 39240 return lexer2.lex(src); 39241 } 39242 /** 39243 * Static Lex Inline Method 39244 */ 39245 static lexInline(src, options2) { 39246 const lexer2 = new _Lexer(options2); 39247 return lexer2.inlineTokens(src); 39248 } 39249 /** 39250 * Preprocessing 39251 */ 39252 lex(src) { 39253 src = src.replace(/\r\n|\r/g, "\n"); 39254 this.blockTokens(src, this.tokens); 39255 let next; 39256 while (next = this.inlineQueue.shift()) { 39257 this.inlineTokens(next.src, next.tokens); 39258 } 39259 return this.tokens; 39260 } 39261 /** 39262 * Lexing 39263 */ 39264 blockTokens(src, tokens2 = []) { 39265 if (this.options.pedantic) { 39266 src = src.replace(/\t/g, " ").replace(/^ +$/gm, ""); 39267 } else { 39268 src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => { 39269 return leading + " ".repeat(tabs.length); 39270 }); 39271 } 39272 let token, lastToken, cutSrc, lastParagraphClipped; 39273 while (src) { 39274 if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => { 39275 if (token = extTokenizer.call({ lexer: this }, src, tokens2)) { 39276 src = src.substring(token.raw.length); 39277 tokens2.push(token); 39278 return true; 39279 } 39280 return false; 39281 })) { 39282 continue; 39283 } 39284 if (token = this.tokenizer.space(src)) { 39285 src = src.substring(token.raw.length); 39286 if (token.raw.length === 1 && tokens2.length > 0) { 39287 tokens2[tokens2.length - 1].raw += "\n"; 39288 } else { 39289 tokens2.push(token); 39290 } 39291 continue; 39292 } 39293 if (token = this.tokenizer.code(src)) { 39294 src = src.substring(token.raw.length); 39295 lastToken = tokens2[tokens2.length - 1]; 39296 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) { 39297 lastToken.raw += "\n" + token.raw; 39298 lastToken.text += "\n" + token.text; 39299 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 39300 } else { 39301 tokens2.push(token); 39302 } 39303 continue; 39304 } 39305 if (token = this.tokenizer.fences(src)) { 39306 src = src.substring(token.raw.length); 39307 tokens2.push(token); 39308 continue; 39309 } 39310 if (token = this.tokenizer.heading(src)) { 39311 src = src.substring(token.raw.length); 39312 tokens2.push(token); 39313 continue; 39314 } 39315 if (token = this.tokenizer.hr(src)) { 39316 src = src.substring(token.raw.length); 39317 tokens2.push(token); 39318 continue; 39319 } 39320 if (token = this.tokenizer.blockquote(src)) { 39321 src = src.substring(token.raw.length); 39322 tokens2.push(token); 39323 continue; 39324 } 39325 if (token = this.tokenizer.list(src)) { 39326 src = src.substring(token.raw.length); 39327 tokens2.push(token); 39328 continue; 39329 } 39330 if (token = this.tokenizer.html(src)) { 39331 src = src.substring(token.raw.length); 39332 tokens2.push(token); 39333 continue; 39334 } 39335 if (token = this.tokenizer.def(src)) { 39336 src = src.substring(token.raw.length); 39337 lastToken = tokens2[tokens2.length - 1]; 39338 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) { 39339 lastToken.raw += "\n" + token.raw; 39340 lastToken.text += "\n" + token.raw; 39341 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 39342 } else if (!this.tokens.links[token.tag]) { 39343 this.tokens.links[token.tag] = { 39344 href: token.href, 39345 title: token.title 39346 }; 39347 } 39348 continue; 39349 } 39350 if (token = this.tokenizer.table(src)) { 39351 src = src.substring(token.raw.length); 39352 tokens2.push(token); 39353 continue; 39354 } 39355 if (token = this.tokenizer.lheading(src)) { 39356 src = src.substring(token.raw.length); 39357 tokens2.push(token); 39358 continue; 39359 } 39360 cutSrc = src; 39361 if (this.options.extensions && this.options.extensions.startBlock) { 39362 let startIndex = Infinity; 39363 const tempSrc = src.slice(1); 39364 let tempStart; 39365 this.options.extensions.startBlock.forEach(function(getStartIndex) { 39366 tempStart = getStartIndex.call({ lexer: this }, tempSrc); 39367 if (typeof tempStart === "number" && tempStart >= 0) { 39368 startIndex = Math.min(startIndex, tempStart); 39369 } 39370 }); 39371 if (startIndex < Infinity && startIndex >= 0) { 39372 cutSrc = src.substring(0, startIndex + 1); 39373 } 39374 } 39375 if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { 39376 lastToken = tokens2[tokens2.length - 1]; 39377 if (lastParagraphClipped && lastToken.type === "paragraph") { 39378 lastToken.raw += "\n" + token.raw; 39379 lastToken.text += "\n" + token.text; 39380 this.inlineQueue.pop(); 39381 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 39382 } else { 39383 tokens2.push(token); 39384 } 39385 lastParagraphClipped = cutSrc.length !== src.length; 39386 src = src.substring(token.raw.length); 39387 continue; 39388 } 39389 if (token = this.tokenizer.text(src)) { 39390 src = src.substring(token.raw.length); 39391 lastToken = tokens2[tokens2.length - 1]; 39392 if (lastToken && lastToken.type === "text") { 39393 lastToken.raw += "\n" + token.raw; 39394 lastToken.text += "\n" + token.text; 39395 this.inlineQueue.pop(); 39396 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 39397 } else { 39398 tokens2.push(token); 39399 } 39400 continue; 39401 } 39402 if (src) { 39403 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); 39404 if (this.options.silent) { 39405 console.error(errMsg); 39406 break; 39407 } else { 39408 throw new Error(errMsg); 39409 } 39410 } 39411 } 39412 this.state.top = true; 39413 return tokens2; 39414 } 39415 inline(src, tokens2 = []) { 39416 this.inlineQueue.push({ src, tokens: tokens2 }); 39417 return tokens2; 39418 } 39419 /** 39420 * Lexing/Compiling 39421 */ 39422 inlineTokens(src, tokens2 = []) { 39423 let token, lastToken, cutSrc; 39424 let maskedSrc = src; 39425 let match; 39426 let keepPrevChar, prevChar2; 39427 if (this.tokens.links) { 39428 const links = Object.keys(this.tokens.links); 39429 if (links.length > 0) { 39430 while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { 39431 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) { 39432 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); 39433 } 39434 } 39435 } 39436 } 39437 while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { 39438 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); 39439 } 39440 while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) { 39441 maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); 39442 } 39443 while (src) { 39444 if (!keepPrevChar) { 39445 prevChar2 = ""; 39446 } 39447 keepPrevChar = false; 39448 if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => { 39449 if (token = extTokenizer.call({ lexer: this }, src, tokens2)) { 39450 src = src.substring(token.raw.length); 39451 tokens2.push(token); 39452 return true; 39453 } 39454 return false; 39455 })) { 39456 continue; 39457 } 39458 if (token = this.tokenizer.escape(src)) { 39459 src = src.substring(token.raw.length); 39460 tokens2.push(token); 39461 continue; 39462 } 39463 if (token = this.tokenizer.tag(src)) { 39464 src = src.substring(token.raw.length); 39465 lastToken = tokens2[tokens2.length - 1]; 39466 if (lastToken && token.type === "text" && lastToken.type === "text") { 39467 lastToken.raw += token.raw; 39468 lastToken.text += token.text; 39469 } else { 39470 tokens2.push(token); 39471 } 39472 continue; 39473 } 39474 if (token = this.tokenizer.link(src)) { 39475 src = src.substring(token.raw.length); 39476 tokens2.push(token); 39477 continue; 39478 } 39479 if (token = this.tokenizer.reflink(src, this.tokens.links)) { 39480 src = src.substring(token.raw.length); 39481 lastToken = tokens2[tokens2.length - 1]; 39482 if (lastToken && token.type === "text" && lastToken.type === "text") { 39483 lastToken.raw += token.raw; 39484 lastToken.text += token.text; 39485 } else { 39486 tokens2.push(token); 39487 } 39488 continue; 39489 } 39490 if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar2)) { 39491 src = src.substring(token.raw.length); 39492 tokens2.push(token); 39493 continue; 39494 } 39495 if (token = this.tokenizer.codespan(src)) { 39496 src = src.substring(token.raw.length); 39497 tokens2.push(token); 39498 continue; 39499 } 39500 if (token = this.tokenizer.br(src)) { 39501 src = src.substring(token.raw.length); 39502 tokens2.push(token); 39503 continue; 39504 } 39505 if (token = this.tokenizer.del(src)) { 39506 src = src.substring(token.raw.length); 39507 tokens2.push(token); 39508 continue; 39509 } 39510 if (token = this.tokenizer.autolink(src, mangle)) { 39511 src = src.substring(token.raw.length); 39512 tokens2.push(token); 39513 continue; 39514 } 39515 if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) { 39516 src = src.substring(token.raw.length); 39517 tokens2.push(token); 39518 continue; 39519 } 39520 cutSrc = src; 39521 if (this.options.extensions && this.options.extensions.startInline) { 39522 let startIndex = Infinity; 39523 const tempSrc = src.slice(1); 39524 let tempStart; 39525 this.options.extensions.startInline.forEach(function(getStartIndex) { 39526 tempStart = getStartIndex.call({ lexer: this }, tempSrc); 39527 if (typeof tempStart === "number" && tempStart >= 0) { 39528 startIndex = Math.min(startIndex, tempStart); 39529 } 39530 }); 39531 if (startIndex < Infinity && startIndex >= 0) { 39532 cutSrc = src.substring(0, startIndex + 1); 39533 } 39534 } 39535 if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { 39536 src = src.substring(token.raw.length); 39537 if (token.raw.slice(-1) !== "_") { 39538 prevChar2 = token.raw.slice(-1); 39539 } 39540 keepPrevChar = true; 39541 lastToken = tokens2[tokens2.length - 1]; 39542 if (lastToken && lastToken.type === "text") { 39543 lastToken.raw += token.raw; 39544 lastToken.text += token.text; 39545 } else { 39546 tokens2.push(token); 39547 } 39548 continue; 39549 } 39550 if (src) { 39551 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); 39552 if (this.options.silent) { 39553 console.error(errMsg); 39554 break; 39555 } else { 39556 throw new Error(errMsg); 39557 } 39558 } 39559 } 39560 return tokens2; 39561 } 39562}; 39563var Renderer = class { 39564 constructor(options2) { 39565 this.options = options2 || defaults4; 39566 } 39567 code(code, infostring, escaped) { 39568 const lang = (infostring || "").match(/\S*/)[0]; 39569 if (this.options.highlight) { 39570 const out = this.options.highlight(code, lang); 39571 if (out != null && out !== code) { 39572 escaped = true; 39573 code = out; 39574 } 39575 } 39576 code = code.replace(/\n$/, "") + "\n"; 39577 if (!lang) { 39578 return "<pre><code>" + (escaped ? code : escape(code, true)) + "</code></pre>\n"; 39579 } 39580 return '<pre><code class="' + this.options.langPrefix + escape(lang) + '">' + (escaped ? code : escape(code, true)) + "</code></pre>\n"; 39581 } 39582 /** 39583 * @param {string} quote 39584 */ 39585 blockquote(quote) { 39586 return `<blockquote> 39587${quote}</blockquote> 39588`; 39589 } 39590 html(html2, block2) { 39591 return html2; 39592 } 39593 /** 39594 * @param {string} text 39595 * @param {string} level 39596 * @param {string} raw 39597 * @param {any} slugger 39598 */ 39599 heading(text, level, raw, slugger) { 39600 if (this.options.headerIds) { 39601 const id2 = this.options.headerPrefix + slugger.slug(raw); 39602 return `<h${level} id="${id2}">${text}</h${level}> 39603`; 39604 } 39605 return `<h${level}>${text}</h${level}> 39606`; 39607 } 39608 hr() { 39609 return this.options.xhtml ? "<hr/>\n" : "<hr>\n"; 39610 } 39611 list(body, ordered, start) { 39612 const type = ordered ? "ol" : "ul", startatt = ordered && start !== 1 ? ' start="' + start + '"' : ""; 39613 return "<" + type + startatt + ">\n" + body + "</" + type + ">\n"; 39614 } 39615 /** 39616 * @param {string} text 39617 */ 39618 listitem(text) { 39619 return `<li>${text}</li> 39620`; 39621 } 39622 checkbox(checked) { 39623 return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> "; 39624 } 39625 /** 39626 * @param {string} text 39627 */ 39628 paragraph(text) { 39629 return `<p>${text}</p> 39630`; 39631 } 39632 /** 39633 * @param {string} header 39634 * @param {string} body 39635 */ 39636 table(header, body) { 39637 if (body) 39638 body = `<tbody>${body}</tbody>`; 39639 return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n"; 39640 } 39641 /** 39642 * @param {string} content 39643 */ 39644 tablerow(content2) { 39645 return `<tr> 39646${content2}</tr> 39647`; 39648 } 39649 tablecell(content2, flags) { 39650 const type = flags.header ? "th" : "td"; 39651 const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`; 39652 return tag + content2 + `</${type}> 39653`; 39654 } 39655 /** 39656 * span level renderer 39657 * @param {string} text 39658 */ 39659 strong(text) { 39660 return `<strong>${text}</strong>`; 39661 } 39662 /** 39663 * @param {string} text 39664 */ 39665 em(text) { 39666 return `<em>${text}</em>`; 39667 } 39668 /** 39669 * @param {string} text 39670 */ 39671 codespan(text) { 39672 return `<code>${text}</code>`; 39673 } 39674 br() { 39675 return this.options.xhtml ? "<br/>" : "<br>"; 39676 } 39677 /** 39678 * @param {string} text 39679 */ 39680 del(text) { 39681 return `<del>${text}</del>`; 39682 } 39683 /** 39684 * @param {string} href 39685 * @param {string} title 39686 * @param {string} text 39687 */ 39688 link(href, title, text) { 39689 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); 39690 if (href === null) { 39691 return text; 39692 } 39693 let out = '<a href="' + href + '"'; 39694 if (title) { 39695 out += ' title="' + title + '"'; 39696 } 39697 out += ">" + text + "</a>"; 39698 return out; 39699 } 39700 /** 39701 * @param {string} href 39702 * @param {string} title 39703 * @param {string} text 39704 */ 39705 image(href, title, text) { 39706 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); 39707 if (href === null) { 39708 return text; 39709 } 39710 let out = `<img src="${href}" alt="${text}"`; 39711 if (title) { 39712 out += ` title="${title}"`; 39713 } 39714 out += this.options.xhtml ? "/>" : ">"; 39715 return out; 39716 } 39717 text(text) { 39718 return text; 39719 } 39720}; 39721var TextRenderer = class { 39722 // no need for block level renderers 39723 strong(text) { 39724 return text; 39725 } 39726 em(text) { 39727 return text; 39728 } 39729 codespan(text) { 39730 return text; 39731 } 39732 del(text) { 39733 return text; 39734 } 39735 html(text) { 39736 return text; 39737 } 39738 text(text) { 39739 return text; 39740 } 39741 link(href, title, text) { 39742 return "" + text; 39743 } 39744 image(href, title, text) { 39745 return "" + text; 39746 } 39747 br() { 39748 return ""; 39749 } 39750}; 39751var Slugger = class { 39752 constructor() { 39753 this.seen = {}; 39754 } 39755 /** 39756 * @param {string} value 39757 */ 39758 serialize(value) { 39759 return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-"); 39760 } 39761 /** 39762 * Finds the next safe (unique) slug to use 39763 * @param {string} originalSlug 39764 * @param {boolean} isDryRun 39765 */ 39766 getNextSafeSlug(originalSlug, isDryRun) { 39767 let slug = originalSlug; 39768 let occurenceAccumulator = 0; 39769 if (this.seen.hasOwnProperty(slug)) { 39770 occurenceAccumulator = this.seen[originalSlug]; 39771 do { 39772 occurenceAccumulator++; 39773 slug = originalSlug + "-" + occurenceAccumulator; 39774 } while (this.seen.hasOwnProperty(slug)); 39775 } 39776 if (!isDryRun) { 39777 this.seen[originalSlug] = occurenceAccumulator; 39778 this.seen[slug] = 0; 39779 } 39780 return slug; 39781 } 39782 /** 39783 * Convert string to unique id 39784 * @param {object} [options] 39785 * @param {boolean} [options.dryrun] Generates the next unique slug without 39786 * updating the internal accumulator. 39787 */ 39788 slug(value, options2 = {}) { 39789 const slug = this.serialize(value); 39790 return this.getNextSafeSlug(slug, options2.dryrun); 39791 } 39792}; 39793var Parser2 = class _Parser { 39794 constructor(options2) { 39795 this.options = options2 || defaults4; 39796 this.options.renderer = this.options.renderer || new Renderer(); 39797 this.renderer = this.options.renderer; 39798 this.renderer.options = this.options; 39799 this.textRenderer = new TextRenderer(); 39800 this.slugger = new Slugger(); 39801 } 39802 /** 39803 * Static Parse Method 39804 */ 39805 static parse(tokens2, options2) { 39806 const parser10 = new _Parser(options2); 39807 return parser10.parse(tokens2); 39808 } 39809 /** 39810 * Static Parse Inline Method 39811 */ 39812 static parseInline(tokens2, options2) { 39813 const parser10 = new _Parser(options2); 39814 return parser10.parseInline(tokens2); 39815 } 39816 /** 39817 * Parse Loop 39818 */ 39819 parse(tokens2, top2 = true) { 39820 let out = "", i2, j3, k, l22, l3, row, cell, header, body, token, ordered, start, loose, itemBody, item, checked, task, checkbox, ret; 39821 const l4 = tokens2.length; 39822 for (i2 = 0; i2 < l4; i2++) { 39823 token = tokens2[i2]; 39824 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { 39825 ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); 39826 if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) { 39827 out += ret || ""; 39828 continue; 39829 } 39830 } 39831 switch (token.type) { 39832 case "space": { 39833 continue; 39834 } 39835 case "hr": { 39836 out += this.renderer.hr(); 39837 continue; 39838 } 39839 case "heading": { 39840 out += this.renderer.heading( 39841 this.parseInline(token.tokens), 39842 token.depth, 39843 unescape(this.parseInline(token.tokens, this.textRenderer)), 39844 this.slugger 39845 ); 39846 continue; 39847 } 39848 case "code": { 39849 out += this.renderer.code( 39850 token.text, 39851 token.lang, 39852 token.escaped 39853 ); 39854 continue; 39855 } 39856 case "table": { 39857 header = ""; 39858 cell = ""; 39859 l22 = token.header.length; 39860 for (j3 = 0; j3 < l22; j3++) { 39861 cell += this.renderer.tablecell( 39862 this.parseInline(token.header[j3].tokens), 39863 { header: true, align: token.align[j3] } 39864 ); 39865 } 39866 header += this.renderer.tablerow(cell); 39867 body = ""; 39868 l22 = token.rows.length; 39869 for (j3 = 0; j3 < l22; j3++) { 39870 row = token.rows[j3]; 39871 cell = ""; 39872 l3 = row.length; 39873 for (k = 0; k < l3; k++) { 39874 cell += this.renderer.tablecell( 39875 this.parseInline(row[k].tokens), 39876 { header: false, align: token.align[k] } 39877 ); 39878 } 39879 body += this.renderer.tablerow(cell); 39880 } 39881 out += this.renderer.table(header, body); 39882 continue; 39883 } 39884 case "blockquote": { 39885 body = this.parse(token.tokens); 39886 out += this.renderer.blockquote(body); 39887 continue; 39888 } 39889 case "list": { 39890 ordered = token.ordered; 39891 start = token.start; 39892 loose = token.loose; 39893 l22 = token.items.length; 39894 body = ""; 39895 for (j3 = 0; j3 < l22; j3++) { 39896 item = token.items[j3]; 39897 checked = item.checked; 39898 task = item.task; 39899 itemBody = ""; 39900 if (item.task) { 39901 checkbox = this.renderer.checkbox(checked); 39902 if (loose) { 39903 if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") { 39904 item.tokens[0].text = checkbox + " " + item.tokens[0].text; 39905 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") { 39906 item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text; 39907 } 39908 } else { 39909 item.tokens.unshift({ 39910 type: "text", 39911 text: checkbox 39912 }); 39913 } 39914 } else { 39915 itemBody += checkbox; 39916 } 39917 } 39918 itemBody += this.parse(item.tokens, loose); 39919 body += this.renderer.listitem(itemBody, task, checked); 39920 } 39921 out += this.renderer.list(body, ordered, start); 39922 continue; 39923 } 39924 case "html": { 39925 out += this.renderer.html(token.text, token.block); 39926 continue; 39927 } 39928 case "paragraph": { 39929 out += this.renderer.paragraph(this.parseInline(token.tokens)); 39930 continue; 39931 } 39932 case "text": { 39933 body = token.tokens ? this.parseInline(token.tokens) : token.text; 39934 while (i2 + 1 < l4 && tokens2[i2 + 1].type === "text") { 39935 token = tokens2[++i2]; 39936 body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text); 39937 } 39938 out += top2 ? this.renderer.paragraph(body) : body; 39939 continue; 39940 } 39941 default: { 39942 const errMsg = 'Token with "' + token.type + '" type was not found.'; 39943 if (this.options.silent) { 39944 console.error(errMsg); 39945 return; 39946 } else { 39947 throw new Error(errMsg); 39948 } 39949 } 39950 } 39951 } 39952 return out; 39953 } 39954 /** 39955 * Parse Inline Tokens 39956 */ 39957 parseInline(tokens2, renderer) { 39958 renderer = renderer || this.renderer; 39959 let out = "", i2, token, ret; 39960 const l3 = tokens2.length; 39961 for (i2 = 0; i2 < l3; i2++) { 39962 token = tokens2[i2]; 39963 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { 39964 ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); 39965 if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) { 39966 out += ret || ""; 39967 continue; 39968 } 39969 } 39970 switch (token.type) { 39971 case "escape": { 39972 out += renderer.text(token.text); 39973 break; 39974 } 39975 case "html": { 39976 out += renderer.html(token.text); 39977 break; 39978 } 39979 case "link": { 39980 out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer)); 39981 break; 39982 } 39983 case "image": { 39984 out += renderer.image(token.href, token.title, token.text); 39985 break; 39986 } 39987 case "strong": { 39988 out += renderer.strong(this.parseInline(token.tokens, renderer)); 39989 break; 39990 } 39991 case "em": { 39992 out += renderer.em(this.parseInline(token.tokens, renderer)); 39993 break; 39994 } 39995 case "codespan": { 39996 out += renderer.codespan(token.text); 39997 break; 39998 } 39999 case "br": { 40000 out += renderer.br(); 40001 break; 40002 } 40003 case "del": { 40004 out += renderer.del(this.parseInline(token.tokens, renderer)); 40005 break; 40006 } 40007 case "text": { 40008 out += renderer.text(token.text); 40009 break; 40010 } 40011 default: { 40012 const errMsg = 'Token with "' + token.type + '" type was not found.'; 40013 if (this.options.silent) { 40014 console.error(errMsg); 40015 return; 40016 } else { 40017 throw new Error(errMsg); 40018 } 40019 } 40020 } 40021 } 40022 return out; 40023 } 40024}; 40025var Hooks = class { 40026 constructor(options2) { 40027 this.options = options2 || defaults4; 40028 } 40029 /** 40030 * Process markdown before marked 40031 */ 40032 preprocess(markdown) { 40033 return markdown; 40034 } 40035 /** 40036 * Process HTML after marked is finished 40037 */ 40038 postprocess(html2) { 40039 return html2; 40040 } 40041}; 40042__publicField(Hooks, "passThroughHooks", /* @__PURE__ */ new Set([ 40043 "preprocess", 40044 "postprocess" 40045])); 40046var _parseMarkdown, parseMarkdown_fn, _onError, onError_fn; 40047var Marked = class { 40048 constructor(...args) { 40049 __privateAdd(this, _parseMarkdown); 40050 __privateAdd(this, _onError); 40051 __publicField(this, "defaults", getDefaults()); 40052 __publicField(this, "options", this.setOptions); 40053 __publicField(this, "parse", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, Lexer.lex, Parser2.parse)); 40054 __publicField(this, "parseInline", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, Lexer.lexInline, Parser2.parseInline)); 40055 __publicField(this, "Parser", Parser2); 40056 __publicField(this, "parser", Parser2.parse); 40057 __publicField(this, "Renderer", Renderer); 40058 __publicField(this, "TextRenderer", TextRenderer); 40059 __publicField(this, "Lexer", Lexer); 40060 __publicField(this, "lexer", Lexer.lex); 40061 __publicField(this, "Tokenizer", Tokenizer); 40062 __publicField(this, "Slugger", Slugger); 40063 __publicField(this, "Hooks", Hooks); 40064 this.use(...args); 40065 } 40066 walkTokens(tokens2, callback) { 40067 let values2 = []; 40068 for (const token of tokens2) { 40069 values2 = values2.concat(callback.call(this, token)); 40070 switch (token.type) { 40071 case "table": { 40072 for (const cell of token.header) { 40073 values2 = values2.concat(this.walkTokens(cell.tokens, callback)); 40074 } 40075 for (const row of token.rows) { 40076 for (const cell of row) { 40077 values2 = values2.concat(this.walkTokens(cell.tokens, callback)); 40078 } 40079 } 40080 break; 40081 } 40082 case "list": { 40083 values2 = values2.concat(this.walkTokens(token.items, callback)); 40084 break; 40085 } 40086 default: { 40087 if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) { 40088 this.defaults.extensions.childTokens[token.type].forEach((childTokens) => { 40089 values2 = values2.concat(this.walkTokens(token[childTokens], callback)); 40090 }); 40091 } else if (token.tokens) { 40092 values2 = values2.concat(this.walkTokens(token.tokens, callback)); 40093 } 40094 } 40095 } 40096 } 40097 return values2; 40098 } 40099 use(...args) { 40100 const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} }; 40101 args.forEach((pack) => { 40102 const opts = { ...pack }; 40103 opts.async = this.defaults.async || opts.async || false; 40104 if (pack.extensions) { 40105 pack.extensions.forEach((ext) => { 40106 if (!ext.name) { 40107 throw new Error("extension name required"); 40108 } 40109 if (ext.renderer) { 40110 const prevRenderer = extensions.renderers[ext.name]; 40111 if (prevRenderer) { 40112 extensions.renderers[ext.name] = function(...args2) { 40113 let ret = ext.renderer.apply(this, args2); 40114 if (ret === false) { 40115 ret = prevRenderer.apply(this, args2); 40116 } 40117 return ret; 40118 }; 40119 } else { 40120 extensions.renderers[ext.name] = ext.renderer; 40121 } 40122 } 40123 if (ext.tokenizer) { 40124 if (!ext.level || ext.level !== "block" && ext.level !== "inline") { 40125 throw new Error("extension level must be 'block' or 'inline'"); 40126 } 40127 if (extensions[ext.level]) { 40128 extensions[ext.level].unshift(ext.tokenizer); 40129 } else { 40130 extensions[ext.level] = [ext.tokenizer]; 40131 } 40132 if (ext.start) { 40133 if (ext.level === "block") { 40134 if (extensions.startBlock) { 40135 extensions.startBlock.push(ext.start); 40136 } else { 40137 extensions.startBlock = [ext.start]; 40138 } 40139 } else if (ext.level === "inline") { 40140 if (extensions.startInline) { 40141 extensions.startInline.push(ext.start); 40142 } else { 40143 extensions.startInline = [ext.start]; 40144 } 40145 } 40146 } 40147 } 40148 if (ext.childTokens) { 40149 extensions.childTokens[ext.name] = ext.childTokens; 40150 } 40151 }); 40152 opts.extensions = extensions; 40153 } 40154 if (pack.renderer) { 40155 const renderer = this.defaults.renderer || new Renderer(this.defaults); 40156 for (const prop in pack.renderer) { 40157 const prevRenderer = renderer[prop]; 40158 renderer[prop] = (...args2) => { 40159 let ret = pack.renderer[prop].apply(renderer, args2); 40160 if (ret === false) { 40161 ret = prevRenderer.apply(renderer, args2); 40162 } 40163 return ret; 40164 }; 40165 } 40166 opts.renderer = renderer; 40167 } 40168 if (pack.tokenizer) { 40169 const tokenizer = this.defaults.tokenizer || new Tokenizer(this.defaults); 40170 for (const prop in pack.tokenizer) { 40171 const prevTokenizer = tokenizer[prop]; 40172 tokenizer[prop] = (...args2) => { 40173 let ret = pack.tokenizer[prop].apply(tokenizer, args2); 40174 if (ret === false) { 40175 ret = prevTokenizer.apply(tokenizer, args2); 40176 } 40177 return ret; 40178 }; 40179 } 40180 opts.tokenizer = tokenizer; 40181 } 40182 if (pack.hooks) { 40183 const hooks = this.defaults.hooks || new Hooks(); 40184 for (const prop in pack.hooks) { 40185 const prevHook = hooks[prop]; 40186 if (Hooks.passThroughHooks.has(prop)) { 40187 hooks[prop] = (arg) => { 40188 if (this.defaults.async) { 40189 return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2) => { 40190 return prevHook.call(hooks, ret2); 40191 }); 40192 } 40193 const ret = pack.hooks[prop].call(hooks, arg); 40194 return prevHook.call(hooks, ret); 40195 }; 40196 } else { 40197 hooks[prop] = (...args2) => { 40198 let ret = pack.hooks[prop].apply(hooks, args2); 40199 if (ret === false) { 40200 ret = prevHook.apply(hooks, args2); 40201 } 40202 return ret; 40203 }; 40204 } 40205 } 40206 opts.hooks = hooks; 40207 } 40208 if (pack.walkTokens) { 40209 const walkTokens2 = this.defaults.walkTokens; 40210 opts.walkTokens = function(token) { 40211 let values2 = []; 40212 values2.push(pack.walkTokens.call(this, token)); 40213 if (walkTokens2) { 40214 values2 = values2.concat(walkTokens2.call(this, token)); 40215 } 40216 return values2; 40217 }; 40218 } 40219 this.defaults = { ...this.defaults, ...opts }; 40220 }); 40221 return this; 40222 } 40223 setOptions(opt) { 40224 this.defaults = { ...this.defaults, ...opt }; 40225 return this; 40226 } 40227}; 40228_parseMarkdown = new WeakSet(); 40229parseMarkdown_fn = function(lexer2, parser10) { 40230 return (src, opt, callback) => { 40231 if (typeof opt === "function") { 40232 callback = opt; 40233 opt = null; 40234 } 40235 const origOpt = { ...opt }; 40236 opt = { ...this.defaults, ...origOpt }; 40237 const throwError = __privateMethod(this, _onError, onError_fn).call(this, opt.silent, opt.async, callback); 40238 if (typeof src === "undefined" || src === null) { 40239 return throwError(new Error("marked(): input parameter is undefined or null")); 40240 } 40241 if (typeof src !== "string") { 40242 return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected")); 40243 } 40244 checkDeprecations(opt, callback); 40245 if (opt.hooks) { 40246 opt.hooks.options = opt; 40247 } 40248 if (callback) { 40249 const highlight = opt.highlight; 40250 let tokens2; 40251 try { 40252 if (opt.hooks) { 40253 src = opt.hooks.preprocess(src); 40254 } 40255 tokens2 = lexer2(src, opt); 40256 } catch (e2) { 40257 return throwError(e2); 40258 } 40259 const done = (err2) => { 40260 let out; 40261 if (!err2) { 40262 try { 40263 if (opt.walkTokens) { 40264 this.walkTokens(tokens2, opt.walkTokens); 40265 } 40266 out = parser10(tokens2, opt); 40267 if (opt.hooks) { 40268 out = opt.hooks.postprocess(out); 40269 } 40270 } catch (e2) { 40271 err2 = e2; 40272 } 40273 } 40274 opt.highlight = highlight; 40275 return err2 ? throwError(err2) : callback(null, out); 40276 }; 40277 if (!highlight || highlight.length < 3) { 40278 return done(); 40279 } 40280 delete opt.highlight; 40281 if (!tokens2.length) 40282 return done(); 40283 let pending = 0; 40284 this.walkTokens(tokens2, (token) => { 40285 if (token.type === "code") { 40286 pending++; 40287 setTimeout(() => { 40288 highlight(token.text, token.lang, (err2, code) => { 40289 if (err2) { 40290 return done(err2); 40291 } 40292 if (code != null && code !== token.text) { 40293 token.text = code; 40294 token.escaped = true; 40295 } 40296 pending--; 40297 if (pending === 0) { 40298 done(); 40299 } 40300 }); 40301 }, 0); 40302 } 40303 }); 40304 if (pending === 0) { 40305 done(); 40306 } 40307 return; 40308 } 40309 if (opt.async) { 40310 return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens2) => opt.walkTokens ? Promise.all(this.walkTokens(tokens2, opt.walkTokens)).then(() => tokens2) : tokens2).then((tokens2) => parser10(tokens2, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError); 40311 } 40312 try { 40313 if (opt.hooks) { 40314 src = opt.hooks.preprocess(src); 40315 } 40316 const tokens2 = lexer2(src, opt); 40317 if (opt.walkTokens) { 40318 this.walkTokens(tokens2, opt.walkTokens); 40319 } 40320 let html2 = parser10(tokens2, opt); 40321 if (opt.hooks) { 40322 html2 = opt.hooks.postprocess(html2); 40323 } 40324 return html2; 40325 } catch (e2) { 40326 return throwError(e2); 40327 } 40328 }; 40329}; 40330_onError = new WeakSet(); 40331onError_fn = function(silent, async, callback) { 40332 return (e2) => { 40333 e2.message += "\nPlease report this to https://github.com/markedjs/marked."; 40334 if (silent) { 40335 const msg = "<p>An error occurred:</p><pre>" + escape(e2.message + "", true) + "</pre>"; 40336 if (async) { 40337 return Promise.resolve(msg); 40338 } 40339 if (callback) { 40340 callback(null, msg); 40341 return; 40342 } 40343 return msg; 40344 } 40345 if (async) { 40346 return Promise.reject(e2); 40347 } 40348 if (callback) { 40349 callback(e2); 40350 return; 40351 } 40352 throw e2; 40353 }; 40354}; 40355var markedInstance = new Marked(defaults4); 40356function marked(src, opt, callback) { 40357 return markedInstance.parse(src, opt, callback); 40358} 40359marked.options = marked.setOptions = function(opt) { 40360 markedInstance.setOptions(opt); 40361 marked.defaults = markedInstance.defaults; 40362 changeDefaults(marked.defaults); 40363 return marked; 40364}; 40365marked.getDefaults = getDefaults; 40366marked.defaults = defaults4; 40367marked.use = function(...args) { 40368 markedInstance.use(...args); 40369 marked.defaults = markedInstance.defaults; 40370 changeDefaults(marked.defaults); 40371 return marked; 40372}; 40373marked.walkTokens = function(tokens2, callback) { 40374 return markedInstance.walkTokens(tokens2, callback); 40375}; 40376marked.parseInline = markedInstance.parseInline; 40377marked.Parser = Parser2; 40378marked.parser = Parser2.parse; 40379marked.Renderer = Renderer; 40380marked.TextRenderer = TextRenderer; 40381marked.Lexer = Lexer; 40382marked.lexer = Lexer.lex; 40383marked.Tokenizer = Tokenizer; 40384marked.Slugger = Slugger; 40385marked.Hooks = Hooks; 40386marked.parse = marked; 40387var options = marked.options; 40388var setOptions = marked.setOptions; 40389var use = marked.use; 40390var walkTokens = marked.walkTokens; 40391var parseInline = marked.parseInline; 40392var parser9 = Parser2.parse; 40393var lexer = Lexer.lex; 40394
40395// src/Components/codeMirror/language-server/documentation.ts 40396init_main(); 40397var renderDocumentation = (documentation) => { 40398 if (!documentation) { 40399 documentation = "No documentation"; 40400 } 40401 const div = document.createElement("div"); 40402 div.className = "docstring"; 40403 if (MarkupContent.is(documentation) && documentation.kind === "markdown") { 40404 try { 40405 div.innerHTML = renderMarkdown(documentation.value).__html; 40406 return div; 40407 } catch (e2) { 40408 } 40409 } 40410 const fallbackContent = MarkupContent.is(documentation) ? documentation.value : documentation; 40411 const p2 = div.appendChild(document.createElement("p")); 40412 p2.appendChild(new Text(fallbackContent)); 40413 return div; 40414}; 40415import_dompurify.default.addHook("afterSanitizeAttributes", function(node) { 40416 if (node.tagName === "A") { 40417 node.setAttribute("target", "_blank"); 40418 node.setAttribute("rel", "noopener"); 40419 } 40420}); 40421var renderMarkdown = (markdown) => { 40422 const html2 = import_dompurify.default.sanitize( 40423 marked.parse(markdown, { gfm: true, headerIds: false, mangle: false }) 40424 ); 40425 return { 40426 __html: html2 40427 }; 40428}; 40429
40430// src/Components/codeMirror/language-server/hover.ts 40431function hover(lspClient, filename) { 40432 return createHoverTooltip(lspClient, filename); 40433} 40434function createHoverTooltip(client, filename) { 40435 const uri = createUri(filename); 40436 return hoverTooltip(async (view, pos, side) => { 40437 offsetToPosition(view.state.doc, pos); 40438 const params = { 40439 textDocument: { uri }, 40440 position: offsetToPosition(view.state.doc, pos) 40441 }; 40442 const result = await client.connection.sendRequest( 40443 import_vscode_languageserver_protocol3.HoverRequest.type, 40444 params 40445 ); 40446 if (result === null) 40447 return null; 40448 return { 40449 pos, 40450 above: true, 40451 create(view2) { 40452 const dom = renderDocumentation(result?.contents); 40453 return { dom }; 40454 } 40455 }; 40456 }); 40457} 40458
40459// src/Components/codeMirror/language-server/signatureHelp.ts 40460var import_vscode_languageserver_protocol4 = __toESM(require_main2()); 40461
40462// src/Components/codeMirror/language-server/names.ts 40463var removeFullyQualifiedName = (fn) => { 40464 const bracket2 = fn.indexOf("("); 40465 const before = fn.substring(0, bracket2); 40466 const remainder = fn.substring(bracket2); 40467 const parts = before.split("."); 40468 const name2 = parts[parts.length - 1]; 40469 return name2 + remainder; 40470}; 40471var nameFromSignature = (fn) => { 40472 const bracket2 = fn.indexOf("("); 40473 const before = fn.substring(0, bracket2); 40474 return before; 40475}; 40476
40477// src/Components/codeMirror/language-server/signatureHelp.ts 40478var setSignatureHelpEffect = StateEffect.define( 40479 {} 40480); 40481var signatureHelpToolTipBaseTheme = EditorView.baseTheme({ 40482 ".cm-tooltip.cm-signature-tooltip": { 40483 padding: "3px 9px", 40484 width: "max-content", 40485 maxWidth: "500px" 40486 }, 40487 ".cm-tooltip .cm-signature-activeParameter": { 40488 fontWeight: "bold" 40489 } 40490}); 40491var closeSignatureHelp = (view) => { 40492 view.dispatch({ 40493 effects: setSignatureHelpEffect.of({ 40494 pos: -1, 40495 result: null 40496 }) 40497 }); 40498 return false; 40499}; 40500var triggerSignatureHelpRequest = async (view, client, uri) => { 40501 await client.initPromise; 40502 const pos = view.state.selection.main.from; 40503 const params = { 40504 textDocument: { uri }, 40505 position: offsetToPosition(view.state.doc, pos) 40506 }; 40507 try { 40508 const result = await client.connection.sendRequest( 40509 import_vscode_languageserver_protocol4.SignatureHelpRequest.type, 40510 params 40511 ); 40512 view.dispatch({ 40513 effects: [setSignatureHelpEffect.of({ pos, result })] 40514 }); 40515 } catch (e2) { 40516 logException(view.state, e2, "signature-help"); 40517 view.dispatch({ 40518 effects: [setSignatureHelpEffect.of({ pos, result: null })] 40519 }); 40520 } 40521}; 40522function createSignatureHelpKeymap(client, filename) { 40523 const openSignatureHelp = (view) => { 40524 triggerSignatureHelpRequest(view, client, createUri(filename)); 40525 return true; 40526 }; 40527 const signatureHelpKeymap = [ 40528 // This matches VS Code. 40529 { key: "Mod-Shift-Space", run: openSignatureHelp }, 40530 { key: "Escape", run: closeSignatureHelp } 40531 ]; 40532 return signatureHelpKeymap; 40533} 40534var signatureHelpTooltipField = StateField.define({ 40535 create: () => ({ 40536 result: null, 40537 tooltip: null 40538 }), 40539 update(state, tr) { 40540 for (const effect of tr.effects) { 40541 if (effect.is(setSignatureHelpEffect)) { 40542 return reduceSignatureHelpState(state, effect.value); 40543 } 40544 } 40545 return state; 40546 }, 40547 provide: (f3) => showTooltip.from(f3, (val) => val.tooltip) 40548}); 40549var reduceSignatureHelpState = (state, effect) => { 40550 if (state.tooltip && !effect.result) { 40551 return { 40552 result: null, 40553 tooltip: null 40554 }; 40555 } 40556 if (effect.result) { 40557 const result = effect.result; 40558 return { 40559 result, 40560 tooltip: { 40561 pos: effect.pos, 40562 above: true, 40563 // This isn't great but the impact is really bad when it conflicts with autocomplete. 40564 // strictSide: true, 40565 create: () => { 40566 const dom = document.createElement("div"); 40567 dom.className = "cm-signature-tooltip"; 40568 dom.appendChild(formatSignatureHelp(result)); 40569 return { dom }; 40570 } 40571 } 40572 }; 40573 } 40574 return state; 40575}; 40576var formatSignatureHelp = (help) => { 40577 const { activeSignature: activeSignatureIndex, signatures } = help; 40578 const activeSignature = activeSignatureIndex === null ? signatures[0] : signatures[activeSignatureIndex]; 40579 const { 40580 label, 40581 parameters, 40582 documentation: signatureDoc, 40583 activeParameter: activeParameterIndex 40584 } = activeSignature; 40585 const activeParameter = activeParameterIndex !== void 0 && parameters ? parameters[activeParameterIndex] : void 0; 40586 const activeParameterLabel = activeParameter?.label; 40587 const activeParameterDoc = activeParameter?.documentation; 40588 if (typeof activeParameterLabel === "string") { 40589 throw new Error("Not supported"); 40590 } 40591 let from = label.length; 40592 let to = label.length; 40593 if (Array.isArray(activeParameterLabel)) { 40594 [from, to] = activeParameterLabel; 40595 } 40596 return formatHighlightedParameter( 40597 label, 40598 from, 40599 to, 40600 signatureDoc, 40601 activeParameterDoc 40602 ); 40603}; 40604var formatHighlightedParameter = (label, from, to, signatureDoc, activeParameterDoc) => { 40605 let before = label.substring(0, from); 40606 const id2 = nameFromSignature(before); 40607 const parameter = label.substring(from, to); 40608 const after = label.substring(to); 40609 before = removeFullyQualifiedName(before); 40610 const parent = document.createElement("div"); 40611 parent.className = "docs-spacing"; 40612 const signature = parent.appendChild(document.createElement("code")); 40613 signature.className = "cm-signature-signature"; 40614 signature.appendChild(document.createTextNode(before)); 40615 const span = signature.appendChild(document.createElement("span")); 40616 span.className = "cm-signature-activeParameter"; 40617 span.appendChild(document.createTextNode(parameter)); 40618 signature.appendChild(document.createTextNode(after)); 40619 return parent; 40620}; 40621var signatureHelp = (lspClient, filename, automatic) => { 40622 const client = lspClient; 40623 const uri = createUri(filename); 40624 class SignatureHelpView { 40625 constructor(view, automatic2) { 40626 this.view = view; 40627 this.automatic = automatic2; 40628 } 40629 update({ docChanged, selectionSet, transactions }) { 40630 if ((docChanged || selectionSet) && this.view.state.field(signatureHelpTooltipField).tooltip) { 40631 triggerSignatureHelpRequest(this.view, client, uri); 40632 } else if (this.automatic && docChanged) { 40633 const last = transactions[transactions.length - 1]; 40634 if (last.isUserEvent("input") || last.isUserEvent("dnd.drop.call")) { 40635 last.changes.iterChanges((_fromA, _toA, _fromB, _toB, inserted) => { 40636 if (inserted.sliceString(0).trim().endsWith("()")) { 40637 triggerSignatureHelpRequest(this.view, client, uri); 40638 } 40639 }); 40640 } 40641 } 40642 } 40643 } 40644 return [ 40645 // View only handles automatic triggering. 40646 ViewPlugin.define((view) => new SignatureHelpView(view, automatic)), 40647 signatureHelpTooltipField, 40648 signatureHelpToolTipBaseTheme, 40649 keymap.of(createSignatureHelpKeymap(client, filename)) 40650 ]; 40651}; 40652
40653// src/Components/codeMirror/language-server/lsp-extension.ts 40654function languageServerExtensions(lspClient, filename) { 40655 if (inferFiletype(filename) !== "python") { 40656 return []; 40657 } 40658 return [ 40659 EditorView.updateListener.of((u3) => { 40660 if (u3.docChanged) { 40661 let changeEvent = null; 40662 let nChanges = 0; 40663 u3.changes.iterChanges((fromA, toA, fromB, toB, inserted) => { 40664 if (nChanges >= 2) 40665 return; 40666 nChanges += 1; 40667 changeEvent = { 40668 range: { 40669 start: offsetToPosition(u3.startState.doc, fromA), 40670 end: offsetToPosition(u3.startState.doc, toA) 40671 }, 40672 text: inserted.sliceString(0) 40673 }; 40674 }); 40675 changeEvent = changeEvent; 40676 if (nChanges === 1) { 40677 lspClient.changeFile(filename, changeEvent); 40678 } else { 40679 lspClient.changeFile(filename, { text: u3.view.state.doc.toString() }); 40680 } 40681 } 40682 }), 40683 autocompletion2(lspClient, filename), 40684 signatureHelp(lspClient, filename, true), 40685 hover(lspClient, filename) 40686 ]; 40687} 40688
40689// src/Components/codeMirror/useTabbedCodeMirror.tsx 40690var React3 = __toESM(require_react()); 40691function useTabbedCodeMirror({ 40692 currentFilesFromApp, 40693 cmView, 40694 inferEditorExtensions, 40695 setFilesHaveChanged, 40696 lspClient, 40697 lspPathPrefix = "" 40698}) { 40699 const [files, setFiles] = React3.useState([]); 40700 const [newFileCounter, setNewFileCounter] = React3.useState(1); 40701 const [activeFileIdx, setActiveFileIdx] = React3.useState(0); 40702 const [editingFilename, setEditingFilename] = React3.useState( 40703 null 40704 ); 40705 const [focusOnEditor, setFocusOnEditor] = React3.useState(false); 40706 React3.useEffect(() => { 40707 setFiles( 40708 fileContentsToEditorFiles(currentFilesFromApp, inferEditorExtensions) 40709 ); 40710 setActiveFileIdx(0); 40711 setNewFileCounter(1); 40712 (async () => { 40713 for (const file of files) { 40714 if (file.type === "text" && inferFiletype(file.name) === "python") { 40715 await lspClient.deleteFile(lspPathPrefix + file.name); 40716 } 40717 } 40718 for (const file of currentFilesFromApp) { 40719 if (file.type === "text" && inferFiletype(file.name) === "python") { 40720 await lspClient.createFile(lspPathPrefix + file.name, file.content); 40721 } 40722 } 40723 })(); 40724 }, [ 40725 // Note that the linter thinks we need to depend on `files`, but we don't -- 40726 // if we did, this would result in an infinite loop. We only want to remove 40727 // `files` if `currentFilesFromApp` changes. 40728 lspClient, 40729 lspPathPrefix, 40730 currentFilesFromApp, 40731 inferEditorExtensions 40732 ]); 40733 function closeFile(e2, index) { 40734 e2.stopPropagation(); 40735 const updatedFiles = [...files]; 40736 const filename = updatedFiles[index].name; 40737 updatedFiles.splice(index, 1); 40738 setFiles(updatedFiles); 40739 if (activeFileIdx > updatedFiles.length - 1) { 40740 setActiveFileIdx(updatedFiles.length - 1); 40741 } 40742 setFilesHaveChanged(true); 40743 lspClient.deleteFile(lspPathPrefix + filename); 40744 } 40745 function addFile() { 40746 const fileContent = { 40747 name: `file${newFileCounter}.py`, 40748 type: "text", 40749 content: "" 40750 }; 40751 const newFile = fileContentToEditorFile( 40752 fileContent, 40753 inferEditorExtensions 40754 ); 40755 setEditingFilename(newFile.name); 40756 setNewFileCounter(newFileCounter + 1); 40757 setFiles([...files, newFile]); 40758 setActiveFileIdx(files.length); 40759 setFilesHaveChanged(true); 40760 setFocusOnEditor(false); 40761 lspClient.createFile(lspPathPrefix + fileContent.name, fileContent.content); 40762 } 40763 const uploadFile = React3.useCallback(async () => { 40764 assertHasFileAccessApiSupport(); 40765 const [fileHandle] = await window.showOpenFilePicker(); 40766 const fileContent = await loadFileContent(fileHandle); 40767 const newFile = fileContentToEditorFile( 40768 fileContent, 40769 inferEditorExtensions 40770 ); 40771 const updatedFiles = [...files]; 40772 const filenameMatchIdx = updatedFiles.findIndex( 40773 (f3) => f3.name === newFile.name 40774 ); 40775 if (filenameMatchIdx === -1) { 40776 updatedFiles.push(newFile); 40777 setActiveFileIdx(updatedFiles.length - 1); 40778 } else { 40779 updatedFiles[filenameMatchIdx] = newFile; 40780 setActiveFileIdx(filenameMatchIdx); 40781 } 40782 setFiles(updatedFiles); 40783 setFilesHaveChanged(true); 40784 }, [files, inferEditorExtensions, setFilesHaveChanged]); 40785 function renameFile(oldFileName, newFileName) { 40786 const updatedFiles = [...files]; 40787 const fileIndex = updatedFiles.findIndex((f3) => f3.name === oldFileName); 40788 updatedFiles[fileIndex].name = newFileName; 40789 if (cmView) { 40790 cmView.dispatch({ 40791 effects: StateEffect.reconfigure.of(getMinimalExtensions()) 40792 }); 40793 cmView.dispatch({ 40794 effects: StateEffect.reconfigure.of( 40795 inferEditorExtensions(updatedFiles[fileIndex]) 40796 ) 40797 }); 40798 } 40799 syncActiveFileState(); 40800 setFiles(updatedFiles); 40801 setEditingFilename(null); 40802 setFilesHaveChanged(true); 40803 (async () => { 40804 if (inferFiletype(oldFileName) === "python") { 40805 await lspClient.deleteFile(lspPathPrefix + oldFileName); 40806 } 40807 if (inferFiletype(newFileName) === "python") { 40808 await lspClient.createFile( 40809 lspPathPrefix + newFileName, 40810 updatedFiles[fileIndex].ref.editorState.doc.toString() 40811 ); 40812 } 40813 })(); 40814 } 40815 function selectFile(fileName) { 40816 const fileIndex = files.findIndex((f3) => f3.name === fileName); 40817 if (activeFileIdx === fileIndex) { 40818 setEditingFilename(fileName); 40819 } else {
40820 setActiveFileIdx(fileIndex); 40821 } 40822 } 40823 function enterNameEditMode(name2) { 40824 if (name2 === null) { 40825 setEditingFilename(null); 40826 return; 40827 } 40828 setEditingFilename(name2); 40829 } 40830 const activeFile = files[activeFileIdx]; 40831 const syncActiveFileState = React3.useCallback(() => { 40832 if (!cmView) 40833 return; 40834 activeFile.ref.editorState = cmView.state; 40835 activeFile.ref.scrollTop = cmView.scrollDOM.scrollTop; 40836 activeFile.ref.scrollLeft = cmView.scrollDOM.scrollLeft; 40837 }, [activeFile, cmView]); 40838 return { 40839 files, 40840 setFiles, 40841 activeFile, 40842 syncActiveFileState, 40843 editingFilename, 40844 focusOnEditor, 40845 setFocusOnEditor, 40846 addFile, 40847 uploadFile, 40848 renameFile, 40849 closeFile, 40850 selectFile, 40851 enterNameEditMode 40852 }; 40853} 40854
40855// src/Components/codeMirror/utils.ts 40856function offsetToPosition2(cmDoc, offset) { 40857 const line = cmDoc.lineAt(offset); 40858 return { line: line.number, col: offset - line.from }; 40859} 40860function positionToOffset2(cmDoc, pos) { 40861 const line = cmDoc.line(pos.line); 40862 const newOffset = Math.min(line.from + pos.col, line.to); 40863 if (newOffset > cmDoc.length) { 40864 return cmDoc.length; 40865 } 40866 return newOffset; 40867} 40868function getSelectedText(cmView) { 40869 const cmState = cmView.state; 40870 return cmState.sliceDoc( 40871 cmState.selection.main.from, 40872 cmState.selection.main.to 40873 ); 40874} 40875function getCurrentLineText(cmView) { 40876 const cmState = cmView.state; 40877 const offset = cmState.selection.main.head; 40878 const pos = offsetToPosition2(cmState.doc, offset); 40879 const lineText = cmState.doc.line(pos.line).text; 40880 return lineText; 40881} 40882function moveCursorToNextLine(cmView) { 40883 const cmState = cmView.state; 40884 const offset = cmState.selection.main.head; 40885 const pos = offsetToPosition2(cmState.doc, offset); 40886 pos.line += 1; 40887 if (pos.line > cmState.doc.lines) { 40888 return; 40889 } 40890 const nextLineOffset = positionToOffset2(cmState.doc, pos); 40891 cmView.dispatch({ selection: { anchor: nextLineOffset } }); 40892} 40893
40894// src/Components/Editor.tsx 40895var import_jsx_runtime3 = __toESM(require_jsx_runtime()); 40896var UPDATE_URL_SIZE_THRESHOLD = 25e4; 40897function Editor({ 40898 currentFilesFromApp, 40899 setCurrentFiles, 40900 setFilesHaveChanged, 40901 setHeaderBarCallbacks, 40902 setEditorMethods, 40903 terminalMethods, 40904 viewerMethods = null, 40905 utilityMethods = null, 40906 showFileTabs = true, 40907 runOnLoad = true, 40908 lineNumbers: lineNumbers2 = true, 40909 showHeaderBar = true, 40910 floatingButtons = false, 40911 updateUrlHashOnRerun = false, 40912 appEngine, 40913 style 40914}) { 40915 const lspClient = appEngine === "python" ? ensurePyrightClient() : ensureNullClient(); 40916 const editorInstanceId = useInstanceCounter(); 40917 const lspPathPrefix = `editor${editorInstanceId}/`; 40918 const [filesHaveChangedSinceLastRun, setFilesHaveChangedSinceLastRun] = React4.useState(false); 40919 const setFilesHaveChangedCombined = React4.useCallback( 40920 (value) => { 40921 setFilesHaveChanged(value); 40922 setFilesHaveChangedSinceLastRun(value); 40923 }, 40924 [setFilesHaveChanged, setFilesHaveChangedSinceLastRun] 40925 ); 40926 const [hasShownUrlTooLargeMessage, setHasShownUrlTooLargeMessage] = React4.useState(false); 40927 const inferEditorExtensions = React4.useCallback( 40928 (file) => { 40929 if (file.type === "binary") { 40930 return getBinaryFileExtensions(); 40931 } 40932 const language2 = inferFiletype(file.name); 40933 const indentSpaces = language2 === "r" ? 2 : 4; 40934 return [ 40935 getExtensions({ lineNumbers: lineNumbers2, indentSpaces }), 40936 getLanguageExtension(language2), 40937 EditorView.updateListener.of((u3) => { 40938 if (u3.docChanged) { 40939 setFilesHaveChangedCombined(true); 40940 } 40941 }), 40942 languageServerExtensions(lspClient, lspPathPrefix + file.name), 40943 Prec.high( 40944 keymap.of( 40945 keyBindings({ 40946 runSelectedTextOrCurrentLine, 40947 runAllAuto, 40948 appEngine 40949 }) 40950 ) 40951 ) 40952 ]; 40953 }, 40954 [ 40955 lineNumbers2, 40956 appEngine, 40957 setFilesHaveChangedCombined, 40958 lspClient, 40959 lspPathPrefix 40960 ] 40961 ); 40962 const [cmView, setCmView] = React4.useState(); 40963 const tabbedFiles = useTabbedCodeMirror({ 40964 currentFilesFromApp, 40965 cmView, 40966 inferEditorExtensions, 40967 setFilesHaveChanged: setFilesHaveChangedCombined, 40968 lspClient, 40969 lspPathPrefix 40970 }); 40971 const { files, activeFile, syncActiveFileState, focusOnEditor } = tabbedFiles; 40972 const [isShinyApp, setIsShinyApp] = React4.useState(false); 40973 React4.useEffect(() => { 40974 setIsShinyApp( 40975 files.some( 40976 (f3) => f3.name === "app.py" || f3.name === "app.R" || f3.name === "server.R" 40977 ) 40978 ); 40979 }, [files]); 40980 const runCodeInTerminal = React4.useCallback( 40981 (command2) => { 40982 if (!terminalMethods.ready) 40983 return; 40984 terminalMethods.runCodeInTerminal(command2); 40985 }, 40986 [terminalMethods] 40987 ); 40988 const runAllApp = React4.useCallback(() => { 40989 if (!viewerMethods || !viewerMethods.ready) 40990 return; 40991 syncActiveFileState(); 40992 const fileContents = editorFilesToFileContents(files); 40993 if (updateUrlHashOnRerun && filesHaveChangedSinceLastRun) { 40994 const filesSize = fileContentsSize(fileContents); 40995 if (!hasShownUrlTooLargeMessage && filesSize > UPDATE_URL_SIZE_THRESHOLD) { 40996 _t( 40997 "Auto-updating the app link is disabled because the app is very large. If you want the sharing URL, click the Share button." 40998 ); 40999 setHasShownUrlTooLargeMessage(true); 41000 } else { 41001 updateBrowserUrlHash(fileContents); 41002 } 41003 } 41004 setFilesHaveChangedCombined(false); 41005 (async () => { 41006 await viewerMethods.stopApp(); 41007 await viewerMethods.runApp(fileContents); 41008 })(); 41009 }, [ 41010 viewerMethods, 41011 syncActiveFileState, 41012 updateUrlHashOnRerun, 41013 filesHaveChangedSinceLastRun, 41014 setFilesHaveChangedCombined, 41015 hasShownUrlTooLargeMessage, 41016 setHasShownUrlTooLargeMessage, 41017 files 41018 ]); 41019 const runAllCode = React4.useCallback(() => { 41020 if (!cmView) 41021 return; 41022 syncActiveFileState(); 41023 runCodeInTerminal(cmView.state.doc.toString()); 41024 }, [runCodeInTerminal, syncActiveFileState, cmView]); 41025 React4.useEffect(() => { 41026 if (!viewerMethods || !viewerMethods.ready) 41027 return; 41028 setFilesHaveChanged(false); 41029 (async () => { 41030 await viewerMethods.stopApp(); 41031 currentFilesFromApp.map((file) => { 41032 if (file.type === "text" && inferFiletype(file.name) === "python") { 41033 lspClient.createFile(lspPathPrefix + file.name, file.content); 41034 } 41035 }); 41036 if (!runOnLoad) 41037 return; 41038 const isShinyCode = currentFilesFromApp.some( 41039 (f3) => f3.name === "app.py" || f3.name === "app.R" || f3.name === "server.R" 41040 ); 41041 if (isShinyCode) { 41042 await viewerMethods.runApp(currentFilesFromApp); 41043 } 41044 })(); 41045 }, [ 41046 runOnLoad, 41047 currentFilesFromApp, 41048 viewerMethods, 41049 setFilesHaveChanged, 41050 lspClient, 41051 lspPathPrefix 41052 ]); 41053 React4.useEffect(() => { 41054 if (!runOnLoad) 41055 return; 41056 if (!terminalMethods.ready) 41057 return; 41058 (async () => { 41059 const isShinyCode = currentFilesFromApp.some( 41060 (f3) => f3.name === "app.py" || f3.name === "app.R" || f3.name === "server.R" 41061 ); 41062 if (!isShinyCode) { 41063 if (currentFilesFromApp[0].type === "text") { 41064 runCodeInTerminal(currentFilesFromApp[0].content); 41065 } 41066 } 41067 })(); 41068 }, [runOnLoad, currentFilesFromApp, terminalMethods, runCodeInTerminal]); 41069 React4.useEffect(() => { 41070 setEditorMethods({ 41071 getActiveFileContents: () => { 41072 syncActiveFileState(); 41073 return editorFilesToFileContents(files); 41074 } 41075 }); 41076 }, [syncActiveFileState, setEditorMethods, files]); 41077 const cmDivRef = React4.useRef(null); 41078 React4.useEffect(() => { 41079 if (!cmDivRef.current) {
41080 throw new Error("Target div ref for CodeMirror is null."); 41081 } 41082 const cmViewLocal = new EditorView({ 41083 parent: cmDivRef.current 41084 }); 41085 setCmView(cmViewLocal); 41086 return function cleanup() { 41087 cmViewLocal.destroy(); 41088 }; 41089 }, []); 41090 React4.useEffect(() => { 41091 if (!cmView || files.length === 0) 41092 return; 41093 cmView.setState(activeFile.ref.editorState); 41094 cmView.scrollDOM.scrollTop = activeFile.ref.scrollTop ?? 0; 41095 cmView.scrollDOM.scrollLeft = activeFile.ref.scrollLeft ?? 0; 41096 if (focusOnEditor) { 41097 cmView.focus(); 41098 } 41099 return function cleanup() { 41100 syncActiveFileState(); 41101 }; 41102 }, [files, syncActiveFileState, activeFile, focusOnEditor, cmView]); 41103 const runSelectedTextOrCurrentLine = React4.useRef(() => { 41104 }); 41105 React4.useEffect(() => { 41106 runSelectedTextOrCurrentLine.current = () => { 41107 if (!cmView) 41108 return; 41109 let code = getSelectedText(cmView); 41110 if (code == "") { 41111 code = getCurrentLineText(cmView); 41112 moveCursorToNextLine(cmView); 41113 } 41114 runCodeInTerminal(code); 41115 }; 41116 }, [runCodeInTerminal, cmView]); 41117 const runAllAuto = React4.useRef(() => { 41118 }); 41119 React4.useEffect(() => { 41120 runAllAuto.current = () => { 41121 if (isShinyApp) { 41122 runAllApp(); 41123 } else { 41124 runAllCode(); 41125 } 41126 }; 41127 }, [isShinyApp, runAllCode, runAllApp]); 41128 const diagnosticsListener = React4.useCallback( 41129 (params) => { 41130 if (!cmView) 41131 return; 41132 syncActiveFileState(); 41133 files.map((file) => { 41134 if (createUri(lspPathPrefix + file.name) !== params.uri) 41135 return; 41136 const transaction = diagnosticToTransaction( 41137 file.ref.editorState, 41138 params.diagnostics.filter(diagnosticFilter) 41139 ); 41140 if (cmView.state === file.ref.editorState) { 41141 cmView.dispatch(transaction); 41142 } 41143 file.ref.editorState = transaction.state; 41144 }); 41145 }, 41146 [files, lspPathPrefix, syncActiveFileState, cmView] 41147 ); 41148 React4.useEffect(() => { 41149 lspClient.on("diagnostics", diagnosticsListener); 41150 return function cleanup() { 41151 lspClient.off("diagnostics", diagnosticsListener); 41152 }; 41153 }, [lspClient, diagnosticsListener]); 41154 const [localDirHandle, setLocalDirHandle] = React4.useState(null); 41155 const loadLocalFiles = React4.useCallback(async () => { 41156 assertHasFileAccessApiSupport(); 41157 const confirmMessage = "Load files from disk? This will close all open files and load all the files from a directory on disk."; 41158 if (!window.confirm(confirmMessage)) 41159 return; 41160 const dirHandle = await window.showDirectoryPicker(); 41161 const localFiles = await loadDirectoryRecursive(dirHandle);
41162 setLocalDirHandle(dirHandle); 41163 setCurrentFiles(localFiles); 41164 }, [setCurrentFiles]); 41165 const saveLocalFiles = React4.useCallback(async () => { 41166 assertHasFileAccessApiSupport(); 41167 const confirmMessage = "Save project files to disk? This will save all files from the editor to a directory on disk."; 41168 if (!window.confirm(confirmMessage)) 41169 return; 41170 let dirHandle; 41171 if (localDirHandle) { 41172 dirHandle = localDirHandle; 41173 } else { 41174 dirHandle = await window.showDirectoryPicker(); 41175 setLocalDirHandle(dirHandle); 41176 } 41177 syncActiveFileState(); 41178 const fileContents = editorFilesToFileContents(files); 41179 await saveFileContentsToDirectory(fileContents, dirHandle); 41180 }, [files, syncActiveFileState, localDirHandle]); 41181 const downloadFiles = React4.useCallback(async () => { 41182 if (!window.confirm("Downlad all project files?")) 41183 return; 41184 syncActiveFileState(); 41185 const fileContents = editorFilesToFileContents(files); 41186 if (fileContents.length == 1) { 41187 const file = fileContents[0]; 41188 await downloadFile( 41189 file.name, 41190 file.content, 41191 file.type === "text" ? "text/plain" : "application/octet-stream" 41192 ); 41193 } else { 41194 const zippableContents = editorFilesToFflateZippable(files); 41195 const zipBuffer = zipSync(zippableContents); 41196 await downloadFile("app.zip", zipBuffer, "application/zip"); 41197 } 41198 }, [files, syncActiveFileState]); 41199 const openEditorWindow = React4.useCallback(async () => { 41200 syncActiveFileState(); 41201 const fileContents = editorFilesToFileContents(files); 41202 window.open( 41203 editorUrlPrefix(appEngine) + "#code=" + fileContentsToUrlString(fileContents), 41204 "_blank" 41205 ); 41206 }, [files, syncActiveFileState]); 41207 const [shareModalVisible, setShareModalVisible] = React4.useState(false); 41208 const showShareModal = React4.useCallback(() => { 41209 syncActiveFileState(); 41210 setShareModalVisible(true); 41211 }, [syncActiveFileState]); 41212 let shareModal = null; 41213 if (shareModalVisible) { 41214 shareModal = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 41215 ShareModal, 41216 { 41217 fileContents: editorFilesToFileContents(files), 41218 setShareModalVisible, 41219 appEngine 41220 } 41221 ); 41222 } 41223 React4.useEffect(() => { 41224 setHeaderBarCallbacks({ 41225 loadLocalFiles, 41226 saveLocalFiles, 41227 downloadFiles, 41228 showShareModal, 41229 openEditorWindow 41230 }); 41231 }, [ 41232 downloadFiles, 41233 loadLocalFiles, 41234 openEditorWindow, 41235 saveLocalFiles, 41236 setHeaderBarCallbacks, 41237 showShareModal 41238 ]);
41239 const formatCodeButton = appEngine === "python" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 41240 "button", 41241 { 41242 className: "code-run-button", 41243 "aria-label": "Reformat code", 41244 "data-balloon-pos": "down", 41245 onClick: () => formatCode(), 41246 children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { icon: "code" }) 41247 } 41248 ) : null; 41249 const formatCode = React4.useCallback(async () => { 41250 if (!cmView) 41251 return; 41252 if (!utilityMethods) 41253 return; 41254 syncActiveFileState(); 41255 if (activeFile.type !== "text") 41256 return; 41257 const content2 = editorFileToFileContent(activeFile).content; 41258 const formatted = await utilityMethods.formatCode(content2); 41259 const cursorPos = Math.min( 41260 formatted.length, 41261 cmView.state.selection.main.anchor 41262 ); 41263 const transaction = cmView.state.update({ 41264 changes: { 41265 from: 0, 41266 to: cmView.state.doc.length, 41267 insert: formatted 41268 }, 41269 selection: { anchor: cursorPos } 41270 }); 41271 cmView.dispatch(transaction); 41272 }, [utilityMethods, syncActiveFileState, activeFile, cmView]); 41273 const runButton = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 41274 "button", 41275 { 41276 className: "code-run-button", 41277 "aria-label": `Re-run ${isShinyApp ? "app" : "code"} (${modKeySymbol()}-Shift-Enter)`, 41278 "data-balloon-pos": "down", 41279 onClick: () => runAllAuto.current(), 41280 children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { icon: "play" }) 41281 } 41282 ); 41283 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "shinylive-editor", style, children: [ 41284 shareModal,
41285 showHeaderBar ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "editor-header", children: [ 41286 showFileTabs ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FileTabs, { ...tabbedFiles }) : null, 41287 /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "editor-actions", children: [ 41288 formatCodeButton, 41289 runButton 41290 ] }) 41291 ] }) : null, 41292 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "editor-container", ref: cmDivRef }), 41293 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 41294 Ie, 41295 { 41296 toastOptions: { 41297 duration: 5e3, 41298 position: "top-center", 41299 style: { fontFamily: "var(--font-face)" } 41300 } 41301 } 41302 ), 41303 floatingButtons ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "floating-buttons", children: runButton }) : null 41304 ] }); 41305} 41306function fileContentsToEditorFiles(files, inferEditorExtensions) { 41307 return files.map((f3) => fileContentToEditorFile(f3, inferEditorExtensions)); 41308} 41309function fileContentToEditorFile(file, inferEditorExtensions) { 41310 if (file.type === "binary") { 41311 const content2 = file.content; 41312 return { 41313 name: file.name, 41314 type: file.type, 41315 content: content2, 41316 ref: { 41317 editorState: EditorState.create({ 41318 extensions: inferEditorExtensions(file), 41319 doc: `<< ${content2.length} bytes of binary data >>` 41320 }) 41321 } 41322 }; 41323 } else { 41324 return { 41325 name: file.name, 41326 type: file.type, 41327 ref: { 41328 editorState: EditorState.create({ 41329 extensions: inferEditorExtensions(file), 41330 doc: file.content 41331 }) 41332 } 41333 }; 41334 } 41335} 41336function editorFilesToFileContents(files) { 41337 return files.map(editorFileToFileContent); 41338} 41339function editorFileToFileContent(file) { 41340 if (file.type === "binary") { 41341 return { 41342 name: file.name, 41343 type: file.type, 41344 content: file.content 41345 }; 41346 } else { 41347 return { 41348 name: file.name, 41349 type: file.type, 41350 content: file.ref.editorState.doc.toString() 41351 }; 41352 } 41353} 41354function editorFilesToFflateZippable(files) { 41355 const res = {}; 41356 for (const file of files) { 41357 if (file.type === "binary") { 41358 res[file.name] = file.content; 41359 } else { 41360 res[file.name] = stringToUint8Array(file.ref.editorState.doc.toString()); 41361 } 41362 } 41363 return res; 41364} 41365function fileContentsSize(files) { 41366 let size = 0; 41367 for (const file of files) { 41368 if (file.type === "binary") { 41369 size += file.content.length; 41370 } else { 41371 size += file.content.length; 41372 } 41373 } 41374 return size; 41375} 41376function diagnosticFilter(diagnostic) { 41377 if (diagnostic.severity === 4 && /is not accessed$/.test(diagnostic.message)) { 41378 return false; 41379 } 41380 return true; 41381} 41382var instanceCount = 0; 41383function useInstanceCounter() { 41384 const [id2] = React4.useState(instanceCount); 41385 React4.useEffect(() => { 41386 instanceCount += 1; 41387 return () => { 41388 instanceCount -= 1; 41389 }; 41390 }, []); 41391 return id2; 41392} 41393function keyBindings({ 41394 runSelectedTextOrCurrentLine, 41395 runAllAuto, 41396 appEngine 41397}) { 41398 const bindings = [ 41399 { 41400 key: "Mod-Enter", 41401 run: (view) => { 41402 if (!runSelectedTextOrCurrentLine.current) 41403 return false; 41404 runSelectedTextOrCurrentLine.current(); 41405 return true; 41406 } 41407 }, 41408 { 41409 key: "Mod-Shift-Enter", 41410 run: (view) => { 41411 if (!runAllAuto.current) 41412 return false; 41413 runAllAuto.current(); 41414 return true; 41415 } 41416 } 41417 ]; 41418 if (appEngine === "r") { 41419 const maybeAddWhiteSpace = (view, range, text) => { 41420 const line = view.state.doc.lineAt(range.head); 41421 const before = view.state.doc.sliceString(line.from, range.from); 41422 const after = view.state.doc.sliceString(range.to, line.to); 41423 if (!before.endsWith(" ") && !before.endsWith("\n")) { 41424 text = " " + text; 41425 } 41426 if (!after.startsWith(" ") && !after.startsWith("\n")) { 41427 text = text + " "; 41428 } 41429 return text; 41430 }; 41431 const insertText = (view, text) => { 41432 const result = view.state.changeByRange((range) => { 41433 const adjustedText = maybeAddWhiteSpace(view, range, text); 41434 const cursorPosAfter = Math.min(range.from, range.to) + adjustedText.length; 41435 return { 41436 range: EditorSelection.range(cursorPosAfter, cursorPosAfter), 41437 changes: { from: range.from, to: range.to, insert: adjustedText } 41438 }; 41439 }); 41440 view.dispatch(result); 41441 return true; 41442 }; 41443 bindings.push({ 41444 key: "Alt--", 41445 run: (view) => insertText(view, "<-") 41446 }); 41447 bindings.push({
41448 key: "Mod-Shift-m", 41449 run: (view) => insertText(view, "|>") 41450 }); 41451 } 41452 return bindings; 41453} 41454async function updateBrowserUrlHash(fileContents) { 41455 const encodedFileContents = await fileContentsToUrlStringInWebWorker(fileContents); 41456 const hash4 = "#code=" + encodedFileContents; 41457 history.replaceState(null, "", hash4); 41458} 41459export { 41460 Editor as default, 41461 editorFileToFileContent, 41462 editorFilesToFileContents, 41463 fileContentToEditorFile, 41464 fileContentsToEditorFiles 41465}; 41466/*! Bundled license information: 41467 41468dompurify/dist/purify.js: 41469 (*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE *) 41470*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.