{"version":3,"sources":["node_modules/@codemirror/commands/dist/index.js","node_modules/@codemirror/theme-one-dark/dist/index.js","node_modules/crelt/index.js","node_modules/@codemirror/search/dist/index.js","node_modules/@codemirror/lint/dist/index.js","node_modules/codemirror/dist/index.js","node_modules/@acrodata/code-editor/fesm2022/acrodata-code-editor.mjs","src/app/core/security/auth.guard.ts","src/app/shared/generated/Models/PatientDataVm.ts","src/app/fulfillment/services/rx-data-storage.service.ts","node_modules/@ngneat/until-destroy/fesm2022/ngneat-until-destroy.mjs","src/app/inventory/services/ai-dicts.ts","src/app/inventory/services/inventory.service.ts","src/app/inventory/scan-rx/scan-rx.component.ts","src/app/inventory/scan-rx/scan-rx.component.html","src/app/fulfillment/inv-choice-modal/inv-choice-modal.component.ts","src/app/fulfillment/inv-choice-modal/inv-choice-modal.component.html","src/app/fulfillment/shipment-list-rx-modal/shipment-list-rx-modal.component.ts","src/app/fulfillment/shipment-list-rx-modal/shipment-list-rx-modal.component.html","src/app/shared/fa-num-icon/fa-icon-name/fa-icon-name.ts","src/app/shared/fa-num-icon/fa-icon-position/fa-icon-position.ts","src/app/shared/fa-num-icon/fa-num-color/fa-num-color.enum.ts","src/app/services/global-variables.service.ts","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/edit-rx-fulfillment.component.ts","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/edit-rx-fulfillment.component.html","src/app/shared/generated/Inventory/Models/Shipping/ShipmentCommentVm.ts","src/app/shared/generated/Models/GenericCommentVm.ts","src/app/shared/conversations/conversations.component.ts","src/app/shared/conversations/conversations.component.html","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/helpers/comments-modal/comments-modal.component.ts","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/helpers/comments-modal/comments-modal.component.html","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/helpers/patient-phi-card/patient-phi-card.component.ts","src/app/inventory/rx-fulfillment/edit-rx-fulfillment/helpers/patient-phi-card/patient-phi-card.component.html","node_modules/date-fns/addWeeks.mjs","node_modules/date-fns/subWeeks.mjs","src/app/shared/generated/Inventory/Models/Shipping/ShipmentListVm.ts","src/app/shared/fa-num-icon/fa-count/fa-count.component.ts","src/app/shared/fa-num-icon/fa-count/fa-count.component.html","src/app/shared/fa-num-icon/fa-num-icon.component.ts","src/app/shared/fa-num-icon/fa-num-icon.component.html","src/app/inventory/rx-fulfillment/shipment-list/shipment-list.component.ts","src/app/inventory/rx-fulfillment/shipment-list/shipment-list.component.html","src/app/shared/scan-product/scan-product.component.ts","src/app/shared/scan-product/scan-product.component.html","src/app/shared/generated/Models/AuditHistoryVm.ts","src/app/shared/audit-history/audit-history.component.ts","src/app/shared/audit-history/audit-history.component.html","src/app/core/enums/generated/VerificationTypeEnum.ts","src/app/shared/generated/Administration/Models/VerificationSettingVm.ts","src/app/shared/generated/Administration/Models/VerificationVm.ts","src/app/shared/authentication/verification-settings/verification-settings.component.ts","src/app/shared/authentication/verification-settings/verification-settings.component.html","node_modules/@pixelverse/strichjs-sdk/dist/strich.js","src/environments/environment.prod.ts","src/app/shared/barcode-scanner-strich/barcode-scanner-strich.component.ts","src/app/shared/barcode-scanner-strich/barcode-scanner-strich.component.html","src/app/core/sendgrid-api/sendgrid-api.service.ts","src/app/shared/bounce-alert/bounce-alert.component.ts","src/app/shared/bounce-alert/bounce-alert.component.html","src/app/shared/ci-workstation/ci-workstation.component.ts","src/app/shared/ci-workstation/ci-workstation.component.html","src/app/shared/generated/Models/GenericOrder/GenericOrderCommentVm.ts","src/app/shared/generated/MetabolicFormula/Models/MetabolicFormulaPatientInfoVm.ts","src/app/shared/generated/MetabolicFormula/Models/MetabolicFormulaPatientCareVm.ts","src/app/shared/generated/MetabolicFormula/Models/MetabolicFormulaInsuranceInfoVm.ts","src/app/shared/generated/Models/GenericOrder/GenericOrderDetailsVm.ts","src/app/shared/generated/CIRepack/Models/CiRepackOrder/CiOrderInfoVm.ts","src/app/shared/comments-modal/comments-modal.component.ts","src/app/shared/comments-modal/comments-modal.component.html","src/app/shared/generated/Administration/Models/Facilities/EditFacilityVm.ts","src/app/shared/generated/Administration/Models/Facilities/FacilityCardinalAccountVm.ts","src/app/shared/facilities/facility-cardinal-accounts/facility-cardinal-accounts.component.ts","src/app/shared/facilities/facility-cardinal-accounts/facility-cardinal-accounts.component.html","src/app/shared/facilities/facility-audit-history/facility-audit-history.component.ts","src/app/shared/facilities/facility-audit-history/facility-audit-history.component.html","src/app/shared/generated/Administration/Models/Facilities/FacilityUserListVm.ts","src/app/shared/generated/Administration/Models/Users/EditUserVm.ts","src/app/shared/facilities/facility-user-list/facility-user-list.component.ts","src/app/shared/facilities/facility-user-list/facility-user-list.component.html","src/app/shared/generated/Administration/Models/Facilities/BusinessAreas/EditFacilityCiDetailVm.ts","src/app/shared/generated/Administration/Models/Facilities/BusinessAreas/EditFacilityInventoryDetailVm.ts","src/app/shared/generated/Administration/Models/Facilities/BusinessAreas/FacilityBusinessAreaVm.ts","src/app/shared/facilities/facility-business-areas/ci-business-area/ci-business-area.component.ts","src/app/shared/facilities/facility-business-areas/ci-business-area/ci-business-area.component.html","src/app/shared/facilities/facility-business-areas/inventory-business-area/inventory-business-area.component.ts","src/app/shared/facilities/facility-business-areas/inventory-business-area/inventory-business-area.component.html","src/app/shared/facilities/facility-business-areas/metabolic-business-area/metabolic-business-area.component.ts","src/app/shared/facilities/facility-business-areas/facilty-business-areas.component.ts","src/app/shared/facilities/facility-business-areas/facilty-business-areas.component.html","src/app/shared/facilities/edit-facility/edit-facility.component.ts","src/app/shared/facilities/edit-facility/edit-facility.component.html","src/app/shared/generated/Administration/Models/Facilities/FacilityListVm.ts","src/app/shared/facilities/facilities-list/facilities-list.component.ts","src/app/shared/facilities/facilities-list/facilities-list.component.html","src/app/heros/applicants/edit-applicant/edit-applicant-helpers/photo-modal/photo-modal.component.ts","src/app/heros/applicants/edit-applicant/edit-applicant-helpers/photo-modal/photo-modal.component.html","src/app/shared/image-slider/image-slider/image-slider.component.ts","src/app/shared/image-slider/image-slider/image-slider.component.html","src/app/shared/image-slider/image-slider.module.ts","src/app/shared/generated/Administration/Models/Organizations/OrganizationAccountRequestVm.ts","src/app/shared/navigation/notification-nav/notification-nav.component.ts","src/app/shared/navigation/notification-nav/notification-nav.component.html","src/app/shared/navigation/nav-notification.service.ts","src/app/shared/organizations/organization-account-update/organization-account-update.component.ts","src/app/shared/organizations/organization-account-update/organization-account-update.component.html","src/app/ci-repack/ci-dashboard/ci-dashboard-service.service.ts","src/app/shared/navigation/ci-dashboard-actions/ci-dashboard-actions.component.ts","src/app/shared/navigation/ci-dashboard-actions/ci-dashboard-actions.component.html","src/app/shared/navigation/organization-account-update-nav/organization-account-update-nav.component.ts","src/app/shared/navigation/organization-account-update-nav/organization-account-update-nav.component.html","src/app/shared/fa-business-area-icons/fa-business-area-icons.service.ts","src/app/core/nav-areas/admin-nav.ts","src/app/core/nav-areas/ba-nav.ts","src/app/core/nav-areas/ci-repack-nav.ts","src/app/core/nav-areas/error-report-nav.ts","src/app/core/nav-areas/help-desk-nav.ts","src/app/core/nav-areas/heros-nav.ts","src/app/core/nav-areas/icq-nav.ts","src/app/core/nav-areas/inv-nav.ts","src/app/core/nav-areas/inventory-nav.ts","src/app/core/nav-areas/metabolic-formula-nav.ts","src/app/core/nav-areas/ndc-directory-nav.ts","src/app/core/nav-areas/pcg-nav.ts","src/app/core/nav-areas/pharmacy-inventory-nav.ts","src/app/core/nav-areas/pharmacy-nav.ts","src/app/core/nav-areas/reporting-nav.ts","src/app/core/nav-areas/rxconnects-nav.ts","src/app/core/main-nav-routes.ts","src/app/shared/navigation/navigation.service.ts","src/app/core/sse-notification/sse-notification.service.ts","src/app/shared/navigation/top-click-nav/top-click-nav.component.ts","src/app/shared/navigation/top-click-nav/top-click-nav.component.html","src/app/shared/navigation/top-secondary-nav/top-secondary-nav.component.ts","src/app/shared/navigation/top-secondary-nav/top-secondary-nav.component.html","src/app/ci-repack/admin/workstations/workstation.service.ts","src/app/shared/navigation/workstation-banner/workstation-banner.component.ts","src/app/shared/navigation/workstation-banner/workstation-banner.component.html","src/app/shared/navigation/quick-nav/quick-nav.service.ts","src/app/shared/navigation/quick-nav/quick-nav.component.ts","src/app/shared/navigation/quick-nav/quick-nav.component.html","src/app/shared/generated/pcg-settings-Development.ts","src/app/shared/generated/pcg-settings-Demo.ts","src/app/shared/generated/pcg-settings-Production.ts","src/app/shared/generated/pcg-settings.ts","src/app/shared/state/account-request-modal-state.service.ts","src/app/core/pages/dashboard/widgets/notifications-widget/notifications.service.ts","src/app/shared/navigation/mat-side-nav/mat-side-nav.component.ts","src/app/shared/navigation/mat-side-nav/mat-side-nav.component.html","src/app/shared/navigation/navigation.module.ts","src/app/shared/generated/Administration/Models/Organizations/EditOrganizationFacilityVm.ts","src/app/shared/organizations/programs-accounts-infographic/programs-accounts-infographic.component.ts","src/app/shared/organizations/programs-accounts-infographic/programs-accounts-infographic.component.html","src/app/shared/organizations/edit-organization-facility/edit-organization-facility.component.ts","src/app/shared/organizations/edit-organization-facility/edit-organization-facility.component.html","src/app/shared/generated/Administration/Models/Organizations/OrganizationUsersVm.ts","src/app/shared/organizations/edit-organization/edit-organization-tabs/associated-users/associated-users.component.ts","src/app/shared/organizations/edit-organization/edit-organization-tabs/associated-users/associated-users.component.html","src/app/shared/generated/Administration/Models/Facilities/MedicalDirectorVm.ts","src/app/shared/generated/Administration/Models/Organizations/EditOrganizationVm.ts","src/app/shared/generated/Administration/Models/Organizations/OrganizationFacilityListVm.ts","src/app/shared/generated/SysInv/Models/SysInvInventoryVm.ts","src/app/shared/facilities/facility-inventories/services/facility-inventory.service.ts","src/app/shared/organizations/org-facility-inventories/org-facility-inventories.component.ts","src/app/shared/organizations/org-facility-inventories/org-facility-inventories.component.html","src/app/shared/organizations/organization-facility-list/organization-facility-list.component.ts","src/app/shared/organizations/organization-facility-list/organization-facility-list.component.html","src/app/shared/organizations/organization-audit-history/organization-audit-history.component.ts","src/app/shared/organizations/organization-audit-history/organization-audit-history.component.html","src/app/shared/generated/Administration/Models/Organizations/OrganizationAccountVm.ts","src/app/shared/organizations/organization-accounts/organization-accounts.component.ts","src/app/shared/organizations/organization-accounts/organization-accounts.component.html","src/app/core/enums/generated/LoginTypeEnum.ts","src/app/core/enums/generated/SSOTypeEnum.ts","src/app/shared/organizations/organization-logins/organization-logins.component.ts","src/app/shared/organizations/organization-logins/organization-logins.component.html","src/app/shared/organizations/edit-organization/edit-organization.component.ts","src/app/shared/organizations/edit-organization/edit-organization.component.html","src/app/shared/organizations/edit-organization/edit-organization.module.ts","src/app/shared/animations/shared-animations.ts","src/app/shared/generated/Administration/Models/Organizations/OrganizationListVm.ts","src/app/core/enums/CollapsibleTableRowStateEnum.ts","src/app/core/collapsible-table/collapsible-table.service.ts","src/app/shared/organizations/organizations-list/organizations-list.component.ts","src/app/shared/organizations/organizations-list/organizations-list.component.html","src/app/shared/pipes/safe.pipe.ts","src/app/shared/pipes/utcToLocalDate.pipe.ts","src/app/shared/stepper/stepper.component.ts","src/app/shared/stepper/stepper.component.html","src/app/shared/stepper/stepper.module.ts","src/app/shared/tooltip-label/tooltip-label.component.ts","src/app/shared/tooltip-label/tooltip-label.component.html","src/app/shared/tooltip/tooltip.module.ts","src/app/shared/shared.module.ts"],"sourcesContent":["import { Annotation, Facet, combineConfig, StateField, Transaction, ChangeSet, ChangeDesc, EditorSelection, StateEffect, Text, findClusterBreak, countColumn, CharCategory } from '@codemirror/state';\nimport { EditorView, Direction } from '@codemirror/view';\nimport { IndentContext, getIndentation, indentString, matchBrackets, syntaxTree, getIndentUnit, indentUnit } from '@codemirror/language';\nimport { NodeProp } from '@lezer/common';\n\n/**\nComment or uncomment the current selection. Will use line comments\nif available, otherwise falling back to block comments.\n*/\nconst toggleComment = target => {\n let {\n state\n } = target,\n line = state.doc.lineAt(state.selection.main.from),\n config = getConfig(target.state, line.from);\n return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false;\n};\nfunction command(f, option) {\n return ({\n state,\n dispatch\n }) => {\n if (state.readOnly) return false;\n let tr = f(option, state);\n if (!tr) return false;\n dispatch(state.update(tr));\n return true;\n };\n}\n/**\nComment or uncomment the current selection using line comments.\nThe line comment syntax is taken from the\n[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).\n*/\nconst toggleLineComment = /*@__PURE__*/command(changeLineComment, 0 /* CommentOption.Toggle */);\n/**\nComment the current selection using line comments.\n*/\nconst lineComment = /*@__PURE__*/command(changeLineComment, 1 /* CommentOption.Comment */);\n/**\nUncomment the current selection using line comments.\n*/\nconst lineUncomment = /*@__PURE__*/command(changeLineComment, 2 /* CommentOption.Uncomment */);\n/**\nComment or uncomment the current selection using block comments.\nThe block comment syntax is taken from the\n[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).\n*/\nconst toggleBlockComment = /*@__PURE__*/command(changeBlockComment, 0 /* CommentOption.Toggle */);\n/**\nComment the current selection using block comments.\n*/\nconst blockComment = /*@__PURE__*/command(changeBlockComment, 1 /* CommentOption.Comment */);\n/**\nUncomment the current selection using block comments.\n*/\nconst blockUncomment = /*@__PURE__*/command(changeBlockComment, 2 /* CommentOption.Uncomment */);\n/**\nComment or uncomment the lines around the current selection using\nblock comments.\n*/\nconst toggleBlockCommentByLine = /*@__PURE__*/command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);\nfunction getConfig(state, pos) {\n let data = state.languageDataAt(\"commentTokens\", pos);\n return data.length ? data[0] : {};\n}\nconst SearchMargin = 50;\n/**\nDetermines if the given range is block-commented in the given\nstate.\n*/\nfunction findBlockComment(state, {\n open,\n close\n}, from, to) {\n let textBefore = state.sliceDoc(from - SearchMargin, from);\n let textAfter = state.sliceDoc(to, to + SearchMargin);\n let spaceBefore = /\\s*$/.exec(textBefore)[0].length,\n spaceAfter = /^\\s*/.exec(textAfter)[0].length;\n let beforeOff = textBefore.length - spaceBefore;\n if (textBefore.slice(beforeOff - open.length, beforeOff) == open && textAfter.slice(spaceAfter, spaceAfter + close.length) == close) {\n return {\n open: {\n pos: from - spaceBefore,\n margin: spaceBefore && 1\n },\n close: {\n pos: to + spaceAfter,\n margin: spaceAfter && 1\n }\n };\n }\n let startText, endText;\n if (to - from <= 2 * SearchMargin) {\n startText = endText = state.sliceDoc(from, to);\n } else {\n startText = state.sliceDoc(from, from + SearchMargin);\n endText = state.sliceDoc(to - SearchMargin, to);\n }\n let startSpace = /^\\s*/.exec(startText)[0].length,\n endSpace = /\\s*$/.exec(endText)[0].length;\n let endOff = endText.length - endSpace - close.length;\n if (startText.slice(startSpace, startSpace + open.length) == open && endText.slice(endOff, endOff + close.length) == close) {\n return {\n open: {\n pos: from + startSpace + open.length,\n margin: /\\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0\n },\n close: {\n pos: to - endSpace - close.length,\n margin: /\\s/.test(endText.charAt(endOff - 1)) ? 1 : 0\n }\n };\n }\n return null;\n}\nfunction selectedLineRanges(state) {\n let ranges = [];\n for (let r of state.selection.ranges) {\n let fromLine = state.doc.lineAt(r.from);\n let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);\n let last = ranges.length - 1;\n if (last >= 0 && ranges[last].to > fromLine.from) ranges[last].to = toLine.to;else ranges.push({\n from: fromLine.from + /^\\s*/.exec(fromLine.text)[0].length,\n to: toLine.to\n });\n }\n return ranges;\n}\n// Performs toggle, comment and uncomment of block comments in\n// languages that support them.\nfunction changeBlockComment(option, state, ranges = state.selection.ranges) {\n let tokens = ranges.map(r => getConfig(state, r.from).block);\n if (!tokens.every(c => c)) return null;\n let comments = ranges.map((r, i) => findBlockComment(state, tokens[i], r.from, r.to));\n if (option != 2 /* CommentOption.Uncomment */ && !comments.every(c => c)) {\n return {\n changes: state.changes(ranges.map((range, i) => {\n if (comments[i]) return [];\n return [{\n from: range.from,\n insert: tokens[i].open + \" \"\n }, {\n from: range.to,\n insert: \" \" + tokens[i].close\n }];\n }))\n };\n } else if (option != 1 /* CommentOption.Comment */ && comments.some(c => c)) {\n let changes = [];\n for (let i = 0, comment; i < comments.length; i++) if (comment = comments[i]) {\n let token = tokens[i],\n {\n open,\n close\n } = comment;\n changes.push({\n from: open.pos - token.open.length,\n to: open.pos + open.margin\n }, {\n from: close.pos - close.margin,\n to: close.pos + token.close.length\n });\n }\n return {\n changes\n };\n }\n return null;\n}\n// Performs toggle, comment and uncomment of line comments.\nfunction changeLineComment(option, state, ranges = state.selection.ranges) {\n let lines = [];\n let prevLine = -1;\n for (let {\n from,\n to\n } of ranges) {\n let startI = lines.length,\n minIndent = 1e9;\n let token = getConfig(state, from).line;\n if (!token) continue;\n for (let pos = from; pos <= to;) {\n let line = state.doc.lineAt(pos);\n if (line.from > prevLine && (from == to || to > line.from)) {\n prevLine = line.from;\n let indent = /^\\s*/.exec(line.text)[0].length;\n let empty = indent == line.length;\n let comment = line.text.slice(indent, indent + token.length) == token ? indent : -1;\n if (indent < line.text.length && indent < minIndent) minIndent = indent;\n lines.push({\n line,\n comment,\n token,\n indent,\n empty,\n single: false\n });\n }\n pos = line.to + 1;\n }\n if (minIndent < 1e9) for (let i = startI; i < lines.length; i++) if (lines[i].indent < lines[i].line.text.length) lines[i].indent = minIndent;\n if (lines.length == startI + 1) lines[startI].single = true;\n }\n if (option != 2 /* CommentOption.Uncomment */ && lines.some(l => l.comment < 0 && (!l.empty || l.single))) {\n let changes = [];\n for (let {\n line,\n token,\n indent,\n empty,\n single\n } of lines) if (single || !empty) changes.push({\n from: line.from + indent,\n insert: token + \" \"\n });\n let changeSet = state.changes(changes);\n return {\n changes: changeSet,\n selection: state.selection.map(changeSet, 1)\n };\n } else if (option != 1 /* CommentOption.Comment */ && lines.some(l => l.comment >= 0)) {\n let changes = [];\n for (let {\n line,\n comment,\n token\n } of lines) if (comment >= 0) {\n let from = line.from + comment,\n to = from + token.length;\n if (line.text[to - line.from] == \" \") to++;\n changes.push({\n from,\n to\n });\n }\n return {\n changes\n };\n }\n return null;\n}\nconst fromHistory = /*@__PURE__*/Annotation.define();\n/**\nTransaction annotation that will prevent that transaction from\nbeing combined with other transactions in the undo history. Given\n`\"before\"`, it'll prevent merging with previous transactions. With\n`\"after\"`, subsequent transactions won't be combined with this\none. With `\"full\"`, the transaction is isolated on both sides.\n*/\nconst isolateHistory = /*@__PURE__*/Annotation.define();\n/**\nThis facet provides a way to register functions that, given a\ntransaction, provide a set of effects that the history should\nstore when inverting the transaction. This can be used to\nintegrate some kinds of effects in the history, so that they can\nbe undone (and redone again).\n*/\nconst invertedEffects = /*@__PURE__*/Facet.define();\nconst historyConfig = /*@__PURE__*/Facet.define({\n combine(configs) {\n return combineConfig(configs, {\n minDepth: 100,\n newGroupDelay: 500,\n joinToEvent: (_t, isAdjacent) => isAdjacent\n }, {\n minDepth: Math.max,\n newGroupDelay: Math.min,\n joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)\n });\n }\n});\nconst historyField_ = /*@__PURE__*/StateField.define({\n create() {\n return HistoryState.empty;\n },\n update(state, tr) {\n let config = tr.state.facet(historyConfig);\n let fromHist = tr.annotation(fromHistory);\n if (fromHist) {\n let item = HistEvent.fromTransaction(tr, fromHist.selection),\n from = fromHist.side;\n let other = from == 0 /* BranchName.Done */ ? state.undone : state.done;\n if (item) other = updateBranch(other, other.length, config.minDepth, item);else other = addSelection(other, tr.startState.selection);\n return new HistoryState(from == 0 /* BranchName.Done */ ? fromHist.rest : other, from == 0 /* BranchName.Done */ ? other : fromHist.rest);\n }\n let isolate = tr.annotation(isolateHistory);\n if (isolate == \"full\" || isolate == \"before\") state = state.isolate();\n if (tr.annotation(Transaction.addToHistory) === false) return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state;\n let event = HistEvent.fromTransaction(tr);\n let time = tr.annotation(Transaction.time),\n userEvent = tr.annotation(Transaction.userEvent);\n if (event) state = state.addChanges(event, time, userEvent, config, tr);else if (tr.selection) state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);\n if (isolate == \"full\" || isolate == \"after\") state = state.isolate();\n return state;\n },\n toJSON(value) {\n return {\n done: value.done.map(e => e.toJSON()),\n undone: value.undone.map(e => e.toJSON())\n };\n },\n fromJSON(json) {\n return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON));\n }\n});\n/**\nCreate a history extension with the given configuration.\n*/\nfunction history(config = {}) {\n return [historyField_, historyConfig.of(config), EditorView.domEventHandlers({\n beforeinput(e, view) {\n let command = e.inputType == \"historyUndo\" ? undo : e.inputType == \"historyRedo\" ? redo : null;\n if (!command) return false;\n e.preventDefault();\n return command(view);\n }\n })];\n}\n/**\nThe state field used to store the history data. Should probably\nonly be used when you want to\n[serialize](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) or\n[deserialize](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) state objects in a way\nthat preserves history.\n*/\nconst historyField = historyField_;\nfunction cmd(side, selection) {\n return function ({\n state,\n dispatch\n }) {\n if (!selection && state.readOnly) return false;\n let historyState = state.field(historyField_, false);\n if (!historyState) return false;\n let tr = historyState.pop(side, state, selection);\n if (!tr) return false;\n dispatch(tr);\n return true;\n };\n}\n/**\nUndo a single group of history events. Returns false if no group\nwas available.\n*/\nconst undo = /*@__PURE__*/cmd(0 /* BranchName.Done */, false);\n/**\nRedo a group of history events. Returns false if no group was\navailable.\n*/\nconst redo = /*@__PURE__*/cmd(1 /* BranchName.Undone */, false);\n/**\nUndo a change or selection change.\n*/\nconst undoSelection = /*@__PURE__*/cmd(0 /* BranchName.Done */, true);\n/**\nRedo a change or selection change.\n*/\nconst redoSelection = /*@__PURE__*/cmd(1 /* BranchName.Undone */, true);\nfunction depth(side) {\n return function (state) {\n let histState = state.field(historyField_, false);\n if (!histState) return 0;\n let branch = side == 0 /* BranchName.Done */ ? histState.done : histState.undone;\n return branch.length - (branch.length && !branch[0].changes ? 1 : 0);\n };\n}\n/**\nThe amount of undoable change events available in a given state.\n*/\nconst undoDepth = /*@__PURE__*/depth(0 /* BranchName.Done */);\n/**\nThe amount of redoable change events available in a given state.\n*/\nconst redoDepth = /*@__PURE__*/depth(1 /* BranchName.Undone */);\n// History events store groups of changes or effects that need to be\n// undone/redone together.\nclass HistEvent {\n constructor(\n // The changes in this event. Normal events hold at least one\n // change or effect. But it may be necessary to store selection\n // events before the first change, in which case a special type of\n // instance is created which doesn't hold any changes, with\n // changes == startSelection == undefined\n changes,\n // The effects associated with this event\n effects,\n // Accumulated mapping (from addToHistory==false) that should be\n // applied to events below this one.\n mapped,\n // The selection before this event\n startSelection,\n // Stores selection changes after this event, to be used for\n // selection undo/redo.\n selectionsAfter) {\n this.changes = changes;\n this.effects = effects;\n this.mapped = mapped;\n this.startSelection = startSelection;\n this.selectionsAfter = selectionsAfter;\n }\n setSelAfter(after) {\n return new HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);\n }\n toJSON() {\n var _a, _b, _c;\n return {\n changes: (_a = this.changes) === null || _a === void 0 ? void 0 : _a.toJSON(),\n mapped: (_b = this.mapped) === null || _b === void 0 ? void 0 : _b.toJSON(),\n startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(),\n selectionsAfter: this.selectionsAfter.map(s => s.toJSON())\n };\n }\n static fromJSON(json) {\n 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));\n }\n // This does not check `addToHistory` and such, it assumes the\n // transaction needs to be converted to an item. Returns null when\n // there are no changes or effects in the transaction.\n static fromTransaction(tr, selection) {\n let effects = none;\n for (let invert of tr.startState.facet(invertedEffects)) {\n let result = invert(tr);\n if (result.length) effects = effects.concat(result);\n }\n if (!effects.length && tr.changes.empty) return null;\n return new HistEvent(tr.changes.invert(tr.startState.doc), effects, undefined, selection || tr.startState.selection, none);\n }\n static selection(selections) {\n return new HistEvent(undefined, none, undefined, undefined, selections);\n }\n}\nfunction updateBranch(branch, to, maxLen, newEvent) {\n let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0;\n let newBranch = branch.slice(start, to);\n newBranch.push(newEvent);\n return newBranch;\n}\nfunction isAdjacent(a, b) {\n let ranges = [],\n isAdjacent = false;\n a.iterChangedRanges((f, t) => ranges.push(f, t));\n b.iterChangedRanges((_f, _t, f, t) => {\n for (let i = 0; i < ranges.length;) {\n let from = ranges[i++],\n to = ranges[i++];\n if (t >= from && f <= to) isAdjacent = true;\n }\n });\n return isAdjacent;\n}\nfunction eqSelectionShape(a, b) {\n return a.ranges.length == b.ranges.length && a.ranges.filter((r, i) => r.empty != b.ranges[i].empty).length === 0;\n}\nfunction conc(a, b) {\n return !a.length ? b : !b.length ? a : a.concat(b);\n}\nconst none = [];\nconst MaxSelectionsPerEvent = 200;\nfunction addSelection(branch, selection) {\n if (!branch.length) {\n return [HistEvent.selection([selection])];\n } else {\n let lastEvent = branch[branch.length - 1];\n let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent));\n if (sels.length && sels[sels.length - 1].eq(selection)) return branch;\n sels.push(selection);\n return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels));\n }\n}\n// Assumes the top item has one or more selectionAfter values\nfunction popSelection(branch) {\n let last = branch[branch.length - 1];\n let newBranch = branch.slice();\n newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1));\n return newBranch;\n}\n// Add a mapping to the top event in the given branch. If this maps\n// away all the changes and effects in that item, drop it and\n// propagate the mapping to the next item.\nfunction addMappingToBranch(branch, mapping) {\n if (!branch.length) return branch;\n let length = branch.length,\n selections = none;\n while (length) {\n let event = mapEvent(branch[length - 1], mapping, selections);\n if (event.changes && !event.changes.empty || event.effects.length) {\n // Event survived mapping\n let result = branch.slice(0, length);\n result[length - 1] = event;\n return result;\n } else {\n // Drop this event, since there's no changes or effects left\n mapping = event.mapped;\n length--;\n selections = event.selectionsAfter;\n }\n }\n return selections.length ? [HistEvent.selection(selections)] : none;\n}\nfunction mapEvent(event, mapping, extraSelections) {\n let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map(s => s.map(mapping)) : none, extraSelections);\n // Change-less events don't store mappings (they are always the last event in a branch)\n if (!event.changes) return HistEvent.selection(selections);\n let mappedChanges = event.changes.map(mapping),\n before = mapping.mapDesc(event.changes, true);\n let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before;\n return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);\n}\nconst joinableUserEvent = /^(input\\.type|delete)($|\\.)/;\nlet HistoryState = /*#__PURE__*/(() => {\n class HistoryState {\n constructor(done, undone, prevTime = 0, prevUserEvent = undefined) {\n this.done = done;\n this.undone = undone;\n this.prevTime = prevTime;\n this.prevUserEvent = prevUserEvent;\n }\n isolate() {\n return this.prevTime ? new HistoryState(this.done, this.undone) : this;\n }\n addChanges(event, time, userEvent, config, tr) {\n let done = this.done,\n lastEvent = done[done.length - 1];\n if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes && (!userEvent || joinableUserEvent.test(userEvent)) && (!lastEvent.selectionsAfter.length && time - this.prevTime < config.newGroupDelay && config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes)) ||\n // For compose (but not compose.start) events, always join with previous event\n userEvent == \"input.type.compose\")) {\n done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none));\n } else {\n done = updateBranch(done, done.length, config.minDepth, event);\n }\n return new HistoryState(done, none, time, userEvent);\n }\n addSelection(selection, time, userEvent, newGroupDelay) {\n let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;\n if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection)) return this;\n return new HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);\n }\n addMapping(mapping) {\n return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);\n }\n pop(side, state, onlySelection) {\n let branch = side == 0 /* BranchName.Done */ ? this.done : this.undone;\n if (branch.length == 0) return null;\n let event = branch[branch.length - 1],\n selection = event.selectionsAfter[0] || state.selection;\n if (onlySelection && event.selectionsAfter.length) {\n return state.update({\n selection: event.selectionsAfter[event.selectionsAfter.length - 1],\n annotations: fromHistory.of({\n side,\n rest: popSelection(branch),\n selection\n }),\n userEvent: side == 0 /* BranchName.Done */ ? \"select.undo\" : \"select.redo\",\n scrollIntoView: true\n });\n } else if (!event.changes) {\n return null;\n } else {\n let rest = branch.length == 1 ? none : branch.slice(0, branch.length - 1);\n if (event.mapped) rest = addMappingToBranch(rest, event.mapped);\n return state.update({\n changes: event.changes,\n selection: event.startSelection,\n effects: event.effects,\n annotations: fromHistory.of({\n side,\n rest,\n selection\n }),\n filter: false,\n userEvent: side == 0 /* BranchName.Done */ ? \"undo\" : \"redo\",\n scrollIntoView: true\n });\n }\n }\n }\n HistoryState.empty = /*@__PURE__*/new HistoryState(none, none);\n /**\n Default key bindings for the undo history.\n \n - Mod-z: [`undo`](https://codemirror.net/6/docs/ref/#commands.undo).\n - Mod-y (Mod-Shift-z on macOS) + Ctrl-Shift-z on Linux: [`redo`](https://codemirror.net/6/docs/ref/#commands.redo).\n - Mod-u: [`undoSelection`](https://codemirror.net/6/docs/ref/#commands.undoSelection).\n - Alt-u (Mod-Shift-u on macOS): [`redoSelection`](https://codemirror.net/6/docs/ref/#commands.redoSelection).\n */\n return HistoryState;\n})();\nconst historyKeymap = [{\n key: \"Mod-z\",\n run: undo,\n preventDefault: true\n}, {\n key: \"Mod-y\",\n mac: \"Mod-Shift-z\",\n run: redo,\n preventDefault: true\n}, {\n linux: \"Ctrl-Shift-z\",\n run: redo,\n preventDefault: true\n}, {\n key: \"Mod-u\",\n run: undoSelection,\n preventDefault: true\n}, {\n key: \"Alt-u\",\n mac: \"Mod-Shift-u\",\n run: redoSelection,\n preventDefault: true\n}];\nfunction updateSel(sel, by) {\n return EditorSelection.create(sel.ranges.map(by), sel.mainIndex);\n}\nfunction setSel(state, selection) {\n return state.update({\n selection,\n scrollIntoView: true,\n userEvent: \"select\"\n });\n}\nfunction moveSel({\n state,\n dispatch\n}, how) {\n let selection = updateSel(state.selection, how);\n if (selection.eq(state.selection, true)) return false;\n dispatch(setSel(state, selection));\n return true;\n}\nfunction rangeEnd(range, forward) {\n return EditorSelection.cursor(forward ? range.to : range.from);\n}\nfunction cursorByChar(view, forward) {\n return moveSel(view, range => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward));\n}\nfunction ltrAtCursor(view) {\n return view.textDirectionAt(view.state.selection.main.head) == Direction.LTR;\n}\n/**\nMove the selection one character to the left (which is backward in\nleft-to-right text, forward in right-to-left text).\n*/\nconst cursorCharLeft = view => cursorByChar(view, !ltrAtCursor(view));\n/**\nMove the selection one character to the right.\n*/\nconst cursorCharRight = view => cursorByChar(view, ltrAtCursor(view));\n/**\nMove the selection one character forward.\n*/\nconst cursorCharForward = view => cursorByChar(view, true);\n/**\nMove the selection one character backward.\n*/\nconst cursorCharBackward = view => cursorByChar(view, false);\nfunction cursorByGroup(view, forward) {\n return moveSel(view, range => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward));\n}\n/**\nMove the selection to the left across one group of word or\nnon-word (but also non-space) characters.\n*/\nconst cursorGroupLeft = view => cursorByGroup(view, !ltrAtCursor(view));\n/**\nMove the selection one group to the right.\n*/\nconst cursorGroupRight = view => cursorByGroup(view, ltrAtCursor(view));\n/**\nMove the selection one group forward.\n*/\nconst cursorGroupForward = view => cursorByGroup(view, true);\n/**\nMove the selection one group backward.\n*/\nconst cursorGroupBackward = view => cursorByGroup(view, false);\nconst segmenter = typeof Intl != \"undefined\" && Intl.Segmenter ? /*@__PURE__*/new Intl.Segmenter(undefined, {\n granularity: \"word\"\n}) : null;\nfunction moveBySubword(view, range, forward) {\n let categorize = view.state.charCategorizer(range.from);\n let cat = CharCategory.Space,\n pos = range.from,\n steps = 0;\n let done = false,\n sawUpper = false,\n sawLower = false;\n let step = next => {\n if (done) return false;\n pos += forward ? next.length : -next.length;\n let nextCat = categorize(next),\n ahead;\n if (nextCat == CharCategory.Word && next.charCodeAt(0) < 128 && /[\\W_]/.test(next)) nextCat = -1; // Treat word punctuation specially\n if (cat == CharCategory.Space) cat = nextCat;\n if (cat != nextCat) return false;\n if (cat == CharCategory.Word) {\n if (next.toLowerCase() == next) {\n if (!forward && sawUpper) return false;\n sawLower = true;\n } else if (sawLower) {\n if (forward) return false;\n done = true;\n } else {\n if (sawUpper && forward && categorize(ahead = view.state.sliceDoc(pos, pos + 1)) == CharCategory.Word && ahead.toLowerCase() == ahead) return false;\n sawUpper = true;\n }\n }\n steps++;\n return true;\n };\n let end = view.moveByChar(range, forward, start => {\n step(start);\n return step;\n });\n if (segmenter && cat == CharCategory.Word && end.from == range.from + steps * (forward ? 1 : -1)) {\n let from = Math.min(range.head, end.head),\n to = Math.max(range.head, end.head);\n let skipped = view.state.sliceDoc(from, to);\n if (skipped.length > 1 && /[\\u4E00-\\uffff]/.test(skipped)) {\n let segments = Array.from(segmenter.segment(skipped));\n if (segments.length > 1) {\n if (forward) return EditorSelection.cursor(range.head + segments[1].index, -1);\n return EditorSelection.cursor(end.head + segments[segments.length - 1].index, 1);\n }\n }\n }\n return end;\n}\nfunction cursorBySubword(view, forward) {\n return moveSel(view, range => range.empty ? moveBySubword(view, range, forward) : rangeEnd(range, forward));\n}\n/**\nMove the selection one group or camel-case subword forward.\n*/\nconst cursorSubwordForward = view => cursorBySubword(view, true);\n/**\nMove the selection one group or camel-case subword backward.\n*/\nconst cursorSubwordBackward = view => cursorBySubword(view, false);\nfunction interestingNode(state, node, bracketProp) {\n if (node.type.prop(bracketProp)) return true;\n let len = node.to - node.from;\n return len && (len > 2 || /[^\\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild;\n}\nfunction moveBySyntax(state, start, forward) {\n let pos = syntaxTree(state).resolveInner(start.head);\n let bracketProp = forward ? NodeProp.closedBy : NodeProp.openedBy;\n // Scan forward through child nodes to see if there's an interesting\n // node ahead.\n for (let at = start.head;;) {\n let next = forward ? pos.childAfter(at) : pos.childBefore(at);\n if (!next) break;\n if (interestingNode(state, next, bracketProp)) pos = next;else at = forward ? next.to : next.from;\n }\n let bracket = pos.type.prop(bracketProp),\n match,\n newPos;\n if (bracket && (match = forward ? matchBrackets(state, pos.from, 1) : matchBrackets(state, pos.to, -1)) && match.matched) newPos = forward ? match.end.to : match.end.from;else newPos = forward ? pos.to : pos.from;\n return EditorSelection.cursor(newPos, forward ? -1 : 1);\n}\n/**\nMove the cursor over the next syntactic element to the left.\n*/\nconst cursorSyntaxLeft = view => moveSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));\n/**\nMove the cursor over the next syntactic element to the right.\n*/\nconst cursorSyntaxRight = view => moveSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));\nfunction cursorByLine(view, forward) {\n return moveSel(view, range => {\n if (!range.empty) return rangeEnd(range, forward);\n let moved = view.moveVertically(range, forward);\n return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward);\n });\n}\n/**\nMove the selection one line up.\n*/\nconst cursorLineUp = view => cursorByLine(view, false);\n/**\nMove the selection one line down.\n*/\nconst cursorLineDown = view => cursorByLine(view, true);\nfunction pageInfo(view) {\n let selfScroll = view.scrollDOM.clientHeight < view.scrollDOM.scrollHeight - 2;\n let marginTop = 0,\n marginBottom = 0,\n height;\n if (selfScroll) {\n for (let source of view.state.facet(EditorView.scrollMargins)) {\n let margins = source(view);\n if (margins === null || margins === void 0 ? void 0 : margins.top) marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop);\n if (margins === null || margins === void 0 ? void 0 : margins.bottom) marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom);\n }\n height = view.scrollDOM.clientHeight - marginTop - marginBottom;\n } else {\n height = (view.dom.ownerDocument.defaultView || window).innerHeight;\n }\n return {\n marginTop,\n marginBottom,\n selfScroll,\n height: Math.max(view.defaultLineHeight, height - 5)\n };\n}\nfunction cursorByPage(view, forward) {\n let page = pageInfo(view);\n let {\n state\n } = view,\n selection = updateSel(state.selection, range => {\n return range.empty ? view.moveVertically(range, forward, page.height) : rangeEnd(range, forward);\n });\n if (selection.eq(state.selection)) return false;\n let effect;\n if (page.selfScroll) {\n let startPos = view.coordsAtPos(state.selection.main.head);\n let scrollRect = view.scrollDOM.getBoundingClientRect();\n let scrollTop = scrollRect.top + page.marginTop,\n scrollBottom = scrollRect.bottom - page.marginBottom;\n if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom) effect = EditorView.scrollIntoView(selection.main.head, {\n y: \"start\",\n yMargin: startPos.top - scrollTop\n });\n }\n view.dispatch(setSel(state, selection), {\n effects: effect\n });\n return true;\n}\n/**\nMove the selection one page up.\n*/\nconst cursorPageUp = view => cursorByPage(view, false);\n/**\nMove the selection one page down.\n*/\nconst cursorPageDown = view => cursorByPage(view, true);\nfunction moveByLineBoundary(view, start, forward) {\n let line = view.lineBlockAt(start.head),\n moved = view.moveToLineBoundary(start, forward);\n if (moved.head == start.head && moved.head != (forward ? line.to : line.from)) moved = view.moveToLineBoundary(start, forward, false);\n if (!forward && moved.head == line.from && line.length) {\n let space = /^\\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length;\n if (space && start.head != line.from + space) moved = EditorSelection.cursor(line.from + space);\n }\n return moved;\n}\n/**\nMove the selection to the next line wrap point, or to the end of\nthe line if there isn't one left on this line.\n*/\nconst cursorLineBoundaryForward = view => moveSel(view, range => moveByLineBoundary(view, range, true));\n/**\nMove the selection to previous line wrap point, or failing that to\nthe start of the line. If the line is indented, and the cursor\nisn't already at the end of the indentation, this will move to the\nend of the indentation instead of the start of the line.\n*/\nconst cursorLineBoundaryBackward = view => moveSel(view, range => moveByLineBoundary(view, range, false));\n/**\nMove the selection one line wrap point to the left.\n*/\nconst cursorLineBoundaryLeft = view => moveSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));\n/**\nMove the selection one line wrap point to the right.\n*/\nconst cursorLineBoundaryRight = view => moveSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));\n/**\nMove the selection to the start of the line.\n*/\nconst cursorLineStart = view => moveSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).from, 1));\n/**\nMove the selection to the end of the line.\n*/\nconst cursorLineEnd = view => moveSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));\nfunction toMatchingBracket(state, dispatch, extend) {\n let found = false,\n selection = updateSel(state.selection, range => {\n 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);\n if (!matching || !matching.end) return range;\n found = true;\n let head = matching.start.from == range.head ? matching.end.to : matching.end.from;\n return extend ? EditorSelection.range(range.anchor, head) : EditorSelection.cursor(head);\n });\n if (!found) return false;\n dispatch(setSel(state, selection));\n return true;\n}\n/**\nMove the selection to the bracket matching the one it is currently\non, if any.\n*/\nconst cursorMatchingBracket = ({\n state,\n dispatch\n}) => toMatchingBracket(state, dispatch, false);\n/**\nExtend the selection to the bracket matching the one the selection\nhead is currently on, if any.\n*/\nconst selectMatchingBracket = ({\n state,\n dispatch\n}) => toMatchingBracket(state, dispatch, true);\nfunction extendSel(view, how) {\n let selection = updateSel(view.state.selection, range => {\n let head = how(range);\n return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);\n });\n if (selection.eq(view.state.selection)) return false;\n view.dispatch(setSel(view.state, selection));\n return true;\n}\nfunction selectByChar(view, forward) {\n return extendSel(view, range => view.moveByChar(range, forward));\n}\n/**\nMove the selection head one character to the left, while leaving\nthe anchor in place.\n*/\nconst selectCharLeft = view => selectByChar(view, !ltrAtCursor(view));\n/**\nMove the selection head one character to the right.\n*/\nconst selectCharRight = view => selectByChar(view, ltrAtCursor(view));\n/**\nMove the selection head one character forward.\n*/\nconst selectCharForward = view => selectByChar(view, true);\n/**\nMove the selection head one character backward.\n*/\nconst selectCharBackward = view => selectByChar(view, false);\nfunction selectByGroup(view, forward) {\n return extendSel(view, range => view.moveByGroup(range, forward));\n}\n/**\nMove the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to\nthe left.\n*/\nconst selectGroupLeft = view => selectByGroup(view, !ltrAtCursor(view));\n/**\nMove the selection head one group to the right.\n*/\nconst selectGroupRight = view => selectByGroup(view, ltrAtCursor(view));\n/**\nMove the selection head one group forward.\n*/\nconst selectGroupForward = view => selectByGroup(view, true);\n/**\nMove the selection head one group backward.\n*/\nconst selectGroupBackward = view => selectByGroup(view, false);\nfunction selectBySubword(view, forward) {\n return extendSel(view, range => moveBySubword(view, range, forward));\n}\n/**\nMove the selection head one group or camel-case subword forward.\n*/\nconst selectSubwordForward = view => selectBySubword(view, true);\n/**\nMove the selection head one group or subword backward.\n*/\nconst selectSubwordBackward = view => selectBySubword(view, false);\n/**\nMove the selection head over the next syntactic element to the left.\n*/\nconst selectSyntaxLeft = view => extendSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));\n/**\nMove the selection head over the next syntactic element to the right.\n*/\nconst selectSyntaxRight = view => extendSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));\nfunction selectByLine(view, forward) {\n return extendSel(view, range => view.moveVertically(range, forward));\n}\n/**\nMove the selection head one line up.\n*/\nconst selectLineUp = view => selectByLine(view, false);\n/**\nMove the selection head one line down.\n*/\nconst selectLineDown = view => selectByLine(view, true);\nfunction selectByPage(view, forward) {\n return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));\n}\n/**\nMove the selection head one page up.\n*/\nconst selectPageUp = view => selectByPage(view, false);\n/**\nMove the selection head one page down.\n*/\nconst selectPageDown = view => selectByPage(view, true);\n/**\nMove the selection head to the next line boundary.\n*/\nconst selectLineBoundaryForward = view => extendSel(view, range => moveByLineBoundary(view, range, true));\n/**\nMove the selection head to the previous line boundary.\n*/\nconst selectLineBoundaryBackward = view => extendSel(view, range => moveByLineBoundary(view, range, false));\n/**\nMove the selection head one line boundary to the left.\n*/\nconst selectLineBoundaryLeft = view => extendSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));\n/**\nMove the selection head one line boundary to the right.\n*/\nconst selectLineBoundaryRight = view => extendSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));\n/**\nMove the selection head to the start of the line.\n*/\nconst selectLineStart = view => extendSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).from));\n/**\nMove the selection head to the end of the line.\n*/\nconst selectLineEnd = view => extendSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).to));\n/**\nMove the selection to the start of the document.\n*/\nconst cursorDocStart = ({\n state,\n dispatch\n}) => {\n dispatch(setSel(state, {\n anchor: 0\n }));\n return true;\n};\n/**\nMove the selection to the end of the document.\n*/\nconst cursorDocEnd = ({\n state,\n dispatch\n}) => {\n dispatch(setSel(state, {\n anchor: state.doc.length\n }));\n return true;\n};\n/**\nMove the selection head to the start of the document.\n*/\nconst selectDocStart = ({\n state,\n dispatch\n}) => {\n dispatch(setSel(state, {\n anchor: state.selection.main.anchor,\n head: 0\n }));\n return true;\n};\n/**\nMove the selection head to the end of the document.\n*/\nconst selectDocEnd = ({\n state,\n dispatch\n}) => {\n dispatch(setSel(state, {\n anchor: state.selection.main.anchor,\n head: state.doc.length\n }));\n return true;\n};\n/**\nSelect the entire document.\n*/\nconst selectAll = ({\n state,\n dispatch\n}) => {\n dispatch(state.update({\n selection: {\n anchor: 0,\n head: state.doc.length\n },\n userEvent: \"select\"\n }));\n return true;\n};\n/**\nExpand the selection to cover entire lines.\n*/\nconst selectLine = ({\n state,\n dispatch\n}) => {\n let ranges = selectedLineBlocks(state).map(({\n from,\n to\n }) => EditorSelection.range(from, Math.min(to + 1, state.doc.length)));\n dispatch(state.update({\n selection: EditorSelection.create(ranges),\n userEvent: \"select\"\n }));\n return true;\n};\n/**\nSelect the next syntactic construct that is larger than the\nselection. Note that this will only work insofar as the language\n[provider](https://codemirror.net/6/docs/ref/#language.language) you use builds up a full\nsyntax tree.\n*/\nconst selectParentSyntax = ({\n state,\n dispatch\n}) => {\n let selection = updateSel(state.selection, range => {\n var _a;\n let stack = syntaxTree(state).resolveStack(range.from, 1);\n for (let cur = stack; cur; cur = cur.next) {\n let {\n node\n } = cur;\n if ((node.from < range.from && node.to >= range.to || node.to > range.to && node.from <= range.from) && ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent)) return EditorSelection.range(node.to, node.from);\n }\n return range;\n });\n dispatch(setSel(state, selection));\n return true;\n};\n/**\nSimplify the current selection. When multiple ranges are selected,\nreduce it to its main range. Otherwise, if the selection is\nnon-empty, convert it to a cursor selection.\n*/\nconst simplifySelection = ({\n state,\n dispatch\n}) => {\n let cur = state.selection,\n selection = null;\n if (cur.ranges.length > 1) selection = EditorSelection.create([cur.main]);else if (!cur.main.empty) selection = EditorSelection.create([EditorSelection.cursor(cur.main.head)]);\n if (!selection) return false;\n dispatch(setSel(state, selection));\n return true;\n};\nfunction deleteBy(target, by) {\n if (target.state.readOnly) return false;\n let event = \"delete.selection\",\n {\n state\n } = target;\n let changes = state.changeByRange(range => {\n let {\n from,\n to\n } = range;\n if (from == to) {\n let towards = by(range);\n if (towards < from) {\n event = \"delete.backward\";\n towards = skipAtomic(target, towards, false);\n } else if (towards > from) {\n event = \"delete.forward\";\n towards = skipAtomic(target, towards, true);\n }\n from = Math.min(from, towards);\n to = Math.max(to, towards);\n } else {\n from = skipAtomic(target, from, false);\n to = skipAtomic(target, to, true);\n }\n return from == to ? {\n range\n } : {\n changes: {\n from,\n to\n },\n range: EditorSelection.cursor(from, from < range.head ? -1 : 1)\n };\n });\n if (changes.changes.empty) return false;\n target.dispatch(state.update(changes, {\n scrollIntoView: true,\n userEvent: event,\n effects: event == \"delete.selection\" ? EditorView.announce.of(state.phrase(\"Selection deleted\")) : undefined\n }));\n return true;\n}\nfunction skipAtomic(target, pos, forward) {\n if (target instanceof EditorView) for (let ranges of target.state.facet(EditorView.atomicRanges).map(f => f(target))) ranges.between(pos, pos, (from, to) => {\n if (from < pos && to > pos) pos = forward ? to : from;\n });\n return pos;\n}\nconst deleteByChar = (target, forward, byIndentUnit) => deleteBy(target, range => {\n let pos = range.from,\n {\n state\n } = target,\n line = state.doc.lineAt(pos),\n before,\n targetPos;\n if (byIndentUnit && !forward && pos > line.from && pos < line.from + 200 && !/[^ \\t]/.test(before = line.text.slice(0, pos - line.from))) {\n if (before[before.length - 1] == \"\\t\") return pos - 1;\n let col = countColumn(before, state.tabSize),\n drop = col % getIndentUnit(state) || getIndentUnit(state);\n for (let i = 0; i < drop && before[before.length - 1 - i] == \" \"; i++) pos--;\n targetPos = pos;\n } else {\n targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from;\n if (targetPos == pos && line.number != (forward ? state.doc.lines : 1)) targetPos += forward ? 1 : -1;else if (!forward && /[\\ufe00-\\ufe0f]/.test(line.text.slice(targetPos - line.from, pos - line.from))) targetPos = findClusterBreak(line.text, targetPos - line.from, false, false) + line.from;\n }\n return targetPos;\n});\n/**\nDelete the selection, or, for cursor selections, the character or\nindentation unit before the cursor.\n*/\nconst deleteCharBackward = view => deleteByChar(view, false, true);\n/**\nDelete the selection or the character before the cursor. Does not\nimplement any extended behavior like deleting whole indentation\nunits in one go.\n*/\nconst deleteCharBackwardStrict = view => deleteByChar(view, false, false);\n/**\nDelete the selection or the character after the cursor.\n*/\nconst deleteCharForward = view => deleteByChar(view, true, false);\nconst deleteByGroup = (target, forward) => deleteBy(target, range => {\n let pos = range.head,\n {\n state\n } = target,\n line = state.doc.lineAt(pos);\n let categorize = state.charCategorizer(pos);\n for (let cat = null;;) {\n if (pos == (forward ? line.to : line.from)) {\n if (pos == range.head && line.number != (forward ? state.doc.lines : 1)) pos += forward ? 1 : -1;\n break;\n }\n let next = findClusterBreak(line.text, pos - line.from, forward) + line.from;\n let nextChar = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from);\n let nextCat = categorize(nextChar);\n if (cat != null && nextCat != cat) break;\n if (nextChar != \" \" || pos != range.head) cat = nextCat;\n pos = next;\n }\n return pos;\n});\n/**\nDelete the selection or backward until the end of the next\n[group](https://codemirror.net/6/docs/ref/#view.EditorView.moveByGroup), only skipping groups of\nwhitespace when they consist of a single space.\n*/\nconst deleteGroupBackward = target => deleteByGroup(target, false);\n/**\nDelete the selection or forward until the end of the next group.\n*/\nconst deleteGroupForward = target => deleteByGroup(target, true);\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe end of the line. If the cursor is directly at the end of the\nline, delete the line break after it.\n*/\nconst deleteToLineEnd = view => deleteBy(view, range => {\n let lineEnd = view.lineBlockAt(range.head).to;\n return range.head < lineEnd ? lineEnd : Math.min(view.state.doc.length, range.head + 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe start of the line. If the cursor is directly at the start of the\nline, delete the line break before it.\n*/\nconst deleteToLineStart = view => deleteBy(view, range => {\n let lineStart = view.lineBlockAt(range.head).from;\n return range.head > lineStart ? lineStart : Math.max(0, range.head - 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe start of the line or the next line wrap before the cursor.\n*/\nconst deleteLineBoundaryBackward = view => deleteBy(view, range => {\n let lineStart = view.moveToLineBoundary(range, false).head;\n return range.head > lineStart ? lineStart : Math.max(0, range.head - 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe end of the line or the next line wrap after the cursor.\n*/\nconst deleteLineBoundaryForward = view => deleteBy(view, range => {\n let lineStart = view.moveToLineBoundary(range, true).head;\n return range.head < lineStart ? lineStart : Math.min(view.state.doc.length, range.head + 1);\n});\n/**\nDelete all whitespace directly before a line end from the\ndocument.\n*/\nconst deleteTrailingWhitespace = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n let changes = [];\n for (let pos = 0, prev = \"\", iter = state.doc.iter();;) {\n iter.next();\n if (iter.lineBreak || iter.done) {\n let trailing = prev.search(/\\s+$/);\n if (trailing > -1) changes.push({\n from: pos - (prev.length - trailing),\n to: pos\n });\n if (iter.done) break;\n prev = \"\";\n } else {\n prev = iter.value;\n }\n pos += iter.value.length;\n }\n if (!changes.length) return false;\n dispatch(state.update({\n changes,\n userEvent: \"delete\"\n }));\n return true;\n};\n/**\nReplace each selection range with a line break, leaving the cursor\non the line before the break.\n*/\nconst splitLine = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n let changes = state.changeByRange(range => {\n return {\n changes: {\n from: range.from,\n to: range.to,\n insert: Text.of([\"\", \"\"])\n },\n range: EditorSelection.cursor(range.from)\n };\n });\n dispatch(state.update(changes, {\n scrollIntoView: true,\n userEvent: \"input\"\n }));\n return true;\n};\n/**\nFlip the characters before and after the cursor(s).\n*/\nconst transposeChars = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n let changes = state.changeByRange(range => {\n if (!range.empty || range.from == 0 || range.from == state.doc.length) return {\n range\n };\n let pos = range.from,\n line = state.doc.lineAt(pos);\n let from = pos == line.from ? pos - 1 : findClusterBreak(line.text, pos - line.from, false) + line.from;\n let to = pos == line.to ? pos + 1 : findClusterBreak(line.text, pos - line.from, true) + line.from;\n return {\n changes: {\n from,\n to,\n insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos))\n },\n range: EditorSelection.cursor(to)\n };\n });\n if (changes.changes.empty) return false;\n dispatch(state.update(changes, {\n scrollIntoView: true,\n userEvent: \"move.character\"\n }));\n return true;\n};\nfunction selectedLineBlocks(state) {\n let blocks = [],\n upto = -1;\n for (let range of state.selection.ranges) {\n let startLine = state.doc.lineAt(range.from),\n endLine = state.doc.lineAt(range.to);\n if (!range.empty && range.to == endLine.from) endLine = state.doc.lineAt(range.to - 1);\n if (upto >= startLine.number) {\n let prev = blocks[blocks.length - 1];\n prev.to = endLine.to;\n prev.ranges.push(range);\n } else {\n blocks.push({\n from: startLine.from,\n to: endLine.to,\n ranges: [range]\n });\n }\n upto = endLine.number + 1;\n }\n return blocks;\n}\nfunction moveLine(state, dispatch, forward) {\n if (state.readOnly) return false;\n let changes = [],\n ranges = [];\n for (let block of selectedLineBlocks(state)) {\n if (forward ? block.to == state.doc.length : block.from == 0) continue;\n let nextLine = state.doc.lineAt(forward ? block.to + 1 : block.from - 1);\n let size = nextLine.length + 1;\n if (forward) {\n changes.push({\n from: block.to,\n to: nextLine.to\n }, {\n from: block.from,\n insert: nextLine.text + state.lineBreak\n });\n for (let r of block.ranges) ranges.push(EditorSelection.range(Math.min(state.doc.length, r.anchor + size), Math.min(state.doc.length, r.head + size)));\n } else {\n changes.push({\n from: nextLine.from,\n to: block.from\n }, {\n from: block.to,\n insert: state.lineBreak + nextLine.text\n });\n for (let r of block.ranges) ranges.push(EditorSelection.range(r.anchor - size, r.head - size));\n }\n }\n if (!changes.length) return false;\n dispatch(state.update({\n changes,\n scrollIntoView: true,\n selection: EditorSelection.create(ranges, state.selection.mainIndex),\n userEvent: \"move.line\"\n }));\n return true;\n}\n/**\nMove the selected lines up one line.\n*/\nconst moveLineUp = ({\n state,\n dispatch\n}) => moveLine(state, dispatch, false);\n/**\nMove the selected lines down one line.\n*/\nconst moveLineDown = ({\n state,\n dispatch\n}) => moveLine(state, dispatch, true);\nfunction copyLine(state, dispatch, forward) {\n if (state.readOnly) return false;\n let changes = [];\n for (let block of selectedLineBlocks(state)) {\n if (forward) changes.push({\n from: block.from,\n insert: state.doc.slice(block.from, block.to) + state.lineBreak\n });else changes.push({\n from: block.to,\n insert: state.lineBreak + state.doc.slice(block.from, block.to)\n });\n }\n dispatch(state.update({\n changes,\n scrollIntoView: true,\n userEvent: \"input.copyline\"\n }));\n return true;\n}\n/**\nCreate a copy of the selected lines. Keep the selection in the top copy.\n*/\nconst copyLineUp = ({\n state,\n dispatch\n}) => copyLine(state, dispatch, false);\n/**\nCreate a copy of the selected lines. Keep the selection in the bottom copy.\n*/\nconst copyLineDown = ({\n state,\n dispatch\n}) => copyLine(state, dispatch, true);\n/**\nDelete selected lines.\n*/\nconst deleteLine = view => {\n if (view.state.readOnly) return false;\n let {\n state\n } = view,\n changes = state.changes(selectedLineBlocks(state).map(({\n from,\n to\n }) => {\n if (from > 0) from--;else if (to < state.doc.length) to++;\n return {\n from,\n to\n };\n }));\n let selection = updateSel(state.selection, range => {\n let dist = undefined;\n if (view.lineWrapping) {\n let block = view.lineBlockAt(range.head),\n pos = view.coordsAtPos(range.head, range.assoc || 1);\n if (pos) dist = block.bottom + view.documentTop - pos.bottom + view.defaultLineHeight / 2;\n }\n return view.moveVertically(range, true, dist);\n }).map(changes);\n view.dispatch({\n changes,\n selection,\n scrollIntoView: true,\n userEvent: \"delete.line\"\n });\n return true;\n};\n/**\nReplace the selection with a newline.\n*/\nconst insertNewline = ({\n state,\n dispatch\n}) => {\n dispatch(state.update(state.replaceSelection(state.lineBreak), {\n scrollIntoView: true,\n userEvent: \"input\"\n }));\n return true;\n};\n/**\nReplace the selection with a newline and the same amount of\nindentation as the line above.\n*/\nconst insertNewlineKeepIndent = ({\n state,\n dispatch\n}) => {\n dispatch(state.update(state.changeByRange(range => {\n let indent = /^\\s*/.exec(state.doc.lineAt(range.from).text)[0];\n return {\n changes: {\n from: range.from,\n to: range.to,\n insert: state.lineBreak + indent\n },\n range: EditorSelection.cursor(range.from + indent.length + 1)\n };\n }), {\n scrollIntoView: true,\n userEvent: \"input\"\n }));\n return true;\n};\nfunction isBetweenBrackets(state, pos) {\n if (/\\(\\)|\\[\\]|\\{\\}/.test(state.sliceDoc(pos - 1, pos + 1))) return {\n from: pos,\n to: pos\n };\n let context = syntaxTree(state).resolveInner(pos);\n let before = context.childBefore(pos),\n after = context.childAfter(pos),\n closedBy;\n 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 && !/\\S/.test(state.sliceDoc(before.to, after.from))) return {\n from: before.to,\n to: after.from\n };\n return null;\n}\n/**\nReplace the selection with a newline and indent the newly created\nline(s). If the current line consists only of whitespace, this\nwill also delete that whitespace. When the cursor is between\nmatching brackets, an additional newline will be inserted after\nthe cursor.\n*/\nconst insertNewlineAndIndent = /*@__PURE__*/newlineAndIndent(false);\n/**\nCreate a blank, indented line below the current line.\n*/\nconst insertBlankLine = /*@__PURE__*/newlineAndIndent(true);\nfunction newlineAndIndent(atEof) {\n return ({\n state,\n dispatch\n }) => {\n if (state.readOnly) return false;\n let changes = state.changeByRange(range => {\n let {\n from,\n to\n } = range,\n line = state.doc.lineAt(from);\n let explode = !atEof && from == to && isBetweenBrackets(state, from);\n if (atEof) from = to = (to <= line.to ? line : state.doc.lineAt(to)).to;\n let cx = new IndentContext(state, {\n simulateBreak: from,\n simulateDoubleBreak: !!explode\n });\n let indent = getIndentation(cx, from);\n if (indent == null) indent = countColumn(/^\\s*/.exec(state.doc.lineAt(from).text)[0], state.tabSize);\n while (to < line.to && /\\s/.test(line.text[to - line.from])) to++;\n if (explode) ({\n from,\n to\n } = explode);else if (from > line.from && from < line.from + 100 && !/\\S/.test(line.text.slice(0, from))) from = line.from;\n let insert = [\"\", indentString(state, indent)];\n if (explode) insert.push(indentString(state, cx.lineIndent(line.from, -1)));\n return {\n changes: {\n from,\n to,\n insert: Text.of(insert)\n },\n range: EditorSelection.cursor(from + 1 + insert[1].length)\n };\n });\n dispatch(state.update(changes, {\n scrollIntoView: true,\n userEvent: \"input\"\n }));\n return true;\n };\n}\nfunction changeBySelectedLine(state, f) {\n let atLine = -1;\n return state.changeByRange(range => {\n let changes = [];\n for (let pos = range.from; pos <= range.to;) {\n let line = state.doc.lineAt(pos);\n if (line.number > atLine && (range.empty || range.to > line.from)) {\n f(line, changes, range);\n atLine = line.number;\n }\n pos = line.to + 1;\n }\n let changeSet = state.changes(changes);\n return {\n changes,\n range: EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1))\n };\n });\n}\n/**\nAuto-indent the selected lines. This uses the [indentation service\nfacet](https://codemirror.net/6/docs/ref/#language.indentService) as source for auto-indent\ninformation.\n*/\nconst indentSelection = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n let updated = Object.create(null);\n let context = new IndentContext(state, {\n overrideIndentation: start => {\n let found = updated[start];\n return found == null ? -1 : found;\n }\n });\n let changes = changeBySelectedLine(state, (line, changes, range) => {\n let indent = getIndentation(context, line.from);\n if (indent == null) return;\n if (!/\\S/.test(line.text)) indent = 0;\n let cur = /^\\s*/.exec(line.text)[0];\n let norm = indentString(state, indent);\n if (cur != norm || range.from < line.from + cur.length) {\n updated[line.from] = indent;\n changes.push({\n from: line.from,\n to: line.from + cur.length,\n insert: norm\n });\n }\n });\n if (!changes.changes.empty) dispatch(state.update(changes, {\n userEvent: \"indent\"\n }));\n return true;\n};\n/**\nAdd a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation to all selected\nlines.\n*/\nconst indentMore = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n dispatch(state.update(changeBySelectedLine(state, (line, changes) => {\n changes.push({\n from: line.from,\n insert: state.facet(indentUnit)\n });\n }), {\n userEvent: \"input.indent\"\n }));\n return true;\n};\n/**\nRemove a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation from all\nselected lines.\n*/\nconst indentLess = ({\n state,\n dispatch\n}) => {\n if (state.readOnly) return false;\n dispatch(state.update(changeBySelectedLine(state, (line, changes) => {\n let space = /^\\s*/.exec(line.text)[0];\n if (!space) return;\n let col = countColumn(space, state.tabSize),\n keep = 0;\n let insert = indentString(state, Math.max(0, col - getIndentUnit(state)));\n while (keep < space.length && keep < insert.length && space.charCodeAt(keep) == insert.charCodeAt(keep)) keep++;\n changes.push({\n from: line.from + keep,\n to: line.from + space.length,\n insert: insert.slice(keep)\n });\n }), {\n userEvent: \"delete.dedent\"\n }));\n return true;\n};\n/**\nEnables or disables\n[tab-focus mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode). While on, this\nprevents the editor's key bindings from capturing Tab or\nShift-Tab, making it possible for the user to move focus out of\nthe editor with the keyboard.\n*/\nconst toggleTabFocusMode = view => {\n view.setTabFocusMode();\n return true;\n};\n/**\nTemporarily enables [tab-focus\nmode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode) for two seconds or until\nanother key is pressed.\n*/\nconst temporarilySetTabFocusMode = view => {\n view.setTabFocusMode(2000);\n return true;\n};\n/**\nInsert a tab character at the cursor or, if something is selected,\nuse [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) to indent the entire\nselection.\n*/\nconst insertTab = ({\n state,\n dispatch\n}) => {\n if (state.selection.ranges.some(r => !r.empty)) return indentMore({\n state,\n dispatch\n });\n dispatch(state.update(state.replaceSelection(\"\\t\"), {\n scrollIntoView: true,\n userEvent: \"input\"\n }));\n return true;\n};\n/**\nArray of key bindings containing the Emacs-style bindings that are\navailable on macOS by default.\n\n - Ctrl-b: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)\n - Ctrl-f: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)\n - Ctrl-p: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)\n - Ctrl-n: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)\n - Ctrl-a: [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)\n - Ctrl-e: [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)\n - Ctrl-d: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)\n - Ctrl-h: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)\n - Ctrl-k: [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd)\n - Ctrl-Alt-h: [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)\n - Ctrl-o: [`splitLine`](https://codemirror.net/6/docs/ref/#commands.splitLine)\n - Ctrl-t: [`transposeChars`](https://codemirror.net/6/docs/ref/#commands.transposeChars)\n - Ctrl-v: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown)\n - Alt-v: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp)\n*/\nconst emacsStyleKeymap = [{\n key: \"Ctrl-b\",\n run: cursorCharLeft,\n shift: selectCharLeft,\n preventDefault: true\n}, {\n key: \"Ctrl-f\",\n run: cursorCharRight,\n shift: selectCharRight\n}, {\n key: \"Ctrl-p\",\n run: cursorLineUp,\n shift: selectLineUp\n}, {\n key: \"Ctrl-n\",\n run: cursorLineDown,\n shift: selectLineDown\n}, {\n key: \"Ctrl-a\",\n run: cursorLineStart,\n shift: selectLineStart\n}, {\n key: \"Ctrl-e\",\n run: cursorLineEnd,\n shift: selectLineEnd\n}, {\n key: \"Ctrl-d\",\n run: deleteCharForward\n}, {\n key: \"Ctrl-h\",\n run: deleteCharBackward\n}, {\n key: \"Ctrl-k\",\n run: deleteToLineEnd\n}, {\n key: \"Ctrl-Alt-h\",\n run: deleteGroupBackward\n}, {\n key: \"Ctrl-o\",\n run: splitLine\n}, {\n key: \"Ctrl-t\",\n run: transposeChars\n}, {\n key: \"Ctrl-v\",\n run: cursorPageDown\n}];\n/**\nAn array of key bindings closely sticking to platform-standard or\nwidely used bindings. (This includes the bindings from\n[`emacsStyleKeymap`](https://codemirror.net/6/docs/ref/#commands.emacsStyleKeymap), with their `key`\nproperty changed to `mac`.)\n\n - ArrowLeft: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)\n - ArrowRight: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)\n - Ctrl-ArrowLeft (Alt-ArrowLeft on macOS): [`cursorGroupLeft`](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) ([`selectGroupLeft`](https://codemirror.net/6/docs/ref/#commands.selectGroupLeft) with Shift)\n - Ctrl-ArrowRight (Alt-ArrowRight on macOS): [`cursorGroupRight`](https://codemirror.net/6/docs/ref/#commands.cursorGroupRight) ([`selectGroupRight`](https://codemirror.net/6/docs/ref/#commands.selectGroupRight) with Shift)\n - Cmd-ArrowLeft (on macOS): [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)\n - Cmd-ArrowRight (on macOS): [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)\n - ArrowUp: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)\n - ArrowDown: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)\n - Cmd-ArrowUp (on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)\n - Cmd-ArrowDown (on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)\n - Ctrl-ArrowUp (on macOS): [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)\n - Ctrl-ArrowDown (on macOS): [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)\n - PageUp: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)\n - PageDown: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)\n - Home: [`cursorLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryBackward) ([`selectLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryBackward) with Shift)\n - End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)\n - Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)\n - Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)\n - Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)\n - Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)\n - Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)\n - Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)\n - Ctrl-Backspace (Alt-Backspace on macOS): [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)\n - Ctrl-Delete (Alt-Delete on macOS): [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)\n - Cmd-Backspace (macOS): [`deleteLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryBackward).\n - Cmd-Delete (macOS): [`deleteLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryForward).\n*/\nconst standardKeymap = /*@__PURE__*/[{\n key: \"ArrowLeft\",\n run: cursorCharLeft,\n shift: selectCharLeft,\n preventDefault: true\n}, {\n key: \"Mod-ArrowLeft\",\n mac: \"Alt-ArrowLeft\",\n run: cursorGroupLeft,\n shift: selectGroupLeft,\n preventDefault: true\n}, {\n mac: \"Cmd-ArrowLeft\",\n run: cursorLineBoundaryLeft,\n shift: selectLineBoundaryLeft,\n preventDefault: true\n}, {\n key: \"ArrowRight\",\n run: cursorCharRight,\n shift: selectCharRight,\n preventDefault: true\n}, {\n key: \"Mod-ArrowRight\",\n mac: \"Alt-ArrowRight\",\n run: cursorGroupRight,\n shift: selectGroupRight,\n preventDefault: true\n}, {\n mac: \"Cmd-ArrowRight\",\n run: cursorLineBoundaryRight,\n shift: selectLineBoundaryRight,\n preventDefault: true\n}, {\n key: \"ArrowUp\",\n run: cursorLineUp,\n shift: selectLineUp,\n preventDefault: true\n}, {\n mac: \"Cmd-ArrowUp\",\n run: cursorDocStart,\n shift: selectDocStart\n}, {\n mac: \"Ctrl-ArrowUp\",\n run: cursorPageUp,\n shift: selectPageUp\n}, {\n key: \"ArrowDown\",\n run: cursorLineDown,\n shift: selectLineDown,\n preventDefault: true\n}, {\n mac: \"Cmd-ArrowDown\",\n run: cursorDocEnd,\n shift: selectDocEnd\n}, {\n mac: \"Ctrl-ArrowDown\",\n run: cursorPageDown,\n shift: selectPageDown\n}, {\n key: \"PageUp\",\n run: cursorPageUp,\n shift: selectPageUp\n}, {\n key: \"PageDown\",\n run: cursorPageDown,\n shift: selectPageDown\n}, {\n key: \"Home\",\n run: cursorLineBoundaryBackward,\n shift: selectLineBoundaryBackward,\n preventDefault: true\n}, {\n key: \"Mod-Home\",\n run: cursorDocStart,\n shift: selectDocStart\n}, {\n key: \"End\",\n run: cursorLineBoundaryForward,\n shift: selectLineBoundaryForward,\n preventDefault: true\n}, {\n key: \"Mod-End\",\n run: cursorDocEnd,\n shift: selectDocEnd\n}, {\n key: \"Enter\",\n run: insertNewlineAndIndent\n}, {\n key: \"Mod-a\",\n run: selectAll\n}, {\n key: \"Backspace\",\n run: deleteCharBackward,\n shift: deleteCharBackward\n}, {\n key: \"Delete\",\n run: deleteCharForward\n}, {\n key: \"Mod-Backspace\",\n mac: \"Alt-Backspace\",\n run: deleteGroupBackward\n}, {\n key: \"Mod-Delete\",\n mac: \"Alt-Delete\",\n run: deleteGroupForward\n}, {\n mac: \"Mod-Backspace\",\n run: deleteLineBoundaryBackward\n}, {\n mac: \"Mod-Delete\",\n run: deleteLineBoundaryForward\n}].concat(/*@__PURE__*/emacsStyleKeymap.map(b => ({\n mac: b.key,\n run: b.run,\n shift: b.shift\n})));\n/**\nThe default keymap. Includes all bindings from\n[`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:\n\n- Alt-ArrowLeft (Ctrl-ArrowLeft on macOS): [`cursorSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxLeft) ([`selectSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxLeft) with Shift)\n- Alt-ArrowRight (Ctrl-ArrowRight on macOS): [`cursorSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxRight) ([`selectSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxRight) with Shift)\n- Alt-ArrowUp: [`moveLineUp`](https://codemirror.net/6/docs/ref/#commands.moveLineUp)\n- Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)\n- Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)\n- Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)\n- Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)\n- Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)\n- Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)\n- Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)\n- Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)\n- Ctrl-] (Cmd-] on macOS): [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore)\n- Ctrl-Alt-\\\\ (Cmd-Alt-\\\\ on macOS): [`indentSelection`](https://codemirror.net/6/docs/ref/#commands.indentSelection)\n- Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)\n- Shift-Ctrl-\\\\ (Shift-Cmd-\\\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)\n- Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).\n- Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).\n- Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).\n*/\nconst defaultKeymap = /*@__PURE__*/[{\n key: \"Alt-ArrowLeft\",\n mac: \"Ctrl-ArrowLeft\",\n run: cursorSyntaxLeft,\n shift: selectSyntaxLeft\n}, {\n key: \"Alt-ArrowRight\",\n mac: \"Ctrl-ArrowRight\",\n run: cursorSyntaxRight,\n shift: selectSyntaxRight\n}, {\n key: \"Alt-ArrowUp\",\n run: moveLineUp\n}, {\n key: \"Shift-Alt-ArrowUp\",\n run: copyLineUp\n}, {\n key: \"Alt-ArrowDown\",\n run: moveLineDown\n}, {\n key: \"Shift-Alt-ArrowDown\",\n run: copyLineDown\n}, {\n key: \"Escape\",\n run: simplifySelection\n}, {\n key: \"Mod-Enter\",\n run: insertBlankLine\n}, {\n key: \"Alt-l\",\n mac: \"Ctrl-l\",\n run: selectLine\n}, {\n key: \"Mod-i\",\n run: selectParentSyntax,\n preventDefault: true\n}, {\n key: \"Mod-[\",\n run: indentLess\n}, {\n key: \"Mod-]\",\n run: indentMore\n}, {\n key: \"Mod-Alt-\\\\\",\n run: indentSelection\n}, {\n key: \"Shift-Mod-k\",\n run: deleteLine\n}, {\n key: \"Shift-Mod-\\\\\",\n run: cursorMatchingBracket\n}, {\n key: \"Mod-/\",\n run: toggleComment\n}, {\n key: \"Alt-A\",\n run: toggleBlockComment\n}, {\n key: \"Ctrl-m\",\n mac: \"Shift-Alt-m\",\n run: toggleTabFocusMode\n}].concat(standardKeymap);\n/**\nA binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and\nShift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).\nPlease see the [Tab example](../../examples/tab/) before using\nthis.\n*/\nconst indentWithTab = {\n key: \"Tab\",\n run: indentMore,\n shift: indentLess\n};\nexport { blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharForward, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, defaultKeymap, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, history, historyField, historyKeymap, indentLess, indentMore, indentSelection, indentWithTab, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharForward, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection };","import { EditorView } from '@codemirror/view';\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags } from '@lezer/highlight';\n\n// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors\nconst chalky = \"#e5c07b\",\n coral = \"#e06c75\",\n cyan = \"#56b6c2\",\n invalid = \"#ffffff\",\n ivory = \"#abb2bf\",\n stone = \"#7d8799\",\n // Brightened compared to original to increase contrast\n malibu = \"#61afef\",\n sage = \"#98c379\",\n whiskey = \"#d19a66\",\n violet = \"#c678dd\",\n darkBackground = \"#21252b\",\n highlightBackground = \"#2c313a\",\n background = \"#282c34\",\n tooltipBackground = \"#353a42\",\n selection = \"#3E4451\",\n cursor = \"#528bff\";\n/**\nThe colors used in the theme, as CSS color strings.\n*/\nconst color = {\n chalky,\n coral,\n cyan,\n invalid,\n ivory,\n stone,\n malibu,\n sage,\n whiskey,\n violet,\n darkBackground,\n highlightBackground,\n background,\n tooltipBackground,\n selection,\n cursor\n};\n/**\nThe editor theme styles for One Dark.\n*/\nconst oneDarkTheme = /*@__PURE__*/EditorView.theme({\n \"&\": {\n color: ivory,\n backgroundColor: background\n },\n \".cm-content\": {\n caretColor: cursor\n },\n \".cm-cursor, .cm-dropCursor\": {\n borderLeftColor: cursor\n },\n \"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\": {\n backgroundColor: selection\n },\n \".cm-panels\": {\n backgroundColor: darkBackground,\n color: ivory\n },\n \".cm-panels.cm-panels-top\": {\n borderBottom: \"2px solid black\"\n },\n \".cm-panels.cm-panels-bottom\": {\n borderTop: \"2px solid black\"\n },\n \".cm-searchMatch\": {\n backgroundColor: \"#72a1ff59\",\n outline: \"1px solid #457dff\"\n },\n \".cm-searchMatch.cm-searchMatch-selected\": {\n backgroundColor: \"#6199ff2f\"\n },\n \".cm-activeLine\": {\n backgroundColor: \"#6699ff0b\"\n },\n \".cm-selectionMatch\": {\n backgroundColor: \"#aafe661a\"\n },\n \"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\": {\n backgroundColor: \"#bad0f847\"\n },\n \".cm-gutters\": {\n backgroundColor: background,\n color: stone,\n border: \"none\"\n },\n \".cm-activeLineGutter\": {\n backgroundColor: highlightBackground\n },\n \".cm-foldPlaceholder\": {\n backgroundColor: \"transparent\",\n border: \"none\",\n color: \"#ddd\"\n },\n \".cm-tooltip\": {\n border: \"none\",\n backgroundColor: tooltipBackground\n },\n \".cm-tooltip .cm-tooltip-arrow:before\": {\n borderTopColor: \"transparent\",\n borderBottomColor: \"transparent\"\n },\n \".cm-tooltip .cm-tooltip-arrow:after\": {\n borderTopColor: tooltipBackground,\n borderBottomColor: tooltipBackground\n },\n \".cm-tooltip-autocomplete\": {\n \"& > ul > li[aria-selected]\": {\n backgroundColor: highlightBackground,\n color: ivory\n }\n }\n}, {\n dark: true\n});\n/**\nThe highlighting style for code in the One Dark theme.\n*/\nconst oneDarkHighlightStyle = /*@__PURE__*/HighlightStyle.define([{\n tag: tags.keyword,\n color: violet\n}, {\n tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName],\n color: coral\n}, {\n tag: [/*@__PURE__*/tags.function(tags.variableName), tags.labelName],\n color: malibu\n}, {\n tag: [tags.color, /*@__PURE__*/tags.constant(tags.name), /*@__PURE__*/tags.standard(tags.name)],\n color: whiskey\n}, {\n tag: [/*@__PURE__*/tags.definition(tags.name), tags.separator],\n color: ivory\n}, {\n tag: [tags.typeName, tags.className, tags.number, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace],\n color: chalky\n}, {\n tag: [tags.operator, tags.operatorKeyword, tags.url, tags.escape, tags.regexp, tags.link, /*@__PURE__*/tags.special(tags.string)],\n color: cyan\n}, {\n tag: [tags.meta, tags.comment],\n color: stone\n}, {\n tag: tags.strong,\n fontWeight: \"bold\"\n}, {\n tag: tags.emphasis,\n fontStyle: \"italic\"\n}, {\n tag: tags.strikethrough,\n textDecoration: \"line-through\"\n}, {\n tag: tags.link,\n color: stone,\n textDecoration: \"underline\"\n}, {\n tag: tags.heading,\n fontWeight: \"bold\",\n color: coral\n}, {\n tag: [tags.atom, tags.bool, /*@__PURE__*/tags.special(tags.variableName)],\n color: whiskey\n}, {\n tag: [tags.processingInstruction, tags.string, tags.inserted],\n color: sage\n}, {\n tag: tags.invalid,\n color: invalid\n}]);\n/**\nExtension to enable the One Dark theme (both the editor theme and\nthe highlight style).\n*/\nconst oneDark = [oneDarkTheme, /*@__PURE__*/syntaxHighlighting(oneDarkHighlightStyle)];\nexport { color, oneDark, oneDarkHighlightStyle, oneDarkTheme };","export default function crelt() {\n var elt = arguments[0];\n if (typeof elt == \"string\") elt = document.createElement(elt);\n var i = 1,\n next = arguments[1];\n if (next && typeof next == \"object\" && next.nodeType == null && !Array.isArray(next)) {\n for (var name in next) if (Object.prototype.hasOwnProperty.call(next, name)) {\n var value = next[name];\n if (typeof value == \"string\") elt.setAttribute(name, value);else if (value != null) elt[name] = value;\n }\n i++;\n }\n for (; i < arguments.length; i++) add(elt, arguments[i]);\n return elt;\n}\nfunction add(elt, child) {\n if (typeof child == \"string\") {\n elt.appendChild(document.createTextNode(child));\n } else if (child == null) {} else if (child.nodeType != null) {\n elt.appendChild(child);\n } else if (Array.isArray(child)) {\n for (var i = 0; i < child.length; i++) add(elt, child[i]);\n } else {\n throw new RangeError(\"Unsupported child node: \" + child);\n }\n}","import { showPanel, EditorView, getPanel, Decoration, ViewPlugin, runScopeHandlers } from '@codemirror/view';\nimport { codePointAt, fromCodePoint, codePointSize, StateEffect, StateField, EditorSelection, Facet, combineConfig, CharCategory, RangeSetBuilder, Prec, EditorState, findClusterBreak } from '@codemirror/state';\nimport elt from 'crelt';\nconst basicNormalize = typeof String.prototype.normalize == \"function\" ? x => x.normalize(\"NFKD\") : x => x;\n/**\nA search cursor provides an iterator over text matches in a\ndocument.\n*/\nclass SearchCursor {\n /**\n Create a text cursor. The query is the search string, `from` to\n `to` provides the region to search.\n \n When `normalize` is given, it will be called, on both the query\n string and the content it is matched against, before comparing.\n You can, for example, create a case-insensitive search by\n passing `s => s.toLowerCase()`.\n \n Text is always normalized with\n [`.normalize(\"NFKD\")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)\n (when supported).\n */\n constructor(text, query, from = 0, to = text.length, normalize, test) {\n this.test = test;\n /**\n The current match (only holds a meaningful value after\n [`next`](https://codemirror.net/6/docs/ref/#search.SearchCursor.next) has been called and when\n `done` is false).\n */\n this.value = {\n from: 0,\n to: 0\n };\n /**\n Whether the end of the iterated region has been reached.\n */\n this.done = false;\n this.matches = [];\n this.buffer = \"\";\n this.bufferPos = 0;\n this.iter = text.iterRange(from, to);\n this.bufferStart = from;\n this.normalize = normalize ? x => normalize(basicNormalize(x)) : basicNormalize;\n this.query = this.normalize(query);\n }\n peek() {\n if (this.bufferPos == this.buffer.length) {\n this.bufferStart += this.buffer.length;\n this.iter.next();\n if (this.iter.done) return -1;\n this.bufferPos = 0;\n this.buffer = this.iter.value;\n }\n return codePointAt(this.buffer, this.bufferPos);\n }\n /**\n Look for the next match. Updates the iterator's\n [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and\n [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called\n at least once before using the cursor.\n */\n next() {\n while (this.matches.length) this.matches.pop();\n return this.nextOverlapping();\n }\n /**\n The `next` method will ignore matches that partially overlap a\n previous match. This method behaves like `next`, but includes\n such matches.\n */\n nextOverlapping() {\n for (;;) {\n let next = this.peek();\n if (next < 0) {\n this.done = true;\n return this;\n }\n let str = fromCodePoint(next),\n start = this.bufferStart + this.bufferPos;\n this.bufferPos += codePointSize(next);\n let norm = this.normalize(str);\n for (let i = 0, pos = start;; i++) {\n let code = norm.charCodeAt(i);\n let match = this.match(code, pos, this.bufferPos + this.bufferStart);\n if (i == norm.length - 1) {\n if (match) {\n this.value = match;\n return this;\n }\n break;\n }\n if (pos == start && i < str.length && str.charCodeAt(i) == code) pos++;\n }\n }\n }\n match(code, pos, end) {\n let match = null;\n for (let i = 0; i < this.matches.length; i += 2) {\n let index = this.matches[i],\n keep = false;\n if (this.query.charCodeAt(index) == code) {\n if (index == this.query.length - 1) {\n match = {\n from: this.matches[i + 1],\n to: end\n };\n } else {\n this.matches[i]++;\n keep = true;\n }\n }\n if (!keep) {\n this.matches.splice(i, 2);\n i -= 2;\n }\n }\n if (this.query.charCodeAt(0) == code) {\n if (this.query.length == 1) match = {\n from: pos,\n to: end\n };else this.matches.push(1, pos);\n }\n if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferStart)) match = null;\n return match;\n }\n}\nif (typeof Symbol != \"undefined\") SearchCursor.prototype[Symbol.iterator] = function () {\n return this;\n};\nconst empty = {\n from: -1,\n to: -1,\n match: /*@__PURE__*//.*/.exec(\"\")\n};\nconst baseFlags = \"gm\" + (/x/.unicode == null ? \"\" : \"u\");\n/**\nThis class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)\nbut searches for a regular expression pattern instead of a plain\nstring.\n*/\nclass RegExpCursor {\n /**\n Create a cursor that will search the given range in the given\n document. `query` should be the raw pattern (as you'd pass it to\n `new RegExp`).\n */\n constructor(text, query, options, from = 0, to = text.length) {\n this.text = text;\n this.to = to;\n this.curLine = \"\";\n /**\n Set to `true` when the cursor has reached the end of the search\n range.\n */\n this.done = false;\n /**\n Will contain an object with the extent of the match and the\n match object when [`next`](https://codemirror.net/6/docs/ref/#search.RegExpCursor.next)\n sucessfully finds a match.\n */\n this.value = empty;\n if (/\\\\[sWDnr]|\\n|\\r|\\[\\^/.test(query)) return new MultilineRegExpCursor(text, query, options, from, to);\n this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? \"i\" : \"\"));\n this.test = options === null || options === void 0 ? void 0 : options.test;\n this.iter = text.iter();\n let startLine = text.lineAt(from);\n this.curLineStart = startLine.from;\n this.matchPos = toCharEnd(text, from);\n this.getLine(this.curLineStart);\n }\n getLine(skip) {\n this.iter.next(skip);\n if (this.iter.lineBreak) {\n this.curLine = \"\";\n } else {\n this.curLine = this.iter.value;\n if (this.curLineStart + this.curLine.length > this.to) this.curLine = this.curLine.slice(0, this.to - this.curLineStart);\n this.iter.next();\n }\n }\n nextLine() {\n this.curLineStart = this.curLineStart + this.curLine.length + 1;\n if (this.curLineStart > this.to) this.curLine = \"\";else this.getLine(0);\n }\n /**\n Move to the next match, if there is one.\n */\n next() {\n for (let off = this.matchPos - this.curLineStart;;) {\n this.re.lastIndex = off;\n let match = this.matchPos <= this.to && this.re.exec(this.curLine);\n if (match) {\n let from = this.curLineStart + match.index,\n to = from + match[0].length;\n this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));\n if (from == this.curLineStart + this.curLine.length) this.nextLine();\n if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {\n this.value = {\n from,\n to,\n match\n };\n return this;\n }\n off = this.matchPos - this.curLineStart;\n } else if (this.curLineStart + this.curLine.length < this.to) {\n this.nextLine();\n off = 0;\n } else {\n this.done = true;\n return this;\n }\n }\n }\n}\nconst flattened = /*@__PURE__*/new WeakMap();\n// Reusable (partially) flattened document strings\nclass FlattenedDoc {\n constructor(from, text) {\n this.from = from;\n this.text = text;\n }\n get to() {\n return this.from + this.text.length;\n }\n static get(doc, from, to) {\n let cached = flattened.get(doc);\n if (!cached || cached.from >= to || cached.to <= from) {\n let flat = new FlattenedDoc(from, doc.sliceString(from, to));\n flattened.set(doc, flat);\n return flat;\n }\n if (cached.from == from && cached.to == to) return cached;\n let {\n text,\n from: cachedFrom\n } = cached;\n if (cachedFrom > from) {\n text = doc.sliceString(from, cachedFrom) + text;\n cachedFrom = from;\n }\n if (cached.to < to) text += doc.sliceString(cached.to, to);\n flattened.set(doc, new FlattenedDoc(cachedFrom, text));\n return new FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom));\n }\n}\nclass MultilineRegExpCursor {\n constructor(text, query, options, from, to) {\n this.text = text;\n this.to = to;\n this.done = false;\n this.value = empty;\n this.matchPos = toCharEnd(text, from);\n this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? \"i\" : \"\"));\n this.test = options === null || options === void 0 ? void 0 : options.test;\n this.flat = FlattenedDoc.get(text, from, this.chunkEnd(from + 5000 /* Chunk.Base */));\n }\n chunkEnd(pos) {\n return pos >= this.to ? this.to : this.text.lineAt(pos).to;\n }\n next() {\n for (;;) {\n let off = this.re.lastIndex = this.matchPos - this.flat.from;\n let match = this.re.exec(this.flat.text);\n // Skip empty matches directly after the last match\n if (match && !match[0] && match.index == off) {\n this.re.lastIndex = off + 1;\n match = this.re.exec(this.flat.text);\n }\n if (match) {\n let from = this.flat.from + match.index,\n to = from + match[0].length;\n // If a match goes almost to the end of a noncomplete chunk, try\n // again, since it'll likely be able to match more\n if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) && (!this.test || this.test(from, to, match))) {\n this.value = {\n from,\n to,\n match\n };\n this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));\n return this;\n }\n }\n if (this.flat.to == this.to) {\n this.done = true;\n return this;\n }\n // Grow the flattened doc\n this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));\n }\n }\n}\nif (typeof Symbol != \"undefined\") {\n RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = function () {\n return this;\n };\n}\nfunction validRegExp(source) {\n try {\n new RegExp(source, baseFlags);\n return true;\n } catch (_a) {\n return false;\n }\n}\nfunction toCharEnd(text, pos) {\n if (pos >= text.length) return pos;\n let line = text.lineAt(pos),\n next;\n while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 0xDC00 && next < 0xE000) pos++;\n return pos;\n}\nfunction createLineDialog(view) {\n let line = String(view.state.doc.lineAt(view.state.selection.main.head).number);\n let input = elt(\"input\", {\n class: \"cm-textfield\",\n name: \"line\",\n value: line\n });\n let dom = elt(\"form\", {\n class: \"cm-gotoLine\",\n onkeydown: event => {\n if (event.keyCode == 27) {\n // Escape\n event.preventDefault();\n view.dispatch({\n effects: dialogEffect.of(false)\n });\n view.focus();\n } else if (event.keyCode == 13) {\n // Enter\n event.preventDefault();\n go();\n }\n },\n onsubmit: event => {\n event.preventDefault();\n go();\n }\n }, elt(\"label\", view.state.phrase(\"Go to line\"), \": \", input), \" \", elt(\"button\", {\n class: \"cm-button\",\n type: \"submit\"\n }, view.state.phrase(\"go\")));\n function go() {\n let match = /^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(input.value);\n if (!match) return;\n let {\n state\n } = view,\n startLine = state.doc.lineAt(state.selection.main.head);\n let [, sign, ln, cl, percent] = match;\n let col = cl ? +cl.slice(1) : 0;\n let line = ln ? +ln : startLine.number;\n if (ln && percent) {\n let pc = line / 100;\n if (sign) pc = pc * (sign == \"-\" ? -1 : 1) + startLine.number / state.doc.lines;\n line = Math.round(state.doc.lines * pc);\n } else if (ln && sign) {\n line = line * (sign == \"-\" ? -1 : 1) + startLine.number;\n }\n let docLine = state.doc.line(Math.max(1, Math.min(state.doc.lines, line)));\n let selection = EditorSelection.cursor(docLine.from + Math.max(0, Math.min(col, docLine.length)));\n view.dispatch({\n effects: [dialogEffect.of(false), EditorView.scrollIntoView(selection.from, {\n y: 'center'\n })],\n selection\n });\n view.focus();\n }\n return {\n dom\n };\n}\nconst dialogEffect = /*@__PURE__*/StateEffect.define();\nconst dialogField = /*@__PURE__*/StateField.define({\n create() {\n return true;\n },\n update(value, tr) {\n for (let e of tr.effects) if (e.is(dialogEffect)) value = e.value;\n return value;\n },\n provide: f => showPanel.from(f, val => val ? createLineDialog : null)\n});\n/**\nCommand that shows a dialog asking the user for a line number, and\nwhen a valid position is provided, moves the cursor to that line.\n\nSupports line numbers, relative line offsets prefixed with `+` or\n`-`, document percentages suffixed with `%`, and an optional\ncolumn position by adding `:` and a second number after the line\nnumber.\n*/\nconst gotoLine = view => {\n let panel = getPanel(view, createLineDialog);\n if (!panel) {\n let effects = [dialogEffect.of(true)];\n if (view.state.field(dialogField, false) == null) effects.push(StateEffect.appendConfig.of([dialogField, baseTheme$1]));\n view.dispatch({\n effects\n });\n panel = getPanel(view, createLineDialog);\n }\n if (panel) panel.dom.querySelector(\"input\").select();\n return true;\n};\nconst baseTheme$1 = /*@__PURE__*/EditorView.baseTheme({\n \".cm-panel.cm-gotoLine\": {\n padding: \"2px 6px 4px\",\n \"& label\": {\n fontSize: \"80%\"\n }\n }\n});\nconst defaultHighlightOptions = {\n highlightWordAroundCursor: false,\n minSelectionLength: 1,\n maxMatches: 100,\n wholeWords: false\n};\nconst highlightConfig = /*@__PURE__*/Facet.define({\n combine(options) {\n return combineConfig(options, defaultHighlightOptions, {\n highlightWordAroundCursor: (a, b) => a || b,\n minSelectionLength: Math.min,\n maxMatches: Math.min\n });\n }\n});\n/**\nThis extension highlights text that matches the selection. It uses\nthe `\"cm-selectionMatch\"` class for the highlighting. When\n`highlightWordAroundCursor` is enabled, the word at the cursor\nitself will be highlighted with `\"cm-selectionMatch-main\"`.\n*/\nfunction highlightSelectionMatches(options) {\n let ext = [defaultTheme, matchHighlighter];\n if (options) ext.push(highlightConfig.of(options));\n return ext;\n}\nconst matchDeco = /*@__PURE__*/Decoration.mark({\n class: \"cm-selectionMatch\"\n});\nconst mainMatchDeco = /*@__PURE__*/Decoration.mark({\n class: \"cm-selectionMatch cm-selectionMatch-main\"\n});\n// Whether the characters directly outside the given positions are non-word characters\nfunction insideWordBoundaries(check, state, from, to) {\n return (from == 0 || check(state.sliceDoc(from - 1, from)) != CharCategory.Word) && (to == state.doc.length || check(state.sliceDoc(to, to + 1)) != CharCategory.Word);\n}\n// Whether the characters directly at the given positions are word characters\nfunction insideWord(check, state, from, to) {\n return check(state.sliceDoc(from, from + 1)) == CharCategory.Word && check(state.sliceDoc(to - 1, to)) == CharCategory.Word;\n}\nconst matchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.decorations = this.getDeco(view);\n }\n update(update) {\n if (update.selectionSet || update.docChanged || update.viewportChanged) this.decorations = this.getDeco(update.view);\n }\n getDeco(view) {\n let conf = view.state.facet(highlightConfig);\n let {\n state\n } = view,\n sel = state.selection;\n if (sel.ranges.length > 1) return Decoration.none;\n let range = sel.main,\n query,\n check = null;\n if (range.empty) {\n if (!conf.highlightWordAroundCursor) return Decoration.none;\n let word = state.wordAt(range.head);\n if (!word) return Decoration.none;\n check = state.charCategorizer(range.head);\n query = state.sliceDoc(word.from, word.to);\n } else {\n let len = range.to - range.from;\n if (len < conf.minSelectionLength || len > 200) return Decoration.none;\n if (conf.wholeWords) {\n query = state.sliceDoc(range.from, range.to); // TODO: allow and include leading/trailing space?\n check = state.charCategorizer(range.head);\n if (!(insideWordBoundaries(check, state, range.from, range.to) && insideWord(check, state, range.from, range.to))) return Decoration.none;\n } else {\n query = state.sliceDoc(range.from, range.to);\n if (!query) return Decoration.none;\n }\n }\n let deco = [];\n for (let part of view.visibleRanges) {\n let cursor = new SearchCursor(state.doc, query, part.from, part.to);\n while (!cursor.next().done) {\n let {\n from,\n to\n } = cursor.value;\n if (!check || insideWordBoundaries(check, state, from, to)) {\n if (range.empty && from <= range.from && to >= range.to) deco.push(mainMatchDeco.range(from, to));else if (from >= range.to || to <= range.from) deco.push(matchDeco.range(from, to));\n if (deco.length > conf.maxMatches) return Decoration.none;\n }\n }\n }\n return Decoration.set(deco);\n }\n}, {\n decorations: v => v.decorations\n});\nconst defaultTheme = /*@__PURE__*/EditorView.baseTheme({\n \".cm-selectionMatch\": {\n backgroundColor: \"#99ff7780\"\n },\n \".cm-searchMatch .cm-selectionMatch\": {\n backgroundColor: \"transparent\"\n }\n});\n// Select the words around the cursors.\nconst selectWord = ({\n state,\n dispatch\n}) => {\n let {\n selection\n } = state;\n let newSel = EditorSelection.create(selection.ranges.map(range => state.wordAt(range.head) || EditorSelection.cursor(range.head)), selection.mainIndex);\n if (newSel.eq(selection)) return false;\n dispatch(state.update({\n selection: newSel\n }));\n return true;\n};\n// Find next occurrence of query relative to last cursor. Wrap around\n// the document if there are no more matches.\nfunction findNextOccurrence(state, query) {\n let {\n main,\n ranges\n } = state.selection;\n let word = state.wordAt(main.head),\n fullWord = word && word.from == main.from && word.to == main.to;\n for (let cycled = false, cursor = new SearchCursor(state.doc, query, ranges[ranges.length - 1].to);;) {\n cursor.next();\n if (cursor.done) {\n if (cycled) return null;\n cursor = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));\n cycled = true;\n } else {\n if (cycled && ranges.some(r => r.from == cursor.value.from)) continue;\n if (fullWord) {\n let word = state.wordAt(cursor.value.from);\n if (!word || word.from != cursor.value.from || word.to != cursor.value.to) continue;\n }\n return cursor.value;\n }\n }\n}\n/**\nSelect next occurrence of the current selection. Expand selection\nto the surrounding word when the selection is empty.\n*/\nconst selectNextOccurrence = ({\n state,\n dispatch\n}) => {\n let {\n ranges\n } = state.selection;\n if (ranges.some(sel => sel.from === sel.to)) return selectWord({\n state,\n dispatch\n });\n let searchedText = state.sliceDoc(ranges[0].from, ranges[0].to);\n if (state.selection.ranges.some(r => state.sliceDoc(r.from, r.to) != searchedText)) return false;\n let range = findNextOccurrence(state, searchedText);\n if (!range) return false;\n dispatch(state.update({\n selection: state.selection.addRange(EditorSelection.range(range.from, range.to), false),\n effects: EditorView.scrollIntoView(range.to)\n }));\n return true;\n};\nconst searchConfigFacet = /*@__PURE__*/Facet.define({\n combine(configs) {\n return combineConfig(configs, {\n top: false,\n caseSensitive: false,\n literal: false,\n regexp: false,\n wholeWord: false,\n createPanel: view => new SearchPanel(view),\n scrollToMatch: range => EditorView.scrollIntoView(range)\n });\n }\n});\n/**\nAdd search state to the editor configuration, and optionally\nconfigure the search extension.\n([`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) will automatically\nenable this if it isn't already on).\n*/\nfunction search(config) {\n return config ? [searchConfigFacet.of(config), searchExtensions] : searchExtensions;\n}\n/**\nA search query. Part of the editor's search state.\n*/\nclass SearchQuery {\n /**\n Create a query object.\n */\n constructor(config) {\n this.search = config.search;\n this.caseSensitive = !!config.caseSensitive;\n this.literal = !!config.literal;\n this.regexp = !!config.regexp;\n this.replace = config.replace || \"\";\n this.valid = !!this.search && (!this.regexp || validRegExp(this.search));\n this.unquoted = this.unquote(this.search);\n this.wholeWord = !!config.wholeWord;\n }\n /**\n @internal\n */\n unquote(text) {\n return this.literal ? text : text.replace(/\\\\([nrt\\\\])/g, (_, ch) => ch == \"n\" ? \"\\n\" : ch == \"r\" ? \"\\r\" : ch == \"t\" ? \"\\t\" : \"\\\\\");\n }\n /**\n Compare this query to another query.\n */\n eq(other) {\n return this.search == other.search && this.replace == other.replace && this.caseSensitive == other.caseSensitive && this.regexp == other.regexp && this.wholeWord == other.wholeWord;\n }\n /**\n @internal\n */\n create() {\n return this.regexp ? new RegExpQuery(this) : new StringQuery(this);\n }\n /**\n Get a search cursor for this query, searching through the given\n range in the given state.\n */\n getCursor(state, from = 0, to) {\n let st = state.doc ? state : EditorState.create({\n doc: state\n });\n if (to == null) to = st.doc.length;\n return this.regexp ? regexpCursor(this, st, from, to) : stringCursor(this, st, from, to);\n }\n}\nclass QueryType {\n constructor(spec) {\n this.spec = spec;\n }\n}\nfunction stringCursor(spec, state, from, to) {\n return new SearchCursor(state.doc, spec.unquoted, from, to, spec.caseSensitive ? undefined : x => x.toLowerCase(), spec.wholeWord ? stringWordTest(state.doc, state.charCategorizer(state.selection.main.head)) : undefined);\n}\nfunction stringWordTest(doc, categorizer) {\n return (from, to, buf, bufPos) => {\n if (bufPos > from || bufPos + buf.length < to) {\n bufPos = Math.max(0, from - 2);\n buf = doc.sliceString(bufPos, Math.min(doc.length, to + 2));\n }\n 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);\n };\n}\nclass StringQuery extends QueryType {\n constructor(spec) {\n super(spec);\n }\n nextMatch(state, curFrom, curTo) {\n let cursor = stringCursor(this.spec, state, curTo, state.doc.length).nextOverlapping();\n if (cursor.done) cursor = stringCursor(this.spec, state, 0, curFrom).nextOverlapping();\n return cursor.done ? null : cursor.value;\n }\n // Searching in reverse is, rather than implementing an inverted search\n // cursor, done by scanning chunk after chunk forward.\n prevMatchInRange(state, from, to) {\n for (let pos = to;;) {\n let start = Math.max(from, pos - 10000 /* FindPrev.ChunkSize */ - this.spec.unquoted.length);\n let cursor = stringCursor(this.spec, state, start, pos),\n range = null;\n while (!cursor.nextOverlapping().done) range = cursor.value;\n if (range) return range;\n if (start == from) return null;\n pos -= 10000 /* FindPrev.ChunkSize */;\n }\n }\n prevMatch(state, curFrom, curTo) {\n return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length);\n }\n getReplacement(_result) {\n return this.spec.unquote(this.spec.replace);\n }\n matchAll(state, limit) {\n let cursor = stringCursor(this.spec, state, 0, state.doc.length),\n ranges = [];\n while (!cursor.next().done) {\n if (ranges.length >= limit) return null;\n ranges.push(cursor.value);\n }\n return ranges;\n }\n highlight(state, from, to, add) {\n let cursor = stringCursor(this.spec, state, Math.max(0, from - this.spec.unquoted.length), Math.min(to + this.spec.unquoted.length, state.doc.length));\n while (!cursor.next().done) add(cursor.value.from, cursor.value.to);\n }\n}\nfunction regexpCursor(spec, state, from, to) {\n return new RegExpCursor(state.doc, spec.search, {\n ignoreCase: !spec.caseSensitive,\n test: spec.wholeWord ? regexpWordTest(state.charCategorizer(state.selection.main.head)) : undefined\n }, from, to);\n}\nfunction charBefore(str, index) {\n return str.slice(findClusterBreak(str, index, false), index);\n}\nfunction charAfter(str, index) {\n return str.slice(index, findClusterBreak(str, index));\n}\nfunction regexpWordTest(categorizer) {\n 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);\n}\nclass RegExpQuery extends QueryType {\n nextMatch(state, curFrom, curTo) {\n let cursor = regexpCursor(this.spec, state, curTo, state.doc.length).next();\n if (cursor.done) cursor = regexpCursor(this.spec, state, 0, curFrom).next();\n return cursor.done ? null : cursor.value;\n }\n prevMatchInRange(state, from, to) {\n for (let size = 1;; size++) {\n let start = Math.max(from, to - size * 10000 /* FindPrev.ChunkSize */);\n let cursor = regexpCursor(this.spec, state, start, to),\n range = null;\n while (!cursor.next().done) range = cursor.value;\n if (range && (start == from || range.from > start + 10)) return range;\n if (start == from) return null;\n }\n }\n prevMatch(state, curFrom, curTo) {\n return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length);\n }\n getReplacement(result) {\n return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g, (m, i) => i == \"$\" ? \"$\" : i == \"&\" ? result.match[0] : i != \"0\" && +i < result.match.length ? result.match[i] : m);\n }\n matchAll(state, limit) {\n let cursor = regexpCursor(this.spec, state, 0, state.doc.length),\n ranges = [];\n while (!cursor.next().done) {\n if (ranges.length >= limit) return null;\n ranges.push(cursor.value);\n }\n return ranges;\n }\n highlight(state, from, to, add) {\n let cursor = regexpCursor(this.spec, state, Math.max(0, from - 250 /* RegExp.HighlightMargin */), Math.min(to + 250 /* RegExp.HighlightMargin */, state.doc.length));\n while (!cursor.next().done) add(cursor.value.from, cursor.value.to);\n }\n}\n/**\nA state effect that updates the current search query. Note that\nthis only has an effect if the search state has been initialized\n(by including [`search`](https://codemirror.net/6/docs/ref/#search.search) in your configuration or\nby running [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) at least\nonce).\n*/\nconst setSearchQuery = /*@__PURE__*/StateEffect.define();\nconst togglePanel = /*@__PURE__*/StateEffect.define();\nconst searchState = /*@__PURE__*/StateField.define({\n create(state) {\n return new SearchState(defaultQuery(state).create(), null);\n },\n update(value, tr) {\n for (let effect of tr.effects) {\n if (effect.is(setSearchQuery)) value = new SearchState(effect.value.create(), value.panel);else if (effect.is(togglePanel)) value = new SearchState(value.query, effect.value ? createSearchPanel : null);\n }\n return value;\n },\n provide: f => showPanel.from(f, val => val.panel)\n});\n/**\nGet the current search query from an editor state.\n*/\nfunction getSearchQuery(state) {\n let curState = state.field(searchState, false);\n return curState ? curState.query.spec : defaultQuery(state);\n}\n/**\nQuery whether the search panel is open in the given editor state.\n*/\nfunction searchPanelOpen(state) {\n var _a;\n return ((_a = state.field(searchState, false)) === null || _a === void 0 ? void 0 : _a.panel) != null;\n}\nclass SearchState {\n constructor(query, panel) {\n this.query = query;\n this.panel = panel;\n }\n}\nconst matchMark = /*@__PURE__*/Decoration.mark({\n class: \"cm-searchMatch\"\n }),\n selectedMatchMark = /*@__PURE__*/Decoration.mark({\n class: \"cm-searchMatch cm-searchMatch-selected\"\n });\nconst searchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.decorations = this.highlight(view.state.field(searchState));\n }\n update(update) {\n let state = update.state.field(searchState);\n if (state != update.startState.field(searchState) || update.docChanged || update.selectionSet || update.viewportChanged) this.decorations = this.highlight(state);\n }\n highlight({\n query,\n panel\n }) {\n if (!panel || !query.spec.valid) return Decoration.none;\n let {\n view\n } = this;\n let builder = new RangeSetBuilder();\n for (let i = 0, ranges = view.visibleRanges, l = ranges.length; i < l; i++) {\n let {\n from,\n to\n } = ranges[i];\n while (i < l - 1 && to > ranges[i + 1].from - 2 * 250 /* RegExp.HighlightMargin */) to = ranges[++i].to;\n query.highlight(view.state, from, to, (from, to) => {\n let selected = view.state.selection.ranges.some(r => r.from == from && r.to == to);\n builder.add(from, to, selected ? selectedMatchMark : matchMark);\n });\n }\n return builder.finish();\n }\n}, {\n decorations: v => v.decorations\n});\nfunction searchCommand(f) {\n return view => {\n let state = view.state.field(searchState, false);\n return state && state.query.spec.valid ? f(view, state) : openSearchPanel(view);\n };\n}\n/**\nOpen the search panel if it isn't already open, and move the\nselection to the first match after the current main selection.\nWill wrap around to the start of the document when it reaches the\nend.\n*/\nconst findNext = /*@__PURE__*/searchCommand((view, {\n query\n}) => {\n let {\n to\n } = view.state.selection.main;\n let next = query.nextMatch(view.state, to, to);\n if (!next) return false;\n let selection = EditorSelection.single(next.from, next.to);\n let config = view.state.facet(searchConfigFacet);\n view.dispatch({\n selection,\n effects: [announceMatch(view, next), config.scrollToMatch(selection.main, view)],\n userEvent: \"select.search\"\n });\n selectSearchInput(view);\n return true;\n});\n/**\nMove the selection to the previous instance of the search query,\nbefore the current main selection. Will wrap past the start\nof the document to start searching at the end again.\n*/\nconst findPrevious = /*@__PURE__*/searchCommand((view, {\n query\n}) => {\n let {\n state\n } = view,\n {\n from\n } = state.selection.main;\n let prev = query.prevMatch(state, from, from);\n if (!prev) return false;\n let selection = EditorSelection.single(prev.from, prev.to);\n let config = view.state.facet(searchConfigFacet);\n view.dispatch({\n selection,\n effects: [announceMatch(view, prev), config.scrollToMatch(selection.main, view)],\n userEvent: \"select.search\"\n });\n selectSearchInput(view);\n return true;\n});\n/**\nSelect all instances of the search query.\n*/\nconst selectMatches = /*@__PURE__*/searchCommand((view, {\n query\n}) => {\n let ranges = query.matchAll(view.state, 1000);\n if (!ranges || !ranges.length) return false;\n view.dispatch({\n selection: EditorSelection.create(ranges.map(r => EditorSelection.range(r.from, r.to))),\n userEvent: \"select.search.matches\"\n });\n return true;\n});\n/**\nSelect all instances of the currently selected text.\n*/\nconst selectSelectionMatches = ({\n state,\n dispatch\n}) => {\n let sel = state.selection;\n if (sel.ranges.length > 1 || sel.main.empty) return false;\n let {\n from,\n to\n } = sel.main;\n let ranges = [],\n main = 0;\n for (let cur = new SearchCursor(state.doc, state.sliceDoc(from, to)); !cur.next().done;) {\n if (ranges.length > 1000) return false;\n if (cur.value.from == from) main = ranges.length;\n ranges.push(EditorSelection.range(cur.value.from, cur.value.to));\n }\n dispatch(state.update({\n selection: EditorSelection.create(ranges, main),\n userEvent: \"select.search.matches\"\n }));\n return true;\n};\n/**\nReplace the current match of the search query.\n*/\nconst replaceNext = /*@__PURE__*/searchCommand((view, {\n query\n}) => {\n let {\n state\n } = view,\n {\n from,\n to\n } = state.selection.main;\n if (state.readOnly) return false;\n let next = query.nextMatch(state, from, from);\n if (!next) return false;\n let changes = [],\n selection,\n replacement;\n let effects = [];\n if (next.from == from && next.to == to) {\n replacement = state.toText(query.getReplacement(next));\n changes.push({\n from: next.from,\n to: next.to,\n insert: replacement\n });\n next = query.nextMatch(state, next.from, next.to);\n effects.push(EditorView.announce.of(state.phrase(\"replaced match on line $\", state.doc.lineAt(from).number) + \".\"));\n }\n if (next) {\n let off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length;\n selection = EditorSelection.single(next.from - off, next.to - off);\n effects.push(announceMatch(view, next));\n effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));\n }\n view.dispatch({\n changes,\n selection,\n effects,\n userEvent: \"input.replace\"\n });\n return true;\n});\n/**\nReplace all instances of the search query with the given\nreplacement.\n*/\nconst replaceAll = /*@__PURE__*/searchCommand((view, {\n query\n}) => {\n if (view.state.readOnly) return false;\n let changes = query.matchAll(view.state, 1e9).map(match => {\n let {\n from,\n to\n } = match;\n return {\n from,\n to,\n insert: query.getReplacement(match)\n };\n });\n if (!changes.length) return false;\n let announceText = view.state.phrase(\"replaced $ matches\", changes.length) + \".\";\n view.dispatch({\n changes,\n effects: EditorView.announce.of(announceText),\n userEvent: \"input.replace.all\"\n });\n return true;\n});\nfunction createSearchPanel(view) {\n return view.state.facet(searchConfigFacet).createPanel(view);\n}\nfunction defaultQuery(state, fallback) {\n var _a, _b, _c, _d, _e;\n let sel = state.selection.main;\n let selText = sel.empty || sel.to > sel.from + 100 ? \"\" : state.sliceDoc(sel.from, sel.to);\n if (fallback && !selText) return fallback;\n let config = state.facet(searchConfigFacet);\n return new SearchQuery({\n search: ((_a = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _a !== void 0 ? _a : config.literal) ? selText : selText.replace(/\\n/g, \"\\\\n\"),\n caseSensitive: (_b = fallback === null || fallback === void 0 ? void 0 : fallback.caseSensitive) !== null && _b !== void 0 ? _b : config.caseSensitive,\n literal: (_c = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _c !== void 0 ? _c : config.literal,\n regexp: (_d = fallback === null || fallback === void 0 ? void 0 : fallback.regexp) !== null && _d !== void 0 ? _d : config.regexp,\n wholeWord: (_e = fallback === null || fallback === void 0 ? void 0 : fallback.wholeWord) !== null && _e !== void 0 ? _e : config.wholeWord\n });\n}\nfunction getSearchInput(view) {\n let panel = getPanel(view, createSearchPanel);\n return panel && panel.dom.querySelector(\"[main-field]\");\n}\nfunction selectSearchInput(view) {\n let input = getSearchInput(view);\n if (input && input == view.root.activeElement) input.select();\n}\n/**\nMake sure the search panel is open and focused.\n*/\nconst openSearchPanel = view => {\n let state = view.state.field(searchState, false);\n if (state && state.panel) {\n let searchInput = getSearchInput(view);\n if (searchInput && searchInput != view.root.activeElement) {\n let query = defaultQuery(view.state, state.query.spec);\n if (query.valid) view.dispatch({\n effects: setSearchQuery.of(query)\n });\n searchInput.focus();\n searchInput.select();\n }\n } else {\n view.dispatch({\n effects: [togglePanel.of(true), state ? setSearchQuery.of(defaultQuery(view.state, state.query.spec)) : StateEffect.appendConfig.of(searchExtensions)]\n });\n }\n return true;\n};\n/**\nClose the search panel.\n*/\nconst closeSearchPanel = view => {\n let state = view.state.field(searchState, false);\n if (!state || !state.panel) return false;\n let panel = getPanel(view, createSearchPanel);\n if (panel && panel.dom.contains(view.root.activeElement)) view.focus();\n view.dispatch({\n effects: togglePanel.of(false)\n });\n return true;\n};\n/**\nDefault search-related key bindings.\n\n - Mod-f: [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel)\n - F3, Mod-g: [`findNext`](https://codemirror.net/6/docs/ref/#search.findNext)\n - Shift-F3, Shift-Mod-g: [`findPrevious`](https://codemirror.net/6/docs/ref/#search.findPrevious)\n - Mod-Alt-g: [`gotoLine`](https://codemirror.net/6/docs/ref/#search.gotoLine)\n - Mod-d: [`selectNextOccurrence`](https://codemirror.net/6/docs/ref/#search.selectNextOccurrence)\n*/\nconst searchKeymap = [{\n key: \"Mod-f\",\n run: openSearchPanel,\n scope: \"editor search-panel\"\n}, {\n key: \"F3\",\n run: findNext,\n shift: findPrevious,\n scope: \"editor search-panel\",\n preventDefault: true\n}, {\n key: \"Mod-g\",\n run: findNext,\n shift: findPrevious,\n scope: \"editor search-panel\",\n preventDefault: true\n}, {\n key: \"Escape\",\n run: closeSearchPanel,\n scope: \"editor search-panel\"\n}, {\n key: \"Mod-Shift-l\",\n run: selectSelectionMatches\n}, {\n key: \"Mod-Alt-g\",\n run: gotoLine\n}, {\n key: \"Mod-d\",\n run: selectNextOccurrence,\n preventDefault: true\n}];\nclass SearchPanel {\n constructor(view) {\n this.view = view;\n let query = this.query = view.state.field(searchState).query.spec;\n this.commit = this.commit.bind(this);\n this.searchField = elt(\"input\", {\n value: query.search,\n placeholder: phrase(view, \"Find\"),\n \"aria-label\": phrase(view, \"Find\"),\n class: \"cm-textfield\",\n name: \"search\",\n form: \"\",\n \"main-field\": \"true\",\n onchange: this.commit,\n onkeyup: this.commit\n });\n this.replaceField = elt(\"input\", {\n value: query.replace,\n placeholder: phrase(view, \"Replace\"),\n \"aria-label\": phrase(view, \"Replace\"),\n class: \"cm-textfield\",\n name: \"replace\",\n form: \"\",\n onchange: this.commit,\n onkeyup: this.commit\n });\n this.caseField = elt(\"input\", {\n type: \"checkbox\",\n name: \"case\",\n form: \"\",\n checked: query.caseSensitive,\n onchange: this.commit\n });\n this.reField = elt(\"input\", {\n type: \"checkbox\",\n name: \"re\",\n form: \"\",\n checked: query.regexp,\n onchange: this.commit\n });\n this.wordField = elt(\"input\", {\n type: \"checkbox\",\n name: \"word\",\n form: \"\",\n checked: query.wholeWord,\n onchange: this.commit\n });\n function button(name, onclick, content) {\n return elt(\"button\", {\n class: \"cm-button\",\n name,\n onclick,\n type: \"button\"\n }, content);\n }\n this.dom = elt(\"div\", {\n onkeydown: e => this.keydown(e),\n class: \"cm-search\"\n }, [this.searchField, button(\"next\", () => findNext(view), [phrase(view, \"next\")]), button(\"prev\", () => findPrevious(view), [phrase(view, \"previous\")]), button(\"select\", () => selectMatches(view), [phrase(view, \"all\")]), elt(\"label\", null, [this.caseField, phrase(view, \"match case\")]), elt(\"label\", null, [this.reField, phrase(view, \"regexp\")]), elt(\"label\", null, [this.wordField, phrase(view, \"by word\")]), ...(view.state.readOnly ? [] : [elt(\"br\"), this.replaceField, button(\"replace\", () => replaceNext(view), [phrase(view, \"replace\")]), button(\"replaceAll\", () => replaceAll(view), [phrase(view, \"replace all\")])]), elt(\"button\", {\n name: \"close\",\n onclick: () => closeSearchPanel(view),\n \"aria-label\": phrase(view, \"close\"),\n type: \"button\"\n }, [\"×\"])]);\n }\n commit() {\n let query = new SearchQuery({\n search: this.searchField.value,\n caseSensitive: this.caseField.checked,\n regexp: this.reField.checked,\n wholeWord: this.wordField.checked,\n replace: this.replaceField.value\n });\n if (!query.eq(this.query)) {\n this.query = query;\n this.view.dispatch({\n effects: setSearchQuery.of(query)\n });\n }\n }\n keydown(e) {\n if (runScopeHandlers(this.view, e, \"search-panel\")) {\n e.preventDefault();\n } else if (e.keyCode == 13 && e.target == this.searchField) {\n e.preventDefault();\n (e.shiftKey ? findPrevious : findNext)(this.view);\n } else if (e.keyCode == 13 && e.target == this.replaceField) {\n e.preventDefault();\n replaceNext(this.view);\n }\n }\n update(update) {\n for (let tr of update.transactions) for (let effect of tr.effects) {\n if (effect.is(setSearchQuery) && !effect.value.eq(this.query)) this.setQuery(effect.value);\n }\n }\n setQuery(query) {\n this.query = query;\n this.searchField.value = query.search;\n this.replaceField.value = query.replace;\n this.caseField.checked = query.caseSensitive;\n this.reField.checked = query.regexp;\n this.wordField.checked = query.wholeWord;\n }\n mount() {\n this.searchField.select();\n }\n get pos() {\n return 80;\n }\n get top() {\n return this.view.state.facet(searchConfigFacet).top;\n }\n}\nfunction phrase(view, phrase) {\n return view.state.phrase(phrase);\n}\nconst AnnounceMargin = 30;\nconst Break = /[\\s\\.,:;?!]/;\nfunction announceMatch(view, {\n from,\n to\n}) {\n let line = view.state.doc.lineAt(from),\n lineEnd = view.state.doc.lineAt(to).to;\n let start = Math.max(line.from, from - AnnounceMargin),\n end = Math.min(lineEnd, to + AnnounceMargin);\n let text = view.state.sliceDoc(start, end);\n if (start != line.from) {\n for (let i = 0; i < AnnounceMargin; i++) if (!Break.test(text[i + 1]) && Break.test(text[i])) {\n text = text.slice(i);\n break;\n }\n }\n if (end != lineEnd) {\n for (let i = text.length - 1; i > text.length - AnnounceMargin; i--) if (!Break.test(text[i - 1]) && Break.test(text[i])) {\n text = text.slice(0, i);\n break;\n }\n }\n return EditorView.announce.of(`${view.state.phrase(\"current match\")}. ${text} ${view.state.phrase(\"on line\")} ${line.number}.`);\n}\nconst baseTheme = /*@__PURE__*/EditorView.baseTheme({\n \".cm-panel.cm-search\": {\n padding: \"2px 6px 4px\",\n position: \"relative\",\n \"& [name=close]\": {\n position: \"absolute\",\n top: \"0\",\n right: \"4px\",\n backgroundColor: \"inherit\",\n border: \"none\",\n font: \"inherit\",\n padding: 0,\n margin: 0\n },\n \"& input, & button, & label\": {\n margin: \".2em .6em .2em 0\"\n },\n \"& input[type=checkbox]\": {\n marginRight: \".2em\"\n },\n \"& label\": {\n fontSize: \"80%\",\n whiteSpace: \"pre\"\n }\n },\n \"&light .cm-searchMatch\": {\n backgroundColor: \"#ffff0054\"\n },\n \"&dark .cm-searchMatch\": {\n backgroundColor: \"#00ffff8a\"\n },\n \"&light .cm-searchMatch-selected\": {\n backgroundColor: \"#ff6a0054\"\n },\n \"&dark .cm-searchMatch-selected\": {\n backgroundColor: \"#ff00ff8a\"\n }\n});\nconst searchExtensions = [searchState, /*@__PURE__*/Prec.low(searchHighlighter), baseTheme];\nexport { RegExpCursor, SearchCursor, SearchQuery, closeSearchPanel, findNext, findPrevious, getSearchQuery, gotoLine, highlightSelectionMatches, openSearchPanel, replaceAll, replaceNext, search, searchKeymap, searchPanelOpen, selectMatches, selectNextOccurrence, selectSelectionMatches, setSearchQuery };","import { Decoration, showPanel, EditorView, ViewPlugin, logException, gutter, showTooltip, hoverTooltip, getPanel, WidgetType, GutterMarker } from '@codemirror/view';\nimport { StateEffect, StateField, Facet, combineConfig, RangeSet } from '@codemirror/state';\nimport elt from 'crelt';\nclass SelectedDiagnostic {\n constructor(from, to, diagnostic) {\n this.from = from;\n this.to = to;\n this.diagnostic = diagnostic;\n }\n}\nclass LintState {\n constructor(diagnostics, panel, selected) {\n this.diagnostics = diagnostics;\n this.panel = panel;\n this.selected = selected;\n }\n static init(diagnostics, panel, state) {\n // Filter the list of diagnostics for which to create markers\n let markedDiagnostics = diagnostics;\n let diagnosticFilter = state.facet(lintConfig).markerFilter;\n if (diagnosticFilter) markedDiagnostics = diagnosticFilter(markedDiagnostics, state);\n let ranges = Decoration.set(markedDiagnostics.map(d => {\n // For zero-length ranges or ranges covering only a line break, create a widget\n return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from ? Decoration.widget({\n widget: new DiagnosticWidget(d),\n diagnostic: d\n }).range(d.from) : Decoration.mark({\n attributes: {\n class: \"cm-lintRange cm-lintRange-\" + d.severity + (d.markClass ? \" \" + d.markClass : \"\")\n },\n diagnostic: d\n }).range(d.from, d.to);\n }), true);\n return new LintState(ranges, panel, findDiagnostic(ranges));\n }\n}\nfunction findDiagnostic(diagnostics, diagnostic = null, after = 0) {\n let found = null;\n diagnostics.between(after, 1e9, (from, to, {\n spec\n }) => {\n if (diagnostic && spec.diagnostic != diagnostic) return;\n found = new SelectedDiagnostic(from, to, spec.diagnostic);\n return false;\n });\n return found;\n}\nfunction hideTooltip(tr, tooltip) {\n let from = tooltip.pos,\n to = tooltip.end || from;\n let result = tr.state.facet(lintConfig).hideOn(tr, from, to);\n if (result != null) return result;\n let line = tr.startState.doc.lineAt(tooltip.pos);\n return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));\n}\nfunction maybeEnableLint(state, effects) {\n return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions));\n}\n/**\nReturns a transaction spec which updates the current set of\ndiagnostics, and enables the lint extension if if wasn't already\nactive.\n*/\nfunction setDiagnostics(state, diagnostics) {\n return {\n effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)])\n };\n}\n/**\nThe state effect that updates the set of active diagnostics. Can\nbe useful when writing an extension that needs to track these.\n*/\nconst setDiagnosticsEffect = /*@__PURE__*/StateEffect.define();\nconst togglePanel = /*@__PURE__*/StateEffect.define();\nconst movePanelSelection = /*@__PURE__*/StateEffect.define();\nconst lintState = /*@__PURE__*/StateField.define({\n create() {\n return new LintState(Decoration.none, null, null);\n },\n update(value, tr) {\n if (tr.docChanged && value.diagnostics.size) {\n let mapped = value.diagnostics.map(tr.changes),\n selected = null,\n panel = value.panel;\n if (value.selected) {\n let selPos = tr.changes.mapPos(value.selected.from, 1);\n selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);\n }\n if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel) panel = null;\n value = new LintState(mapped, panel, selected);\n }\n for (let effect of tr.effects) {\n if (effect.is(setDiagnosticsEffect)) {\n let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;\n value = LintState.init(effect.value, panel, tr.state);\n } else if (effect.is(togglePanel)) {\n value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);\n } else if (effect.is(movePanelSelection)) {\n value = new LintState(value.diagnostics, value.panel, effect.value);\n }\n }\n return value;\n },\n provide: f => [showPanel.from(f, val => val.panel), EditorView.decorations.from(f, s => s.diagnostics)]\n});\n/**\nReturns the number of active lint diagnostics in the given state.\n*/\nfunction diagnosticCount(state) {\n let lint = state.field(lintState, false);\n return lint ? lint.diagnostics.size : 0;\n}\nconst activeMark = /*@__PURE__*/Decoration.mark({\n class: \"cm-lintRange cm-lintRange-active\"\n});\nfunction lintTooltip(view, pos, side) {\n let {\n diagnostics\n } = view.state.field(lintState);\n let found = [],\n stackStart = 2e8,\n stackEnd = 0;\n diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, {\n spec\n }) => {\n if (pos >= from && pos <= to && (from == to || (pos > from || side > 0) && (pos < to || side < 0))) {\n found.push(spec.diagnostic);\n stackStart = Math.min(from, stackStart);\n stackEnd = Math.max(to, stackEnd);\n }\n });\n let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;\n if (diagnosticFilter) found = diagnosticFilter(found, view.state);\n if (!found.length) return null;\n return {\n pos: stackStart,\n end: stackEnd,\n above: view.state.doc.lineAt(stackStart).to < stackEnd,\n create() {\n return {\n dom: diagnosticsTooltip(view, found)\n };\n }\n };\n}\nfunction diagnosticsTooltip(view, diagnostics) {\n return elt(\"ul\", {\n class: \"cm-tooltip-lint\"\n }, diagnostics.map(d => renderDiagnostic(view, d, false)));\n}\n/**\nCommand to open and focus the lint panel.\n*/\nconst openLintPanel = view => {\n let field = view.state.field(lintState, false);\n if (!field || !field.panel) view.dispatch({\n effects: maybeEnableLint(view.state, [togglePanel.of(true)])\n });\n let panel = getPanel(view, LintPanel.open);\n if (panel) panel.dom.querySelector(\".cm-panel-lint ul\").focus();\n return true;\n};\n/**\nCommand to close the lint panel, when open.\n*/\nconst closeLintPanel = view => {\n let field = view.state.field(lintState, false);\n if (!field || !field.panel) return false;\n view.dispatch({\n effects: togglePanel.of(false)\n });\n return true;\n};\n/**\nMove the selection to the next diagnostic.\n*/\nconst nextDiagnostic = view => {\n let field = view.state.field(lintState, false);\n if (!field) return false;\n let sel = view.state.selection.main,\n next = field.diagnostics.iter(sel.to + 1);\n if (!next.value) {\n next = field.diagnostics.iter(0);\n if (!next.value || next.from == sel.from && next.to == sel.to) return false;\n }\n view.dispatch({\n selection: {\n anchor: next.from,\n head: next.to\n },\n scrollIntoView: true\n });\n return true;\n};\n/**\nMove the selection to the previous diagnostic.\n*/\nconst previousDiagnostic = view => {\n let {\n state\n } = view,\n field = state.field(lintState, false);\n if (!field) return false;\n let sel = state.selection.main;\n let prevFrom, prevTo, lastFrom, lastTo;\n field.diagnostics.between(0, state.doc.length, (from, to) => {\n if (to < sel.to && (prevFrom == null || prevFrom < from)) {\n prevFrom = from;\n prevTo = to;\n }\n if (lastFrom == null || from > lastFrom) {\n lastFrom = from;\n lastTo = to;\n }\n });\n if (lastFrom == null || prevFrom == null && lastFrom == sel.from) return false;\n view.dispatch({\n selection: {\n anchor: prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom,\n head: prevTo !== null && prevTo !== void 0 ? prevTo : lastTo\n },\n scrollIntoView: true\n });\n return true;\n};\n/**\nA set of default key bindings for the lint functionality.\n\n- Ctrl-Shift-m (Cmd-Shift-m on macOS): [`openLintPanel`](https://codemirror.net/6/docs/ref/#lint.openLintPanel)\n- F8: [`nextDiagnostic`](https://codemirror.net/6/docs/ref/#lint.nextDiagnostic)\n*/\nconst lintKeymap = [{\n key: \"Mod-Shift-m\",\n run: openLintPanel,\n preventDefault: true\n}, {\n key: \"F8\",\n run: nextDiagnostic\n}];\nconst lintPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.timeout = -1;\n this.set = true;\n let {\n delay\n } = view.state.facet(lintConfig);\n this.lintTime = Date.now() + delay;\n this.run = this.run.bind(this);\n this.timeout = setTimeout(this.run, delay);\n }\n run() {\n clearTimeout(this.timeout);\n let now = Date.now();\n if (now < this.lintTime - 10) {\n this.timeout = setTimeout(this.run, this.lintTime - now);\n } else {\n this.set = false;\n let {\n state\n } = this.view,\n {\n sources\n } = state.facet(lintConfig);\n if (sources.length) Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {\n let all = annotations.reduce((a, b) => a.concat(b));\n if (this.view.state.doc == state.doc) this.view.dispatch(setDiagnostics(this.view.state, all));\n }, error => {\n logException(this.view.state, error);\n });\n }\n }\n update(update) {\n let config = update.state.facet(lintConfig);\n if (update.docChanged || config != update.startState.facet(lintConfig) || config.needsRefresh && config.needsRefresh(update)) {\n this.lintTime = Date.now() + config.delay;\n if (!this.set) {\n this.set = true;\n this.timeout = setTimeout(this.run, config.delay);\n }\n }\n }\n force() {\n if (this.set) {\n this.lintTime = Date.now();\n this.run();\n }\n }\n destroy() {\n clearTimeout(this.timeout);\n }\n});\nconst lintConfig = /*@__PURE__*/Facet.define({\n combine(input) {\n return Object.assign({\n sources: input.map(i => i.source).filter(x => x != null)\n }, combineConfig(input.map(i => i.config), {\n delay: 750,\n markerFilter: null,\n tooltipFilter: null,\n needsRefresh: null,\n hideOn: () => null\n }, {\n needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)\n }));\n }\n});\n/**\nGiven a diagnostic source, this function returns an extension that\nenables linting with that source. It will be called whenever the\neditor is idle (after its content changed). If `null` is given as\nsource, this only configures the lint extension.\n*/\nfunction linter(source, config = {}) {\n return [lintConfig.of({\n source,\n config\n }), lintPlugin, lintExtensions];\n}\n/**\nForces any linters [configured](https://codemirror.net/6/docs/ref/#lint.linter) to run when the\neditor is idle to run right away.\n*/\nfunction forceLinting(view) {\n let plugin = view.plugin(lintPlugin);\n if (plugin) plugin.force();\n}\nfunction assignKeys(actions) {\n let assigned = [];\n if (actions) actions: for (let {\n name\n } of actions) {\n for (let i = 0; i < name.length; i++) {\n let ch = name[i];\n if (/[a-zA-Z]/.test(ch) && !assigned.some(c => c.toLowerCase() == ch.toLowerCase())) {\n assigned.push(ch);\n continue actions;\n }\n }\n assigned.push(\"\");\n }\n return assigned;\n}\nfunction renderDiagnostic(view, diagnostic, inPanel) {\n var _a;\n let keys = inPanel ? assignKeys(diagnostic.actions) : [];\n return elt(\"li\", {\n class: \"cm-diagnostic cm-diagnostic-\" + diagnostic.severity\n }, elt(\"span\", {\n class: \"cm-diagnosticText\"\n }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {\n let fired = false,\n click = e => {\n e.preventDefault();\n if (fired) return;\n fired = true;\n let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);\n if (found) action.apply(view, found.from, found.to);\n };\n let {\n name\n } = action,\n keyIndex = keys[i] ? name.indexOf(keys[i]) : -1;\n let nameElt = keyIndex < 0 ? name : [name.slice(0, keyIndex), elt(\"u\", name.slice(keyIndex, keyIndex + 1)), name.slice(keyIndex + 1)];\n return elt(\"button\", {\n type: \"button\",\n class: \"cm-diagnosticAction\",\n onclick: click,\n onmousedown: click,\n \"aria-label\": ` Action: ${name}${keyIndex < 0 ? \"\" : ` (access key \"${keys[i]})\"`}.`\n }, nameElt);\n }), diagnostic.source && elt(\"div\", {\n class: \"cm-diagnosticSource\"\n }, diagnostic.source));\n}\nclass DiagnosticWidget extends WidgetType {\n constructor(diagnostic) {\n super();\n this.diagnostic = diagnostic;\n }\n eq(other) {\n return other.diagnostic == this.diagnostic;\n }\n toDOM() {\n return elt(\"span\", {\n class: \"cm-lintPoint cm-lintPoint-\" + this.diagnostic.severity\n });\n }\n}\nclass PanelItem {\n constructor(view, diagnostic) {\n this.diagnostic = diagnostic;\n this.id = \"item_\" + Math.floor(Math.random() * 0xffffffff).toString(16);\n this.dom = renderDiagnostic(view, diagnostic, true);\n this.dom.id = this.id;\n this.dom.setAttribute(\"role\", \"option\");\n }\n}\nclass LintPanel {\n constructor(view) {\n this.view = view;\n this.items = [];\n let onkeydown = event => {\n if (event.keyCode == 27) {\n // Escape\n closeLintPanel(this.view);\n this.view.focus();\n } else if (event.keyCode == 38 || event.keyCode == 33) {\n // ArrowUp, PageUp\n this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);\n } else if (event.keyCode == 40 || event.keyCode == 34) {\n // ArrowDown, PageDown\n this.moveSelection((this.selectedIndex + 1) % this.items.length);\n } else if (event.keyCode == 36) {\n // Home\n this.moveSelection(0);\n } else if (event.keyCode == 35) {\n // End\n this.moveSelection(this.items.length - 1);\n } else if (event.keyCode == 13) {\n // Enter\n this.view.focus();\n } else if (event.keyCode >= 65 && event.keyCode <= 90 && this.selectedIndex >= 0) {\n // A-Z\n let {\n diagnostic\n } = this.items[this.selectedIndex],\n keys = assignKeys(diagnostic.actions);\n for (let i = 0; i < keys.length; i++) if (keys[i].toUpperCase().charCodeAt(0) == event.keyCode) {\n let found = findDiagnostic(this.view.state.field(lintState).diagnostics, diagnostic);\n if (found) diagnostic.actions[i].apply(view, found.from, found.to);\n }\n } else {\n return;\n }\n event.preventDefault();\n };\n let onclick = event => {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].dom.contains(event.target)) this.moveSelection(i);\n }\n };\n this.list = elt(\"ul\", {\n tabIndex: 0,\n role: \"listbox\",\n \"aria-label\": this.view.state.phrase(\"Diagnostics\"),\n onkeydown,\n onclick\n });\n this.dom = elt(\"div\", {\n class: \"cm-panel-lint\"\n }, this.list, elt(\"button\", {\n type: \"button\",\n name: \"close\",\n \"aria-label\": this.view.state.phrase(\"close\"),\n onclick: () => closeLintPanel(this.view)\n }, \"×\"));\n this.update();\n }\n get selectedIndex() {\n let selected = this.view.state.field(lintState).selected;\n if (!selected) return -1;\n for (let i = 0; i < this.items.length; i++) if (this.items[i].diagnostic == selected.diagnostic) return i;\n return -1;\n }\n update() {\n let {\n diagnostics,\n selected\n } = this.view.state.field(lintState);\n let i = 0,\n needsSync = false,\n newSelectedItem = null;\n diagnostics.between(0, this.view.state.doc.length, (_start, _end, {\n spec\n }) => {\n let found = -1,\n item;\n for (let j = i; j < this.items.length; j++) if (this.items[j].diagnostic == spec.diagnostic) {\n found = j;\n break;\n }\n if (found < 0) {\n item = new PanelItem(this.view, spec.diagnostic);\n this.items.splice(i, 0, item);\n needsSync = true;\n } else {\n item = this.items[found];\n if (found > i) {\n this.items.splice(i, found - i);\n needsSync = true;\n }\n }\n if (selected && item.diagnostic == selected.diagnostic) {\n if (!item.dom.hasAttribute(\"aria-selected\")) {\n item.dom.setAttribute(\"aria-selected\", \"true\");\n newSelectedItem = item;\n }\n } else if (item.dom.hasAttribute(\"aria-selected\")) {\n item.dom.removeAttribute(\"aria-selected\");\n }\n i++;\n });\n while (i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) {\n needsSync = true;\n this.items.pop();\n }\n if (this.items.length == 0) {\n this.items.push(new PanelItem(this.view, {\n from: -1,\n to: -1,\n severity: \"info\",\n message: this.view.state.phrase(\"No diagnostics\")\n }));\n needsSync = true;\n }\n if (newSelectedItem) {\n this.list.setAttribute(\"aria-activedescendant\", newSelectedItem.id);\n this.view.requestMeasure({\n key: this,\n read: () => ({\n sel: newSelectedItem.dom.getBoundingClientRect(),\n panel: this.list.getBoundingClientRect()\n }),\n write: ({\n sel,\n panel\n }) => {\n let scaleY = panel.height / this.list.offsetHeight;\n if (sel.top < panel.top) this.list.scrollTop -= (panel.top - sel.top) / scaleY;else if (sel.bottom > panel.bottom) this.list.scrollTop += (sel.bottom - panel.bottom) / scaleY;\n }\n });\n } else if (this.selectedIndex < 0) {\n this.list.removeAttribute(\"aria-activedescendant\");\n }\n if (needsSync) this.sync();\n }\n sync() {\n let domPos = this.list.firstChild;\n function rm() {\n let prev = domPos;\n domPos = prev.nextSibling;\n prev.remove();\n }\n for (let item of this.items) {\n if (item.dom.parentNode == this.list) {\n while (domPos != item.dom) rm();\n domPos = item.dom.nextSibling;\n } else {\n this.list.insertBefore(item.dom, domPos);\n }\n }\n while (domPos) rm();\n }\n moveSelection(selectedIndex) {\n if (this.selectedIndex < 0) return;\n let field = this.view.state.field(lintState);\n let selection = findDiagnostic(field.diagnostics, this.items[selectedIndex].diagnostic);\n if (!selection) return;\n this.view.dispatch({\n selection: {\n anchor: selection.from,\n head: selection.to\n },\n scrollIntoView: true,\n effects: movePanelSelection.of(selection)\n });\n }\n static open(view) {\n return new LintPanel(view);\n }\n}\nfunction svg(content, attrs = `viewBox=\"0 0 40 40\"`) {\n return `url('data:image/svg+xml,')`;\n}\nfunction underline(color) {\n return svg(` Warning: Scanning an Rx here will create a fulfillment. Multiple inventories contain the NDC for this Rx. Please choose the inventory to fill the prescription from. There are no Rx's assigned to this fulfillment. Are you sure you want to ${this.isNotActive ? \"activate\" : \"deactivate\"} this fulfillment? This will:{{ title }}
\r\n\t\t\r\n\tPrescriptions
\r\n\t | {{ rxList[0].pfsNumber }}
\r\n\t\r\n
\r\n\r\n\t\r\n\t\t\r\n\t\t\t
\r\n\r\n\tRx \r\n\t\t\tFirst Name \r\n\t\t\tLast Name \r\n\t\t\tProduct \r\n\t\t\tPFS Flags \r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t \r\n\t\t\r\n\t{{ row.rxNumber }} \r\n\t\t\t\t{{ row.patientFirstName }} \r\n\t\t\t\t{{ row.patientLastName }} \r\n\t\t\t\t{{ row.productName }} \r\n\t\t\t\t\r\n\t\t\t\t\t \r\n\t\t\t
\r\n \r\n
\r\n
\r\n @if (\r\n isSysAdmin \r\n || isAssignee \r\n || showCommenterInfo\r\n ) { {{ row?.commentorInfo }} | }\r\n \r\n {{ row?.commentDateStr }}\r\n\r\n @if (\r\n fromFulfillment \r\n && row.pfsFormID !== null \r\n && row.pfsFormID !== 0\r\n ) {\r\n \r\n | \r\n {{ row.pfsFormID }}\r\n \r\n } \r\n
\r\n }\r\n \r\n @if (!row?.isEdit) {\r\n \r\n } \r\n\r\n Me | {{ row?.commentDateStr }}\r\n @if (\r\n fromFulfillment \r\n && row.pfsFormID !== null \r\n && row.pfsFormID !== 0\r\n ) {\r\n \r\n | \r\n {{ row.pfsFormID }}\r\n \r\n } \r\n
\r\n }\r\n \r\n @if (!row?.isEdit) {\r\n \r\n } \r\n{{ facilityCodeValidationError }}
}\r\n\t\t\t@else {{{ addressValidationError }}
\r\n\t\t\t\r\n\t\t\t\tSuggested Address\r\n\t\t\t
\r\n\t\t}\t\t\r\n\t\t\r\n\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t= | \r\n\t\t\t\t\t\tEOS | \r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t= | \r\n\t\t\t\t\t\tEarly Refill | \r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t= | \r\n\t\t\t\t\t\tPatient Facility Transfer | \r\n\t\t\t\t\t
\r\n\t\t\t\t\tRecords highlighted in red indicate that there are one or more rejected Rx numbers on a Fulfillment. Fulfillments older than two weeks that have\r\n\t\t\t\t\tno Products added in Step 1 are automatically deleted from this list.\r\n\t\t\t\t
\r\n\t\t\t} @else {Records highlighted in red indicate that there are one or more rejected Rx numbers on a Fulfillment.
}\r\n\t\t\tDOB
\r\n\t\t\t\t\t\r\n\t\t\t\tMultiple inventories contain the NDC for this Rx. Please choose the inventory to fill the prescription from.
\r\n\t\t\t\t\t
Warning: Scanning an Rx here will create a fulfillment.
The scanned product NDC (${scannedNdc}) does not match the selected Rx product NDC (${this.ndc}).
\r\n\t\tAre you sure you want to continue?
`;\r\n\r\n\t\tmodal.result.then((emittedValue) => {\r\n\t\t\tif(emittedValue) {\r\n\t\t\t\tthis.beepSuccess.play();\r\n\t\t\t\tthis.scanSuccess.emit(barcode);\r\n\t\t\t}\r\n\t\t}).catch(err => {\r\n\t\t\t// Prevents Uncaught (in promise) error when user \r\n\t\t\t// closes modal from clicking outside modal. \r\n\t\t});\r\n\t}\r\n\r\n\thelpButtonClicked() { this.modalService.open(this.helpModal); }\r\n}\r\n","\r\n\t\t\tPlease locate the GS1 DataMatrix barcode that looks similar to this one.
\r\n\t\t\tStandard barcodes will not work.
\r\n\t\t\tSimply use your barcode scanner to scan this making sure you have first clicked into the input field to the\r\n\t\t\tleft of the help button.
\r\n\t\t\tTip: If your barcode and QR matrix are close to each other cover up the barcode with your other hand.\r\n\t\t
\r\n\t\t\t\r\n\t\t\t Locked Users: These users have entered an incorrect password 5 consecutive times. \r\n\t\t\tClick the Unlock button on their profile to unlock their account and send them a reset password email.
\r\n\t\t\t\r\n\t\t\t Email needs manual validation: Our automated validation tool flagged this email. \r\n\t\t\tClick the Validate Email button on their profile.
\r\n\t\t\t\r\n\t\t\t Undeliverable Email: Usually indicates a permanent error, \r\n\t\t\tbut can also be caused by a strict email security filter.You may need to reach out to your IT to whitelist our domain. \r\n\t\t\tClick the Unbounce Email button on their profile.
\r\n\t\t\t\r\n\t\t\t Undeliverable Email due to Spam Report: \r\n\t\t\tThe user has reported one of our emails as spam. Click the Undo Spam button on their profile.\r\n\t\t
\r\n\t\tThis tab contains business area specific information. Assigning access to certain business areas may require\r\n\t\tadditional details.\r\n\t\t
\r\n\t\tUpdates may only be performed by User Admin level users and above for either the related business area or the\r\n\t\t\"Admin\" business area.\r\n\t\t
\r\n\t\tTo view your roles, visit the module access section of your profile.\r\n\t
\" \r\n + \"Setting ICQ Participant to off will remove any published ICQ Surveys for this Fiscal Year assiciated to this facility.\" \r\n + \"
\";\r\n modal.componentInstance.confirmationMessage += 'Are you sure you wish to continue?
'\r\n modal.result.then((emittedValue) => {\r\n if (emittedValue) { return this.runSave(); }\r\n }).catch(err => { // When user clicks out of confirmation box.\r\n\r\n });\r\n }\r\n\t\telse { this.runSave(); }\r\n\t}\r\n\r\n runSave() { \r\n\t\tlet disabled = this.hasDisabledShipFacilityName();\r\n\t\t// As a result of moving this to a .ts POST method, disabled values\r\n\t\t// won't go through within the request body.\r\n\t\tif (this.hasDisabledShipFacilityName) { this.enableShipFacilityName(); }\r\n\r\n this.httpClient.post(\r\n\t\t\t`api/Administration/Facility/SaveFacility`\r\n\t\t\t, this.formGroup.value\r\n\t\t).subscribe((sm: SystemMessage) => {\r\n\t\t\t// Re-disable property after POST request.\r\n\t\t\tif (disabled) { this.disableShipFacilityName(); }\r\n\t\t\tif (sm.isSuccessful) { this.onMessageSuccess(sm); } \r\n\t\t\telse { this.onMessageError(sm); }\r\n\t\t});\r\n }\r\n\r\n\treroute(sm: SystemMessage) {\r\n\t\tif (\r\n\t\t\tthis.businessArea === BusinessAreaEnum.Admin \r\n\t\t\t|| this.businessArea === null \r\n\t\t\t|| this.businessArea == undefined \r\n\t\t\t|| Number.isNaN(this.businessArea)\r\n\t\t) {\r\n\t\t\tthis.router.navigate([`/admin/organizations/facilities/edit/${sm.value}`]);\r\n\t\t} else if (this.businessArea === BusinessAreaEnum.CI) {\r\n\t\t\tthis.router.navigate([`/ci-repack/facilities/edit/${sm.value}`]);\r\n\t\t} else if (this.businessArea === BusinessAreaEnum.MetabolicFormula) {\r\n\t\t\tthis.router.navigate([`/metabolic-formula/facilities/edit/${sm.value}`]);\r\n\t\t}\r\n\t}\r\n\r\n\tonMessageSuccess(sm: SystemMessage) {\r\n\t\tthis.setSysMessage(sm);\r\n\t\tthis.formGroup.setValue(sm.model);\r\n\t\tthis.router.navigateByUrl(\"/\", { skipLocationChange: true }).then(() => { this.reroute(sm); });\r\n\t}\r\n\r\n\tonMessageError(sm: SystemMessage) {\r\n\t\tthis.setSysMessage(sm);\r\n\t\tthis.formGroup.patchValue(sm.model);\r\n\t}\r\n\r\n\tenableShipFacilityName() {\r\n\t\tthis.formGroup.get(\"shipFacilityName\").enable();\r\n\t\tthis.formGroup.get(\"shipSmartyAddress\").enable();\r\n\t}\r\n\r\n\tdisableShipFacilityName() {\r\n\t\tthis.formGroup.get(\"shipFacilityName\").disable();\r\n\t\tthis.formGroup.get(\"shipSmartyAddress\").disable();\r\n\t}\r\n\r\n\tmedDirectorChange(select: PcgSelectComponent) {\r\n\t\tif (select.value) {\r\n\t\t\tthis.model.medicalDirectorLicense = select.additionalData?.licenseNumber;\r\n\t\t\tthis.model.medicalDirectorExpDate = select.additionalData?.expirationDate;\r\n\t\t} else {\r\n\t\t\tthis.model.medicalDirectorLicense = \"\";\r\n\t\t\tthis.model.medicalDirectorExpDate = \"\";\r\n\t\t}\r\n\t}\r\n\r\n\tsetSysMessage = (sm: SystemMessage) => this.ms.setSystemMessage(sm.message, sm.messageClass);\r\n\thasDisabledShipFacilityName = () => this.formGroup.get(\"shipFacilityName\").disabled;\r\n}\r\n","There are no notifications.
\r\n\t\t\tScan a Job Id, Order Id, or DOH Lot # into the appropriate scan box to quickly navigate to either record.
\r\n\r\n{{ repackErrorMsg }}
\r\n{{ jobIdErrorMsg }}
\r\n{{ lotnumErrorMsg }}
\r\n{{route.name}}
\r\n\t\t\t\r\n\t\t\t\t\t{{route.name}}\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t
\r\n\r\n\t\t\t\t{{ user.firstName }} {{ user.lastName }}
\r\n\t\t\t}\r\n\t\t\tMy Profile
\r\n\t\t\t\tLogout
\r\n\t\t\t\tProgram
\r\nOrganization
Account
Wholesaler
Account
Add Inventory
\r\nName:
\r\n{{ inv.name }}
\r\nType:
\r\n{{ parseEnum(inv.type) }}
\r\nPrograms:
\r\n @if (inv.programs.length <= 2) {{{ inv.programs.slice(0, 2).join(', ') }}
}\r\n @else { \r\n\r\n \r\n
\r\n }\r\nActive:
\r\n{{ inv.active ? \"Yes\" : \"No\" }}
\r\n\r\n\t\t\t\t\t\t\t {{ collapsibleTableService.expandedRows.size > 0 ? '-' : '+' }} \r\n\t\t\t\t\t\t | \r\n\t\t\t\t\t\tOrganizations | \r\n\t\t\t\t\t\tCounty | \r\n\t\t\t\t\t\tAddress | \r\n\t\t\t\t\t\tFacilities | \r\n\t\t\t\t\t
---|---|---|---|---|
\r\n\t\t\t\t\t\t\t\t {{ collapsibleTableService.expandedOrCollapsed(i) === 'expanded' ? '-' : '+' }} \r\n\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t\t{{ row.orgCount }} | \r\n\t\t\t\t\t\t\t{{ row.county }} | \r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t | {{ row.facilityCount }} | \r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t\t\t\t | \r\n\t\t\t\t\t\t\t\t{{ rowchild.address }}, {{ rowchild.city }}, {{ rowchild.state }} {{ rowchild.zip }} | \r\n\t\t\t\t\t\t\t\t{{ rowchild.facilityCount }} | \r\n\t\t\t\t\t\t\t