From faee08cb3137f7a2717ba951ebd9a29e036dfa90 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Mon, 8 May 2017 16:39:35 +0200 Subject: [PATCH] Bug 1362398 - Update Debugger Frontend. r=jdescottes MozReview-Commit-ID: H2XDuj14Ayc --HG-- extra : rebase_source : 80ffdd6a881daa6bee3b571e73d7ffd50bafdeb3 --- devtools/client/debugger/new/debugger.css | 1404 +- devtools/client/debugger/new/debugger.js | 45980 ++++------------ devtools/client/debugger/new/index.html | 2 +- .../client/debugger/new/integration-tests.js | 26651 ++------- devtools/client/debugger/new/parser-worker.js | 1011 +- .../debugger/new/pretty-print-worker.js | 25 +- .../debugger/new/test/mochitest/browser.ini | 6 + .../mochitest/browser_dbg-breakpoints-cond.js | 7 +- .../test/mochitest/browser_dbg-expressions.js | 2 +- .../mochitest/browser_dbg-scopes-mutations.js | 120 + .../new/test/mochitest/examples/asm.js | 9 +- .../mochitest/examples/doc-return-values.html | 20 + .../mochitest/examples/doc-script-mutate.html | 17 + .../test/mochitest/examples/doc-sources.html | 11 +- .../test/mochitest/examples/script-mutate.js | 20 + .../debugger/new/test/mochitest/head.js | 27 +- .../client/locales/en-US/debugger.properties | 20 +- 17 files changed, 18440 insertions(+), 56892 deletions(-) create mode 100644 devtools/client/debugger/new/test/mochitest/browser_dbg-scopes-mutations.js create mode 100644 devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html create mode 100644 devtools/client/debugger/new/test/mochitest/examples/script-mutate.js diff --git a/devtools/client/debugger/new/debugger.css b/devtools/client/debugger/new/debugger.css index b374aba1d9e6..ea4b3654964c 100644 --- a/devtools/client/debugger/new/debugger.css +++ b/devtools/client/debugger/new/debugger.css @@ -202,6 +202,91 @@ .landing-page .sidebar li:focus a { color: inherit; } +menu { + display: inline; + padding: 0; +} + +menu > menuitem::after { + content: "\25BA"; + float: right; +} + +menu > menupopup { + display: none; +} + +menu > menuitem:hover + menupopup, +menu > menupopup:hover { + display: block; +} + +menupopup { + position: fixed; + z-index: 10000; + background: white; + border: 1px solid #cccccc; + padding: 5px 0; + background: #f2f2f2; + border-radius: 5px; + color: #585858; + box-shadow: 0 0 4px 0 rgba(190, 190, 190, 0.8); + min-width: 130px; +} + +menuitem { + display: block; + padding: 0 20px; + line-height: 20px; + font-weight: 500; + font-size: 13px; + -moz-user-select: none; + user-select: none; +} + +menuitem:hover { + background: #3780fb; + color: white; + cursor: pointer; +} + +menuitem[disabled=true] { + color: #cccccc; +} + +menuitem[disabled=true]:hover { + background-color: transparent; + cursor: default; +} + +menuitem[type=checkbox]::before { + content: ""; + width: 10px; + display: inline-block; +} + +menuitem[type=checkbox][checked=true]::before { + content: "\2713"; + left: -8px; + position: relative; +} + +menuseparator { + border-bottom: 1px solid #cacdd3; + width: 100%; + height: 5px; + display: block; + margin-bottom: 5px; +} + +#contextmenu-mask.show { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; +} :root.theme-light, :root .theme-light { --theme-search-overlays-semitransparent: rgba(221, 225, 228, 0.66); @@ -243,690 +328,6 @@ body { :root.theme-dark .CodeMirror-scrollbar-filler { background: transparent; } -/* BASICS */ - -.CodeMirror { - /* Set height, width, borders, and global font properties here */ - font-family: monospace; - height: 300px; - color: black; -} - -/* PADDING */ - -.CodeMirror-lines { - padding: 4px 0; /* Vertical padding around content */ -} -.CodeMirror pre { - padding: 0 4px; /* Horizontal padding of content */ -} - -.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - background-color: white; /* The little square between H and V scrollbars */ -} - -/* GUTTER */ - -.CodeMirror-gutters { - border-right: 1px solid #ddd; - background-color: #f7f7f7; - white-space: nowrap; -} -.CodeMirror-linenumbers {} -.CodeMirror-linenumber { - padding: 0 3px 0 5px; - min-width: 20px; - text-align: right; - color: #999; - white-space: nowrap; -} - -.CodeMirror-guttermarker { color: black; } -.CodeMirror-guttermarker-subtle { color: #999; } - -/* CURSOR */ - -.CodeMirror-cursor { - border-left: 1px solid black; - border-right: none; - width: 0; -} -/* Shown when moving in bi-directional text */ -.CodeMirror div.CodeMirror-secondarycursor { - border-left: 1px solid silver; -} -.cm-fat-cursor .CodeMirror-cursor { - width: auto; - border: 0 !important; - background: #7e7; -} -.cm-fat-cursor div.CodeMirror-cursors { - z-index: 1; -} - -.cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; -} -@-moz-keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} -} -@-webkit-keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} -} -@keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} -} - -/* Can style cursor different in overwrite (non-insert) mode */ -.CodeMirror-overwrite .CodeMirror-cursor {} - -.cm-tab { display: inline-block; text-decoration: inherit; } - -.CodeMirror-rulers { - position: absolute; - left: 0; right: 0; top: -50px; bottom: -20px; - overflow: hidden; -} -.CodeMirror-ruler { - border-left: 1px solid #ccc; - top: 0; bottom: 0; - position: absolute; -} - -/* DEFAULT THEME */ - -.cm-s-default .cm-header {color: blue;} -.cm-s-default .cm-quote {color: #090;} -.cm-negative {color: #d44;} -.cm-positive {color: #292;} -.cm-header, .cm-strong {font-weight: bold;} -.cm-em {font-style: italic;} -.cm-link {text-decoration: underline;} -.cm-strikethrough {text-decoration: line-through;} - -.cm-s-default .cm-keyword {color: #708;} -.cm-s-default .cm-atom {color: #219;} -.cm-s-default .cm-number {color: #164;} -.cm-s-default .cm-def {color: #00f;} -.cm-s-default .cm-variable, -.cm-s-default .cm-punctuation, -.cm-s-default .cm-property, -.cm-s-default .cm-operator {} -.cm-s-default .cm-variable-2 {color: #05a;} -.cm-s-default .cm-variable-3 {color: #085;} -.cm-s-default .cm-comment {color: #a50;} -.cm-s-default .cm-string {color: #a11;} -.cm-s-default .cm-string-2 {color: #f50;} -.cm-s-default .cm-meta {color: #555;} -.cm-s-default .cm-qualifier {color: #555;} -.cm-s-default .cm-builtin {color: #30a;} -.cm-s-default .cm-bracket {color: #997;} -.cm-s-default .cm-tag {color: #170;} -.cm-s-default .cm-attribute {color: #00c;} -.cm-s-default .cm-hr {color: #999;} -.cm-s-default .cm-link {color: #00c;} - -.cm-s-default .cm-error {color: #f00;} -.cm-invalidchar {color: #f00;} - -.CodeMirror-composing { border-bottom: 2px solid; } - -/* Default styles for common addons */ - -div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} -div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} -.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } -.CodeMirror-activeline-background {background: #e8f2ff;} - -/* STOP */ - -/* The rest of this file contains styles related to the mechanics of - the editor. You probably shouldn't touch them. */ - -.CodeMirror { - position: relative; - overflow: hidden; - background: white; -} - -.CodeMirror-scroll { - overflow: scroll !important; /* Things will break if this is overridden */ - /* 30px is the magic margin used to hide the element's real scrollbars */ - /* See overflow: hidden in .CodeMirror */ - margin-bottom: -30px; margin-right: -30px; - padding-bottom: 30px; - height: 100%; - outline: none; /* Prevent dragging from highlighting the element */ - position: relative; -} -.CodeMirror-sizer { - position: relative; - border-right: 30px solid transparent; -} - -/* The fake, visible scrollbars. Used to force redraw during scrolling - before actual scrolling happens, thus preventing shaking and - flickering artifacts. */ -.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - position: absolute; - z-index: 6; - display: none; -} -.CodeMirror-vscrollbar { - right: 0; top: 0; - overflow-x: hidden; - overflow-y: scroll; -} -.CodeMirror-hscrollbar { - bottom: 0; left: 0; - overflow-y: hidden; - overflow-x: scroll; -} -.CodeMirror-scrollbar-filler { - right: 0; bottom: 0; -} -.CodeMirror-gutter-filler { - left: 0; bottom: 0; -} - -.CodeMirror-gutters { - position: absolute; left: 0; top: 0; - min-height: 100%; - z-index: 3; -} -.CodeMirror-gutter { - white-space: normal; - height: 100%; - display: inline-block; - vertical-align: top; - margin-bottom: -30px; -} -.CodeMirror-gutter-wrapper { - position: absolute; - z-index: 4; - background: none !important; - border: none !important; -} -.CodeMirror-gutter-background { - position: absolute; - top: 0; bottom: 0; - z-index: 4; -} -.CodeMirror-gutter-elt { - position: absolute; - cursor: default; - z-index: 4; -} -.CodeMirror-gutter-wrapper ::selection { background-color: transparent } -.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } - -.CodeMirror-lines { - cursor: text; - min-height: 1px; /* prevents collapsing before first draw */ -} -.CodeMirror pre { - /* Reset some styles that the rest of the page might have set */ - -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; - border-width: 0; - background: transparent; - font-family: inherit; - font-size: inherit; - margin: 0; - white-space: pre; - word-wrap: normal; - line-height: inherit; - color: inherit; - z-index: 2; - position: relative; - overflow: visible; - -webkit-tap-highlight-color: transparent; - -webkit-font-variant-ligatures: contextual; - font-variant-ligatures: contextual; -} -.CodeMirror-wrap pre { - word-wrap: break-word; - white-space: pre-wrap; - word-break: normal; -} - -.CodeMirror-linebackground { - position: absolute; - left: 0; right: 0; top: 0; bottom: 0; - z-index: 0; -} - -.CodeMirror-linewidget { - position: relative; - z-index: 2; - overflow: auto; -} - -.CodeMirror-widget {} - -.CodeMirror-rtl pre { direction: rtl; } - -.CodeMirror-code { - outline: none; -} - -/* Force content-box sizing for the elements where we expect it */ -.CodeMirror-scroll, -.CodeMirror-sizer, -.CodeMirror-gutter, -.CodeMirror-gutters, -.CodeMirror-linenumber { - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -.CodeMirror-measure { - position: absolute; - width: 100%; - height: 0; - overflow: hidden; - visibility: hidden; -} - -.CodeMirror-cursor { - position: absolute; - pointer-events: none; -} -.CodeMirror-measure pre { position: static; } - -div.CodeMirror-cursors { - visibility: hidden; - position: relative; - z-index: 3; -} -div.CodeMirror-dragcursors { - visibility: visible; -} - -.CodeMirror-focused div.CodeMirror-cursors { - visibility: visible; -} - -.CodeMirror-selected { background: #d9d9d9; } -.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } -.CodeMirror-crosshair { cursor: crosshair; } -.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } -.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } - -.cm-searching { - background: #ffa; - background: rgba(255, 255, 0, .4); -} - -/* Used to force a border model for a node */ -.cm-force-border { padding-right: .1px; } - -@media print { - /* Hide the cursor when printing */ - .CodeMirror div.CodeMirror-cursors { - visibility: hidden; - } -} - -/* See issue #2901 */ -.cm-tab-wrap-hack:after { content: ''; } - -/* Help users use markselection to safely style text background */ -span.CodeMirror-selectedtext { background: none; } -:root { - /* --breakpoint-background: url("chrome://devtools/skin/images/breakpoint.svg#light"); */ - /* --breakpoint-hover-background: url("chrome://devtools/skin/images/breakpoint.svg#light-hover"); */ - --breakpoint-active-color: rgba(44,187,15,.2); - --breakpoint-active-color-hover: rgba(44,187,15,.5); - /* --breakpoint-conditional-background: url("chrome://devtools/skin/images/breakpoint.svg#light-conditional"); */ -} - -.theme-dark:root { - /* --breakpoint-background: url("chrome://devtools/skin/images/breakpoint.svg#dark"); */ - /* --breakpoint-hover-background: url("chrome://devtools/skin/images/breakpoint.svg#dark-hover"); */ - --breakpoint-active-color: rgba(45,210,158,0.5); - --breakpoint-active-color-hover: rgba(0,255,175,.7); - /* --breakpoint-conditional-background: url("chrome://devtools/skin/images/breakpoint.svg#dark-conditional"); */ -} - -.CodeMirror .errors { - width: 16px; -} - -.CodeMirror .error { - display: inline-block; - margin-left: 5px; - width: 12px; - height: 12px; - background-repeat: no-repeat; - background-position: center; - background-size: contain; - /* background-image: url("chrome://devtools/skin/images/editor-error.png"); */ - opacity: 0.75; -} - -.CodeMirror .hit-counts { - width: 6px; -} - -.CodeMirror .hit-count { - display: inline-block; - height: 12px; - border: solid rgba(0,0,0,0.2); - border-width: 1px 1px 1px 0; - border-radius: 0 3px 3px 0; - padding: 0 3px; - font-size: 10px; - pointer-events: none; -} - -.CodeMirror-linenumber:before { - content: " "; - display: block; - width: calc(100% - 3px); - position: absolute; - top: 1px; - left: 0; - height: 12px; - z-index: -1; - background-size: calc(100% - 2px) 12px; - background-repeat: no-repeat; - background-position: right center; - padding-inline-end: 9px; -} - -.breakpoint .CodeMirror-linenumber { - color: var(--theme-body-background); -} - -.breakpoint .CodeMirror-linenumber:before { - background-image: var(--breakpoint-background) !important; -} - -.conditional .CodeMirror-linenumber:before { - background-image: var(--breakpoint-conditional-background) !important; -} - -.debug-line .CodeMirror-linenumber { - background-color: var(--breakpoint-active-color); -} - -.theme-dark .debug-line .CodeMirror-linenumber { - color: #c0c0c0; -} - -.debug-line .CodeMirror-line { - background-color: var(--breakpoint-active-color) !important; -} - -/* Don't display the highlight color since the debug line - is already highlighted */ -.debug-line .CodeMirror-activeline-background { - display: none; -} - -.CodeMirror { - cursor: text; - height: 100%; -} - -.CodeMirror-gutters { - cursor: default; -} - -/* This is to avoid the fake horizontal scrollbar div of codemirror to go 0 -height when floating scrollbars are active. Make sure that this value is equal -to the maximum of `min-height` specific to the `scrollbar[orient="horizontal"]` -selector in floating-scrollbar-light.css across all platforms. */ -.CodeMirror-hscrollbar { - min-height: 10px; -} - -/* This is to avoid the fake vertical scrollbar div of codemirror to go 0 -width when floating scrollbars are active. Make sure that this value is equal -to the maximum of `min-width` specific to the `scrollbar[orient="vertical"]` -selector in floating-scrollbar-light.css across all platforms. */ -.CodeMirror-vscrollbar { - min-width: 10px; -} - -.cm-trailingspace { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg=="); - opacity: 0.75; - background-position: left bottom; - background-repeat: repeat-x; -} - -.cm-highlight { - position: relative; -} - -.cm-highlight:before { - position: absolute; - border-top-style: solid; - border-bottom-style: solid; - border-top-color: var(--theme-comment-alt); - border-bottom-color: var(--theme-comment-alt); - border-top-width: 1px; - border-bottom-width: 1px; - top: -1px; - bottom: 0; - left: 0; - right: 0; - content: ""; - margin-bottom: -1px; -} - -.cm-highlight-full:before { - border: 1px solid var(--theme-comment-alt); -} - -.cm-highlight-start:before { - border-left-width: 1px; - border-left-style: solid; - border-left-color: var(--theme-comment-alt); - margin: 0 0 -1px -1px; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; -} - -.cm-highlight-end:before { - border-right-width: 1px; - border-right-style: solid; - border-right-color: var(--theme-comment-alt); - margin: 0 -1px -1px 0; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; -} - -/* CodeMirror dialogs styling */ - -.CodeMirror-dialog { - padding: 4px 3px; -} - -.CodeMirror-dialog, -.CodeMirror-dialog input { - font: message-box; -} - -/* Fold addon */ - -.CodeMirror-foldmarker { - color: blue; - text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; - font-family: sans-serif; - line-height: .3; - cursor: pointer; -} - -.CodeMirror-foldgutter { - width: 10px; -} - -.CodeMirror-foldgutter-open, -.CodeMirror-foldgutter-folded { - color: #555; - cursor: pointer; - line-height: 1; - padding: 0 1px; -} - -.CodeMirror-foldgutter-open::after, -.CodeMirror-foldgutter-open::before, -.CodeMirror-foldgutter-folded::after, -.CodeMirror-foldgutter-folded::before { - content: ''; - height: 0; - width: 0; - position: absolute; - border: 4px solid transparent; -} - -.CodeMirror-foldgutter-open::after { - border-top-color: var(--theme-codemirror-gutter-background); - top: 4px; -} - -.CodeMirror-foldgutter-open::before { - border-top-color: var(--theme-body-color); - top: 5px; -} - -.new-breakpoint .CodeMirror-foldgutter-open::after { - border-top-color: var(--theme-selection-background); -} - -.new-breakpoint .CodeMirror-foldgutter-open::before { - border-top-color: white; -} - -.CodeMirror-foldgutter-folded::after { - border-left-color: var(--theme-codemirror-gutter-background); - left: 3px; - top: 3px; -} - -.CodeMirror-foldgutter-folded::before { - border-left-color: var(--theme-body-color); - left: 4px; - top: 3px; -} - -.new-breakpoint .CodeMirror-foldgutter-folded::after { - border-left-color: var(--theme-selection-background); -} - -.new-breakpoint .CodeMirror-foldgutter-folded::before { - border-left-color: white; -} - -.CodeMirror-hints { - position: absolute; - z-index: 10; - overflow: hidden; - list-style: none; - margin: 0; - padding: 2px; - border-radius: 3px; - font-size: 90%; - max-height: 20em; - overflow-y: auto; -} - -.CodeMirror-hint { - margin: 0; - padding: 0 4px; - border-radius: 2px; - max-width: 19em; - overflow: hidden; - white-space: pre; - cursor: pointer; -} - -.CodeMirror-Tern-completion { - padding-inline-start: 22px; - position: relative; - line-height: 18px; -} - -.CodeMirror-Tern-completion:before { - position: absolute; - left: 2px; - bottom: 2px; - border-radius: 50%; - font-size: 12px; - font-weight: bold; - height: 15px; - width: 15px; - line-height: 16px; - text-align: center; - color: #ffffff; - box-sizing: border-box; -} - -.CodeMirror-Tern-completion-unknown:before { - content: "?"; -} - -.CodeMirror-Tern-completion-object:before { - content: "O"; -} - -.CodeMirror-Tern-completion-fn:before { - content: "F"; -} - -.CodeMirror-Tern-completion-array:before { - content: "A"; -} - -.CodeMirror-Tern-completion-number:before { - content: "N"; -} - -.CodeMirror-Tern-completion-string:before { - content: "S"; -} - -.CodeMirror-Tern-completion-bool:before { - content: "B"; -} - -.CodeMirror-Tern-completion-guess { - color: #999; -} - -.CodeMirror-Tern-tooltip { - border-radius: 3px; - padding: 2px 5px; - white-space: pre-wrap; - max-width: 40em; - position: absolute; - z-index: 10; -} - -.CodeMirror-Tern-hint-doc { - max-width: 25em; -} - -.CodeMirror-Tern-farg-current { - text-decoration: underline; -} - -.CodeMirror-Tern-fhint-guess { - opacity: .7; -} :root.theme-light, :root .theme-light { --search-overlays-semitransparent: rgba(221, 225, 228, 0.66); @@ -1559,10 +960,18 @@ html .arrow.expanded svg { .search-field .search-nav-buttons .nav-btn { display: flex; height: 100%; - border-radius: 50%; + background: transparent; + transition: all 0.25s ease-in-out; + border: 1px solid transparent; + justify-content: center; + padding-top: 4px; +} + +.search-field .search-nav-buttons .nav-btn:hover { + cursor: pointer; + background: var(--theme-toolbar-background-hover); } -.search-field .search-nav-buttons .nav-btn:hover path, .search-field .search-nav-buttons .nav-btn:active path { fill: var(--theme-comment-alt); } @@ -1795,161 +1204,6 @@ html[dir="rtl"] .tree .node > div { .conditional-breakpoint-panel input:focus { outline-width: 0; } -/* vim:set ts=2 sw=2 sts=2 et: */ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * There's a known codemirror flex issue with chrome that this addresses. - * BUG https://github.com/devtools-html/debugger.html/issues/63 - */ -.editor-wrapper { - position: absolute; - height: calc(100% - 31px); - width: 100%; - top: 30px; - left: 0px; - --editor-footer-height: 27px; - --editor-searchbar-height: 27px; - --editor-second-searchbar-height: 27px; -} - -html[dir="rtl"] .editor-mount { - direction: ltr; -} - -.editor-wrapper .breakpoints { - position: absolute; - top: 0; - left: 0; -} - -.function-search { - max-height: 300px; - overflow: hidden; -} - -.function-search .results { - height: auto; -} - -.editor.hit-marker { - height: 14px; -} - -.coverage-on .CodeMirror-code :not(.hit-marker) .CodeMirror-line, -.coverage-on .CodeMirror-code :not(.hit-marker) .CodeMirror-gutter-wrapper { - opacity: 0.5; -} - -.editor.new-breakpoint svg { - fill: var(--theme-selection-background); - width: 60px; - height: 14px; - position: absolute; - top: 0px; - right: -4px; -} - -.editor.new-breakpoint.folding-enabled svg { - right: -16px; -} - -.new-breakpoint.has-condition svg { - fill: var(--theme-graphs-yellow); -} - -.editor.new-breakpoint.breakpoint-disabled svg { - opacity: 0.3; -} - -.CodeMirror { - width: 100%; - height: 100%; -} - -.editor-wrapper .editor-mount { - width: 100%; - background-color: var(--theme-body-background); -} - -.CodeMirror-linenumber { - font-size: 11px; - line-height: 14px; -} - -.folding-enabled .CodeMirror-linenumber { - text-align: left; - padding: 0 0 0 2px; -} - -/* set the linenumber white when there is a breakpoint */ -.new-breakpoint .CodeMirror-gutter-wrapper .CodeMirror-linenumber { - color: white; -} - -/* move the breakpoint below the other gutter elements */ -.new-breakpoint .CodeMirror-gutter-elt:nth-child(2) { - z-index: 0; -} - -.editor-wrapper .CodeMirror-line { - font-size: 11px; - line-height: 14px; -} - -.theme-dark .editor-wrapper .CodeMirror-line .cm-comment { - color: var(--theme-content-color3); -} - -.debug-line .CodeMirror-line { - background-color: var(--breakpoint-active-color) !important; -} - -/* Don't display the highlight color since the debug line - is already highlighted */ -.debug-line .CodeMirror-activeline-background { - display: none; -} - -.highlight-line .CodeMirror-line { - animation: fade-highlight-out 1.5s normal forwards; -} - -@keyframes fade-highlight-out { - 0% { background-color: var(--theme-highlight-gray); } - 100% { background-color: transparent; } -} - -.theme-dark .highlight-line .CodeMirror-line { - animation: fade-highlight-out-dark 1.5s normal forwards; -} - -@keyframes fade-highlight-out-dark { - 0% { background-color: var(--theme-content-color3); } - 100% { background-color: transparent; } -} - -.welcomebox { - width: calc(100% - 1px); - - /* Offsetting it by 30px for the sources-header area */ - height: calc(100% - 30px); - position: absolute; - top: 30px; - left: 0; - padding: 50px 0; - text-align: center; - font-size: 1.25em; - color: var(--theme-comment-alt); - background-color: var(--theme-tab-toolbar-background); - font-weight: lighter; - z-index: 100; - -moz-user-select: none; - user-select: none; -} .toggle-button-start, .toggle-button-end { transform: translate(0, 2px); @@ -1970,12 +1224,12 @@ html[dir="rtl"] .editor-mount { } .toggle-button-end { - margin-left: auto; - margin-right: 5px; + margin-inline-end: 5px; + margin-inline-start: auto; } .toggle-button-start { - margin-left: 5px; + margin-inline-start: 5px; } html:not([dir="rtl"]) .toggle-button-end svg, @@ -2224,6 +1478,7 @@ html .toggle-button-end.vertical svg { .popover { position: fixed; z-index: 100; + box-shadow: 1px 2px 4px 1px var(--theme-toolbar-background-alt); } .popover .gap { @@ -2282,7 +1537,6 @@ html .toggle-button-end.vertical svg { min-height: inherit; max-height: 200px; overflow: auto; - box-shadow: 1px 2px 4px 1px var(--theme-toolbar-background-alt); } .popover .preview .header { @@ -2350,121 +1604,211 @@ html .toggle-button-end.vertical svg { height: 4px; padding-top: 4px; } -.input-expression { - width: 100%; - margin: 0px; - border: 1px; - cursor: pointer; - background-color: var(--theme-body-background); - font-size: 12px; - padding: 0px 20px; - color: var(--theme-body-color); -} -.input-expression::placeholder { - text-align: center; - font-style: italic; +.add-to-expression-bar { + border: 1px solid var(--theme-splitter-color); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + font-size: 14px; + line-height: 30px; + background: var(--theme-toolbar-background); color: var(--theme-comment-alt); - opacity: 1; } -.input-expression:focus { - outline: none; - cursor: text; +.add-to-expression-bar .prompt { + padding-left: 3px; + width: 1em; } -.expression-input-container { - padding: 0.5em; - display: flex; +.add-to-expression-bar .expression-to-save-label { + width: calc(100% - 4em); } -.expression-container { - border: 1px; - padding: 8px 5px 0px 0px; +.add-to-expression-bar .expression-to-save-button { + font-size: 14px; + color: var(--theme-comment); + cursor: pointer; +} +/* vim:set ts=2 sw=2 sts=2 et: */ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * There's a known codemirror flex issue with chrome that this addresses. + * BUG https://github.com/devtools-html/debugger.html/issues/63 + */ +.editor-wrapper { + position: absolute; + height: calc(100% - 31px); width: 100%; - color: var(--theme-body-color); - background-color: var(--theme-body-background); - display: flex; - position: relative; + top: 30px; + left: 0px; + --editor-footer-height: 27px; + --editor-searchbar-height: 27px; + --editor-second-searchbar-height: 27px; } -.expression-container > .tree { - width: 100%; +html[dir="rtl"] .editor-mount { + direction: ltr; +} + +.editor-wrapper .breakpoints { + position: absolute; + top: 0; + left: 0; +} + +.function-search { + max-height: 300px; overflow: hidden; } -:root.theme-light .expression-container:hover { - background-color: var(--theme-tab-toolbar-background); +.function-search .results { + height: auto; } -:root.theme-dark .expression-container:hover { - background-color: var(--search-overlays-semitransparent); +.editor.hit-marker { + height: 14px; } -.expression-container .close-btn { +.coverage-on .CodeMirror-code :not(.hit-marker) .CodeMirror-line, +.coverage-on .CodeMirror-code :not(.hit-marker) .CodeMirror-gutter-wrapper { + opacity: 0.5; +} + +.editor.new-breakpoint svg { + fill: var(--theme-selection-background); + width: 60px; + height: 14px; position: absolute; - offset-inline-end: 6px; - top: 6px; + top: 0px; + right: -4px; } -.expression-container .close-btn { +.inline-bp { + background-color: #9ddfff; + width: 20px; + padding: 0px 5px; + margin: 0px 4px; + border-radius: 5px; + border-color: blue; + border: 1px solid #00b6ff; +} + +.inline-bp:hover { + cursor: pointer; +} + +.editor.new-breakpoint.folding-enabled svg { + right: -16px; +} + +.new-breakpoint.has-condition svg { + fill: var(--theme-graphs-yellow); +} + +.editor.new-breakpoint.breakpoint-disabled svg { + opacity: 0.3; +} + +.CodeMirror { + width: 100%; + height: 100%; +} + +.editor-wrapper .editor-mount { + width: 100%; + background-color: var(--theme-body-background); +} + +.CodeMirror-linenumber { + font-size: 11px; + line-height: 14px; +} + +.folding-enabled .CodeMirror-linenumber { + text-align: left; + padding: 0 0 0 2px; +} + +/* set the linenumber white when there is a breakpoint */ +.new-breakpoint .CodeMirror-gutter-wrapper .CodeMirror-linenumber { + color: white; +} + +/* move the breakpoint below the other gutter elements */ +.new-breakpoint .CodeMirror-gutter-elt:nth-child(2) { + z-index: 0; +} + +.editor-wrapper .CodeMirror-line { + font-size: 11px; + line-height: 14px; +} + +.theme-dark .editor-wrapper .CodeMirror-line .cm-comment { + color: var(--theme-content-color3); +} + +.debug-line .CodeMirror-line { + background-color: var(--breakpoint-active-color) !important; +} + +/* Don't display the highlight color since the debug line + is already highlighted */ +.debug-line .CodeMirror-activeline-background { display: none; } -.expression-container:hover .close-btn { - display: block; +.highlight-line .CodeMirror-line { + animation: fade-highlight-out 1.5s normal forwards; } -.expression-input { - cursor: pointer; - max-width: 50%; +@keyframes fade-highlight-out { + 0% { background-color: var(--theme-highlight-gray); } + 100% { background-color: transparent; } } -.expression-separator { - padding: 0px 5px; +.theme-dark .highlight-line .CodeMirror-line { + animation: fade-highlight-out-dark 1.5s normal forwards; } -.expression-value { - overflow-x: scroll; - color: var(--theme-content-color2); - max-width: 50% !important; +@keyframes fade-highlight-out-dark { + 0% { background-color: var(--theme-content-color3); } + 100% { background-color: transparent; } } -.expression-error { - color: var(--theme-highlight-red); -} -.secondary-panes { - display: flex; - flex-direction: column; - flex: 1; - white-space: nowrap; -} +.welcomebox { + width: calc(100% - 1px); -.secondary-panes * { - -moz-user-select: none; - user-select: none; -} - -.secondary-panes .accordion { - overflow-y: auto; - overflow-x: hidden; - flex: 1 0 auto; -} - -.pane { - color: var(--theme-body-color); -} - -.pane .pane-info { - font-style: italic; + /* Offsetting it by 30px for the sources-header area */ + height: calc(100% - 30px); + position: absolute; + top: 30px; + left: 0; + padding: 50px 0; text-align: center; - padding: 0.5em; + font-size: 1.25em; + color: var(--theme-comment-alt); + background-color: var(--theme-tab-toolbar-background); + font-weight: lighter; + z-index: 100; -moz-user-select: none; user-select: none; } -.theme-dark .secondary-panes .accordion .arrow svg { - fill: var(--theme-comment); +.CodeMirror-guttermarker-subtle { + visibility: hidden; +} + +.visible { + visibility: visible; } .why-paused { @@ -2481,6 +1825,10 @@ html .toggle-button-end.vertical svg { .theme-dark .secondary-panes .why-paused { color: white; } + +.why-paused .message { + font-size: 10px; +} .breakpoints-list * { -moz-user-select: none; user-select: none; @@ -2579,36 +1927,110 @@ html .breakpoints-list .breakpoint.paused { .breakpoint:hover .close { visibility: visible; } - -.object-node.default-property { - opacity: 0.6; +.input-expression { + width: 100%; + margin: 0px; + border: 1px; + cursor: pointer; + background-color: var(--theme-body-background); + font-size: 12px; + padding: 0px 20px; + color: var(--theme-body-color); } -.object-label { - color: var(--theme-highlight-blue); +.input-expression::placeholder { + text-align: center; + font-style: italic; + color: var(--theme-comment-alt); + opacity: 1; } -.objectBox-object, -.objectBox-string, -.objectBox-text, -.objectBox-table, -.objectLink-textNode, -.objectLink-event, -.objectLink-eventLog, -.objectLink-regexp, -.objectLink-object, -.objectLink-Date, -.theme-dark .objectBox-object, -.theme-light .objectBox-object { - white-space: nowrap; +.input-expression:focus { + outline: none; + cursor: text; } -.scopes-list .tree-node { +.expression-input-container { + padding: 0.5em; + display: flex; +} + +.expression-container { + border: 1px; + padding: 8px 5px 0px 0px; + width: 100%; + color: var(--theme-body-color); + background-color: var(--theme-body-background); + display: flex; + position: relative; +} + +.expression-container > .tree { + width: 100%; overflow: hidden; } -.scopes-list .function-signature { - display: inline-block; +:root.theme-light .expression-container:hover { + background-color: var(--theme-tab-toolbar-background); +} + +:root.theme-dark .expression-container:hover { + background-color: var(--search-overlays-semitransparent); +} + +.expression-container .close-btn { + position: absolute; + offset-inline-end: 6px; + top: 6px; +} + +.expression-container .close-btn { + display: none; +} + +.expression-container:hover .close-btn { + display: block; +} + +.expression-input { + cursor: pointer; + max-width: 50%; +} + +.expression-separator { + padding: 0px 5px; +} + +.expression-value { + overflow-x: scroll; + color: var(--theme-content-color2); + max-width: 50% !important; +} + +.expression-error { + color: var(--theme-highlight-red); +} +.frames ul .frames-group .group, +.frames ul .frames-group .group .location { + font-weight: 500; +} + +.frames ul .frames-group.expanded .group, +.frames ul .frames-group.expanded .group .location { + color: var(--theme-highlight-blue); +} + +.frames ul .frames-group.expanded .react path { + fill: var(--theme-highlight-blue); +} + +.frames ul .frames-group .frames-list li { + padding-left: 30px; +} + +.frames ul .frames-group .frames-list { + border-top: 1px solid var(--theme-splitter-color); + border-bottom: 1px solid var(--theme-splitter-color); } .frames ul { list-style: none; @@ -2627,12 +2049,6 @@ html .breakpoints-list .breakpoint.paused { margin: 0; } -/* Style the focused call frame like so: -.frames ul li:focus { - border: 3px solid red; -} -*/ - .frames ul li * { -moz-user-select: none; user-select: none; @@ -2687,6 +2103,10 @@ html .breakpoints-list .breakpoint.paused { color: white; } +.frames ul li.selected i.annotation-logo svg path { + fill: white; +} + :root.theme-light .frames ul li.selected .location, :root.theme-firebug .frames ul li.selected .location, :root.theme-dark .frames ul li.selected .location { @@ -2713,7 +2133,8 @@ html .breakpoints-list .breakpoint.paused { .annotation-logo { width: 12px; - margin-left: 2px; + margin-left: 3px; + line-height: 8px; } :root.theme-dark .annotation-logo svg path { @@ -2842,6 +2263,10 @@ html .breakpoints-list .breakpoint.paused { background-color: var(--theme-body-background); } +html[dir="rtl"] .command-bar { + border-right: 1px solid var(--theme-splitter-color); +} + .theme-dark .command-bar { background-color: var(--theme-tab-toolbar-background); } @@ -2904,6 +2329,70 @@ html .command-bar > button:disabled { .command-bar button.pause-exceptions.all { color: var(--theme-highlight-blue); } + +.object-node.default-property { + opacity: 0.6; +} + +.object-label { + color: var(--theme-highlight-blue); +} + +.objectBox-object, +.objectBox-string, +.objectBox-text, +.objectBox-table, +.objectLink-textNode, +.objectLink-event, +.objectLink-eventLog, +.objectLink-regexp, +.objectLink-object, +.objectLink-Date, +.theme-dark .objectBox-object, +.theme-light .objectBox-object { + white-space: nowrap; +} + +.scopes-list .tree-node { + overflow: hidden; +} + +.scopes-list .function-signature { + display: inline-block; +} +.secondary-panes { + display: flex; + flex-direction: column; + flex: 1; + white-space: nowrap; +} + +.secondary-panes * { + -moz-user-select: none; + user-select: none; +} + +.secondary-panes .accordion { + overflow-y: auto; + overflow-x: hidden; + flex: 1 0 auto; +} + +.pane { + color: var(--theme-body-color); +} + +.pane .pane-info { + font-style: italic; + text-align: center; + padding: 0.5em; + -moz-user-select: none; + user-select: none; +} + +.theme-dark .secondary-panes .accordion .arrow svg { + fill: var(--theme-comment); +} .welcomebox { width: calc(100% - 1px); @@ -2970,7 +2459,6 @@ html .welcomebox .toggle-button-end { overflow: hidden; padding: 6px; margin-inline-start: 3px; - margin-top: 2px; } .source-tab:hover { @@ -3004,6 +2492,20 @@ html .welcomebox .toggle-button-end { fill: var(--theme-textbox-box-shadow); } +.source-tab .blackBox { + line-height: 0; + padding: 5px; +} + +.source-tab .blackBox svg { + height: 12px; + width: 12px; +} + +.source-tab .blackBox path { + fill: var(--theme-textbox-box-shadow); +} + .source-tab .filename { white-space: nowrap; text-overflow: ellipsis; diff --git a/devtools/client/debugger/new/debugger.js b/devtools/client/debugger/new/debugger.js index 9998c9fa18b1..4e1a116f65fb 100644 --- a/devtools/client/debugger/new/debugger.js +++ b/devtools/client/debugger/new/debugger.js @@ -1,13 +1,13 @@ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags")); + module.exports = factory(require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor")); else if(typeof define === 'function' && define.amd) - define(["devtools/client/shared/vendor/react", "Services", "devtools/shared/flags"], factory); + define(["devtools/client/shared/vendor/react", "Services", "devtools/shared/flags", "devtools/client/sourceeditor/editor"], factory); else { - var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags")) : factory(root["devtools/client/shared/vendor/react"], root["Services"], root["devtools/shared/flags"]); + var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor")) : factory(root["devtools/client/shared/vendor/react"], root["Services"], root["devtools/shared/flags"], root["devtools/client/sourceeditor/editor"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } -})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_29__, __WEBPACK_EXTERNAL_MODULE_121__) { +})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_29__, __WEBPACK_EXTERNAL_MODULE_121__, __WEBPACK_EXTERNAL_MODULE_994__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -65,6 +65,11 @@ return /******/ (function(modules) { // webpackBootstrap var React = __webpack_require__(2); var ReactDOM = __webpack_require__(22); + // + // if (process.env.NODE_ENV !== "production") { + // const Perf = require("react-addons-perf"); + // window.Perf = Perf; + // } var _require = __webpack_require__(131), bootstrap = _require.bootstrap, @@ -1175,16 +1180,16 @@ return /******/ (function(modules) { // webpackBootstrap /* 51 */ /***/ function(module, exports) { - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } /***/ }, @@ -2783,7 +2788,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 118 */ /***/ function(module, exports) { - + /***/ }, /* 119 */ @@ -3190,6 +3195,10 @@ return /******/ (function(modules) { // webpackBootstrap process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -3274,7 +3283,7 @@ return /******/ (function(modules) { // webpackBootstrap if (isDevelopment()) { var config = yield updateConfig(); actions.setConfig(config); - AppConstants.DEBUG_JS_MODULES = true; + // AppConstants.DEBUG_JS_MODULES = true; } return { store, actions, LaunchpadApp }; @@ -3358,9 +3367,7 @@ return /******/ (function(modules) { // webpackBootstrap var _require2 = __webpack_require__(151), Provider = _require2.Provider; - var _require3 = __webpack_require__(830), - DevToolsUtils = _require3.DevToolsUtils, - AppConstants = _require3.AppConstants, + var _require3 = __webpack_require__(137), defer = _require3.defer; var _require4 = __webpack_require__(184), @@ -3373,15 +3380,15 @@ return /******/ (function(modules) { // webpackBootstrap var L10N = __webpack_require__(185); - var _require6 = __webpack_require__(180), + var _require6 = __webpack_require__(966), showMenu = _require6.showMenu, buildMenu = _require6.buildMenu; - setConfig(({"environment":"firefox-panel","logging":false,"clientLogging":false,"firefox":{"mcPath":"./firefox"},"workers":{"parserURL":"resource://devtools/client/debugger/new/parser-worker.js","prettyPrintURL":"resource://devtools/client/debugger/new/pretty-print-worker.js"},"features":{"blackbox":{"enabled":true},"watchExpressions":{"enabled":true},"chromeScopes":{"enabled":false},"eventListeners":{"enabled":false},"codeCoverage":{"enabled":false},"searchModifiers":{"enabled":true},"symbolSearch":{"enabled":true},"editorPreview":{"enabled":true},"showSource":{"enabled":true}}})); + setConfig(({"environment":"firefox-panel","logging":false,"clientLogging":false,"firefox":{"mcPath":"./firefox"},"workers":{"parserURL":"resource://devtools/client/debugger/new/parser-worker.js","prettyPrintURL":"resource://devtools/client/debugger/new/pretty-print-worker.js"},"features":{"blackbox":{"enabled":true},"chromeScopes":{"enabled":false},"eventListeners":{"enabled":false},"codeCoverage":{"enabled":false}}})); // Set various flags before requiring app code. if (getValue("logging.client")) { - DevToolsUtils.dumpn.wantLogging = true; + // DevToolsUtils.dumpn.wantLogging = true; } var _require7 = __webpack_require__(885), @@ -3690,7 +3697,7 @@ return /******/ (function(modules) { // webpackBootstrap * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var _require = __webpack_require__(830), + var _require = __webpack_require__(137), defer = _require.defer; var _require2 = __webpack_require__(138), @@ -3752,7 +3759,30 @@ return /******/ (function(modules) { // webpackBootstrap exports.promise = promiseMiddleware; /***/ }, -/* 137 */, +/* 137 */ +/***/ function(module, exports) { + + "use strict"; + + /** + * Returns a deferred object, with a resolve and reject property. + * https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred + */ + module.exports = function defer() { + var resolve = void 0, + reject = void 0; + var promise = new Promise(function () { + resolve = arguments[0]; + reject = arguments[1]; + }); + return { + resolve: resolve, + reject: reject, + promise: promise + }; + }; + +/***/ }, /* 138 */ /***/ function(module, exports, __webpack_require__) { @@ -3768,7 +3798,7 @@ return /******/ (function(modules) { // webpackBootstrap * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var co = __webpack_require__(882); + var co = __webpack_require__(965); function asPaused(client, func) { if (client.state != "paused") { @@ -4533,7 +4563,7 @@ return /******/ (function(modules) { // webpackBootstrap var array = this._array; var maxIndex = array.length - 1; var ii = 0; - return new Iterator(function() + return new Iterator(function() {return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} @@ -5004,7 +5034,7 @@ return /******/ (function(modules) { // webpackBootstrap Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; var ii = 0; - return new Iterator(function() + return new Iterator(function() {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} ); }; @@ -7202,7 +7232,7 @@ return /******/ (function(modules) { // webpackBootstrap return flipSequence; }; } - reversedSequence.get = function(key, notSetValue) + reversedSequence.get = function(key, notSetValue) {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; reversedSequence.has = function(key ) {return iterable.has(useKeys ? key : -1 - key)}; @@ -7401,7 +7431,7 @@ return /******/ (function(modules) { // webpackBootstrap return this.cacheResult().__iterate(fn, reverse); } var iterations = 0; - iterable.__iterate(function(v, k, c) + iterable.__iterate(function(v, k, c) {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} ); return iterations; @@ -7592,7 +7622,7 @@ return /******/ (function(modules) { // webpackBootstrap interposedSequence.size = iterable.size && iterable.size * 2 -1; interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; var iterations = 0; - iterable.__iterate(function(v, k) + iterable.__iterate(function(v, k) {return (!iterations || fn(separator, iterations++, this$0) !== false) && fn(v, iterations++, this$0) !== false}, reverse @@ -11586,7 +11616,7 @@ return /******/ (function(modules) { // webpackBootstrap var React = __webpack_require__(2); var dom = React.DOM; - var _require = __webpack_require__(180), + var _require = __webpack_require__(966), showMenu = _require.showMenu, buildMenu = _require.buildMenu; @@ -11698,105 +11728,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = Settings; /***/ }, -/* 180 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var _require = __webpack_require__(830), - Menu = _require.Menu, - MenuItem = _require.MenuItem; - - var _require2 = __webpack_require__(828), - isFirefoxPanel = _require2.isFirefoxPanel; - - function createPopup(doc) { - var popup = doc.createElement("menupopup"); - popup.className = "landing-popup"; - if (popup.openPopupAtScreen) { - return popup; - } - - function preventDefault(e) { - e.preventDefault(); - e.returnValue = false; - } - - var mask = document.querySelector("#contextmenu-mask"); - if (!mask) { - mask = doc.createElement("div"); - mask.id = "contextmenu-mask"; - document.body.appendChild(mask); - } - - mask.onclick = () => popup.hidePopup(); - - popup.openPopupAtScreen = function (clientX, clientY) { - this.style.setProperty("left", `${clientX}px`); - this.style.setProperty("top", `${clientY}px`); - mask = document.querySelector("#contextmenu-mask"); - window.onwheel = preventDefault; - mask.classList.add("show"); - this.dispatchEvent(new Event("popupshown")); - this.popupshown; - }; - - popup.hidePopup = function () { - this.remove(); - mask = document.querySelector("#contextmenu-mask"); - mask.classList.remove("show"); - window.onwheel = null; - }; - - return popup; - } - - if (!isFirefoxPanel()) { - Menu.prototype.createPopup = createPopup; - } - - function onShown(menu, popup) { - popup.childNodes.forEach((menuitem, index) => { - var item = menu.items[index]; - - if (!item.disabled) { - menuitem.onclick = () => { - item.click(); - popup.hidePopup(); - }; - } - }); - } - - function showMenu(e, items) { - if (items.length === 0) { - return; - } - - var menu = new Menu(); - items.forEach(item => menu.append(new MenuItem(item))); - - if (isFirefoxPanel()) { - return menu.popup(e.screenX, e.screenY, { doc: window.parent.document }); - } - - menu.on("open", (_, popup) => onShown(menu, popup)); - menu.popup(e.clientX, e.clientY, { doc: document }); - } - - function buildMenu(items) { - return items.map(itm => { - var hide = typeof itm.hidden === "function" ? itm.hidden() : itm.hidden; - return hide ? null : itm.item; - }).filter(itm => itm !== null); - } - - module.exports = { - showMenu, - buildMenu - }; - -/***/ }, +/* 180 */, /* 181 */ /***/ function(module, exports, __webpack_require__) { @@ -12011,7 +11943,7 @@ return /******/ (function(modules) { // webpackBootstrap function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - var _require = __webpack_require__(830), + var _require = __webpack_require__(975), sprintf = _require.sprintf; var _require2 = __webpack_require__(883), @@ -12101,40 +12033,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - /* global window */ + Object.defineProperty(exports, "__esModule", { + value: true + }); - /** - * Redux store utils - * @module utils/create-store - */ + var _redux = __webpack_require__(3); - var _require = __webpack_require__(3), - createStore = _require.createStore, - applyMiddleware = _require.applyMiddleware; + var _waitService = __webpack_require__(190); - var _require2 = __webpack_require__(190), - waitUntilService = _require2.waitUntilService; + var _log = __webpack_require__(191); - var _require3 = __webpack_require__(191), - log = _require3.log; + var _history = __webpack_require__(192); - var _require4 = __webpack_require__(192), - history = _require4.history; - - var _require5 = __webpack_require__(193), - promise = _require5.promise; - - var _require6 = __webpack_require__(224), - thunk = _require6.thunk; - - /** - * @memberof utils/create-store - * @static - */ + var _promise = __webpack_require__(193); + var _thunk = __webpack_require__(224); /** * This creates a dispatcher with all the standard middleware in place @@ -12149,19 +12062,37 @@ return /******/ (function(modules) { // webpackBootstrap * @memberof utils/create-store * @static */ + + + /** + * @memberof utils/create-store + * @static + */ + + + /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + /* global window */ + + /** + * Redux store utils + * @module utils/create-store + */ + var configureStore = function () { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var middleware = [thunk(opts.makeThunkArgs), promise, + var middleware = [(0, _thunk.thunk)(opts.makeThunkArgs), _promise.promise, // Order is important: services must go last as they always // operate on "already transformed" actions. Actions going through // them shouldn't have any special fields like promises, they // should just be normal JSON objects. - waitUntilService]; + _waitService.waitUntilService]; if (opts.history) { - middleware.push(history(opts.history)); + middleware.push((0, _history.history)(opts.history)); } if (opts.middleware) { @@ -12169,16 +12100,16 @@ return /******/ (function(modules) { // webpackBootstrap } if (opts.log) { - middleware.push(log); + middleware.push(_log.log); } // Hook in the redux devtools browser extension if it exists var devtoolsExt = typeof window === "object" && window.devToolsExtension ? window.devToolsExtension() : f => f; - return applyMiddleware.apply(undefined, middleware)(devtoolsExt(createStore)); + return _redux.applyMiddleware.apply(undefined, middleware)(devtoolsExt(_redux.createStore)); }; - module.exports = configureStore; + exports.default = configureStore; /***/ }, /* 190 */ @@ -12255,6 +12186,10 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.log = log; /** * A middleware that logs all actions coming through the system * to the console. @@ -12271,29 +12206,31 @@ return /******/ (function(modules) { // webpackBootstrap }; } - exports.log = log; - /***/ }, /* 192 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var _require = __webpack_require__(828), - isDevelopment = _require.isDevelopment; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.history = undefined; + + var _devtoolsConfig = __webpack_require__(828); /** * A middleware that stores every action coming through the store in the passed * in logging object. Should only be used for tests, as it collects all * action information, which will cause memory bloat. */ - exports.history = function () { + var history = exports.history = function () { var log = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; return (_ref) => { var dispatch = _ref.dispatch, getState = _ref.getState; - if (isDevelopment()) { + if ((0, _devtoolsConfig.isDevelopment)()) { console.warn("Using history middleware stores all actions in state for " + "testing and devtools is not currently running in test " + "mode. Be sure this is intentional."); } return next => action => { @@ -12309,18 +12246,31 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.promise = exports.PROMISE = undefined; + + var _defer = __webpack_require__(194); + + var _defer2 = _interopRequireDefault(_defer); + + var _toPairs = __webpack_require__(195); + + var _toPairs2 = _interopRequireDefault(_toPairs); + + var _fromPairs = __webpack_require__(221); + + var _fromPairs2 = _interopRequireDefault(_fromPairs); + + var _DevToolsUtils = __webpack_require__(222); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var defer = __webpack_require__(194); - var toPairs = __webpack_require__(195); - var fromPairs = __webpack_require__(221); - - var _require = __webpack_require__(222), - executeSoon = _require.executeSoon; - - var PROMISE = exports.PROMISE = "@@dispatch/promise"; var seqIdVal = 1; function seqIdGen() { @@ -12328,7 +12278,7 @@ return /******/ (function(modules) { // webpackBootstrap } function filterAction(action) { - return fromPairs(toPairs(action).filter(pair => pair[0] !== PROMISE)); + return (0, _fromPairs2.default)((0, _toPairs2.default)(action).filter(pair => pair[0] !== PROMISE)); } function promiseMiddleware(_ref) { @@ -12351,9 +12301,9 @@ return /******/ (function(modules) { // webpackBootstrap // Return the promise so action creators can still compose if they // want to. - var deferred = defer(); + var deferred = (0, _defer2.default)(); promiseInst.then(value => { - executeSoon(() => { + (0, _DevToolsUtils.executeSoon)(() => { dispatch(Object.assign({}, action, { status: "done", value: value @@ -12361,7 +12311,7 @@ return /******/ (function(modules) { // webpackBootstrap deferred.resolve(value); }); }, error => { - executeSoon(() => { + (0, _DevToolsUtils.executeSoon)(() => { dispatch(Object.assign({}, action, { status: "error", error: error.message || error @@ -12373,6 +12323,7 @@ return /******/ (function(modules) { // webpackBootstrap }; } + var PROMISE = exports.PROMISE = "@@dispatch/promise"; exports.promise = promiseMiddleware; /***/ }, @@ -12381,6 +12332,10 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = defer; function defer() { var resolve = void 0; // eslint-disable-line no-unused-vars var reject = void 0; // eslint-disable-line no-unused-vars @@ -12395,8 +12350,6 @@ return /******/ (function(modules) { // webpackBootstrap }; } - module.exports = defer; - /***/ }, /* 195 */ /***/ function(module, exports, __webpack_require__) { @@ -13256,7 +13209,17 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var assert = __webpack_require__(223); + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.reportException = reportException; + exports.executeSoon = executeSoon; + + var _assert = __webpack_require__(223); + + var _assert2 = _interopRequireDefault(_assert); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function reportException(who, exception) { var msg = `${who} threw an exception: `; @@ -13267,7 +13230,7 @@ return /******/ (function(modules) { // webpackBootstrap setTimeout(fn, 0); } - module.exports = { reportException, executeSoon, assert }; + exports.default = _assert2.default; /***/ }, /* 223 */ @@ -13275,14 +13238,16 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = assert; function assert(condition, message) { if (!condition) { throw new Error(`Assertion failure: ${message}`); } } - module.exports = assert; - /***/ }, /* 224 */ /***/ function(module, exports) { @@ -13359,28 +13324,57 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _expressions = __webpack_require__(228); + + var _expressions2 = _interopRequireDefault(_expressions); + + var _eventListeners = __webpack_require__(231); + + var _eventListeners2 = _interopRequireDefault(_eventListeners); + + var _sources = __webpack_require__(232); + + var _sources2 = _interopRequireDefault(_sources); + + var _breakpoints = __webpack_require__(236); + + var _breakpoints2 = _interopRequireDefault(_breakpoints); + + var _asyncRequests = __webpack_require__(238); + + var _asyncRequests2 = _interopRequireDefault(_asyncRequests); + + var _pause = __webpack_require__(239); + + var _pause2 = _interopRequireDefault(_pause); + + var _ui = __webpack_require__(240); + + var _ui2 = _interopRequireDefault(_ui); + + var _coverage = __webpack_require__(241); + + var _coverage2 = _interopRequireDefault(_coverage); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var expressions = __webpack_require__(228); - var eventListeners = __webpack_require__(231); - var sources = __webpack_require__(232); - var breakpoints = __webpack_require__(236); - var asyncRequests = __webpack_require__(238); - var pause = __webpack_require__(239); - var ui = __webpack_require__(240); - var coverage = __webpack_require__(241); - - module.exports = { - expressions: expressions.update, - eventListeners: eventListeners.update, - sources: sources.update, - breakpoints: breakpoints.update, - pause: pause.update, - asyncRequests, - ui: ui.update, - coverage: coverage.update + exports.default = { + expressions: _expressions2.default, + eventListeners: _eventListeners2.default, + sources: _sources2.default, + breakpoints: _breakpoints2.default, + asyncRequests: _asyncRequests2.default, + pause: _pause2.default, + ui: _ui2.default, + coverage: _coverage2.default }; /***/ }, @@ -13392,10 +13386,7 @@ return /******/ (function(modules) { // webpackBootstrap Object.defineProperty(exports, "__esModule", { value: true }); - exports.State = undefined; - exports.update = update; - exports.getExpressions = getExpressions; - exports.getVisibleExpressions = getVisibleExpressions; + exports.getVisibleExpressions = exports.getExpressions = exports.State = undefined; exports.getExpression = getExpression; var _constants = __webpack_require__(229); @@ -13408,6 +13399,8 @@ return /******/ (function(modules) { // webpackBootstrap var _immutable = __webpack_require__(146); + var _reselect = __webpack_require__(992); + var _prefs = __webpack_require__(226); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -13490,76 +13483,85 @@ return /******/ (function(modules) { // webpackBootstrap return newState; } - function getExpressions(state) { - return state.expressions.get("expressions"); - } + var getExpressionsWrapper = state => state.expressions; - function getVisibleExpressions(state) { - return state.expressions.get("expressions").filter(e => e.visible); - } + var getExpressions = exports.getExpressions = (0, _reselect.createSelector)(getExpressionsWrapper, expressions => expressions.get("expressions")); + + var getVisibleExpressions = exports.getVisibleExpressions = (0, _reselect.createSelector)(getExpressions, expressions => expressions.filter(e => e.visible)); function getExpression(state, input) { return getExpressions(state).find(exp => exp.input == input); } + exports.default = update; + /***/ }, /* 229 */ /***/ function(module, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + + /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - exports.UPDATE_EVENT_BREAKPOINTS = "UPDATE_EVENT_BREAKPOINTS"; - exports.FETCH_EVENT_LISTENERS = "FETCH_EVENT_LISTENERS"; + exports.default = { + UPDATE_EVENT_BREAKPOINTS: "UPDATE_EVENT_BREAKPOINTS", + FETCH_EVENT_LISTENERS: "FETCH_EVENT_LISTENERS", - exports.TOGGLE_PRETTY_PRINT = "TOGGLE_PRETTY_PRINT"; - exports.BLACKBOX = "BLACKBOX"; + TOGGLE_PRETTY_PRINT: "TOGGLE_PRETTY_PRINT", + BLACKBOX: "BLACKBOX", - exports.ADD_BREAKPOINT = "ADD_BREAKPOINT"; - exports.REMOVE_BREAKPOINT = "REMOVE_BREAKPOINT"; - exports.ENABLE_BREAKPOINT = "ENABLE_BREAKPOINT"; - exports.DISABLE_BREAKPOINT = "DISABLE_BREAKPOINT"; - exports.SET_BREAKPOINT_CONDITION = "SET_BREAKPOINT_CONDITION"; - exports.TOGGLE_BREAKPOINTS = "TOGGLE_BREAKPOINTS"; + ADD_BREAKPOINT: "ADD_BREAKPOINT", + REMOVE_BREAKPOINT: "REMOVE_BREAKPOINT", + ENABLE_BREAKPOINT: "ENABLE_BREAKPOINT", + DISABLE_BREAKPOINT: "DISABLE_BREAKPOINT", + SET_BREAKPOINT_CONDITION: "SET_BREAKPOINT_CONDITION", + TOGGLE_BREAKPOINTS: "TOGGLE_BREAKPOINTS", - exports.ADD_SOURCE = "ADD_SOURCE"; - exports.ADD_SOURCES = "ADD_SOURCES"; - exports.LOAD_SOURCE_TEXT = "LOAD_SOURCE_TEXT"; - exports.SELECT_SOURCE = "SELECT_SOURCE"; - exports.SELECT_SOURCE_URL = "SELECT_SOURCE_URL"; - exports.CLOSE_TAB = "CLOSE_TAB"; - exports.CLOSE_TABS = "CLOSE_TABS"; - exports.NAVIGATE = "NAVIGATE"; - exports.RELOAD = "RELOAD"; + ADD_SOURCE: "ADD_SOURCE", + ADD_SOURCES: "ADD_SOURCES", + LOAD_SOURCE_TEXT: "LOAD_SOURCE_TEXT", + SELECT_SOURCE: "SELECT_SOURCE", + SELECT_SOURCE_URL: "SELECT_SOURCE_URL", + CLOSE_TAB: "CLOSE_TAB", + CLOSE_TABS: "CLOSE_TABS", + NAVIGATE: "NAVIGATE", + RELOAD: "RELOAD", - exports.ADD_TABS = "ADD_TABS"; - exports.SELECT_TAB = "SELECT_TAB"; + ADD_TABS: "ADD_TABS", + SELECT_TAB: "SELECT_TAB", - exports.BREAK_ON_NEXT = "BREAK_ON_NEXT"; - exports.RESUME = "RESUME"; - exports.PAUSED = "PAUSED"; - exports.PAUSE_ON_EXCEPTIONS = "PAUSE_ON_EXCEPTIONS"; - exports.COMMAND = "COMMAND"; - exports.SELECT_FRAME = "SELECT_FRAME"; - exports.LOAD_OBJECT_PROPERTIES = "LOAD_OBJECT_PROPERTIES"; - exports.ADD_EXPRESSION = "ADD_EXPRESSION"; - exports.EVALUATE_EXPRESSION = "EVALUATE_EXPRESSION"; - exports.UPDATE_EXPRESSION = "UPDATE_EXPRESSION"; - exports.DELETE_EXPRESSION = "DELETE_EXPRESSION"; + BREAK_ON_NEXT: "BREAK_ON_NEXT", + RESUME: "RESUME", + PAUSED: "PAUSED", + PAUSE_ON_EXCEPTIONS: "PAUSE_ON_EXCEPTIONS", + COMMAND: "COMMAND", + SELECT_FRAME: "SELECT_FRAME", + LOAD_OBJECT_PROPERTIES: "LOAD_OBJECT_PROPERTIES", + ADD_EXPRESSION: "ADD_EXPRESSION", + EVALUATE_EXPRESSION: "EVALUATE_EXPRESSION", + UPDATE_EXPRESSION: "UPDATE_EXPRESSION", + DELETE_EXPRESSION: "DELETE_EXPRESSION", - exports.RECORD_COVERAGE = "RECORD_COVERAGE"; + RECORD_COVERAGE: "RECORD_COVERAGE", - exports.TOGGLE_PROJECT_SEARCH = "TOGGLE_PROJECT_SEARCH"; - exports.TOGGLE_FILE_SEARCH = "TOGGLE_FILE_SEARCH"; - exports.UPDATE_FILE_SEARCH_QUERY = "UPDATE_FILE_SEARCH_QUERY"; - exports.TOGGLE_FILE_SEARCH_MODIFIER = "TOGGLE_FILE_SEARCH_MODIFIER"; - exports.SHOW_SOURCE = "SHOW_SOURCE"; - exports.TOGGLE_PANE = "TOGGLE_PANE"; + TOGGLE_PROJECT_SEARCH: "TOGGLE_PROJECT_SEARCH", + TOGGLE_FILE_SEARCH: "TOGGLE_FILE_SEARCH", + TOGGLE_SYMBOL_SEARCH: "TOGGLE_SYMBOL_SEARCH", + SET_SYMBOL_SEARCH_TYPE: "SET_SYMBOL_SEARCH_TYPE", + UPDATE_FILE_SEARCH_QUERY: "UPDATE_FILE_SEARCH_QUERY", + TOGGLE_FILE_SEARCH_MODIFIER: "TOGGLE_FILE_SEARCH_MODIFIER", + SHOW_SOURCE: "SHOW_SOURCE", + TOGGLE_PANE: "TOGGLE_PANE" + }; /***/ }, /* 230 */ @@ -13606,7 +13608,6 @@ return /******/ (function(modules) { // webpackBootstrap Object.defineProperty(exports, "__esModule", { value: true }); - exports.update = update; exports.getEventListeners = getEventListeners; var _constants = __webpack_require__(229); @@ -13652,12 +13653,50 @@ return /******/ (function(modules) { // webpackBootstrap return state.eventListeners.listeners; } + exports.default = update; + /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getSelectedSource = exports.getSelectedLocation = exports.getSourcesForTabs = exports.getSourceTabs = exports.getSources = exports.State = undefined; + exports.getSource = getSource; + exports.getSourceByURL = getSourceByURL; + exports.getSourceText = getSourceText; + exports.getPendingSelectedLocation = getPendingSelectedLocation; + exports.getPrettySource = getPrettySource; + exports.getSourceInSources = getSourceInSources; + + var _immutable = __webpack_require__(146); + + var I = _interopRequireWildcard(_immutable); + + var _reselect = __webpack_require__(992); + + var _makeRecord = __webpack_require__(230); + + var _makeRecord2 = _interopRequireDefault(_makeRecord); + + var _source2 = __webpack_require__(233); + + var _prefs = __webpack_require__(226); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + var State = exports.State = (0, _makeRecord2.default)({ + sources: I.Map(), + selectedLocation: undefined, + pendingSelectedLocation: _prefs.prefs.pendingSelectedLocation, + sourcesText: I.Map(), + tabs: I.List(restoreTabs()) + }); /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -13667,23 +13706,6 @@ return /******/ (function(modules) { // webpackBootstrap * @module reducers/sources */ - var I = __webpack_require__(146); - var makeRecord = __webpack_require__(230); - - var _require = __webpack_require__(233), - getPrettySourceURL = _require.getPrettySourceURL; - - var _require2 = __webpack_require__(226), - prefs = _require2.prefs; - - var State = makeRecord({ - sources: I.Map(), - selectedLocation: undefined, - pendingSelectedLocation: prefs.pendingSelectedLocation, - sourcesText: I.Map(), - tabs: I.List(restoreTabs()) - }); - function update() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : State(); var action = arguments[1]; @@ -13712,7 +13734,7 @@ return /******/ (function(modules) { // webpackBootstrap line: action.line, url: action.source.url }; - prefs.pendingSelectedLocation = location; + _prefs.prefs.pendingSelectedLocation = location; var sourceUrl = action.source.url || ""; return state.set("selectedLocation", { @@ -13728,7 +13750,7 @@ return /******/ (function(modules) { // webpackBootstrap line: action.line }; - prefs.pendingSelectedLocation = location; + _prefs.prefs.pendingSelectedLocation = location; return state.set("pendingSelectedLocation", location); case "CLOSE_TAB": @@ -13760,7 +13782,7 @@ return /******/ (function(modules) { // webpackBootstrap case "NAVIGATE": var source = getSelectedSource({ sources: state }); var _url = source && source.get("url"); - prefs.pendingSelectedLocation = { url: _url }; + _prefs.prefs.pendingSelectedLocation = { url: _url }; return State().set("pendingSelectedLocation", { url: _url }); } @@ -13799,7 +13821,7 @@ return /******/ (function(modules) { // webpackBootstrap function removeSourceFromTabList(tabs, url) { var newTabs = tabs.filter(tab => tab != url); - prefs.tabs = newTabs; + _prefs.prefs.tabs = newTabs; return newTabs; } @@ -13808,7 +13830,7 @@ return /******/ (function(modules) { // webpackBootstrap } function restoreTabs() { - var prefsTabs = prefs.tabs || []; + var prefsTabs = _prefs.prefs.tabs || []; if (Object.keys(prefsTabs).length == 0) { return; } @@ -13835,7 +13857,7 @@ return /******/ (function(modules) { // webpackBootstrap tabs = tabs.insert(0, url); } - prefs.tabs = tabs.toJS(); + _prefs.prefs.tabs = tabs.toJS(); return tabs; } @@ -13877,7 +13899,8 @@ return /******/ (function(modules) { // webpackBootstrap var leftNeighborIndex = Math.max(tabUrls.indexOf(selectedTabUrl) - 1, 0); var lastAvailbleTabIndex = availableTabs.size - 1; var newSelectedTabIndex = Math.min(leftNeighborIndex, lastAvailbleTabIndex); - var tabSource = state.sources.find(source => source.get("url") === availableTabs.toJS()[newSelectedTabIndex]); + var availableTab = availableTabs.toJS()[newSelectedTabIndex]; + var tabSource = getSourceByUrlInSources(state.sources, availableTab); if (tabSource) { return tabSource.get("id"); @@ -13897,20 +13920,14 @@ return /******/ (function(modules) { // webpackBootstrap // (right now) to type those wrapped functions. + var getSourcesState = state => state.sources; + function getSource(state, id) { - return state.sources.sources.get(id); + return getSourceInSources(getSources(state), id); } function getSourceByURL(state, url) { - return state.sources.sources.find(source => source.get("url") == url); - } - - function getSourceById(state, id) { - return state.sources.sources.find(source => source.get("id") == id); - } - - function getSources(state) { - return state.sources.sources; + return getSourceByUrlInSources(state.sources.sources, url); } function getSourceText(state, id) { @@ -13919,23 +13936,6 @@ return /******/ (function(modules) { // webpackBootstrap } } - function getSourceTabs(state) { - return state.sources.tabs.filter(tab => getSourceByURL(state, tab)); - } - - function getSelectedSource(state) { - var selectedLocation = state.sources.selectedLocation; - if (!selectedLocation) { - return; - } - - return state.sources.sources.find(source => source.get("id") == selectedLocation.sourceId); - } - - function getSelectedLocation(state) { - return state.sources.selectedLocation; - } - function getPendingSelectedLocation(state) { return state.sources.pendingSelectedLocation; } @@ -13946,23 +13946,38 @@ return /******/ (function(modules) { // webpackBootstrap return; } - return getSourceByURL(state, getPrettySourceURL(source.get("url"))); + return getSourceByURL(state, (0, _source2.getPrettySourceURL)(source.get("url"))); } - module.exports = { - State, - update, - getSource, - getSourceByURL, - getSourceById, - getSources, - getSourceText, - getSourceTabs, - getSelectedSource, - getSelectedLocation, - getPendingSelectedLocation, - getPrettySource - }; + function getSourceByUrlInSources(sources, url) { + return sources.find(source => source.get("url") === url); + } + + function getSourceInSources(sources, id) { + return sources.get(id); + } + + var getSources = exports.getSources = (0, _reselect.createSelector)(getSourcesState, sources => sources.sources); + + var getTabs = (0, _reselect.createSelector)(getSourcesState, sources => sources.tabs); + + var getSourceTabs = exports.getSourceTabs = (0, _reselect.createSelector)(getTabs, getSources, (tabs, sources) => tabs.filter(tab => getSourceByUrlInSources(sources, tab))); + + var getSourcesForTabs = exports.getSourcesForTabs = (0, _reselect.createSelector)(getSourceTabs, getSources, (tabs, sources) => { + return tabs.map(tab => getSourceByUrlInSources(sources, tab)).filter(source => source); + }); + + var getSelectedLocation = exports.getSelectedLocation = (0, _reselect.createSelector)(getSourcesState, sources => sources.selectedLocation); + + var getSelectedSource = exports.getSelectedSource = (0, _reselect.createSelector)(getSelectedLocation, getSources, (selectedLocation, sources) => { + if (!selectedLocation) { + return; + } + + return sources.find(source => source.get("id") == selectedLocation.sourceId); + }); + + exports.default = update; /***/ }, /* 233 */ @@ -13970,16 +13985,14 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - /** - * Utils for working with Source URLs - * @module utils/source - */ + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getMode = exports.getFilenameFromURL = exports.getFilename = exports.getRawSourceURL = exports.getPrettySourceURL = exports.isPretty = exports.isJavaScript = undefined; - var _require = __webpack_require__(234), - endTruncateStr = _require.endTruncateStr; + var _utils = __webpack_require__(234); - var _require2 = __webpack_require__(235), - basename = _require2.basename; + var _path = __webpack_require__(235); /** * Trims the query part or reference identifier of a url string, if necessary. @@ -13987,6 +14000,13 @@ return /******/ (function(modules) { // webpackBootstrap * @memberof utils/source * @static */ + + + /** + * Utils for working with Source URLs + * @module utils/source + */ + function trimUrlQuery(url) { var length = url.length; var q1 = url.indexOf("?"); @@ -14026,6 +14046,9 @@ return /******/ (function(modules) { // webpackBootstrap * @static */ function getPrettySourceURL(url) { + if (!url) { + url = ""; + } return `${url}:formatted`; } @@ -14039,8 +14062,8 @@ return /******/ (function(modules) { // webpackBootstrap function getFilenameFromURL(url) { url = getRawSourceURL(url || ""); - var name = basename(url) || "(index)"; - return endTruncateStr(name, 50); + var name = (0, _path.basename)(url) || "(index)"; + return (0, _utils.endTruncateStr)(name, 50); } /** @@ -14113,29 +14136,23 @@ return /******/ (function(modules) { // webpackBootstrap return { name: "text" }; } - module.exports = { - isJavaScript, - isPretty, - getPrettySourceURL, - getRawSourceURL, - getFilename, - getFilenameFromURL, - getMode - }; + exports.isJavaScript = isJavaScript; + exports.isPretty = isPretty; + exports.getPrettySourceURL = getPrettySourceURL; + exports.getRawSourceURL = getRawSourceURL; + exports.getFilename = getFilename; + exports.getFilenameFromURL = getFilenameFromURL; + exports.getMode = getMode; /***/ }, /* 234 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { "use strict"; - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var _zip = __webpack_require__(704); - - var _zip2 = _interopRequireDefault(_zip); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + Object.defineProperty(exports, "__esModule", { + value: true + }); function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } @@ -14218,27 +14235,12 @@ return /******/ (function(modules) { // webpackBootstrap return new Promise(resolve => setTimeout(resolve, ms)); } - function filterDuplicates(list, predicate) { - var lastItem = list[list.length - 1]; - var pairs = (0, _zip2.default)(list.slice(1), list.slice(0, -1)); - return pairs.filter(predicate).map((_ref) => { - var _ref2 = _slicedToArray(_ref, 2), - prev = _ref2[0], - item = _ref2[1]; - - return item; - }).concat(lastItem); - } - - module.exports = { - handleError, - promisify, - endTruncateStr, - updateObj, - throttle, - waitForMs, - filterDuplicates - }; + exports.handleError = handleError; + exports.promisify = promisify; + exports.endTruncateStr = endTruncateStr; + exports.updateObj = updateObj; + exports.throttle = throttle; + exports.waitForMs = waitForMs; /***/ }, /* 235 */ @@ -14281,6 +14283,47 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.State = undefined; + exports.makeLocationId = makeLocationId; + exports.getBreakpoint = getBreakpoint; + exports.getBreakpoints = getBreakpoints; + exports.getBreakpointsForSource = getBreakpointsForSource; + exports.getBreakpointsDisabled = getBreakpointsDisabled; + exports.getBreakpointsLoading = getBreakpointsLoading; + exports.getPendingBreakpoints = getPendingBreakpoints; + + var _fromJS = __webpack_require__(237); + + var _fromJS2 = _interopRequireDefault(_fromJS); + + var _utils = __webpack_require__(234); + + var _immutable = __webpack_require__(146); + + var I = _interopRequireWildcard(_immutable); + + var _makeRecord = __webpack_require__(230); + + var _makeRecord2 = _interopRequireDefault(_makeRecord); + + var _prefs = __webpack_require__(226); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var State = exports.State = (0, _makeRecord2.default)({ + breakpoints: I.Map(), + pendingBreakpoints: restorePendingBreakpoints(), + breakpointsDisabled: false + }); + + // Return the first argument that is a string, or null if nothing is a + // string. + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -14290,25 +14333,6 @@ return /******/ (function(modules) { // webpackBootstrap * @module reducers/breakpoints */ - var fromJS = __webpack_require__(237); - - var _require = __webpack_require__(234), - updateObj = _require.updateObj; - - var I = __webpack_require__(146); - var makeRecord = __webpack_require__(230); - - var _require2 = __webpack_require__(226), - prefs = _require2.prefs; - - var State = makeRecord({ - breakpoints: I.Map(), - pendingBreakpoints: restorePendingBreakpoints(), - breakpointsDisabled: false - }); - - // Return the first argument that is a string, or null if nothing is a - // string. function firstString() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; @@ -14327,7 +14351,12 @@ return /******/ (function(modules) { // webpackBootstrap } function makeLocationId(location) { - return `${location.sourceId}:${location.line}`; + var sourceId = location.sourceId, + line = location.line, + column = location.column; + + column = column || ""; + return `${sourceId}:${line}:${column}`; } function allBreakpointsDisabled(state) { @@ -14369,13 +14398,13 @@ return /******/ (function(modules) { // webpackBootstrap if (action.status === "start") { var bp = state.breakpoints.get(id); - return state.setIn(["breakpoints", id], updateObj(bp, { + return state.setIn(["breakpoints", id], (0, _utils.updateObj)(bp, { loading: true, condition: action.condition })); } else if (action.status === "done") { var _bp = state.breakpoints.get(id); - return state.setIn(["breakpoints", id], updateObj(_bp, { + return state.setIn(["breakpoints", id], (0, _utils.updateObj)(_bp, { id: action.value.id, loading: false })); @@ -14396,7 +14425,7 @@ return /******/ (function(modules) { // webpackBootstrap if (action.status === "start") { var bp = state.breakpoints.get(id) || action.breakpoint; - return state.setIn(["breakpoints", id], updateObj(bp, { + return state.setIn(["breakpoints", id], (0, _utils.updateObj)(bp, { disabled: false, loading: true, // We want to do an OR here, but we can't because we need @@ -14420,15 +14449,15 @@ return /******/ (function(modules) { // webpackBootstrap state = state.deleteIn(["breakpoints", id]); var movedId = makeLocationId(actualLocation); - var currentBp = state.breakpoints.get(movedId) || fromJS(action.breakpoint); - var newBp = updateObj(currentBp, { location: actualLocation }); + var currentBp = state.breakpoints.get(movedId) || (0, _fromJS2.default)(action.breakpoint); + var newBp = (0, _utils.updateObj)(currentBp, { location: actualLocation }); state = state.setIn(["breakpoints", movedId], newBp); location = actualLocation; } var locationId = makeLocationId(location); var _bp2 = state.breakpoints.get(locationId); - return state.setIn(["breakpoints", locationId], updateObj(_bp2, { + return state.setIn(["breakpoints", locationId], (0, _utils.updateObj)(_bp2, { id: breakpointId, disabled: false, loading: false, @@ -14448,7 +14477,7 @@ return /******/ (function(modules) { // webpackBootstrap if (action.disabled) { var bp = state.breakpoints.get(id); - var _updatedState = state.setIn(["breakpoints", id], updateObj(bp, { + var _updatedState = state.setIn(["breakpoints", id], (0, _utils.updateObj)(bp, { loading: false, disabled: true })); @@ -14468,11 +14497,12 @@ return /******/ (function(modules) { // webpackBootstrap var _bp$location = bp.location, sourceUrl = _bp$location.sourceUrl, line = _bp$location.line, + column = _bp$location.column, condition = bp.condition, disabled = bp.disabled; - var location = { sourceUrl, line }; + var location = { sourceUrl, line, column }; return { condition, disabled, location }; } @@ -14481,11 +14511,11 @@ return /******/ (function(modules) { // webpackBootstrap } function setPendingBreakpoints(state) { - prefs.pendingBreakpoints = Object.values(state.get("breakpoints").toJS()).filter(filterByNotLoading).map(makePendingBreakpoint); + _prefs.prefs.pendingBreakpoints = Object.values(state.get("breakpoints").toJS()).filter(filterByNotLoading).map(makePendingBreakpoint); } function restorePendingBreakpoints() { - return prefs.pendingBreakpoints; + return _prefs.prefs.pendingBreakpoints; } // Selectors @@ -14519,17 +14549,7 @@ return /******/ (function(modules) { // webpackBootstrap return state.breakpoints.pendingBreakpoints; } - module.exports = { - State, - update, - makeLocationId, - getBreakpoint, - getBreakpoints, - getBreakpointsForSource, - getBreakpointsDisabled, - getBreakpointsLoading, - getPendingBreakpoints - }; + exports.default = update; /***/ }, /* 237 */ @@ -14622,13 +14642,20 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + Object.defineProperty(exports, "__esModule", { + value: true + }); - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + var _constants = __webpack_require__(229); + + var _constants2 = _interopRequireDefault(_constants); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var constants = __webpack_require__(229); var initialState = []; function update() { @@ -14637,7 +14664,7 @@ return /******/ (function(modules) { // webpackBootstrap var seqId = action.seqId; - if (action.type === constants.NAVIGATE) { + if (action.type === _constants2.default.NAVIGATE) { return initialState; } else if (seqId) { var newState = void 0; @@ -14653,7 +14680,7 @@ return /******/ (function(modules) { // webpackBootstrap return state; } - module.exports = update; + exports.default = update; /***/ }, /* 239 */ @@ -14661,27 +14688,55 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getSelectedFrame = exports.getLoadedObjects = exports.getPause = exports.State = undefined; + exports.getLoadedObject = getLoadedObject; + exports.getObjectProperties = getObjectProperties; + exports.getIsWaitingOnBreak = getIsWaitingOnBreak; + exports.getShouldPauseOnExceptions = getShouldPauseOnExceptions; + exports.getShouldIgnoreCaughtExceptions = getShouldIgnoreCaughtExceptions; + exports.getFrames = getFrames; + exports.getDebuggeeUrl = getDebuggeeUrl; + exports.getChromeScopes = getChromeScopes; + + var _reselect = __webpack_require__(992); + + var _fromJS = __webpack_require__(237); + + var _fromJS2 = _interopRequireDefault(_fromJS); + + var _makeRecord = __webpack_require__(230); + + var _makeRecord2 = _interopRequireDefault(_makeRecord); + + var _prefs = __webpack_require__(226); + + var _immutable = __webpack_require__(146); + + var I = _interopRequireWildcard(_immutable); + + var _constants = __webpack_require__(229); + + var _constants2 = _interopRequireDefault(_constants); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var constants = __webpack_require__(229); - var fromJS = __webpack_require__(237); - var makeRecord = __webpack_require__(230); - - var _require = __webpack_require__(226), - prefs = _require.prefs; - - var I = __webpack_require__(146); - - var State = makeRecord({ + var State = exports.State = (0, _makeRecord2.default)({ pause: undefined, isWaitingOnBreak: false, frames: undefined, selectedFrameId: undefined, loadedObjects: I.Map(), - shouldPauseOnExceptions: prefs.pauseOnExceptions, - shouldIgnoreCaughtExceptions: prefs.ignoreCaughtExceptions, + shouldPauseOnExceptions: _prefs.prefs.pauseOnExceptions, + shouldIgnoreCaughtExceptions: _prefs.prefs.ignoreCaughtExceptions, debuggeeUrl: "" }); @@ -14690,7 +14745,7 @@ return /******/ (function(modules) { // webpackBootstrap var action = arguments[1]; switch (action.type) { - case constants.PAUSED: + case _constants2.default.PAUSED: { var _selectedFrameId = action.selectedFrameId, _frames = action.frames, @@ -14707,14 +14762,14 @@ return /******/ (function(modules) { // webpackBootstrap return state.merge({ isWaitingOnBreak: false, - pause: fromJS(pauseInfo), + pause: (0, _fromJS2.default)(pauseInfo), selectedFrameId: _selectedFrameId, frames: _frames, loadedObjects: objectMap }); } - case constants.RESUME: + case _constants2.default.RESUME: return state.merge({ pause: null, frames: null, @@ -14722,25 +14777,25 @@ return /******/ (function(modules) { // webpackBootstrap loadedObjects: {} }); - case constants.TOGGLE_PRETTY_PRINT: + case _constants2.default.TOGGLE_PRETTY_PRINT: if (action.status == "done") { var _frames2 = action.value.frames; var _pause = state.get("pause"); if (_pause) { - _pause = _pause.set("frame", fromJS(_frames2[0])); + _pause = _pause.set("frame", (0, _fromJS2.default)(_frames2[0])); } return state.merge({ pause: _pause, frames: _frames2 }); } break; - case constants.BREAK_ON_NEXT: + case _constants2.default.BREAK_ON_NEXT: return state.set("isWaitingOnBreak", true); - case constants.SELECT_FRAME: + case _constants2.default.SELECT_FRAME: return state.set("selectedFrameId", action.frame.id); - case constants.LOAD_OBJECT_PROPERTIES: + case _constants2.default.LOAD_OBJECT_PROPERTIES: if (action.status === "start") { return state.setIn(["loadedObjects", action.objectId], {}); } @@ -14762,16 +14817,16 @@ return /******/ (function(modules) { // webpackBootstrap } break; - case constants.NAVIGATE: + case _constants2.default.NAVIGATE: return State().set("debuggeeUrl", action.url); - case constants.PAUSE_ON_EXCEPTIONS: + case _constants2.default.PAUSE_ON_EXCEPTIONS: var _shouldPauseOnExceptions = action.shouldPauseOnExceptions, _shouldIgnoreCaughtExceptions = action.shouldIgnoreCaughtExceptions; - prefs.pauseOnExceptions = _shouldPauseOnExceptions; - prefs.ignoreCaughtExceptions = _shouldIgnoreCaughtExceptions; + _prefs.prefs.pauseOnExceptions = _shouldPauseOnExceptions; + _prefs.prefs.ignoreCaughtExceptions = _shouldIgnoreCaughtExceptions; return state.merge({ shouldPauseOnExceptions: _shouldPauseOnExceptions, @@ -14793,13 +14848,11 @@ return /******/ (function(modules) { // webpackBootstrap // (right now) to type those wrapped functions. - function getPause(state) { - return state.pause.get("pause"); - } + var getPauseState = state => state.pause; - function getLoadedObjects(state) { - return state.pause.get("loadedObjects"); - } + var getPause = exports.getPause = (0, _reselect.createSelector)(getPauseState, pauseWrapper => pauseWrapper.get("pause")); + + var getLoadedObjects = exports.getLoadedObjects = (0, _reselect.createSelector)(getPauseState, pauseWrapper => pauseWrapper.get("loadedObjects")); function getLoadedObject(state, objectId) { return getLoadedObjects(state).get(objectId); @@ -14825,15 +14878,15 @@ return /******/ (function(modules) { // webpackBootstrap return state.pause.get("frames"); } - function getSelectedFrame(state) { - var selectedFrameId = state.pause.get("selectedFrameId"); - var frames = state.pause.get("frames"); + var getSelectedFrameId = (0, _reselect.createSelector)(getPauseState, pauseWrapper => pauseWrapper.get("selectedFrameId")); + + var getSelectedFrame = exports.getSelectedFrame = (0, _reselect.createSelector)(getSelectedFrameId, getFrames, (selectedFrameId, frames) => { if (!frames) { return null; } return frames.find(frame => frame.get("id") == selectedFrameId).toJS(); - } + }); function getDebuggeeUrl(state) { return state.pause.get("debuggeeUrl"); @@ -14845,21 +14898,7 @@ return /******/ (function(modules) { // webpackBootstrap return frame ? frame.scopeChain : undefined; } - module.exports = { - State, - update, - getPause, - getChromeScopes, - getLoadedObjects, - getLoadedObject, - getObjectProperties, - getIsWaitingOnBreak, - getShouldPauseOnExceptions, - getShouldIgnoreCaughtExceptions, - getFrames, - getSelectedFrame, - getDebuggeeUrl - }; + exports.default = update; /***/ }, /* 240 */ @@ -14867,69 +14906,97 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - /** - * UI reducer - * @module reducers/ui - */ + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getSymbolSearchState = exports.getFileSearchState = exports.getProjectSearchState = exports.State = undefined; + exports.getFileSearchQueryState = getFileSearchQueryState; + exports.getFileSearchModifierState = getFileSearchModifierState; + exports.getSymbolSearchType = getSymbolSearchType; + exports.getShownSource = getShownSource; + exports.getPaneCollapse = getPaneCollapse; - var constants = __webpack_require__(229); - var makeRecord = __webpack_require__(230); + var _makeRecord = __webpack_require__(230); - var _require = __webpack_require__(226), - prefs = _require.prefs; + var _makeRecord2 = _interopRequireDefault(_makeRecord); - var State = makeRecord({ + var _prefs = __webpack_require__(226); + + var _constants = __webpack_require__(229); + + var _constants2 = _interopRequireDefault(_constants); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var State = exports.State = (0, _makeRecord2.default)({ fileSearchOn: false, fileSearchQuery: "", - fileSearchModifiers: makeRecord({ + fileSearchModifiers: (0, _makeRecord2.default)({ caseSensitive: true, wholeWord: false, regexMatch: false })(), projectSearchOn: false, + symbolSearchOn: false, + symbolSearchType: "functions", shownSource: "", - startPanelCollapsed: prefs.startPanelCollapsed, - endPanelCollapsed: prefs.endPanelCollapsed + startPanelCollapsed: _prefs.prefs.startPanelCollapsed, + endPanelCollapsed: _prefs.prefs.endPanelCollapsed }); + /** + * UI reducer + * @module reducers/ui + */ + function update() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : State(); var action = arguments[1]; switch (action.type) { - case constants.TOGGLE_PROJECT_SEARCH: + case _constants2.default.TOGGLE_PROJECT_SEARCH: { return state.set("projectSearchOn", action.value); } - case constants.TOGGLE_FILE_SEARCH: + case _constants2.default.TOGGLE_FILE_SEARCH: { return state.set("fileSearchOn", action.value); } - case constants.UPDATE_FILE_SEARCH_QUERY: + case _constants2.default.TOGGLE_SYMBOL_SEARCH: + { + return state.set("symbolSearchOn", action.value); + } + + case _constants2.default.UPDATE_FILE_SEARCH_QUERY: { return state.set("fileSearchQuery", action.query); } - case constants.TOGGLE_FILE_SEARCH_MODIFIER: + case _constants2.default.TOGGLE_FILE_SEARCH_MODIFIER: { return state.setIn(["fileSearchModifiers", action.modifier], !state.getIn(["fileSearchModifiers", action.modifier])); } - case constants.SHOW_SOURCE: + case _constants2.default.SET_SYMBOL_SEARCH_TYPE: + { + return state.set("symbolSearchType", action.symbolType); + } + + case _constants2.default.SHOW_SOURCE: { return state.set("shownSource", action.sourceUrl); } - case constants.TOGGLE_PANE: + case _constants2.default.TOGGLE_PANE: { if (action.position == "start") { - prefs.startPanelCollapsed = action.paneCollapsed; + _prefs.prefs.startPanelCollapsed = action.paneCollapsed; return state.set("startPanelCollapsed", action.paneCollapsed); } - prefs.endPanelCollapsed = action.paneCollapsed; + _prefs.prefs.endPanelCollapsed = action.paneCollapsed; return state.set("endPanelCollapsed", action.paneCollapsed); } @@ -14955,8 +15022,13 @@ return /******/ (function(modules) { // webpackBootstrap return state.ui.get("fileSearchModifiers"); } - var getProjectSearchState = getSearchState.bind(null, "projectSearchOn"); - var getFileSearchState = getSearchState.bind(null, "fileSearchOn"); + function getSymbolSearchType(state) { + return state.ui.get("symbolSearchType"); + } + + var getProjectSearchState = exports.getProjectSearchState = getSearchState.bind(null, "projectSearchOn"); + var getFileSearchState = exports.getFileSearchState = getSearchState.bind(null, "fileSearchOn"); + var getSymbolSearchState = exports.getSymbolSearchState = getSearchState.bind(null, "symbolSearchOn"); function getShownSource(state) { return state.ui.get("shownSource"); @@ -14970,16 +15042,7 @@ return /******/ (function(modules) { // webpackBootstrap return state.ui.get("endPanelCollapsed"); } - module.exports = { - State, - update, - getProjectSearchState, - getFileSearchState, - getFileSearchQueryState, - getFileSearchModifierState, - getShownSource, - getPaneCollapse - }; + exports.default = update; /***/ }, /* 241 */ @@ -14987,17 +15050,39 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.State = undefined; + exports.getHitCountForSource = getHitCountForSource; + exports.getCoverageEnabled = getCoverageEnabled; + + var _makeRecord = __webpack_require__(230); + + var _makeRecord2 = _interopRequireDefault(_makeRecord); + + var _immutable = __webpack_require__(146); + + var I = _interopRequireWildcard(_immutable); + + var _fromJS = __webpack_require__(237); + + var _fromJS2 = _interopRequireDefault(_fromJS); + + var _constants = __webpack_require__(229); + + var _constants2 = _interopRequireDefault(_constants); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** * Code Coverage reducer * @module reducers/coverage */ - var constants = __webpack_require__(229); - var makeRecord = __webpack_require__(230); - var I = __webpack_require__(146); - var fromJS = __webpack_require__(237); - - var State = makeRecord({ + var State = exports.State = (0, _makeRecord2.default)({ coverageOn: false, hitCount: I.Map() }); @@ -15007,8 +15092,8 @@ return /******/ (function(modules) { // webpackBootstrap var action = arguments[1]; switch (action.type) { - case constants.RECORD_COVERAGE: - return state.mergeIn(["hitCount"], fromJS(action.value.coverage)).setIn(["coverageOn"], true); + case _constants2.default.RECORD_COVERAGE: + return state.mergeIn(["hitCount"], (0, _fromJS2.default)(action.value.coverage)).setIn(["coverageOn"], true); default: { @@ -15019,8 +15104,6 @@ return /******/ (function(modules) { // webpackBootstrap // NOTE: we'd like to have the app state fully typed // https://github.com/devtools-html/debugger.html/blob/master/src/reducers/sources.js#L179-L185 - - function getHitCountForSource(state, sourceId) { var hitCount = state.coverage.get("hitCount"); return hitCount.get(sourceId); @@ -15030,12 +15113,7 @@ return /******/ (function(modules) { // webpackBootstrap return state.coverage.get("coverageOn"); } - module.exports = { - State, - update, - getHitCountForSource, - getCoverageEnabled - }; + exports.default = update; /***/ }, /* 242 */ @@ -15058,10 +15136,11 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = { getSource: sources.getSource, getSourceByURL: sources.getSourceByURL, - getSourceById: sources.getSourceById, + getSourceInSources: sources.getSourceInSources, getSources: sources.getSources, getSourceText: sources.getSourceText, getSourceTabs: sources.getSourceTabs, + getSourcesForTabs: sources.getSourcesForTabs, getSelectedSource: sources.getSelectedSource, getSelectedLocation: sources.getSelectedLocation, getPendingSelectedLocation: sources.getPendingSelectedLocation, @@ -15095,6 +15174,8 @@ return /******/ (function(modules) { // webpackBootstrap getFileSearchState: ui.getFileSearchState, getFileSearchQueryState: ui.getFileSearchQueryState, getFileSearchModifierState: ui.getFileSearchModifierState, + getSymbolSearchState: ui.getSymbolSearchState, + getSymbolSearchType: ui.getSymbolSearchType, getShownSource: ui.getShownSource, getPaneCollapse: ui.getPaneCollapse, @@ -15135,19 +15216,53 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(331); + var _devtoolsSplitter = __webpack_require__(910); + + var _devtoolsSplitter2 = _interopRequireDefault(_devtoolsSplitter); + + var _ProjectSearch2 = __webpack_require__(915); + + var _ProjectSearch3 = _interopRequireDefault(_ProjectSearch2); + + var _Sources2 = __webpack_require__(388); + + var _Sources3 = _interopRequireDefault(_Sources2); + + var _Editor2 = __webpack_require__(426); + + var _Editor3 = _interopRequireDefault(_Editor2); + + var _SecondaryPanes2 = __webpack_require__(718); + + var _SecondaryPanes3 = _interopRequireDefault(_SecondaryPanes2); + + var _WelcomeBox2 = __webpack_require__(747); + + var _WelcomeBox3 = _interopRequireDefault(_WelcomeBox2); + + var _Tabs = __webpack_require__(750); + + var _Tabs2 = _interopRequireDefault(_Tabs); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var shortcuts = new _devtoolsModules.KeyShortcuts({ window }); var verticalLayoutBreakpoint = window.matchMedia("(min-width: 800px)"); - var SplitBox = (0, _react.createFactory)(__webpack_require__(910)); - var ProjectSearch = (0, _react.createFactory)(__webpack_require__(915).default); - var Sources = (0, _react.createFactory)(__webpack_require__(388).default); - var Editor = (0, _react.createFactory)(__webpack_require__(426).default); - var SecondaryPanes = (0, _react.createFactory)(__webpack_require__(718).default); - var WelcomeBox = (0, _react.createFactory)(__webpack_require__(747).default); - var EditorTabs = (0, _react.createFactory)(__webpack_require__(750)); + var SplitBox = (0, _react.createFactory)(_devtoolsSplitter2.default); + + var ProjectSearch = (0, _react.createFactory)(_ProjectSearch3.default); + + var Sources = (0, _react.createFactory)(_Sources3.default); + + var Editor = (0, _react.createFactory)(_Editor3.default); + + var SecondaryPanes = (0, _react.createFactory)(_SecondaryPanes3.default); + + var WelcomeBox = (0, _react.createFactory)(_WelcomeBox3.default); + + var EditorTabs = (0, _react.createFactory)(_Tabs2.default); class App extends _react.Component { @@ -15199,7 +15314,6 @@ return /******/ (function(modules) { // webpackBootstrap renderHorizontalLayout() { var _props2 = this.props, - sources = _props2.sources, startPanelCollapsed = _props2.startPanelCollapsed, endPanelCollapsed = _props2.endPanelCollapsed; var horizontal = this.state.horizontal; @@ -15214,7 +15328,7 @@ return /******/ (function(modules) { // webpackBootstrap maxSize: "50%", splitterSize: 1, onResizeEnd: size => this.setState({ startPanelSize: size }), - startPanel: Sources({ sources, horizontal }), + startPanel: Sources({ horizontal }), startPanelCollapsed, endPanel: SplitBox({ style: { overflowX }, @@ -15234,7 +15348,6 @@ return /******/ (function(modules) { // webpackBootstrap renderVerticalLayout() { var _props3 = this.props, - sources = _props3.sources, startPanelCollapsed = _props3.startPanelCollapsed, endPanelCollapsed = _props3.endPanelCollapsed; var horizontal = this.state.horizontal; @@ -15254,7 +15367,7 @@ return /******/ (function(modules) { // webpackBootstrap maxSize: "40%", splitterSize: 1, startPanelCollapsed, - startPanel: Sources({ sources, horizontal }), + startPanel: Sources({ horizontal }), endPanel: this.renderEditorPane() }), endPanel: SecondaryPanes({ horizontal }), @@ -15268,7 +15381,6 @@ return /******/ (function(modules) { // webpackBootstrap } App.propTypes = { - sources: _react.PropTypes.object, selectSource: _react.PropTypes.func, selectedSource: _react.PropTypes.object, startPanelCollapsed: _react.PropTypes.bool, @@ -15280,7 +15392,6 @@ return /******/ (function(modules) { // webpackBootstrap App.childContextTypes = { shortcuts: _react.PropTypes.object }; exports.default = (0, _reactRedux.connect)(state => ({ - sources: (0, _selectors.getSources)(state), selectedSource: (0, _selectors.getSelectedSource)(state), startPanelCollapsed: (0, _selectors.getPaneCollapse)(state, "start"), endPanelCollapsed: (0, _selectors.getPaneCollapse)(state, "end") @@ -15582,166 +15693,166 @@ return /******/ (function(modules) { // webpackBootstrap /* 248 */ /***/ function(module, exports, __webpack_require__) { - (function(){ - var crypt = __webpack_require__(249), - utf8 = __webpack_require__(250).utf8, - isBuffer = __webpack_require__(251), - bin = __webpack_require__(250).bin, - - // The core - md5 = function (message, options) { - // Convert to byte array - if (message.constructor == String) - if (options && options.encoding === 'binary') - message = bin.stringToBytes(message); - else - message = utf8.stringToBytes(message); - else if (isBuffer(message)) - message = Array.prototype.slice.call(message, 0); - else if (!Array.isArray(message)) - message = message.toString(); - // else, assume byte array already - - var m = crypt.bytesToWords(message), - l = message.length * 8, - a = 1732584193, - b = -271733879, - c = -1732584194, - d = 271733878; - - // Swap endian - for (var i = 0; i < m.length; i++) { - m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | - ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; - } - - // Padding - m[l >>> 5] |= 0x80 << (l % 32); - m[(((l + 64) >>> 9) << 4) + 14] = l; - - // Method shortcuts - var FF = md5._ff, - GG = md5._gg, - HH = md5._hh, - II = md5._ii; - - for (var i = 0; i < m.length; i += 16) { - - var aa = a, - bb = b, - cc = c, - dd = d; - - a = FF(a, b, c, d, m[i+ 0], 7, -680876936); - d = FF(d, a, b, c, m[i+ 1], 12, -389564586); - c = FF(c, d, a, b, m[i+ 2], 17, 606105819); - b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); - a = FF(a, b, c, d, m[i+ 4], 7, -176418897); - d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); - c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); - b = FF(b, c, d, a, m[i+ 7], 22, -45705983); - a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); - d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); - c = FF(c, d, a, b, m[i+10], 17, -42063); - b = FF(b, c, d, a, m[i+11], 22, -1990404162); - a = FF(a, b, c, d, m[i+12], 7, 1804603682); - d = FF(d, a, b, c, m[i+13], 12, -40341101); - c = FF(c, d, a, b, m[i+14], 17, -1502002290); - b = FF(b, c, d, a, m[i+15], 22, 1236535329); - - a = GG(a, b, c, d, m[i+ 1], 5, -165796510); - d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); - c = GG(c, d, a, b, m[i+11], 14, 643717713); - b = GG(b, c, d, a, m[i+ 0], 20, -373897302); - a = GG(a, b, c, d, m[i+ 5], 5, -701558691); - d = GG(d, a, b, c, m[i+10], 9, 38016083); - c = GG(c, d, a, b, m[i+15], 14, -660478335); - b = GG(b, c, d, a, m[i+ 4], 20, -405537848); - a = GG(a, b, c, d, m[i+ 9], 5, 568446438); - d = GG(d, a, b, c, m[i+14], 9, -1019803690); - c = GG(c, d, a, b, m[i+ 3], 14, -187363961); - b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); - a = GG(a, b, c, d, m[i+13], 5, -1444681467); - d = GG(d, a, b, c, m[i+ 2], 9, -51403784); - c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); - b = GG(b, c, d, a, m[i+12], 20, -1926607734); - - a = HH(a, b, c, d, m[i+ 5], 4, -378558); - d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); - c = HH(c, d, a, b, m[i+11], 16, 1839030562); - b = HH(b, c, d, a, m[i+14], 23, -35309556); - a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); - d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); - c = HH(c, d, a, b, m[i+ 7], 16, -155497632); - b = HH(b, c, d, a, m[i+10], 23, -1094730640); - a = HH(a, b, c, d, m[i+13], 4, 681279174); - d = HH(d, a, b, c, m[i+ 0], 11, -358537222); - c = HH(c, d, a, b, m[i+ 3], 16, -722521979); - b = HH(b, c, d, a, m[i+ 6], 23, 76029189); - a = HH(a, b, c, d, m[i+ 9], 4, -640364487); - d = HH(d, a, b, c, m[i+12], 11, -421815835); - c = HH(c, d, a, b, m[i+15], 16, 530742520); - b = HH(b, c, d, a, m[i+ 2], 23, -995338651); - - a = II(a, b, c, d, m[i+ 0], 6, -198630844); - d = II(d, a, b, c, m[i+ 7], 10, 1126891415); - c = II(c, d, a, b, m[i+14], 15, -1416354905); - b = II(b, c, d, a, m[i+ 5], 21, -57434055); - a = II(a, b, c, d, m[i+12], 6, 1700485571); - d = II(d, a, b, c, m[i+ 3], 10, -1894986606); - c = II(c, d, a, b, m[i+10], 15, -1051523); - b = II(b, c, d, a, m[i+ 1], 21, -2054922799); - a = II(a, b, c, d, m[i+ 8], 6, 1873313359); - d = II(d, a, b, c, m[i+15], 10, -30611744); - c = II(c, d, a, b, m[i+ 6], 15, -1560198380); - b = II(b, c, d, a, m[i+13], 21, 1309151649); - a = II(a, b, c, d, m[i+ 4], 6, -145523070); - d = II(d, a, b, c, m[i+11], 10, -1120210379); - c = II(c, d, a, b, m[i+ 2], 15, 718787259); - b = II(b, c, d, a, m[i+ 9], 21, -343485551); - - a = (a + aa) >>> 0; - b = (b + bb) >>> 0; - c = (c + cc) >>> 0; - d = (d + dd) >>> 0; - } - - return crypt.endian([a, b, c, d]); - }; - - // Auxiliary functions - md5._ff = function (a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._gg = function (a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._hh = function (a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._ii = function (a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - - // Package private blocksize - md5._blocksize = 16; - md5._digestsize = 16; - - module.exports = function (message, options) { - if (message === undefined || message === null) - throw new Error('Illegal argument ' + message); - - var digestbytes = crypt.wordsToBytes(md5(message, options)); - return options && options.asBytes ? digestbytes : - options && options.asString ? bin.bytesToString(digestbytes) : - crypt.bytesToHex(digestbytes); - }; - - })(); + (function(){ + var crypt = __webpack_require__(249), + utf8 = __webpack_require__(250).utf8, + isBuffer = __webpack_require__(251), + bin = __webpack_require__(250).bin, + + // The core + md5 = function (message, options) { + // Convert to byte array + if (message.constructor == String) + if (options && options.encoding === 'binary') + message = bin.stringToBytes(message); + else + message = utf8.stringToBytes(message); + else if (isBuffer(message)) + message = Array.prototype.slice.call(message, 0); + else if (!Array.isArray(message)) + message = message.toString(); + // else, assume byte array already + + var m = crypt.bytesToWords(message), + l = message.length * 8, + a = 1732584193, + b = -271733879, + c = -1732584194, + d = 271733878; + + // Swap endian + for (var i = 0; i < m.length; i++) { + m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | + ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; + } + + // Padding + m[l >>> 5] |= 0x80 << (l % 32); + m[(((l + 64) >>> 9) << 4) + 14] = l; + + // Method shortcuts + var FF = md5._ff, + GG = md5._gg, + HH = md5._hh, + II = md5._ii; + + for (var i = 0; i < m.length; i += 16) { + + var aa = a, + bb = b, + cc = c, + dd = d; + + a = FF(a, b, c, d, m[i+ 0], 7, -680876936); + d = FF(d, a, b, c, m[i+ 1], 12, -389564586); + c = FF(c, d, a, b, m[i+ 2], 17, 606105819); + b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); + a = FF(a, b, c, d, m[i+ 4], 7, -176418897); + d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); + c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); + b = FF(b, c, d, a, m[i+ 7], 22, -45705983); + a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); + d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); + c = FF(c, d, a, b, m[i+10], 17, -42063); + b = FF(b, c, d, a, m[i+11], 22, -1990404162); + a = FF(a, b, c, d, m[i+12], 7, 1804603682); + d = FF(d, a, b, c, m[i+13], 12, -40341101); + c = FF(c, d, a, b, m[i+14], 17, -1502002290); + b = FF(b, c, d, a, m[i+15], 22, 1236535329); + + a = GG(a, b, c, d, m[i+ 1], 5, -165796510); + d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); + c = GG(c, d, a, b, m[i+11], 14, 643717713); + b = GG(b, c, d, a, m[i+ 0], 20, -373897302); + a = GG(a, b, c, d, m[i+ 5], 5, -701558691); + d = GG(d, a, b, c, m[i+10], 9, 38016083); + c = GG(c, d, a, b, m[i+15], 14, -660478335); + b = GG(b, c, d, a, m[i+ 4], 20, -405537848); + a = GG(a, b, c, d, m[i+ 9], 5, 568446438); + d = GG(d, a, b, c, m[i+14], 9, -1019803690); + c = GG(c, d, a, b, m[i+ 3], 14, -187363961); + b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); + a = GG(a, b, c, d, m[i+13], 5, -1444681467); + d = GG(d, a, b, c, m[i+ 2], 9, -51403784); + c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); + b = GG(b, c, d, a, m[i+12], 20, -1926607734); + + a = HH(a, b, c, d, m[i+ 5], 4, -378558); + d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); + c = HH(c, d, a, b, m[i+11], 16, 1839030562); + b = HH(b, c, d, a, m[i+14], 23, -35309556); + a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); + d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); + c = HH(c, d, a, b, m[i+ 7], 16, -155497632); + b = HH(b, c, d, a, m[i+10], 23, -1094730640); + a = HH(a, b, c, d, m[i+13], 4, 681279174); + d = HH(d, a, b, c, m[i+ 0], 11, -358537222); + c = HH(c, d, a, b, m[i+ 3], 16, -722521979); + b = HH(b, c, d, a, m[i+ 6], 23, 76029189); + a = HH(a, b, c, d, m[i+ 9], 4, -640364487); + d = HH(d, a, b, c, m[i+12], 11, -421815835); + c = HH(c, d, a, b, m[i+15], 16, 530742520); + b = HH(b, c, d, a, m[i+ 2], 23, -995338651); + + a = II(a, b, c, d, m[i+ 0], 6, -198630844); + d = II(d, a, b, c, m[i+ 7], 10, 1126891415); + c = II(c, d, a, b, m[i+14], 15, -1416354905); + b = II(b, c, d, a, m[i+ 5], 21, -57434055); + a = II(a, b, c, d, m[i+12], 6, 1700485571); + d = II(d, a, b, c, m[i+ 3], 10, -1894986606); + c = II(c, d, a, b, m[i+10], 15, -1051523); + b = II(b, c, d, a, m[i+ 1], 21, -2054922799); + a = II(a, b, c, d, m[i+ 8], 6, 1873313359); + d = II(d, a, b, c, m[i+15], 10, -30611744); + c = II(c, d, a, b, m[i+ 6], 15, -1560198380); + b = II(b, c, d, a, m[i+13], 21, 1309151649); + a = II(a, b, c, d, m[i+ 4], 6, -145523070); + d = II(d, a, b, c, m[i+11], 10, -1120210379); + c = II(c, d, a, b, m[i+ 2], 15, 718787259); + b = II(b, c, d, a, m[i+ 9], 21, -343485551); + + a = (a + aa) >>> 0; + b = (b + bb) >>> 0; + c = (c + cc) >>> 0; + d = (d + dd) >>> 0; + } + + return crypt.endian([a, b, c, d]); + }; + + // Auxiliary functions + md5._ff = function (a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._gg = function (a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._hh = function (a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._ii = function (a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + + // Package private blocksize + md5._blocksize = 16; + md5._digestsize = 16; + + module.exports = function (message, options) { + if (message === undefined || message === null) + throw new Error('Illegal argument ' + message); + + var digestbytes = crypt.wordsToBytes(md5(message, options)); + return options && options.asBytes ? digestbytes : + options && options.asString ? bin.bytesToString(digestbytes) : + crypt.bytesToHex(digestbytes); + }; + + })(); /***/ }, @@ -16323,6 +16434,8 @@ return /******/ (function(modules) { // webpackBootstrap var _breakpoints = __webpack_require__(245); + var _devtoolsConfig = __webpack_require__(828); + var _prettyPrint = __webpack_require__(903); var _source = __webpack_require__(233); @@ -16367,16 +16480,21 @@ return /******/ (function(modules) { // webpackBootstrap var _pendingBreakpoint$lo = pendingBreakpoint.location, line = _pendingBreakpoint$lo.line, sourceUrl = _pendingBreakpoint$lo.sourceUrl, + column = _pendingBreakpoint$lo.column, condition = pendingBreakpoint.condition; var sameSource = sourceUrl && sourceUrl == source.url; - var location = { sourceId: source.id, sourceUrl, line }; + var location = { sourceId: source.id, sourceUrl, line, column }; var bp = (0, _selectors.getBreakpoint)(state, location); if (sameSource && !bp) { - dispatch((0, _breakpoints.addBreakpoint)(location, { condition })); + if (location.column && (0, _devtoolsConfig.isEnabled)("columnBreakpoints")) { + dispatch((0, _breakpoints.addBreakpoint)(location, { condition })); + } else { + dispatch((0, _breakpoints.addBreakpoint)(location, { condition })); + } } }); } @@ -16890,34 +17008,38 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + var _devtoolsConfig = __webpack_require__(828); + + var _source = __webpack_require__(233); + + var _devtoolsSourceMap = __webpack_require__(898); + + var _buildQuery = __webpack_require__(258); + + var _buildQuery2 = _interopRequireDefault(_buildQuery); + + var _sourceDocuments = __webpack_require__(260); + + var sourceDocumentUtils = _interopRequireWildcard(_sourceDocuments); + var _expression = __webpack_require__(904); var expressionUtils = _interopRequireWildcard(_expression); + var _sourceSearch = __webpack_require__(261); + + var sourceSearchUtils = _interopRequireWildcard(_sourceSearch); + + var _devtoolsSourceEditor = __webpack_require__(993); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - var _require = __webpack_require__(828), - isEnabled = _require.isEnabled; + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var _require2 = __webpack_require__(233), - isPretty = _require2.isPretty, - isJavaScript = _require2.isJavaScript; - - var _require3 = __webpack_require__(898), - isOriginalId = _require3.isOriginalId; - - var buildQuery = __webpack_require__(258); - var sourceDocumentUtils = __webpack_require__(260); var getDocument = sourceDocumentUtils.getDocument; - - - var sourceSearchUtils = __webpack_require__(261); var findNext = sourceSearchUtils.findNext, findPrev = sourceSearchUtils.findPrev; - var _require4 = __webpack_require__(965), - SourceEditor = _require4.SourceEditor, - SourceEditorUtils = _require4.SourceEditorUtils; function shouldShowPrettyPrint(selectedSource) { if (!selectedSource) { @@ -16925,9 +17047,9 @@ return /******/ (function(modules) { // webpackBootstrap } selectedSource = selectedSource.toJS(); - var _isPretty = isPretty(selectedSource); - var _isJavaScript = isJavaScript(selectedSource.url); - var isOriginal = isOriginalId(selectedSource.id); + var _isPretty = (0, _source.isPretty)(selectedSource); + var _isJavaScript = (0, _source.isJavaScript)(selectedSource.url); + var isOriginal = (0, _devtoolsSourceMap.isOriginalId)(selectedSource.id); var hasSourceMap = selectedSource.sourceMapURL; if (_isPretty || isOriginal || hasSourceMap || !_isJavaScript) { @@ -16949,9 +17071,13 @@ return /******/ (function(modules) { // webpackBootstrap return !sourceText.get("loading") && !sourceText.get("error"); } - function breakpointAtLine(breakpoints, line) { - return breakpoints.find(b => { - return b.location.line === line + 1; + function breakpointAtLocation(breakpoints, _ref) { + var line = _ref.line, + _ref$column = _ref.column, + column = _ref$column === undefined ? undefined : _ref$column; + + return breakpoints.find(bp => { + return bp.location.line === line + 1 && bp.location.column === column; }); } @@ -16969,13 +17095,14 @@ return /******/ (function(modules) { // webpackBootstrap function createEditor() { var gutters = ["breakpoints", "hit-markers", "CodeMirror-linenumbers"]; - if (isEnabled("codeFolding")) { + if ((0, _devtoolsConfig.isEnabled)("codeFolding")) { gutters.push("CodeMirror-foldgutter"); } - return new SourceEditor({ + return new _devtoolsSourceEditor.SourceEditor({ mode: "javascript", - foldGutter: isEnabled("codeFolding"), + foldGutter: (0, _devtoolsConfig.isEnabled)("codeFolding"), + enableCodeFolding: (0, _devtoolsConfig.isEnabled)("codeFolding"), readOnly: true, lineNumbers: true, theme: "mozilla", @@ -17003,13 +17130,13 @@ return /******/ (function(modules) { // webpackBootstrap } } - module.exports = Object.assign({}, expressionUtils, sourceDocumentUtils, sourceSearchUtils, SourceEditorUtils, { + module.exports = Object.assign({}, expressionUtils, sourceDocumentUtils, sourceSearchUtils, _devtoolsSourceEditor.SourceEditorUtils, { createEditor, shouldShowPrettyPrint, shouldShowFooter, - buildQuery, + buildQuery: _buildQuery2.default, isTextForSource, - breakpointAtLine, + breakpointAtLocation, traverseResults, updateDocument }); @@ -17020,7 +17147,16 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var escapeRegExp = __webpack_require__(259); + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = buildQuery; + + var _escapeRegExp = __webpack_require__(259); + + var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Ignore doing outline matches for less than 3 whitespaces @@ -17033,6 +17169,7 @@ return /******/ (function(modules) { // webpackBootstrap ); } + function wholeMatch(query, wholeWord) { if (query == "" || !wholeWord) { return query; @@ -17077,7 +17214,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (!regexMatch) { - query = escapeRegExp(query); + query = (0, _escapeRegExp2.default)(query); } query = wholeMatch(query, wholeWord); @@ -17090,8 +17227,6 @@ return /******/ (function(modules) { // webpackBootstrap return new RegExp(query); } - module.exports = buildQuery; - /***/ }, /* 259 */ /***/ function(module, exports, __webpack_require__) { @@ -17136,6 +17271,9 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); var sourceDocs = {}; function getDocument(key) { @@ -17154,12 +17292,10 @@ return /******/ (function(modules) { // webpackBootstrap sourceDocs = {}; } - module.exports = { - getDocument, - setDocument, - removeDocument, - clearDocuments - }; + exports.getDocument = getDocument; + exports.setDocument = setDocument; + exports.removeDocument = removeDocument; + exports.clearDocuments = clearDocuments; /***/ }, /* 261 */ @@ -17167,15 +17303,27 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var buildQuery = __webpack_require__(258); - var findIndex = __webpack_require__(262); + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getMatchIndex = exports.removeOverlay = exports.findPrev = exports.findNext = exports.find = exports.countMatches = exports.clearIndex = exports.buildQuery = undefined; + + var _buildQuery = __webpack_require__(258); + + var _buildQuery2 = _interopRequireDefault(_buildQuery); + + var _findIndex = __webpack_require__(262); + + var _findIndex2 = _interopRequireDefault(_findIndex); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @memberof utils/source-search * @static */ function getSearchCursor(cm, query, pos, modifiers) { - var regexQuery = buildQuery(query, modifiers, { isGlobal: true }); + var regexQuery = (0, _buildQuery2.default)(query, modifiers, { isGlobal: true }); return cm.getSearchCursor(regexQuery, pos); } @@ -17229,7 +17377,7 @@ return /******/ (function(modules) { // webpackBootstrap * @static */ function searchOverlay(query, modifiers) { - var regexQuery = buildQuery(query, modifiers, { + var regexQuery = (0, _buildQuery2.default)(query, modifiers, { ignoreSpaces: true }); @@ -17333,7 +17481,7 @@ return /******/ (function(modules) { // webpackBootstrap var nextMatch = searchNext(ctx, rev, query, newQuery, modifiers); if (nextMatch) { if (state.matchIndex === -1) { - matchIndex = findIndex(state.results, nextMatch); + matchIndex = (0, _findIndex2.default)(state.results, nextMatch); } else { var count = state.results.length; var currentIndex = state.matchIndex; @@ -17466,23 +17614,21 @@ return /******/ (function(modules) { // webpackBootstrap } function countMatches(query, text, modifiers) { - var regexQuery = buildQuery(query, modifiers, { + var regexQuery = (0, _buildQuery2.default)(query, modifiers, { isGlobal: true }); var match = text.match(regexQuery); return match ? match.length : 0; } - module.exports = { - buildQuery, - clearIndex, - countMatches, - find, - findNext, - findPrev, - removeOverlay, - getMatchIndex - }; + exports.buildQuery = _buildQuery2.default; + exports.clearIndex = clearIndex; + exports.countMatches = countMatches; + exports.find = find; + exports.findNext = findNext; + exports.findPrev = findPrev; + exports.removeOverlay = removeOverlay; + exports.getMatchIndex = getMatchIndex; /***/ }, /* 262 */ @@ -19114,12450 +19260,19 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 305 */, -/* 306 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - // This is CodeMirror (http://codemirror.net), a code editor - // implemented in JavaScript on top of the browser's DOM. - // - // You can find some technical background for some of the code below - // at http://marijnhaverbeke.nl/blog/#cm-internals . - - (function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.CodeMirror = factory()); - }(this, (function () { 'use strict'; - - // Kludges for bugs and behavior differences that can't be feature - // detected are enabled based on userAgent etc sniffing. - var userAgent = navigator.userAgent; - var platform = navigator.platform; - - var gecko = /gecko\/\d/i.test(userAgent); - var ie_upto10 = /MSIE \d/.test(userAgent); - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent); - var edge = /Edge\/(\d+)/.exec(userAgent); - var ie = ie_upto10 || ie_11up || edge; - var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]); - var webkit = !edge && /WebKit\//.test(userAgent); - var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent); - var chrome = !edge && /Chrome\//.test(userAgent); - var presto = /Opera\//.test(userAgent); - var safari = /Apple Computer/.test(navigator.vendor); - var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); - var phantom = /PhantomJS/.test(userAgent); - - var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent); - var android = /Android/.test(userAgent); - // This is woefully incomplete. Suggestions for alternative methods welcome. - var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); - var mac = ios || /Mac/.test(platform); - var chromeOS = /\bCrOS\b/.test(userAgent); - var windows = /win/i.test(platform); - - var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/); - if (presto_version) { presto_version = Number(presto_version[1]); } - if (presto_version && presto_version >= 15) { presto = false; webkit = true; } - // Some browsers use the wrong event properties to signal cmd/ctrl on OS X - var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)); - var captureRightClick = gecko || (ie && ie_version >= 9); - - function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") } - - var rmClass = function(node, cls) { - var current = node.className; - var match = classTest(cls).exec(current); - if (match) { - var after = current.slice(match.index + match[0].length); - node.className = current.slice(0, match.index) + (after ? match[1] + after : ""); - } - }; - - function removeChildren(e) { - for (var count = e.childNodes.length; count > 0; --count) - { e.removeChild(e.firstChild); } - return e - } - - function removeChildrenAndAdd(parent, e) { - return removeChildren(parent).appendChild(e) - } - - function elt(tag, content, className, style) { - var e = document.createElement(tag); - if (className) { e.className = className; } - if (style) { e.style.cssText = style; } - if (typeof content == "string") { e.appendChild(document.createTextNode(content)); } - else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } } - return e - } - // wrapper for elt, which removes the elt from the accessibility tree - function eltP(tag, content, className, style) { - var e = elt(tag, content, className, style); - e.setAttribute("role", "presentation"); - return e - } - - var range; - if (document.createRange) { range = function(node, start, end, endNode) { - var r = document.createRange(); - r.setEnd(endNode || node, end); - r.setStart(node, start); - return r - }; } - else { range = function(node, start, end) { - var r = document.body.createTextRange(); - try { r.moveToElementText(node.parentNode); } - catch(e) { return r } - r.collapse(true); - r.moveEnd("character", end); - r.moveStart("character", start); - return r - }; } - - function contains(parent, child) { - if (child.nodeType == 3) // Android browser always returns false when child is a textnode - { child = child.parentNode; } - if (parent.contains) - { return parent.contains(child) } - do { - if (child.nodeType == 11) { child = child.host; } - if (child == parent) { return true } - } while (child = child.parentNode) - } - - function activeElt() { - // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement. - // IE < 10 will throw when accessed while the page is loading or in an iframe. - // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable. - var activeElement; - try { - activeElement = document.activeElement; - } catch(e) { - activeElement = document.body || null; - } - while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) - { activeElement = activeElement.shadowRoot.activeElement; } - return activeElement - } - - function addClass(node, cls) { - var current = node.className; - if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; } - } - function joinClasses(a, b) { - var as = a.split(" "); - for (var i = 0; i < as.length; i++) - { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } } - return b - } - - var selectInput = function(node) { node.select(); }; - if (ios) // Mobile Safari apparently has a bug where select() is broken. - { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; } - else if (ie) // Suppress mysterious IE10 errors - { selectInput = function(node) { try { node.select(); } catch(_e) {} }; } - - function bind(f) { - var args = Array.prototype.slice.call(arguments, 1); - return function(){return f.apply(null, args)} - } - - function copyObj(obj, target, overwrite) { - if (!target) { target = {}; } - for (var prop in obj) - { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) - { target[prop] = obj[prop]; } } - return target - } - - // Counts the column offset in a string, taking tabs into account. - // Used mostly to find indentation. - function countColumn(string, end, tabSize, startIndex, startValue) { - if (end == null) { - end = string.search(/[^\s\u00a0]/); - if (end == -1) { end = string.length; } - } - for (var i = startIndex || 0, n = startValue || 0;;) { - var nextTab = string.indexOf("\t", i); - if (nextTab < 0 || nextTab >= end) - { return n + (end - i) } - n += nextTab - i; - n += tabSize - (n % tabSize); - i = nextTab + 1; - } - } - - var Delayed = function() {this.id = null;}; - Delayed.prototype.set = function (ms, f) { - clearTimeout(this.id); - this.id = setTimeout(f, ms); - }; - - function indexOf(array, elt) { - for (var i = 0; i < array.length; ++i) - { if (array[i] == elt) { return i } } - return -1 - } - - // Number of pixels added to scroller and sizer to hide scrollbar - var scrollerGap = 30; - - // Returned or thrown by various protocols to signal 'I'm not - // handling this'. - var Pass = {toString: function(){return "CodeMirror.Pass"}}; - - // Reused option objects for setSelection & friends - var sel_dontScroll = {scroll: false}; - var sel_mouse = {origin: "*mouse"}; - var sel_move = {origin: "+move"}; - - // The inverse of countColumn -- find the offset that corresponds to - // a particular column. - function findColumn(string, goal, tabSize) { - for (var pos = 0, col = 0;;) { - var nextTab = string.indexOf("\t", pos); - if (nextTab == -1) { nextTab = string.length; } - var skipped = nextTab - pos; - if (nextTab == string.length || col + skipped >= goal) - { return pos + Math.min(skipped, goal - col) } - col += nextTab - pos; - col += tabSize - (col % tabSize); - pos = nextTab + 1; - if (col >= goal) { return pos } - } - } - - var spaceStrs = [""]; - function spaceStr(n) { - while (spaceStrs.length <= n) - { spaceStrs.push(lst(spaceStrs) + " "); } - return spaceStrs[n] - } - - function lst(arr) { return arr[arr.length-1] } - - function map(array, f) { - var out = []; - for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); } - return out - } - - function insertSorted(array, value, score) { - var pos = 0, priority = score(value); - while (pos < array.length && score(array[pos]) <= priority) { pos++; } - array.splice(pos, 0, value); - } - - function nothing() {} - - function createObj(base, props) { - var inst; - if (Object.create) { - inst = Object.create(base); - } else { - nothing.prototype = base; - inst = new nothing(); - } - if (props) { copyObj(props, inst); } - return inst - } - - var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; - function isWordCharBasic(ch) { - return /\w/.test(ch) || ch > "\x80" && - (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)) - } - function isWordChar(ch, helper) { - if (!helper) { return isWordCharBasic(ch) } - if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true } - return helper.test(ch) - } - - function isEmpty(obj) { - for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } } - return true - } - - // Extending unicode characters. A series of a non-extending char + - // any number of extending chars is treated as a single unit as far - // as editing and measuring is concerned. This is not fully correct, - // since some scripts/fonts/browsers also treat other configurations - // of code points as a group. - var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/; - function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) } - - // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range. - function skipExtendingChars(str, pos, dir) { - while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; } - return pos - } - - // Returns the value from the range [`from`; `to`] that satisfies - // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`. - function findFirst(pred, from, to) { - for (;;) { - if (Math.abs(from - to) <= 1) { return pred(from) ? from : to } - var mid = Math.floor((from + to) / 2); - if (pred(mid)) { to = mid; } - else { from = mid; } - } - } - - // The display handles the DOM integration, both for input reading - // and content drawing. It holds references to DOM nodes and - // display-related state. - - function Display(place, doc, input) { - var d = this; - this.input = input; - - // Covers bottom-right square when both scrollbars are present. - d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); - d.scrollbarFiller.setAttribute("cm-not-content", "true"); - // Covers bottom of gutter when coverGutterNextToScrollbar is on - // and h scrollbar is present. - d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); - d.gutterFiller.setAttribute("cm-not-content", "true"); - // Will contain the actual code, positioned to cover the viewport. - d.lineDiv = eltP("div", null, "CodeMirror-code"); - // Elements are added to these to represent selection and cursors. - d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); - d.cursorDiv = elt("div", null, "CodeMirror-cursors"); - // A visibility: hidden element used to find the size of things. - d.measure = elt("div", null, "CodeMirror-measure"); - // When lines outside of the viewport are measured, they are drawn in this. - d.lineMeasure = elt("div", null, "CodeMirror-measure"); - // Wraps everything that needs to exist inside the vertically-padded coordinate system - d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], - null, "position: relative; outline: none"); - var lines = eltP("div", [d.lineSpace], "CodeMirror-lines"); - // Moved around its parent to cover visible view. - d.mover = elt("div", [lines], null, "position: relative"); - // Set to the height of the document, allowing scrolling. - d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); - d.sizerWidth = null; - // Behavior of elts with overflow: auto and padding is - // inconsistent across browsers. This is used to ensure the - // scrollable area is big enough. - d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); - // Will contain the gutters, if any. - d.gutters = elt("div", null, "CodeMirror-gutters"); - d.lineGutter = null; - // Actual scrollable element. - d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); - d.scroller.setAttribute("tabIndex", "-1"); - // The element in which the editor lives. - d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); - - // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) - if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } - if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; } - - if (place) { - if (place.appendChild) { place.appendChild(d.wrapper); } - else { place(d.wrapper); } - } - - // Current rendered range (may be bigger than the view window). - d.viewFrom = d.viewTo = doc.first; - d.reportedViewFrom = d.reportedViewTo = doc.first; - // Information about the rendered lines. - d.view = []; - d.renderedView = null; - // Holds info about a single rendered line when it was rendered - // for measurement, while not in view. - d.externalMeasured = null; - // Empty space (in pixels) above the view - d.viewOffset = 0; - d.lastWrapHeight = d.lastWrapWidth = 0; - d.updateLineNumbers = null; - - d.nativeBarWidth = d.barHeight = d.barWidth = 0; - d.scrollbarsClipped = false; - - // Used to only resize the line number gutter when necessary (when - // the amount of lines crosses a boundary that makes its width change) - d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; - // Set to true when a non-horizontal-scrolling line widget is - // added. As an optimization, line widget aligning is skipped when - // this is false. - d.alignWidgets = false; - - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - - // Tracks the maximum line length so that the horizontal scrollbar - // can be kept static when scrolling. - d.maxLine = null; - d.maxLineLength = 0; - d.maxLineChanged = false; - - // Used for measuring wheel scrolling granularity - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; - - // True when shift is held down. - d.shift = false; - - // Used to track whether anything happened since the context menu - // was opened. - d.selForContextMenu = null; - - d.activeTouch = null; - - input.init(d); - } - - // Find the line object corresponding to the given line number. - function getLine(doc, n) { - n -= doc.first; - if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } - var chunk = doc; - while (!chunk.lines) { - for (var i = 0;; ++i) { - var child = chunk.children[i], sz = child.chunkSize(); - if (n < sz) { chunk = child; break } - n -= sz; - } - } - return chunk.lines[n] - } - - // Get the part of a document between two positions, as an array of - // strings. - function getBetween(doc, start, end) { - var out = [], n = start.line; - doc.iter(start.line, end.line + 1, function (line) { - var text = line.text; - if (n == end.line) { text = text.slice(0, end.ch); } - if (n == start.line) { text = text.slice(start.ch); } - out.push(text); - ++n; - }); - return out - } - // Get the lines between from and to, as array of strings. - function getLines(doc, from, to) { - var out = []; - doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value - return out - } - - // Update the height of a line, propagating the height change - // upwards to parent nodes. - function updateLineHeight(line, height) { - var diff = height - line.height; - if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } } - } - - // Given a line object, find its line number by walking up through - // its parent links. - function lineNo(line) { - if (line.parent == null) { return null } - var cur = line.parent, no = indexOf(cur.lines, line); - for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { - for (var i = 0;; ++i) { - if (chunk.children[i] == cur) { break } - no += chunk.children[i].chunkSize(); - } - } - return no + cur.first - } - - // Find the line at the given vertical position, using the height - // information in the document tree. - function lineAtHeight(chunk, h) { - var n = chunk.first; - outer: do { - for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) { - var child = chunk.children[i$1], ch = child.height; - if (h < ch) { chunk = child; continue outer } - h -= ch; - n += child.chunkSize(); - } - return n - } while (!chunk.lines) - var i = 0; - for (; i < chunk.lines.length; ++i) { - var line = chunk.lines[i], lh = line.height; - if (h < lh) { break } - h -= lh; - } - return n + i - } - - function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size} - - function lineNumberFor(options, i) { - return String(options.lineNumberFormatter(i + options.firstLineNumber)) - } - - // A Pos instance represents a position within the text. - function Pos(line, ch, sticky) { - if ( sticky === void 0 ) sticky = null; - - if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) } - this.line = line; - this.ch = ch; - this.sticky = sticky; - } - - // Compare two positions, return 0 if they are the same, a negative - // number when a is less, and a positive number otherwise. - function cmp(a, b) { return a.line - b.line || a.ch - b.ch } - - function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 } - - function copyPos(x) {return Pos(x.line, x.ch)} - function maxPos(a, b) { return cmp(a, b) < 0 ? b : a } - function minPos(a, b) { return cmp(a, b) < 0 ? a : b } - - // Most of the external API clips given positions to make sure they - // actually exist within the document. - function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))} - function clipPos(doc, pos) { - if (pos.line < doc.first) { return Pos(doc.first, 0) } - var last = doc.first + doc.size - 1; - if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) } - return clipToLen(pos, getLine(doc, pos.line).text.length) - } - function clipToLen(pos, linelen) { - var ch = pos.ch; - if (ch == null || ch > linelen) { return Pos(pos.line, linelen) } - else if (ch < 0) { return Pos(pos.line, 0) } - else { return pos } - } - function clipPosArray(doc, array) { - var out = []; - for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); } - return out - } - - // Optimize some code when these features are not used. - var sawReadOnlySpans = false; - var sawCollapsedSpans = false; - - function seeReadOnlySpans() { - sawReadOnlySpans = true; - } - - function seeCollapsedSpans() { - sawCollapsedSpans = true; - } - - // TEXTMARKER SPANS - - function MarkedSpan(marker, from, to) { - this.marker = marker; - this.from = from; this.to = to; - } - - // Search an array of spans for a span matching the given marker. - function getMarkedSpanFor(spans, marker) { - if (spans) { for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.marker == marker) { return span } - } } - } - // Remove a span from an array, returning undefined if no spans are - // left (we don't store arrays for lines without spans). - function removeMarkedSpan(spans, span) { - var r; - for (var i = 0; i < spans.length; ++i) - { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } - return r - } - // Add a span to a line. - function addMarkedSpan(line, span) { - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; - span.marker.attachLine(line); - } - - // Used for the algorithm that adjusts markers for a change in the - // document. These functions cut an array of spans at a given - // character position, returning an array of remaining chunks (or - // undefined if nothing remains). - function markedSpansBefore(old, startCh, isInsert) { - var nw; - if (old) { for (var i = 0; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); - if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); - } - } } - return nw - } - function markedSpansAfter(old, endCh, isInsert) { - var nw; - if (old) { for (var i = 0; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); - if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, - span.to == null ? null : span.to - endCh)); - } - } } - return nw - } - - // Given a change object, compute the new set of marker spans that - // cover the line in which the change took place. Removes spans - // entirely within the change, reconnects spans belonging to the - // same marker that appear on both sides of the change, and cuts off - // spans partially within the change. Returns an array of span - // arrays with one element for each line in (after) the change. - function stretchSpansOverChange(doc, change) { - if (change.full) { return null } - var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; - var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; - if (!oldFirst && !oldLast) { return null } - - var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; - // Get the spans that 'stick out' on both sides - var first = markedSpansBefore(oldFirst, startCh, isInsert); - var last = markedSpansAfter(oldLast, endCh, isInsert); - - // Next, merge those two ends - var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); - if (first) { - // Fix up .to properties of first - for (var i = 0; i < first.length; ++i) { - var span = first[i]; - if (span.to == null) { - var found = getMarkedSpanFor(last, span.marker); - if (!found) { span.to = startCh; } - else if (sameLine) { span.to = found.to == null ? null : found.to + offset; } - } - } - } - if (last) { - // Fix up .from in last (or move them into first in case of sameLine) - for (var i$1 = 0; i$1 < last.length; ++i$1) { - var span$1 = last[i$1]; - if (span$1.to != null) { span$1.to += offset; } - if (span$1.from == null) { - var found$1 = getMarkedSpanFor(first, span$1.marker); - if (!found$1) { - span$1.from = offset; - if (sameLine) { (first || (first = [])).push(span$1); } - } - } else { - span$1.from += offset; - if (sameLine) { (first || (first = [])).push(span$1); } - } - } - } - // Make sure we didn't create any zero-length spans - if (first) { first = clearEmptySpans(first); } - if (last && last != first) { last = clearEmptySpans(last); } - - var newMarkers = [first]; - if (!sameLine) { - // Fill gap with whole-line-spans - var gap = change.text.length - 2, gapMarkers; - if (gap > 0 && first) - { for (var i$2 = 0; i$2 < first.length; ++i$2) - { if (first[i$2].to == null) - { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } } - for (var i$3 = 0; i$3 < gap; ++i$3) - { newMarkers.push(gapMarkers); } - newMarkers.push(last); - } - return newMarkers - } - - // Remove spans that are empty and don't have a clearWhenEmpty - // option of false. - function clearEmptySpans(spans) { - for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) - { spans.splice(i--, 1); } - } - if (!spans.length) { return null } - return spans - } - - // Used to 'clip' out readOnly ranges when making a change. - function removeReadOnlyRanges(doc, from, to) { - var markers = null; - doc.iter(from.line, to.line + 1, function (line) { - if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { - var mark = line.markedSpans[i].marker; - if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) - { (markers || (markers = [])).push(mark); } - } } - }); - if (!markers) { return null } - var parts = [{from: from, to: to}]; - for (var i = 0; i < markers.length; ++i) { - var mk = markers[i], m = mk.find(0); - for (var j = 0; j < parts.length; ++j) { - var p = parts[j]; - if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue } - var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); - if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) - { newParts.push({from: p.from, to: m.from}); } - if (dto > 0 || !mk.inclusiveRight && !dto) - { newParts.push({from: m.to, to: p.to}); } - parts.splice.apply(parts, newParts); - j += newParts.length - 3; - } - } - return parts - } - - // Connect or disconnect spans from a line. - function detachMarkedSpans(line) { - var spans = line.markedSpans; - if (!spans) { return } - for (var i = 0; i < spans.length; ++i) - { spans[i].marker.detachLine(line); } - line.markedSpans = null; - } - function attachMarkedSpans(line, spans) { - if (!spans) { return } - for (var i = 0; i < spans.length; ++i) - { spans[i].marker.attachLine(line); } - line.markedSpans = spans; - } - - // Helpers used when computing which overlapping collapsed span - // counts as the larger one. - function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 } - function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 } - - // Returns a number indicating which of two overlapping collapsed - // spans is larger (and thus includes the other). Falls back to - // comparing ids when the spans cover exactly the same range. - function compareCollapsedMarkers(a, b) { - var lenDiff = a.lines.length - b.lines.length; - if (lenDiff != 0) { return lenDiff } - var aPos = a.find(), bPos = b.find(); - var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); - if (fromCmp) { return -fromCmp } - var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); - if (toCmp) { return toCmp } - return b.id - a.id - } - - // Find out whether a line ends or starts in a collapsed span. If - // so, return the marker for that span. - function collapsedSpanAtSide(line, start) { - var sps = sawCollapsedSpans && line.markedSpans, found; - if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && - (!found || compareCollapsedMarkers(found, sp.marker) < 0)) - { found = sp.marker; } - } } - return found - } - function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) } - function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) } - - // Test whether there exists a collapsed span that partially - // overlaps (covers the start or end, but not both) of a new span. - // Such overlap is not allowed. - function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) { - var line = getLine(doc, lineNo$$1); - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) { for (var i = 0; i < sps.length; ++i) { - var sp = sps[i]; - if (!sp.marker.collapsed) { continue } - var found = sp.marker.find(0); - var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); - var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); - if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue } - if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || - fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) - { return true } - } } - } - - // A visual line is a line as drawn on the screen. Folding, for - // example, can cause multiple logical lines to appear on the same - // visual line. This finds the start of the visual line that the - // given line is part of (usually that is the line itself). - function visualLine(line) { - var merged; - while (merged = collapsedSpanAtStart(line)) - { line = merged.find(-1, true).line; } - return line - } - - function visualLineEnd(line) { - var merged; - while (merged = collapsedSpanAtEnd(line)) - { line = merged.find(1, true).line; } - return line - } - - // Returns an array of logical lines that continue the visual line - // started by the argument, or undefined if there are no such lines. - function visualLineContinued(line) { - var merged, lines; - while (merged = collapsedSpanAtEnd(line)) { - line = merged.find(1, true).line - ;(lines || (lines = [])).push(line); - } - return lines - } - - // Get the line number of the start of the visual line that the - // given line number is part of. - function visualLineNo(doc, lineN) { - var line = getLine(doc, lineN), vis = visualLine(line); - if (line == vis) { return lineN } - return lineNo(vis) - } - - // Get the line number of the start of the next visual line after - // the given line. - function visualLineEndNo(doc, lineN) { - if (lineN > doc.lastLine()) { return lineN } - var line = getLine(doc, lineN), merged; - if (!lineIsHidden(doc, line)) { return lineN } - while (merged = collapsedSpanAtEnd(line)) - { line = merged.find(1, true).line; } - return lineNo(line) + 1 - } - - // Compute whether a line is hidden. Lines count as hidden when they - // are part of a visual line that starts with another line, or when - // they are entirely covered by collapsed, non-widget span. - function lineIsHidden(doc, line) { - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (!sp.marker.collapsed) { continue } - if (sp.from == null) { return true } - if (sp.marker.widgetNode) { continue } - if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) - { return true } - } } - } - function lineIsHiddenInner(doc, line, span) { - if (span.to == null) { - var end = span.marker.find(1, true); - return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)) - } - if (span.marker.inclusiveRight && span.to == line.text.length) - { return true } - for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) { - sp = line.markedSpans[i]; - if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && - (sp.to == null || sp.to != span.from) && - (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && - lineIsHiddenInner(doc, line, sp)) { return true } - } - } - - // Find the height above the given line. - function heightAtLine(lineObj) { - lineObj = visualLine(lineObj); - - var h = 0, chunk = lineObj.parent; - for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i]; - if (line == lineObj) { break } - else { h += line.height; } - } - for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { - for (var i$1 = 0; i$1 < p.children.length; ++i$1) { - var cur = p.children[i$1]; - if (cur == chunk) { break } - else { h += cur.height; } - } - } - return h - } - - // Compute the character length of a line, taking into account - // collapsed ranges (see markText) that might hide parts, and join - // other lines onto it. - function lineLength(line) { - if (line.height == 0) { return 0 } - var len = line.text.length, merged, cur = line; - while (merged = collapsedSpanAtStart(cur)) { - var found = merged.find(0, true); - cur = found.from.line; - len += found.from.ch - found.to.ch; - } - cur = line; - while (merged = collapsedSpanAtEnd(cur)) { - var found$1 = merged.find(0, true); - len -= cur.text.length - found$1.from.ch; - cur = found$1.to.line; - len += cur.text.length - found$1.to.ch; - } - return len - } - - // Find the longest line in the document. - function findMaxLine(cm) { - var d = cm.display, doc = cm.doc; - d.maxLine = getLine(doc, doc.first); - d.maxLineLength = lineLength(d.maxLine); - d.maxLineChanged = true; - doc.iter(function (line) { - var len = lineLength(line); - if (len > d.maxLineLength) { - d.maxLineLength = len; - d.maxLine = line; - } - }); - } - - // BIDI HELPERS - - function iterateBidiSections(order, from, to, f) { - if (!order) { return f(from, to, "ltr") } - var found = false; - for (var i = 0; i < order.length; ++i) { - var part = order[i]; - if (part.from < to && part.to > from || from == to && part.to == from) { - f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr"); - found = true; - } - } - if (!found) { f(from, to, "ltr"); } - } - - var bidiOther = null; - function getBidiPartAt(order, ch, sticky) { - var found; - bidiOther = null; - for (var i = 0; i < order.length; ++i) { - var cur = order[i]; - if (cur.from < ch && cur.to > ch) { return i } - if (cur.to == ch) { - if (cur.from != cur.to && sticky == "before") { found = i; } - else { bidiOther = i; } - } - if (cur.from == ch) { - if (cur.from != cur.to && sticky != "before") { found = i; } - else { bidiOther = i; } - } - } - return found != null ? found : bidiOther - } - - // Bidirectional ordering algorithm - // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm - // that this (partially) implements. - - // One-char codes used for character types: - // L (L): Left-to-Right - // R (R): Right-to-Left - // r (AL): Right-to-Left Arabic - // 1 (EN): European Number - // + (ES): European Number Separator - // % (ET): European Number Terminator - // n (AN): Arabic Number - // , (CS): Common Number Separator - // m (NSM): Non-Spacing Mark - // b (BN): Boundary Neutral - // s (B): Paragraph Separator - // t (S): Segment Separator - // w (WS): Whitespace - // N (ON): Other Neutrals - - // Returns null if characters are ordered as they appear - // (left-to-right), or an array of sections ({from, to, level} - // objects) in the order in which they occur visually. - var bidiOrdering = (function() { - // Character types for codepoints 0 to 0xff - var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"; - // Character types for codepoints 0x600 to 0x6f9 - var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"; - function charType(code) { - if (code <= 0xf7) { return lowTypes.charAt(code) } - else if (0x590 <= code && code <= 0x5f4) { return "R" } - else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) } - else if (0x6ee <= code && code <= 0x8ac) { return "r" } - else if (0x2000 <= code && code <= 0x200b) { return "w" } - else if (code == 0x200c) { return "b" } - else { return "L" } - } - - var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; - var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; - - function BidiSpan(level, from, to) { - this.level = level; - this.from = from; this.to = to; - } - - return function(str, direction) { - var outerType = direction == "ltr" ? "L" : "R"; - - if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false } - var len = str.length, types = []; - for (var i = 0; i < len; ++i) - { types.push(charType(str.charCodeAt(i))); } - - // W1. Examine each non-spacing mark (NSM) in the level run, and - // change the type of the NSM to the type of the previous - // character. If the NSM is at the start of the level run, it will - // get the type of sor. - for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) { - var type = types[i$1]; - if (type == "m") { types[i$1] = prev; } - else { prev = type; } - } - - // W2. Search backwards from each instance of a European number - // until the first strong type (R, L, AL, or sor) is found. If an - // AL is found, change the type of the European number to Arabic - // number. - // W3. Change all ALs to R. - for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) { - var type$1 = types[i$2]; - if (type$1 == "1" && cur == "r") { types[i$2] = "n"; } - else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } } - } - - // W4. A single European separator between two European numbers - // changes to a European number. A single common separator between - // two numbers of the same type changes to that type. - for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) { - var type$2 = types[i$3]; - if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; } - else if (type$2 == "," && prev$1 == types[i$3+1] && - (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; } - prev$1 = type$2; - } - - // W5. A sequence of European terminators adjacent to European - // numbers changes to all European numbers. - // W6. Otherwise, separators and terminators change to Other - // Neutral. - for (var i$4 = 0; i$4 < len; ++i$4) { - var type$3 = types[i$4]; - if (type$3 == ",") { types[i$4] = "N"; } - else if (type$3 == "%") { - var end = (void 0); - for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {} - var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"; - for (var j = i$4; j < end; ++j) { types[j] = replace; } - i$4 = end - 1; - } - } - - // W7. Search backwards from each instance of a European number - // until the first strong type (R, L, or sor) is found. If an L is - // found, then change the type of the European number to L. - for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) { - var type$4 = types[i$5]; - if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; } - else if (isStrong.test(type$4)) { cur$1 = type$4; } - } - - // N1. A sequence of neutrals takes the direction of the - // surrounding strong text if the text on both sides has the same - // direction. European and Arabic numbers act as if they were R in - // terms of their influence on neutrals. Start-of-level-run (sor) - // and end-of-level-run (eor) are used at level run boundaries. - // N2. Any remaining neutrals take the embedding direction. - for (var i$6 = 0; i$6 < len; ++i$6) { - if (isNeutral.test(types[i$6])) { - var end$1 = (void 0); - for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {} - var before = (i$6 ? types[i$6-1] : outerType) == "L"; - var after = (end$1 < len ? types[end$1] : outerType) == "L"; - var replace$1 = before == after ? (before ? "L" : "R") : outerType; - for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; } - i$6 = end$1 - 1; - } - } - - // Here we depart from the documented algorithm, in order to avoid - // building up an actual levels array. Since there are only three - // levels (0, 1, 2) in an implementation that doesn't take - // explicit embedding into account, we can build up the order on - // the fly, without following the level-based algorithm. - var order = [], m; - for (var i$7 = 0; i$7 < len;) { - if (countsAsLeft.test(types[i$7])) { - var start = i$7; - for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {} - order.push(new BidiSpan(0, start, i$7)); - } else { - var pos = i$7, at = order.length; - for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {} - for (var j$2 = pos; j$2 < i$7;) { - if (countsAsNum.test(types[j$2])) { - if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); } - var nstart = j$2; - for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {} - order.splice(at, 0, new BidiSpan(2, nstart, j$2)); - pos = j$2; - } else { ++j$2; } - } - if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); } - } - } - if (order[0].level == 1 && (m = str.match(/^\s+/))) { - order[0].from = m[0].length; - order.unshift(new BidiSpan(0, 0, m[0].length)); - } - if (lst(order).level == 1 && (m = str.match(/\s+$/))) { - lst(order).to -= m[0].length; - order.push(new BidiSpan(0, len - m[0].length, len)); - } - - return direction == "rtl" ? order.reverse() : order - } - })(); - - // Get the bidi ordering for the given line (and cache it). Returns - // false for lines that are fully left-to-right, and an array of - // BidiSpan objects otherwise. - function getOrder(line, direction) { - var order = line.order; - if (order == null) { order = line.order = bidiOrdering(line.text, direction); } - return order - } - - function moveCharLogically(line, ch, dir) { - var target = skipExtendingChars(line.text, ch + dir, dir); - return target < 0 || target > line.text.length ? null : target - } - - function moveLogically(line, start, dir) { - var ch = moveCharLogically(line, start.ch, dir); - return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before") - } - - function endOfLine(visually, cm, lineObj, lineNo, dir) { - if (visually) { - var order = getOrder(lineObj, cm.doc.direction); - if (order) { - var part = dir < 0 ? lst(order) : order[0]; - var moveInStorageOrder = (dir < 0) == (part.level == 1); - var sticky = moveInStorageOrder ? "after" : "before"; - var ch; - // With a wrapped rtl chunk (possibly spanning multiple bidi parts), - // it could be that the last bidi part is not on the last visual line, - // since visual lines contain content order-consecutive chunks. - // Thus, in rtl, we are looking for the first (content-order) character - // in the rtl chunk that is on the last line (that is, the same line - // as the last (content-order) character). - if (part.level > 0) { - var prep = prepareMeasureForLine(cm, lineObj); - ch = dir < 0 ? lineObj.text.length - 1 : 0; - var targetTop = measureCharPrepared(cm, prep, ch).top; - ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch); - if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); } - } else { ch = dir < 0 ? part.to : part.from; } - return new Pos(lineNo, ch, sticky) - } - } - return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after") - } - - function moveVisually(cm, line, start, dir) { - var bidi = getOrder(line, cm.doc.direction); - if (!bidi) { return moveLogically(line, start, dir) } - if (start.ch >= line.text.length) { - start.ch = line.text.length; - start.sticky = "before"; - } else if (start.ch <= 0) { - start.ch = 0; - start.sticky = "after"; - } - var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]; - if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) { - // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines, - // nothing interesting happens. - return moveLogically(line, start, dir) - } - - var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }; - var prep; - var getWrappedLineExtent = function (ch) { - if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} } - prep = prep || prepareMeasureForLine(cm, line); - return wrappedLineExtentChar(cm, line, prep, ch) - }; - var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch); - - if (cm.doc.direction == "rtl" || part.level == 1) { - var moveInStorageOrder = (part.level == 1) == (dir < 0); - var ch = mv(start, moveInStorageOrder ? 1 : -1); - if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) { - // Case 2: We move within an rtl part or in an rtl editor on the same visual line - var sticky = moveInStorageOrder ? "before" : "after"; - return new Pos(start.line, ch, sticky) - } - } - - // Case 3: Could not move within this bidi part in this visual line, so leave - // the current bidi part - - var searchInVisualLine = function (partPos, dir, wrappedLineExtent) { - var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder - ? new Pos(start.line, mv(ch, 1), "before") - : new Pos(start.line, ch, "after"); }; - - for (; partPos >= 0 && partPos < bidi.length; partPos += dir) { - var part = bidi[partPos]; - var moveInStorageOrder = (dir > 0) == (part.level != 1); - var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1); - if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) } - ch = moveInStorageOrder ? part.from : mv(part.to, -1); - if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) } - } - }; - - // Case 3a: Look for other bidi parts on the same visual line - var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent); - if (res) { return res } - - // Case 3b: Look for other bidi parts on the next visual line - var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1); - if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) { - res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh)); - if (res) { return res } - } - - // Case 4: Nowhere to move - return null - } - - // EVENT HANDLING - - // Lightweight event framework. on/off also work on DOM nodes, - // registering native DOM handlers. - - var noHandlers = []; - - var on = function(emitter, type, f) { - if (emitter.addEventListener) { - emitter.addEventListener(type, f, false); - } else if (emitter.attachEvent) { - emitter.attachEvent("on" + type, f); - } else { - var map$$1 = emitter._handlers || (emitter._handlers = {}); - map$$1[type] = (map$$1[type] || noHandlers).concat(f); - } - }; - - function getHandlers(emitter, type) { - return emitter._handlers && emitter._handlers[type] || noHandlers - } - - function off(emitter, type, f) { - if (emitter.removeEventListener) { - emitter.removeEventListener(type, f, false); - } else if (emitter.detachEvent) { - emitter.detachEvent("on" + type, f); - } else { - var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type]; - if (arr) { - var index = indexOf(arr, f); - if (index > -1) - { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); } - } - } - } - - function signal(emitter, type /*, values...*/) { - var handlers = getHandlers(emitter, type); - if (!handlers.length) { return } - var args = Array.prototype.slice.call(arguments, 2); - for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); } - } - - // The DOM events that CodeMirror handles can be overridden by - // registering a (non-DOM) handler on the editor for the event name, - // and preventDefault-ing the event in that handler. - function signalDOMEvent(cm, e, override) { - if (typeof e == "string") - { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; } - signal(cm, override || e.type, cm, e); - return e_defaultPrevented(e) || e.codemirrorIgnore - } - - function signalCursorActivity(cm) { - var arr = cm._handlers && cm._handlers.cursorActivity; - if (!arr) { return } - var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); - for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1) - { set.push(arr[i]); } } - } - - function hasHandler(emitter, type) { - return getHandlers(emitter, type).length > 0 - } - - // Add on and off methods to a constructor's prototype, to make - // registering events on such objects more convenient. - function eventMixin(ctor) { - ctor.prototype.on = function(type, f) {on(this, type, f);}; - ctor.prototype.off = function(type, f) {off(this, type, f);}; - } - - // Due to the fact that we still support jurassic IE versions, some - // compatibility wrappers are needed. - - function e_preventDefault(e) { - if (e.preventDefault) { e.preventDefault(); } - else { e.returnValue = false; } - } - function e_stopPropagation(e) { - if (e.stopPropagation) { e.stopPropagation(); } - else { e.cancelBubble = true; } - } - function e_defaultPrevented(e) { - return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false - } - function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} - - function e_target(e) {return e.target || e.srcElement} - function e_button(e) { - var b = e.which; - if (b == null) { - if (e.button & 1) { b = 1; } - else if (e.button & 2) { b = 3; } - else if (e.button & 4) { b = 2; } - } - if (mac && e.ctrlKey && b == 1) { b = 3; } - return b - } - - // Detect drag-and-drop - var dragAndDrop = function() { - // There is *some* kind of drag-and-drop support in IE6-8, but I - // couldn't get it to work yet. - if (ie && ie_version < 9) { return false } - var div = elt('div'); - return "draggable" in div || "dragDrop" in div - }(); - - var zwspSupported; - function zeroWidthElement(measure) { - if (zwspSupported == null) { - var test = elt("span", "\u200b"); - removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); - if (measure.firstChild.offsetHeight != 0) - { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); } - } - var node = zwspSupported ? elt("span", "\u200b") : - elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); - node.setAttribute("cm-text", ""); - return node - } - - // Feature-detect IE's crummy client rect reporting for bidi text - var badBidiRects; - function hasBadBidiRects(measure) { - if (badBidiRects != null) { return badBidiRects } - var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")); - var r0 = range(txt, 0, 1).getBoundingClientRect(); - var r1 = range(txt, 1, 2).getBoundingClientRect(); - removeChildren(measure); - if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780) - return badBidiRects = (r1.right - r0.right < 3) - } - - // See if "".split is the broken IE version, if so, provide an - // alternative way to split lines. - var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) { - var pos = 0, result = [], l = string.length; - while (pos <= l) { - var nl = string.indexOf("\n", pos); - if (nl == -1) { nl = string.length; } - var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); - var rt = line.indexOf("\r"); - if (rt != -1) { - result.push(line.slice(0, rt)); - pos += rt + 1; - } else { - result.push(line); - pos = nl + 1; - } - } - return result - } : function (string) { return string.split(/\r\n?|\n/); }; - - var hasSelection = window.getSelection ? function (te) { - try { return te.selectionStart != te.selectionEnd } - catch(e) { return false } - } : function (te) { - var range$$1; - try {range$$1 = te.ownerDocument.selection.createRange();} - catch(e) {} - if (!range$$1 || range$$1.parentElement() != te) { return false } - return range$$1.compareEndPoints("StartToEnd", range$$1) != 0 - }; - - var hasCopyEvent = (function () { - var e = elt("div"); - if ("oncopy" in e) { return true } - e.setAttribute("oncopy", "return;"); - return typeof e.oncopy == "function" - })(); - - var badZoomedRects = null; - function hasBadZoomedRects(measure) { - if (badZoomedRects != null) { return badZoomedRects } - var node = removeChildrenAndAdd(measure, elt("span", "x")); - var normal = node.getBoundingClientRect(); - var fromRange = range(node, 0, 1).getBoundingClientRect(); - return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1 - } - - // Known modes, by name and by MIME - var modes = {}; - var mimeModes = {}; - - // Extra arguments are stored as the mode's dependencies, which is - // used by (legacy) mechanisms like loadmode.js to automatically - // load a mode. (Preferred mechanism is the require/define calls.) - function defineMode(name, mode) { - if (arguments.length > 2) - { mode.dependencies = Array.prototype.slice.call(arguments, 2); } - modes[name] = mode; - } - - function defineMIME(mime, spec) { - mimeModes[mime] = spec; - } - - // Given a MIME type, a {name, ...options} config object, or a name - // string, return a mode config object. - function resolveMode(spec) { - if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { - spec = mimeModes[spec]; - } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { - var found = mimeModes[spec.name]; - if (typeof found == "string") { found = {name: found}; } - spec = createObj(found, spec); - spec.name = found.name; - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { - return resolveMode("application/xml") - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) { - return resolveMode("application/json") - } - if (typeof spec == "string") { return {name: spec} } - else { return spec || {name: "null"} } - } - - // Given a mode spec (anything that resolveMode accepts), find and - // initialize an actual mode object. - function getMode(options, spec) { - spec = resolveMode(spec); - var mfactory = modes[spec.name]; - if (!mfactory) { return getMode(options, "text/plain") } - var modeObj = mfactory(options, spec); - if (modeExtensions.hasOwnProperty(spec.name)) { - var exts = modeExtensions[spec.name]; - for (var prop in exts) { - if (!exts.hasOwnProperty(prop)) { continue } - if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; } - modeObj[prop] = exts[prop]; - } - } - modeObj.name = spec.name; - if (spec.helperType) { modeObj.helperType = spec.helperType; } - if (spec.modeProps) { for (var prop$1 in spec.modeProps) - { modeObj[prop$1] = spec.modeProps[prop$1]; } } - - return modeObj - } - - // This can be used to attach properties to mode objects from - // outside the actual mode definition. - var modeExtensions = {}; - function extendMode(mode, properties) { - var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); - copyObj(properties, exts); - } - - function copyState(mode, state) { - if (state === true) { return state } - if (mode.copyState) { return mode.copyState(state) } - var nstate = {}; - for (var n in state) { - var val = state[n]; - if (val instanceof Array) { val = val.concat([]); } - nstate[n] = val; - } - return nstate - } - - // Given a mode and a state (for that mode), find the inner mode and - // state at the position that the state refers to. - function innerMode(mode, state) { - var info; - while (mode.innerMode) { - info = mode.innerMode(state); - if (!info || info.mode == mode) { break } - state = info.state; - mode = info.mode; - } - return info || {mode: mode, state: state} - } - - function startState(mode, a1, a2) { - return mode.startState ? mode.startState(a1, a2) : true - } - - // STRING STREAM - - // Fed to the mode parsers, provides helper functions to make - // parsers more succinct. - - var StringStream = function(string, tabSize) { - this.pos = this.start = 0; - this.string = string; - this.tabSize = tabSize || 8; - this.lastColumnPos = this.lastColumnValue = 0; - this.lineStart = 0; - }; - - StringStream.prototype.eol = function () {return this.pos >= this.string.length}; - StringStream.prototype.sol = function () {return this.pos == this.lineStart}; - StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined}; - StringStream.prototype.next = function () { - if (this.pos < this.string.length) - { return this.string.charAt(this.pos++) } - }; - StringStream.prototype.eat = function (match) { - var ch = this.string.charAt(this.pos); - var ok; - if (typeof match == "string") { ok = ch == match; } - else { ok = ch && (match.test ? match.test(ch) : match(ch)); } - if (ok) {++this.pos; return ch} - }; - StringStream.prototype.eatWhile = function (match) { - var start = this.pos; - while (this.eat(match)){} - return this.pos > start - }; - StringStream.prototype.eatSpace = function () { - var this$1 = this; - - var start = this.pos; - while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; } - return this.pos > start - }; - StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;}; - StringStream.prototype.skipTo = function (ch) { - var found = this.string.indexOf(ch, this.pos); - if (found > -1) {this.pos = found; return true} - }; - StringStream.prototype.backUp = function (n) {this.pos -= n;}; - StringStream.prototype.column = function () { - if (this.lastColumnPos < this.start) { - this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); - this.lastColumnPos = this.start; - } - return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) - }; - StringStream.prototype.indentation = function () { - return countColumn(this.string, null, this.tabSize) - - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) - }; - StringStream.prototype.match = function (pattern, consume, caseInsensitive) { - if (typeof pattern == "string") { - var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }; - var substr = this.string.substr(this.pos, pattern.length); - if (cased(substr) == cased(pattern)) { - if (consume !== false) { this.pos += pattern.length; } - return true - } - } else { - var match = this.string.slice(this.pos).match(pattern); - if (match && match.index > 0) { return null } - if (match && consume !== false) { this.pos += match[0].length; } - return match - } - }; - StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)}; - StringStream.prototype.hideFirstChars = function (n, inner) { - this.lineStart += n; - try { return inner() } - finally { this.lineStart -= n; } - }; - - // Compute a style array (an array starting with a mode generation - // -- for invalidation -- followed by pairs of end positions and - // style strings), which is used to highlight the tokens on the - // line. - function highlightLine(cm, line, state, forceToEnd) { - // A styles array always starts with a number identifying the - // mode/overlays that it is based on (for easy invalidation). - var st = [cm.state.modeGen], lineClasses = {}; - // Compute the base array of styles - runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); }, - lineClasses, forceToEnd); - - // Run overlays, adjust style array. - var loop = function ( o ) { - var overlay = cm.state.overlays[o], i = 1, at = 0; - runMode(cm, line.text, overlay.mode, true, function (end, style) { - var start = i; - // Ensure there's a token end at the current position, and that i points at it - while (at < end) { - var i_end = st[i]; - if (i_end > end) - { st.splice(i, 1, end, st[i+1], i_end); } - i += 2; - at = Math.min(end, i_end); - } - if (!style) { return } - if (overlay.opaque) { - st.splice(start, i - start, end, "overlay " + style); - i = start + 2; - } else { - for (; start < i; start += 2) { - var cur = st[start+1]; - st[start+1] = (cur ? cur + " " : "") + "overlay " + style; - } - } - }, lineClasses); - }; - - for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); - - return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null} - } - - function getLineStyles(cm, line, updateFrontier) { - if (!line.styles || line.styles[0] != cm.state.modeGen) { - var state = getStateBefore(cm, lineNo(line)); - var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state); - line.stateAfter = state; - line.styles = result.styles; - if (result.classes) { line.styleClasses = result.classes; } - else if (line.styleClasses) { line.styleClasses = null; } - if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; } - } - return line.styles - } - - function getStateBefore(cm, n, precise) { - var doc = cm.doc, display = cm.display; - if (!doc.mode.startState) { return true } - var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter; - if (!state) { state = startState(doc.mode); } - else { state = copyState(doc.mode, state); } - doc.iter(pos, n, function (line) { - processLine(cm, line.text, state); - var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo; - line.stateAfter = save ? copyState(doc.mode, state) : null; - ++pos; - }); - if (precise) { doc.frontier = pos; } - return state - } - - // Lightweight form of highlight -- proceed over this line and - // update state, but don't save a style array. Used for lines that - // aren't currently visible. - function processLine(cm, text, state, startAt) { - var mode = cm.doc.mode; - var stream = new StringStream(text, cm.options.tabSize); - stream.start = stream.pos = startAt || 0; - if (text == "") { callBlankLine(mode, state); } - while (!stream.eol()) { - readToken(mode, stream, state); - stream.start = stream.pos; - } - } - - function callBlankLine(mode, state) { - if (mode.blankLine) { return mode.blankLine(state) } - if (!mode.innerMode) { return } - var inner = innerMode(mode, state); - if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) } - } - - function readToken(mode, stream, state, inner) { - for (var i = 0; i < 10; i++) { - if (inner) { inner[0] = innerMode(mode, state).mode; } - var style = mode.token(stream, state); - if (stream.pos > stream.start) { return style } - } - throw new Error("Mode " + mode.name + " failed to advance stream.") - } - - // Utility for getTokenAt and getLineTokens - function takeToken(cm, pos, precise, asArray) { - var getObj = function (copy) { return ({ - start: stream.start, end: stream.pos, - string: stream.current(), - type: style || null, - state: copy ? copyState(doc.mode, state) : state - }); }; - - var doc = cm.doc, mode = doc.mode, style; - pos = clipPos(doc, pos); - var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise); - var stream = new StringStream(line.text, cm.options.tabSize), tokens; - if (asArray) { tokens = []; } - while ((asArray || stream.pos < pos.ch) && !stream.eol()) { - stream.start = stream.pos; - style = readToken(mode, stream, state); - if (asArray) { tokens.push(getObj(true)); } - } - return asArray ? tokens : getObj() - } - - function extractLineClasses(type, output) { - if (type) { for (;;) { - var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); - if (!lineClass) { break } - type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); - var prop = lineClass[1] ? "bgClass" : "textClass"; - if (output[prop] == null) - { output[prop] = lineClass[2]; } - else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) - { output[prop] += " " + lineClass[2]; } - } } - return type - } - - // Run the given mode's parser over a line, calling f for each token. - function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { - var flattenSpans = mode.flattenSpans; - if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; } - var curStart = 0, curStyle = null; - var stream = new StringStream(text, cm.options.tabSize), style; - var inner = cm.options.addModeClass && [null]; - if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); } - while (!stream.eol()) { - if (stream.pos > cm.options.maxHighlightLength) { - flattenSpans = false; - if (forceToEnd) { processLine(cm, text, state, stream.pos); } - stream.pos = text.length; - style = null; - } else { - style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses); - } - if (inner) { - var mName = inner[0].name; - if (mName) { style = "m-" + (style ? mName + " " + style : mName); } - } - if (!flattenSpans || curStyle != style) { - while (curStart < stream.start) { - curStart = Math.min(stream.start, curStart + 5000); - f(curStart, curStyle); - } - curStyle = style; - } - stream.start = stream.pos; - } - while (curStart < stream.pos) { - // Webkit seems to refuse to render text nodes longer than 57444 - // characters, and returns inaccurate measurements in nodes - // starting around 5000 chars. - var pos = Math.min(stream.pos, curStart + 5000); - f(pos, curStyle); - curStart = pos; - } - } - - // Finds the line to start with when starting a parse. Tries to - // find a line with a stateAfter, so that it can start with a - // valid state. If that fails, it returns the line with the - // smallest indentation, which tends to need the least context to - // parse correctly. - function findStartLine(cm, n, precise) { - var minindent, minline, doc = cm.doc; - var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); - for (var search = n; search > lim; --search) { - if (search <= doc.first) { return doc.first } - var line = getLine(doc, search - 1); - if (line.stateAfter && (!precise || search <= doc.frontier)) { return search } - var indented = countColumn(line.text, null, cm.options.tabSize); - if (minline == null || minindent > indented) { - minline = search - 1; - minindent = indented; - } - } - return minline - } - - // LINE DATA STRUCTURE - - // Line objects. These hold state related to a line, including - // highlighting info (the styles array). - var Line = function(text, markedSpans, estimateHeight) { - this.text = text; - attachMarkedSpans(this, markedSpans); - this.height = estimateHeight ? estimateHeight(this) : 1; - }; - - Line.prototype.lineNo = function () { return lineNo(this) }; - eventMixin(Line); - - // Change the content (text, markers) of a line. Automatically - // invalidates cached information and tries to re-estimate the - // line's height. - function updateLine(line, text, markedSpans, estimateHeight) { - line.text = text; - if (line.stateAfter) { line.stateAfter = null; } - if (line.styles) { line.styles = null; } - if (line.order != null) { line.order = null; } - detachMarkedSpans(line); - attachMarkedSpans(line, markedSpans); - var estHeight = estimateHeight ? estimateHeight(line) : 1; - if (estHeight != line.height) { updateLineHeight(line, estHeight); } - } - - // Detach a line from the document tree and its markers. - function cleanUpLine(line) { - line.parent = null; - detachMarkedSpans(line); - } - - // Convert a style as returned by a mode (either null, or a string - // containing one or more styles) to a CSS style. This is cached, - // and also looks for line-wide styles. - var styleToClassCache = {}; - var styleToClassCacheWithMode = {}; - function interpretTokenStyle(style, options) { - if (!style || /^\s*$/.test(style)) { return null } - var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; - return cache[style] || - (cache[style] = style.replace(/\S+/g, "cm-$&")) - } - - // Render the DOM representation of the text of a line. Also builds - // up a 'line map', which points at the DOM nodes that represent - // specific stretches of text, and is used by the measuring code. - // The returned object contains the DOM node, this map, and - // information about line-wide styles that were set by the mode. - function buildLineContent(cm, lineView) { - // The padding-right forces the element to have a 'border', which - // is needed on Webkit to be able to get line-level bounding - // rectangles for it (in measureChar). - var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null); - var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content, - col: 0, pos: 0, cm: cm, - trailingSpace: false, - splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}; - lineView.measure = {}; - - // Iterate over the logical lines that make up this visual line. - for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { - var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0); - builder.pos = 0; - builder.addToken = buildToken; - // Optionally wire in some hacks into the token-rendering - // algorithm, to deal with browser quirks. - if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) - { builder.addToken = buildTokenBadBidi(builder.addToken, order); } - builder.map = []; - var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); - insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); - if (line.styleClasses) { - if (line.styleClasses.bgClass) - { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); } - if (line.styleClasses.textClass) - { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); } - } - - // Ensure at least a single node is present, for measuring. - if (builder.map.length == 0) - { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); } - - // Store the map and a cache object for the current logical line - if (i == 0) { - lineView.measure.map = builder.map; - lineView.measure.cache = {}; - } else { - (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map) - ;(lineView.measure.caches || (lineView.measure.caches = [])).push({}); - } - } - - // See issue #2901 - if (webkit) { - var last = builder.content.lastChild; - if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) - { builder.content.className = "cm-tab-wrap-hack"; } - } - - signal(cm, "renderLine", cm, lineView.line, builder.pre); - if (builder.pre.className) - { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); } - - return builder - } - - function defaultSpecialCharPlaceholder(ch) { - var token = elt("span", "\u2022", "cm-invalidchar"); - token.title = "\\u" + ch.charCodeAt(0).toString(16); - token.setAttribute("aria-label", token.title); - return token - } - - // Build up the DOM representation for a single token, and add it to - // the line map. Takes care to render special characters separately. - function buildToken(builder, text, style, startStyle, endStyle, title, css) { - if (!text) { return } - var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; - var special = builder.cm.state.specialChars, mustWrap = false; - var content; - if (!special.test(text)) { - builder.col += text.length; - content = document.createTextNode(displayText); - builder.map.push(builder.pos, builder.pos + text.length, content); - if (ie && ie_version < 9) { mustWrap = true; } - builder.pos += text.length; - } else { - content = document.createDocumentFragment(); - var pos = 0; - while (true) { - special.lastIndex = pos; - var m = special.exec(text); - var skipped = m ? m.index - pos : text.length - pos; - if (skipped) { - var txt = document.createTextNode(displayText.slice(pos, pos + skipped)); - if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); } - else { content.appendChild(txt); } - builder.map.push(builder.pos, builder.pos + skipped, txt); - builder.col += skipped; - builder.pos += skipped; - } - if (!m) { break } - pos += skipped + 1; - var txt$1 = (void 0); - if (m[0] == "\t") { - var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; - txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); - txt$1.setAttribute("role", "presentation"); - txt$1.setAttribute("cm-text", "\t"); - builder.col += tabWidth; - } else if (m[0] == "\r" || m[0] == "\n") { - txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")); - txt$1.setAttribute("cm-text", m[0]); - builder.col += 1; - } else { - txt$1 = builder.cm.options.specialCharPlaceholder(m[0]); - txt$1.setAttribute("cm-text", m[0]); - if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); } - else { content.appendChild(txt$1); } - builder.col += 1; - } - builder.map.push(builder.pos, builder.pos + 1, txt$1); - builder.pos++; - } - } - builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32; - if (style || startStyle || endStyle || mustWrap || css) { - var fullStyle = style || ""; - if (startStyle) { fullStyle += startStyle; } - if (endStyle) { fullStyle += endStyle; } - var token = elt("span", [content], fullStyle, css); - if (title) { token.title = title; } - return builder.content.appendChild(token) - } - builder.content.appendChild(content); - } - - function splitSpaces(text, trailingBefore) { - if (text.length > 1 && !/ /.test(text)) { return text } - var spaceBefore = trailingBefore, result = ""; - for (var i = 0; i < text.length; i++) { - var ch = text.charAt(i); - if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) - { ch = "\u00a0"; } - result += ch; - spaceBefore = ch == " "; - } - return result - } - - // Work around nonsense dimensions being reported for stretches of - // right-to-left text. - function buildTokenBadBidi(inner, order) { - return function (builder, text, style, startStyle, endStyle, title, css) { - style = style ? style + " cm-force-border" : "cm-force-border"; - var start = builder.pos, end = start + text.length; - for (;;) { - // Find the part that overlaps with the start of this text - var part = (void 0); - for (var i = 0; i < order.length; i++) { - part = order[i]; - if (part.to > start && part.from <= start) { break } - } - if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) } - inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css); - startStyle = null; - text = text.slice(part.to - start); - start = part.to; - } - } - } - - function buildCollapsedSpan(builder, size, marker, ignoreWidget) { - var widget = !ignoreWidget && marker.widgetNode; - if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); } - if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { - if (!widget) - { widget = builder.content.appendChild(document.createElement("span")); } - widget.setAttribute("cm-marker", marker.id); - } - if (widget) { - builder.cm.display.input.setUneditable(widget); - builder.content.appendChild(widget); - } - builder.pos += size; - builder.trailingSpace = false; - } - - // Outputs a number of spans to make up a line, taking highlighting - // and marked text into account. - function insertLineContent(line, builder, styles) { - var spans = line.markedSpans, allText = line.text, at = 0; - if (!spans) { - for (var i$1 = 1; i$1 < styles.length; i$1+=2) - { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); } - return - } - - var len = allText.length, pos = 0, i = 1, text = "", style, css; - var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; - for (;;) { - if (nextChange == pos) { // Update current marker set - spanStyle = spanEndStyle = spanStartStyle = title = css = ""; - collapsed = null; nextChange = Infinity; - var foundBookmarks = [], endStyles = (void 0); - for (var j = 0; j < spans.length; ++j) { - var sp = spans[j], m = sp.marker; - if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { - foundBookmarks.push(m); - } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { - if (sp.to != null && sp.to != pos && nextChange > sp.to) { - nextChange = sp.to; - spanEndStyle = ""; - } - if (m.className) { spanStyle += " " + m.className; } - if (m.css) { css = (css ? css + ";" : "") + m.css; } - if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; } - if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); } - if (m.title && !title) { title = m.title; } - if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) - { collapsed = sp; } - } else if (sp.from > pos && nextChange > sp.from) { - nextChange = sp.from; - } - } - if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) - { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } } - - if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) - { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } } - if (collapsed && (collapsed.from || 0) == pos) { - buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, - collapsed.marker, collapsed.from == null); - if (collapsed.to == null) { return } - if (collapsed.to == pos) { collapsed = false; } - } - } - if (pos >= len) { break } - - var upto = Math.min(len, nextChange); - while (true) { - if (text) { - var end = pos + text.length; - if (!collapsed) { - var tokenText = end > upto ? text.slice(0, upto - pos) : text; - builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, - spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css); - } - if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} - pos = end; - spanStartStyle = ""; - } - text = allText.slice(at, at = styles[i++]); - style = interpretTokenStyle(styles[i++], builder.cm.options); - } - } - } - - - // These objects are used to represent the visible (currently drawn) - // part of the document. A LineView may correspond to multiple - // logical lines, if those are connected by collapsed ranges. - function LineView(doc, line, lineN) { - // The starting line - this.line = line; - // Continuing lines, if any - this.rest = visualLineContinued(line); - // Number of logical lines in this visual line - this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; - this.node = this.text = null; - this.hidden = lineIsHidden(doc, line); - } - - // Create a range of LineView objects for the given lines. - function buildViewArray(cm, from, to) { - var array = [], nextPos; - for (var pos = from; pos < to; pos = nextPos) { - var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); - nextPos = pos + view.size; - array.push(view); - } - return array - } - - var operationGroup = null; - - function pushOperation(op) { - if (operationGroup) { - operationGroup.ops.push(op); - } else { - op.ownsGroup = operationGroup = { - ops: [op], - delayedCallbacks: [] - }; - } - } - - function fireCallbacksForOps(group) { - // Calls delayed callbacks and cursorActivity handlers until no - // new ones appear - var callbacks = group.delayedCallbacks, i = 0; - do { - for (; i < callbacks.length; i++) - { callbacks[i].call(null); } - for (var j = 0; j < group.ops.length; j++) { - var op = group.ops[j]; - if (op.cursorActivityHandlers) - { while (op.cursorActivityCalled < op.cursorActivityHandlers.length) - { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } } - } - } while (i < callbacks.length) - } - - function finishOperation(op, endCb) { - var group = op.ownsGroup; - if (!group) { return } - - try { fireCallbacksForOps(group); } - finally { - operationGroup = null; - endCb(group); - } - } - - var orphanDelayedCallbacks = null; - - // Often, we want to signal events at a point where we are in the - // middle of some work, but don't want the handler to start calling - // other methods on the editor, which might be in an inconsistent - // state or simply not expect any other events to happen. - // signalLater looks whether there are any handlers, and schedules - // them to be executed when the last operation ends, or, if no - // operation is active, when a timeout fires. - function signalLater(emitter, type /*, values...*/) { - var arr = getHandlers(emitter, type); - if (!arr.length) { return } - var args = Array.prototype.slice.call(arguments, 2), list; - if (operationGroup) { - list = operationGroup.delayedCallbacks; - } else if (orphanDelayedCallbacks) { - list = orphanDelayedCallbacks; - } else { - list = orphanDelayedCallbacks = []; - setTimeout(fireOrphanDelayed, 0); - } - var loop = function ( i ) { - list.push(function () { return arr[i].apply(null, args); }); - }; - - for (var i = 0; i < arr.length; ++i) - loop( i ); - } - - function fireOrphanDelayed() { - var delayed = orphanDelayedCallbacks; - orphanDelayedCallbacks = null; - for (var i = 0; i < delayed.length; ++i) { delayed[i](); } - } - - // When an aspect of a line changes, a string is added to - // lineView.changes. This updates the relevant part of the line's - // DOM structure. - function updateLineForChanges(cm, lineView, lineN, dims) { - for (var j = 0; j < lineView.changes.length; j++) { - var type = lineView.changes[j]; - if (type == "text") { updateLineText(cm, lineView); } - else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); } - else if (type == "class") { updateLineClasses(cm, lineView); } - else if (type == "widget") { updateLineWidgets(cm, lineView, dims); } - } - lineView.changes = null; - } - - // Lines with gutter elements, widgets or a background class need to - // be wrapped, and have the extra elements added to the wrapper div - function ensureLineWrapped(lineView) { - if (lineView.node == lineView.text) { - lineView.node = elt("div", null, null, "position: relative"); - if (lineView.text.parentNode) - { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); } - lineView.node.appendChild(lineView.text); - if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; } - } - return lineView.node - } - - function updateLineBackground(cm, lineView) { - var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass; - if (cls) { cls += " CodeMirror-linebackground"; } - if (lineView.background) { - if (cls) { lineView.background.className = cls; } - else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; } - } else if (cls) { - var wrap = ensureLineWrapped(lineView); - lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild); - cm.display.input.setUneditable(lineView.background); - } - } - - // Wrapper around buildLineContent which will reuse the structure - // in display.externalMeasured when possible. - function getLineContent(cm, lineView) { - var ext = cm.display.externalMeasured; - if (ext && ext.line == lineView.line) { - cm.display.externalMeasured = null; - lineView.measure = ext.measure; - return ext.built - } - return buildLineContent(cm, lineView) - } - - // Redraw the line's text. Interacts with the background and text - // classes because the mode may output tokens that influence these - // classes. - function updateLineText(cm, lineView) { - var cls = lineView.text.className; - var built = getLineContent(cm, lineView); - if (lineView.text == lineView.node) { lineView.node = built.pre; } - lineView.text.parentNode.replaceChild(built.pre, lineView.text); - lineView.text = built.pre; - if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { - lineView.bgClass = built.bgClass; - lineView.textClass = built.textClass; - updateLineClasses(cm, lineView); - } else if (cls) { - lineView.text.className = cls; - } - } - - function updateLineClasses(cm, lineView) { - updateLineBackground(cm, lineView); - if (lineView.line.wrapClass) - { ensureLineWrapped(lineView).className = lineView.line.wrapClass; } - else if (lineView.node != lineView.text) - { lineView.node.className = ""; } - var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass; - lineView.text.className = textClass || ""; - } - - function updateLineGutter(cm, lineView, lineN, dims) { - if (lineView.gutter) { - lineView.node.removeChild(lineView.gutter); - lineView.gutter = null; - } - if (lineView.gutterBackground) { - lineView.node.removeChild(lineView.gutterBackground); - lineView.gutterBackground = null; - } - if (lineView.line.gutterClass) { - var wrap = ensureLineWrapped(lineView); - lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass, - ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px")); - cm.display.input.setUneditable(lineView.gutterBackground); - wrap.insertBefore(lineView.gutterBackground, lineView.text); - } - var markers = lineView.line.gutterMarkers; - if (cm.options.lineNumbers || markers) { - var wrap$1 = ensureLineWrapped(lineView); - var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")); - cm.display.input.setUneditable(gutterWrap); - wrap$1.insertBefore(gutterWrap, lineView.text); - if (lineView.line.gutterClass) - { gutterWrap.className += " " + lineView.line.gutterClass; } - if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) - { lineView.lineNumber = gutterWrap.appendChild( - elt("div", lineNumberFor(cm.options, lineN), - "CodeMirror-linenumber CodeMirror-gutter-elt", - ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); } - if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) { - var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]; - if (found) - { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", - ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); } - } } - } - } - - function updateLineWidgets(cm, lineView, dims) { - if (lineView.alignable) { lineView.alignable = null; } - for (var node = lineView.node.firstChild, next = (void 0); node; node = next) { - next = node.nextSibling; - if (node.className == "CodeMirror-linewidget") - { lineView.node.removeChild(node); } - } - insertLineWidgets(cm, lineView, dims); - } - - // Build a line's DOM representation from scratch - function buildLineElement(cm, lineView, lineN, dims) { - var built = getLineContent(cm, lineView); - lineView.text = lineView.node = built.pre; - if (built.bgClass) { lineView.bgClass = built.bgClass; } - if (built.textClass) { lineView.textClass = built.textClass; } - - updateLineClasses(cm, lineView); - updateLineGutter(cm, lineView, lineN, dims); - insertLineWidgets(cm, lineView, dims); - return lineView.node - } - - // A lineView may contain multiple logical lines (when merged by - // collapsed spans). The widgets for all of them need to be drawn. - function insertLineWidgets(cm, lineView, dims) { - insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); - if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) - { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } } - } - - function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { - if (!line.widgets) { return } - var wrap = ensureLineWrapped(lineView); - for (var i = 0, ws = line.widgets; i < ws.length; ++i) { - var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget"); - if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); } - positionLineWidget(widget, node, lineView, dims); - cm.display.input.setUneditable(node); - if (allowAbove && widget.above) - { wrap.insertBefore(node, lineView.gutter || lineView.text); } - else - { wrap.appendChild(node); } - signalLater(widget, "redraw"); - } - } - - function positionLineWidget(widget, node, lineView, dims) { - if (widget.noHScroll) { - (lineView.alignable || (lineView.alignable = [])).push(node); - var width = dims.wrapperWidth; - node.style.left = dims.fixedPos + "px"; - if (!widget.coverGutter) { - width -= dims.gutterTotalWidth; - node.style.paddingLeft = dims.gutterTotalWidth + "px"; - } - node.style.width = width + "px"; - } - if (widget.coverGutter) { - node.style.zIndex = 5; - node.style.position = "relative"; - if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; } - } - } - - function widgetHeight(widget) { - if (widget.height != null) { return widget.height } - var cm = widget.doc.cm; - if (!cm) { return 0 } - if (!contains(document.body, widget.node)) { - var parentStyle = "position: relative;"; - if (widget.coverGutter) - { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; } - if (widget.noHScroll) - { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; } - removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)); - } - return widget.height = widget.node.parentNode.offsetHeight - } - - // Return true when the given mouse event happened in a widget - function eventInWidget(display, e) { - for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { - if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || - (n.parentNode == display.sizer && n != display.mover)) - { return true } - } - } - - // POSITION MEASUREMENT - - function paddingTop(display) {return display.lineSpace.offsetTop} - function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight} - function paddingH(display) { - if (display.cachedPaddingH) { return display.cachedPaddingH } - var e = removeChildrenAndAdd(display.measure, elt("pre", "x")); - var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle; - var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}; - if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; } - return data - } - - function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth } - function displayWidth(cm) { - return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth - } - function displayHeight(cm) { - return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight - } - - // Ensure the lineView.wrapping.heights array is populated. This is - // an array of bottom offsets for the lines that make up a drawn - // line. When lineWrapping is on, there might be more than one - // height. - function ensureLineHeights(cm, lineView, rect) { - var wrapping = cm.options.lineWrapping; - var curWidth = wrapping && displayWidth(cm); - if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { - var heights = lineView.measure.heights = []; - if (wrapping) { - lineView.measure.width = curWidth; - var rects = lineView.text.firstChild.getClientRects(); - for (var i = 0; i < rects.length - 1; i++) { - var cur = rects[i], next = rects[i + 1]; - if (Math.abs(cur.bottom - next.bottom) > 2) - { heights.push((cur.bottom + next.top) / 2 - rect.top); } - } - } - heights.push(rect.bottom - rect.top); - } - } - - // Find a line map (mapping character offsets to text nodes) and a - // measurement cache for the given line number. (A line view might - // contain multiple lines when collapsed ranges are present.) - function mapFromLineView(lineView, line, lineN) { - if (lineView.line == line) - { return {map: lineView.measure.map, cache: lineView.measure.cache} } - for (var i = 0; i < lineView.rest.length; i++) - { if (lineView.rest[i] == line) - { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } - for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) - { if (lineNo(lineView.rest[i$1]) > lineN) - { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } - } - - // Render a line into the hidden node display.externalMeasured. Used - // when measurement is needed for a line that's not in the viewport. - function updateExternalMeasurement(cm, line) { - line = visualLine(line); - var lineN = lineNo(line); - var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); - view.lineN = lineN; - var built = view.built = buildLineContent(cm, view); - view.text = built.pre; - removeChildrenAndAdd(cm.display.lineMeasure, built.pre); - return view - } - - // Get a {top, bottom, left, right} box (in line-local coordinates) - // for a given character. - function measureChar(cm, line, ch, bias) { - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias) - } - - // Find a line view that corresponds to the given line number. - function findViewForLine(cm, lineN) { - if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) - { return cm.display.view[findViewIndex(cm, lineN)] } - var ext = cm.display.externalMeasured; - if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) - { return ext } - } - - // Measurement can be split in two steps, the set-up work that - // applies to the whole line, and the measurement of the actual - // character. Functions like coordsChar, that need to do a lot of - // measurements in a row, can thus ensure that the set-up work is - // only done once. - function prepareMeasureForLine(cm, line) { - var lineN = lineNo(line); - var view = findViewForLine(cm, lineN); - if (view && !view.text) { - view = null; - } else if (view && view.changes) { - updateLineForChanges(cm, view, lineN, getDimensions(cm)); - cm.curOp.forceUpdate = true; - } - if (!view) - { view = updateExternalMeasurement(cm, line); } - - var info = mapFromLineView(view, line, lineN); - return { - line: line, view: view, rect: null, - map: info.map, cache: info.cache, before: info.before, - hasHeights: false - } - } - - // Given a prepared measurement object, measures the position of an - // actual character (or fetches it from the cache). - function measureCharPrepared(cm, prepared, ch, bias, varHeight) { - if (prepared.before) { ch = -1; } - var key = ch + (bias || ""), found; - if (prepared.cache.hasOwnProperty(key)) { - found = prepared.cache[key]; - } else { - if (!prepared.rect) - { prepared.rect = prepared.view.text.getBoundingClientRect(); } - if (!prepared.hasHeights) { - ensureLineHeights(cm, prepared.view, prepared.rect); - prepared.hasHeights = true; - } - found = measureCharInner(cm, prepared, ch, bias); - if (!found.bogus) { prepared.cache[key] = found; } - } - return {left: found.left, right: found.right, - top: varHeight ? found.rtop : found.top, - bottom: varHeight ? found.rbottom : found.bottom} - } - - var nullRect = {left: 0, right: 0, top: 0, bottom: 0}; - - function nodeAndOffsetInLineMap(map$$1, ch, bias) { - var node, start, end, collapse, mStart, mEnd; - // First, search the line map for the text node corresponding to, - // or closest to, the target character. - for (var i = 0; i < map$$1.length; i += 3) { - mStart = map$$1[i]; - mEnd = map$$1[i + 1]; - if (ch < mStart) { - start = 0; end = 1; - collapse = "left"; - } else if (ch < mEnd) { - start = ch - mStart; - end = start + 1; - } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) { - end = mEnd - mStart; - start = end - 1; - if (ch >= mEnd) { collapse = "right"; } - } - if (start != null) { - node = map$$1[i + 2]; - if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) - { collapse = bias; } - if (bias == "left" && start == 0) - { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) { - node = map$$1[(i -= 3) + 2]; - collapse = "left"; - } } - if (bias == "right" && start == mEnd - mStart) - { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) { - node = map$$1[(i += 3) + 2]; - collapse = "right"; - } } - break - } - } - return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd} - } - - function getUsefulRect(rects, bias) { - var rect = nullRect; - if (bias == "left") { for (var i = 0; i < rects.length; i++) { - if ((rect = rects[i]).left != rect.right) { break } - } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) { - if ((rect = rects[i$1]).left != rect.right) { break } - } } - return rect - } - - function measureCharInner(cm, prepared, ch, bias) { - var place = nodeAndOffsetInLineMap(prepared.map, ch, bias); - var node = place.node, start = place.start, end = place.end, collapse = place.collapse; - - var rect; - if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. - for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned - while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; } - while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; } - if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) - { rect = node.parentNode.getBoundingClientRect(); } - else - { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); } - if (rect.left || rect.right || start == 0) { break } - end = start; - start = start - 1; - collapse = "right"; - } - if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); } - } else { // If it is a widget, simply get the box for the whole widget. - if (start > 0) { collapse = bias = "right"; } - var rects; - if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) - { rect = rects[bias == "right" ? rects.length - 1 : 0]; } - else - { rect = node.getBoundingClientRect(); } - } - if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { - var rSpan = node.parentNode.getClientRects()[0]; - if (rSpan) - { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; } - else - { rect = nullRect; } - } - - var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top; - var mid = (rtop + rbot) / 2; - var heights = prepared.view.measure.heights; - var i = 0; - for (; i < heights.length - 1; i++) - { if (mid < heights[i]) { break } } - var top = i ? heights[i - 1] : 0, bot = heights[i]; - var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, - right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, - top: top, bottom: bot}; - if (!rect.left && !rect.right) { result.bogus = true; } - if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; } - - return result - } - - // Work around problem with bounding client rects on ranges being - // returned incorrectly when zoomed on IE10 and below. - function maybeUpdateRectForZooming(measure, rect) { - if (!window.screen || screen.logicalXDPI == null || - screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) - { return rect } - var scaleX = screen.logicalXDPI / screen.deviceXDPI; - var scaleY = screen.logicalYDPI / screen.deviceYDPI; - return {left: rect.left * scaleX, right: rect.right * scaleX, - top: rect.top * scaleY, bottom: rect.bottom * scaleY} - } - - function clearLineMeasurementCacheFor(lineView) { - if (lineView.measure) { - lineView.measure.cache = {}; - lineView.measure.heights = null; - if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) - { lineView.measure.caches[i] = {}; } } - } - } - - function clearLineMeasurementCache(cm) { - cm.display.externalMeasure = null; - removeChildren(cm.display.lineMeasure); - for (var i = 0; i < cm.display.view.length; i++) - { clearLineMeasurementCacheFor(cm.display.view[i]); } - } - - function clearCaches(cm) { - clearLineMeasurementCache(cm); - cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null; - if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; } - cm.display.lineNumChars = null; - } - - function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft } - function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop } - - // Converts a {top, bottom, left, right} box from line-local - // coordinates into another coordinate system. Context may be one of - // "line", "div" (display.lineDiv), "local"./null (editor), "window", - // or "page". - function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) { - if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) { - var size = widgetHeight(lineObj.widgets[i]); - rect.top += size; rect.bottom += size; - } } } - if (context == "line") { return rect } - if (!context) { context = "local"; } - var yOff = heightAtLine(lineObj); - if (context == "local") { yOff += paddingTop(cm.display); } - else { yOff -= cm.display.viewOffset; } - if (context == "page" || context == "window") { - var lOff = cm.display.lineSpace.getBoundingClientRect(); - yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); - rect.left += xOff; rect.right += xOff; - } - rect.top += yOff; rect.bottom += yOff; - return rect - } - - // Coverts a box from "div" coords to another coordinate system. - // Context may be "window", "page", "div", or "local"./null. - function fromCoordSystem(cm, coords, context) { - if (context == "div") { return coords } - var left = coords.left, top = coords.top; - // First move into "page" coordinate system - if (context == "page") { - left -= pageScrollX(); - top -= pageScrollY(); - } else if (context == "local" || !context) { - var localBox = cm.display.sizer.getBoundingClientRect(); - left += localBox.left; - top += localBox.top; - } - - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); - return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} - } - - function charCoords(cm, pos, context, lineObj, bias) { - if (!lineObj) { lineObj = getLine(cm.doc, pos.line); } - return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context) - } - - // Returns a box for a given cursor position, which may have an - // 'other' property containing the position of the secondary cursor - // on a bidi boundary. - // A cursor Pos(line, char, "before") is on the same visual line as `char - 1` - // and after `char - 1` in writing order of `char - 1` - // A cursor Pos(line, char, "after") is on the same visual line as `char` - // and before `char` in writing order of `char` - // Examples (upper-case letters are RTL, lower-case are LTR): - // Pos(0, 1, ...) - // before after - // ab a|b a|b - // aB a|B aB| - // Ab |Ab A|b - // AB B|A B|A - // Every position after the last character on a line is considered to stick - // to the last character on the line. - function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { - lineObj = lineObj || getLine(cm.doc, pos.line); - if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); } - function get(ch, right) { - var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); - if (right) { m.left = m.right; } else { m.right = m.left; } - return intoCoordSystem(cm, lineObj, m, context) - } - var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky; - if (ch >= lineObj.text.length) { - ch = lineObj.text.length; - sticky = "before"; - } else if (ch <= 0) { - ch = 0; - sticky = "after"; - } - if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") } - - function getBidi(ch, partPos, invert) { - var part = order[partPos], right = (part.level % 2) != 0; - return get(invert ? ch - 1 : ch, right != invert) - } - var partPos = getBidiPartAt(order, ch, sticky); - var other = bidiOther; - var val = getBidi(ch, partPos, sticky == "before"); - if (other != null) { val.other = getBidi(ch, other, sticky != "before"); } - return val - } - - // Used to cheaply estimate the coordinates for a position. Used for - // intermediate scroll updates. - function estimateCoords(cm, pos) { - var left = 0; - pos = clipPos(cm.doc, pos); - if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; } - var lineObj = getLine(cm.doc, pos.line); - var top = heightAtLine(lineObj) + paddingTop(cm.display); - return {left: left, right: left, top: top, bottom: top + lineObj.height} - } - - // Positions returned by coordsChar contain some extra information. - // xRel is the relative x position of the input coordinates compared - // to the found position (so xRel > 0 means the coordinates are to - // the right of the character position, for example). When outside - // is true, that means the coordinates lie outside the line's - // vertical range. - function PosWithInfo(line, ch, sticky, outside, xRel) { - var pos = Pos(line, ch, sticky); - pos.xRel = xRel; - if (outside) { pos.outside = true; } - return pos - } - - // Compute the character position closest to the given coordinates. - // Input must be lineSpace-local ("div" coordinate system). - function coordsChar(cm, x, y) { - var doc = cm.doc; - y += cm.display.viewOffset; - if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) } - var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; - if (lineN > last) - { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) } - if (x < 0) { x = 0; } - - var lineObj = getLine(doc, lineN); - for (;;) { - var found = coordsCharInner(cm, lineObj, lineN, x, y); - var merged = collapsedSpanAtEnd(lineObj); - var mergedPos = merged && merged.find(0, true); - if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) - { lineN = lineNo(lineObj = mergedPos.to.line); } - else - { return found } - } - } - - function wrappedLineExtent(cm, lineObj, preparedMeasure, y) { - var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); }; - var end = lineObj.text.length; - var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0); - end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end); - return {begin: begin, end: end} - } - - function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) { - var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top; - return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop) - } - - function coordsCharInner(cm, lineObj, lineNo$$1, x, y) { - y -= heightAtLine(lineObj); - var begin = 0, end = lineObj.text.length; - var preparedMeasure = prepareMeasureForLine(cm, lineObj); - var pos; - var order = getOrder(lineObj, cm.doc.direction); - if (order) { - if (cm.options.lineWrapping) { - var assign; - ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign)); - } - pos = new Pos(lineNo$$1, begin); - var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left; - var dir = beginLeft < x ? 1 : -1; - var prevDiff, diff = beginLeft - x, prevPos; - do { - prevDiff = diff; - prevPos = pos; - pos = moveVisually(cm, lineObj, pos, dir); - if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) { - pos = prevPos; - break - } - diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x; - } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff))) - if (Math.abs(diff) > Math.abs(prevDiff)) { - if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") } - pos = prevPos; - } - } else { - var ch = findFirst(function (ch) { - var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); - if (box.top > y) { - // For the cursor stickiness - end = Math.min(ch, end); - return true - } - else if (box.bottom <= y) { return false } - else if (box.left > x) { return true } - else if (box.right < x) { return false } - else { return (x - box.left < box.right - x) } - }, begin, end); - ch = skipExtendingChars(lineObj.text, ch, 1); - pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after"); - } - var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure); - if (y < coords.top || coords.bottom < y) { pos.outside = true; } - pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0); - return pos - } - - var measureText; - // Compute the default text height. - function textHeight(display) { - if (display.cachedTextHeight != null) { return display.cachedTextHeight } - if (measureText == null) { - measureText = elt("pre"); - // Measure a bunch of lines, for browsers that compute - // fractional heights. - for (var i = 0; i < 49; ++i) { - measureText.appendChild(document.createTextNode("x")); - measureText.appendChild(elt("br")); - } - measureText.appendChild(document.createTextNode("x")); - } - removeChildrenAndAdd(display.measure, measureText); - var height = measureText.offsetHeight / 50; - if (height > 3) { display.cachedTextHeight = height; } - removeChildren(display.measure); - return height || 1 - } - - // Compute the default character width. - function charWidth(display) { - if (display.cachedCharWidth != null) { return display.cachedCharWidth } - var anchor = elt("span", "xxxxxxxxxx"); - var pre = elt("pre", [anchor]); - removeChildrenAndAdd(display.measure, pre); - var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; - if (width > 2) { display.cachedCharWidth = width; } - return width || 10 - } - - // Do a bulk-read of the DOM positions and sizes needed to draw the - // view, so that we don't interleave reading and writing to the DOM. - function getDimensions(cm) { - var d = cm.display, left = {}, width = {}; - var gutterLeft = d.gutters.clientLeft; - for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { - left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft; - width[cm.options.gutters[i]] = n.clientWidth; - } - return {fixedPos: compensateForHScroll(d), - gutterTotalWidth: d.gutters.offsetWidth, - gutterLeft: left, - gutterWidth: width, - wrapperWidth: d.wrapper.clientWidth} - } - - // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, - // but using getBoundingClientRect to get a sub-pixel-accurate - // result. - function compensateForHScroll(display) { - return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left - } - - // Returns a function that estimates the height of a line, to use as - // first approximation until the line becomes visible (and is thus - // properly measurable). - function estimateHeight(cm) { - var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; - var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); - return function (line) { - if (lineIsHidden(cm.doc, line)) { return 0 } - - var widgetsHeight = 0; - if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { - if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; } - } } - - if (wrapping) - { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } - else - { return widgetsHeight + th } - } - } - - function estimateLineHeights(cm) { - var doc = cm.doc, est = estimateHeight(cm); - doc.iter(function (line) { - var estHeight = est(line); - if (estHeight != line.height) { updateLineHeight(line, estHeight); } - }); - } - - // Given a mouse event, find the corresponding position. If liberal - // is false, it checks whether a gutter or scrollbar was clicked, - // and returns null if it was. forRect is used by rectangular - // selections, and tries to estimate a character position even for - // coordinates beyond the right of the text. - function posFromMouse(cm, e, liberal, forRect) { - var display = cm.display; - if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } - - var x, y, space = display.lineSpace.getBoundingClientRect(); - // Fails unpredictably on IE[67] when mouse is dragged around quickly. - try { x = e.clientX - space.left; y = e.clientY - space.top; } - catch (e) { return null } - var coords = coordsChar(cm, x, y), line; - if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { - var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; - coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); - } - return coords - } - - // Find the view element corresponding to a given line. Return null - // when the line isn't visible. - function findViewIndex(cm, n) { - if (n >= cm.display.viewTo) { return null } - n -= cm.display.viewFrom; - if (n < 0) { return null } - var view = cm.display.view; - for (var i = 0; i < view.length; i++) { - n -= view[i].size; - if (n < 0) { return i } - } - } - - function updateSelection(cm) { - cm.display.input.showSelection(cm.display.input.prepareSelection()); - } - - function prepareSelection(cm, primary) { - var doc = cm.doc, result = {}; - var curFragment = result.cursors = document.createDocumentFragment(); - var selFragment = result.selection = document.createDocumentFragment(); - - for (var i = 0; i < doc.sel.ranges.length; i++) { - if (primary === false && i == doc.sel.primIndex) { continue } - var range$$1 = doc.sel.ranges[i]; - if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue } - var collapsed = range$$1.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - { drawSelectionCursor(cm, range$$1.head, curFragment); } - if (!collapsed) - { drawSelectionRange(cm, range$$1, selFragment); } - } - return result - } - - // Draws a cursor for the given range - function drawSelectionCursor(cm, head, output) { - var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); - - var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); - cursor.style.left = pos.left + "px"; - cursor.style.top = pos.top + "px"; - cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; - - if (pos.other) { - // Secondary cursor, shown when on a 'jump' in bi-directional text - var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); - otherCursor.style.display = ""; - otherCursor.style.left = pos.other.left + "px"; - otherCursor.style.top = pos.other.top + "px"; - otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; - } - } - - // Draws the given range as a highlighted selection - function drawSelectionRange(cm, range$$1, output) { - var display = cm.display, doc = cm.doc; - var fragment = document.createDocumentFragment(); - var padding = paddingH(cm.display), leftSide = padding.left; - var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; - - function add(left, top, width, bottom) { - if (top < 0) { top = 0; } - top = Math.round(top); - bottom = Math.round(bottom); - fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px"))); - } - - function drawForLine(line, fromArg, toArg) { - var lineObj = getLine(doc, line); - var lineLen = lineObj.text.length; - var start, end; - function coords(ch, bias) { - return charCoords(cm, Pos(line, ch), "div", lineObj, bias) - } - - iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) { - var leftPos = coords(from, "left"), rightPos, left, right; - if (from == to) { - rightPos = leftPos; - left = right = leftPos.left; - } else { - rightPos = coords(to - 1, "right"); - if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } - left = leftPos.left; - right = rightPos.right; - } - if (fromArg == null && from == 0) { left = leftSide; } - if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part - add(left, leftPos.top, null, leftPos.bottom); - left = leftSide; - if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); } - } - if (toArg == null && to == lineLen) { right = rightSide; } - if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) - { start = leftPos; } - if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) - { end = rightPos; } - if (left < leftSide + 1) { left = leftSide; } - add(left, rightPos.top, right - left, rightPos.bottom); - }); - return {start: start, end: end} - } - - var sFrom = range$$1.from(), sTo = range$$1.to(); - if (sFrom.line == sTo.line) { - drawForLine(sFrom.line, sFrom.ch, sTo.ch); - } else { - var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); - var singleVLine = visualLine(fromLine) == visualLine(toLine); - var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; - var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; - if (singleVLine) { - if (leftEnd.top < rightStart.top - 2) { - add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); - add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); - } else { - add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); - } - } - if (leftEnd.bottom < rightStart.top) - { add(leftSide, leftEnd.bottom, null, rightStart.top); } - } - - output.appendChild(fragment); - } - - // Cursor-blinking - function restartBlink(cm) { - if (!cm.state.focused) { return } - var display = cm.display; - clearInterval(display.blinker); - var on = true; - display.cursorDiv.style.visibility = ""; - if (cm.options.cursorBlinkRate > 0) - { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; }, - cm.options.cursorBlinkRate); } - else if (cm.options.cursorBlinkRate < 0) - { display.cursorDiv.style.visibility = "hidden"; } - } - - function ensureFocus(cm) { - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); } - } - - function delayBlurEvent(cm) { - cm.state.delayingBlurEvent = true; - setTimeout(function () { if (cm.state.delayingBlurEvent) { - cm.state.delayingBlurEvent = false; - onBlur(cm); - } }, 100); - } - - function onFocus(cm, e) { - if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; } - - if (cm.options.readOnly == "nocursor") { return } - if (!cm.state.focused) { - signal(cm, "focus", cm, e); - cm.state.focused = true; - addClass(cm.display.wrapper, "CodeMirror-focused"); - // This test prevents this from firing when a context - // menu is closed (since the input reset would kill the - // select-all detection hack) - if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { - cm.display.input.reset(); - if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730 - } - cm.display.input.receivedFocus(); - } - restartBlink(cm); - } - function onBlur(cm, e) { - if (cm.state.delayingBlurEvent) { return } - - if (cm.state.focused) { - signal(cm, "blur", cm, e); - cm.state.focused = false; - rmClass(cm.display.wrapper, "CodeMirror-focused"); - } - clearInterval(cm.display.blinker); - setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150); - } - - // Re-align line numbers and gutter marks to compensate for - // horizontal scrolling. - function alignHorizontally(cm) { - var display = cm.display, view = display.view; - if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } - var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; - var gutterW = display.gutters.offsetWidth, left = comp + "px"; - for (var i = 0; i < view.length; i++) { if (!view[i].hidden) { - if (cm.options.fixedGutter) { - if (view[i].gutter) - { view[i].gutter.style.left = left; } - if (view[i].gutterBackground) - { view[i].gutterBackground.style.left = left; } - } - var align = view[i].alignable; - if (align) { for (var j = 0; j < align.length; j++) - { align[j].style.left = left; } } - } } - if (cm.options.fixedGutter) - { display.gutters.style.left = (comp + gutterW) + "px"; } - } - - // Used to ensure that the line number gutter is still the right - // size for the current document size. Returns true when an update - // is needed. - function maybeUpdateLineNumberWidth(cm) { - if (!cm.options.lineNumbers) { return false } - var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; - if (last.length != display.lineNumChars) { - var test = display.measure.appendChild(elt("div", [elt("div", last)], - "CodeMirror-linenumber CodeMirror-gutter-elt")); - var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; - display.lineGutter.style.width = ""; - display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1; - display.lineNumWidth = display.lineNumInnerWidth + padding; - display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; - display.lineGutter.style.width = display.lineNumWidth + "px"; - updateGutterSpace(cm); - return true - } - return false - } - - // Read the actual heights of the rendered lines, and update their - // stored heights to match. - function updateHeightsInViewport(cm) { - var display = cm.display; - var prevBottom = display.lineDiv.offsetTop; - for (var i = 0; i < display.view.length; i++) { - var cur = display.view[i], height = (void 0); - if (cur.hidden) { continue } - if (ie && ie_version < 8) { - var bot = cur.node.offsetTop + cur.node.offsetHeight; - height = bot - prevBottom; - prevBottom = bot; - } else { - var box = cur.node.getBoundingClientRect(); - height = box.bottom - box.top; - } - var diff = cur.line.height - height; - if (height < 2) { height = textHeight(display); } - if (diff > .001 || diff < -.001) { - updateLineHeight(cur.line, height); - updateWidgetHeight(cur.line); - if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) - { updateWidgetHeight(cur.rest[j]); } } - } - } - } - - // Read and store the height of line widgets associated with the - // given line. - function updateWidgetHeight(line) { - if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) - { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } } - } - - // Compute the lines that are visible in a given viewport (defaults - // the the current scroll position). viewport may contain top, - // height, and ensure (see op.scrollToPos) properties. - function visibleLines(display, doc, viewport) { - var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; - top = Math.floor(top - paddingTop(display)); - var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; - - var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); - // Ensure is a {from: {line, ch}, to: {line, ch}} object, and - // forces those lines into the viewport (if possible). - if (viewport && viewport.ensure) { - var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; - if (ensureFrom < from) { - from = ensureFrom; - to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); - } else if (Math.min(ensureTo, doc.lastLine()) >= to) { - from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); - to = ensureTo; - } - } - return {from: from, to: Math.max(to, from + 1)} - } - - // Sync the scrollable area and scrollbars, ensure the viewport - // covers the visible area. - function setScrollTop(cm, val) { - if (Math.abs(cm.doc.scrollTop - val) < 2) { return } - cm.doc.scrollTop = val; - if (!gecko) { updateDisplaySimple(cm, {top: val}); } - if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; } - cm.display.scrollbars.setScrollTop(val); - if (gecko) { updateDisplaySimple(cm); } - startWorker(cm, 100); - } - // Sync scroller and scrollbar, ensure the gutter elements are - // aligned. - function setScrollLeft(cm, val, isScroller) { - if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return } - val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); - cm.doc.scrollLeft = val; - alignHorizontally(cm); - if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; } - cm.display.scrollbars.setScrollLeft(val); - } - - // Since the delta values reported on mouse wheel events are - // unstandardized between browsers and even browser versions, and - // generally horribly unpredictable, this code starts by measuring - // the scroll effect that the first few mouse wheel events have, - // and, from that, detects the way it can convert deltas to pixel - // offsets afterwards. - // - // The reason we want to know the amount a wheel event will scroll - // is that it gives us a chance to update the display before the - // actual scrolling happens, reducing flickering. - - var wheelSamples = 0; - var wheelPixelsPerUnit = null; - // Fill in a browser-detected starting value on browsers where we - // know one. These don't have to be accurate -- the result of them - // being wrong would just be a slight flicker on the first wheel - // scroll (if it is large enough). - if (ie) { wheelPixelsPerUnit = -.53; } - else if (gecko) { wheelPixelsPerUnit = 15; } - else if (chrome) { wheelPixelsPerUnit = -.7; } - else if (safari) { wheelPixelsPerUnit = -1/3; } - - function wheelEventDelta(e) { - var dx = e.wheelDeltaX, dy = e.wheelDeltaY; - if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; } - if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; } - else if (dy == null) { dy = e.wheelDelta; } - return {x: dx, y: dy} - } - function wheelEventPixels(e) { - var delta = wheelEventDelta(e); - delta.x *= wheelPixelsPerUnit; - delta.y *= wheelPixelsPerUnit; - return delta - } - - function onScrollWheel(cm, e) { - var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; - - var display = cm.display, scroll = display.scroller; - // Quit if there's nothing to scroll here - var canScrollX = scroll.scrollWidth > scroll.clientWidth; - var canScrollY = scroll.scrollHeight > scroll.clientHeight; - if (!(dx && canScrollX || dy && canScrollY)) { return } - - // Webkit browsers on OS X abort momentum scrolls when the target - // of the scroll event is removed from the scrollable element. - // This hack (see related code in patchDisplay) makes sure the - // element is kept around. - if (dy && mac && webkit) { - outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { - for (var i = 0; i < view.length; i++) { - if (view[i].node == cur) { - cm.display.currentWheelTarget = cur; - break outer - } - } - } - } - - // On some browsers, horizontal scrolling will cause redraws to - // happen before the gutter has been realigned, causing it to - // wriggle around in a most unseemly way. When we have an - // estimated pixels/delta value, we just handle horizontal - // scrolling entirely here. It'll be slightly off from native, but - // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { - if (dy && canScrollY) - { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); } - setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))); - // Only prevent default scrolling if vertical scrolling is - // actually possible. Otherwise, it causes vertical scroll - // jitter on OSX trackpads when deltaX is small and deltaY - // is large (issue #3579) - if (!dy || (dy && canScrollY)) - { e_preventDefault(e); } - display.wheelStartX = null; // Abort measurement, if in progress - return - } - - // 'Project' the visible viewport to cover the area that is being - // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; - var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; - if (pixels < 0) { top = Math.max(0, top + pixels - 50); } - else { bot = Math.min(cm.doc.height, bot + pixels + 50); } - updateDisplaySimple(cm, {top: top, bottom: bot}); - } - - if (wheelSamples < 20) { - if (display.wheelStartX == null) { - display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; - display.wheelDX = dx; display.wheelDY = dy; - setTimeout(function () { - if (display.wheelStartX == null) { return } - var movedX = scroll.scrollLeft - display.wheelStartX; - var movedY = scroll.scrollTop - display.wheelStartY; - var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || - (movedX && display.wheelDX && movedX / display.wheelDX); - display.wheelStartX = display.wheelStartY = null; - if (!sample) { return } - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); - ++wheelSamples; - }, 200); - } else { - display.wheelDX += dx; display.wheelDY += dy; - } - } - } - - // SCROLLBARS - - // Prepare DOM reads needed to update the scrollbars. Done in one - // shot to minimize update/measure roundtrips. - function measureForScrollbars(cm) { - var d = cm.display, gutterW = d.gutters.offsetWidth; - var docH = Math.round(cm.doc.height + paddingVert(cm.display)); - return { - clientHeight: d.scroller.clientHeight, - viewHeight: d.wrapper.clientHeight, - scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, - viewWidth: d.wrapper.clientWidth, - barLeft: cm.options.fixedGutter ? gutterW : 0, - docHeight: docH, - scrollHeight: docH + scrollGap(cm) + d.barHeight, - nativeBarWidth: d.nativeBarWidth, - gutterWidth: gutterW - } - } - - var NativeScrollbars = function(place, scroll, cm) { - this.cm = cm; - var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"); - var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); - place(vert); place(horiz); - - on(vert, "scroll", function () { - if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); } - }); - on(horiz, "scroll", function () { - if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); } - }); - - this.checkedZeroWidth = false; - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). - if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; } - }; - - NativeScrollbars.prototype.update = function (measure) { - var needsH = measure.scrollWidth > measure.clientWidth + 1; - var needsV = measure.scrollHeight > measure.clientHeight + 1; - var sWidth = measure.nativeBarWidth; - - if (needsV) { - this.vert.style.display = "block"; - this.vert.style.bottom = needsH ? sWidth + "px" : "0"; - var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); - // A bug in IE8 can cause this value to be negative, so guard it. - this.vert.firstChild.style.height = - Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; - } else { - this.vert.style.display = ""; - this.vert.firstChild.style.height = "0"; - } - - if (needsH) { - this.horiz.style.display = "block"; - this.horiz.style.right = needsV ? sWidth + "px" : "0"; - this.horiz.style.left = measure.barLeft + "px"; - var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0); - this.horiz.firstChild.style.width = - Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"; - } else { - this.horiz.style.display = ""; - this.horiz.firstChild.style.width = "0"; - } - - if (!this.checkedZeroWidth && measure.clientHeight > 0) { - if (sWidth == 0) { this.zeroWidthHack(); } - this.checkedZeroWidth = true; - } - - return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0} - }; - - NativeScrollbars.prototype.setScrollLeft = function (pos) { - if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; } - if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); } - }; - - NativeScrollbars.prototype.setScrollTop = function (pos) { - if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; } - if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); } - }; - - NativeScrollbars.prototype.zeroWidthHack = function () { - var w = mac && !mac_geMountainLion ? "12px" : "18px"; - this.horiz.style.height = this.vert.style.width = w; - this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"; - this.disableHoriz = new Delayed; - this.disableVert = new Delayed; - }; - - NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) { - bar.style.pointerEvents = "auto"; - function maybeDisable() { - // To find out whether the scrollbar is still visible, we - // check whether the element under the pixel in the bottom - // left corner of the scrollbar box is the scrollbar box - // itself (when the bar is still visible) or its filler child - // (when the bar is hidden). If it is still visible, we keep - // it enabled, if it's hidden, we disable pointer events. - var box = bar.getBoundingClientRect(); - var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1); - if (elt$$1 != bar) { bar.style.pointerEvents = "none"; } - else { delay.set(1000, maybeDisable); } - } - delay.set(1000, maybeDisable); - }; - - NativeScrollbars.prototype.clear = function () { - var parent = this.horiz.parentNode; - parent.removeChild(this.horiz); - parent.removeChild(this.vert); - }; - - var NullScrollbars = function () {}; - - NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} }; - NullScrollbars.prototype.setScrollLeft = function () {}; - NullScrollbars.prototype.setScrollTop = function () {}; - NullScrollbars.prototype.clear = function () {}; - - function updateScrollbars(cm, measure) { - if (!measure) { measure = measureForScrollbars(cm); } - var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight; - updateScrollbarsInner(cm, measure); - for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { - if (startWidth != cm.display.barWidth && cm.options.lineWrapping) - { updateHeightsInViewport(cm); } - updateScrollbarsInner(cm, measureForScrollbars(cm)); - startWidth = cm.display.barWidth; startHeight = cm.display.barHeight; - } - } - - // Re-synchronize the fake scrollbars with the actual size of the - // content. - function updateScrollbarsInner(cm, measure) { - var d = cm.display; - var sizes = d.scrollbars.update(measure); - - d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; - d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; - d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"; - - if (sizes.right && sizes.bottom) { - d.scrollbarFiller.style.display = "block"; - d.scrollbarFiller.style.height = sizes.bottom + "px"; - d.scrollbarFiller.style.width = sizes.right + "px"; - } else { d.scrollbarFiller.style.display = ""; } - if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { - d.gutterFiller.style.display = "block"; - d.gutterFiller.style.height = sizes.bottom + "px"; - d.gutterFiller.style.width = measure.gutterWidth + "px"; - } else { d.gutterFiller.style.display = ""; } - } - - var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}; - - function initScrollbars(cm) { - if (cm.display.scrollbars) { - cm.display.scrollbars.clear(); - if (cm.display.scrollbars.addClass) - { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); } - } - - cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) { - cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); - // Prevent clicks in the scrollbars from killing focus - on(node, "mousedown", function () { - if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); } - }); - node.setAttribute("cm-not-content", "true"); - }, function (pos, axis) { - if (axis == "horizontal") { setScrollLeft(cm, pos); } - else { setScrollTop(cm, pos); } - }, cm); - if (cm.display.scrollbars.addClass) - { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); } - } - - // SCROLLING THINGS INTO VIEW - - // If an editor sits on the top or bottom of the window, partially - // scrolled out of view, this ensures that the cursor is visible. - function maybeScrollWindow(cm, rect) { - if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } - - var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; - if (rect.top + box.top < 0) { doScroll = true; } - else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } - if (doScroll != null && !phantom) { - var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;")); - cm.display.lineSpace.appendChild(scrollNode); - scrollNode.scrollIntoView(doScroll); - cm.display.lineSpace.removeChild(scrollNode); - } - } - - // Scroll a given position into view (immediately), verifying that - // it actually became visible (as line heights are accurately - // measured, the position of something may 'drift' during drawing). - function scrollPosIntoView(cm, pos, end, margin) { - if (margin == null) { margin = 0; } - var rect; - for (var limit = 0; limit < 5; limit++) { - var changed = false; - var coords = cursorCoords(cm, pos); - var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); - rect = {left: Math.min(coords.left, endCoords.left), - top: Math.min(coords.top, endCoords.top) - margin, - right: Math.max(coords.left, endCoords.left), - bottom: Math.max(coords.bottom, endCoords.bottom) + margin}; - var scrollPos = calculateScrollPos(cm, rect); - var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; - if (scrollPos.scrollTop != null) { - setScrollTop(cm, scrollPos.scrollTop); - if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; } - } - if (scrollPos.scrollLeft != null) { - setScrollLeft(cm, scrollPos.scrollLeft); - if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; } - } - if (!changed) { break } - } - return rect - } - - // Scroll a given set of coordinates into view (immediately). - function scrollIntoView(cm, rect) { - var scrollPos = calculateScrollPos(cm, rect); - if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); } - if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); } - } - - // Calculate a new scroll position needed to scroll the given - // rectangle into view. Returns an object with scrollTop and - // scrollLeft properties. When these are undefined, the - // vertical/horizontal position does not need to be adjusted. - function calculateScrollPos(cm, rect) { - var display = cm.display, snapMargin = textHeight(cm.display); - if (rect.top < 0) { rect.top = 0; } - var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; - var screen = displayHeight(cm), result = {}; - if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; } - var docBottom = cm.doc.height + paddingVert(display); - var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin; - if (rect.top < screentop) { - result.scrollTop = atTop ? 0 : rect.top; - } else if (rect.bottom > screentop + screen) { - var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen); - if (newTop != screentop) { result.scrollTop = newTop; } - } - - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); - var tooWide = rect.right - rect.left > screenw; - if (tooWide) { rect.right = rect.left + screenw; } - if (rect.left < 10) - { result.scrollLeft = 0; } - else if (rect.left < screenleft) - { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); } - else if (rect.right > screenw + screenleft - 3) - { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; } - return result - } - - // Store a relative adjustment to the scroll position in the current - // operation (to be applied when the operation finishes). - function addToScrollPos(cm, left, top) { - if (left != null || top != null) { resolveScrollToPos(cm); } - if (left != null) - { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; } - if (top != null) - { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; } - } - - // Make sure that at the end of the operation the current cursor is - // shown. - function ensureCursorVisible(cm) { - resolveScrollToPos(cm); - var cur = cm.getCursor(), from = cur, to = cur; - if (!cm.options.lineWrapping) { - from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur; - to = Pos(cur.line, cur.ch + 1); - } - cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin}; - } - - // When an operation has its scrollToPos property set, and another - // scroll action is applied before the end of the operation, this - // 'simulates' scrolling that position into view in a cheap way, so - // that the effect of intermediate scroll commands is not ignored. - function resolveScrollToPos(cm) { - var range$$1 = cm.curOp.scrollToPos; - if (range$$1) { - cm.curOp.scrollToPos = null; - var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to); - var sPos = calculateScrollPos(cm, { - left: Math.min(from.left, to.left), - top: Math.min(from.top, to.top) - range$$1.margin, - right: Math.max(from.right, to.right), - bottom: Math.max(from.bottom, to.bottom) + range$$1.margin - }); - cm.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - } - - // Operations are used to wrap a series of changes to the editor - // state in such a way that each change won't have to update the - // cursor and display (which would be awkward, slow, and - // error-prone). Instead, display updates are batched and then all - // combined and executed at once. - - var nextOpId = 0; - // Start a new operation. - function startOperation(cm) { - cm.curOp = { - cm: cm, - viewChanged: false, // Flag that indicates that lines might need to be redrawn - startHeight: cm.doc.height, // Used to detect need to update scrollbar - forceUpdate: false, // Used to force a redraw - updateInput: null, // Whether to reset the input textarea - typing: false, // Whether this reset should be careful to leave existing text (for compositing) - changeObjs: null, // Accumulated changes, for firing change events - cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on - cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already - selectionChanged: false, // Whether the selection needs to be redrawn - updateMaxLine: false, // Set when the widest line needs to be determined anew - scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet - scrollToPos: null, // Used to scroll to a specific position - focus: false, - id: ++nextOpId // Unique ID - }; - pushOperation(cm.curOp); - } - - // Finish an operation, updating the display and signalling delayed events - function endOperation(cm) { - var op = cm.curOp; - finishOperation(op, function (group) { - for (var i = 0; i < group.ops.length; i++) - { group.ops[i].cm.curOp = null; } - endOperations(group); - }); - } - - // The DOM updates done when an operation finishes are batched so - // that the minimum number of relayouts are required. - function endOperations(group) { - var ops = group.ops; - for (var i = 0; i < ops.length; i++) // Read DOM - { endOperation_R1(ops[i]); } - for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) - { endOperation_W1(ops[i$1]); } - for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM - { endOperation_R2(ops[i$2]); } - for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) - { endOperation_W2(ops[i$3]); } - for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM - { endOperation_finish(ops[i$4]); } - } - - function endOperation_R1(op) { - var cm = op.cm, display = cm.display; - maybeClipScrollbars(cm); - if (op.updateMaxLine) { findMaxLine(cm); } - - op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || - op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || - op.scrollToPos.to.line >= display.viewTo) || - display.maxLineChanged && cm.options.lineWrapping; - op.update = op.mustUpdate && - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); - } - - function endOperation_W1(op) { - op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); - } - - function endOperation_R2(op) { - var cm = op.cm, display = cm.display; - if (op.updatedDisplay) { updateHeightsInViewport(cm); } - - op.barMeasure = measureForScrollbars(cm); - - // If the max line changed since it was last measured, measure it, - // and ensure the document's width matches it. - // updateDisplay_W2 will use these properties to do the actual resizing - if (display.maxLineChanged && !cm.options.lineWrapping) { - op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3; - cm.display.sizerWidth = op.adjustWidthTo; - op.barMeasure.scrollWidth = - Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth); - op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)); - } - - if (op.updatedDisplay || op.selectionChanged) - { op.preparedSelection = display.input.prepareSelection(op.focus); } - } - - function endOperation_W2(op) { - var cm = op.cm; - - if (op.adjustWidthTo != null) { - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; - if (op.maxScrollLeft < cm.doc.scrollLeft) - { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); } - cm.display.maxLineChanged = false; - } - - var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()); - if (op.preparedSelection) - { cm.display.input.showSelection(op.preparedSelection, takeFocus); } - if (op.updatedDisplay || op.startHeight != cm.doc.height) - { updateScrollbars(cm, op.barMeasure); } - if (op.updatedDisplay) - { setDocumentHeight(cm, op.barMeasure); } - - if (op.selectionChanged) { restartBlink(cm); } - - if (cm.state.focused && op.updateInput) - { cm.display.input.reset(op.typing); } - if (takeFocus) { ensureFocus(op.cm); } - } - - function endOperation_finish(op) { - var cm = op.cm, display = cm.display, doc = cm.doc; - - if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); } - - // Abort mouse wheel delta measurement, when scrolling explicitly - if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) - { display.wheelStartX = display.wheelStartY = null; } - - // Propagate the scroll position to the actual DOM scroller - if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { - doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)); - display.scrollbars.setScrollTop(doc.scrollTop); - display.scroller.scrollTop = doc.scrollTop; - } - if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { - doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft)); - display.scrollbars.setScrollLeft(doc.scrollLeft); - display.scroller.scrollLeft = doc.scrollLeft; - alignHorizontally(cm); - } - // If we need to scroll a specific position into view, do so. - if (op.scrollToPos) { - var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), - clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin); - maybeScrollWindow(cm, rect); - } - - // Fire events for markers that are hidden/unidden by editing or - // undoing - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; - if (hidden) { for (var i = 0; i < hidden.length; ++i) - { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } } - if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1) - { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } } - - if (display.wrapper.offsetHeight) - { doc.scrollTop = cm.display.scroller.scrollTop; } - - // Fire change events, and delayed event handlers - if (op.changeObjs) - { signal(cm, "changes", cm, op.changeObjs); } - if (op.update) - { op.update.finish(); } - } - - // Run the given function in an operation - function runInOp(cm, f) { - if (cm.curOp) { return f() } - startOperation(cm); - try { return f() } - finally { endOperation(cm); } - } - // Wraps a function in an operation. Returns the wrapped function. - function operation(cm, f) { - return function() { - if (cm.curOp) { return f.apply(cm, arguments) } - startOperation(cm); - try { return f.apply(cm, arguments) } - finally { endOperation(cm); } - } - } - // Used to add methods to editor and doc instances, wrapping them in - // operations. - function methodOp(f) { - return function() { - if (this.curOp) { return f.apply(this, arguments) } - startOperation(this); - try { return f.apply(this, arguments) } - finally { endOperation(this); } - } - } - function docMethodOp(f) { - return function() { - var cm = this.cm; - if (!cm || cm.curOp) { return f.apply(this, arguments) } - startOperation(cm); - try { return f.apply(this, arguments) } - finally { endOperation(cm); } - } - } - - // Updates the display.view data structure for a given change to the - // document. From and to are in pre-change coordinates. Lendiff is - // the amount of lines added or subtracted by the change. This is - // used for changes that span multiple lines, or change the way - // lines are divided into visual lines. regLineChange (below) - // registers single-line changes. - function regChange(cm, from, to, lendiff) { - if (from == null) { from = cm.doc.first; } - if (to == null) { to = cm.doc.first + cm.doc.size; } - if (!lendiff) { lendiff = 0; } - - var display = cm.display; - if (lendiff && to < display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers > from)) - { display.updateLineNumbers = from; } - - cm.curOp.viewChanged = true; - - if (from >= display.viewTo) { // Change after - if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) - { resetView(cm); } - } else if (to <= display.viewFrom) { // Change before - if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { - resetView(cm); - } else { - display.viewFrom += lendiff; - display.viewTo += lendiff; - } - } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap - resetView(cm); - } else if (from <= display.viewFrom) { // Top overlap - var cut = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cut) { - display.view = display.view.slice(cut.index); - display.viewFrom = cut.lineN; - display.viewTo += lendiff; - } else { - resetView(cm); - } - } else if (to >= display.viewTo) { // Bottom overlap - var cut$1 = viewCuttingPoint(cm, from, from, -1); - if (cut$1) { - display.view = display.view.slice(0, cut$1.index); - display.viewTo = cut$1.lineN; - } else { - resetView(cm); - } - } else { // Gap in the middle - var cutTop = viewCuttingPoint(cm, from, from, -1); - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cutTop && cutBot) { - display.view = display.view.slice(0, cutTop.index) - .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) - .concat(display.view.slice(cutBot.index)); - display.viewTo += lendiff; - } else { - resetView(cm); - } - } - - var ext = display.externalMeasured; - if (ext) { - if (to < ext.lineN) - { ext.lineN += lendiff; } - else if (from < ext.lineN + ext.size) - { display.externalMeasured = null; } - } - } - - // Register a change to a single line. Type must be one of "text", - // "gutter", "class", "widget" - function regLineChange(cm, line, type) { - cm.curOp.viewChanged = true; - var display = cm.display, ext = cm.display.externalMeasured; - if (ext && line >= ext.lineN && line < ext.lineN + ext.size) - { display.externalMeasured = null; } - - if (line < display.viewFrom || line >= display.viewTo) { return } - var lineView = display.view[findViewIndex(cm, line)]; - if (lineView.node == null) { return } - var arr = lineView.changes || (lineView.changes = []); - if (indexOf(arr, type) == -1) { arr.push(type); } - } - - // Clear the view. - function resetView(cm) { - cm.display.viewFrom = cm.display.viewTo = cm.doc.first; - cm.display.view = []; - cm.display.viewOffset = 0; - } - - function viewCuttingPoint(cm, oldN, newN, dir) { - var index = findViewIndex(cm, oldN), diff, view = cm.display.view; - if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) - { return {index: index, lineN: newN} } - var n = cm.display.viewFrom; - for (var i = 0; i < index; i++) - { n += view[i].size; } - if (n != oldN) { - if (dir > 0) { - if (index == view.length - 1) { return null } - diff = (n + view[index].size) - oldN; - index++; - } else { - diff = n - oldN; - } - oldN += diff; newN += diff; - } - while (visualLineNo(cm.doc, newN) != newN) { - if (index == (dir < 0 ? 0 : view.length - 1)) { return null } - newN += dir * view[index - (dir < 0 ? 1 : 0)].size; - index += dir; - } - return {index: index, lineN: newN} - } - - // Force the view to cover a given range, adding empty view element - // or clipping off existing ones as needed. - function adjustView(cm, from, to) { - var display = cm.display, view = display.view; - if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { - display.view = buildViewArray(cm, from, to); - display.viewFrom = from; - } else { - if (display.viewFrom > from) - { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); } - else if (display.viewFrom < from) - { display.view = display.view.slice(findViewIndex(cm, from)); } - display.viewFrom = from; - if (display.viewTo < to) - { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); } - else if (display.viewTo > to) - { display.view = display.view.slice(0, findViewIndex(cm, to)); } - } - display.viewTo = to; - } - - // Count the number of lines in the view whose DOM representation is - // out of date (or nonexistent). - function countDirtyView(cm) { - var view = cm.display.view, dirty = 0; - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; } - } - return dirty - } - - // HIGHLIGHT WORKER - - function startWorker(cm, time) { - if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) - { cm.state.highlight.set(time, bind(highlightWorker, cm)); } - } - - function highlightWorker(cm) { - var doc = cm.doc; - if (doc.frontier < doc.first) { doc.frontier = doc.first; } - if (doc.frontier >= cm.display.viewTo) { return } - var end = +new Date + cm.options.workTime; - var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); - var changedLines = []; - - doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) { - if (doc.frontier >= cm.display.viewFrom) { // Visible - var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength; - var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true); - line.styles = highlighted.styles; - var oldCls = line.styleClasses, newCls = highlighted.classes; - if (newCls) { line.styleClasses = newCls; } - else if (oldCls) { line.styleClasses = null; } - var ischange = !oldStyles || oldStyles.length != line.styles.length || - oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass); - for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; } - if (ischange) { changedLines.push(doc.frontier); } - line.stateAfter = tooLong ? state : copyState(doc.mode, state); - } else { - if (line.text.length <= cm.options.maxHighlightLength) - { processLine(cm, line.text, state); } - line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; - } - ++doc.frontier; - if (+new Date > end) { - startWorker(cm, cm.options.workDelay); - return true - } - }); - if (changedLines.length) { runInOp(cm, function () { - for (var i = 0; i < changedLines.length; i++) - { regLineChange(cm, changedLines[i], "text"); } - }); } - } - - // DISPLAY DRAWING - - var DisplayUpdate = function(cm, viewport, force) { - var display = cm.display; - - this.viewport = viewport; - // Store some values that we'll need later (but don't want to force a relayout for) - this.visible = visibleLines(display, cm.doc, viewport); - this.editorIsHidden = !display.wrapper.offsetWidth; - this.wrapperHeight = display.wrapper.clientHeight; - this.wrapperWidth = display.wrapper.clientWidth; - this.oldDisplayWidth = displayWidth(cm); - this.force = force; - this.dims = getDimensions(cm); - this.events = []; - }; - - DisplayUpdate.prototype.signal = function (emitter, type) { - if (hasHandler(emitter, type)) - { this.events.push(arguments); } - }; - DisplayUpdate.prototype.finish = function () { - var this$1 = this; - - for (var i = 0; i < this.events.length; i++) - { signal.apply(null, this$1.events[i]); } - }; - - function maybeClipScrollbars(cm) { - var display = cm.display; - if (!display.scrollbarsClipped && display.scroller.offsetWidth) { - display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth; - display.heightForcer.style.height = scrollGap(cm) + "px"; - display.sizer.style.marginBottom = -display.nativeBarWidth + "px"; - display.sizer.style.borderRightWidth = scrollGap(cm) + "px"; - display.scrollbarsClipped = true; - } - } - - // Does the actual updating of the line display. Bails out - // (returning false) when there is nothing to be done and forced is - // false. - function updateDisplayIfNeeded(cm, update) { - var display = cm.display, doc = cm.doc; - - if (update.editorIsHidden) { - resetView(cm); - return false - } - - // Bail out if the visible area is already rendered and nothing changed. - if (!update.force && - update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && - display.renderedView == display.view && countDirtyView(cm) == 0) - { return false } - - if (maybeUpdateLineNumberWidth(cm)) { - resetView(cm); - update.dims = getDimensions(cm); - } - - // Compute a suitable new viewport (from & to) - var end = doc.first + doc.size; - var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); - var to = Math.min(end, update.visible.to + cm.options.viewportMargin); - if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); } - if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); } - if (sawCollapsedSpans) { - from = visualLineNo(cm.doc, from); - to = visualLineEndNo(cm.doc, to); - } - - var different = from != display.viewFrom || to != display.viewTo || - display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; - adjustView(cm, from, to); - - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); - // Position the mover div to align with the current scroll position - cm.display.mover.style.top = display.viewOffset + "px"; - - var toUpdate = countDirtyView(cm); - if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) - { return false } - - // For big changes, we hide the enclosing element during the - // update, since that speeds up the operations on most browsers. - var focused = activeElt(); - if (toUpdate > 4) { display.lineDiv.style.display = "none"; } - patchDisplay(cm, display.updateLineNumbers, update.dims); - if (toUpdate > 4) { display.lineDiv.style.display = ""; } - display.renderedView = display.view; - // There might have been a widget with a focused element that got - // hidden or updated, if so re-focus it. - if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); } - - // Prevent selection and cursors from interfering with the scroll - // width and height. - removeChildren(display.cursorDiv); - removeChildren(display.selectionDiv); - display.gutters.style.height = display.sizer.style.minHeight = 0; - - if (different) { - display.lastWrapHeight = update.wrapperHeight; - display.lastWrapWidth = update.wrapperWidth; - startWorker(cm, 400); - } - - display.updateLineNumbers = null; - - return true - } - - function postUpdateDisplay(cm, update) { - var viewport = update.viewport; - - for (var first = true;; first = false) { - if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { - // Clip forced viewport to actual scrollable area. - if (viewport && viewport.top != null) - { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; } - // Updated line heights might result in the drawn area not - // actually covering the viewport. Keep looping until it does. - update.visible = visibleLines(cm.display, cm.doc, viewport); - if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) - { break } - } - if (!updateDisplayIfNeeded(cm, update)) { break } - updateHeightsInViewport(cm); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - updateScrollbars(cm, barMeasure); - setDocumentHeight(cm, barMeasure); - } - - update.signal(cm, "update", cm); - if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { - update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); - cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; - } - } - - function updateDisplaySimple(cm, viewport) { - var update = new DisplayUpdate(cm, viewport); - if (updateDisplayIfNeeded(cm, update)) { - updateHeightsInViewport(cm); - postUpdateDisplay(cm, update); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - updateScrollbars(cm, barMeasure); - setDocumentHeight(cm, barMeasure); - update.finish(); - } - } - - // Sync the actual display DOM structure with display.view, removing - // nodes for lines that are no longer in view, and creating the ones - // that are not there yet, and updating the ones that are out of - // date. - function patchDisplay(cm, updateNumbersFrom, dims) { - var display = cm.display, lineNumbers = cm.options.lineNumbers; - var container = display.lineDiv, cur = container.firstChild; - - function rm(node) { - var next = node.nextSibling; - // Works around a throw-scroll bug in OS X Webkit - if (webkit && mac && cm.display.currentWheelTarget == node) - { node.style.display = "none"; } - else - { node.parentNode.removeChild(node); } - return next - } - - var view = display.view, lineN = display.viewFrom; - // Loop over the elements in the view, syncing cur (the DOM nodes - // in display.lineDiv) with the view as we go. - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (lineView.hidden) { - } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet - var node = buildLineElement(cm, lineView, lineN, dims); - container.insertBefore(node, cur); - } else { // Already drawn - while (cur != lineView.node) { cur = rm(cur); } - var updateNumber = lineNumbers && updateNumbersFrom != null && - updateNumbersFrom <= lineN && lineView.lineNumber; - if (lineView.changes) { - if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; } - updateLineForChanges(cm, lineView, lineN, dims); - } - if (updateNumber) { - removeChildren(lineView.lineNumber); - lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); - } - cur = lineView.node.nextSibling; - } - lineN += lineView.size; - } - while (cur) { cur = rm(cur); } - } - - function updateGutterSpace(cm) { - var width = cm.display.gutters.offsetWidth; - cm.display.sizer.style.marginLeft = width + "px"; - } - - function setDocumentHeight(cm, measure) { - cm.display.sizer.style.minHeight = measure.docHeight + "px"; - cm.display.heightForcer.style.top = measure.docHeight + "px"; - cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"; - } - - // Rebuild the gutter elements, ensure the margin to the left of the - // code matches their width. - function updateGutters(cm) { - var gutters = cm.display.gutters, specs = cm.options.gutters; - removeChildren(gutters); - var i = 0; - for (; i < specs.length; ++i) { - var gutterClass = specs[i]; - var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); - if (gutterClass == "CodeMirror-linenumbers") { - cm.display.lineGutter = gElt; - gElt.style.width = (cm.display.lineNumWidth || 1) + "px"; - } - } - gutters.style.display = i ? "" : "none"; - updateGutterSpace(cm); - } - - // Make sure the gutters options contains the element - // "CodeMirror-linenumbers" when the lineNumbers option is true. - function setGuttersForLineNumbers(options) { - var found = indexOf(options.gutters, "CodeMirror-linenumbers"); - if (found == -1 && options.lineNumbers) { - options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]); - } else if (found > -1 && !options.lineNumbers) { - options.gutters = options.gutters.slice(0); - options.gutters.splice(found, 1); - } - } - - // Selection objects are immutable. A new one is created every time - // the selection changes. A selection is one or more non-overlapping - // (and non-touching) ranges, sorted, and an integer that indicates - // which one is the primary selection (the one that's scrolled into - // view, that getCursor returns, etc). - var Selection = function(ranges, primIndex) { - this.ranges = ranges; - this.primIndex = primIndex; - }; - - Selection.prototype.primary = function () { return this.ranges[this.primIndex] }; - - Selection.prototype.equals = function (other) { - var this$1 = this; - - if (other == this) { return true } - if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false } - for (var i = 0; i < this.ranges.length; i++) { - var here = this$1.ranges[i], there = other.ranges[i]; - if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false } - } - return true - }; - - Selection.prototype.deepCopy = function () { - var this$1 = this; - - var out = []; - for (var i = 0; i < this.ranges.length; i++) - { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); } - return new Selection(out, this.primIndex) - }; - - Selection.prototype.somethingSelected = function () { - var this$1 = this; - - for (var i = 0; i < this.ranges.length; i++) - { if (!this$1.ranges[i].empty()) { return true } } - return false - }; - - Selection.prototype.contains = function (pos, end) { - var this$1 = this; - - if (!end) { end = pos; } - for (var i = 0; i < this.ranges.length; i++) { - var range = this$1.ranges[i]; - if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) - { return i } - } - return -1 - }; - - var Range = function(anchor, head) { - this.anchor = anchor; this.head = head; - }; - - Range.prototype.from = function () { return minPos(this.anchor, this.head) }; - Range.prototype.to = function () { return maxPos(this.anchor, this.head) }; - Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }; - - // Take an unsorted, potentially overlapping set of ranges, and - // build a selection out of it. 'Consumes' ranges array (modifying - // it). - function normalizeSelection(ranges, primIndex) { - var prim = ranges[primIndex]; - ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }); - primIndex = indexOf(ranges, prim); - for (var i = 1; i < ranges.length; i++) { - var cur = ranges[i], prev = ranges[i - 1]; - if (cmp(prev.to(), cur.from()) >= 0) { - var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); - var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; - if (i <= primIndex) { --primIndex; } - ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); - } - } - return new Selection(ranges, primIndex) - } - - function simpleSelection(anchor, head) { - return new Selection([new Range(anchor, head || anchor)], 0) - } - - // Compute the position of the end of a change (its 'to' property - // refers to the pre-change end). - function changeEnd(change) { - if (!change.text) { return change.to } - return Pos(change.from.line + change.text.length - 1, - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) - } - - // Adjust a position to refer to the post-change position of the - // same text, or the end of the change if the change covers it. - function adjustForChange(pos, change) { - if (cmp(pos, change.from) < 0) { return pos } - if (cmp(pos, change.to) <= 0) { return changeEnd(change) } - - var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; - if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; } - return Pos(line, ch) - } - - function computeSelAfterChange(doc, change) { - var out = []; - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - out.push(new Range(adjustForChange(range.anchor, change), - adjustForChange(range.head, change))); - } - return normalizeSelection(out, doc.sel.primIndex) - } - - function offsetPos(pos, old, nw) { - if (pos.line == old.line) - { return Pos(nw.line, pos.ch - old.ch + nw.ch) } - else - { return Pos(nw.line + (pos.line - old.line), pos.ch) } - } - - // Used by replaceSelections to allow moving the selection to the - // start or around the replaced test. Hint may be "start" or "around". - function computeReplacedSel(doc, changes, hint) { - var out = []; - var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - var from = offsetPos(change.from, oldPrev, newPrev); - var to = offsetPos(changeEnd(change), oldPrev, newPrev); - oldPrev = change.to; - newPrev = to; - if (hint == "around") { - var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; - out[i] = new Range(inv ? to : from, inv ? from : to); - } else { - out[i] = new Range(from, from); - } - } - return new Selection(out, doc.sel.primIndex) - } - - // Used to get the editor into a consistent state again when options change. - - function loadMode(cm) { - cm.doc.mode = getMode(cm.options, cm.doc.modeOption); - resetModeState(cm); - } - - function resetModeState(cm) { - cm.doc.iter(function (line) { - if (line.stateAfter) { line.stateAfter = null; } - if (line.styles) { line.styles = null; } - }); - cm.doc.frontier = cm.doc.first; - startWorker(cm, 100); - cm.state.modeGen++; - if (cm.curOp) { regChange(cm); } - } - - // DOCUMENT DATA STRUCTURE - - // By default, updates that start and end at the beginning of a line - // are treated specially, in order to make the association of line - // widgets and marker elements with the text behave more intuitive. - function isWholeLineUpdate(doc, change) { - return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && - (!doc.cm || doc.cm.options.wholeLineUpdateBefore) - } - - // Perform a change on the document data structure. - function updateDoc(doc, change, markedSpans, estimateHeight$$1) { - function spansFor(n) {return markedSpans ? markedSpans[n] : null} - function update(line, text, spans) { - updateLine(line, text, spans, estimateHeight$$1); - signalLater(line, "change", line, change); - } - function linesFor(start, end) { - var result = []; - for (var i = start; i < end; ++i) - { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); } - return result - } - - var from = change.from, to = change.to, text = change.text; - var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); - var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; - - // Adjust the line structure - if (change.full) { - doc.insert(0, linesFor(0, text.length)); - doc.remove(text.length, doc.size - text.length); - } else if (isWholeLineUpdate(doc, change)) { - // This is a whole-line replace. Treated specially to make - // sure line objects move the way they are supposed to. - var added = linesFor(0, text.length - 1); - update(lastLine, lastLine.text, lastSpans); - if (nlines) { doc.remove(from.line, nlines); } - if (added.length) { doc.insert(from.line, added); } - } else if (firstLine == lastLine) { - if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); - } else { - var added$1 = linesFor(1, text.length - 1); - added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1)); - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - doc.insert(from.line + 1, added$1); - } - } else if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); - doc.remove(from.line + 1, nlines); - } else { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); - var added$2 = linesFor(1, text.length - 1); - if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); } - doc.insert(from.line + 1, added$2); - } - - signalLater(doc, "change", doc, change); - } - - // Call f for all linked documents. - function linkedDocs(doc, f, sharedHistOnly) { - function propagate(doc, skip, sharedHist) { - if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { - var rel = doc.linked[i]; - if (rel.doc == skip) { continue } - var shared = sharedHist && rel.sharedHist; - if (sharedHistOnly && !shared) { continue } - f(rel.doc, shared); - propagate(rel.doc, doc, shared); - } } - } - propagate(doc, null, true); - } - - // Attach a document to an editor. - function attachDoc(cm, doc) { - if (doc.cm) { throw new Error("This document is already in use.") } - cm.doc = doc; - doc.cm = cm; - estimateLineHeights(cm); - loadMode(cm); - setDirectionClass(cm); - if (!cm.options.lineWrapping) { findMaxLine(cm); } - cm.options.mode = doc.modeOption; - regChange(cm); - } - - function setDirectionClass(cm) { - (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl"); - } - - function directionChanged(cm) { - runInOp(cm, function () { - setDirectionClass(cm); - regChange(cm); - }); - } - - function History(startGen) { - // Arrays of change events and selections. Doing something adds an - // event to done and clears undo. Undoing moves events from done - // to undone, redoing moves them in the other direction. - this.done = []; this.undone = []; - this.undoDepth = Infinity; - // Used to track when changes can be merged into a single undo - // event - this.lastModTime = this.lastSelTime = 0; - this.lastOp = this.lastSelOp = null; - this.lastOrigin = this.lastSelOrigin = null; - // Used by the isClean() method - this.generation = this.maxGeneration = startGen || 1; - } - - // Create a history change event from an updateDoc-style change - // object. - function historyChangeFromChange(doc, change) { - var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; - attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); - linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true); - return histChange - } - - // Pop all selection events off the end of a history array. Stop at - // a change event. - function clearSelectionEvents(array) { - while (array.length) { - var last = lst(array); - if (last.ranges) { array.pop(); } - else { break } - } - } - - // Find the top change event in the history. Pop off selection - // events that are in the way. - function lastChangeEvent(hist, force) { - if (force) { - clearSelectionEvents(hist.done); - return lst(hist.done) - } else if (hist.done.length && !lst(hist.done).ranges) { - return lst(hist.done) - } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { - hist.done.pop(); - return lst(hist.done) - } - } - - // Register a change in the history. Merges changes that are within - // a single operation, or are close together with an origin that - // allows merging (starting with "+") into a single event. - function addChangeToHistory(doc, change, selAfter, opId) { - var hist = doc.history; - hist.undone.length = 0; - var time = +new Date, cur; - var last; - - if ((hist.lastOp == opId || - hist.lastOrigin == change.origin && change.origin && - ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || - change.origin.charAt(0) == "*")) && - (cur = lastChangeEvent(hist, hist.lastOp == opId))) { - // Merge this change into the last event - last = lst(cur.changes); - if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { - // Optimized case for simple insertion -- don't want to add - // new changesets for every character typed - last.to = changeEnd(change); - } else { - // Add new sub-event - cur.changes.push(historyChangeFromChange(doc, change)); - } - } else { - // Can not be merged, start a new event. - var before = lst(hist.done); - if (!before || !before.ranges) - { pushSelectionToHistory(doc.sel, hist.done); } - cur = {changes: [historyChangeFromChange(doc, change)], - generation: hist.generation}; - hist.done.push(cur); - while (hist.done.length > hist.undoDepth) { - hist.done.shift(); - if (!hist.done[0].ranges) { hist.done.shift(); } - } - } - hist.done.push(selAfter); - hist.generation = ++hist.maxGeneration; - hist.lastModTime = hist.lastSelTime = time; - hist.lastOp = hist.lastSelOp = opId; - hist.lastOrigin = hist.lastSelOrigin = change.origin; - - if (!last) { signal(doc, "historyAdded"); } - } - - function selectionEventCanBeMerged(doc, origin, prev, sel) { - var ch = origin.charAt(0); - return ch == "*" || - ch == "+" && - prev.ranges.length == sel.ranges.length && - prev.somethingSelected() == sel.somethingSelected() && - new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500) - } - - // Called whenever the selection changes, sets the new selection as - // the pending selection in the history, and pushes the old pending - // selection into the 'done' array when it was significantly - // different (in number of selected ranges, emptiness, or time). - function addSelectionToHistory(doc, sel, opId, options) { - var hist = doc.history, origin = options && options.origin; - - // A new event is started when the previous origin does not match - // the current, or the origins don't allow matching. Origins - // starting with * are always merged, those starting with + are - // merged when similar and close together in time. - if (opId == hist.lastSelOp || - (origin && hist.lastSelOrigin == origin && - (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || - selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) - { hist.done[hist.done.length - 1] = sel; } - else - { pushSelectionToHistory(sel, hist.done); } - - hist.lastSelTime = +new Date; - hist.lastSelOrigin = origin; - hist.lastSelOp = opId; - if (options && options.clearRedo !== false) - { clearSelectionEvents(hist.undone); } - } - - function pushSelectionToHistory(sel, dest) { - var top = lst(dest); - if (!(top && top.ranges && top.equals(sel))) - { dest.push(sel); } - } - - // Used to store marked span information in the history. - function attachLocalSpans(doc, change, from, to) { - var existing = change["spans_" + doc.id], n = 0; - doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { - if (line.markedSpans) - { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; } - ++n; - }); - } - - // When un/re-doing restores text containing marked spans, those - // that have been explicitly cleared should not be restored. - function removeClearedSpans(spans) { - if (!spans) { return null } - var out; - for (var i = 0; i < spans.length; ++i) { - if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } } - else if (out) { out.push(spans[i]); } - } - return !out ? spans : out.length ? out : null - } - - // Retrieve and filter the old marked spans stored in a change event. - function getOldSpans(doc, change) { - var found = change["spans_" + doc.id]; - if (!found) { return null } - var nw = []; - for (var i = 0; i < change.text.length; ++i) - { nw.push(removeClearedSpans(found[i])); } - return nw - } - - // Used for un/re-doing changes from the history. Combines the - // result of computing the existing spans with the set of spans that - // existed in the history (so that deleting around a span and then - // undoing brings back the span). - function mergeOldSpans(doc, change) { - var old = getOldSpans(doc, change); - var stretched = stretchSpansOverChange(doc, change); - if (!old) { return stretched } - if (!stretched) { return old } - - for (var i = 0; i < old.length; ++i) { - var oldCur = old[i], stretchCur = stretched[i]; - if (oldCur && stretchCur) { - spans: for (var j = 0; j < stretchCur.length; ++j) { - var span = stretchCur[j]; - for (var k = 0; k < oldCur.length; ++k) - { if (oldCur[k].marker == span.marker) { continue spans } } - oldCur.push(span); - } - } else if (stretchCur) { - old[i] = stretchCur; - } - } - return old - } - - // Used both to provide a JSON-safe object in .getHistory, and, when - // detaching a document, to split the history in two - function copyHistoryArray(events, newGroup, instantiateSel) { - var copy = []; - for (var i = 0; i < events.length; ++i) { - var event = events[i]; - if (event.ranges) { - copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); - continue - } - var changes = event.changes, newChanges = []; - copy.push({changes: newChanges}); - for (var j = 0; j < changes.length; ++j) { - var change = changes[j], m = (void 0); - newChanges.push({from: change.from, to: change.to, text: change.text}); - if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) { - if (indexOf(newGroup, Number(m[1])) > -1) { - lst(newChanges)[prop] = change[prop]; - delete change[prop]; - } - } } } - } - } - return copy - } - - // The 'scroll' parameter given to many of these indicated whether - // the new cursor position should be scrolled into view after - // modifying the selection. - - // If shift is held or the extend flag is set, extends a range to - // include a given position (and optionally a second position). - // Otherwise, simply returns the range between the given positions. - // Used for cursor motion and such. - function extendRange(doc, range, head, other) { - if (doc.cm && doc.cm.display.shift || doc.extend) { - var anchor = range.anchor; - if (other) { - var posBefore = cmp(head, anchor) < 0; - if (posBefore != (cmp(other, anchor) < 0)) { - anchor = head; - head = other; - } else if (posBefore != (cmp(head, other) < 0)) { - head = other; - } - } - return new Range(anchor, head) - } else { - return new Range(other || head, head) - } - } - - // Extend the primary selection range, discard the rest. - function extendSelection(doc, head, other, options) { - setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options); - } - - // Extend all selections (pos is an array of selections with length - // equal the number of selections) - function extendSelections(doc, heads, options) { - var out = []; - for (var i = 0; i < doc.sel.ranges.length; i++) - { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); } - var newSel = normalizeSelection(out, doc.sel.primIndex); - setSelection(doc, newSel, options); - } - - // Updates a single range in the selection. - function replaceOneSelection(doc, i, range, options) { - var ranges = doc.sel.ranges.slice(0); - ranges[i] = range; - setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options); - } - - // Reset the selection to a single range. - function setSimpleSelection(doc, anchor, head, options) { - setSelection(doc, simpleSelection(anchor, head), options); - } - - // Give beforeSelectionChange handlers a change to influence a - // selection update. - function filterSelectionChange(doc, sel, options) { - var obj = { - ranges: sel.ranges, - update: function(ranges) { - var this$1 = this; - - this.ranges = []; - for (var i = 0; i < ranges.length; i++) - { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), - clipPos(doc, ranges[i].head)); } - }, - origin: options && options.origin - }; - signal(doc, "beforeSelectionChange", doc, obj); - if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); } - if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) } - else { return sel } - } - - function setSelectionReplaceHistory(doc, sel, options) { - var done = doc.history.done, last = lst(done); - if (last && last.ranges) { - done[done.length - 1] = sel; - setSelectionNoUndo(doc, sel, options); - } else { - setSelection(doc, sel, options); - } - } - - // Set a new selection. - function setSelection(doc, sel, options) { - setSelectionNoUndo(doc, sel, options); - addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); - } - - function setSelectionNoUndo(doc, sel, options) { - if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) - { sel = filterSelectionChange(doc, sel, options); } - - var bias = options && options.bias || - (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); - setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); - - if (!(options && options.scroll === false) && doc.cm) - { ensureCursorVisible(doc.cm); } - } - - function setSelectionInner(doc, sel) { - if (sel.equals(doc.sel)) { return } - - doc.sel = sel; - - if (doc.cm) { - doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true; - signalCursorActivity(doc.cm); - } - signalLater(doc, "cursorActivity", doc); - } - - // Verify that the selection does not partially select any atomic - // marked ranges. - function reCheckSelection(doc) { - setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll); - } - - // Return a selection that does not partially select any atomic - // ranges. - function skipAtomicInSelection(doc, sel, bias, mayClear) { - var out; - for (var i = 0; i < sel.ranges.length; i++) { - var range = sel.ranges[i]; - var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; - var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); - var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); - if (out || newAnchor != range.anchor || newHead != range.head) { - if (!out) { out = sel.ranges.slice(0, i); } - out[i] = new Range(newAnchor, newHead); - } - } - return out ? normalizeSelection(out, sel.primIndex) : sel - } - - function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { - var line = getLine(doc, pos.line); - if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { - var sp = line.markedSpans[i], m = sp.marker; - if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && - (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) { - if (mayClear) { - signal(m, "beforeCursorEnter"); - if (m.explicitlyCleared) { - if (!line.markedSpans) { break } - else {--i; continue} - } - } - if (!m.atomic) { continue } - - if (oldPos) { - var near = m.find(dir < 0 ? 1 : -1), diff = (void 0); - if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) - { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); } - if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) - { return skipAtomicInner(doc, near, pos, dir, mayClear) } - } - - var far = m.find(dir < 0 ? -1 : 1); - if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) - { far = movePos(doc, far, dir, far.line == pos.line ? line : null); } - return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null - } - } } - return pos - } - - // Ensure a given position is not inside an atomic range. - function skipAtomic(doc, pos, oldPos, bias, mayClear) { - var dir = bias || 1; - var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || - (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || - skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || - (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)); - if (!found) { - doc.cantEdit = true; - return Pos(doc.first, 0) - } - return found - } - - function movePos(doc, pos, dir, line) { - if (dir < 0 && pos.ch == 0) { - if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) } - else { return null } - } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) { - if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) } - else { return null } - } else { - return new Pos(pos.line, pos.ch + dir) - } - } - - function selectAll(cm) { - cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll); - } - - // UPDATING - - // Allow "beforeChange" event handlers to influence a change - function filterChange(doc, change, update) { - var obj = { - canceled: false, - from: change.from, - to: change.to, - text: change.text, - origin: change.origin, - cancel: function () { return obj.canceled = true; } - }; - if (update) { obj.update = function (from, to, text, origin) { - if (from) { obj.from = clipPos(doc, from); } - if (to) { obj.to = clipPos(doc, to); } - if (text) { obj.text = text; } - if (origin !== undefined) { obj.origin = origin; } - }; } - signal(doc, "beforeChange", doc, obj); - if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); } - - if (obj.canceled) { return null } - return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} - } - - // Apply a change to a document, and add it to the document's - // history, and propagating it to all linked documents. - function makeChange(doc, change, ignoreReadOnly) { - if (doc.cm) { - if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } - if (doc.cm.state.suppressEdits) { return } - } - - if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { - change = filterChange(doc, change, true); - if (!change) { return } - } - - // Possibly split or suppress the update based on the presence - // of read-only spans in its range. - var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); - if (split) { - for (var i = split.length - 1; i >= 0; --i) - { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); } - } else { - makeChangeInner(doc, change); - } - } - - function makeChangeInner(doc, change) { - if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return } - var selAfter = computeSelAfterChange(doc, change); - addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); - - makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); - var rebased = []; - - linkedDocs(doc, function (doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); - }); - } - - // Revert a change stored in a document's history. - function makeChangeFromHistory(doc, type, allowSelectionOnly) { - if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return } - - var hist = doc.history, event, selAfter = doc.sel; - var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; - - // Verify that there is a useable event (so that ctrl-z won't - // needlessly clear selection events) - var i = 0; - for (; i < source.length; i++) { - event = source[i]; - if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) - { break } - } - if (i == source.length) { return } - hist.lastOrigin = hist.lastSelOrigin = null; - - for (;;) { - event = source.pop(); - if (event.ranges) { - pushSelectionToHistory(event, dest); - if (allowSelectionOnly && !event.equals(doc.sel)) { - setSelection(doc, event, {clearRedo: false}); - return - } - selAfter = event; - } - else { break } - } - - // Build up a reverse change object to add to the opposite history - // stack (redo when undoing, and vice versa). - var antiChanges = []; - pushSelectionToHistory(selAfter, dest); - dest.push({changes: antiChanges, generation: hist.generation}); - hist.generation = event.generation || ++hist.maxGeneration; - - var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); - - var loop = function ( i ) { - var change = event.changes[i]; - change.origin = type; - if (filter && !filterChange(doc, change, false)) { - source.length = 0; - return {} - } - - antiChanges.push(historyChangeFromChange(doc, change)); - - var after = i ? computeSelAfterChange(doc, change) : lst(source); - makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); - if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); } - var rebased = []; - - // Propagate to the linked documents - linkedDocs(doc, function (doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); - }); - }; - - for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { - var returned = loop( i$1 ); - - if ( returned ) return returned.v; - } - } - - // Sub-views need their line numbers shifted when text is added - // above or below them in the parent document. - function shiftDoc(doc, distance) { - if (distance == 0) { return } - doc.first += distance; - doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( - Pos(range.anchor.line + distance, range.anchor.ch), - Pos(range.head.line + distance, range.head.ch) - ); }), doc.sel.primIndex); - if (doc.cm) { - regChange(doc.cm, doc.first, doc.first - distance, distance); - for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) - { regLineChange(doc.cm, l, "gutter"); } - } - } - - // More lower-level change function, handling only a single document - // (not linked ones). - function makeChangeSingleDoc(doc, change, selAfter, spans) { - if (doc.cm && !doc.cm.curOp) - { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } - - if (change.to.line < doc.first) { - shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); - return - } - if (change.from.line > doc.lastLine()) { return } - - // Clip the change to the size of this doc - if (change.from.line < doc.first) { - var shift = change.text.length - 1 - (doc.first - change.from.line); - shiftDoc(doc, shift); - change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), - text: [lst(change.text)], origin: change.origin}; - } - var last = doc.lastLine(); - if (change.to.line > last) { - change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), - text: [change.text[0]], origin: change.origin}; - } - - change.removed = getBetween(doc, change.from, change.to); - - if (!selAfter) { selAfter = computeSelAfterChange(doc, change); } - if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); } - else { updateDoc(doc, change, spans); } - setSelectionNoUndo(doc, selAfter, sel_dontScroll); - } - - // Handle the interaction of a change to a document with the editor - // that this document is part of. - function makeChangeSingleDocInEditor(cm, change, spans) { - var doc = cm.doc, display = cm.display, from = change.from, to = change.to; - - var recomputeMaxLength = false, checkWidthStart = from.line; - if (!cm.options.lineWrapping) { - checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); - doc.iter(checkWidthStart, to.line + 1, function (line) { - if (line == display.maxLine) { - recomputeMaxLength = true; - return true - } - }); - } - - if (doc.sel.contains(change.from, change.to) > -1) - { signalCursorActivity(cm); } - - updateDoc(doc, change, spans, estimateHeight(cm)); - - if (!cm.options.lineWrapping) { - doc.iter(checkWidthStart, from.line + change.text.length, function (line) { - var len = lineLength(line); - if (len > display.maxLineLength) { - display.maxLine = line; - display.maxLineLength = len; - display.maxLineChanged = true; - recomputeMaxLength = false; - } - }); - if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } - } - - // Adjust frontier, schedule worker - doc.frontier = Math.min(doc.frontier, from.line); - startWorker(cm, 400); - - var lendiff = change.text.length - (to.line - from.line) - 1; - // Remember that these lines changed, for updating the display - if (change.full) - { regChange(cm); } - else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) - { regLineChange(cm, from.line, "text"); } - else - { regChange(cm, from.line, to.line + 1, lendiff); } - - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); - if (changeHandler || changesHandler) { - var obj = { - from: from, to: to, - text: change.text, - removed: change.removed, - origin: change.origin - }; - if (changeHandler) { signalLater(cm, "change", cm, obj); } - if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); } - } - cm.display.selForContextMenu = null; - } - - function replaceRange(doc, code, from, to, origin) { - if (!to) { to = from; } - if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; } - if (typeof code == "string") { code = doc.splitLines(code); } - makeChange(doc, {from: from, to: to, text: code, origin: origin}); - } - - // Rebasing/resetting history to deal with externally-sourced changes - - function rebaseHistSelSingle(pos, from, to, diff) { - if (to < pos.line) { - pos.line += diff; - } else if (from < pos.line) { - pos.line = from; - pos.ch = 0; - } - } - - // Tries to rebase an array of history events given a change in the - // document. If the change touches the same lines as the event, the - // event, and everything 'behind' it, is discarded. If the change is - // before the event, the event's positions are updated. Uses a - // copy-on-write scheme for the positions, to avoid having to - // reallocate them all on every rebase, but also avoid problems with - // shared position objects being unsafely updated. - function rebaseHistArray(array, from, to, diff) { - for (var i = 0; i < array.length; ++i) { - var sub = array[i], ok = true; - if (sub.ranges) { - if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } - for (var j = 0; j < sub.ranges.length; j++) { - rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); - rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); - } - continue - } - for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { - var cur = sub.changes[j$1]; - if (to < cur.from.line) { - cur.from = Pos(cur.from.line + diff, cur.from.ch); - cur.to = Pos(cur.to.line + diff, cur.to.ch); - } else if (from <= cur.to.line) { - ok = false; - break - } - } - if (!ok) { - array.splice(0, i + 1); - i = 0; - } - } - } - - function rebaseHist(hist, change) { - var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; - rebaseHistArray(hist.done, from, to, diff); - rebaseHistArray(hist.undone, from, to, diff); - } - - // Utility for applying a change to a line by handle or number, - // returning the number and optionally registering the line as - // changed. - function changeLine(doc, handle, changeType, op) { - var no = handle, line = handle; - if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); } - else { no = lineNo(handle); } - if (no == null) { return null } - if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); } - return line - } - - // The document is represented as a BTree consisting of leaves, with - // chunk of lines in them, and branches, with up to ten leaves or - // other branch nodes below them. The top node is always a branch - // node, and is the document object itself (meaning it has - // additional methods and properties). - // - // All nodes have parent links. The tree is used both to go from - // line numbers to line objects, and to go from objects to numbers. - // It also indexes by height, and is used to convert between height - // and line object, and to find the total height of the document. - // - // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html - - var LeafChunk = function(lines) { - var this$1 = this; - - this.lines = lines; - this.parent = null; - var height = 0; - for (var i = 0; i < lines.length; ++i) { - lines[i].parent = this$1; - height += lines[i].height; - } - this.height = height; - }; - - LeafChunk.prototype.chunkSize = function () { return this.lines.length }; - - // Remove the n lines at offset 'at'. - LeafChunk.prototype.removeInner = function (at, n) { - var this$1 = this; - - for (var i = at, e = at + n; i < e; ++i) { - var line = this$1.lines[i]; - this$1.height -= line.height; - cleanUpLine(line); - signalLater(line, "delete"); - } - this.lines.splice(at, n); - }; - - // Helper used to collapse a small branch into a single leaf. - LeafChunk.prototype.collapse = function (lines) { - lines.push.apply(lines, this.lines); - }; - - // Insert the given array of lines at offset 'at', count them as - // having the given height. - LeafChunk.prototype.insertInner = function (at, lines, height) { - var this$1 = this; - - this.height += height; - this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); - for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; } - }; - - // Used to iterate over a part of the tree. - LeafChunk.prototype.iterN = function (at, n, op) { - var this$1 = this; - - for (var e = at + n; at < e; ++at) - { if (op(this$1.lines[at])) { return true } } - }; - - var BranchChunk = function(children) { - var this$1 = this; - - this.children = children; - var size = 0, height = 0; - for (var i = 0; i < children.length; ++i) { - var ch = children[i]; - size += ch.chunkSize(); height += ch.height; - ch.parent = this$1; - } - this.size = size; - this.height = height; - this.parent = null; - }; - - BranchChunk.prototype.chunkSize = function () { return this.size }; - - BranchChunk.prototype.removeInner = function (at, n) { - var this$1 = this; - - this.size -= n; - for (var i = 0; i < this.children.length; ++i) { - var child = this$1.children[i], sz = child.chunkSize(); - if (at < sz) { - var rm = Math.min(n, sz - at), oldHeight = child.height; - child.removeInner(at, rm); - this$1.height -= oldHeight - child.height; - if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; } - if ((n -= rm) == 0) { break } - at = 0; - } else { at -= sz; } - } - // If the result is smaller than 25 lines, ensure that it is a - // single leaf node. - if (this.size - n < 25 && - (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { - var lines = []; - this.collapse(lines); - this.children = [new LeafChunk(lines)]; - this.children[0].parent = this; - } - }; - - BranchChunk.prototype.collapse = function (lines) { - var this$1 = this; - - for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); } - }; - - BranchChunk.prototype.insertInner = function (at, lines, height) { - var this$1 = this; - - this.size += lines.length; - this.height += height; - for (var i = 0; i < this.children.length; ++i) { - var child = this$1.children[i], sz = child.chunkSize(); - if (at <= sz) { - child.insertInner(at, lines, height); - if (child.lines && child.lines.length > 50) { - // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced. - // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest. - var remaining = child.lines.length % 25 + 25; - for (var pos = remaining; pos < child.lines.length;) { - var leaf = new LeafChunk(child.lines.slice(pos, pos += 25)); - child.height -= leaf.height; - this$1.children.splice(++i, 0, leaf); - leaf.parent = this$1; - } - child.lines = child.lines.slice(0, remaining); - this$1.maybeSpill(); - } - break - } - at -= sz; - } - }; - - // When a node has grown, check whether it should be split. - BranchChunk.prototype.maybeSpill = function () { - if (this.children.length <= 10) { return } - var me = this; - do { - var spilled = me.children.splice(me.children.length - 5, 5); - var sibling = new BranchChunk(spilled); - if (!me.parent) { // Become the parent node - var copy = new BranchChunk(me.children); - copy.parent = me; - me.children = [copy, sibling]; - me = copy; - } else { - me.size -= sibling.size; - me.height -= sibling.height; - var myIndex = indexOf(me.parent.children, me); - me.parent.children.splice(myIndex + 1, 0, sibling); - } - sibling.parent = me.parent; - } while (me.children.length > 10) - me.parent.maybeSpill(); - }; - - BranchChunk.prototype.iterN = function (at, n, op) { - var this$1 = this; - - for (var i = 0; i < this.children.length; ++i) { - var child = this$1.children[i], sz = child.chunkSize(); - if (at < sz) { - var used = Math.min(n, sz - at); - if (child.iterN(at, used, op)) { return true } - if ((n -= used) == 0) { break } - at = 0; - } else { at -= sz; } - } - }; - - // Line widgets are block elements displayed above or below a line. - - var LineWidget = function(doc, node, options) { - var this$1 = this; - - if (options) { for (var opt in options) { if (options.hasOwnProperty(opt)) - { this$1[opt] = options[opt]; } } } - this.doc = doc; - this.node = node; - }; - - LineWidget.prototype.clear = function () { - var this$1 = this; - - var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line); - if (no == null || !ws) { return } - for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } } - if (!ws.length) { line.widgets = null; } - var height = widgetHeight(this); - updateLineHeight(line, Math.max(0, line.height - height)); - if (cm) { - runInOp(cm, function () { - adjustScrollWhenAboveVisible(cm, line, -height); - regLineChange(cm, no, "widget"); - }); - signalLater(cm, "lineWidgetCleared", cm, this, no); - } - }; - - LineWidget.prototype.changed = function () { - var this$1 = this; - - var oldH = this.height, cm = this.doc.cm, line = this.line; - this.height = null; - var diff = widgetHeight(this) - oldH; - if (!diff) { return } - updateLineHeight(line, line.height + diff); - if (cm) { - runInOp(cm, function () { - cm.curOp.forceUpdate = true; - adjustScrollWhenAboveVisible(cm, line, diff); - signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line)); - }); - } - }; - eventMixin(LineWidget); - - function adjustScrollWhenAboveVisible(cm, line, diff) { - if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) - { addToScrollPos(cm, null, diff); } - } - - function addLineWidget(doc, handle, node, options) { - var widget = new LineWidget(doc, node, options); - var cm = doc.cm; - if (cm && widget.noHScroll) { cm.display.alignWidgets = true; } - changeLine(doc, handle, "widget", function (line) { - var widgets = line.widgets || (line.widgets = []); - if (widget.insertAt == null) { widgets.push(widget); } - else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); } - widget.line = line; - if (cm && !lineIsHidden(doc, line)) { - var aboveVisible = heightAtLine(line) < doc.scrollTop; - updateLineHeight(line, line.height + widgetHeight(widget)); - if (aboveVisible) { addToScrollPos(cm, null, widget.height); } - cm.curOp.forceUpdate = true; - } - return true - }); - signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); - return widget - } - - // TEXTMARKERS - - // Created with markText and setBookmark methods. A TextMarker is a - // handle that can be used to clear or find a marked position in the - // document. Line objects hold arrays (markedSpans) containing - // {from, to, marker} object pointing to such marker objects, and - // indicating that such a marker is present on that line. Multiple - // lines may point to the same marker when it spans across lines. - // The spans will have null for their from/to properties when the - // marker continues beyond the start/end of the line. Markers have - // links back to the lines they currently touch. - - // Collapsed markers have unique ids, in order to be able to order - // them, which is needed for uniquely determining an outer marker - // when they overlap (they may nest, but not partially overlap). - var nextMarkerId = 0; - - var TextMarker = function(doc, type) { - this.lines = []; - this.type = type; - this.doc = doc; - this.id = ++nextMarkerId; - }; - - // Clear the marker. - TextMarker.prototype.clear = function () { - var this$1 = this; - - if (this.explicitlyCleared) { return } - var cm = this.doc.cm, withOp = cm && !cm.curOp; - if (withOp) { startOperation(cm); } - if (hasHandler(this, "clear")) { - var found = this.find(); - if (found) { signalLater(this, "clear", found.from, found.to); } - } - var min = null, max = null; - for (var i = 0; i < this.lines.length; ++i) { - var line = this$1.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this$1); - if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); } - else if (cm) { - if (span.to != null) { max = lineNo(line); } - if (span.from != null) { min = lineNo(line); } - } - line.markedSpans = removeMarkedSpan(line.markedSpans, span); - if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm) - { updateLineHeight(line, textHeight(cm.display)); } - } - if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) { - var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual); - if (len > cm.display.maxLineLength) { - cm.display.maxLine = visual; - cm.display.maxLineLength = len; - cm.display.maxLineChanged = true; - } - } } - - if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); } - this.lines.length = 0; - this.explicitlyCleared = true; - if (this.atomic && this.doc.cantEdit) { - this.doc.cantEdit = false; - if (cm) { reCheckSelection(cm.doc); } - } - if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); } - if (withOp) { endOperation(cm); } - if (this.parent) { this.parent.clear(); } - }; - - // Find the position of the marker in the document. Returns a {from, - // to} object by default. Side can be passed to get a specific side - // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the - // Pos objects returned contain a line object, rather than a line - // number (used to prevent looking up the same line twice). - TextMarker.prototype.find = function (side, lineObj) { - var this$1 = this; - - if (side == null && this.type == "bookmark") { side = 1; } - var from, to; - for (var i = 0; i < this.lines.length; ++i) { - var line = this$1.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this$1); - if (span.from != null) { - from = Pos(lineObj ? line : lineNo(line), span.from); - if (side == -1) { return from } - } - if (span.to != null) { - to = Pos(lineObj ? line : lineNo(line), span.to); - if (side == 1) { return to } - } - } - return from && {from: from, to: to} - }; - - // Signals that the marker's widget changed, and surrounding layout - // should be recomputed. - TextMarker.prototype.changed = function () { - var this$1 = this; - - var pos = this.find(-1, true), widget = this, cm = this.doc.cm; - if (!pos || !cm) { return } - runInOp(cm, function () { - var line = pos.line, lineN = lineNo(pos.line); - var view = findViewForLine(cm, lineN); - if (view) { - clearLineMeasurementCacheFor(view); - cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; - } - cm.curOp.updateMaxLine = true; - if (!lineIsHidden(widget.doc, line) && widget.height != null) { - var oldHeight = widget.height; - widget.height = null; - var dHeight = widgetHeight(widget) - oldHeight; - if (dHeight) - { updateLineHeight(line, line.height + dHeight); } - } - signalLater(cm, "markerChanged", cm, this$1); - }); - }; - - TextMarker.prototype.attachLine = function (line) { - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; - if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) - { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); } - } - this.lines.push(line); - }; - - TextMarker.prototype.detachLine = function (line) { - this.lines.splice(indexOf(this.lines, line), 1); - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); - } - }; - eventMixin(TextMarker); - - // Create a marker, wire it up to the right lines, and - function markText(doc, from, to, options, type) { - // Shared markers (across linked documents) are handled separately - // (markTextShared will call out to this again, once per - // document). - if (options && options.shared) { return markTextShared(doc, from, to, options, type) } - // Ensure we are in an operation. - if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } - - var marker = new TextMarker(doc, type), diff = cmp(from, to); - if (options) { copyObj(options, marker, false); } - // Don't connect empty markers unless clearWhenEmpty is false - if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) - { return marker } - if (marker.replacedWith) { - // Showing up as a widget implies collapsed (widget replaces text) - marker.collapsed = true; - marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget"); - if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); } - if (options.insertLeft) { marker.widgetNode.insertLeft = true; } - } - if (marker.collapsed) { - if (conflictingCollapsedRange(doc, from.line, from, to, marker) || - from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) - { throw new Error("Inserting collapsed marker partially overlapping an existing one") } - seeCollapsedSpans(); - } - - if (marker.addToHistory) - { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); } - - var curLine = from.line, cm = doc.cm, updateMaxLine; - doc.iter(curLine, to.line + 1, function (line) { - if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) - { updateMaxLine = true; } - if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } - addMarkedSpan(line, new MarkedSpan(marker, - curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null)); - ++curLine; - }); - // lineIsHidden depends on the presence of the spans, so needs a second pass - if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { - if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); } - }); } - - if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); } - - if (marker.readOnly) { - seeReadOnlySpans(); - if (doc.history.done.length || doc.history.undone.length) - { doc.clearHistory(); } - } - if (marker.collapsed) { - marker.id = ++nextMarkerId; - marker.atomic = true; - } - if (cm) { - // Sync editor state - if (updateMaxLine) { cm.curOp.updateMaxLine = true; } - if (marker.collapsed) - { regChange(cm, from.line, to.line + 1); } - else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) - { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } } - if (marker.atomic) { reCheckSelection(cm.doc); } - signalLater(cm, "markerAdded", cm, marker); - } - return marker - } - - // SHARED TEXTMARKERS - - // A shared marker spans multiple linked documents. It is - // implemented as a meta-marker-object controlling multiple normal - // markers. - var SharedTextMarker = function(markers, primary) { - var this$1 = this; - - this.markers = markers; - this.primary = primary; - for (var i = 0; i < markers.length; ++i) - { markers[i].parent = this$1; } - }; - - SharedTextMarker.prototype.clear = function () { - var this$1 = this; - - if (this.explicitlyCleared) { return } - this.explicitlyCleared = true; - for (var i = 0; i < this.markers.length; ++i) - { this$1.markers[i].clear(); } - signalLater(this, "clear"); - }; - - SharedTextMarker.prototype.find = function (side, lineObj) { - return this.primary.find(side, lineObj) - }; - eventMixin(SharedTextMarker); - - function markTextShared(doc, from, to, options, type) { - options = copyObj(options); - options.shared = false; - var markers = [markText(doc, from, to, options, type)], primary = markers[0]; - var widget = options.widgetNode; - linkedDocs(doc, function (doc) { - if (widget) { options.widgetNode = widget.cloneNode(true); } - markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); - for (var i = 0; i < doc.linked.length; ++i) - { if (doc.linked[i].isParent) { return } } - primary = lst(markers); - }); - return new SharedTextMarker(markers, primary) - } - - function findSharedMarkers(doc) { - return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; }) - } - - function copySharedMarkers(doc, markers) { - for (var i = 0; i < markers.length; i++) { - var marker = markers[i], pos = marker.find(); - var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to); - if (cmp(mFrom, mTo)) { - var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type); - marker.markers.push(subMark); - subMark.parent = marker; - } - } - } - - function detachSharedMarkers(markers) { - var loop = function ( i ) { - var marker = markers[i], linked = [marker.primary.doc]; - linkedDocs(marker.primary.doc, function (d) { return linked.push(d); }); - for (var j = 0; j < marker.markers.length; j++) { - var subMarker = marker.markers[j]; - if (indexOf(linked, subMarker.doc) == -1) { - subMarker.parent = null; - marker.markers.splice(j--, 1); - } - } - }; - - for (var i = 0; i < markers.length; i++) loop( i ); - } - - var nextDocId = 0; - var Doc = function(text, mode, firstLine, lineSep, direction) { - if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) } - if (firstLine == null) { firstLine = 0; } - - BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); - this.first = firstLine; - this.scrollTop = this.scrollLeft = 0; - this.cantEdit = false; - this.cleanGeneration = 1; - this.frontier = firstLine; - var start = Pos(firstLine, 0); - this.sel = simpleSelection(start); - this.history = new History(null); - this.id = ++nextDocId; - this.modeOption = mode; - this.lineSep = lineSep; - this.direction = (direction == "rtl") ? "rtl" : "ltr"; - this.extend = false; - - if (typeof text == "string") { text = this.splitLines(text); } - updateDoc(this, {from: start, to: start, text: text}); - setSelection(this, simpleSelection(start), sel_dontScroll); - }; - - Doc.prototype = createObj(BranchChunk.prototype, { - constructor: Doc, - // Iterate over the document. Supports two forms -- with only one - // argument, it calls that for each line in the document. With - // three, it iterates over the range given by the first two (with - // the second being non-inclusive). - iter: function(from, to, op) { - if (op) { this.iterN(from - this.first, to - from, op); } - else { this.iterN(this.first, this.first + this.size, from); } - }, - - // Non-public interface for adding and removing lines. - insert: function(at, lines) { - var height = 0; - for (var i = 0; i < lines.length; ++i) { height += lines[i].height; } - this.insertInner(at - this.first, lines, height); - }, - remove: function(at, n) { this.removeInner(at - this.first, n); }, - - // From here, the methods are part of the public interface. Most - // are also available from CodeMirror (editor) instances. - - getValue: function(lineSep) { - var lines = getLines(this, this.first, this.first + this.size); - if (lineSep === false) { return lines } - return lines.join(lineSep || this.lineSeparator()) - }, - setValue: docMethodOp(function(code) { - var top = Pos(this.first, 0), last = this.first + this.size - 1; - makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), - text: this.splitLines(code), origin: "setValue", full: true}, true); - setSelection(this, simpleSelection(top)); - }), - replaceRange: function(code, from, to, origin) { - from = clipPos(this, from); - to = to ? clipPos(this, to) : from; - replaceRange(this, code, from, to, origin); - }, - getRange: function(from, to, lineSep) { - var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); - if (lineSep === false) { return lines } - return lines.join(lineSep || this.lineSeparator()) - }, - - getLine: function(line) {var l = this.getLineHandle(line); return l && l.text}, - - getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }}, - getLineNumber: function(line) {return lineNo(line)}, - - getLineHandleVisualStart: function(line) { - if (typeof line == "number") { line = getLine(this, line); } - return visualLine(line) - }, - - lineCount: function() {return this.size}, - firstLine: function() {return this.first}, - lastLine: function() {return this.first + this.size - 1}, - - clipPos: function(pos) {return clipPos(this, pos)}, - - getCursor: function(start) { - var range$$1 = this.sel.primary(), pos; - if (start == null || start == "head") { pos = range$$1.head; } - else if (start == "anchor") { pos = range$$1.anchor; } - else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); } - else { pos = range$$1.from(); } - return pos - }, - listSelections: function() { return this.sel.ranges }, - somethingSelected: function() {return this.sel.somethingSelected()}, - - setCursor: docMethodOp(function(line, ch, options) { - setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options); - }), - setSelection: docMethodOp(function(anchor, head, options) { - setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); - }), - extendSelection: docMethodOp(function(head, other, options) { - extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); - }), - extendSelections: docMethodOp(function(heads, options) { - extendSelections(this, clipPosArray(this, heads), options); - }), - extendSelectionsBy: docMethodOp(function(f, options) { - var heads = map(this.sel.ranges, f); - extendSelections(this, clipPosArray(this, heads), options); - }), - setSelections: docMethodOp(function(ranges, primary, options) { - var this$1 = this; - - if (!ranges.length) { return } - var out = []; - for (var i = 0; i < ranges.length; i++) - { out[i] = new Range(clipPos(this$1, ranges[i].anchor), - clipPos(this$1, ranges[i].head)); } - if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } - setSelection(this, normalizeSelection(out, primary), options); - }), - addSelection: docMethodOp(function(anchor, head, options) { - var ranges = this.sel.ranges.slice(0); - ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))); - setSelection(this, normalizeSelection(ranges, ranges.length - 1), options); - }), - - getSelection: function(lineSep) { - var this$1 = this; - - var ranges = this.sel.ranges, lines; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()); - lines = lines ? lines.concat(sel) : sel; - } - if (lineSep === false) { return lines } - else { return lines.join(lineSep || this.lineSeparator()) } - }, - getSelections: function(lineSep) { - var this$1 = this; - - var parts = [], ranges = this.sel.ranges; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()); - if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); } - parts[i] = sel; - } - return parts - }, - replaceSelection: function(code, collapse, origin) { - var dup = []; - for (var i = 0; i < this.sel.ranges.length; i++) - { dup[i] = code; } - this.replaceSelections(dup, collapse, origin || "+input"); - }, - replaceSelections: docMethodOp(function(code, collapse, origin) { - var this$1 = this; - - var changes = [], sel = this.sel; - for (var i = 0; i < sel.ranges.length; i++) { - var range$$1 = sel.ranges[i]; - changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin}; - } - var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); - for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) - { makeChange(this$1, changes[i$1]); } - if (newSel) { setSelectionReplaceHistory(this, newSel); } - else if (this.cm) { ensureCursorVisible(this.cm); } - }), - undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}), - redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}), - undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}), - redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}), - - setExtending: function(val) {this.extend = val;}, - getExtending: function() {return this.extend}, - - historySize: function() { - var hist = this.history, done = 0, undone = 0; - for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } } - for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } } - return {undo: done, redo: undone} - }, - clearHistory: function() {this.history = new History(this.history.maxGeneration);}, - - markClean: function() { - this.cleanGeneration = this.changeGeneration(true); - }, - changeGeneration: function(forceSplit) { - if (forceSplit) - { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; } - return this.history.generation - }, - isClean: function (gen) { - return this.history.generation == (gen || this.cleanGeneration) - }, - - getHistory: function() { - return {done: copyHistoryArray(this.history.done), - undone: copyHistoryArray(this.history.undone)} - }, - setHistory: function(histData) { - var hist = this.history = new History(this.history.maxGeneration); - hist.done = copyHistoryArray(histData.done.slice(0), null, true); - hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); - }, - - setGutterMarker: docMethodOp(function(line, gutterID, value) { - return changeLine(this, line, "gutter", function (line) { - var markers = line.gutterMarkers || (line.gutterMarkers = {}); - markers[gutterID] = value; - if (!value && isEmpty(markers)) { line.gutterMarkers = null; } - return true - }) - }), - - clearGutter: docMethodOp(function(gutterID) { - var this$1 = this; - - this.iter(function (line) { - if (line.gutterMarkers && line.gutterMarkers[gutterID]) { - changeLine(this$1, line, "gutter", function () { - line.gutterMarkers[gutterID] = null; - if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; } - return true - }); - } - }); - }), - - lineInfo: function(line) { - var n; - if (typeof line == "number") { - if (!isLine(this, line)) { return null } - n = line; - line = getLine(this, line); - if (!line) { return null } - } else { - n = lineNo(line); - if (n == null) { return null } - } - return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, - textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, - widgets: line.widgets} - }, - - addLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - if (!line[prop]) { line[prop] = cls; } - else if (classTest(cls).test(line[prop])) { return false } - else { line[prop] += " " + cls; } - return true - }) - }), - removeLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - var cur = line[prop]; - if (!cur) { return false } - else if (cls == null) { line[prop] = null; } - else { - var found = cur.match(classTest(cls)); - if (!found) { return false } - var end = found.index + found[0].length; - line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; - } - return true - }) - }), - - addLineWidget: docMethodOp(function(handle, node, options) { - return addLineWidget(this, handle, node, options) - }), - removeLineWidget: function(widget) { widget.clear(); }, - - markText: function(from, to, options) { - return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range") - }, - setBookmark: function(pos, options) { - var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), - insertLeft: options && options.insertLeft, - clearWhenEmpty: false, shared: options && options.shared, - handleMouseEvents: options && options.handleMouseEvents}; - pos = clipPos(this, pos); - return markText(this, pos, pos, realOpts, "bookmark") - }, - findMarksAt: function(pos) { - pos = clipPos(this, pos); - var markers = [], spans = getLine(this, pos.line).markedSpans; - if (spans) { for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if ((span.from == null || span.from <= pos.ch) && - (span.to == null || span.to >= pos.ch)) - { markers.push(span.marker.parent || span.marker); } - } } - return markers - }, - findMarks: function(from, to, filter) { - from = clipPos(this, from); to = clipPos(this, to); - var found = [], lineNo$$1 = from.line; - this.iter(from.line, to.line + 1, function (line) { - var spans = line.markedSpans; - if (spans) { for (var i = 0; i < spans.length; i++) { - var span = spans[i]; - if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to || - span.from == null && lineNo$$1 != from.line || - span.from != null && lineNo$$1 == to.line && span.from >= to.ch) && - (!filter || filter(span.marker))) - { found.push(span.marker.parent || span.marker); } - } } - ++lineNo$$1; - }); - return found - }, - getAllMarks: function() { - var markers = []; - this.iter(function (line) { - var sps = line.markedSpans; - if (sps) { for (var i = 0; i < sps.length; ++i) - { if (sps[i].from != null) { markers.push(sps[i].marker); } } } - }); - return markers - }, - - posFromIndex: function(off) { - var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length; - this.iter(function (line) { - var sz = line.text.length + sepSize; - if (sz > off) { ch = off; return true } - off -= sz; - ++lineNo$$1; - }); - return clipPos(this, Pos(lineNo$$1, ch)) - }, - indexFromPos: function (coords) { - coords = clipPos(this, coords); - var index = coords.ch; - if (coords.line < this.first || coords.ch < 0) { return 0 } - var sepSize = this.lineSeparator().length; - this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value - index += line.text.length + sepSize; - }); - return index - }, - - copy: function(copyHistory) { - var doc = new Doc(getLines(this, this.first, this.first + this.size), - this.modeOption, this.first, this.lineSep, this.direction); - doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; - doc.sel = this.sel; - doc.extend = false; - if (copyHistory) { - doc.history.undoDepth = this.history.undoDepth; - doc.setHistory(this.getHistory()); - } - return doc - }, - - linkedDoc: function(options) { - if (!options) { options = {}; } - var from = this.first, to = this.first + this.size; - if (options.from != null && options.from > from) { from = options.from; } - if (options.to != null && options.to < to) { to = options.to; } - var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction); - if (options.sharedHist) { copy.history = this.history - ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); - copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; - copySharedMarkers(copy, findSharedMarkers(this)); - return copy - }, - unlinkDoc: function(other) { - var this$1 = this; - - if (other instanceof CodeMirror$1) { other = other.doc; } - if (this.linked) { for (var i = 0; i < this.linked.length; ++i) { - var link = this$1.linked[i]; - if (link.doc != other) { continue } - this$1.linked.splice(i, 1); - other.unlinkDoc(this$1); - detachSharedMarkers(findSharedMarkers(this$1)); - break - } } - // If the histories were shared, split them again - if (other.history == this.history) { - var splitIds = [other.id]; - linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true); - other.history = new History(null); - other.history.done = copyHistoryArray(this.history.done, splitIds); - other.history.undone = copyHistoryArray(this.history.undone, splitIds); - } - }, - iterLinkedDocs: function(f) {linkedDocs(this, f);}, - - getMode: function() {return this.mode}, - getEditor: function() {return this.cm}, - - splitLines: function(str) { - if (this.lineSep) { return str.split(this.lineSep) } - return splitLinesAuto(str) - }, - lineSeparator: function() { return this.lineSep || "\n" }, - - setDirection: docMethodOp(function (dir) { - if (dir != "rtl") { dir = "ltr"; } - if (dir == this.direction) { return } - this.direction = dir; - this.iter(function (line) { return line.order = null; }); - if (this.cm) { directionChanged(this.cm); } - }) - }); - - // Public alias. - Doc.prototype.eachLine = Doc.prototype.iter; - - // Kludge to work around strange IE behavior where it'll sometimes - // re-fire a series of drag-related events right after the drop (#1551) - var lastDrop = 0; - - function onDrop(e) { - var cm = this; - clearDragCursor(cm); - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) - { return } - e_preventDefault(e); - if (ie) { lastDrop = +new Date; } - var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; - if (!pos || cm.isReadOnly()) { return } - // Might be a file drop, in which case we simply extract the text - // and insert it. - if (files && files.length && window.FileReader && window.File) { - var n = files.length, text = Array(n), read = 0; - var loadFile = function (file, i) { - if (cm.options.allowDropFileTypes && - indexOf(cm.options.allowDropFileTypes, file.type) == -1) - { return } - - var reader = new FileReader; - reader.onload = operation(cm, function () { - var content = reader.result; - if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; } - text[i] = content; - if (++read == n) { - pos = clipPos(cm.doc, pos); - var change = {from: pos, to: pos, - text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())), - origin: "paste"}; - makeChange(cm.doc, change); - setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); - } - }); - reader.readAsText(file); - }; - for (var i = 0; i < n; ++i) { loadFile(files[i], i); } - } else { // Normal drop - // Don't do a replace if the drop happened inside of the selected text. - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { - cm.state.draggingText(e); - // Ensure the editor is re-focused - setTimeout(function () { return cm.display.input.focus(); }, 20); - return - } - try { - var text$1 = e.dataTransfer.getData("Text"); - if (text$1) { - var selected; - if (cm.state.draggingText && !cm.state.draggingText.copy) - { selected = cm.listSelections(); } - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); - if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1) - { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } } - cm.replaceSelection(text$1, "around", "paste"); - cm.display.input.focus(); - } - } - catch(e){} - } - } - - function onDragStart(cm, e) { - if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return } - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return } - - e.dataTransfer.setData("Text", cm.getSelection()); - e.dataTransfer.effectAllowed = "copyMove"; - - // Use dummy image instead of default browsers image. - // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. - if (e.dataTransfer.setDragImage && !safari) { - var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); - img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - if (presto) { - img.width = img.height = 1; - cm.display.wrapper.appendChild(img); - // Force a relayout, or Opera won't use our image for some obscure reason - img._top = img.offsetTop; - } - e.dataTransfer.setDragImage(img, 0, 0); - if (presto) { img.parentNode.removeChild(img); } - } - } - - function onDragOver(cm, e) { - var pos = posFromMouse(cm, e); - if (!pos) { return } - var frag = document.createDocumentFragment(); - drawSelectionCursor(cm, pos, frag); - if (!cm.display.dragCursor) { - cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors"); - cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv); - } - removeChildrenAndAdd(cm.display.dragCursor, frag); - } - - function clearDragCursor(cm) { - if (cm.display.dragCursor) { - cm.display.lineSpace.removeChild(cm.display.dragCursor); - cm.display.dragCursor = null; - } - } - - // These must be handled carefully, because naively registering a - // handler for each editor will cause the editors to never be - // garbage collected. - - function forEachCodeMirror(f) { - if (!document.body.getElementsByClassName) { return } - var byClass = document.body.getElementsByClassName("CodeMirror"); - for (var i = 0; i < byClass.length; i++) { - var cm = byClass[i].CodeMirror; - if (cm) { f(cm); } - } - } - - var globalsRegistered = false; - function ensureGlobalHandlers() { - if (globalsRegistered) { return } - registerGlobalHandlers(); - globalsRegistered = true; - } - function registerGlobalHandlers() { - // When the window resizes, we need to refresh active editors. - var resizeTimer; - on(window, "resize", function () { - if (resizeTimer == null) { resizeTimer = setTimeout(function () { - resizeTimer = null; - forEachCodeMirror(onResize); - }, 100); } - }); - // When the window loses focus, we want to show the editor as blurred - on(window, "blur", function () { return forEachCodeMirror(onBlur); }); - } - // Called when the window resizes - function onResize(cm) { - var d = cm.display; - if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) - { return } - // Might be a text scaling operation, clear size caches. - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - d.scrollbarsClipped = false; - cm.setSize(); - } - - var keyNames = { - 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", - 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", - 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", - 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", - 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", - 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", - 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", - 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" - }; - - // Number keys - for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); } - // Alphabetic keys - for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); } - // Function keys - for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; } - - var keyMap = {}; - - keyMap.basic = { - "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", - "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", - "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore", - "Tab": "defaultTab", "Shift-Tab": "indentAuto", - "Enter": "newlineAndIndent", "Insert": "toggleOverwrite", - "Esc": "singleSelection" - }; - // Note that the save and find-related commands aren't defined by - // default. User code or addons can define them. Unknown commands - // are simply ignored. - keyMap.pcDefault = { - "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", - "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown", - "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", - "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find", - "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", - "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", - "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection", - fallthrough: "basic" - }; - // Very basic readline/emacs-style bindings, which are standard on Mac. - keyMap.emacsy = { - "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", - "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", - "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", - "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", - "Ctrl-O": "openLine" - }; - keyMap.macDefault = { - "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", - "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", - "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore", - "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find", - "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", - "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight", - "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd", - fallthrough: ["basic", "emacsy"] - }; - keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; - - // KEYMAP DISPATCH - - function normalizeKeyName(name) { - var parts = name.split(/-(?!$)/); - name = parts[parts.length - 1]; - var alt, ctrl, shift, cmd; - for (var i = 0; i < parts.length - 1; i++) { - var mod = parts[i]; - if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; } - else if (/^a(lt)?$/i.test(mod)) { alt = true; } - else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; } - else if (/^s(hift)?$/i.test(mod)) { shift = true; } - else { throw new Error("Unrecognized modifier name: " + mod) } - } - if (alt) { name = "Alt-" + name; } - if (ctrl) { name = "Ctrl-" + name; } - if (cmd) { name = "Cmd-" + name; } - if (shift) { name = "Shift-" + name; } - return name - } - - // This is a kludge to keep keymaps mostly working as raw objects - // (backwards compatibility) while at the same time support features - // like normalization and multi-stroke key bindings. It compiles a - // new normalized keymap, and then updates the old object to reflect - // this. - function normalizeKeyMap(keymap) { - var copy = {}; - for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { - var value = keymap[keyname]; - if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } - if (value == "...") { delete keymap[keyname]; continue } - - var keys = map(keyname.split(" "), normalizeKeyName); - for (var i = 0; i < keys.length; i++) { - var val = (void 0), name = (void 0); - if (i == keys.length - 1) { - name = keys.join(" "); - val = value; - } else { - name = keys.slice(0, i + 1).join(" "); - val = "..."; - } - var prev = copy[name]; - if (!prev) { copy[name] = val; } - else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } - } - delete keymap[keyname]; - } } - for (var prop in copy) { keymap[prop] = copy[prop]; } - return keymap - } - - function lookupKey(key, map$$1, handle, context) { - map$$1 = getKeyMap(map$$1); - var found = map$$1.call ? map$$1.call(key, context) : map$$1[key]; - if (found === false) { return "nothing" } - if (found === "...") { return "multi" } - if (found != null && handle(found)) { return "handled" } - - if (map$$1.fallthrough) { - if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]") - { return lookupKey(key, map$$1.fallthrough, handle, context) } - for (var i = 0; i < map$$1.fallthrough.length; i++) { - var result = lookupKey(key, map$$1.fallthrough[i], handle, context); - if (result) { return result } - } - } - } - - // Modifier key presses don't count as 'real' key presses for the - // purpose of keymap fallthrough. - function isModifierKey(value) { - var name = typeof value == "string" ? value : keyNames[value.keyCode]; - return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" - } - - // Look up the name of a key as indicated by an event object. - function keyName(event, noShift) { - if (presto && event.keyCode == 34 && event["char"]) { return false } - var base = keyNames[event.keyCode], name = base; - if (name == null || event.altGraphKey) { return false } - if (event.altKey && base != "Alt") { name = "Alt-" + name; } - if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; } - if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; } - if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; } - return name - } - - function getKeyMap(val) { - return typeof val == "string" ? keyMap[val] : val - } - - // Helper for deleting text near the selection(s), used to implement - // backspace, delete, and similar functionality. - function deleteNearSelection(cm, compute) { - var ranges = cm.doc.sel.ranges, kill = []; - // Build up a set of ranges to kill first, merging overlapping - // ranges. - for (var i = 0; i < ranges.length; i++) { - var toKill = compute(ranges[i]); - while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { - var replaced = kill.pop(); - if (cmp(replaced.from, toKill.from) < 0) { - toKill.from = replaced.from; - break - } - } - kill.push(toKill); - } - // Next, remove those actual ranges. - runInOp(cm, function () { - for (var i = kill.length - 1; i >= 0; i--) - { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); } - ensureCursorVisible(cm); - }); - } - - // Commands are parameter-less actions that can be performed on an - // editor, mostly used for keybindings. - var commands = { - selectAll: selectAll, - singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); }, - killLine: function (cm) { return deleteNearSelection(cm, function (range) { - if (range.empty()) { - var len = getLine(cm.doc, range.head.line).text.length; - if (range.head.ch == len && range.head.line < cm.lastLine()) - { return {from: range.head, to: Pos(range.head.line + 1, 0)} } - else - { return {from: range.head, to: Pos(range.head.line, len)} } - } else { - return {from: range.from(), to: range.to()} - } - }); }, - deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({ - from: Pos(range.from().line, 0), - to: clipPos(cm.doc, Pos(range.to().line + 1, 0)) - }); }); }, - delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({ - from: Pos(range.from().line, 0), to: range.from() - }); }); }, - delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { - var top = cm.charCoords(range.head, "div").top + 5; - var leftPos = cm.coordsChar({left: 0, top: top}, "div"); - return {from: leftPos, to: range.from()} - }); }, - delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) { - var top = cm.charCoords(range.head, "div").top + 5; - var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); - return {from: range.from(), to: rightPos } - }); }, - undo: function (cm) { return cm.undo(); }, - redo: function (cm) { return cm.redo(); }, - undoSelection: function (cm) { return cm.undoSelection(); }, - redoSelection: function (cm) { return cm.redoSelection(); }, - goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); }, - goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); }, - goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); }, - {origin: "+move", bias: 1} - ); }, - goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); }, - {origin: "+move", bias: 1} - ); }, - goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); }, - {origin: "+move", bias: -1} - ); }, - goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") - }, sel_move); }, - goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: 0, top: top}, "div") - }, sel_move); }, - goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) { - var top = cm.charCoords(range.head, "div").top + 5; - var pos = cm.coordsChar({left: 0, top: top}, "div"); - if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) } - return pos - }, sel_move); }, - goLineUp: function (cm) { return cm.moveV(-1, "line"); }, - goLineDown: function (cm) { return cm.moveV(1, "line"); }, - goPageUp: function (cm) { return cm.moveV(-1, "page"); }, - goPageDown: function (cm) { return cm.moveV(1, "page"); }, - goCharLeft: function (cm) { return cm.moveH(-1, "char"); }, - goCharRight: function (cm) { return cm.moveH(1, "char"); }, - goColumnLeft: function (cm) { return cm.moveH(-1, "column"); }, - goColumnRight: function (cm) { return cm.moveH(1, "column"); }, - goWordLeft: function (cm) { return cm.moveH(-1, "word"); }, - goGroupRight: function (cm) { return cm.moveH(1, "group"); }, - goGroupLeft: function (cm) { return cm.moveH(-1, "group"); }, - goWordRight: function (cm) { return cm.moveH(1, "word"); }, - delCharBefore: function (cm) { return cm.deleteH(-1, "char"); }, - delCharAfter: function (cm) { return cm.deleteH(1, "char"); }, - delWordBefore: function (cm) { return cm.deleteH(-1, "word"); }, - delWordAfter: function (cm) { return cm.deleteH(1, "word"); }, - delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); }, - delGroupAfter: function (cm) { return cm.deleteH(1, "group"); }, - indentAuto: function (cm) { return cm.indentSelection("smart"); }, - indentMore: function (cm) { return cm.indentSelection("add"); }, - indentLess: function (cm) { return cm.indentSelection("subtract"); }, - insertTab: function (cm) { return cm.replaceSelection("\t"); }, - insertSoftTab: function (cm) { - var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize; - for (var i = 0; i < ranges.length; i++) { - var pos = ranges[i].from(); - var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize); - spaces.push(spaceStr(tabSize - col % tabSize)); - } - cm.replaceSelections(spaces); - }, - defaultTab: function (cm) { - if (cm.somethingSelected()) { cm.indentSelection("add"); } - else { cm.execCommand("insertTab"); } - }, - // Swap the two chars left and right of each selection's head. - // Move cursor behind the two swapped characters afterwards. - // - // Doesn't consider line feeds a character. - // Doesn't scan more than one line above to find a character. - // Doesn't do anything on an empty line. - // Doesn't do anything with non-empty selections. - transposeChars: function (cm) { return runInOp(cm, function () { - var ranges = cm.listSelections(), newSel = []; - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) { continue } - var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text; - if (line) { - if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); } - if (cur.ch > 0) { - cur = new Pos(cur.line, cur.ch + 1); - cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), - Pos(cur.line, cur.ch - 2), cur, "+transpose"); - } else if (cur.line > cm.doc.first) { - var prev = getLine(cm.doc, cur.line - 1).text; - if (prev) { - cur = new Pos(cur.line, 1); - cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + - prev.charAt(prev.length - 1), - Pos(cur.line - 1, prev.length - 1), cur, "+transpose"); - } - } - } - newSel.push(new Range(cur, cur)); - } - cm.setSelections(newSel); - }); }, - newlineAndIndent: function (cm) { return runInOp(cm, function () { - var sels = cm.listSelections(); - for (var i = sels.length - 1; i >= 0; i--) - { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); } - sels = cm.listSelections(); - for (var i$1 = 0; i$1 < sels.length; i$1++) - { cm.indentLine(sels[i$1].from().line, null, true); } - ensureCursorVisible(cm); - }); }, - openLine: function (cm) { return cm.replaceSelection("\n", "start"); }, - toggleOverwrite: function (cm) { return cm.toggleOverwrite(); } - }; - - - function lineStart(cm, lineN) { - var line = getLine(cm.doc, lineN); - var visual = visualLine(line); - if (visual != line) { lineN = lineNo(visual); } - return endOfLine(true, cm, visual, lineN, 1) - } - function lineEnd(cm, lineN) { - var line = getLine(cm.doc, lineN); - var visual = visualLineEnd(line); - if (visual != line) { lineN = lineNo(visual); } - return endOfLine(true, cm, line, lineN, -1) - } - function lineStartSmart(cm, pos) { - var start = lineStart(cm, pos.line); - var line = getLine(cm.doc, start.line); - var order = getOrder(line, cm.doc.direction); - if (!order || order[0].level == 0) { - var firstNonWS = Math.max(0, line.text.search(/\S/)); - var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch; - return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky) - } - return start - } - - // Run a handler that was bound to a key. - function doHandleBinding(cm, bound, dropShift) { - if (typeof bound == "string") { - bound = commands[bound]; - if (!bound) { return false } - } - // Ensure previous input has been read, so that the handler sees a - // consistent view of the document - cm.display.input.ensurePolled(); - var prevShift = cm.display.shift, done = false; - try { - if (cm.isReadOnly()) { cm.state.suppressEdits = true; } - if (dropShift) { cm.display.shift = false; } - done = bound(cm) != Pass; - } finally { - cm.display.shift = prevShift; - cm.state.suppressEdits = false; - } - return done - } - - function lookupKeyForEditor(cm, name, handle) { - for (var i = 0; i < cm.state.keyMaps.length; i++) { - var result = lookupKey(name, cm.state.keyMaps[i], handle, cm); - if (result) { return result } - } - return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) - || lookupKey(name, cm.options.keyMap, handle, cm) - } - - var stopSeq = new Delayed; - function dispatchKey(cm, name, e, handle) { - var seq = cm.state.keySeq; - if (seq) { - if (isModifierKey(name)) { return "handled" } - stopSeq.set(50, function () { - if (cm.state.keySeq == seq) { - cm.state.keySeq = null; - cm.display.input.reset(); - } - }); - name = seq + " " + name; - } - var result = lookupKeyForEditor(cm, name, handle); - - if (result == "multi") - { cm.state.keySeq = name; } - if (result == "handled") - { signalLater(cm, "keyHandled", cm, name, e); } - - if (result == "handled" || result == "multi") { - e_preventDefault(e); - restartBlink(cm); - } - - if (seq && !result && /\'$/.test(name)) { - e_preventDefault(e); - return true - } - return !!result - } - - // Handle a key from the keydown event. - function handleKeyBinding(cm, e) { - var name = keyName(e, true); - if (!name) { return false } - - if (e.shiftKey && !cm.state.keySeq) { - // First try to resolve full name (including 'Shift-'). Failing - // that, see if there is a cursor-motion command (starting with - // 'go') bound to the keyname without 'Shift-'. - return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) - || dispatchKey(cm, name, e, function (b) { - if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) - { return doHandleBinding(cm, b) } - }) - } else { - return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) - } - } - - // Handle a key from the keypress event - function handleCharBinding(cm, e, ch) { - return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) - } - - var lastStoppedKey = null; - function onKeyDown(e) { - var cm = this; - cm.curOp.focus = activeElt(); - if (signalDOMEvent(cm, e)) { return } - // IE does strange things with escape. - if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; } - var code = e.keyCode; - cm.display.shift = code == 16 || e.shiftKey; - var handled = handleKeyBinding(cm, e); - if (presto) { - lastStoppedKey = handled ? code : null; - // Opera has no cut event... we try to at least catch the key combo - if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) - { cm.replaceSelection("", null, "cut"); } - } - - // Turn mouse into crosshair when Alt is held on Mac. - if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) - { showCrossHair(cm); } - } - - function showCrossHair(cm) { - var lineDiv = cm.display.lineDiv; - addClass(lineDiv, "CodeMirror-crosshair"); - - function up(e) { - if (e.keyCode == 18 || !e.altKey) { - rmClass(lineDiv, "CodeMirror-crosshair"); - off(document, "keyup", up); - off(document, "mouseover", up); - } - } - on(document, "keyup", up); - on(document, "mouseover", up); - } - - function onKeyUp(e) { - if (e.keyCode == 16) { this.doc.sel.shift = false; } - signalDOMEvent(this, e); - } - - function onKeyPress(e) { - var cm = this; - if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return } - var keyCode = e.keyCode, charCode = e.charCode; - if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return} - if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return } - var ch = String.fromCharCode(charCode == null ? keyCode : charCode); - // Some browsers fire keypress events for backspace - if (ch == "\x08") { return } - if (handleCharBinding(cm, e, ch)) { return } - cm.display.input.onKeyPress(e); - } - - // A mouse down can be a single click, double click, triple click, - // start of selection drag, start of text drag, new cursor - // (ctrl-click), rectangle drag (alt-drag), or xwin - // middle-click-paste. Or it might be a click on something we should - // not interfere with, such as a scrollbar or widget. - function onMouseDown(e) { - var cm = this, display = cm.display; - if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } - display.input.ensurePolled(); - display.shift = e.shiftKey; - - if (eventInWidget(display, e)) { - if (!webkit) { - // Briefly turn off draggability, to allow widgets to do - // normal dragging things. - display.scroller.draggable = false; - setTimeout(function () { return display.scroller.draggable = true; }, 100); - } - return - } - if (clickInGutter(cm, e)) { return } - var start = posFromMouse(cm, e); - window.focus(); - - switch (e_button(e)) { - case 1: - // #3261: make sure, that we're not starting a second selection - if (cm.state.selectingText) - { cm.state.selectingText(e); } - else if (start) - { leftButtonDown(cm, e, start); } - else if (e_target(e) == display.scroller) - { e_preventDefault(e); } - break - case 2: - if (webkit) { cm.state.lastMiddleDown = +new Date; } - if (start) { extendSelection(cm.doc, start); } - setTimeout(function () { return display.input.focus(); }, 20); - e_preventDefault(e); - break - case 3: - if (captureRightClick) { onContextMenu(cm, e); } - else { delayBlurEvent(cm); } - break - } - } - - var lastClick; - var lastDoubleClick; - function leftButtonDown(cm, e, start) { - if (ie) { setTimeout(bind(ensureFocus, cm), 0); } - else { cm.curOp.focus = activeElt(); } - - var now = +new Date, type; - if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { - type = "triple"; - } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { - type = "double"; - lastDoubleClick = {time: now, pos: start}; - } else { - type = "single"; - lastClick = {time: now, pos: start}; - } - - var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; - if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && - type == "single" && (contained = sel.contains(start)) > -1 && - (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) && - (cmp(contained.to(), start) > 0 || start.xRel < 0)) - { leftButtonStartDrag(cm, e, start, modifier); } - else - { leftButtonSelect(cm, e, start, type, modifier); } - } - - // Start a text drag. When it ends, see if any dragging actually - // happen, and treat as a click if it didn't. - function leftButtonStartDrag(cm, e, start, modifier) { - var display = cm.display, startTime = +new Date; - var dragEnd = operation(cm, function (e2) { - if (webkit) { display.scroller.draggable = false; } - cm.state.draggingText = false; - off(document, "mouseup", dragEnd); - off(display.scroller, "drop", dragEnd); - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { - e_preventDefault(e2); - if (!modifier && +new Date - 200 < startTime) - { extendSelection(cm.doc, start); } - // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) - if (webkit || ie && ie_version == 9) - { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); } - else - { display.input.focus(); } - } - }); - // Let the drag handler handle this. - if (webkit) { display.scroller.draggable = true; } - cm.state.draggingText = dragEnd; - dragEnd.copy = mac ? e.altKey : e.ctrlKey; - // IE's approach to draggable - if (display.scroller.dragDrop) { display.scroller.dragDrop(); } - on(document, "mouseup", dragEnd); - on(display.scroller, "drop", dragEnd); - } - - // Normal selection, as opposed to text dragging. - function leftButtonSelect(cm, e, start, type, addNew) { - var display = cm.display, doc = cm.doc; - e_preventDefault(e); - - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; - if (addNew && !e.shiftKey) { - ourIndex = doc.sel.contains(start); - if (ourIndex > -1) - { ourRange = ranges[ourIndex]; } - else - { ourRange = new Range(start, start); } - } else { - ourRange = doc.sel.primary(); - ourIndex = doc.sel.primIndex; - } - - if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) { - type = "rect"; - if (!addNew) { ourRange = new Range(start, start); } - start = posFromMouse(cm, e, true, true); - ourIndex = -1; - } else if (type == "double") { - var word = cm.findWordAt(start); - if (cm.display.shift || doc.extend) - { ourRange = extendRange(doc, ourRange, word.anchor, word.head); } - else - { ourRange = word; } - } else if (type == "triple") { - var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))); - if (cm.display.shift || doc.extend) - { ourRange = extendRange(doc, ourRange, line.anchor, line.head); } - else - { ourRange = line; } - } else { - ourRange = extendRange(doc, ourRange, start); - } - - if (!addNew) { - ourIndex = 0; - setSelection(doc, new Selection([ourRange], 0), sel_mouse); - startSel = doc.sel; - } else if (ourIndex == -1) { - ourIndex = ranges.length; - setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), - {scroll: false, origin: "*mouse"}); - } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) { - setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), - {scroll: false, origin: "*mouse"}); - startSel = doc.sel; - } else { - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); - } - - var lastPos = start; - function extendTo(pos) { - if (cmp(lastPos, pos) == 0) { return } - lastPos = pos; - - if (type == "rect") { - var ranges = [], tabSize = cm.options.tabSize; - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); - var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); - for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); - line <= end; line++) { - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); - if (left == right) - { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } - else if (text.length > leftPos) - { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } - } - if (!ranges.length) { ranges.push(new Range(start, start)); } - setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), - {origin: "*mouse", scroll: false}); - cm.scrollIntoView(pos); - } else { - var oldRange = ourRange; - var anchor = oldRange.anchor, head = pos; - if (type != "single") { - var range$$1; - if (type == "double") - { range$$1 = cm.findWordAt(pos); } - else - { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); } - if (cmp(range$$1.anchor, anchor) > 0) { - head = range$$1.head; - anchor = minPos(oldRange.from(), range$$1.anchor); - } else { - head = range$$1.anchor; - anchor = maxPos(oldRange.to(), range$$1.head); - } - } - var ranges$1 = startSel.ranges.slice(0); - ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head); - setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse); - } - } - - var editorSize = display.wrapper.getBoundingClientRect(); - // Used to ensure timeout re-tries don't fire when another extend - // happened in the meantime (clearTimeout isn't reliable -- at - // least on Chrome, the timeouts still happen even when cleared, - // if the clear happens after their scheduled firing time). - var counter = 0; - - function extend(e) { - var curCount = ++counter; - var cur = posFromMouse(cm, e, true, type == "rect"); - if (!cur) { return } - if (cmp(cur, lastPos) != 0) { - cm.curOp.focus = activeElt(); - extendTo(cur); - var visible = visibleLines(display, doc); - if (cur.line >= visible.to || cur.line < visible.from) - { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } - } else { - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; - if (outside) { setTimeout(operation(cm, function () { - if (counter != curCount) { return } - display.scroller.scrollTop += outside; - extend(e); - }), 50); } - } - } - - function done(e) { - cm.state.selectingText = false; - counter = Infinity; - e_preventDefault(e); - display.input.focus(); - off(document, "mousemove", move); - off(document, "mouseup", up); - doc.history.lastSelOrigin = null; - } - - var move = operation(cm, function (e) { - if (!e_button(e)) { done(e); } - else { extend(e); } - }); - var up = operation(cm, done); - cm.state.selectingText = up; - on(document, "mousemove", move); - on(document, "mouseup", up); - } - - - // Determines whether an event happened in the gutter, and fires the - // handlers for the corresponding event. - function gutterEvent(cm, e, type, prevent) { - var mX, mY; - try { mX = e.clientX; mY = e.clientY; } - catch(e) { return false } - if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } - if (prevent) { e_preventDefault(e); } - - var display = cm.display; - var lineBox = display.lineDiv.getBoundingClientRect(); - - if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } - mY -= lineBox.top - display.viewOffset; - - for (var i = 0; i < cm.options.gutters.length; ++i) { - var g = display.gutters.childNodes[i]; - if (g && g.getBoundingClientRect().right >= mX) { - var line = lineAtHeight(cm.doc, mY); - var gutter = cm.options.gutters[i]; - signal(cm, type, cm, line, gutter, e); - return e_defaultPrevented(e) - } - } - } - - function clickInGutter(cm, e) { - return gutterEvent(cm, e, "gutterClick", true) - } - - // CONTEXT MENU HANDLING - - // To make the context menu work, we need to briefly unhide the - // textarea (making it as unobtrusive as possible) to let the - // right-click take effect on it. - function onContextMenu(cm, e) { - if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } - if (signalDOMEvent(cm, e, "contextmenu")) { return } - cm.display.input.onContextMenu(e); - } - - function contextMenuInGutter(cm, e) { - if (!hasHandler(cm, "gutterContextMenu")) { return false } - return gutterEvent(cm, e, "gutterContextMenu", false) - } - - function themeChanged(cm) { - cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + - cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); - clearCaches(cm); - } - - var Init = {toString: function(){return "CodeMirror.Init"}}; - - var defaults = {}; - var optionHandlers = {}; - - function defineOptions(CodeMirror) { - var optionHandlers = CodeMirror.optionHandlers; - - function option(name, deflt, handle, notOnInit) { - CodeMirror.defaults[name] = deflt; - if (handle) { optionHandlers[name] = - notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; } - } - - CodeMirror.defineOption = option; - - // Passed to option handlers when there is no old value. - CodeMirror.Init = Init; - - // These two are, on init, called from the constructor because they - // have to be initialized before the editor can start at all. - option("value", "", function (cm, val) { return cm.setValue(val); }, true); - option("mode", null, function (cm, val) { - cm.doc.modeOption = val; - loadMode(cm); - }, true); - - option("indentUnit", 2, loadMode, true); - option("indentWithTabs", false); - option("smartIndent", true); - option("tabSize", 4, function (cm) { - resetModeState(cm); - clearCaches(cm); - regChange(cm); - }, true); - option("lineSeparator", null, function (cm, val) { - cm.doc.lineSep = val; - if (!val) { return } - var newBreaks = [], lineNo = cm.doc.first; - cm.doc.iter(function (line) { - for (var pos = 0;;) { - var found = line.text.indexOf(val, pos); - if (found == -1) { break } - pos = found + val.length; - newBreaks.push(Pos(lineNo, found)); - } - lineNo++; - }); - for (var i = newBreaks.length - 1; i >= 0; i--) - { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } - }); - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) { - cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); - if (old != Init) { cm.refresh(); } - }); - option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true); - option("electricChars", true); - option("inputStyle", mobile ? "contenteditable" : "textarea", function () { - throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME - }, true); - option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true); - option("rtlMoveVisually", !windows); - option("wholeLineUpdateBefore", true); - - option("theme", "default", function (cm) { - themeChanged(cm); - guttersChanged(cm); - }, true); - option("keyMap", "default", function (cm, val, old) { - var next = getKeyMap(val); - var prev = old != Init && getKeyMap(old); - if (prev && prev.detach) { prev.detach(cm, next); } - if (next.attach) { next.attach(cm, prev || null); } - }); - option("extraKeys", null); - - option("lineWrapping", false, wrappingChanged, true); - option("gutters", [], function (cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("fixedGutter", true, function (cm, val) { - cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; - cm.refresh(); - }, true); - option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true); - option("scrollbarStyle", "native", function (cm) { - initScrollbars(cm); - updateScrollbars(cm); - cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); - cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); - }, true); - option("lineNumbers", false, function (cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("firstLineNumber", 1, guttersChanged, true); - option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true); - option("showCursorWhenSelecting", false, updateSelection, true); - - option("resetSelectionOnContextMenu", true); - option("lineWiseCopyCut", true); - - option("readOnly", false, function (cm, val) { - if (val == "nocursor") { - onBlur(cm); - cm.display.input.blur(); - cm.display.disabled = true; - } else { - cm.display.disabled = false; - } - cm.display.input.readOnlyChanged(val); - }); - option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true); - option("dragDrop", true, dragDropChanged); - option("allowDropFileTypes", null); - - option("cursorBlinkRate", 530); - option("cursorScrollMargin", 0); - option("cursorHeight", 1, updateSelection, true); - option("singleCursorHeightPerLine", true, updateSelection, true); - option("workTime", 100); - option("workDelay", 100); - option("flattenSpans", true, resetModeState, true); - option("addModeClass", false, resetModeState, true); - option("pollInterval", 100); - option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; }); - option("historyEventDelay", 1250); - option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true); - option("maxHighlightLength", 10000, resetModeState, true); - option("moveInputWithCursor", true, function (cm, val) { - if (!val) { cm.display.input.resetPosition(); } - }); - - option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; }); - option("autofocus", null); - option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true); - } - - function guttersChanged(cm) { - updateGutters(cm); - regChange(cm); - alignHorizontally(cm); - } - - function dragDropChanged(cm, value, old) { - var wasOn = old && old != Init; - if (!value != !wasOn) { - var funcs = cm.display.dragFunctions; - var toggle = value ? on : off; - toggle(cm.display.scroller, "dragstart", funcs.start); - toggle(cm.display.scroller, "dragenter", funcs.enter); - toggle(cm.display.scroller, "dragover", funcs.over); - toggle(cm.display.scroller, "dragleave", funcs.leave); - toggle(cm.display.scroller, "drop", funcs.drop); - } - } - - function wrappingChanged(cm) { - if (cm.options.lineWrapping) { - addClass(cm.display.wrapper, "CodeMirror-wrap"); - cm.display.sizer.style.minWidth = ""; - cm.display.sizerWidth = null; - } else { - rmClass(cm.display.wrapper, "CodeMirror-wrap"); - findMaxLine(cm); - } - estimateLineHeights(cm); - regChange(cm); - clearCaches(cm); - setTimeout(function () { return updateScrollbars(cm); }, 100); - } - - // A CodeMirror instance represents an editor. This is the object - // that user code is usually dealing with. - - function CodeMirror$1(place, options) { - var this$1 = this; - - if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) } - - this.options = options = options ? copyObj(options) : {}; - // Determine effective options based on given values and defaults. - copyObj(defaults, options, false); - setGuttersForLineNumbers(options); - - var doc = options.value; - if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); } - this.doc = doc; - - var input = new CodeMirror$1.inputStyles[options.inputStyle](this); - var display = this.display = new Display(place, doc, input); - display.wrapper.CodeMirror = this; - updateGutters(this); - themeChanged(this); - if (options.lineWrapping) - { this.display.wrapper.className += " CodeMirror-wrap"; } - initScrollbars(this); - - this.state = { - keyMaps: [], // stores maps added by addKeyMap - overlays: [], // highlighting overlays, as added by addOverlay - modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info - overwrite: false, - delayingBlurEvent: false, - focused: false, - suppressEdits: false, // used to disable editing during key handlers when in readOnly mode - pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll - selectingText: false, - draggingText: false, - highlight: new Delayed(), // stores highlight worker timeout - keySeq: null, // Unfinished key sequence - specialChars: null - }; - - if (options.autofocus && !mobile) { display.input.focus(); } - - // Override magic textarea content restore that IE sometimes does - // on our hidden textarea on reload - if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); } - - registerEventHandlers(this); - ensureGlobalHandlers(); - - startOperation(this); - this.curOp.forceUpdate = true; - attachDoc(this, doc); - - if ((options.autofocus && !mobile) || this.hasFocus()) - { setTimeout(bind(onFocus, this), 20); } - else - { onBlur(this); } - - for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) - { optionHandlers[opt](this$1, options[opt], Init); } } - maybeUpdateLineNumberWidth(this); - if (options.finishInit) { options.finishInit(this); } - for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); } - endOperation(this); - // Suppress optimizelegibility in Webkit, since it breaks text - // measuring on line wrapping boundaries. - if (webkit && options.lineWrapping && - getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") - { display.lineDiv.style.textRendering = "auto"; } - } - - // The default configuration options. - CodeMirror$1.defaults = defaults; - // Functions to run when options are changed. - CodeMirror$1.optionHandlers = optionHandlers; - - // Attach the necessary event handlers when initializing the editor - function registerEventHandlers(cm) { - var d = cm.display; - on(d.scroller, "mousedown", operation(cm, onMouseDown)); - // Older IE's will not fire a second mousedown for a double click - if (ie && ie_version < 11) - { on(d.scroller, "dblclick", operation(cm, function (e) { - if (signalDOMEvent(cm, e)) { return } - var pos = posFromMouse(cm, e); - if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } - e_preventDefault(e); - var word = cm.findWordAt(pos); - extendSelection(cm.doc, word.anchor, word.head); - })); } - else - { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); } - // Some browsers fire contextmenu *after* opening the menu, at - // which point we can't mess with it anymore. Context menu is - // handled in onMouseDown for these browsers. - if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); } - - // Used to suppress mouse event handling when a touch happens - var touchFinished, prevTouch = {end: 0}; - function finishTouch() { - if (d.activeTouch) { - touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000); - prevTouch = d.activeTouch; - prevTouch.end = +new Date; - } - } - function isMouseLikeTouchEvent(e) { - if (e.touches.length != 1) { return false } - var touch = e.touches[0]; - return touch.radiusX <= 1 && touch.radiusY <= 1 - } - function farAway(touch, other) { - if (other.left == null) { return true } - var dx = other.left - touch.left, dy = other.top - touch.top; - return dx * dx + dy * dy > 20 * 20 - } - on(d.scroller, "touchstart", function (e) { - if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) { - d.input.ensurePolled(); - clearTimeout(touchFinished); - var now = +new Date; - d.activeTouch = {start: now, moved: false, - prev: now - prevTouch.end <= 300 ? prevTouch : null}; - if (e.touches.length == 1) { - d.activeTouch.left = e.touches[0].pageX; - d.activeTouch.top = e.touches[0].pageY; - } - } - }); - on(d.scroller, "touchmove", function () { - if (d.activeTouch) { d.activeTouch.moved = true; } - }); - on(d.scroller, "touchend", function (e) { - var touch = d.activeTouch; - if (touch && !eventInWidget(d, e) && touch.left != null && - !touch.moved && new Date - touch.start < 300) { - var pos = cm.coordsChar(d.activeTouch, "page"), range; - if (!touch.prev || farAway(touch, touch.prev)) // Single tap - { range = new Range(pos, pos); } - else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap - { range = cm.findWordAt(pos); } - else // Triple tap - { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); } - cm.setSelection(range.anchor, range.head); - cm.focus(); - e_preventDefault(e); - } - finishTouch(); - }); - on(d.scroller, "touchcancel", finishTouch); - - // Sync scrolling between fake scrollbars and real scrollable - // area, ensure viewport is updated when scrolling. - on(d.scroller, "scroll", function () { - if (d.scroller.clientHeight) { - setScrollTop(cm, d.scroller.scrollTop); - setScrollLeft(cm, d.scroller.scrollLeft, true); - signal(cm, "scroll", cm); - } - }); - - // Listen to wheel events in order to try and update the viewport on time. - on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }); - on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }); - - // Prevent wrapper from ever scrolling - on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); - - d.dragFunctions = { - enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }}, - over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, - start: function (e) { return onDragStart(cm, e); }, - drop: operation(cm, onDrop), - leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} - }; - - var inp = d.input.getField(); - on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }); - on(inp, "keydown", operation(cm, onKeyDown)); - on(inp, "keypress", operation(cm, onKeyPress)); - on(inp, "focus", function (e) { return onFocus(cm, e); }); - on(inp, "blur", function (e) { return onBlur(cm, e); }); - } - - var initHooks = []; - CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); }; - - // Indent the given line. The how parameter can be "smart", - // "add"/null, "subtract", or "prev". When aggressive is false - // (typically set to true for forced single-line indents), empty - // lines are not indented, and places where the mode returns Pass - // are left alone. - function indentLine(cm, n, how, aggressive) { - var doc = cm.doc, state; - if (how == null) { how = "add"; } - if (how == "smart") { - // Fall back to "prev" when the mode doesn't have an indentation - // method. - if (!doc.mode.indent) { how = "prev"; } - else { state = getStateBefore(cm, n); } - } - - var tabSize = cm.options.tabSize; - var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); - if (line.stateAfter) { line.stateAfter = null; } - var curSpaceString = line.text.match(/^\s*/)[0], indentation; - if (!aggressive && !/\S/.test(line.text)) { - indentation = 0; - how = "not"; - } else if (how == "smart") { - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); - if (indentation == Pass || indentation > 150) { - if (!aggressive) { return } - how = "prev"; - } - } - if (how == "prev") { - if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); } - else { indentation = 0; } - } else if (how == "add") { - indentation = curSpace + cm.options.indentUnit; - } else if (how == "subtract") { - indentation = curSpace - cm.options.indentUnit; - } else if (typeof how == "number") { - indentation = curSpace + how; - } - indentation = Math.max(0, indentation); - - var indentString = "", pos = 0; - if (cm.options.indentWithTabs) - { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} } - if (pos < indentation) { indentString += spaceStr(indentation - pos); } - - if (indentString != curSpaceString) { - replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); - line.stateAfter = null; - return true - } else { - // Ensure that, if the cursor was in the whitespace at the start - // of the line, it is moved to the end of that space. - for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { - var range = doc.sel.ranges[i$1]; - if (range.head.line == n && range.head.ch < curSpaceString.length) { - var pos$1 = Pos(n, curSpaceString.length); - replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)); - break - } - } - } - } - - // This will be set to a {lineWise: bool, text: [string]} object, so - // that, when pasting, we know what kind of selections the copied - // text was made out of. - var lastCopied = null; - - function setLastCopied(newLastCopied) { - lastCopied = newLastCopied; - } - - function applyTextInput(cm, inserted, deleted, sel, origin) { - var doc = cm.doc; - cm.display.shift = false; - if (!sel) { sel = doc.sel; } - - var paste = cm.state.pasteIncoming || origin == "paste"; - var textLines = splitLinesAuto(inserted), multiPaste = null; - // When pasing N lines into N selections, insert one line per selection - if (paste && sel.ranges.length > 1) { - if (lastCopied && lastCopied.text.join("\n") == inserted) { - if (sel.ranges.length % lastCopied.text.length == 0) { - multiPaste = []; - for (var i = 0; i < lastCopied.text.length; i++) - { multiPaste.push(doc.splitLines(lastCopied.text[i])); } - } - } else if (textLines.length == sel.ranges.length) { - multiPaste = map(textLines, function (l) { return [l]; }); - } - } - - var updateInput; - // Normal behavior is to insert the new text into every selection - for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) { - var range$$1 = sel.ranges[i$1]; - var from = range$$1.from(), to = range$$1.to(); - if (range$$1.empty()) { - if (deleted && deleted > 0) // Handle deletion - { from = Pos(from.line, from.ch - deleted); } - else if (cm.state.overwrite && !paste) // Handle overwrite - { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); } - else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) - { from = to = Pos(from.line, 0); } - } - updateInput = cm.curOp.updateInput; - var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines, - origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")}; - makeChange(cm.doc, changeEvent); - signalLater(cm, "inputRead", cm, changeEvent); - } - if (inserted && !paste) - { triggerElectric(cm, inserted); } - - ensureCursorVisible(cm); - cm.curOp.updateInput = updateInput; - cm.curOp.typing = true; - cm.state.pasteIncoming = cm.state.cutIncoming = false; - } - - function handlePaste(e, cm) { - var pasted = e.clipboardData && e.clipboardData.getData("Text"); - if (pasted) { - e.preventDefault(); - if (!cm.isReadOnly() && !cm.options.disableInput) - { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); } - return true - } - } - - function triggerElectric(cm, inserted) { - // When an 'electric' character is inserted, immediately trigger a reindent - if (!cm.options.electricChars || !cm.options.smartIndent) { return } - var sel = cm.doc.sel; - - for (var i = sel.ranges.length - 1; i >= 0; i--) { - var range$$1 = sel.ranges[i]; - if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue } - var mode = cm.getModeAt(range$$1.head); - var indented = false; - if (mode.electricChars) { - for (var j = 0; j < mode.electricChars.length; j++) - { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { - indented = indentLine(cm, range$$1.head.line, "smart"); - break - } } - } else if (mode.electricInput) { - if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch))) - { indented = indentLine(cm, range$$1.head.line, "smart"); } - } - if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); } - } - } - - function copyableRanges(cm) { - var text = [], ranges = []; - for (var i = 0; i < cm.doc.sel.ranges.length; i++) { - var line = cm.doc.sel.ranges[i].head.line; - var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}; - ranges.push(lineRange); - text.push(cm.getRange(lineRange.anchor, lineRange.head)); - } - return {text: text, ranges: ranges} - } - - function disableBrowserMagic(field, spellcheck) { - field.setAttribute("autocorrect", "off"); - field.setAttribute("autocapitalize", "off"); - field.setAttribute("spellcheck", !!spellcheck); - } - - function hiddenTextarea() { - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); - var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); - // The textarea is kept positioned near the cursor to prevent the - // fact that it'll be scrolled into view on input from scrolling - // our fake cursor out of view. On webkit, when wrap=off, paste is - // very slow. So make the area wide instead. - if (webkit) { te.style.width = "1000px"; } - else { te.setAttribute("wrap", "off"); } - // If border: 0; -- iOS fails to open keyboard (issue #1287) - if (ios) { te.style.border = "1px solid black"; } - disableBrowserMagic(te); - return div - } - - // The publicly visible API. Note that methodOp(f) means - // 'wrap f in an operation, performed on its `this` parameter'. - - // This is not the complete set of editor methods. Most of the - // methods defined on the Doc type are also injected into - // CodeMirror.prototype, for backwards compatibility and - // convenience. - - var addEditorMethods = function(CodeMirror) { - var optionHandlers = CodeMirror.optionHandlers; - - var helpers = CodeMirror.helpers = {}; - - CodeMirror.prototype = { - constructor: CodeMirror, - focus: function(){window.focus(); this.display.input.focus();}, - - setOption: function(option, value) { - var options = this.options, old = options[option]; - if (options[option] == value && option != "mode") { return } - options[option] = value; - if (optionHandlers.hasOwnProperty(option)) - { operation(this, optionHandlers[option])(this, value, old); } - signal(this, "optionChange", this, option); - }, - - getOption: function(option) {return this.options[option]}, - getDoc: function() {return this.doc}, - - addKeyMap: function(map$$1, bottom) { - this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1)); - }, - removeKeyMap: function(map$$1) { - var maps = this.state.keyMaps; - for (var i = 0; i < maps.length; ++i) - { if (maps[i] == map$$1 || maps[i].name == map$$1) { - maps.splice(i, 1); - return true - } } - }, - - addOverlay: methodOp(function(spec, options) { - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); - if (mode.startState) { throw new Error("Overlays may not be stateful.") } - insertSorted(this.state.overlays, - {mode: mode, modeSpec: spec, opaque: options && options.opaque, - priority: (options && options.priority) || 0}, - function (overlay) { return overlay.priority; }); - this.state.modeGen++; - regChange(this); - }), - removeOverlay: methodOp(function(spec) { - var this$1 = this; - - var overlays = this.state.overlays; - for (var i = 0; i < overlays.length; ++i) { - var cur = overlays[i].modeSpec; - if (cur == spec || typeof spec == "string" && cur.name == spec) { - overlays.splice(i, 1); - this$1.state.modeGen++; - regChange(this$1); - return - } - } - }), - - indentLine: methodOp(function(n, dir, aggressive) { - if (typeof dir != "string" && typeof dir != "number") { - if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; } - else { dir = dir ? "add" : "subtract"; } - } - if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); } - }), - indentSelection: methodOp(function(how) { - var this$1 = this; - - var ranges = this.doc.sel.ranges, end = -1; - for (var i = 0; i < ranges.length; i++) { - var range$$1 = ranges[i]; - if (!range$$1.empty()) { - var from = range$$1.from(), to = range$$1.to(); - var start = Math.max(end, from.line); - end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; - for (var j = start; j < end; ++j) - { indentLine(this$1, j, how); } - var newRanges = this$1.doc.sel.ranges; - if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) - { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); } - } else if (range$$1.head.line > end) { - indentLine(this$1, range$$1.head.line, how, true); - end = range$$1.head.line; - if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); } - } - } - }), - - // Fetch the parser token for a given character. Useful for hacks - // that want to inspect the mode state (say, for completion). - getTokenAt: function(pos, precise) { - return takeToken(this, pos, precise) - }, - - getLineTokens: function(line, precise) { - return takeToken(this, Pos(line), precise, true) - }, - - getTokenTypeAt: function(pos) { - pos = clipPos(this.doc, pos); - var styles = getLineStyles(this, getLine(this.doc, pos.line)); - var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; - var type; - if (ch == 0) { type = styles[2]; } - else { for (;;) { - var mid = (before + after) >> 1; - if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; } - else if (styles[mid * 2 + 1] < ch) { before = mid + 1; } - else { type = styles[mid * 2 + 2]; break } - } } - var cut = type ? type.indexOf("overlay ") : -1; - return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) - }, - - getModeAt: function(pos) { - var mode = this.doc.mode; - if (!mode.innerMode) { return mode } - return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode - }, - - getHelper: function(pos, type) { - return this.getHelpers(pos, type)[0] - }, - - getHelpers: function(pos, type) { - var this$1 = this; - - var found = []; - if (!helpers.hasOwnProperty(type)) { return found } - var help = helpers[type], mode = this.getModeAt(pos); - if (typeof mode[type] == "string") { - if (help[mode[type]]) { found.push(help[mode[type]]); } - } else if (mode[type]) { - for (var i = 0; i < mode[type].length; i++) { - var val = help[mode[type][i]]; - if (val) { found.push(val); } - } - } else if (mode.helperType && help[mode.helperType]) { - found.push(help[mode.helperType]); - } else if (help[mode.name]) { - found.push(help[mode.name]); - } - for (var i$1 = 0; i$1 < help._global.length; i$1++) { - var cur = help._global[i$1]; - if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1) - { found.push(cur.val); } - } - return found - }, - - getStateAfter: function(line, precise) { - var doc = this.doc; - line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); - return getStateBefore(this, line + 1, precise) - }, - - cursorCoords: function(start, mode) { - var pos, range$$1 = this.doc.sel.primary(); - if (start == null) { pos = range$$1.head; } - else if (typeof start == "object") { pos = clipPos(this.doc, start); } - else { pos = start ? range$$1.from() : range$$1.to(); } - return cursorCoords(this, pos, mode || "page") - }, - - charCoords: function(pos, mode) { - return charCoords(this, clipPos(this.doc, pos), mode || "page") - }, - - coordsChar: function(coords, mode) { - coords = fromCoordSystem(this, coords, mode || "page"); - return coordsChar(this, coords.left, coords.top) - }, - - lineAtHeight: function(height, mode) { - height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; - return lineAtHeight(this.doc, height + this.display.viewOffset) - }, - heightAtLine: function(line, mode, includeWidgets) { - var end = false, lineObj; - if (typeof line == "number") { - var last = this.doc.first + this.doc.size - 1; - if (line < this.doc.first) { line = this.doc.first; } - else if (line > last) { line = last; end = true; } - lineObj = getLine(this.doc, line); - } else { - lineObj = line; - } - return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + - (end ? this.doc.height - heightAtLine(lineObj) : 0) - }, - - defaultTextHeight: function() { return textHeight(this.display) }, - defaultCharWidth: function() { return charWidth(this.display) }, - - getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, - - addWidget: function(pos, node, scroll, vert, horiz) { - var display = this.display; - pos = cursorCoords(this, clipPos(this.doc, pos)); - var top = pos.bottom, left = pos.left; - node.style.position = "absolute"; - node.setAttribute("cm-ignore-events", "true"); - this.display.input.setUneditable(node); - display.sizer.appendChild(node); - if (vert == "over") { - top = pos.top; - } else if (vert == "above" || vert == "near") { - var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), - hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); - // Default to positioning above (if specified and possible); otherwise default to positioning below - if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) - { top = pos.top - node.offsetHeight; } - else if (pos.bottom + node.offsetHeight <= vspace) - { top = pos.bottom; } - if (left + node.offsetWidth > hspace) - { left = hspace - node.offsetWidth; } - } - node.style.top = top + "px"; - node.style.left = node.style.right = ""; - if (horiz == "right") { - left = display.sizer.clientWidth - node.offsetWidth; - node.style.right = "0px"; - } else { - if (horiz == "left") { left = 0; } - else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; } - node.style.left = left + "px"; - } - if (scroll) - { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); } - }, - - triggerOnKeyDown: methodOp(onKeyDown), - triggerOnKeyPress: methodOp(onKeyPress), - triggerOnKeyUp: onKeyUp, - - execCommand: function(cmd) { - if (commands.hasOwnProperty(cmd)) - { return commands[cmd].call(null, this) } - }, - - triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), - - findPosH: function(from, amount, unit, visually) { - var this$1 = this; - - var dir = 1; - if (amount < 0) { dir = -1; amount = -amount; } - var cur = clipPos(this.doc, from); - for (var i = 0; i < amount; ++i) { - cur = findPosH(this$1.doc, cur, dir, unit, visually); - if (cur.hitSide) { break } - } - return cur - }, - - moveH: methodOp(function(dir, unit) { - var this$1 = this; - - this.extendSelectionsBy(function (range$$1) { - if (this$1.display.shift || this$1.doc.extend || range$$1.empty()) - { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) } - else - { return dir < 0 ? range$$1.from() : range$$1.to() } - }, sel_move); - }), - - deleteH: methodOp(function(dir, unit) { - var sel = this.doc.sel, doc = this.doc; - if (sel.somethingSelected()) - { doc.replaceSelection("", null, "+delete"); } - else - { deleteNearSelection(this, function (range$$1) { - var other = findPosH(doc, range$$1.head, dir, unit, false); - return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other} - }); } - }), - - findPosV: function(from, amount, unit, goalColumn) { - var this$1 = this; - - var dir = 1, x = goalColumn; - if (amount < 0) { dir = -1; amount = -amount; } - var cur = clipPos(this.doc, from); - for (var i = 0; i < amount; ++i) { - var coords = cursorCoords(this$1, cur, "div"); - if (x == null) { x = coords.left; } - else { coords.left = x; } - cur = findPosV(this$1, coords, dir, unit); - if (cur.hitSide) { break } - } - return cur - }, - - moveV: methodOp(function(dir, unit) { - var this$1 = this; - - var doc = this.doc, goals = []; - var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected(); - doc.extendSelectionsBy(function (range$$1) { - if (collapse) - { return dir < 0 ? range$$1.from() : range$$1.to() } - var headPos = cursorCoords(this$1, range$$1.head, "div"); - if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; } - goals.push(headPos.left); - var pos = findPosV(this$1, headPos, dir, unit); - if (unit == "page" && range$$1 == doc.sel.primary()) - { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); } - return pos - }, sel_move); - if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) - { doc.sel.ranges[i].goalColumn = goals[i]; } } - }), - - // Find the word at the given position (as returned by coordsChar). - findWordAt: function(pos) { - var doc = this.doc, line = getLine(doc, pos.line).text; - var start = pos.ch, end = pos.ch; - if (line) { - var helper = this.getHelper(pos, "wordChars"); - if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; } - var startChar = line.charAt(start); - var check = isWordChar(startChar, helper) - ? function (ch) { return isWordChar(ch, helper); } - : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } - : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }; - while (start > 0 && check(line.charAt(start - 1))) { --start; } - while (end < line.length && check(line.charAt(end))) { ++end; } - } - return new Range(Pos(pos.line, start), Pos(pos.line, end)) - }, - - toggleOverwrite: function(value) { - if (value != null && value == this.state.overwrite) { return } - if (this.state.overwrite = !this.state.overwrite) - { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); } - else - { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); } - - signal(this, "overwriteToggle", this, this.state.overwrite); - }, - hasFocus: function() { return this.display.input.getField() == activeElt() }, - isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, - - scrollTo: methodOp(function(x, y) { - if (x != null || y != null) { resolveScrollToPos(this); } - if (x != null) { this.curOp.scrollLeft = x; } - if (y != null) { this.curOp.scrollTop = y; } - }), - getScrollInfo: function() { - var scroller = this.display.scroller; - return {left: scroller.scrollLeft, top: scroller.scrollTop, - height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, - width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, - clientHeight: displayHeight(this), clientWidth: displayWidth(this)} - }, - - scrollIntoView: methodOp(function(range$$1, margin) { - if (range$$1 == null) { - range$$1 = {from: this.doc.sel.primary().head, to: null}; - if (margin == null) { margin = this.options.cursorScrollMargin; } - } else if (typeof range$$1 == "number") { - range$$1 = {from: Pos(range$$1, 0), to: null}; - } else if (range$$1.from == null) { - range$$1 = {from: range$$1, to: null}; - } - if (!range$$1.to) { range$$1.to = range$$1.from; } - range$$1.margin = margin || 0; - - if (range$$1.from.line != null) { - resolveScrollToPos(this); - this.curOp.scrollToPos = range$$1; - } else { - var sPos = calculateScrollPos(this, { - left: Math.min(range$$1.from.left, range$$1.to.left), - top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin, - right: Math.max(range$$1.from.right, range$$1.to.right), - bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin - }); - this.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - }), - - setSize: methodOp(function(width, height) { - var this$1 = this; - - var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }; - if (width != null) { this.display.wrapper.style.width = interpret(width); } - if (height != null) { this.display.wrapper.style.height = interpret(height); } - if (this.options.lineWrapping) { clearLineMeasurementCache(this); } - var lineNo$$1 = this.display.viewFrom; - this.doc.iter(lineNo$$1, this.display.viewTo, function (line) { - if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) - { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } } - ++lineNo$$1; - }); - this.curOp.forceUpdate = true; - signal(this, "refresh", this); - }), - - operation: function(f){return runInOp(this, f)}, - - refresh: methodOp(function() { - var oldHeight = this.display.cachedTextHeight; - regChange(this); - this.curOp.forceUpdate = true; - clearCaches(this); - this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop); - updateGutterSpace(this); - if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) - { estimateLineHeights(this); } - signal(this, "refresh", this); - }), - - swapDoc: methodOp(function(doc) { - var old = this.doc; - old.cm = null; - attachDoc(this, doc); - clearCaches(this); - this.display.input.reset(); - this.scrollTo(doc.scrollLeft, doc.scrollTop); - this.curOp.forceScroll = true; - signalLater(this, "swapDoc", this, old); - return old - }), - - getInputField: function(){return this.display.input.getField()}, - getWrapperElement: function(){return this.display.wrapper}, - getScrollerElement: function(){return this.display.scroller}, - getGutterElement: function(){return this.display.gutters} - }; - eventMixin(CodeMirror); - - CodeMirror.registerHelper = function(type, name, value) { - if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; } - helpers[type][name] = value; - }; - CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { - CodeMirror.registerHelper(type, name, value); - helpers[type]._global.push({pred: predicate, val: value}); - }; - }; - - // Used for horizontal relative motion. Dir is -1 or 1 (left or - // right), unit can be "char", "column" (like char, but doesn't - // cross line boundaries), "word" (across next word), or "group" (to - // the start of next group of word or non-word-non-whitespace - // chars). The visually param controls whether, in right-to-left - // text, direction 1 means to move towards the next index in the - // string, or towards the character to the right of the current - // position. The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosH(doc, pos, dir, unit, visually) { - var oldPos = pos; - var origDir = dir; - var lineObj = getLine(doc, pos.line); - function findNextLine() { - var l = pos.line + dir; - if (l < doc.first || l >= doc.first + doc.size) { return false } - pos = new Pos(l, pos.ch, pos.sticky); - return lineObj = getLine(doc, l) - } - function moveOnce(boundToLine) { - var next; - if (visually) { - next = moveVisually(doc.cm, lineObj, pos, dir); - } else { - next = moveLogically(lineObj, pos, dir); - } - if (next == null) { - if (!boundToLine && findNextLine()) - { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); } - else - { return false } - } else { - pos = next; - } - return true - } - - if (unit == "char") { - moveOnce(); - } else if (unit == "column") { - moveOnce(true); - } else if (unit == "word" || unit == "group") { - var sawType = null, group = unit == "group"; - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); - for (var first = true;; first = false) { - if (dir < 0 && !moveOnce(!first)) { break } - var cur = lineObj.text.charAt(pos.ch) || "\n"; - var type = isWordChar(cur, helper) ? "w" - : group && cur == "\n" ? "n" - : !group || /\s/.test(cur) ? null - : "p"; - if (group && !first && !type) { type = "s"; } - if (sawType && sawType != type) { - if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";} - break - } - - if (type) { sawType = type; } - if (dir > 0 && !moveOnce(!first)) { break } - } - } - var result = skipAtomic(doc, pos, oldPos, origDir, true); - if (equalCursorPos(oldPos, result)) { result.hitSide = true; } - return result - } - - // For relative vertical movement. Dir may be -1 or 1. Unit can be - // "page" or "line". The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosV(cm, pos, dir, unit) { - var doc = cm.doc, x = pos.left, y; - if (unit == "page") { - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); - var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); - y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; - - } else if (unit == "line") { - y = dir > 0 ? pos.bottom + 3 : pos.top - 3; - } - var target; - for (;;) { - target = coordsChar(cm, x, y); - if (!target.outside) { break } - if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } - y += dir * 5; - } - return target - } - - // CONTENTEDITABLE INPUT STYLE - - var ContentEditableInput = function(cm) { - this.cm = cm; - this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null; - this.polling = new Delayed(); - this.composing = null; - this.gracePeriod = false; - this.readDOMTimeout = null; - }; - - ContentEditableInput.prototype.init = function (display) { - var this$1 = this; - - var input = this, cm = input.cm; - var div = input.div = display.lineDiv; - disableBrowserMagic(div, cm.options.spellcheck); - - on(div, "paste", function (e) { - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } - // IE doesn't fire input events, so we schedule a read for the pasted content in this way - if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); } - }); - - on(div, "compositionstart", function (e) { - this$1.composing = {data: e.data, done: false}; - }); - on(div, "compositionupdate", function (e) { - if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; } - }); - on(div, "compositionend", function (e) { - if (this$1.composing) { - if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); } - this$1.composing.done = true; - } - }); - - on(div, "touchstart", function () { return input.forceCompositionEnd(); }); - - on(div, "input", function () { - if (!this$1.composing) { this$1.readFromDOMSoon(); } - }); - - function onCopyCut(e) { - if (signalDOMEvent(cm, e)) { return } - if (cm.somethingSelected()) { - setLastCopied({lineWise: false, text: cm.getSelections()}); - if (e.type == "cut") { cm.replaceSelection("", null, "cut"); } - } else if (!cm.options.lineWiseCopyCut) { - return - } else { - var ranges = copyableRanges(cm); - setLastCopied({lineWise: true, text: ranges.text}); - if (e.type == "cut") { - cm.operation(function () { - cm.setSelections(ranges.ranges, 0, sel_dontScroll); - cm.replaceSelection("", null, "cut"); - }); - } - } - if (e.clipboardData) { - e.clipboardData.clearData(); - var content = lastCopied.text.join("\n"); - // iOS exposes the clipboard API, but seems to discard content inserted into it - e.clipboardData.setData("Text", content); - if (e.clipboardData.getData("Text") == content) { - e.preventDefault(); - return - } - } - // Old-fashioned briefly-focus-a-textarea hack - var kludge = hiddenTextarea(), te = kludge.firstChild; - cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); - te.value = lastCopied.text.join("\n"); - var hadFocus = document.activeElement; - selectInput(te); - setTimeout(function () { - cm.display.lineSpace.removeChild(kludge); - hadFocus.focus(); - if (hadFocus == div) { input.showPrimarySelection(); } - }, 50); - } - on(div, "copy", onCopyCut); - on(div, "cut", onCopyCut); - }; - - ContentEditableInput.prototype.prepareSelection = function () { - var result = prepareSelection(this.cm, false); - result.focus = this.cm.state.focused; - return result - }; - - ContentEditableInput.prototype.showSelection = function (info, takeFocus) { - if (!info || !this.cm.display.view.length) { return } - if (info.focus || takeFocus) { this.showPrimarySelection(); } - this.showMultipleSelections(info); - }; - - ContentEditableInput.prototype.showPrimarySelection = function () { - var sel = window.getSelection(), prim = this.cm.doc.sel.primary(); - var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset); - var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset); - if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && - cmp(minPos(curAnchor, curFocus), prim.from()) == 0 && - cmp(maxPos(curAnchor, curFocus), prim.to()) == 0) - { return } - - var start = posToDOM(this.cm, prim.from()); - var end = posToDOM(this.cm, prim.to()); - if (!start && !end) { - sel.removeAllRanges(); - return - } - - var view = this.cm.display.view; - var old = sel.rangeCount && sel.getRangeAt(0); - if (!start) { - start = {node: view[0].measure.map[2], offset: 0}; - } else if (!end) { // FIXME dangerously hacky - var measure = view[view.length - 1].measure; - var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map; - end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]}; - } - - var rng; - try { rng = range(start.node, start.offset, end.offset, end.node); } - catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible - if (rng) { - if (!gecko && this.cm.state.focused) { - sel.collapse(start.node, start.offset); - if (!rng.collapsed) { - sel.removeAllRanges(); - sel.addRange(rng); - } - } else { - sel.removeAllRanges(); - sel.addRange(rng); - } - if (old && sel.anchorNode == null) { sel.addRange(old); } - else if (gecko) { this.startGracePeriod(); } - } - this.rememberSelection(); - }; - - ContentEditableInput.prototype.startGracePeriod = function () { - var this$1 = this; - - clearTimeout(this.gracePeriod); - this.gracePeriod = setTimeout(function () { - this$1.gracePeriod = false; - if (this$1.selectionChanged()) - { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); } - }, 20); - }; - - ContentEditableInput.prototype.showMultipleSelections = function (info) { - removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors); - removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection); - }; - - ContentEditableInput.prototype.rememberSelection = function () { - var sel = window.getSelection(); - this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset; - this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset; - }; - - ContentEditableInput.prototype.selectionInEditor = function () { - var sel = window.getSelection(); - if (!sel.rangeCount) { return false } - var node = sel.getRangeAt(0).commonAncestorContainer; - return contains(this.div, node) - }; - - ContentEditableInput.prototype.focus = function () { - if (this.cm.options.readOnly != "nocursor") { - if (!this.selectionInEditor()) - { this.showSelection(this.prepareSelection(), true); } - this.div.focus(); - } - }; - ContentEditableInput.prototype.blur = function () { this.div.blur(); }; - ContentEditableInput.prototype.getField = function () { return this.div }; - - ContentEditableInput.prototype.supportsTouch = function () { return true }; - - ContentEditableInput.prototype.receivedFocus = function () { - var input = this; - if (this.selectionInEditor()) - { this.pollSelection(); } - else - { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } - - function poll() { - if (input.cm.state.focused) { - input.pollSelection(); - input.polling.set(input.cm.options.pollInterval, poll); - } - } - this.polling.set(this.cm.options.pollInterval, poll); - }; - - ContentEditableInput.prototype.selectionChanged = function () { - var sel = window.getSelection(); - return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || - sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset - }; - - ContentEditableInput.prototype.pollSelection = function () { - if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return } - var sel = window.getSelection(), cm = this.cm; - // On Android Chrome (version 56, at least), backspacing into an - // uneditable block element will put the cursor in that element, - // and then, because it's not editable, hide the virtual keyboard. - // Because Android doesn't allow us to actually detect backspace - // presses in a sane way, this code checks for when that happens - // and simulates a backspace press in this case. - if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) { - this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs}); - this.blur(); - this.focus(); - return - } - if (this.composing) { return } - this.rememberSelection(); - var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset); - var head = domToPos(cm, sel.focusNode, sel.focusOffset); - if (anchor && head) { runInOp(cm, function () { - setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll); - if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; } - }); } - }; - - ContentEditableInput.prototype.pollContent = function () { - if (this.readDOMTimeout != null) { - clearTimeout(this.readDOMTimeout); - this.readDOMTimeout = null; - } - - var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary(); - var from = sel.from(), to = sel.to(); - if (from.ch == 0 && from.line > cm.firstLine()) - { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); } - if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) - { to = Pos(to.line + 1, 0); } - if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false } - - var fromIndex, fromLine, fromNode; - if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { - fromLine = lineNo(display.view[0].line); - fromNode = display.view[0].node; - } else { - fromLine = lineNo(display.view[fromIndex].line); - fromNode = display.view[fromIndex - 1].node.nextSibling; - } - var toIndex = findViewIndex(cm, to.line); - var toLine, toNode; - if (toIndex == display.view.length - 1) { - toLine = display.viewTo - 1; - toNode = display.lineDiv.lastChild; - } else { - toLine = lineNo(display.view[toIndex + 1].line) - 1; - toNode = display.view[toIndex + 1].node.previousSibling; - } - - if (!fromNode) { return false } - var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)); - var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)); - while (newText.length > 1 && oldText.length > 1) { - if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; } - else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; } - else { break } - } - - var cutFront = 0, cutEnd = 0; - var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length); - while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) - { ++cutFront; } - var newBot = lst(newText), oldBot = lst(oldText); - var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), - oldBot.length - (oldText.length == 1 ? cutFront : 0)); - while (cutEnd < maxCutEnd && - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) - { ++cutEnd; } - // Try to move start of change to start of selection if ambiguous - if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) { - while (cutFront && cutFront > from.ch && - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) { - cutFront--; - cutEnd++; - } - } - - newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, ""); - newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, ""); - - var chFrom = Pos(fromLine, cutFront); - var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0); - if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { - replaceRange(cm.doc, newText, chFrom, chTo, "+input"); - return true - } - }; - - ContentEditableInput.prototype.ensurePolled = function () { - this.forceCompositionEnd(); - }; - ContentEditableInput.prototype.reset = function () { - this.forceCompositionEnd(); - }; - ContentEditableInput.prototype.forceCompositionEnd = function () { - if (!this.composing) { return } - clearTimeout(this.readDOMTimeout); - this.composing = null; - this.updateFromDOM(); - this.div.blur(); - this.div.focus(); - }; - ContentEditableInput.prototype.readFromDOMSoon = function () { - var this$1 = this; - - if (this.readDOMTimeout != null) { return } - this.readDOMTimeout = setTimeout(function () { - this$1.readDOMTimeout = null; - if (this$1.composing) { - if (this$1.composing.done) { this$1.composing = null; } - else { return } - } - this$1.updateFromDOM(); - }, 80); - }; - - ContentEditableInput.prototype.updateFromDOM = function () { - var this$1 = this; - - if (this.cm.isReadOnly() || !this.pollContent()) - { runInOp(this.cm, function () { return regChange(this$1.cm); }); } - }; - - ContentEditableInput.prototype.setUneditable = function (node) { - node.contentEditable = "false"; - }; - - ContentEditableInput.prototype.onKeyPress = function (e) { - if (e.charCode == 0) { return } - e.preventDefault(); - if (!this.cm.isReadOnly()) - { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); } - }; - - ContentEditableInput.prototype.readOnlyChanged = function (val) { - this.div.contentEditable = String(val != "nocursor"); - }; - - ContentEditableInput.prototype.onContextMenu = function () {}; - ContentEditableInput.prototype.resetPosition = function () {}; - - ContentEditableInput.prototype.needsContentAttribute = true; - - function posToDOM(cm, pos) { - var view = findViewForLine(cm, pos.line); - if (!view || view.hidden) { return null } - var line = getLine(cm.doc, pos.line); - var info = mapFromLineView(view, line, pos.line); - - var order = getOrder(line, cm.doc.direction), side = "left"; - if (order) { - var partPos = getBidiPartAt(order, pos.ch); - side = partPos % 2 ? "right" : "left"; - } - var result = nodeAndOffsetInLineMap(info.map, pos.ch, side); - result.offset = result.collapse == "right" ? result.end : result.start; - return result - } - - function isInGutter(node) { - for (var scan = node; scan; scan = scan.parentNode) - { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } } - return false - } - - function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos } - - function domTextBetween(cm, from, to, fromLine, toLine) { - var text = "", closing = false, lineSep = cm.doc.lineSeparator(); - function recognizeMarker(id) { return function (marker) { return marker.id == id; } } - function close() { - if (closing) { - text += lineSep; - closing = false; - } - } - function addText(str) { - if (str) { - close(); - text += str; - } - } - function walk(node) { - if (node.nodeType == 1) { - var cmText = node.getAttribute("cm-text"); - if (cmText != null) { - addText(cmText || node.textContent.replace(/\u200b/g, "")); - return - } - var markerID = node.getAttribute("cm-marker"), range$$1; - if (markerID) { - var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)); - if (found.length && (range$$1 = found[0].find())) - { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); } - return - } - if (node.getAttribute("contenteditable") == "false") { return } - var isBlock = /^(pre|div|p)$/i.test(node.nodeName); - if (isBlock) { close(); } - for (var i = 0; i < node.childNodes.length; i++) - { walk(node.childNodes[i]); } - if (isBlock) { closing = true; } - } else if (node.nodeType == 3) { - addText(node.nodeValue); - } - } - for (;;) { - walk(from); - if (from == to) { break } - from = from.nextSibling; - } - return text - } - - function domToPos(cm, node, offset) { - var lineNode; - if (node == cm.display.lineDiv) { - lineNode = cm.display.lineDiv.childNodes[offset]; - if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) } - node = null; offset = 0; - } else { - for (lineNode = node;; lineNode = lineNode.parentNode) { - if (!lineNode || lineNode == cm.display.lineDiv) { return null } - if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break } - } - } - for (var i = 0; i < cm.display.view.length; i++) { - var lineView = cm.display.view[i]; - if (lineView.node == lineNode) - { return locateNodeInLineView(lineView, node, offset) } - } - } - - function locateNodeInLineView(lineView, node, offset) { - var wrapper = lineView.text.firstChild, bad = false; - if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) } - if (node == wrapper) { - bad = true; - node = wrapper.childNodes[offset]; - offset = 0; - if (!node) { - var line = lineView.rest ? lst(lineView.rest) : lineView.line; - return badPos(Pos(lineNo(line), line.text.length), bad) - } - } - - var textNode = node.nodeType == 3 ? node : null, topNode = node; - if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { - textNode = node.firstChild; - if (offset) { offset = textNode.nodeValue.length; } - } - while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; } - var measure = lineView.measure, maps = measure.maps; - - function find(textNode, topNode, offset) { - for (var i = -1; i < (maps ? maps.length : 0); i++) { - var map$$1 = i < 0 ? measure.map : maps[i]; - for (var j = 0; j < map$$1.length; j += 3) { - var curNode = map$$1[j + 2]; - if (curNode == textNode || curNode == topNode) { - var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]); - var ch = map$$1[j] + offset; - if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; } - return Pos(line, ch) - } - } - } - } - var found = find(textNode, topNode, offset); - if (found) { return badPos(found, bad) } - - // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems - for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { - found = find(after, after.firstChild, 0); - if (found) - { return badPos(Pos(found.line, found.ch - dist), bad) } - else - { dist += after.textContent.length; } - } - for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) { - found = find(before, before.firstChild, -1); - if (found) - { return badPos(Pos(found.line, found.ch + dist$1), bad) } - else - { dist$1 += before.textContent.length; } - } - } - - // TEXTAREA INPUT STYLE - - var TextareaInput = function(cm) { - this.cm = cm; - // See input.poll and input.reset - this.prevInput = ""; - - // Flag that indicates whether we expect input to appear real soon - // now (after some event like 'keypress' or 'input') and are - // polling intensively. - this.pollingFast = false; - // Self-resetting timeout for the poller - this.polling = new Delayed(); - // Tracks when input.reset has punted to just putting a short - // string into the textarea instead of the full selection. - this.inaccurateSelection = false; - // Used to work around IE issue with selection being forgotten when focus moves away from textarea - this.hasSelection = false; - this.composing = null; - }; - - TextareaInput.prototype.init = function (display) { - var this$1 = this; - - var input = this, cm = this.cm; - - // Wraps and hides input textarea - var div = this.wrapper = hiddenTextarea(); - // The semihidden textarea that is focused when the editor is - // focused, and receives input. - var te = this.textarea = div.firstChild; - display.wrapper.insertBefore(div, display.wrapper.firstChild); - - // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) - if (ios) { te.style.width = "0px"; } - - on(te, "input", function () { - if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; } - input.poll(); - }); - - on(te, "paste", function (e) { - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } - - cm.state.pasteIncoming = true; - input.fastPoll(); - }); - - function prepareCopyCut(e) { - if (signalDOMEvent(cm, e)) { return } - if (cm.somethingSelected()) { - setLastCopied({lineWise: false, text: cm.getSelections()}); - if (input.inaccurateSelection) { - input.prevInput = ""; - input.inaccurateSelection = false; - te.value = lastCopied.text.join("\n"); - selectInput(te); - } - } else if (!cm.options.lineWiseCopyCut) { - return - } else { - var ranges = copyableRanges(cm); - setLastCopied({lineWise: true, text: ranges.text}); - if (e.type == "cut") { - cm.setSelections(ranges.ranges, null, sel_dontScroll); - } else { - input.prevInput = ""; - te.value = ranges.text.join("\n"); - selectInput(te); - } - } - if (e.type == "cut") { cm.state.cutIncoming = true; } - } - on(te, "cut", prepareCopyCut); - on(te, "copy", prepareCopyCut); - - on(display.scroller, "paste", function (e) { - if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return } - cm.state.pasteIncoming = true; - input.focus(); - }); - - // Prevent normal selection in the editor (we handle our own) - on(display.lineSpace, "selectstart", function (e) { - if (!eventInWidget(display, e)) { e_preventDefault(e); } - }); - - on(te, "compositionstart", function () { - var start = cm.getCursor("from"); - if (input.composing) { input.composing.range.clear(); } - input.composing = { - start: start, - range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) - }; - }); - on(te, "compositionend", function () { - if (input.composing) { - input.poll(); - input.composing.range.clear(); - input.composing = null; - } - }); - }; - - TextareaInput.prototype.prepareSelection = function () { - // Redraw the selection and/or cursor - var cm = this.cm, display = cm.display, doc = cm.doc; - var result = prepareSelection(cm); - - // Move the hidden textarea near the cursor to prevent scrolling artifacts - if (cm.options.moveInputWithCursor) { - var headPos = cursorCoords(cm, doc.sel.primary().head, "div"); - var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect(); - result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, - headPos.top + lineOff.top - wrapOff.top)); - result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, - headPos.left + lineOff.left - wrapOff.left)); - } - - return result - }; - - TextareaInput.prototype.showSelection = function (drawn) { - var cm = this.cm, display = cm.display; - removeChildrenAndAdd(display.cursorDiv, drawn.cursors); - removeChildrenAndAdd(display.selectionDiv, drawn.selection); - if (drawn.teTop != null) { - this.wrapper.style.top = drawn.teTop + "px"; - this.wrapper.style.left = drawn.teLeft + "px"; - } - }; - - // Reset the input to correspond to the selection (or to be empty, - // when not typing and nothing is selected) - TextareaInput.prototype.reset = function (typing) { - if (this.contextMenuPending) { return } - var minimal, selected, cm = this.cm, doc = cm.doc; - if (cm.somethingSelected()) { - this.prevInput = ""; - var range$$1 = doc.sel.primary(); - minimal = hasCopyEvent && - (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000); - var content = minimal ? "-" : selected || cm.getSelection(); - this.textarea.value = content; - if (cm.state.focused) { selectInput(this.textarea); } - if (ie && ie_version >= 9) { this.hasSelection = content; } - } else if (!typing) { - this.prevInput = this.textarea.value = ""; - if (ie && ie_version >= 9) { this.hasSelection = null; } - } - this.inaccurateSelection = minimal; - }; - - TextareaInput.prototype.getField = function () { return this.textarea }; - - TextareaInput.prototype.supportsTouch = function () { return false }; - - TextareaInput.prototype.focus = function () { - if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { - try { this.textarea.focus(); } - catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM - } - }; - - TextareaInput.prototype.blur = function () { this.textarea.blur(); }; - - TextareaInput.prototype.resetPosition = function () { - this.wrapper.style.top = this.wrapper.style.left = 0; - }; - - TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); }; - - // Poll for input changes, using the normal rate of polling. This - // runs as long as the editor is focused. - TextareaInput.prototype.slowPoll = function () { - var this$1 = this; - - if (this.pollingFast) { return } - this.polling.set(this.cm.options.pollInterval, function () { - this$1.poll(); - if (this$1.cm.state.focused) { this$1.slowPoll(); } - }); - }; - - // When an event has just come in that is likely to add or change - // something in the input textarea, we poll faster, to ensure that - // the change appears on the screen quickly. - TextareaInput.prototype.fastPoll = function () { - var missed = false, input = this; - input.pollingFast = true; - function p() { - var changed = input.poll(); - if (!changed && !missed) {missed = true; input.polling.set(60, p);} - else {input.pollingFast = false; input.slowPoll();} - } - input.polling.set(20, p); - }; - - // Read input from the textarea, and update the document to match. - // When something is selected, it is present in the textarea, and - // selected (unless it is huge, in which case a placeholder is - // used). When nothing is selected, the cursor sits after previously - // seen text (can be empty), which is stored in prevInput (we must - // not reset the textarea when typing, because that breaks IME). - TextareaInput.prototype.poll = function () { - var this$1 = this; - - var cm = this.cm, input = this.textarea, prevInput = this.prevInput; - // Since this is called a *lot*, try to bail out as cheaply as - // possible when it is clear that nothing happened. hasSelection - // will be the case when there is a lot of text in the textarea, - // in which case reading its value would be expensive. - if (this.contextMenuPending || !cm.state.focused || - (hasSelection(input) && !prevInput && !this.composing) || - cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) - { return false } - - var text = input.value; - // If nothing changed, bail. - if (text == prevInput && !cm.somethingSelected()) { return false } - // Work around nonsensical selection resetting in IE9/10, and - // inexplicable appearance of private area unicode characters on - // some key combos in Mac (#2689). - if (ie && ie_version >= 9 && this.hasSelection === text || - mac && /[\uf700-\uf7ff]/.test(text)) { - cm.display.input.reset(); - return false - } - - if (cm.doc.sel == cm.display.selForContextMenu) { - var first = text.charCodeAt(0); - if (first == 0x200b && !prevInput) { prevInput = "\u200b"; } - if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") } - } - // Find the part of the input that is actually new - var same = 0, l = Math.min(prevInput.length, text.length); - while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; } - - runInOp(cm, function () { - applyTextInput(cm, text.slice(same), prevInput.length - same, - null, this$1.composing ? "*compose" : null); - - // Don't leave long text in the textarea, since it makes further polling slow - if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; } - else { this$1.prevInput = text; } - - if (this$1.composing) { - this$1.composing.range.clear(); - this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"), - {className: "CodeMirror-composing"}); - } - }); - return true - }; - - TextareaInput.prototype.ensurePolled = function () { - if (this.pollingFast && this.poll()) { this.pollingFast = false; } - }; - - TextareaInput.prototype.onKeyPress = function () { - if (ie && ie_version >= 9) { this.hasSelection = null; } - this.fastPoll(); - }; - - TextareaInput.prototype.onContextMenu = function (e) { - var input = this, cm = input.cm, display = cm.display, te = input.textarea; - var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; - if (!pos || presto) { return } // Opera is difficult. - - // Reset the current text selection only if the click is done outside of the selection - // and 'resetSelectionOnContextMenu' option is true. - var reset = cm.options.resetSelectionOnContextMenu; - if (reset && cm.doc.sel.contains(pos) == -1) - { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); } - - var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText; - input.wrapper.style.cssText = "position: absolute"; - var wrapperBox = input.wrapper.getBoundingClientRect(); - te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; - var oldScrollY; - if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712) - display.input.focus(); - if (webkit) { window.scrollTo(null, oldScrollY); } - display.input.reset(); - // Adds "Select all" to context menu in FF - if (!cm.somethingSelected()) { te.value = input.prevInput = " "; } - input.contextMenuPending = true; - display.selForContextMenu = cm.doc.sel; - clearTimeout(display.detectingSelectAll); - - // Select-all will be greyed out if there's nothing to select, so - // this adds a zero-width space so that we can later check whether - // it got selected. - function prepareSelectAllHack() { - if (te.selectionStart != null) { - var selected = cm.somethingSelected(); - var extval = "\u200b" + (selected ? te.value : ""); - te.value = "\u21da"; // Used to catch context-menu undo - te.value = extval; - input.prevInput = selected ? "" : "\u200b"; - te.selectionStart = 1; te.selectionEnd = extval.length; - // Re-set this, in case some other handler touched the - // selection in the meantime. - display.selForContextMenu = cm.doc.sel; - } - } - function rehide() { - input.contextMenuPending = false; - input.wrapper.style.cssText = oldWrapperCSS; - te.style.cssText = oldCSS; - if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); } - - // Try to detect the user choosing select-all - if (te.selectionStart != null) { - if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); } - var i = 0, poll = function () { - if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && - te.selectionEnd > 0 && input.prevInput == "\u200b") { - operation(cm, selectAll)(cm); - } else if (i++ < 10) { - display.detectingSelectAll = setTimeout(poll, 500); - } else { - display.selForContextMenu = null; - display.input.reset(); - } - }; - display.detectingSelectAll = setTimeout(poll, 200); - } - } - - if (ie && ie_version >= 9) { prepareSelectAllHack(); } - if (captureRightClick) { - e_stop(e); - var mouseup = function () { - off(window, "mouseup", mouseup); - setTimeout(rehide, 20); - }; - on(window, "mouseup", mouseup); - } else { - setTimeout(rehide, 50); - } - }; - - TextareaInput.prototype.readOnlyChanged = function (val) { - if (!val) { this.reset(); } - }; - - TextareaInput.prototype.setUneditable = function () {}; - - TextareaInput.prototype.needsContentAttribute = false; - - function fromTextArea(textarea, options) { - options = options ? copyObj(options) : {}; - options.value = textarea.value; - if (!options.tabindex && textarea.tabIndex) - { options.tabindex = textarea.tabIndex; } - if (!options.placeholder && textarea.placeholder) - { options.placeholder = textarea.placeholder; } - // Set autofocus to true if this textarea is focused, or if it has - // autofocus and no other element is focused. - if (options.autofocus == null) { - var hasFocus = activeElt(); - options.autofocus = hasFocus == textarea || - textarea.getAttribute("autofocus") != null && hasFocus == document.body; - } - - function save() {textarea.value = cm.getValue();} - - var realSubmit; - if (textarea.form) { - on(textarea.form, "submit", save); - // Deplorable hack to make the submit method do the right thing. - if (!options.leaveSubmitMethodAlone) { - var form = textarea.form; - realSubmit = form.submit; - try { - var wrappedSubmit = form.submit = function () { - save(); - form.submit = realSubmit; - form.submit(); - form.submit = wrappedSubmit; - }; - } catch(e) {} - } - } - - options.finishInit = function (cm) { - cm.save = save; - cm.getTextArea = function () { return textarea; }; - cm.toTextArea = function () { - cm.toTextArea = isNaN; // Prevent this from being ran twice - save(); - textarea.parentNode.removeChild(cm.getWrapperElement()); - textarea.style.display = ""; - if (textarea.form) { - off(textarea.form, "submit", save); - if (typeof textarea.form.submit == "function") - { textarea.form.submit = realSubmit; } - } - }; - }; - - textarea.style.display = "none"; - var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); }, - options); - return cm - } - - function addLegacyProps(CodeMirror) { - CodeMirror.off = off; - CodeMirror.on = on; - CodeMirror.wheelEventPixels = wheelEventPixels; - CodeMirror.Doc = Doc; - CodeMirror.splitLines = splitLinesAuto; - CodeMirror.countColumn = countColumn; - CodeMirror.findColumn = findColumn; - CodeMirror.isWordChar = isWordCharBasic; - CodeMirror.Pass = Pass; - CodeMirror.signal = signal; - CodeMirror.Line = Line; - CodeMirror.changeEnd = changeEnd; - CodeMirror.scrollbarModel = scrollbarModel; - CodeMirror.Pos = Pos; - CodeMirror.cmpPos = cmp; - CodeMirror.modes = modes; - CodeMirror.mimeModes = mimeModes; - CodeMirror.resolveMode = resolveMode; - CodeMirror.getMode = getMode; - CodeMirror.modeExtensions = modeExtensions; - CodeMirror.extendMode = extendMode; - CodeMirror.copyState = copyState; - CodeMirror.startState = startState; - CodeMirror.innerMode = innerMode; - CodeMirror.commands = commands; - CodeMirror.keyMap = keyMap; - CodeMirror.keyName = keyName; - CodeMirror.isModifierKey = isModifierKey; - CodeMirror.lookupKey = lookupKey; - CodeMirror.normalizeKeyMap = normalizeKeyMap; - CodeMirror.StringStream = StringStream; - CodeMirror.SharedTextMarker = SharedTextMarker; - CodeMirror.TextMarker = TextMarker; - CodeMirror.LineWidget = LineWidget; - CodeMirror.e_preventDefault = e_preventDefault; - CodeMirror.e_stopPropagation = e_stopPropagation; - CodeMirror.e_stop = e_stop; - CodeMirror.addClass = addClass; - CodeMirror.contains = contains; - CodeMirror.rmClass = rmClass; - CodeMirror.keyNames = keyNames; - } - - // EDITOR CONSTRUCTOR - - defineOptions(CodeMirror$1); - - addEditorMethods(CodeMirror$1); - - // Set up methods on CodeMirror's prototype to redirect to the editor's document. - var dontDelegate = "iter insert remove copy getEditor constructor".split(" "); - for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) - { CodeMirror$1.prototype[prop] = (function(method) { - return function() {return method.apply(this.doc, arguments)} - })(Doc.prototype[prop]); } } - - eventMixin(Doc); - - // INPUT HANDLING - - CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}; - - // MODE DEFINITION AND QUERYING - - // Extra arguments are stored as the mode's dependencies, which is - // used by (legacy) mechanisms like loadmode.js to automatically - // load a mode. (Preferred mechanism is the require/define calls.) - CodeMirror$1.defineMode = function(name/*, mode, …*/) { - if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; } - defineMode.apply(this, arguments); - }; - - CodeMirror$1.defineMIME = defineMIME; - - // Minimal default mode. - CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }); - CodeMirror$1.defineMIME("text/plain", "null"); - - // EXTENSIONS - - CodeMirror$1.defineExtension = function (name, func) { - CodeMirror$1.prototype[name] = func; - }; - CodeMirror$1.defineDocExtension = function (name, func) { - Doc.prototype[name] = func; - }; - - CodeMirror$1.fromTextArea = fromTextArea; - - addLegacyProps(CodeMirror$1); - - CodeMirror$1.version = "5.25.0"; - - return CodeMirror$1; - - }))); - - -/***/ }, -/* 307 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, +/* 306 */, +/* 307 */, /* 308 */, -/* 309 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - function expressionAllowed(stream, state, backUp) { - return /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) || - (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)))) - } - - CodeMirror.defineMode("javascript", function(config, parserConfig) { - var indentUnit = config.indentUnit; - var statementIndent = parserConfig.statementIndent; - var jsonldMode = parserConfig.jsonld; - var jsonMode = parserConfig.json || jsonldMode; - var isTS = parserConfig.typescript; - var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; - - // Tokenizer - - var keywords = function(){ - function kw(type) {return {type: type, style: "keyword"};} - var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); - var operator = kw("operator"), atom = {type: "atom", style: "atom"}; - - var jsKeywords = { - "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, - "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C, - "var": kw("var"), "const": kw("var"), "let": kw("var"), - "function": kw("function"), "catch": kw("catch"), - "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), - "in": operator, "typeof": operator, "instanceof": operator, - "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, - "this": kw("this"), "class": kw("class"), "super": kw("atom"), - "yield": C, "export": kw("export"), "import": kw("import"), "extends": C, - "await": C, "async": kw("async") - }; - - // Extend the 'normal' keywords with the TypeScript language extensions - if (isTS) { - var type = {type: "variable", style: "variable-3"}; - var tsKeywords = { - // object-like things - "interface": kw("class"), - "implements": C, - "namespace": C, - "module": kw("module"), - "enum": kw("module"), - "type": kw("type"), - - // scope modifiers - "public": kw("modifier"), - "private": kw("modifier"), - "protected": kw("modifier"), - "abstract": kw("modifier"), - - // operators - "as": operator, - - // types - "string": type, "number": type, "boolean": type, "any": type - }; - - for (var attr in tsKeywords) { - jsKeywords[attr] = tsKeywords[attr]; - } - } - - return jsKeywords; - }(); - - var isOperatorChar = /[+\-*&%=<>!?|~^]/; - var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; - - function readRegexp(stream) { - var escaped = false, next, inSet = false; - while ((next = stream.next()) != null) { - if (!escaped) { - if (next == "/" && !inSet) return; - if (next == "[") inSet = true; - else if (inSet && next == "]") inSet = false; - } - escaped = !escaped && next == "\\"; - } - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == '"' || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { - return ret("number", "number"); - } else if (ch == "." && stream.match("..")) { - return ret("spread", "meta"); - } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return ret(ch); - } else if (ch == "=" && stream.eat(">")) { - return ret("=>", "operator"); - } else if (ch == "0" && stream.eat(/x/i)) { - stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); - } else if (ch == "0" && stream.eat(/o/i)) { - stream.eatWhile(/[0-7]/i); - return ret("number", "number"); - } else if (ch == "0" && stream.eat(/b/i)) { - stream.eatWhile(/[01]/i); - return ret("number", "number"); - } else if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); - return ret("number", "number"); - } else if (ch == "/") { - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } else if (stream.eat("/")) { - stream.skipToEnd(); - return ret("comment", "comment"); - } else if (expressionAllowed(stream, state, 1)) { - readRegexp(stream); - stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); - return ret("regexp", "string-2"); - } else { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } - } else if (ch == "`") { - state.tokenize = tokenQuasi; - return tokenQuasi(stream, state); - } else if (ch == "#") { - stream.skipToEnd(); - return ret("error", "error"); - } else if (isOperatorChar.test(ch)) { - if (ch != ">" || !state.lexical || state.lexical.type != ">") - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } else if (wordRE.test(ch)) { - stream.eatWhile(wordRE); - var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; - return (known && state.lastType != ".") ? ret(known.type, known.style, word) : - ret("variable", "variable", word); - } - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next; - if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){ - state.tokenize = tokenBase; - return ret("jsonld-keyword", "meta"); - } - while ((next = stream.next()) != null) { - if (next == quote && !escaped) break; - escaped = !escaped && next == "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return ret("comment", "comment"); - } - - function tokenQuasi(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { - state.tokenize = tokenBase; - break; - } - escaped = !escaped && next == "\\"; - } - return ret("quasi", "string-2", stream.current()); - } - - var brackets = "([{}])"; - // This is a crude lookahead trick to try and notice that we're - // parsing the argument patterns for a fat-arrow function before we - // actually hit the arrow token. It only works if the arrow is on - // the same line as the arguments and there's no strange noise - // (comments) in between. Fallback is to only notice when we hit the - // arrow, and not declare the arguments as locals for the arrow - // body. - function findFatArrow(stream, state) { - if (state.fatArrowAt) state.fatArrowAt = null; - var arrow = stream.string.indexOf("=>", stream.start); - if (arrow < 0) return; - - if (isTS) { // Try to skip TypeScript return type declarations after the arguments - var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) - if (m) arrow = m.index - } - - var depth = 0, sawSomething = false; - for (var pos = arrow - 1; pos >= 0; --pos) { - var ch = stream.string.charAt(pos); - var bracket = brackets.indexOf(ch); - if (bracket >= 0 && bracket < 3) { - if (!depth) { ++pos; break; } - if (--depth == 0) { if (ch == "(") sawSomething = true; break; } - } else if (bracket >= 3 && bracket < 6) { - ++depth; - } else if (wordRE.test(ch)) { - sawSomething = true; - } else if (/["'\/]/.test(ch)) { - return; - } else if (sawSomething && !depth) { - ++pos; - break; - } - } - if (sawSomething && !depth) state.fatArrowAt = pos; - } - - // Parser - - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; - - function JSLexical(indented, column, type, align, prev, info) { - this.indented = indented; - this.column = column; - this.type = type; - this.prev = prev; - this.info = info; - if (align != null) this.align = align; - } - - function inScope(state, varname) { - for (var v = state.localVars; v; v = v.next) - if (v.name == varname) return true; - for (var cx = state.context; cx; cx = cx.prev) { - for (var v = cx.vars; v; v = v.next) - if (v.name == varname) return true; - } - } - - function parseJS(state, style, type, content, stream) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; - - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - - while(true) { - var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; - if (combinator(type, content)) { - while(cc.length && cc[cc.length - 1].lex) - cc.pop()(); - if (cx.marked) return cx.marked; - if (type == "variable" && inScope(state, content)) return "variable-2"; - return style; - } - } - } - - // Combinator utils - - var cx = {state: null, column: null, marked: null, cc: null}; - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - function cont() { - pass.apply(null, arguments); - return true; - } - function register(varname) { - function inList(list) { - for (var v = list; v; v = v.next) - if (v.name == varname) return true; - return false; - } - var state = cx.state; - cx.marked = "def"; - if (state.context) { - if (inList(state.localVars)) return; - state.localVars = {name: varname, next: state.localVars}; - } else { - if (inList(state.globalVars)) return; - if (parserConfig.globalVars) - state.globalVars = {name: varname, next: state.globalVars}; - } - } - - // Combinators - - var defaultVars = {name: "this", next: {name: "arguments"}}; - function pushcontext() { - cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; - cx.state.localVars = defaultVars; - } - function popcontext() { - cx.state.localVars = cx.state.context.vars; - cx.state.context = cx.state.context.prev; - } - function pushlex(type, info) { - var result = function() { - var state = cx.state, indent = state.indented; - if (state.lexical.type == "stat") indent = state.lexical.indented; - else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) - indent = outer.indented; - state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); - }; - result.lex = true; - return result; - } - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type == ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - poplex.lex = true; - - function expect(wanted) { - function exp(type) { - if (type == wanted) return cont(); - else if (wanted == ";") return pass(); - else return cont(exp); - }; - return exp; - } - - function statement(type, value) { - if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); - if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); - if (type == "keyword b") return cont(pushlex("form"), statement, poplex); - if (type == "{") return cont(pushlex("}"), block, poplex); - if (type == ";") return cont(); - if (type == "if") { - if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) - cx.state.cc.pop()(); - return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); - } - if (type == "function") return cont(functiondef); - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); - if (type == "variable") return cont(pushlex("stat"), maybelabel); - if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"), - block, poplex, poplex); - if (type == "case") return cont(expression, expect(":")); - if (type == "default") return cont(expect(":")); - if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), - statement, poplex, popcontext); - if (type == "class") return cont(pushlex("form"), className, poplex); - if (type == "export") return cont(pushlex("stat"), afterExport, poplex); - if (type == "import") return cont(pushlex("stat"), afterImport, poplex); - if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex) - if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";")); - if (type == "async") return cont(statement) - return pass(pushlex("stat"), expression, expect(";"), poplex); - } - function expression(type) { - return expressionInner(type, false); - } - function expressionNoComma(type) { - return expressionInner(type, true); - } - function parenExpr(type) { - if (type != "(") return pass() - return cont(pushlex(")"), expression, expect(")"), poplex) - } - function expressionInner(type, noComma) { - if (cx.state.fatArrowAt == cx.stream.start) { - var body = noComma ? arrowBodyNoComma : arrowBody; - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext); - else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); - } - - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; - if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); - if (type == "function") return cont(functiondef, maybeop); - if (type == "class") return cont(pushlex("form"), classExpression, poplex); - if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression); - if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); - if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); - if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); - if (type == "{") return contCommasep(objprop, "}", null, maybeop); - if (type == "quasi") return pass(quasi, maybeop); - if (type == "new") return cont(maybeTarget(noComma)); - return cont(); - } - function maybeexpression(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expression); - } - function maybeexpressionNoComma(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expressionNoComma); - } - - function maybeoperatorComma(type, value) { - if (type == ",") return cont(expression); - return maybeoperatorNoComma(type, value, false); - } - function maybeoperatorNoComma(type, value, noComma) { - var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; - var expr = noComma == false ? expression : expressionNoComma; - if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); - if (type == "operator") { - if (/\+\+|--/.test(value)) return cont(me); - if (value == "?") return cont(expression, expect(":"), expr); - return cont(expr); - } - if (type == "quasi") { return pass(quasi, me); } - if (type == ";") return; - if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); - if (type == ".") return cont(property, me); - if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); - } - function quasi(type, value) { - if (type != "quasi") return pass(); - if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); - } - function continueQuasi(type) { - if (type == "}") { - cx.marked = "string-2"; - cx.state.tokenize = tokenQuasi; - return cont(quasi); - } - } - function arrowBody(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expression); - } - function arrowBodyNoComma(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expressionNoComma); - } - function maybeTarget(noComma) { - return function(type) { - if (type == ".") return cont(noComma ? targetNoComma : target); - else return pass(noComma ? expressionNoComma : expression); - }; - } - function target(_, value) { - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); } - } - function targetNoComma(_, value) { - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); } - } - function maybelabel(type) { - if (type == ":") return cont(poplex, statement); - return pass(maybeoperatorComma, expect(";"), poplex); - } - function property(type) { - if (type == "variable") {cx.marked = "property"; return cont();} - } - function objprop(type, value) { - if (type == "async") { - cx.marked = "property"; - return cont(objprop); - } else if (type == "variable" || cx.style == "keyword") { - cx.marked = "property"; - if (value == "get" || value == "set") return cont(getterSetter); - return cont(afterprop); - } else if (type == "number" || type == "string") { - cx.marked = jsonldMode ? "property" : (cx.style + " property"); - return cont(afterprop); - } else if (type == "jsonld-keyword") { - return cont(afterprop); - } else if (type == "modifier") { - return cont(objprop) - } else if (type == "[") { - return cont(expression, expect("]"), afterprop); - } else if (type == "spread") { - return cont(expression); - } else if (type == ":") { - return pass(afterprop) - } - } - function getterSetter(type) { - if (type != "variable") return pass(afterprop); - cx.marked = "property"; - return cont(functiondef); - } - function afterprop(type) { - if (type == ":") return cont(expressionNoComma); - if (type == "(") return pass(functiondef); - } - function commasep(what, end, sep) { - function proceed(type, value) { - if (sep ? sep.indexOf(type) > -1 : type == ",") { - var lex = cx.state.lexical; - if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; - return cont(function(type, value) { - if (type == end || value == end) return pass() - return pass(what) - }, proceed); - } - if (type == end || value == end) return cont(); - return cont(expect(end)); - } - return function(type, value) { - if (type == end || value == end) return cont(); - return pass(what, proceed); - }; - } - function contCommasep(what, end, info) { - for (var i = 3; i < arguments.length; i++) - cx.cc.push(arguments[i]); - return cont(pushlex(end, info), commasep(what, end), poplex); - } - function block(type) { - if (type == "}") return cont(); - return pass(statement, block); - } - function maybetype(type, value) { - if (isTS) { - if (type == ":") return cont(typeexpr); - if (value == "?") return cont(maybetype); - } - } - function typeexpr(type) { - if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);} - if (type == "string" || type == "number" || type == "atom") return cont(afterType); - if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex) - if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType) - } - function maybeReturnType(type) { - if (type == "=>") return cont(typeexpr) - } - function typeprop(type, value) { - if (type == "variable" || cx.style == "keyword") { - cx.marked = "property" - return cont(typeprop) - } else if (value == "?") { - return cont(typeprop) - } else if (type == ":") { - return cont(typeexpr) - } - } - function typearg(type) { - if (type == "variable") return cont(typearg) - else if (type == ":") return cont(typeexpr) - } - function afterType(type, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - if (value == "|" || type == ".") return cont(typeexpr) - if (type == "[") return cont(expect("]"), afterType) - } - function vardef() { - return pass(pattern, maybetype, maybeAssign, vardefCont); - } - function pattern(type, value) { - if (type == "modifier") return cont(pattern) - if (type == "variable") { register(value); return cont(); } - if (type == "spread") return cont(pattern); - if (type == "[") return contCommasep(pattern, "]"); - if (type == "{") return contCommasep(proppattern, "}"); - } - function proppattern(type, value) { - if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { - register(value); - return cont(maybeAssign); - } - if (type == "variable") cx.marked = "property"; - if (type == "spread") return cont(pattern); - if (type == "}") return pass(); - return cont(expect(":"), pattern, maybeAssign); - } - function maybeAssign(_type, value) { - if (value == "=") return cont(expressionNoComma); - } - function vardefCont(type) { - if (type == ",") return cont(vardef); - } - function maybeelse(type, value) { - if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); - } - function forspec(type) { - if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); - } - function forspec1(type) { - if (type == "var") return cont(vardef, expect(";"), forspec2); - if (type == ";") return cont(forspec2); - if (type == "variable") return cont(formaybeinof); - return pass(expression, expect(";"), forspec2); - } - function formaybeinof(_type, value) { - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return cont(maybeoperatorComma, forspec2); - } - function forspec2(type, value) { - if (type == ";") return cont(forspec3); - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return pass(expression, expect(";"), forspec3); - } - function forspec3(type) { - if (type != ")") cont(expression); - } - function functiondef(type, value) { - if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} - if (type == "variable") {register(value); return cont(functiondef);} - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext); - } - function funarg(type) { - if (type == "spread") return cont(funarg); - return pass(pattern, maybetype, maybeAssign); - } - function classExpression(type, value) { - // Class expressions may have an optional name. - if (type == "variable") return className(type, value); - return classNameAfter(type, value); - } - function className(type, value) { - if (type == "variable") {register(value); return cont(classNameAfter);} - } - function classNameAfter(type, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter) - if (value == "extends" || value == "implements" || (isTS && type == ",")) - return cont(isTS ? typeexpr : expression, classNameAfter); - if (type == "{") return cont(pushlex("}"), classBody, poplex); - } - function classBody(type, value) { - if (type == "variable" || cx.style == "keyword") { - if ((value == "async" || value == "static" || value == "get" || value == "set" || - (isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) && - cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) { - cx.marked = "keyword"; - return cont(classBody); - } - cx.marked = "property"; - return cont(isTS ? classfield : functiondef, classBody); - } - if (type == "[") - return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody) - if (value == "*") { - cx.marked = "keyword"; - return cont(classBody); - } - if (type == ";") return cont(classBody); - if (type == "}") return cont(); - } - function classfield(type, value) { - if (value == "?") return cont(classfield) - if (type == ":") return cont(typeexpr, maybeAssign) - if (value == "=") return cont(expressionNoComma) - return pass(functiondef) - } - function afterExport(type, value) { - if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } - if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } - if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";")); - return pass(statement); - } - function exportField(type, value) { - if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); } - if (type == "variable") return pass(expressionNoComma, exportField); - } - function afterImport(type) { - if (type == "string") return cont(); - return pass(importSpec, maybeMoreImports, maybeFrom); - } - function importSpec(type, value) { - if (type == "{") return contCommasep(importSpec, "}"); - if (type == "variable") register(value); - if (value == "*") cx.marked = "keyword"; - return cont(maybeAs); - } - function maybeMoreImports(type) { - if (type == ",") return cont(importSpec, maybeMoreImports) - } - function maybeAs(_type, value) { - if (value == "as") { cx.marked = "keyword"; return cont(importSpec); } - } - function maybeFrom(_type, value) { - if (value == "from") { cx.marked = "keyword"; return cont(expression); } - } - function arrayLiteral(type) { - if (type == "]") return cont(); - return pass(commasep(expressionNoComma, "]")); - } - - function isContinuedStatement(state, textAfter) { - return state.lastType == "operator" || state.lastType == "," || - isOperatorChar.test(textAfter.charAt(0)) || - /[,.]/.test(textAfter.charAt(0)); - } - - // Interface - - return { - startState: function(basecolumn) { - var state = { - tokenize: tokenBase, - lastType: "sof", - cc: [], - lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), - localVars: parserConfig.localVars, - context: parserConfig.localVars && {vars: parserConfig.localVars}, - indented: basecolumn || 0 - }; - if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") - state.globalVars = parserConfig.globalVars; - return state; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - findFatArrow(stream, state); - } - if (state.tokenize != tokenComment && stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (type == "comment") return style; - state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; - return parseJS(state, style, type, content, stream); - }, - - indent: function(state, textAfter) { - if (state.tokenize == tokenComment) return CodeMirror.Pass; - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top - // Kludge to prevent 'maybelse' from blocking lexical scope pops - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { - var c = state.cc[i]; - if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; - } - while ((lexical.type == "stat" || lexical.type == "form") && - (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && - (top == maybeoperatorComma || top == maybeoperatorNoComma) && - !/^[,\.=+\-*:?[\(]/.test(textAfter)))) - lexical = lexical.prev; - if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") - lexical = lexical.prev; - var type = lexical.type, closing = firstChar == type; - - if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0); - else if (type == "form" && firstChar == "{") return lexical.indented; - else if (type == "form") return lexical.indented + indentUnit; - else if (type == "stat") - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); - else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); - else if (lexical.align) return lexical.column + (closing ? 0 : 1); - else return lexical.indented + (closing ? 0 : indentUnit); - }, - - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, - blockCommentStart: jsonMode ? null : "/*", - blockCommentEnd: jsonMode ? null : "*/", - lineComment: jsonMode ? null : "//", - fold: "brace", - closeBrackets: "()[]{}''\"\"``", - - helperType: jsonMode ? "json" : "javascript", - jsonldMode: jsonldMode, - jsonMode: jsonMode, - - expressionAllowed: expressionAllowed, - skipExpression: function(state) { - var top = state.cc[state.cc.length - 1] - if (top == expression || top == expressionNoComma) state.cc.pop() - } - }; - }); - - CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); - - CodeMirror.defineMIME("text/javascript", "javascript"); - CodeMirror.defineMIME("text/ecmascript", "javascript"); - CodeMirror.defineMIME("application/javascript", "javascript"); - CodeMirror.defineMIME("application/x-javascript", "javascript"); - CodeMirror.defineMIME("application/ecmascript", "javascript"); - CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); - CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); - CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); - CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); - CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); - - }); - - -/***/ }, -/* 310 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306), __webpack_require__(311), __webpack_require__(309), __webpack_require__(312)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - var defaultTags = { - script: [ - ["lang", /(javascript|babel)/i, "javascript"], - ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"], - ["type", /./, "text/plain"], - [null, null, "javascript"] - ], - style: [ - ["lang", /^css$/i, "css"], - ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"], - ["type", /./, "text/plain"], - [null, null, "css"] - ] - }; - - function maybeBackup(stream, pat, style) { - var cur = stream.current(), close = cur.search(pat); - if (close > -1) { - stream.backUp(cur.length - close); - } else if (cur.match(/<\/?$/)) { - stream.backUp(cur.length); - if (!stream.match(pat, false)) stream.match(cur); - } - return style; - } - - var attrRegexpCache = {}; - function getAttrRegexp(attr) { - var regexp = attrRegexpCache[attr]; - if (regexp) return regexp; - return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"); - } - - function getAttrValue(text, attr) { - var match = text.match(getAttrRegexp(attr)) - return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : "" - } - - function getTagRegexp(tagName, anchored) { - return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); - } - - function addTags(from, to) { - for (var tag in from) { - var dest = to[tag] || (to[tag] = []); - var source = from[tag]; - for (var i = source.length - 1; i >= 0; i--) - dest.unshift(source[i]) - } - } - - function findMatchingMode(tagInfo, tagText) { - for (var i = 0; i < tagInfo.length; i++) { - var spec = tagInfo[i]; - if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2]; - } - } - - CodeMirror.defineMode("htmlmixed", function (config, parserConfig) { - var htmlMode = CodeMirror.getMode(config, { - name: "xml", - htmlMode: true, - multilineTagIndentFactor: parserConfig.multilineTagIndentFactor, - multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag - }); - - var tags = {}; - var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes; - addTags(defaultTags, tags); - if (configTags) addTags(configTags, tags); - if (configScript) for (var i = configScript.length - 1; i >= 0; i--) - tags.script.unshift(["type", configScript[i].matches, configScript[i].mode]) - - function html(stream, state) { - var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName - if (tag && !/[<>\s\/]/.test(stream.current()) && - (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) && - tags.hasOwnProperty(tagName)) { - state.inTag = tagName + " " - } else if (state.inTag && tag && />$/.test(stream.current())) { - var inTag = /^([\S]+) (.*)/.exec(state.inTag) - state.inTag = null - var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]) - var mode = CodeMirror.getMode(config, modeSpec) - var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false); - state.token = function (stream, state) { - if (stream.match(endTagA, false)) { - state.token = html; - state.localState = state.localMode = null; - return null; - } - return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState)); - }; - state.localMode = mode; - state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "")); - } else if (state.inTag) { - state.inTag += stream.current() - if (stream.eol()) state.inTag += " " - } - return style; - }; - - return { - startState: function () { - var state = CodeMirror.startState(htmlMode); - return {token: html, inTag: null, localMode: null, localState: null, htmlState: state}; - }, - - copyState: function (state) { - var local; - if (state.localState) { - local = CodeMirror.copyState(state.localMode, state.localState); - } - return {token: state.token, inTag: state.inTag, - localMode: state.localMode, localState: local, - htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; - }, - - token: function (stream, state) { - return state.token(stream, state); - }, - - indent: function (state, textAfter) { - if (!state.localMode || /^\s*<\//.test(textAfter)) - return htmlMode.indent(state.htmlState, textAfter); - else if (state.localMode.indent) - return state.localMode.indent(state.localState, textAfter); - else - return CodeMirror.Pass; - }, - - innerMode: function (state) { - return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode}; - } - }; - }, "xml", "javascript", "css"); - - CodeMirror.defineMIME("text/html", "htmlmixed"); - }); - - -/***/ }, -/* 311 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - var htmlConfig = { - autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, - 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, - 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, - 'track': true, 'wbr': true, 'menuitem': true}, - implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, - 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, - 'th': true, 'tr': true}, - contextGrabbers: { - 'dd': {'dd': true, 'dt': true}, - 'dt': {'dd': true, 'dt': true}, - 'li': {'li': true}, - 'option': {'option': true, 'optgroup': true}, - 'optgroup': {'optgroup': true}, - 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, - 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, - 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, - 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, - 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, - 'rp': {'rp': true, 'rt': true}, - 'rt': {'rp': true, 'rt': true}, - 'tbody': {'tbody': true, 'tfoot': true}, - 'td': {'td': true, 'th': true}, - 'tfoot': {'tbody': true}, - 'th': {'td': true, 'th': true}, - 'thead': {'tbody': true, 'tfoot': true}, - 'tr': {'tr': true} - }, - doNotIndent: {"pre": true}, - allowUnquoted: true, - allowMissing: true, - caseFold: true - } - - var xmlConfig = { - autoSelfClosers: {}, - implicitlyClosed: {}, - contextGrabbers: {}, - doNotIndent: {}, - allowUnquoted: false, - allowMissing: false, - caseFold: false - } - - CodeMirror.defineMode("xml", function(editorConf, config_) { - var indentUnit = editorConf.indentUnit - var config = {} - var defaults = config_.htmlMode ? htmlConfig : xmlConfig - for (var prop in defaults) config[prop] = defaults[prop] - for (var prop in config_) config[prop] = config_[prop] - - // Return variables for tokenizers - var type, setStyle; - - function inText(stream, state) { - function chain(parser) { - state.tokenize = parser; - return parser(stream, state); - } - - var ch = stream.next(); - if (ch == "<") { - if (stream.eat("!")) { - if (stream.eat("[")) { - if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); - else return null; - } else if (stream.match("--")) { - return chain(inBlock("comment", "-->")); - } else if (stream.match("DOCTYPE", true, true)) { - stream.eatWhile(/[\w\._\-]/); - return chain(doctype(1)); - } else { - return null; - } - } else if (stream.eat("?")) { - stream.eatWhile(/[\w\._\-]/); - state.tokenize = inBlock("meta", "?>"); - return "meta"; - } else { - type = stream.eat("/") ? "closeTag" : "openTag"; - state.tokenize = inTag; - return "tag bracket"; - } - } else if (ch == "&") { - var ok; - if (stream.eat("#")) { - if (stream.eat("x")) { - ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); - } else { - ok = stream.eatWhile(/[\d]/) && stream.eat(";"); - } - } else { - ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); - } - return ok ? "atom" : "error"; - } else { - stream.eatWhile(/[^&<]/); - return null; - } - } - inText.isInText = true; - - function inTag(stream, state) { - var ch = stream.next(); - if (ch == ">" || (ch == "/" && stream.eat(">"))) { - state.tokenize = inText; - type = ch == ">" ? "endTag" : "selfcloseTag"; - return "tag bracket"; - } else if (ch == "=") { - type = "equals"; - return null; - } else if (ch == "<") { - state.tokenize = inText; - state.state = baseState; - state.tagName = state.tagStart = null; - var next = state.tokenize(stream, state); - return next ? next + " tag error" : "tag error"; - } else if (/[\'\"]/.test(ch)) { - state.tokenize = inAttribute(ch); - state.stringStartCol = stream.column(); - return state.tokenize(stream, state); - } else { - stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); - return "word"; - } - } - - function inAttribute(quote) { - var closure = function(stream, state) { - while (!stream.eol()) { - if (stream.next() == quote) { - state.tokenize = inTag; - break; - } - } - return "string"; - }; - closure.isInAttribute = true; - return closure; - } - - function inBlock(style, terminator) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.match(terminator)) { - state.tokenize = inText; - break; - } - stream.next(); - } - return style; - }; - } - function doctype(depth) { - return function(stream, state) { - var ch; - while ((ch = stream.next()) != null) { - if (ch == "<") { - state.tokenize = doctype(depth + 1); - return state.tokenize(stream, state); - } else if (ch == ">") { - if (depth == 1) { - state.tokenize = inText; - break; - } else { - state.tokenize = doctype(depth - 1); - return state.tokenize(stream, state); - } - } - } - return "meta"; - }; - } - - function Context(state, tagName, startOfLine) { - this.prev = state.context; - this.tagName = tagName; - this.indent = state.indented; - this.startOfLine = startOfLine; - if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) - this.noIndent = true; - } - function popContext(state) { - if (state.context) state.context = state.context.prev; - } - function maybePopContext(state, nextTagName) { - var parentTagName; - while (true) { - if (!state.context) { - return; - } - parentTagName = state.context.tagName; - if (!config.contextGrabbers.hasOwnProperty(parentTagName) || - !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { - return; - } - popContext(state); - } - } - - function baseState(type, stream, state) { - if (type == "openTag") { - state.tagStart = stream.column(); - return tagNameState; - } else if (type == "closeTag") { - return closeTagNameState; - } else { - return baseState; - } - } - function tagNameState(type, stream, state) { - if (type == "word") { - state.tagName = stream.current(); - setStyle = "tag"; - return attrState; - } else { - setStyle = "error"; - return tagNameState; - } - } - function closeTagNameState(type, stream, state) { - if (type == "word") { - var tagName = stream.current(); - if (state.context && state.context.tagName != tagName && - config.implicitlyClosed.hasOwnProperty(state.context.tagName)) - popContext(state); - if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { - setStyle = "tag"; - return closeState; - } else { - setStyle = "tag error"; - return closeStateErr; - } - } else { - setStyle = "error"; - return closeStateErr; - } - } - - function closeState(type, _stream, state) { - if (type != "endTag") { - setStyle = "error"; - return closeState; - } - popContext(state); - return baseState; - } - function closeStateErr(type, stream, state) { - setStyle = "error"; - return closeState(type, stream, state); - } - - function attrState(type, _stream, state) { - if (type == "word") { - setStyle = "attribute"; - return attrEqState; - } else if (type == "endTag" || type == "selfcloseTag") { - var tagName = state.tagName, tagStart = state.tagStart; - state.tagName = state.tagStart = null; - if (type == "selfcloseTag" || - config.autoSelfClosers.hasOwnProperty(tagName)) { - maybePopContext(state, tagName); - } else { - maybePopContext(state, tagName); - state.context = new Context(state, tagName, tagStart == state.indented); - } - return baseState; - } - setStyle = "error"; - return attrState; - } - function attrEqState(type, stream, state) { - if (type == "equals") return attrValueState; - if (!config.allowMissing) setStyle = "error"; - return attrState(type, stream, state); - } - function attrValueState(type, stream, state) { - if (type == "string") return attrContinuedState; - if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;} - setStyle = "error"; - return attrState(type, stream, state); - } - function attrContinuedState(type, stream, state) { - if (type == "string") return attrContinuedState; - return attrState(type, stream, state); - } - - return { - startState: function(baseIndent) { - var state = {tokenize: inText, - state: baseState, - indented: baseIndent || 0, - tagName: null, tagStart: null, - context: null} - if (baseIndent != null) state.baseIndent = baseIndent - return state - }, - - token: function(stream, state) { - if (!state.tagName && stream.sol()) - state.indented = stream.indentation(); - - if (stream.eatSpace()) return null; - type = null; - var style = state.tokenize(stream, state); - if ((style || type) && style != "comment") { - setStyle = null; - state.state = state.state(type || style, stream, state); - if (setStyle) - style = setStyle == "error" ? style + " error" : setStyle; - } - return style; - }, - - indent: function(state, textAfter, fullLine) { - var context = state.context; - // Indent multi-line strings (e.g. css). - if (state.tokenize.isInAttribute) { - if (state.tagStart == state.indented) - return state.stringStartCol + 1; - else - return state.indented + indentUnit; - } - if (context && context.noIndent) return CodeMirror.Pass; - if (state.tokenize != inTag && state.tokenize != inText) - return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; - // Indent the starts of attribute names. - if (state.tagName) { - if (config.multilineTagIndentPastTag !== false) - return state.tagStart + state.tagName.length + 2; - else - return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1); - } - if (config.alignCDATA && /$/, - blockCommentStart: "", - - configuration: config.htmlMode ? "html" : "xml", - helperType: config.htmlMode ? "html" : "xml", - - skipAttribute: function(state) { - if (state.state == attrValueState) - state.state = attrState - } - }; - }); - - CodeMirror.defineMIME("text/xml", "xml"); - CodeMirror.defineMIME("application/xml", "xml"); - if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) - CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); - - }); - - -/***/ }, -/* 312 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("css", function(config, parserConfig) { - var inline = parserConfig.inline - if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css"); - - var indentUnit = config.indentUnit, - tokenHooks = parserConfig.tokenHooks, - documentTypes = parserConfig.documentTypes || {}, - mediaTypes = parserConfig.mediaTypes || {}, - mediaFeatures = parserConfig.mediaFeatures || {}, - mediaValueKeywords = parserConfig.mediaValueKeywords || {}, - propertyKeywords = parserConfig.propertyKeywords || {}, - nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {}, - fontProperties = parserConfig.fontProperties || {}, - counterDescriptors = parserConfig.counterDescriptors || {}, - colorKeywords = parserConfig.colorKeywords || {}, - valueKeywords = parserConfig.valueKeywords || {}, - allowNested = parserConfig.allowNested, - lineComment = parserConfig.lineComment, - supportsAtComponent = parserConfig.supportsAtComponent === true; - - var type, override; - function ret(style, tp) { type = tp; return style; } - - // Tokenizers - - function tokenBase(stream, state) { - var ch = stream.next(); - if (tokenHooks[ch]) { - var result = tokenHooks[ch](stream, state); - if (result !== false) return result; - } - if (ch == "@") { - stream.eatWhile(/[\w\\\-]/); - return ret("def", stream.current()); - } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) { - return ret(null, "compare"); - } else if (ch == "\"" || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } else if (ch == "#") { - stream.eatWhile(/[\w\\\-]/); - return ret("atom", "hash"); - } else if (ch == "!") { - stream.match(/^\s*\w*/); - return ret("keyword", "important"); - } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) { - stream.eatWhile(/[\w.%]/); - return ret("number", "unit"); - } else if (ch === "-") { - if (/[\d.]/.test(stream.peek())) { - stream.eatWhile(/[\w.%]/); - return ret("number", "unit"); - } else if (stream.match(/^-[\w\\\-]+/)) { - stream.eatWhile(/[\w\\\-]/); - if (stream.match(/^\s*:/, false)) - return ret("variable-2", "variable-definition"); - return ret("variable-2", "variable"); - } else if (stream.match(/^\w+-/)) { - return ret("meta", "meta"); - } - } else if (/[,+>*\/]/.test(ch)) { - return ret(null, "select-op"); - } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) { - return ret("qualifier", "qualifier"); - } else if (/[:;{}\[\]\(\)]/.test(ch)) { - return ret(null, ch); - } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || - (ch == "d" && stream.match("omain(")) || - (ch == "r" && stream.match("egexp("))) { - stream.backUp(1); - state.tokenize = tokenParenthesized; - return ret("property", "word"); - } else if (/[\w\\\-]/.test(ch)) { - stream.eatWhile(/[\w\\\-]/); - return ret("property", "word"); - } else { - return ret(null, null); - } - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) { - if (quote == ")") stream.backUp(1); - break; - } - escaped = !escaped && ch == "\\"; - } - if (ch == quote || !escaped && quote != ")") state.tokenize = null; - return ret("string", "string"); - }; - } - - function tokenParenthesized(stream, state) { - stream.next(); // Must be '(' - if (!stream.match(/\s*[\"\')]/, false)) - state.tokenize = tokenString(")"); - else - state.tokenize = null; - return ret(null, "("); - } - - // Context management - - function Context(type, indent, prev) { - this.type = type; - this.indent = indent; - this.prev = prev; - } - - function pushContext(state, stream, type, indent) { - state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context); - return type; - } - - function popContext(state) { - if (state.context.prev) - state.context = state.context.prev; - return state.context.type; - } - - function pass(type, stream, state) { - return states[state.context.type](type, stream, state); - } - function popAndPass(type, stream, state, n) { - for (var i = n || 1; i > 0; i--) - state.context = state.context.prev; - return pass(type, stream, state); - } - - // Parser - - function wordAsValue(stream) { - var word = stream.current().toLowerCase(); - if (valueKeywords.hasOwnProperty(word)) - override = "atom"; - else if (colorKeywords.hasOwnProperty(word)) - override = "keyword"; - else - override = "variable"; - } - - var states = {}; - - states.top = function(type, stream, state) { - if (type == "{") { - return pushContext(state, stream, "block"); - } else if (type == "}" && state.context.prev) { - return popContext(state); - } else if (supportsAtComponent && /@component/.test(type)) { - return pushContext(state, stream, "atComponentBlock"); - } else if (/^@(-moz-)?document$/.test(type)) { - return pushContext(state, stream, "documentTypes"); - } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) { - return pushContext(state, stream, "atBlock"); - } else if (/^@(font-face|counter-style)/.test(type)) { - state.stateArg = type; - return "restricted_atBlock_before"; - } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { - return "keyframes"; - } else if (type && type.charAt(0) == "@") { - return pushContext(state, stream, "at"); - } else if (type == "hash") { - override = "builtin"; - } else if (type == "word") { - override = "tag"; - } else if (type == "variable-definition") { - return "maybeprop"; - } else if (type == "interpolation") { - return pushContext(state, stream, "interpolation"); - } else if (type == ":") { - return "pseudo"; - } else if (allowNested && type == "(") { - return pushContext(state, stream, "parens"); - } - return state.context.type; - }; - - states.block = function(type, stream, state) { - if (type == "word") { - var word = stream.current().toLowerCase(); - if (propertyKeywords.hasOwnProperty(word)) { - override = "property"; - return "maybeprop"; - } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { - override = "string-2"; - return "maybeprop"; - } else if (allowNested) { - override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; - return "block"; - } else { - override += " error"; - return "maybeprop"; - } - } else if (type == "meta") { - return "block"; - } else if (!allowNested && (type == "hash" || type == "qualifier")) { - override = "error"; - return "block"; - } else { - return states.top(type, stream, state); - } - }; - - states.maybeprop = function(type, stream, state) { - if (type == ":") return pushContext(state, stream, "prop"); - return pass(type, stream, state); - }; - - states.prop = function(type, stream, state) { - if (type == ";") return popContext(state); - if (type == "{" && allowNested) return pushContext(state, stream, "propBlock"); - if (type == "}" || type == "{") return popAndPass(type, stream, state); - if (type == "(") return pushContext(state, stream, "parens"); - - if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) { - override += " error"; - } else if (type == "word") { - wordAsValue(stream); - } else if (type == "interpolation") { - return pushContext(state, stream, "interpolation"); - } - return "prop"; - }; - - states.propBlock = function(type, _stream, state) { - if (type == "}") return popContext(state); - if (type == "word") { override = "property"; return "maybeprop"; } - return state.context.type; - }; - - states.parens = function(type, stream, state) { - if (type == "{" || type == "}") return popAndPass(type, stream, state); - if (type == ")") return popContext(state); - if (type == "(") return pushContext(state, stream, "parens"); - if (type == "interpolation") return pushContext(state, stream, "interpolation"); - if (type == "word") wordAsValue(stream); - return "parens"; - }; - - states.pseudo = function(type, stream, state) { - if (type == "meta") return "pseudo"; - - if (type == "word") { - override = "variable-3"; - return state.context.type; - } - return pass(type, stream, state); - }; - - states.documentTypes = function(type, stream, state) { - if (type == "word" && documentTypes.hasOwnProperty(stream.current())) { - override = "tag"; - return state.context.type; - } else { - return states.atBlock(type, stream, state); - } - }; - - states.atBlock = function(type, stream, state) { - if (type == "(") return pushContext(state, stream, "atBlock_parens"); - if (type == "}" || type == ";") return popAndPass(type, stream, state); - if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top"); - - if (type == "interpolation") return pushContext(state, stream, "interpolation"); - - if (type == "word") { - var word = stream.current().toLowerCase(); - if (word == "only" || word == "not" || word == "and" || word == "or") - override = "keyword"; - else if (mediaTypes.hasOwnProperty(word)) - override = "attribute"; - else if (mediaFeatures.hasOwnProperty(word)) - override = "property"; - else if (mediaValueKeywords.hasOwnProperty(word)) - override = "keyword"; - else if (propertyKeywords.hasOwnProperty(word)) - override = "property"; - else if (nonStandardPropertyKeywords.hasOwnProperty(word)) - override = "string-2"; - else if (valueKeywords.hasOwnProperty(word)) - override = "atom"; - else if (colorKeywords.hasOwnProperty(word)) - override = "keyword"; - else - override = "error"; - } - return state.context.type; - }; - - states.atComponentBlock = function(type, stream, state) { - if (type == "}") - return popAndPass(type, stream, state); - if (type == "{") - return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false); - if (type == "word") - override = "error"; - return state.context.type; - }; - - states.atBlock_parens = function(type, stream, state) { - if (type == ")") return popContext(state); - if (type == "{" || type == "}") return popAndPass(type, stream, state, 2); - return states.atBlock(type, stream, state); - }; - - states.restricted_atBlock_before = function(type, stream, state) { - if (type == "{") - return pushContext(state, stream, "restricted_atBlock"); - if (type == "word" && state.stateArg == "@counter-style") { - override = "variable"; - return "restricted_atBlock_before"; - } - return pass(type, stream, state); - }; - - states.restricted_atBlock = function(type, stream, state) { - if (type == "}") { - state.stateArg = null; - return popContext(state); - } - if (type == "word") { - if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) || - (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase()))) - override = "error"; - else - override = "property"; - return "maybeprop"; - } - return "restricted_atBlock"; - }; - - states.keyframes = function(type, stream, state) { - if (type == "word") { override = "variable"; return "keyframes"; } - if (type == "{") return pushContext(state, stream, "top"); - return pass(type, stream, state); - }; - - states.at = function(type, stream, state) { - if (type == ";") return popContext(state); - if (type == "{" || type == "}") return popAndPass(type, stream, state); - if (type == "word") override = "tag"; - else if (type == "hash") override = "builtin"; - return "at"; - }; - - states.interpolation = function(type, stream, state) { - if (type == "}") return popContext(state); - if (type == "{" || type == ";") return popAndPass(type, stream, state); - if (type == "word") override = "variable"; - else if (type != "variable" && type != "(" && type != ")") override = "error"; - return "interpolation"; - }; - - return { - startState: function(base) { - return {tokenize: null, - state: inline ? "block" : "top", - stateArg: null, - context: new Context(inline ? "block" : "top", base || 0, null)}; - }, - - token: function(stream, state) { - if (!state.tokenize && stream.eatSpace()) return null; - var style = (state.tokenize || tokenBase)(stream, state); - if (style && typeof style == "object") { - type = style[1]; - style = style[0]; - } - override = style; - state.state = states[state.state](type, stream, state); - return override; - }, - - indent: function(state, textAfter) { - var cx = state.context, ch = textAfter && textAfter.charAt(0); - var indent = cx.indent; - if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev; - if (cx.prev) { - if (ch == "}" && (cx.type == "block" || cx.type == "top" || - cx.type == "interpolation" || cx.type == "restricted_atBlock")) { - // Resume indentation from parent context. - cx = cx.prev; - indent = cx.indent; - } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || - ch == "{" && (cx.type == "at" || cx.type == "atBlock")) { - // Dedent relative to current context. - indent = Math.max(0, cx.indent - indentUnit); - cx = cx.prev; - } - } - return indent; - }, - - electricChars: "}", - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: lineComment, - fold: "brace" - }; - }); - - function keySet(array) { - var keys = {}; - for (var i = 0; i < array.length; ++i) { - keys[array[i].toLowerCase()] = true; - } - return keys; - } - - var documentTypes_ = [ - "domain", "regexp", "url", "url-prefix" - ], documentTypes = keySet(documentTypes_); - - var mediaTypes_ = [ - "all", "aural", "braille", "handheld", "print", "projection", "screen", - "tty", "tv", "embossed" - ], mediaTypes = keySet(mediaTypes_); - - var mediaFeatures_ = [ - "width", "min-width", "max-width", "height", "min-height", "max-height", - "device-width", "min-device-width", "max-device-width", "device-height", - "min-device-height", "max-device-height", "aspect-ratio", - "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio", - "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color", - "max-color", "color-index", "min-color-index", "max-color-index", - "monochrome", "min-monochrome", "max-monochrome", "resolution", - "min-resolution", "max-resolution", "scan", "grid", "orientation", - "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", - "pointer", "any-pointer", "hover", "any-hover" - ], mediaFeatures = keySet(mediaFeatures_); - - var mediaValueKeywords_ = [ - "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", - "interlace", "progressive" - ], mediaValueKeywords = keySet(mediaValueKeywords_); - - var propertyKeywords_ = [ - "align-content", "align-items", "align-self", "alignment-adjust", - "alignment-baseline", "anchor-point", "animation", "animation-delay", - "animation-direction", "animation-duration", "animation-fill-mode", - "animation-iteration-count", "animation-name", "animation-play-state", - "animation-timing-function", "appearance", "azimuth", "backface-visibility", - "background", "background-attachment", "background-blend-mode", "background-clip", - "background-color", "background-image", "background-origin", "background-position", - "background-repeat", "background-size", "baseline-shift", "binding", - "bleed", "bookmark-label", "bookmark-level", "bookmark-state", - "bookmark-target", "border", "border-bottom", "border-bottom-color", - "border-bottom-left-radius", "border-bottom-right-radius", - "border-bottom-style", "border-bottom-width", "border-collapse", - "border-color", "border-image", "border-image-outset", - "border-image-repeat", "border-image-slice", "border-image-source", - "border-image-width", "border-left", "border-left-color", - "border-left-style", "border-left-width", "border-radius", "border-right", - "border-right-color", "border-right-style", "border-right-width", - "border-spacing", "border-style", "border-top", "border-top-color", - "border-top-left-radius", "border-top-right-radius", "border-top-style", - "border-top-width", "border-width", "bottom", "box-decoration-break", - "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", - "caption-side", "clear", "clip", "color", "color-profile", "column-count", - "column-fill", "column-gap", "column-rule", "column-rule-color", - "column-rule-style", "column-rule-width", "column-span", "column-width", - "columns", "content", "counter-increment", "counter-reset", "crop", "cue", - "cue-after", "cue-before", "cursor", "direction", "display", - "dominant-baseline", "drop-initial-after-adjust", - "drop-initial-after-align", "drop-initial-before-adjust", - "drop-initial-before-align", "drop-initial-size", "drop-initial-value", - "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis", - "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", - "float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings", - "font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust", - "font-stretch", "font-style", "font-synthesis", "font-variant", - "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", - "font-variant-ligatures", "font-variant-numeric", "font-variant-position", - "font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", - "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap", - "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", - "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", - "grid-template-rows", "hanging-punctuation", "height", "hyphens", - "icon", "image-orientation", "image-rendering", "image-resolution", - "inline-box-align", "justify-content", "left", "letter-spacing", - "line-break", "line-height", "line-stacking", "line-stacking-ruby", - "line-stacking-shift", "line-stacking-strategy", "list-style", - "list-style-image", "list-style-position", "list-style-type", "margin", - "margin-bottom", "margin-left", "margin-right", "margin-top", - "marks", "marquee-direction", "marquee-loop", - "marquee-play-count", "marquee-speed", "marquee-style", "max-height", - "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index", - "nav-left", "nav-right", "nav-up", "object-fit", "object-position", - "opacity", "order", "orphans", "outline", - "outline-color", "outline-offset", "outline-style", "outline-width", - "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y", - "padding", "padding-bottom", "padding-left", "padding-right", "padding-top", - "page", "page-break-after", "page-break-before", "page-break-inside", - "page-policy", "pause", "pause-after", "pause-before", "perspective", - "perspective-origin", "pitch", "pitch-range", "play-during", "position", - "presentation-level", "punctuation-trim", "quotes", "region-break-after", - "region-break-before", "region-break-inside", "region-fragment", - "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness", - "right", "rotation", "rotation-point", "ruby-align", "ruby-overhang", - "ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin", - "shape-outside", "size", "speak", "speak-as", "speak-header", - "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set", - "tab-size", "table-layout", "target", "target-name", "target-new", - "target-position", "text-align", "text-align-last", "text-decoration", - "text-decoration-color", "text-decoration-line", "text-decoration-skip", - "text-decoration-style", "text-emphasis", "text-emphasis-color", - "text-emphasis-position", "text-emphasis-style", "text-height", - "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow", - "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position", - "text-wrap", "top", "transform", "transform-origin", "transform-style", - "transition", "transition-delay", "transition-duration", - "transition-property", "transition-timing-function", "unicode-bidi", - "user-select", "vertical-align", "visibility", "voice-balance", "voice-duration", - "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", - "voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break", - "word-spacing", "word-wrap", "z-index", - // SVG-specific - "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color", - "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events", - "color-interpolation", "color-interpolation-filters", - "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering", - "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke", - "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", - "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering", - "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal", - "glyph-orientation-vertical", "text-anchor", "writing-mode" - ], propertyKeywords = keySet(propertyKeywords_); - - var nonStandardPropertyKeywords_ = [ - "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", - "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color", - "scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside", - "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", - "searchfield-results-decoration", "zoom" - ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); - - var fontProperties_ = [ - "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", - "font-stretch", "font-weight", "font-style" - ], fontProperties = keySet(fontProperties_); - - var counterDescriptors_ = [ - "additive-symbols", "fallback", "negative", "pad", "prefix", "range", - "speak-as", "suffix", "symbols", "system" - ], counterDescriptors = keySet(counterDescriptors_); - - var colorKeywords_ = [ - "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", - "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", - "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", - "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", - "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", - "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", - "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", - "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", - "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", - "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", - "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", - "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", - "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", - "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", - "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", - "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", - "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", - "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", - "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", - "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", - "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", - "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", - "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", - "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", - "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", - "whitesmoke", "yellow", "yellowgreen" - ], colorKeywords = keySet(colorKeywords_); - - var valueKeywords_ = [ - "above", "absolute", "activeborder", "additive", "activecaption", "afar", - "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", - "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", - "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", - "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary", - "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", - "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", - "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", - "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", - "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", - "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", - "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", - "compact", "condensed", "contain", "content", "contents", - "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", - "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", - "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", - "destination-in", "destination-out", "destination-over", "devanagari", "difference", - "disc", "discard", "disclosure-closed", "disclosure-open", "document", - "dot-dash", "dot-dot-dash", - "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", - "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", - "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", - "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", - "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et", - "ethiopic-halehame-gez", "ethiopic-halehame-om-et", - "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", - "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", - "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", - "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", - "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", - "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", - "help", "hidden", "hide", "higher", "highlight", "highlighttext", - "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", - "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", - "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", - "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", - "italic", "japanese-formal", "japanese-informal", "justify", "kannada", - "katakana", "katakana-iroha", "keep-all", "khmer", - "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal", - "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten", - "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", - "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", - "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", - "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d", - "media-controls-background", "media-current-time-display", - "media-fullscreen-button", "media-mute-button", "media-play-button", - "media-return-to-realtime-button", "media-rewind-button", - "media-seek-back-button", "media-seek-forward-button", "media-slider", - "media-sliderthumb", "media-time-remaining-display", "media-volume-slider", - "media-volume-slider-container", "media-volume-sliderthumb", "medium", - "menu", "menulist", "menulist-button", "menulist-text", - "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", - "mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize", - "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", - "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", - "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote", - "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", - "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", - "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter", - "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", - "progress", "push-button", "radial-gradient", "radio", "read-only", - "read-write", "read-write-plaintext-only", "rectangle", "region", - "relative", "repeat", "repeating-linear-gradient", - "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", - "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", - "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", - "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", - "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", - "searchfield-cancel-button", "searchfield-decoration", - "searchfield-results-button", "searchfield-results-decoration", - "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", - "simp-chinese-formal", "simp-chinese-informal", "single", - "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", - "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", - "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali", - "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square", - "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", - "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", - "table-caption", "table-cell", "table-column", "table-column-group", - "table-footer-group", "table-header-group", "table-row", "table-row-group", - "tamil", - "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", - "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", - "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", - "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", - "trad-chinese-formal", "trad-chinese-informal", "transform", - "translate", "translate3d", "translateX", "translateY", "translateZ", - "transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up", - "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", - "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", - "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", - "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", - "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", - "xx-large", "xx-small" - ], valueKeywords = keySet(valueKeywords_); - - var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_) - .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_) - .concat(valueKeywords_); - CodeMirror.registerHelper("hintWords", "css", allWords); - - function tokenCComment(stream, state) { - var maybeEnd = false, ch; - while ((ch = stream.next()) != null) { - if (maybeEnd && ch == "/") { - state.tokenize = null; - break; - } - maybeEnd = (ch == "*"); - } - return ["comment", "comment"]; - } - - CodeMirror.defineMIME("text/css", { - documentTypes: documentTypes, - mediaTypes: mediaTypes, - mediaFeatures: mediaFeatures, - mediaValueKeywords: mediaValueKeywords, - propertyKeywords: propertyKeywords, - nonStandardPropertyKeywords: nonStandardPropertyKeywords, - fontProperties: fontProperties, - counterDescriptors: counterDescriptors, - colorKeywords: colorKeywords, - valueKeywords: valueKeywords, - tokenHooks: { - "/": function(stream, state) { - if (!stream.eat("*")) return false; - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } - }, - name: "css" - }); - - CodeMirror.defineMIME("text/x-scss", { - mediaTypes: mediaTypes, - mediaFeatures: mediaFeatures, - mediaValueKeywords: mediaValueKeywords, - propertyKeywords: propertyKeywords, - nonStandardPropertyKeywords: nonStandardPropertyKeywords, - colorKeywords: colorKeywords, - valueKeywords: valueKeywords, - fontProperties: fontProperties, - allowNested: true, - lineComment: "//", - tokenHooks: { - "/": function(stream, state) { - if (stream.eat("/")) { - stream.skipToEnd(); - return ["comment", "comment"]; - } else if (stream.eat("*")) { - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } else { - return ["operator", "operator"]; - } - }, - ":": function(stream) { - if (stream.match(/\s*\{/)) - return [null, "{"]; - return false; - }, - "$": function(stream) { - stream.match(/^[\w-]+/); - if (stream.match(/^\s*:/, false)) - return ["variable-2", "variable-definition"]; - return ["variable-2", "variable"]; - }, - "#": function(stream) { - if (!stream.eat("{")) return false; - return [null, "interpolation"]; - } - }, - name: "css", - helperType: "scss" - }); - - CodeMirror.defineMIME("text/x-less", { - mediaTypes: mediaTypes, - mediaFeatures: mediaFeatures, - mediaValueKeywords: mediaValueKeywords, - propertyKeywords: propertyKeywords, - nonStandardPropertyKeywords: nonStandardPropertyKeywords, - colorKeywords: colorKeywords, - valueKeywords: valueKeywords, - fontProperties: fontProperties, - allowNested: true, - lineComment: "//", - tokenHooks: { - "/": function(stream, state) { - if (stream.eat("/")) { - stream.skipToEnd(); - return ["comment", "comment"]; - } else if (stream.eat("*")) { - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } else { - return ["operator", "operator"]; - } - }, - "@": function(stream) { - if (stream.eat("{")) return [null, "interpolation"]; - if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; - stream.eatWhile(/[\w\\\-]/); - if (stream.match(/^\s*:/, false)) - return ["variable-2", "variable-definition"]; - return ["variable-2", "variable"]; - }, - "&": function() { - return ["atom", "atom"]; - } - }, - name: "css", - helperType: "less" - }); - - CodeMirror.defineMIME("text/x-gss", { - documentTypes: documentTypes, - mediaTypes: mediaTypes, - mediaFeatures: mediaFeatures, - propertyKeywords: propertyKeywords, - nonStandardPropertyKeywords: nonStandardPropertyKeywords, - fontProperties: fontProperties, - counterDescriptors: counterDescriptors, - colorKeywords: colorKeywords, - valueKeywords: valueKeywords, - supportsAtComponent: true, - tokenHooks: { - "/": function(stream, state) { - if (!stream.eat("*")) return false; - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } - }, - name: "css", - helperType: "gss" - }); - - }); - - -/***/ }, -/* 313 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - /** - * Link to the project's GitHub page: - * https://github.com/pickhardt/coffeescript-codemirror-mode - */ - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("coffeescript", function(conf, parserConf) { - var ERRORCLASS = "error"; - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); - } - - var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/; - var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/; - var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/; - var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/; - - var wordOperators = wordRegexp(["and", "or", "not", - "is", "isnt", "in", - "instanceof", "typeof"]); - var indentKeywords = ["for", "while", "loop", "if", "unless", "else", - "switch", "try", "catch", "finally", "class"]; - var commonKeywords = ["break", "by", "continue", "debugger", "delete", - "do", "in", "of", "new", "return", "then", - "this", "@", "throw", "when", "until", "extends"]; - - var keywords = wordRegexp(indentKeywords.concat(commonKeywords)); - - indentKeywords = wordRegexp(indentKeywords); - - - var stringPrefixes = /^('{3}|\"{3}|['\"])/; - var regexPrefixes = /^(\/{3}|\/)/; - var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"]; - var constants = wordRegexp(commonConstants); - - // Tokenizers - function tokenBase(stream, state) { - // Handle scope changes - if (stream.sol()) { - if (state.scope.align === null) state.scope.align = false; - var scopeOffset = state.scope.offset; - if (stream.eatSpace()) { - var lineOffset = stream.indentation(); - if (lineOffset > scopeOffset && state.scope.type == "coffee") { - return "indent"; - } else if (lineOffset < scopeOffset) { - return "dedent"; - } - return null; - } else { - if (scopeOffset > 0) { - dedent(stream, state); - } - } - } - if (stream.eatSpace()) { - return null; - } - - var ch = stream.peek(); - - // Handle docco title comment (single line) - if (stream.match("####")) { - stream.skipToEnd(); - return "comment"; - } - - // Handle multi line comments - if (stream.match("###")) { - state.tokenize = longComment; - return state.tokenize(stream, state); - } - - // Single line comment - if (ch === "#") { - stream.skipToEnd(); - return "comment"; - } - - // Handle number literals - if (stream.match(/^-?[0-9\.]/, false)) { - var floatLiteral = false; - // Floats - if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) { - floatLiteral = true; - } - if (stream.match(/^-?\d+\.\d*/)) { - floatLiteral = true; - } - if (stream.match(/^-?\.\d+/)) { - floatLiteral = true; - } - - if (floatLiteral) { - // prevent from getting extra . on 1.. - if (stream.peek() == "."){ - stream.backUp(1); - } - return "number"; - } - // Integers - var intLiteral = false; - // Hex - if (stream.match(/^-?0x[0-9a-f]+/i)) { - intLiteral = true; - } - // Decimal - if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) { - intLiteral = true; - } - // Zero by itself with no other piece of number. - if (stream.match(/^-?0(?![\dx])/i)) { - intLiteral = true; - } - if (intLiteral) { - return "number"; - } - } - - // Handle strings - if (stream.match(stringPrefixes)) { - state.tokenize = tokenFactory(stream.current(), false, "string"); - return state.tokenize(stream, state); - } - // Handle regex literals - if (stream.match(regexPrefixes)) { - if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division - state.tokenize = tokenFactory(stream.current(), true, "string-2"); - return state.tokenize(stream, state); - } else { - stream.backUp(1); - } - } - - - - // Handle operators and delimiters - if (stream.match(operators) || stream.match(wordOperators)) { - return "operator"; - } - if (stream.match(delimiters)) { - return "punctuation"; - } - - if (stream.match(constants)) { - return "atom"; - } - - if (stream.match(atProp) || state.prop && stream.match(identifiers)) { - return "property"; - } - - if (stream.match(keywords)) { - return "keyword"; - } - - if (stream.match(identifiers)) { - return "variable"; - } - - // Handle non-detected items - stream.next(); - return ERRORCLASS; - } - - function tokenFactory(delimiter, singleline, outclass) { - return function(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^'"\/\\]/); - if (stream.eat("\\")) { - stream.next(); - if (singleline && stream.eol()) { - return outclass; - } - } else if (stream.match(delimiter)) { - state.tokenize = tokenBase; - return outclass; - } else { - stream.eat(/['"\/]/); - } - } - if (singleline) { - if (parserConf.singleLineStringErrors) { - outclass = ERRORCLASS; - } else { - state.tokenize = tokenBase; - } - } - return outclass; - }; - } - - function longComment(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^#]/); - if (stream.match("###")) { - state.tokenize = tokenBase; - break; - } - stream.eatWhile("#"); - } - return "comment"; - } - - function indent(stream, state, type) { - type = type || "coffee"; - var offset = 0, align = false, alignOffset = null; - for (var scope = state.scope; scope; scope = scope.prev) { - if (scope.type === "coffee" || scope.type == "}") { - offset = scope.offset + conf.indentUnit; - break; - } - } - if (type !== "coffee") { - align = null; - alignOffset = stream.column() + stream.current().length; - } else if (state.scope.align) { - state.scope.align = false; - } - state.scope = { - offset: offset, - type: type, - prev: state.scope, - align: align, - alignOffset: alignOffset - }; - } - - function dedent(stream, state) { - if (!state.scope.prev) return; - if (state.scope.type === "coffee") { - var _indent = stream.indentation(); - var matched = false; - for (var scope = state.scope; scope; scope = scope.prev) { - if (_indent === scope.offset) { - matched = true; - break; - } - } - if (!matched) { - return true; - } - while (state.scope.prev && state.scope.offset !== _indent) { - state.scope = state.scope.prev; - } - return false; - } else { - state.scope = state.scope.prev; - return false; - } - } - - function tokenLexer(stream, state) { - var style = state.tokenize(stream, state); - var current = stream.current(); - - // Handle scope changes. - if (current === "return") { - state.dedent = true; - } - if (((current === "->" || current === "=>") && stream.eol()) - || style === "indent") { - indent(stream, state); - } - var delimiter_index = "[({".indexOf(current); - if (delimiter_index !== -1) { - indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); - } - if (indentKeywords.exec(current)){ - indent(stream, state); - } - if (current == "then"){ - dedent(stream, state); - } - - - if (style === "dedent") { - if (dedent(stream, state)) { - return ERRORCLASS; - } - } - delimiter_index = "])}".indexOf(current); - if (delimiter_index !== -1) { - while (state.scope.type == "coffee" && state.scope.prev) - state.scope = state.scope.prev; - if (state.scope.type == current) - state.scope = state.scope.prev; - } - if (state.dedent && stream.eol()) { - if (state.scope.type == "coffee" && state.scope.prev) - state.scope = state.scope.prev; - state.dedent = false; - } - - return style; - } - - var external = { - startState: function(basecolumn) { - return { - tokenize: tokenBase, - scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false}, - prop: false, - dedent: 0 - }; - }, - - token: function(stream, state) { - var fillAlign = state.scope.align === null && state.scope; - if (fillAlign && stream.sol()) fillAlign.align = false; - - var style = tokenLexer(stream, state); - if (style && style != "comment") { - if (fillAlign) fillAlign.align = true; - state.prop = style == "punctuation" && stream.current() == "." - } - - return style; - }, - - indent: function(state, text) { - if (state.tokenize != tokenBase) return 0; - var scope = state.scope; - var closer = text && "])}".indexOf(text.charAt(0)) > -1; - if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev; - var closes = closer && scope.type === text.charAt(0); - if (scope.align) - return scope.alignOffset - (closes ? 1 : 0); - else - return (closes ? scope.prev : scope).offset; - }, - - lineComment: "#", - fold: "indent" - }; - return external; - }); - - CodeMirror.defineMIME("text/x-coffeescript", "coffeescript"); - CodeMirror.defineMIME("text/coffeescript", "coffeescript"); - - }); - - -/***/ }, -/* 314 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306), __webpack_require__(311), __webpack_require__(309)) - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod) - else // Plain browser env - mod(CodeMirror) - })(function(CodeMirror) { - "use strict" - - // Depth means the amount of open braces in JS context, in XML - // context 0 means not in tag, 1 means in tag, and 2 means in tag - // and js block comment. - function Context(state, mode, depth, prev) { - this.state = state; this.mode = mode; this.depth = depth; this.prev = prev - } - - function copyContext(context) { - return new Context(CodeMirror.copyState(context.mode, context.state), - context.mode, - context.depth, - context.prev && copyContext(context.prev)) - } - - CodeMirror.defineMode("jsx", function(config, modeConfig) { - var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false}) - var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript") - - function flatXMLIndent(state) { - var tagName = state.tagName - state.tagName = null - var result = xmlMode.indent(state, "") - state.tagName = tagName - return result - } - - function token(stream, state) { - if (state.context.mode == xmlMode) - return xmlToken(stream, state, state.context) - else - return jsToken(stream, state, state.context) - } - - function xmlToken(stream, state, cx) { - if (cx.depth == 2) { // Inside a JS /* */ comment - if (stream.match(/^.*?\*\//)) cx.depth = 1 - else stream.skipToEnd() - return "comment" - } - - if (stream.peek() == "{") { - xmlMode.skipAttribute(cx.state) - - var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context - // If JS starts on same line as tag - if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) { - while (xmlContext.prev && !xmlContext.startOfLine) - xmlContext = xmlContext.prev - // If tag starts the line, use XML indentation level - if (xmlContext.startOfLine) indent -= config.indentUnit - // Else use JS indentation level - else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented - // Else if inside of tag - } else if (cx.depth == 1) { - indent += config.indentUnit - } - - state.context = new Context(CodeMirror.startState(jsMode, indent), - jsMode, 0, state.context) - return null - } - - if (cx.depth == 1) { // Inside of tag - if (stream.peek() == "<") { // Tag inside of tag - xmlMode.skipAttribute(cx.state) - state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)), - xmlMode, 0, state.context) - return null - } else if (stream.match("//")) { - stream.skipToEnd() - return "comment" - } else if (stream.match("/*")) { - cx.depth = 2 - return token(stream, state) - } - } - - var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop - if (/\btag\b/.test(style)) { - if (/>$/.test(cur)) { - if (cx.state.context) cx.depth = 0 - else state.context = state.context.prev - } else if (/^ -1) { - stream.backUp(cur.length - stop) - } - return style - } - - function jsToken(stream, state, cx) { - if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) { - jsMode.skipExpression(cx.state) - state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")), - xmlMode, 0, state.context) - return null - } - - var style = jsMode.token(stream, cx.state) - if (!style && cx.depth != null) { - var cur = stream.current() - if (cur == "{") { - cx.depth++ - } else if (cur == "}") { - if (--cx.depth == 0) state.context = state.context.prev - } - } - return style - } - - return { - startState: function() { - return {context: new Context(CodeMirror.startState(jsMode), jsMode)} - }, - - copyState: function(state) { - return {context: copyContext(state.context)} - }, - - token: token, - - indent: function(state, textAfter, fullLine) { - return state.context.mode.indent(state.context.state, textAfter, fullLine) - }, - - innerMode: function(state) { - return state.context - } - } - }, "xml", "javascript") - - CodeMirror.defineMIME("text/jsx", "jsx") - CodeMirror.defineMIME("text/typescript-jsx", {name: "jsx", base: {name: "javascript", typescript: true}}) - }); - - -/***/ }, -/* 315 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("elm", function() { - - function switchState(source, setState, f) { - setState(f); - return f(source, setState); - } - - // These should all be Unicode extended, as per the Haskell 2010 report - var smallRE = /[a-z_]/; - var largeRE = /[A-Z]/; - var digitRE = /[0-9]/; - var hexitRE = /[0-9A-Fa-f]/; - var octitRE = /[0-7]/; - var idRE = /[a-z_A-Z0-9\']/; - var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/; - var specialRE = /[(),;[\]`{}]/; - var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer - - function normal() { - return function (source, setState) { - if (source.eatWhile(whiteCharRE)) { - return null; - } - - var ch = source.next(); - if (specialRE.test(ch)) { - if (ch == '{' && source.eat('-')) { - var t = "comment"; - if (source.eat('#')) t = "meta"; - return switchState(source, setState, ncomment(t, 1)); - } - return null; - } - - if (ch == '\'') { - if (source.eat('\\')) - source.next(); // should handle other escapes here - else - source.next(); - - if (source.eat('\'')) - return "string"; - return "error"; - } - - if (ch == '"') { - return switchState(source, setState, stringLiteral); - } - - if (largeRE.test(ch)) { - source.eatWhile(idRE); - if (source.eat('.')) - return "qualifier"; - return "variable-2"; - } - - if (smallRE.test(ch)) { - var isDef = source.pos === 1; - source.eatWhile(idRE); - return isDef ? "variable-3" : "variable"; - } - - if (digitRE.test(ch)) { - if (ch == '0') { - if (source.eat(/[xX]/)) { - source.eatWhile(hexitRE); // should require at least 1 - return "integer"; - } - if (source.eat(/[oO]/)) { - source.eatWhile(octitRE); // should require at least 1 - return "number"; - } - } - source.eatWhile(digitRE); - var t = "number"; - if (source.eat('.')) { - t = "number"; - source.eatWhile(digitRE); // should require at least 1 - } - if (source.eat(/[eE]/)) { - t = "number"; - source.eat(/[-+]/); - source.eatWhile(digitRE); // should require at least 1 - } - return t; - } - - if (symbolRE.test(ch)) { - if (ch == '-' && source.eat(/-/)) { - source.eatWhile(/-/); - if (!source.eat(symbolRE)) { - source.skipToEnd(); - return "comment"; - } - } - source.eatWhile(symbolRE); - return "builtin"; - } - - return "error"; - } - } - - function ncomment(type, nest) { - if (nest == 0) { - return normal(); - } - return function(source, setState) { - var currNest = nest; - while (!source.eol()) { - var ch = source.next(); - if (ch == '{' && source.eat('-')) { - ++currNest; - } else if (ch == '-' && source.eat('}')) { - --currNest; - if (currNest == 0) { - setState(normal()); - return type; - } - } - } - setState(ncomment(type, currNest)); - return type; - } - } - - function stringLiteral(source, setState) { - while (!source.eol()) { - var ch = source.next(); - if (ch == '"') { - setState(normal()); - return "string"; - } - if (ch == '\\') { - if (source.eol() || source.eat(whiteCharRE)) { - setState(stringGap); - return "string"; - } - if (!source.eat('&')) source.next(); // should handle other escapes here - } - } - setState(normal()); - return "error"; - } - - function stringGap(source, setState) { - if (source.eat('\\')) { - return switchState(source, setState, stringLiteral); - } - source.next(); - setState(normal()); - return "error"; - } - - - var wellKnownWords = (function() { - var wkw = {}; - - var keywords = [ - "case", "of", "as", - "if", "then", "else", - "let", "in", - "infix", "infixl", "infixr", - "type", "alias", - "input", "output", "foreign", "loopback", - "module", "where", "import", "exposing", - "_", "..", "|", ":", "=", "\\", "\"", "->", "<-" - ]; - - for (var i = keywords.length; i--;) - wkw[keywords[i]] = "keyword"; - - return wkw; - })(); - - - - return { - startState: function () { return { f: normal() }; }, - copyState: function (s) { return { f: s.f }; }, - - token: function(stream, state) { - var t = state.f(stream, function(s) { state.f = s; }); - var w = stream.current(); - return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t; - } - }; - - }); - - CodeMirror.defineMIME("text/x-elm", "elm"); - }); - - -/***/ }, +/* 309 */, +/* 310 */, +/* 311 */, +/* 312 */, +/* 313 */, +/* 314 */, +/* 315 */, /* 316 */, /* 317 */, -/* 318 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - var Pos = CodeMirror.Pos; - - function SearchCursor(doc, query, pos, caseFold) { - this.atOccurrence = false; this.doc = doc; - if (caseFold == null && typeof query == "string") caseFold = false; - - pos = pos ? doc.clipPos(pos) : Pos(0, 0); - this.pos = {from: pos, to: pos}; - - // The matches method is filled in based on the type of query. - // It takes a position and a direction, and returns an object - // describing the next occurrence of the query, or null if no - // more matches were found. - if (typeof query != "string") { // Regexp match - if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g"); - this.matches = function(reverse, pos) { - if (reverse) { - query.lastIndex = 0; - var line = doc.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start; - for (;;) { - query.lastIndex = cutOff; - var newMatch = query.exec(line); - if (!newMatch) break; - match = newMatch; - start = match.index; - cutOff = match.index + (match[0].length || 1); - if (cutOff == line.length) break; - } - var matchLen = (match && match[0].length) || 0; - if (!matchLen) { - if (start == 0 && line.length == 0) {match = undefined;} - else if (start != doc.getLine(pos.line).length) { - matchLen++; - } - } - } else { - query.lastIndex = pos.ch; - var line = doc.getLine(pos.line), match = query.exec(line); - var matchLen = (match && match[0].length) || 0; - var start = match && match.index; - if (start + matchLen != line.length && !matchLen) matchLen = 1; - } - if (match && matchLen) - return {from: Pos(pos.line, start), - to: Pos(pos.line, start + matchLen), - match: match}; - }; - } else { // String query - var origQuery = query; - if (caseFold) query = query.toLowerCase(); - var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; - var target = query.split("\n"); - // Different methods for single-line and multi-line queries - if (target.length == 1) { - if (!query.length) { - // Empty string would match anything and never progress, so - // we define it to match nothing instead. - this.matches = function() {}; - } else { - this.matches = function(reverse, pos) { - if (reverse) { - var orig = doc.getLine(pos.line).slice(0, pos.ch), line = fold(orig); - var match = line.lastIndexOf(query); - if (match > -1) { - match = adjustPos(orig, line, match); - return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)}; - } - } else { - var orig = doc.getLine(pos.line).slice(pos.ch), line = fold(orig); - var match = line.indexOf(query); - if (match > -1) { - match = adjustPos(orig, line, match) + pos.ch; - return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)}; - } - } - }; - } - } else { - var origTarget = origQuery.split("\n"); - this.matches = function(reverse, pos) { - var last = target.length - 1; - if (reverse) { - if (pos.line - (target.length - 1) < doc.firstLine()) return; - if (fold(doc.getLine(pos.line).slice(0, origTarget[last].length)) != target[target.length - 1]) return; - var to = Pos(pos.line, origTarget[last].length); - for (var ln = pos.line - 1, i = last - 1; i >= 1; --i, --ln) - if (target[i] != fold(doc.getLine(ln))) return; - var line = doc.getLine(ln), cut = line.length - origTarget[0].length; - if (fold(line.slice(cut)) != target[0]) return; - return {from: Pos(ln, cut), to: to}; - } else { - if (pos.line + (target.length - 1) > doc.lastLine()) return; - var line = doc.getLine(pos.line), cut = line.length - origTarget[0].length; - if (fold(line.slice(cut)) != target[0]) return; - var from = Pos(pos.line, cut); - for (var ln = pos.line + 1, i = 1; i < last; ++i, ++ln) - if (target[i] != fold(doc.getLine(ln))) return; - if (fold(doc.getLine(ln).slice(0, origTarget[last].length)) != target[last]) return; - return {from: from, to: Pos(ln, origTarget[last].length)}; - } - }; - } - } - } - - SearchCursor.prototype = { - findNext: function() {return this.find(false);}, - findPrevious: function() {return this.find(true);}, - - find: function(reverse) { - var self = this, pos = this.doc.clipPos(reverse ? this.pos.from : this.pos.to); - function savePosAndFail(line) { - var pos = Pos(line, 0); - self.pos = {from: pos, to: pos}; - self.atOccurrence = false; - return false; - } - - for (;;) { - if (this.pos = this.matches(reverse, pos)) { - this.atOccurrence = true; - return this.pos.match || true; - } - if (reverse) { - if (!pos.line) return savePosAndFail(0); - pos = Pos(pos.line-1, this.doc.getLine(pos.line-1).length); - } - else { - var maxLine = this.doc.lineCount(); - if (pos.line == maxLine - 1) return savePosAndFail(maxLine); - pos = Pos(pos.line + 1, 0); - } - } - }, - - from: function() {if (this.atOccurrence) return this.pos.from;}, - to: function() {if (this.atOccurrence) return this.pos.to;}, - - replace: function(newText, origin) { - if (!this.atOccurrence) return; - var lines = CodeMirror.splitLines(newText); - this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin); - this.pos.to = Pos(this.pos.from.line + lines.length - 1, - lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0)); - } - }; - - // Maps a position in a case-folded line back to a position in the original line - // (compensating for codepoints increasing in number during folding) - function adjustPos(orig, folded, pos) { - if (orig.length == folded.length) return pos; - for (var pos1 = Math.min(pos, orig.length);;) { - var len1 = orig.slice(0, pos1).toLowerCase().length; - if (len1 < pos) ++pos1; - else if (len1 > pos) --pos1; - else return pos1; - } - } - - CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { - return new SearchCursor(this.doc, query, pos, caseFold); - }); - CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) { - return new SearchCursor(this, query, pos, caseFold); - }); - - CodeMirror.defineExtension("selectMatches", function(query, caseFold) { - var ranges = []; - var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold); - while (cur.findNext()) { - if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break; - ranges.push({anchor: cur.from(), head: cur.to()}); - } - if (ranges.length) - this.setSelections(ranges, 0); - }); - }); - - -/***/ }, +/* 318 */, /* 319 */ /***/ function(module, exports, __webpack_require__) { @@ -31930,6 +19645,8 @@ return /******/ (function(modules) { // webpackBootstrap }); exports.toggleProjectSearch = toggleProjectSearch; exports.toggleFileSearch = toggleFileSearch; + exports.toggleSymbolSearch = toggleSymbolSearch; + exports.setSelectedSymbolType = setSelectedSymbolType; exports.setFileSearchQuery = setFileSearchQuery; exports.toggleFileSearchModifier = toggleFileSearchModifier; exports.showSource = showSource; @@ -31981,6 +19698,30 @@ return /******/ (function(modules) { // webpackBootstrap }; } + function toggleSymbolSearch(toggleValue) { + return (_ref3) => { + var dispatch = _ref3.dispatch, + getState = _ref3.getState; + + dispatch({ + type: _constants2.default.TOGGLE_SYMBOL_SEARCH, + value: toggleValue + }); + }; + } + + function setSelectedSymbolType(symbolType) { + return (_ref4) => { + var dispatch = _ref4.dispatch, + getState = _ref4.getState; + + dispatch({ + type: _constants2.default.SET_SYMBOL_SEARCH_TYPE, + symbolType + }); + }; + } + function setFileSearchQuery(query) { return { type: _constants2.default.UPDATE_FILE_SEARCH_QUERY, @@ -31993,9 +19734,9 @@ return /******/ (function(modules) { // webpackBootstrap } function showSource(sourceId) { - return (_ref3) => { - var dispatch = _ref3.dispatch, - getState = _ref3.getState; + return (_ref5) => { + var dispatch = _ref5.dispatch, + getState = _ref5.getState; var source = (0, _selectors.getSource)(getState(), sourceId); dispatch({ @@ -33026,6 +20767,10 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + var _fuzzaldrinPlus = __webpack_require__(161); var _classnames = __webpack_require__(175); @@ -33040,13 +20785,19 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(386); + var _SearchInput2 = __webpack_require__(377); + + var _SearchInput3 = _interopRequireDefault(_SearchInput2); + + var _ResultList2 = __webpack_require__(383); + + var _ResultList3 = _interopRequireDefault(_ResultList2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var _require = __webpack_require__(22), - findDOMNode = _require.findDOMNode; + var SearchInput = (0, _react.createFactory)(_SearchInput3.default); - var SearchInput = (0, _react.createFactory)(__webpack_require__(377).default); - var ResultList = (0, _react.createFactory)(__webpack_require__(383).default); + var ResultList = (0, _react.createFactory)(_ResultList3.default); class Autocomplete extends _react.Component { @@ -33063,7 +20814,7 @@ return /******/ (function(modules) { // webpackBootstrap componentDidMount() { var endOfInput = this.state.inputValue.length; - var node = findDOMNode(this); + var node = _reactDom2.default.findDOMNode(this); if (node instanceof HTMLElement) { var searchInput = node.querySelector("input"); if (searchInput instanceof HTMLInputElement) { @@ -33110,7 +20861,7 @@ return /******/ (function(modules) { // webpackBootstrap e.preventDefault(); } else if (e.key === "Enter") { if (searchResults.length) { - this.props.selectItem(searchResults[this.state.selectedIndex]); + this.props.selectItem(e, searchResults[this.state.selectedIndex]); } else { this.props.close(this.state.inputValue); } @@ -33186,13 +20937,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var _require = __webpack_require__(828), - isFirefox = _require.isFirefox; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.handleKeyDown = exports.scrollList = undefined; + + var _devtoolsConfig = __webpack_require__(828); function scrollList(resultList, index) { + if (!resultList.hasOwnProperty(index)) { + return; + } + var resultEl = resultList[index]; - if (isFirefox()) { + if ((0, _devtoolsConfig.isFirefox)()) { resultEl.scrollIntoView({ block: "end", behavior: "smooth" }); } else { chromeScrollList(resultEl, index); @@ -33246,10 +21005,8 @@ return /******/ (function(modules) { // webpackBootstrap } } - module.exports = { - scrollList, - handleKeyDown - }; + exports.scrollList = scrollList; + exports.handleKeyDown = handleKeyDown; /***/ }, /* 344 */ @@ -33265,9 +21022,10 @@ return /******/ (function(modules) { // webpackBootstrap var _Svg2 = _interopRequireDefault(_Svg); + __webpack_require__(375); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - __webpack_require__(375); /** * This file maps the SVG React Components in the assets/images directory. */ @@ -33286,6 +21044,7 @@ return /******/ (function(modules) { // webpackBootstrap var svg = { "angle-brackets": __webpack_require__(347), arrow: __webpack_require__(348), + backbone: __webpack_require__(996), blackBox: __webpack_require__(349), breakpoint: __webpack_require__(350), "case-match": __webpack_require__(351), @@ -33294,6 +21053,7 @@ return /******/ (function(modules) { // webpackBootstrap file: __webpack_require__(354), folder: __webpack_require__(355), globe: __webpack_require__(356), + jquery: __webpack_require__(997), "magnifying-glass": __webpack_require__(357), "arrow-up": __webpack_require__(919), "arrow-down": __webpack_require__(920), @@ -33301,7 +21061,7 @@ return /******/ (function(modules) { // webpackBootstrap "pause-exceptions": __webpack_require__(359), plus: __webpack_require__(360), prettyPrint: __webpack_require__(361), - react: __webpack_require__(970), + react: __webpack_require__(998), "regex-match": __webpack_require__(362), resume: __webpack_require__(363), settings: __webpack_require__(364), @@ -33314,7 +21074,8 @@ return /******/ (function(modules) { // webpackBootstrap "whole-word-match": __webpack_require__(371), worker: __webpack_require__(372), "sad-face": __webpack_require__(373), - refresh: __webpack_require__(374) + refresh: __webpack_require__(374), + webpack: __webpack_require__(999) }; module.exports = function (name, props) { @@ -33690,6 +21451,16 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var arrowBtn = (onClick, type, className, tooltip) => { + return _react.DOM.button({ + onClick, + type, + className, + title: tooltip, + key: type + }, (0, _Svg2.default)(type)); + }; + class SearchInput extends _react.Component { static get defaultProps() { @@ -33711,44 +21482,45 @@ return /******/ (function(modules) { // webpackBootstrap return (0, _Svg2.default)("magnifying-glass"); } + renderArrowButtons() { + var _props2 = this.props, + handleNext = _props2.handleNext, + handlePrev = _props2.handlePrev; + + + return [arrowBtn(handleNext, "arrow-down", (0, _classnames2.default)("nav-btn", "next"), L10N.getFormatStr("editor.searchResults.nextResult")), arrowBtn(handlePrev, "arrow-up", (0, _classnames2.default)("nav-btn", "prev"), L10N.getFormatStr("editor.searchResults.prevResult"))]; + } + renderNav() { if (!(0, _devtoolsConfig.isEnabled)("searchNav")) { return; } - var _props2 = this.props, - count = _props2.count, - handleNext = _props2.handleNext, - handlePrev = _props2.handlePrev; + var _props3 = this.props, + count = _props3.count, + handleNext = _props3.handleNext, + handlePrev = _props3.handlePrev; if (!handleNext && !handlePrev || !count || count == 1) { return; } - return _react.DOM.div({ className: "search-nav-buttons" }, (0, _Svg2.default)("arrow-down", { - className: (0, _classnames2.default)("nav-btn", "next"), - onClick: handleNext, - title: "Next Result" - }), (0, _Svg2.default)("arrow-up", { - className: (0, _classnames2.default)("nav-btn", "prev"), - onClick: handlePrev, - title: "Previous Result" - })); + return _react.DOM.div({ className: "search-nav-buttons" }, this.renderArrowButtons()); } render() { - var _props3 = this.props, - query = _props3.query, - placeholder = _props3.placeholder, - count = _props3.count, - summaryMsg = _props3.summaryMsg, - onChange = _props3.onChange, - onKeyDown = _props3.onKeyDown, - onKeyUp = _props3.onKeyUp, - onFocus = _props3.onFocus, - onBlur = _props3.onBlur, - handleClose = _props3.handleClose, - size = _props3.size; + var _props4 = this.props, + query = _props4.query, + placeholder = _props4.placeholder, + count = _props4.count, + summaryMsg = _props4.summaryMsg, + onChange = _props4.onChange, + onKeyDown = _props4.onKeyDown, + onKeyUp = _props4.onKeyUp, + onFocus = _props4.onFocus, + onBlur = _props4.onBlur, + handleClose = _props4.handleClose, + size = _props4.size; return _react.DOM.div({ @@ -33948,12 +21720,19 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(424); + var _Outline2 = __webpack_require__(921); + + var _Outline3 = _interopRequireDefault(_Outline2); + + var _SourcesTree2 = __webpack_require__(390); + + var _SourcesTree3 = _interopRequireDefault(_SourcesTree2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var Outline = (0, _react.createFactory)(__webpack_require__(921).default); - - var SourcesTree = (0, _react.createFactory)(__webpack_require__(390).default); + var Outline = (0, _react.createFactory)(_Outline3.default); + var SourcesTree = (0, _react.createFactory)(_SourcesTree3.default); class Sources extends _react.Component { @@ -34001,14 +21780,20 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.formatKeyShortcut = undefined; + + var _devtoolsModules = __webpack_require__(830); + + var appinfo = _devtoolsModules.Services.appinfo; + /** * Utils for keyboard command strings * @module utils/text */ - var _require = __webpack_require__(830), - appinfo = _require.Services.appinfo; - var isMacOS = appinfo.OS === "Darwin"; /** @@ -34031,9 +21816,7 @@ return /******/ (function(modules) { // webpackBootstrap return shortcut.replace(/CommandOrControl\+|CmdOrCtrl\+/g, `${L10N.getStr("ctrl")}+`); } - module.exports = { - formatKeyShortcut - }; + exports.formatKeyShortcut = formatKeyShortcut; /***/ }, /* 390 */ @@ -34065,6 +21848,10 @@ return /******/ (function(modules) { // webpackBootstrap var _sourcesTree = __webpack_require__(391); + var _ManagedTree2 = __webpack_require__(419); + + var _ManagedTree3 = _interopRequireDefault(_ManagedTree2); + var _actions = __webpack_require__(244); var _actions2 = _interopRequireDefault(_actions); @@ -34081,8 +21868,7 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ManagedTree = (0, _react.createFactory)(__webpack_require__(419).default); - + var ManagedTree = (0, _react.createFactory)(_ManagedTree3.default); class SourcesTree extends _react.Component { @@ -34321,22 +22107,30 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.isExactUrlMatch = exports.getURL = exports.getDirectories = exports.createTree = exports.collapseTree = exports.addToTree = exports.isDirectory = exports.createParentMap = exports.nodeHasChildren = exports.createNode = undefined; + + var _url = __webpack_require__(334); + + var _DevToolsUtils = __webpack_require__(222); + + var _DevToolsUtils2 = _interopRequireDefault(_DevToolsUtils); + + var _source = __webpack_require__(233); + + var _merge = __webpack_require__(392); + + var _merge2 = _interopRequireDefault(_merge); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** * Utils for Sources Tree Component * @module utils/sources-tree */ - var _require = __webpack_require__(334), - parse = _require.parse; - - var _require2 = __webpack_require__(222), - assert = _require2.assert; - - var _require3 = __webpack_require__(233), - isPretty = _require3.isPretty; - - var merge = __webpack_require__(392); - var IGNORED_URLS = ["debugger eval code", "XStringBundle"]; /** @@ -34423,7 +22217,7 @@ return /******/ (function(modules) { // webpackBootstrap return def; } - var _parse = parse(url), + var _parse = (0, _url.parse)(url), pathname = _parse.pathname, protocol = _parse.protocol, host = _parse.host, @@ -34438,7 +22232,7 @@ return /******/ (function(modules) { // webpackBootstrap case "about:": // An about page is a special case - return merge(def, { + return (0, _merge2.default)(def, { path: "/", group: url, filename: filename @@ -34448,7 +22242,7 @@ return /******/ (function(modules) { // webpackBootstrap if (pathname && pathname.startsWith("/")) { // If it's just a URL like "/foo/bar.js", resolve it to the file // protocol - return merge(def, { + return (0, _merge2.default)(def, { path: path, group: "file://", filename: filename @@ -34456,7 +22250,7 @@ return /******/ (function(modules) { // webpackBootstrap } else if (host === null) { // We don't know what group to put this under, and it's a script // with a weird URL. Just group them all under an anonymous group. - return merge(def, { + return (0, _merge2.default)(def, { path: url, group: "(no domain)", filename: filename @@ -34466,14 +22260,14 @@ return /******/ (function(modules) { // webpackBootstrap case "http:": case "https:": - return merge(def, { + return (0, _merge2.default)(def, { path: pathname, group: host, filename: filename }); } - return merge(def, { + return (0, _merge2.default)(def, { path: path, group: protocol ? `${protocol}//` : "", filename: filename @@ -34499,7 +22293,7 @@ return /******/ (function(modules) { // webpackBootstrap function addToTree(tree, source, debuggeeUrl) { var url = getURL(source.get("url")); - if (IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || !url.group || isPretty(source.toJS())) { + if (IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || !url.group || (0, _source.isPretty)(source.toJS())) { return; } @@ -34522,7 +22316,7 @@ return /******/ (function(modules) { // webpackBootstrap // // TODO: Be smarter about this, which we'll probably do when we // are smarter about folders and collapsing empty ones. - assert(nodeHasChildren(subtree), `${subtree.name} should have children`); + (0, _DevToolsUtils2.default)(nodeHasChildren(subtree), `${subtree.name} should have children`); var children = subtree.contents; var index = determineFileSortOrder(children, part, isLastPart, i === 0 ? debuggeeUrl : ""); @@ -34559,7 +22353,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function isExactUrlMatch(pathPart, debuggeeUrl) { // compare to hostname with an optional 'www.' prefix - var _parse2 = parse(debuggeeUrl), + var _parse2 = (0, _url.parse)(debuggeeUrl), host = _parse2.host; if (!host) { @@ -34697,18 +22491,16 @@ return /******/ (function(modules) { // webpackBootstrap } } - module.exports = { - createNode, - nodeHasChildren, - createParentMap, - isDirectory, - addToTree, - collapseTree, - createTree, - getDirectories, - getURL, - isExactUrlMatch - }; + exports.createNode = createNode; + exports.nodeHasChildren = nodeHasChildren; + exports.createParentMap = createParentMap; + exports.isDirectory = isDirectory; + exports.addToTree = addToTree; + exports.collapseTree = collapseTree; + exports.createTree = createTree; + exports.getDirectories = getDirectories; + exports.getURL = getURL; + exports.isExactUrlMatch = isExactUrlMatch; /***/ }, /* 392 */ @@ -35684,10 +23476,13 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var Tree = (0, _react.createFactory)(__webpack_require__(830).Tree); - __webpack_require__(420); + var _devtoolsComponents = __webpack_require__(1000); + + var Tree = (0, _react.createFactory)(_devtoolsComponents.Tree); + + class ManagedTree extends _react.Component { constructor() { @@ -35868,6 +23663,10 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + var _reactImmutableProptypes = __webpack_require__(150); var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); @@ -35876,6 +23675,8 @@ return /******/ (function(modules) { // webpackBootstrap var _reactRedux = __webpack_require__(151); + var _reselect = __webpack_require__(992); + var _classnames = __webpack_require__(175); var _classnames2 = _interopRequireDefault(_classnames); @@ -35884,6 +23685,8 @@ return /******/ (function(modules) { // webpackBootstrap var _debounce2 = _interopRequireDefault(_debounce); + var _devtoolsConfig = __webpack_require__(828); + var _source = __webpack_require__(233); var _GutterMenu = __webpack_require__(655); @@ -35898,8 +23701,6 @@ return /******/ (function(modules) { // webpackBootstrap var _devtoolsLaunchpad = __webpack_require__(131); - var _devtoolsConfig = __webpack_require__(828); - var _selectors = __webpack_require__(242); var _breakpoints = __webpack_require__(236); @@ -35908,6 +23709,30 @@ return /******/ (function(modules) { // webpackBootstrap var _actions2 = _interopRequireDefault(_actions); + var _Footer2 = __webpack_require__(427); + + var _Footer3 = _interopRequireDefault(_Footer2); + + var _SearchBar2 = __webpack_require__(433); + + var _SearchBar3 = _interopRequireDefault(_SearchBar2); + + var _Preview2 = __webpack_require__(657); + + var _Preview3 = _interopRequireDefault(_Preview2); + + var _Breakpoint2 = __webpack_require__(714); + + var _Breakpoint3 = _interopRequireDefault(_Breakpoint2); + + var _ColumnBreakpoint2 = __webpack_require__(1004); + + var _ColumnBreakpoint3 = _interopRequireDefault(_ColumnBreakpoint2); + + var _HitMarker2 = __webpack_require__(715); + + var _HitMarker3 = _interopRequireDefault(_HitMarker2); + var _editor = __webpack_require__(257); var _scopes = __webpack_require__(732); @@ -35918,16 +23743,17 @@ return /******/ (function(modules) { // webpackBootstrap function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - var ReactDOM = __webpack_require__(22); + var Footer = (0, _react.createFactory)(_Footer3.default); + var SearchBar = (0, _react.createFactory)(_SearchBar3.default); - var Footer = (0, _react.createFactory)(__webpack_require__(427).default); - var SearchBar = (0, _react.createFactory)(__webpack_require__(433).default); + var Preview = (0, _react.createFactory)(_Preview3.default); - var Preview = (0, _react.createFactory)(__webpack_require__(657).default); + var Breakpoint = (0, _react.createFactory)(_Breakpoint3.default); - var Breakpoint = (0, _react.createFactory)(__webpack_require__(714).default); - var HitMarker = (0, _react.createFactory)(__webpack_require__(715).default); + var ColumnBreakpoint = (0, _react.createFactory)(_ColumnBreakpoint3.default); + + var HitMarker = (0, _react.createFactory)(_HitMarker3.default); var cssVars = { searchbarHeight: "var(--editor-searchbar-height)", @@ -35935,7 +23761,7 @@ return /******/ (function(modules) { // webpackBootstrap footerHeight: "var(--editor-footer-height)" }; - class Editor extends _react.Component { + class Editor extends _react.PureComponent { constructor() { super(); @@ -35979,7 +23805,9 @@ return /******/ (function(modules) { // webpackBootstrap this.clearDebugLine(this.props.selectedFrame); if (!sourceText) { - this.showMessage(""); + if (this.props.sourceText) { + this.showMessage(""); + } } else if (!(0, _editor.isTextForSource)(sourceText)) { this.showMessage(sourceText.get("error") || L10N.getStr("loadingText")); } else if (this.props.sourceText !== sourceText) { @@ -35996,7 +23824,7 @@ return /******/ (function(modules) { // webpackBootstrap // disables the default search shortcuts editor._initShortcuts = () => {}; - var node = ReactDOM.findDOMNode(this); + var node = _reactDom2.default.findDOMNode(this); if (node instanceof HTMLElement) { editor.appendToLocalElement(node.querySelector(".editor-mount")); } @@ -36014,6 +23842,19 @@ return /******/ (function(modules) { // webpackBootstrap codeMirrorWrapper.tabIndex = 0; codeMirrorWrapper.addEventListener("keydown", e => this.onKeyDown(e)); codeMirrorWrapper.addEventListener("mouseover", e => this.onMouseOver(e)); + codeMirrorWrapper.addEventListener("click", e => this.onTokenClick(e)); + + var toggleFoldMarkerVisibility = e => { + if (node instanceof HTMLElement) { + node.querySelectorAll(".CodeMirror-guttermarker-subtle").forEach(elem => { + elem.classList.toggle("visible"); + }); + } + }; + + var codeMirrorGutter = codeMirror.getGutterElement(); + codeMirrorGutter.addEventListener("mouseleave", toggleFoldMarkerVisibility); + codeMirrorGutter.addEventListener("mouseenter", toggleFoldMarkerVisibility); if (!(0, _devtoolsConfig.isFirefox)()) { codeMirror.on("gutterContextMenu", (cm, line, eventName, event) => this.onGutterContextMenu(event)); @@ -36140,9 +23981,28 @@ return /******/ (function(modules) { // webpackBootstrap } onMouseOver(e) { + var target = e.target; + + if (!target.parentElement.closest(".CodeMirror-line")) { + return; + } this.previewSelectedToken(e); } + onTokenClick(e) { + var target = e.target; + + if (!(0, _devtoolsConfig.isEnabled)("columnBreakpoints") || !e.altKey || !target.parentElement.closest(".CodeMirror-line")) { + return; + } + + var _getTokenLocation = (0, _editor.getTokenLocation)(this.editor.codeMirror, target), + line = _getTokenLocation.line, + column = _getTokenLocation.column; + + this.toggleBreakpoint(line - 1, column - 1); + } + onSearchAgain(_, e) { var _props2 = this.props, query = _props2.query, @@ -36151,10 +24011,6 @@ return /******/ (function(modules) { // webpackBootstrap var ctx = { ed: this.editor, cm: codeMirror }; - if (!searchModifiers) { - return; - } - var direction = e.shiftKey ? "prev" : "next"; (0, _editor.traverseResults)(e, ctx, query, direction, searchModifiers.toJS()); } @@ -36173,7 +24029,7 @@ return /******/ (function(modules) { // webpackBootstrap var token = e.target; - if (!selectedFrame || !sourceText || !(0, _devtoolsConfig.isEnabled)("editorPreview") || !selectedSource || selectedFrame.location.sourceId !== selectedSource.get("id")) { + if (!selectedFrame || !sourceText || !selectedSource || selectedFrame.location.sourceId !== selectedSource.get("id")) { return; } @@ -36271,7 +24127,7 @@ return /******/ (function(modules) { // webpackBootstrap } var line = this.editor.codeMirror.lineAtHeight(event.clientY); - var bp = (0, _editor.breakpointAtLine)(this.props.breakpoints, line); + var bp = (0, _editor.breakpointAtLocation)(this.props.breakpoints, { line }); (0, _GutterMenu2.default)({ event, line, @@ -36296,7 +24152,7 @@ return /******/ (function(modules) { // webpackBootstrap var sourceId = selectedLocation ? selectedLocation.sourceId : ""; - var bp = (0, _editor.breakpointAtLine)(breakpoints, line); + var bp = (0, _editor.breakpointAtLocation)(breakpoints, { line }); var location = { sourceId, line: line + 1 }; var condition = bp ? bp.condition : ""; @@ -36328,6 +24184,7 @@ return /******/ (function(modules) { // webpackBootstrap } toggleBreakpoint(line) { + var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; var _props6 = this.props, selectedSource = _props6.selectedSource, selectedLocation = _props6.selectedLocation, @@ -36335,7 +24192,7 @@ return /******/ (function(modules) { // webpackBootstrap addBreakpoint = _props6.addBreakpoint, removeBreakpoint = _props6.removeBreakpoint; - var bp = (0, _editor.breakpointAtLine)(breakpoints, line); + var bp = (0, _editor.breakpointAtLocation)(breakpoints, { line, column }); if (bp && bp.loading || !selectedLocation || !selectedSource) { return; @@ -36347,13 +24204,15 @@ return /******/ (function(modules) { // webpackBootstrap if (bp) { removeBreakpoint({ sourceId: sourceId, - line: line + 1 + line: line + 1, + column: column }); } else { addBreakpoint({ sourceId: sourceId, sourceUrl: selectedSource.get("url"), - line: line + 1 + line: line + 1, + column: column }, // Pass in a function to get line text because the breakpoint // may slide and it needs to compute the value at the new @@ -36363,7 +24222,7 @@ return /******/ (function(modules) { // webpackBootstrap } toggleBreakpointDisabledStatus(line) { - var bp = (0, _editor.breakpointAtLine)(this.props.breakpoints, line); + var bp = (0, _editor.breakpointAtLocation)(this.props.breakpoints, { line }); var selectedLocation = this.props.selectedLocation; @@ -36485,11 +24344,19 @@ return /******/ (function(modules) { // webpackBootstrap return; } - return breakpoints.valueSeq().map(bp => Breakpoint({ + var breakpointMarkers = breakpoints.valueSeq().filter(b => !b.location.column).map(bp => Breakpoint({ key: (0, _breakpoints.makeLocationId)(bp.location), breakpoint: bp, editor: this.editor && this.editor.codeMirror })); + + var columnBreakpointBookmarks = breakpoints.valueSeq().filter(b => b.location.column).map(bp => ColumnBreakpoint({ + key: (0, _breakpoints.makeLocationId)(bp.location), + breakpoint: bp, + editor: this.editor && this.editor.codeMirror + })); + + return breakpointMarkers.concat(columnBreakpointBookmarks); } renderHitCounts() { @@ -36525,12 +24392,7 @@ return /******/ (function(modules) { // webpackBootstrap if (searchOn) { subtractions.push(cssVars.searchbarHeight); - - var secondSearchBarOn = (0, _devtoolsConfig.isEnabled)("searchModifiers") && (0, _devtoolsConfig.isEnabled)("symbolSearch"); - - if (secondSearchBarOn) { - subtractions.push(cssVars.secondSearchbarHeight); - } + subtractions.push(cssVars.secondSearchbarHeight); } return { @@ -36551,7 +24413,7 @@ return /******/ (function(modules) { // webpackBootstrap return null; } - if (!(0, _devtoolsConfig.isEnabled)("editorPreview") || !selectedToken || !selectedFrame || !selectedExpression) { + if (!selectedToken || !selectedFrame || !selectedExpression) { return; } @@ -36642,6 +24504,9 @@ return /******/ (function(modules) { // webpackBootstrap shortcuts: _react.PropTypes.object }; + var expressionsSel = state => state.expressions.expressions; + var getExpressionSel = (0, _reselect.createSelector)(expressionsSel, expressions => input => expressions.find(exp => exp.input == input)); + exports.default = (0, _reactRedux.connect)(state => { var selectedLocation = (0, _selectors.getSelectedLocation)(state); var sourceId = selectedLocation && selectedLocation.sourceId; @@ -36656,7 +24521,7 @@ return /******/ (function(modules) { // webpackBootstrap breakpoints: (0, _selectors.getBreakpointsForSource)(state, sourceId || ""), hitCount: (0, _selectors.getHitCountForSource)(state, sourceId), selectedFrame: (0, _selectors.getSelectedFrame)(state), - getExpression: _selectors.getExpression.bind(null, state), + getExpression: getExpressionSel(state), pauseData: (0, _selectors.getPause)(state), coverageOn: (0, _selectors.getCoverageEnabled)(state), query: (0, _selectors.getFileSearchQueryState)(state), @@ -36676,8 +24541,6 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _react2 = _interopRequireDefault(_react); - var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); @@ -36692,10 +24555,6 @@ return /******/ (function(modules) { // webpackBootstrap var _Svg2 = _interopRequireDefault(_Svg); - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - var _classnames = __webpack_require__(175); var _classnames2 = _interopRequireDefault(_classnames); @@ -36714,9 +24573,10 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var PaneToggleButton = _react2.default.createFactory(_PaneToggle2.default); + var PaneToggleButton = (0, _react.createFactory)(_PaneToggle2.default); + + class SourceFooter extends _react.PureComponent { - class SourceFooter extends _react.Component { prettyPrintButton() { var _props = this.props, selectedSource = _props.selectedSource, @@ -36838,19 +24698,6 @@ return /******/ (function(modules) { // webpackBootstrap } } - SourceFooter.propTypes = { - selectedSource: _reactImmutableProptypes2.default.map, - togglePrettyPrint: _react.PropTypes.func, - toggleBlackBox: _react.PropTypes.func, - recordCoverage: _react.PropTypes.func, - sourceText: _reactImmutableProptypes2.default.map, - selectSource: _react.PropTypes.func, - editor: _react.PropTypes.object, - endPanelCollapsed: _react.PropTypes.bool, - togglePaneCollapse: _react.PropTypes.func, - horizontal: _react.PropTypes.bool - }; - SourceFooter.displayName = "SourceFooter"; exports.default = (0, _reactRedux.connect)(state => { @@ -36955,12 +24802,12 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); - var _devtoolsConfig = __webpack_require__(828); - var _fuzzaldrinPlus = __webpack_require__(161); var _Svg = __webpack_require__(344); @@ -36991,18 +24838,23 @@ return /******/ (function(modules) { // webpackBootstrap var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); + var _SearchInput2 = __webpack_require__(377); + + var _SearchInput3 = _interopRequireDefault(_SearchInput2); + + var _ResultList2 = __webpack_require__(383); + + var _ResultList3 = _interopRequireDefault(_ResultList2); + __webpack_require__(653); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - var _require = __webpack_require__(22), - findDOMNode = _require.findDOMNode; - - var SearchInput = (0, _react.createFactory)(__webpack_require__(377).default); - var ResultList = (0, _react.createFactory)(__webpack_require__(383).default); + var SearchInput = (0, _react.createFactory)(_SearchInput3.default); + var ResultList = (0, _react.createFactory)(_ResultList3.default); function getShortcuts() { var searchAgainKey = L10N.getStr("sourceSearch.search.again.key"); @@ -37021,8 +24873,6 @@ return /******/ (function(modules) { // webpackBootstrap constructor(props) { super(props); this.state = { - symbolSearchEnabled: false, - selectedSymbolType: "functions", symbolSearchResults: [], selectedResultIndex: 0, count: 0, @@ -37094,12 +24944,10 @@ return /******/ (function(modules) { // webpackBootstrap shortcuts.on(searchAgainShortcut, (_, e) => this.traverseResults(e, false)); - if ((0, _devtoolsConfig.isEnabled)("symbolSearch")) { - shortcuts.on(symbolSearchShortcut, (_, e) => this.toggleSymbolSearch(e, { - toggle: false, - searchType: "functions" - })); - } + shortcuts.on(symbolSearchShortcut, (_, e) => this.toggleSymbolSearch(e, { + toggle: false, + searchType: "functions" + })); } componentDidUpdate(prevProps, prevState) { @@ -37107,7 +24955,10 @@ return /******/ (function(modules) { // webpackBootstrap sourceText = _props.sourceText, selectedSource = _props.selectedSource, query = _props.query, - modifiers = _props.modifiers; + modifiers = _props.modifiers, + searchOn = _props.searchOn, + symbolSearchOn = _props.symbolSearchOn, + selectedSymbolType = _props.selectedSymbolType; var searchInput = this.searchInput(); @@ -37126,12 +24977,8 @@ return /******/ (function(modules) { // webpackBootstrap var changedFiles = selectedSource != prevProps.selectedSource && hasLoaded; var modifiersUpdated = modifiers && !modifiers.equals(prevProps.modifiers); - var isOpen = this.props.searchOn || this.state.symbolSearchEnabled; - var _state = this.state, - selectedSymbolType = _state.selectedSymbolType, - symbolSearchEnabled = _state.symbolSearchEnabled; - - var changedSearchType = selectedSymbolType != prevState.selectedSymbolType || symbolSearchEnabled != prevState.symbolSearchEnabled; + var isOpen = searchOn || symbolSearchOn; + var changedSearchType = selectedSymbolType != prevProps.selectedSymbolType || symbolSearchOn != prevProps.symbolSearchOn; if (isOpen && (doneLoading || changedFiles || modifiersUpdated || changedSearchType)) { this.doSearch(query); @@ -37161,10 +25008,8 @@ return /******/ (function(modules) { // webpackBootstrap if (this.props.searchOn && ed) { this.clearSearch(); this.props.toggleFileSearch(false); - this.setState({ - symbolSearchEnabled: false, - selectedSymbolType: "functions" - }); + this.props.toggleSymbolSearch(false); + this.props.setSelectedSymbolType("functions"); e.stopPropagation(); e.preventDefault(); } @@ -37180,12 +25025,10 @@ return /******/ (function(modules) { // webpackBootstrap this.props.toggleFileSearch(); } - if (this.state.symbolSearchEnabled) { + if (this.props.symbolSearchOn) { this.clearSearch(); - this.setState({ - symbolSearchEnabled: false, - selectedSymbolType: "functions" - }); + this.props.toggleSymbolSearch(false); + this.props.setSelectedSymbolType("functions"); } if (this.props.searchOn && editor) { @@ -37219,21 +25062,19 @@ return /******/ (function(modules) { // webpackBootstrap this.props.toggleFileSearch(); } - if (this.state.symbolSearchEnabled) { + if (this.props.symbolSearchOn) { if (toggle) { - this.setState({ symbolSearchEnabled: false }); + this.props.toggleSymbolSearch(false); } else { - this.setState({ selectedSymbolType: searchType }); + this.props.setSelectedSymbolType(searchType); } return; } if (this.props.selectedSource) { this.clearSearch(); - this.setState({ - symbolSearchEnabled: true, - selectedSymbolType: searchType - }); + this.props.toggleSymbolSearch(true); + this.props.setSelectedSymbolType(searchType); } } @@ -37254,7 +25095,7 @@ return /******/ (function(modules) { // webpackBootstrap } searchInput() { - var node = findDOMNode(this); + var node = (0, _reactDom.findDOMNode)(this); if (node instanceof HTMLElement) { var input = node.querySelector("input"); if (input instanceof HTMLInputElement) { @@ -37270,8 +25111,8 @@ return /******/ (function(modules) { // webpackBootstrap return _asyncToGenerator(function* () { var _props3 = _this.props, sourceText = _props3.sourceText, - updateSearchResults = _props3.updateSearchResults; - var selectedSymbolType = _this.state.selectedSymbolType; + updateSearchResults = _props3.updateSearchResults, + selectedSymbolType = _props3.selectedSymbolType; if (query == "" || !sourceText) { @@ -37301,7 +25142,7 @@ return /******/ (function(modules) { // webpackBootstrap setFileSearchQuery(query); - if (_this2.state.symbolSearchEnabled) { + if (_this2.props.symbolSearchOn) { return yield _this2.updateSymbolSearchResults(query); } else if (ed) { _this2.searchContents(query); @@ -37337,9 +25178,9 @@ return /******/ (function(modules) { // webpackBootstrap } traverseSymbolResults(rev) { - var _state2 = this.state, - symbolSearchResults = _state2.symbolSearchResults, - selectedResultIndex = _state2.selectedResultIndex; + var _state = this.state, + symbolSearchResults = _state.symbolSearchResults, + selectedResultIndex = _state.selectedResultIndex; var searchResults = symbolSearchResults; var resultCount = searchResults.length; @@ -37403,10 +25244,10 @@ return /******/ (function(modules) { // webpackBootstrap e.stopPropagation(); e.preventDefault(); - var symbolSearchEnabled = this.state.symbolSearchEnabled; + var symbolSearchOn = this.props.symbolSearchOn; - if (symbolSearchEnabled) { + if (symbolSearchOn) { return this.traverseSymbolResults(rev); } @@ -37450,19 +25291,19 @@ return /******/ (function(modules) { // webpackBootstrap } onKeyUp(e) { - if (e.key !== "Enter" || e.key !== "F3") { + if (e.key !== "Enter" && e.key !== "F3") { return; } this.traverseResults(e, e.shiftKey); + e.preventDefault(); } onKeyDown(e) { - var _state3 = this.state, - symbolSearchEnabled = _state3.symbolSearchEnabled, - symbolSearchResults = _state3.symbolSearchResults; + var symbolSearchOn = this.props.symbolSearchOn; + var symbolSearchResults = this.state.symbolSearchResults; - if (!symbolSearchEnabled || this.props.query == "") { + if (!symbolSearchOn || this.props.query == "") { return; } @@ -37488,7 +25329,7 @@ return /******/ (function(modules) { // webpackBootstrap // Renderers buildSummaryMsg() { - if (this.state.symbolSearchEnabled) { + if (this.props.symbolSearchOn) { if (this.state.symbolSearchResults.length > 1) { return L10N.getFormatStr("editor.searchResults", this.state.selectedResultIndex + 1, this.state.symbolSearchResults.length); } else if (this.state.symbolSearchResults.length === 1) { @@ -37519,11 +25360,12 @@ return /******/ (function(modules) { // webpackBootstrap } buildPlaceHolder() { - var _state4 = this.state, - symbolSearchEnabled = _state4.symbolSearchEnabled, - selectedSymbolType = _state4.selectedSymbolType; + var _props10 = this.props, + symbolSearchOn = _props10.symbolSearchOn, + selectedSymbolType = _props10.selectedSymbolType; - if (symbolSearchEnabled) { + if (symbolSearchOn) { + // prettier-ignore return L10N.getFormatStr(`symbolSearch.search.${selectedSymbolType}Placeholder`); } @@ -37531,23 +25373,19 @@ return /******/ (function(modules) { // webpackBootstrap } renderSearchModifiers() { - if (!(0, _devtoolsConfig.isEnabled)("searchModifiers")) { - return; - } - - var _props10 = this.props, - modifiers = _props10.modifiers, - toggleFileSearchModifier = _props10.toggleFileSearchModifier; - var symbolSearchEnabled = this.state.symbolSearchEnabled; + var _props11 = this.props, + modifiers = _props11.modifiers, + toggleFileSearchModifier = _props11.toggleFileSearchModifier, + symbolSearchOn = _props11.symbolSearchOn; function searchModBtn(modVal, className, svgName, tooltip) { return _react.DOM.button({ className: (0, _classnames2.default)(className, { - active: !symbolSearchEnabled && modifiers && modifiers.get(modVal), - disabled: symbolSearchEnabled + active: !symbolSearchOn && modifiers && modifiers.get(modVal), + disabled: symbolSearchOn }), - onClick: () => !symbolSearchEnabled ? toggleFileSearchModifier(modVal) : null, + onClick: () => !symbolSearchOn ? toggleFileSearchModifier(modVal) : null, title: tooltip }, (0, _Svg2.default)(svgName)); } @@ -37556,19 +25394,16 @@ return /******/ (function(modules) { // webpackBootstrap } renderSearchTypeToggle() { - if (!(0, _devtoolsConfig.isEnabled)("symbolSearch")) { - return; - } var toggleSymbolSearch = this.toggleSymbolSearch; - var _state5 = this.state, - symbolSearchEnabled = _state5.symbolSearchEnabled, - selectedSymbolType = _state5.selectedSymbolType; + var _props12 = this.props, + symbolSearchOn = _props12.symbolSearchOn, + selectedSymbolType = _props12.selectedSymbolType; function searchTypeBtn(searchType) { return _react.DOM.button({ className: (0, _classnames2.default)("search-type-btn", { - active: symbolSearchEnabled && selectedSymbolType == searchType + active: symbolSearchOn && selectedSymbolType == searchType }), onClick: e => { if (selectedSymbolType == searchType) { @@ -37584,21 +25419,18 @@ return /******/ (function(modules) { // webpackBootstrap } renderBottomBar() { - if (!(0, _devtoolsConfig.isEnabled)("searchModifiers") || !(0, _devtoolsConfig.isEnabled)("symbolSearch")) { - return; - } - return _react.DOM.div({ className: "search-bottom-bar" }, this.renderSearchTypeToggle(), this.renderSearchModifiers()); } renderResults() { - var _state6 = this.state, - symbolSearchEnabled = _state6.symbolSearchEnabled, - symbolSearchResults = _state6.symbolSearchResults, - selectedResultIndex = _state6.selectedResultIndex; - var query = this.props.query; + var _state2 = this.state, + symbolSearchResults = _state2.symbolSearchResults, + selectedResultIndex = _state2.selectedResultIndex; + var _props13 = this.props, + query = _props13.query, + symbolSearchOn = _props13.symbolSearchOn; - if (query == "" || !symbolSearchEnabled || !symbolSearchResults.length) { + if (query == "" || !symbolSearchOn || !symbolSearchResults.length) { return; } @@ -37611,10 +25443,10 @@ return /******/ (function(modules) { // webpackBootstrap } render() { - var _props11 = this.props, - count = _props11.searchResults.count, - query = _props11.query, - searchOn = _props11.searchOn; + var _props14 = this.props, + count = _props14.searchResults.count, + query = _props14.query, + searchOn = _props14.searchOn; if (!searchOn) { @@ -37650,6 +25482,10 @@ return /******/ (function(modules) { // webpackBootstrap wholeWord: _react.PropTypes.bool.isRequired }).isRequired, toggleFileSearchModifier: _react.PropTypes.func.isRequired, + symbolSearchOn: _react.PropTypes.bool.isRequired, + selectedSymbolType: _react.PropTypes.string, + toggleSymbolSearch: _react.PropTypes.func.isRequired, + setSelectedSymbolType: _react.PropTypes.func.isRequired, query: _react.PropTypes.string.isRequired, setFileSearchQuery: _react.PropTypes.func.isRequired, updateSearchResults: _react.PropTypes.func.isRequired @@ -37665,7 +25501,9 @@ return /******/ (function(modules) { // webpackBootstrap return { searchOn: (0, _selectors.getFileSearchState)(state), query: (0, _selectors.getFileSearchQueryState)(state), - modifiers: (0, _selectors.getFileSearchModifierState)(state) + modifiers: (0, _selectors.getFileSearchModifierState)(state), + symbolSearchOn: (0, _selectors.getSymbolSearchState)(state), + selectedSymbolType: (0, _selectors.getSymbolSearchType)(state) }; }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SearchBar); @@ -37838,7 +25676,42 @@ return /******/ (function(modules) { // webpackBootstrap /* 599 */, /* 600 */, /* 601 */, -/* 602 */, +/* 602 */ +/***/ function(module, exports, __webpack_require__) { + + var baseGetTag = __webpack_require__(6), + isArray = __webpack_require__(70), + isObjectLike = __webpack_require__(14); + + /** `Object#toString` result references. */ + var stringTag = '[object String]'; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + module.exports = isString; + + +/***/ }, /* 603 */, /* 604 */, /* 605 */, @@ -38236,8 +26109,6 @@ return /******/ (function(modules) { // webpackBootstrap var _devtoolsLaunchpad = __webpack_require__(131); - var _devtoolsConfig = __webpack_require__(828); - var _devtoolsSourceMap = __webpack_require__(898); var _clipboard = __webpack_require__(423); @@ -38324,7 +26195,7 @@ return /******/ (function(modules) { // webpackBootstrap var menuItems = [copySourceUrl, jumpLabel, showSourceMenuItem, blackBoxMenuItem]; - if ((0, _devtoolsConfig.isEnabled)("watchExpressions") && textSelected) { + if (textSelected) { menuItems.push(watchExpressionLabel); } @@ -38345,39 +26216,48 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _react2 = _interopRequireDefault(_react); - var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); + var _devtoolsConfig = __webpack_require__(828); + + var _ObjectInspector2 = __webpack_require__(696); + + var _ObjectInspector3 = _interopRequireDefault(_ObjectInspector2); + + var _Popover2 = __webpack_require__(698); + + var _Popover3 = _interopRequireDefault(_Popover2); + + var _previewFunction = __webpack_require__(701); + + var _previewFunction2 = _interopRequireDefault(_previewFunction); + + var _selectors = __webpack_require__(242); + var _actions = __webpack_require__(244); var _actions2 = _interopRequireDefault(_actions); - var _selectors = __webpack_require__(242); - var _objectInspector = __webpack_require__(658); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var _Rep = __webpack_require__(697); - var ObjectInspector = _react2.default.createFactory(__webpack_require__(696).default); - var Popover = _react2.default.createFactory(__webpack_require__(698).default); - var previewFunction = __webpack_require__(701).default; - - var Rep = __webpack_require__(697).default; - - var _require = __webpack_require__(924), - MODE = _require.MODE; - - var dom = _react2.default.DOM, - PropTypes = _react2.default.PropTypes, - Component = _react2.default.Component; + var _Rep2 = _interopRequireDefault(_Rep); + var _devtoolsReps = __webpack_require__(924); __webpack_require__(709); - class Preview extends Component { + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var ObjectInspector = (0, _react.createFactory)(_ObjectInspector3.default); + + var Popover = (0, _react.createFactory)(_Popover3.default); + + class Preview extends _react.Component { + componentDidMount() { var _props = this.props, loadObjectProperties = _props.loadObjectProperties, @@ -38415,18 +26295,18 @@ return /******/ (function(modules) { // webpackBootstrap var location = value.location; - return dom.div({ + return _react.DOM.div({ className: "preview", onClick: () => selectSourceURL(location.url, { line: location.line }) - }, previewFunction(value)); + }, (0, _previewFunction2.default)(value)); } renderObjectPreview(expression, root) { - return dom.div({ className: "preview" }, this.renderObjectInspector(root)); + return _react.DOM.div({ className: "preview" }, this.renderObjectInspector(root)); } renderSimplePreview(value) { - return dom.div({ className: "preview" }, Rep({ object: value, mode: MODE.LONG })); + return _react.DOM.div({ className: "preview" }, (0, _Rep2.default)({ object: value, mode: _devtoolsReps.MODE.LONG })); } renderObjectInspector(root) { @@ -38448,6 +26328,21 @@ return /******/ (function(modules) { // webpackBootstrap }); } + renderAddToExpressionBar(expression) { + if (!(0, _devtoolsConfig.isEnabled)("previewWatch")) { + return null; + } + + var addExpression = this.props.addExpression; + + return _react.DOM.div({ className: "add-to-expression-bar" }, _react.DOM.div({ className: "prompt" }, "»"), _react.DOM.div({ className: "expression-to-save-label" }, expression), _react.DOM.div({ + className: "expression-to-save-button", + onClick: event => { + addExpression(expression); + } + }, L10N.getStr("addWatchExpressionButton"))); + } + renderPreview(expression, value) { var root = { name: expression, @@ -38460,7 +26355,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (value.type === "object") { - return this.renderObjectPreview(expression, root); + return _react.DOM.div({}, this.renderObjectPreview(expression, root), this.renderAddToExpressionBar(expression, value)); } return this.renderSimplePreview(value); @@ -38484,17 +26379,6 @@ return /******/ (function(modules) { // webpackBootstrap } } - Preview.propTypes = { - loadObjectProperties: PropTypes.func, - loadedObjects: PropTypes.object, - selectedFrame: PropTypes.object, - popoverTarget: PropTypes.object, - value: PropTypes.any, - expression: PropTypes.string, - onClose: PropTypes.func, - selectSourceURL: PropTypes.func - }; - Preview.displayName = "Preview"; exports.default = (0, _reactRedux.connect)(state => ({ @@ -38846,10 +26730,13 @@ return /******/ (function(modules) { // webpackBootstrap var _objectInspector = __webpack_require__(658); + var _ManagedTree2 = __webpack_require__(419); + + var _ManagedTree3 = _interopRequireDefault(_ManagedTree2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ManagedTree = (0, _react.createFactory)(__webpack_require__(419).default); - + var ManagedTree = (0, _react.createFactory)(_ManagedTree3.default); // This implements a component that renders an interactive inspector // for looking at JavaScript objects. It expects descriptions of @@ -39046,16 +26933,12 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _react2 = _interopRequireDefault(_react); + var _devtoolsReps = __webpack_require__(924); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var _Rep = _devtoolsReps.REPS.Rep, + Grip = _devtoolsReps.REPS.Grip; - var _require = __webpack_require__(924), - _require$REPS = _require.REPS, - Rep = _require$REPS.Rep, - Grip = _require$REPS.Grip; - - Rep = _react2.default.createFactory(Rep); + var Rep = (0, _react.createFactory)(_Rep); function renderRep(_ref) { var object = _ref.object, @@ -39076,17 +26959,18 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + var _classnames = __webpack_require__(175); var _classnames2 = _interopRequireDefault(_classnames); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var ReactDOM = __webpack_require__(22); - - __webpack_require__(699); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + class Popover extends _react.Component { constructor() { super(); @@ -39111,7 +26995,7 @@ return /******/ (function(modules) { // webpackBootstrap } getPopoverCoords() { - var el = ReactDOM.findDOMNode(this); + var el = _reactDom2.default.findDOMNode(this); var _el$getBoundingClient = el.getBoundingClientRect(), width = _el$getBoundingClient.width, @@ -39134,7 +27018,7 @@ return /******/ (function(modules) { // webpackBootstrap } getTooltipCoords() { - var el = ReactDOM.findDOMNode(this); + var el = _reactDom2.default.findDOMNode(this); var _el$getBoundingClient2 = el.getBoundingClientRect(), height = _el$getBoundingClient2.height; @@ -39246,12 +27130,12 @@ return /******/ (function(modules) { // webpackBootstrap var _flatten2 = _interopRequireDefault(_flatten); + __webpack_require__(1002); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - __webpack_require__(971); - function renderFunctionName(value) { var name = value.userDisplayName || value.displayName || value.name || ""; return _react.DOM.span({ className: "function-name" }, name); @@ -39552,6 +27436,10 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + var _Close = __webpack_require__(378); var _Close2 = _interopRequireDefault(_Close); @@ -39560,9 +27448,6 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ReactDOM = __webpack_require__(22); - - function renderConditionalPanel(_ref) { var condition = _ref.condition, closePanel = _ref.closePanel, @@ -39591,7 +27476,7 @@ return /******/ (function(modules) { // webpackBootstrap } } - ReactDOM.render(_react.DOM.div({ className: "conditional-breakpoint-panel" }, _react.DOM.div({ className: "prompt" }, "»"), _react.DOM.input({ + _reactDom2.default.render(_react.DOM.div({ className: "conditional-breakpoint-panel" }, _react.DOM.div({ className: "prompt" }, "»"), _react.DOM.input({ defaultValue: condition, placeholder: L10N.getStr("editor.conditionalPanel.placeholder"), onKeyDown: onKey, @@ -39628,6 +27513,10 @@ return /******/ (function(modules) { // webpackBootstrap var _devtoolsConfig = __webpack_require__(828); + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + var _classnames = __webpack_require__(175); var _classnames2 = _interopRequireDefault(_classnames); @@ -39638,10 +27527,9 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ReactDOM = __webpack_require__(22); - var breakpointSvg = document.createElement("div"); - ReactDOM.render((0, _Svg2.default)("breakpoint"), breakpointSvg); + + _reactDom2.default.render((0, _Svg2.default)("breakpoint"), breakpointSvg); function makeMarker(isDisabled) { var bp = breakpointSvg.cloneNode(true); @@ -39825,28 +27713,69 @@ return /******/ (function(modules) { // webpackBootstrap var _prefs = __webpack_require__(226); + var _WhyPaused2 = __webpack_require__(722); + + var _WhyPaused3 = _interopRequireDefault(_WhyPaused2); + + var _Breakpoints2 = __webpack_require__(725); + + var _Breakpoints3 = _interopRequireDefault(_Breakpoints2); + var _Expressions2 = __webpack_require__(719); var _Expressions3 = _interopRequireDefault(_Expressions2); + var _devtoolsSplitter = __webpack_require__(910); + + var _devtoolsSplitter2 = _interopRequireDefault(_devtoolsSplitter); + + var _Frames2 = __webpack_require__(1005); + + var _Frames3 = _interopRequireDefault(_Frames2); + + var _EventListeners2 = __webpack_require__(736); + + var _EventListeners3 = _interopRequireDefault(_EventListeners2); + + var _Accordion2 = __webpack_require__(739); + + var _Accordion3 = _interopRequireDefault(_Accordion2); + + var _CommandBar2 = __webpack_require__(742); + + var _CommandBar3 = _interopRequireDefault(_CommandBar2); + + var _ChromeScopes = __webpack_require__(728); + + var _ChromeScopes2 = _interopRequireDefault(_ChromeScopes); + + var _Scopes2 = __webpack_require__(731); + + var _Scopes3 = _interopRequireDefault(_Scopes2); + __webpack_require__(745); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - var WhyPaused = (0, _react.createFactory)(__webpack_require__(722).default); - var Breakpoints = (0, _react.createFactory)(__webpack_require__(725).default); + var WhyPaused = (0, _react.createFactory)(_WhyPaused3.default); + + var Breakpoints = (0, _react.createFactory)(_Breakpoints3.default); var Expressions = (0, _react.createFactory)(_Expressions3.default); - var SplitBox = (0, _react.createFactory)(__webpack_require__(830).SplitBox); - var Scopes = (0, _devtoolsConfig.isEnabled)("chromeScopes") ? (0, _react.createFactory)(__webpack_require__(728).default) : (0, _react.createFactory)(__webpack_require__(731).default); + var SplitBox = (0, _react.createFactory)(_devtoolsSplitter2.default); - var Frames = (0, _react.createFactory)(__webpack_require__(733).default); - var EventListeners = (0, _react.createFactory)(__webpack_require__(736).default); - var Accordion = (0, _react.createFactory)(__webpack_require__(739).default); - var CommandBar = (0, _react.createFactory)(__webpack_require__(742).default); + var Frames = (0, _react.createFactory)(_Frames3.default); + + var EventListeners = (0, _react.createFactory)(_EventListeners3.default); + + var Accordion = (0, _react.createFactory)(_Accordion3.default); + + var CommandBar = (0, _react.createFactory)(_CommandBar3.default); + + var Scopes = (0, _devtoolsConfig.isEnabled)("chromeScopes") ? (0, _react.createFactory)(_ChromeScopes2.default) : (0, _react.createFactory)(_Scopes3.default); function debugBtn(onClick, type, className, tooltip) { className = `${type} ${className}`; @@ -39940,7 +27869,7 @@ return /******/ (function(modules) { // webpackBootstrap }); } - if ((0, _devtoolsConfig.isEnabled)("watchExpressions") && this.props.horizontal) { + if (this.props.horizontal) { items.unshift(this.getWatchItem()); } @@ -39960,7 +27889,7 @@ return /******/ (function(modules) { // webpackBootstrap items.unshift(this.getScopeItem()); } - if ((0, _devtoolsConfig.isEnabled)("watchExpressions") && !this.props.horizontal) { + if (!this.props.horizontal) { items.unshift(this.getWatchItem()); } @@ -40026,8 +27955,6 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _react2 = _interopRequireDefault(_react); - var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); @@ -40042,14 +27969,21 @@ return /******/ (function(modules) { // webpackBootstrap var _selectors = __webpack_require__(242); + var _Close = __webpack_require__(378); + + var _Close2 = _interopRequireDefault(_Close); + + var _ObjectInspector2 = __webpack_require__(696); + + var _ObjectInspector3 = _interopRequireDefault(_ObjectInspector2); + __webpack_require__(720); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var CloseButton = _react2.default.createFactory(__webpack_require__(378).default); - var ObjectInspector = _react2.default.createFactory(__webpack_require__(696).default); - var dom = _react2.default.DOM, - PropTypes = _react2.default.PropTypes; + var CloseButton = (0, _react.createFactory)(_Close2.default); + + var ObjectInspector = (0, _react.createFactory)(_ObjectInspector3.default); function getValue(expression) { var value = expression.value; @@ -40080,7 +28014,7 @@ return /******/ (function(modules) { // webpackBootstrap }; } - class Expressions extends _react2.default.Component { + class Expressions extends _react.PureComponent { constructor() { super(...arguments); @@ -40144,7 +28078,7 @@ return /******/ (function(modules) { // webpackBootstrap } renderExpressionEditInput(expression) { - return dom.span({ className: "expression-input-container" }, dom.input({ + return _react.DOM.span({ className: "expression-input-container" }, _react.DOM.input({ type: "text", className: "input-expression", onKeyPress: e => this.inputKeyPress(e, expression), @@ -40185,7 +28119,7 @@ return /******/ (function(modules) { // webpackBootstrap contents: { value } }; - return dom.div({ + return _react.DOM.div({ className: "expression-container", key: path || input }, ObjectInspector({ @@ -40219,7 +28153,7 @@ return /******/ (function(modules) { // webpackBootstrap e.target.value = ""; this.props.addExpression(value); }; - return dom.span({ className: "expression-input-container" }, dom.input({ + return _react.DOM.span({ className: "expression-input-container" }, _react.DOM.input({ type: "text", className: "input-expression", placeholder: L10N.getStr("expressions.placeholder"), @@ -40233,17 +28167,17 @@ return /******/ (function(modules) { // webpackBootstrap render() { var expressions = this.props.expressions; - return dom.span({ className: "pane expressions-list" }, expressions.map(this.renderExpression), this.renderNewExpressionInput()); + return _react.DOM.span({ className: "pane expressions-list" }, expressions.map(this.renderExpression), this.renderNewExpressionInput()); } } Expressions.propTypes = { expressions: _reactImmutableProptypes2.default.list.isRequired, - addExpression: PropTypes.func.isRequired, - evaluateExpressions: PropTypes.func.isRequired, - updateExpression: PropTypes.func.isRequired, - deleteExpression: PropTypes.func.isRequired, - loadObjectProperties: PropTypes.func, + addExpression: _react.PropTypes.func.isRequired, + evaluateExpressions: _react.PropTypes.func.isRequired, + updateExpression: _react.PropTypes.func.isRequired, + deleteExpression: _react.PropTypes.func.isRequired, + loadObjectProperties: _react.PropTypes.func, loadedObjects: _reactImmutableProptypes2.default.map.isRequired }; @@ -40288,24 +28222,45 @@ return /******/ (function(modules) { // webpackBootstrap var _selectors = __webpack_require__(242); + var _isString = __webpack_require__(602); + + var _isString2 = _interopRequireDefault(_isString); + var _pause = __webpack_require__(255); __webpack_require__(723); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function renderExceptionSummary(exception) { + if ((0, _isString2.default)(exception)) { + return exception; + } + + var message = exception.getIn(["preview", "message"]); + var name = exception.getIn(["preview", "name"]); + + return `${name}: ${message}`; + } + + class WhyPaused extends _react.Component { renderMessage(pauseInfo) { if (!pauseInfo) { return null; } - var message = pauseInfo.getIn(["why"]).get("message"); - if (!message) { - return null; + var message = pauseInfo.getIn(["why", "message"]); + if (message) { + return _react.DOM.div({ className: "message" }, message); } - return _react.DOM.div(null, message); + var exception = pauseInfo.getIn(["why", "exception"]); + if (exception) { + return _react.DOM.div({ className: "message" }, renderExceptionSummary(exception)); + } + + return null; } render() { @@ -40352,6 +28307,8 @@ return /******/ (function(modules) { // webpackBootstrap var _reactRedux = __webpack_require__(151); + var _reselect = __webpack_require__(992); + var _redux = __webpack_require__(3); var _reactImmutableProptypes = __webpack_require__(150); @@ -40382,8 +28339,7 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function isCurrentlyPausedAtBreakpoint(state, breakpoint) { - var pause = (0, _selectors.getPause)(state); + function isCurrentlyPausedAtBreakpoint(pause, breakpoint) { if (!pause || pause.get("isInterrupted")) { return false; } @@ -40394,13 +28350,14 @@ return /******/ (function(modules) { // webpackBootstrap return bpId === pausedId; } + function renderSourceLocation(source, line) { var url = source.get("url") ? (0, _path.basename)(source.get("url")) : null; // const line = url !== "" ? `: ${line}` : ""; return url ? _react.DOM.div({ className: "location" }, `${(0, _utils.endTruncateStr)(url, 30)}: ${line}`) : null; } - class Breakpoints extends _react.Component { + class Breakpoints extends _react.PureComponent { shouldComponentUpdate(nextProps, nextState) { var breakpoints = this.props.breakpoints; @@ -40480,9 +28437,9 @@ return /******/ (function(modules) { // webpackBootstrap removeBreakpoint: _react.PropTypes.func.isRequired }; - function updateLocation(state, bp) { - var source = (0, _selectors.getSource)(state, bp.location.sourceId); - var isCurrentlyPaused = isCurrentlyPausedAtBreakpoint(state, bp); + function updateLocation(sources, pause, bp) { + var source = (0, _selectors.getSourceInSources)(sources, bp.location.sourceId); + var isCurrentlyPaused = isCurrentlyPausedAtBreakpoint(pause, bp); var locationId = (0, _breakpoints.makeLocationId)(bp.location); var location = Object.assign({}, bp.location, { source }); @@ -40495,9 +28452,7 @@ return /******/ (function(modules) { // webpackBootstrap return localBP; } - function _getBreakpoints(state) { - return (0, _selectors.getBreakpoints)(state).map(bp => updateLocation(state, bp)).filter(bp => bp.location.source && !bp.location.source.get("isBlackBoxed")); - } + var _getBreakpoints = (0, _reselect.createSelector)(_selectors.getBreakpoints, _selectors.getSources, _selectors.getPause, (breakpoints, sources, pause) => breakpoints.map(bp => updateLocation(sources, pause, bp)).filter(bp => bp.location.source && !bp.location.source.get("isBlackBoxed"))); exports.default = (0, _reactRedux.connect)((state, props) => ({ breakpoints: _getBreakpoints(state) }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Breakpoints); @@ -40528,26 +28483,29 @@ return /******/ (function(modules) { // webpackBootstrap var _reactRedux = __webpack_require__(151); + var _classnames = __webpack_require__(175); + + var _classnames2 = _interopRequireDefault(_classnames); + var _actions = __webpack_require__(244); var _actions2 = _interopRequireDefault(_actions); var _selectors = __webpack_require__(242); - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - var _Svg = __webpack_require__(344); var _Svg2 = _interopRequireDefault(_Svg); __webpack_require__(729); + var _ManagedTree2 = __webpack_require__(419); + + var _ManagedTree3 = _interopRequireDefault(_ManagedTree2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ManagedTree = (0, _react.createFactory)(__webpack_require__(419).default); - + var ManagedTree = (0, _react.createFactory)(_ManagedTree3.default); function info(text) { return _react.DOM.div({ className: "pane-info" }, text); @@ -40769,12 +28727,15 @@ return /******/ (function(modules) { // webpackBootstrap var _scopes = __webpack_require__(732); + var _ObjectInspector2 = __webpack_require__(696); + + var _ObjectInspector3 = _interopRequireDefault(_ObjectInspector2); + __webpack_require__(729); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ObjectInspector = (0, _react.createFactory)(__webpack_require__(696).default); - + var ObjectInspector = (0, _react.createFactory)(_ObjectInspector3.default); function info(text) { return _react.DOM.div({ className: "pane-info" }, text); @@ -40783,7 +28744,7 @@ return /******/ (function(modules) { // webpackBootstrap var expandedCache = new Set(); var actorsCache = []; - class Scopes extends _react.Component { + class Scopes extends _react.PureComponent { constructor(props) { var pauseInfo = props.pauseInfo, @@ -40800,19 +28761,10 @@ return /******/ (function(modules) { // webpackBootstrap }; } - shouldComponentUpdate(nextProps, nextState) { + componentWillReceiveProps(nextProps) { var _props = this.props, pauseInfo = _props.pauseInfo, - selectedFrame = _props.selectedFrame, - loadedObjects = _props.loadedObjects; - - return pauseInfo !== nextProps.pauseInfo || selectedFrame !== nextProps.selectedFrame || loadedObjects !== nextProps.loadedObjects; - } - - componentWillReceiveProps(nextProps) { - var _props2 = this.props, - pauseInfo = _props2.pauseInfo, - selectedFrame = _props2.selectedFrame; + selectedFrame = _props.selectedFrame; var pauseInfoChanged = pauseInfo !== nextProps.pauseInfo; var selectedFrameChange = selectedFrame !== nextProps.selectedFrame; @@ -40825,10 +28777,10 @@ return /******/ (function(modules) { // webpackBootstrap } render() { - var _props3 = this.props, - pauseInfo = _props3.pauseInfo, - loadObjectProperties = _props3.loadObjectProperties, - loadedObjects = _props3.loadedObjects; + var _props2 = this.props, + pauseInfo = _props2.pauseInfo, + loadObjectProperties = _props2.loadObjectProperties, + loadedObjects = _props2.loadedObjects; var scopes = this.state.scopes; @@ -40880,6 +28832,13 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getSpecialVariables = getSpecialVariables; + exports.getScopes = getScopes; + exports.getVisibleVariablesFromScope = getVisibleVariablesFromScope; + var _toPairs = __webpack_require__(195); var _toPairs2 = _interopRequireDefault(_toPairs); @@ -40972,10 +28931,14 @@ return /******/ (function(modules) { // webpackBootstrap var scope = selectedScope; var pausedScopeActor = pauseInfo.getIn(["frame", "scope"]).get("actor"); + var scopeIndex = 1; do { - var type = scope.type; - var key = scope.actor; + var _scope = scope, + type = _scope.type, + actor = _scope.actor; + + var key = `${actor}-${scopeIndex}`; if (type === "function" || type === "block") { var bindings = scope.bindings; var title = void 0; @@ -40985,7 +28948,7 @@ return /******/ (function(modules) { // webpackBootstrap title = L10N.getStr("scopes.block"); } - var vars = getBindingVariables(bindings, title); + var vars = getBindingVariables(bindings, key); // show exception, return, and this variables in innermost scope if (scope.actor === pausedScopeActor) { @@ -41002,7 +28965,11 @@ return /******/ (function(modules) { // webpackBootstrap if (vars && vars.length) { vars.sort((a, b) => a.name.localeCompare(b.name)); - scopes.push({ name: title, path: key, contents: vars }); + scopes.push({ + name: title, + path: key, + contents: vars + }); } } else if (type === "object") { var value = scope.object; @@ -41017,6 +28984,7 @@ return /******/ (function(modules) { // webpackBootstrap contents: { value } }); } + scopeIndex++; } while (scope = scope.parent); // eslint-disable-line no-cond-assign return scopes; @@ -41047,276 +29015,9 @@ return /******/ (function(modules) { // webpackBootstrap return result; } - module.exports = { - getScopes, - getSpecialVariables, - getVisibleVariablesFromScope - }; - -/***/ }, -/* 733 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var _react = __webpack_require__(2); - - var _redux = __webpack_require__(3); - - var _reactRedux = __webpack_require__(151); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _utils = __webpack_require__(234); - - var _source = __webpack_require__(233); - - var _function = __webpack_require__(973); - - var _function2 = _interopRequireDefault(_function); - - var _get = __webpack_require__(67); - - var _get2 = _interopRequireDefault(_get); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _devtoolsConfig = __webpack_require__(828); - - var _devtoolsLaunchpad = __webpack_require__(131); - - var _clipboard = __webpack_require__(423); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - __webpack_require__(734); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var _require = __webpack_require__(242), - getFrames = _require.getFrames, - getSelectedFrame = _require.getSelectedFrame, - getSource = _require.getSource; - - var NUM_FRAMES_SHOWN = 7; - - function renderFrameTitle(_ref) { - var displayName = _ref.displayName; - - var simplifiedDisplaName = (0, _function2.default)(displayName); - var truncatedDisplayName = (0, _utils.endTruncateStr)(simplifiedDisplaName, 40); - return _react.DOM.div({ className: "title" }, truncatedDisplayName); - } - - function renderFrameLocation(_ref2) { - var source = _ref2.source, - location = _ref2.location, - library = _ref2.library; - - var thisSource = source; - if (thisSource == null) { - return; - } - - if (library) { - return _react.DOM.div({ className: "location" }, library, (0, _Svg2.default)(library.toLowerCase(), { className: "annotation-logo" })); - } - - var filename = (0, _source.getFilename)(thisSource); - return _react.DOM.div({ className: "location" }, `${filename}: ${location.line}`); - } - - class Frames extends _react.Component { - - constructor() { - super(...arguments); - - this.state = { - showAllFrames: false - }; - - this.renderFrame = this.renderFrame.bind(this); - this.toggleFramesDisplay = this.toggleFramesDisplay.bind(this); - } - - shouldComponentUpdate(nextProps, nextState) { - var _props = this.props, - frames = _props.frames, - selectedFrame = _props.selectedFrame; - var showAllFrames = this.state.showAllFrames; - - return frames !== nextProps.frames || selectedFrame !== nextProps.selectedFrame || showAllFrames !== nextState.showAllFrames; - } - - toggleFramesDisplay() { - this.setState({ - showAllFrames: !this.state.showAllFrames - }); - } - - onContextMenu(event, frame) { - var copySourceUrlLabel = L10N.getStr("copySourceUrl"); - var copySourceUrlKey = L10N.getStr("copySourceUrl.accesskey"); - - event.stopPropagation(); - event.preventDefault(); - - var menuOptions = []; - - var source = frame.source; - if (source) { - var copySourceUrl = { - id: "node-menu-copy-source", - label: copySourceUrlLabel, - accesskey: copySourceUrlKey, - disabled: false, - click: () => (0, _clipboard.copyToTheClipboard)(source.url) - }; - - menuOptions.push(copySourceUrl); - } - - (0, _devtoolsLaunchpad.showMenu)(event, menuOptions); - } - - renderFrame(frame) { - var selectedFrame = this.props.selectedFrame; - - return _react.DOM.li({ - key: frame.id, - className: (0, _classnames2.default)("frame", { - selected: selectedFrame && selectedFrame.id === frame.id - }), - onMouseDown: e => this.onMouseDown(e, frame, selectedFrame), - onKeyUp: e => this.onKeyUp(e, frame, selectedFrame), - onContextMenu: e => this.onContextMenu(e, frame), - tabIndex: 0 - }, renderFrameTitle(frame), renderFrameLocation(frame)); - } - - onMouseDown(e, frame, selectedFrame) { - if (e.nativeEvent.which == 3 && selectedFrame.id != frame.id) { - return; - } - this.props.selectFrame(frame); - } - - onKeyUp(event, frame, selectedFrame) { - if (event.key != "Enter" || selectedFrame.id == frame.id) { - return; - } - this.props.selectFrame(frame); - } - - renderFrames(frames) { - var numFramesToShow = this.state.showAllFrames ? frames.length : NUM_FRAMES_SHOWN; - - var framesToShow = frames.slice(0, numFramesToShow); - - return _react.DOM.ul({}, framesToShow.map(this.renderFrame)); - } - - renderToggleButton(frames) { - var buttonMessage = this.state.showAllFrames ? L10N.getStr("callStack.collapse") : L10N.getStr("callStack.expand"); - - if (frames.length < NUM_FRAMES_SHOWN) { - return null; - } - - return _react.DOM.div({ className: "show-more", onClick: this.toggleFramesDisplay }, buttonMessage); - } - - render() { - var frames = this.props.frames; - - - if (!frames) { - return _react.DOM.div({ className: "pane frames" }, _react.DOM.div({ className: "pane-info empty" }, L10N.getStr("callStack.notPaused"))); - } - - return _react.DOM.div({ className: "pane frames" }, this.renderFrames(frames), this.renderToggleButton(frames)); - } - } - - Frames.propTypes = { - frames: _react.PropTypes.array, - selectedFrame: _react.PropTypes.object, - selectFrame: _react.PropTypes.func.isRequired - }; - - Frames.displayName = "Frames"; - - function getSourceForFrame(state, frame) { - return getSource(state, frame.location.sourceId); - } - - function filterFrameworkFrames(frames) { - return (0, _utils.filterDuplicates)(frames, (_ref3) => { - var _ref4 = _slicedToArray(_ref3, 2), - prev = _ref4[0], - item = _ref4[1]; - - return !(prev.library && prev.library == item.library); - }); - } - - function annotateFrame(frame) { - if (!(0, _devtoolsConfig.isEnabled)("collapseFrame")) { - return frame; - } - var source = frame.source; - - if (source && source.url && source.url.match(/react/i)) { - return Object.assign({}, frame, { - library: "React" - }); - } - return frame; - } - - function appendSource(state, frame) { - return Object.assign({}, frame, { - source: getSourceForFrame(state, frame).toJS() - }); - } - - function getAndProcessFrames(state) { - var frames = getFrames(state); - if (!frames) { - return null; - } - - frames = frames.toJS().filter(frame => getSourceForFrame(state, frame)).map(frame => Object.assign({}, frame, { - source: getSourceForFrame(state, frame).toJS() - })).filter(frame => !(0, _get2.default)(frame, "source.isBlackBoxed")).map(frame => appendSource(state, frame)).map(annotateFrame); - frames = filterFrameworkFrames(frames); - return frames; - } - - exports.default = (0, _reactRedux.connect)(state => ({ - frames: getAndProcessFrames(state), - selectedFrame: getSelectedFrame(state) - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Frames); - -/***/ }, -/* 734 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - /***/ }, +/* 733 */, +/* 734 */, /* 735 */, /* 736 */ /***/ function(module, exports, __webpack_require__) { @@ -41457,8 +29158,6 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _react2 = _interopRequireDefault(_react); - var _Svg = __webpack_require__(344); var _Svg2 = _interopRequireDefault(_Svg); @@ -41469,7 +29168,7 @@ return /******/ (function(modules) { // webpackBootstrap function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - class Accordion extends _react2.default.Component { + class Accordion extends _react.Component { constructor(props) { super(); @@ -41558,20 +29257,22 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); + var _reactDom = __webpack_require__(22); + var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); + var _reactImmutableProptypes = __webpack_require__(150); + + var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); + var _selectors = __webpack_require__(242); var _Svg = __webpack_require__(344); var _Svg2 = _interopRequireDefault(_Svg); - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - var _text = __webpack_require__(389); var _actions = __webpack_require__(244); @@ -41580,13 +29281,12 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(743); + var _devtoolsModules = __webpack_require__(830); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var _require = __webpack_require__(22), - findDOMNode = _require.findDOMNode; + var appinfo = _devtoolsModules.Services.appinfo; - var _require2 = __webpack_require__(830), - appinfo = _require2.Services.appinfo; var isMacOS = appinfo.OS === "Darwin"; @@ -41690,7 +29390,7 @@ return /******/ (function(modules) { // webpackBootstrap e.stopPropagation(); this.props[action](); - var node = findDOMNode(this); + var node = (0, _reactDom.findDOMNode)(this); if (node instanceof HTMLElement) { handlePressAnimation(node.querySelector(`.${action}`)); } @@ -41819,11 +29519,16 @@ return /******/ (function(modules) { // webpackBootstrap var _text = __webpack_require__(389); + var _PaneToggle = __webpack_require__(428); + + var _PaneToggle2 = _interopRequireDefault(_PaneToggle); + __webpack_require__(748); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var PaneToggleButton = (0, _react.createFactory)(__webpack_require__(428).default); + var PaneToggleButton = (0, _react.createFactory)(_PaneToggle2.default); + class WelcomeBox extends _react.Component { renderToggleButton() { @@ -41872,14 +29577,14 @@ return /******/ (function(modules) { // webpackBootstrap var _react = __webpack_require__(2); - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - var _reactRedux = __webpack_require__(151); var _redux = __webpack_require__(3); + var _immutable = __webpack_require__(146); + + var I = _interopRequireWildcard(_immutable); + var _selectors = __webpack_require__(242); var _source = __webpack_require__(233); @@ -41910,14 +29615,23 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(754); + var _PaneToggle = __webpack_require__(428); + + var _PaneToggle2 = _interopRequireDefault(_PaneToggle); + + var _Dropdown2 = __webpack_require__(751); + + var _Dropdown3 = _interopRequireDefault(_Dropdown2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - var PaneToggleButton = (0, _react.createFactory)(__webpack_require__(428).default); - - var Dropdown = (0, _react.createFactory)(__webpack_require__(751).default); + var PaneToggleButton = (0, _react.createFactory)(_PaneToggle2.default); + var Dropdown = (0, _react.createFactory)(_Dropdown3.default); /* * Finds the hidden tabs by comparing the tabs' top offset. @@ -41937,7 +29651,9 @@ return /******/ (function(modules) { // webpackBootstrap var tabTopOffset = getTopOffset(); return sourceTabs.filter((tab, index) => { - return sourceTabEls[index].getBoundingClientRect().top > tabTopOffset; + // adding 10px helps account for cases where the tab might be offset by + // styling such as selected tabs which don't have a border. + return sourceTabEls[index].getBoundingClientRect().top > tabTopOffset + 10; }); } @@ -41956,13 +29672,13 @@ return /******/ (function(modules) { // webpackBootstrap document.removeEventListener("copy", doCopy); } - class SourceTabs extends _react.Component { + class SourceTabs extends _react.PureComponent { constructor(props) { super(props); this.state = { dropdownShown: false, - hiddenSourceTabs: null + hiddenSourceTabs: I.List() }; this.onTabContextMenu = this.onTabContextMenu.bind(this); @@ -42032,6 +29748,11 @@ return /******/ (function(modules) { // webpackBootstrap var sourceTab = sourceTabs.find(t => t.get("id") == tab); var tabURLs = sourceTabs.map(thisTab => thisTab.get("url")); var otherTabURLs = otherTabs.map(thisTab => thisTab.get("url")); + + if (!sourceTab) { + return; + } + var isPrettySource = (0, _source.isPretty)(sourceTab.toJS()); var closeTabMenuItem = { @@ -42152,6 +29873,10 @@ return /******/ (function(modules) { // webpackBootstrap renderTabs() { var sourceTabs = this.props.sourceTabs; + if (!sourceTabs) { + return; + } + return _react.DOM.div({ className: "source-tabs", ref: "sourceTabs" }, sourceTabs.map(this.renderTab)); } @@ -42164,6 +29889,7 @@ return /******/ (function(modules) { // webpackBootstrap var filename = (0, _source.getFilename)(source.toJS()); var active = selectedSource && source.get("id") == selectedSource.get("id"); var isPrettyCode = (0, _source.isPretty)(source.toJS()); + var sourceAnnotation = this.getSourceAnnotation(source); function onClickClose(ev) { ev.stopPropagation(); @@ -42179,7 +29905,7 @@ return /******/ (function(modules) { // webpackBootstrap onClick: () => selectSource(source.get("id")), onContextMenu: e => this.onTabContextMenu(e, source.get("id")), title: (0, _source.getFilename)(source.toJS()) - }, isPrettyCode ? (0, _Svg2.default)("prettyPrint") : null, _react.DOM.div({ className: "filename" }, filename), (0, _Close2.default)({ + }, sourceAnnotation, _react.DOM.div({ className: "filename" }, filename), (0, _Close2.default)({ handleClick: onClickClose, tooltip: L10N.getStr("sourceTabs.closeTabButtonTooltip") })); @@ -42226,36 +29952,28 @@ return /******/ (function(modules) { // webpackBootstrap }); } + getSourceAnnotation(source) { + var sourceObj = source.toJS(); + + if ((0, _source.isPretty)(sourceObj)) { + return (0, _Svg2.default)("prettyPrint"); + } + if (sourceObj.isBlackBoxed) { + return (0, _Svg2.default)("blackBox"); + } + } + render() { return _react.DOM.div({ className: "source-header" }, this.renderStartPanelToggleButton(), this.renderTabs(), this.renderNewButton(), this.renderDropdown(), this.renderEndPanelToggleButton()); } } - SourceTabs.propTypes = { - sourceTabs: _reactImmutableProptypes2.default.list.isRequired, - selectedSource: _reactImmutableProptypes2.default.map, - selectSource: _react.PropTypes.func.isRequired, - closeTab: _react.PropTypes.func.isRequired, - closeTabs: _react.PropTypes.func.isRequired, - toggleProjectSearch: _react.PropTypes.func.isRequired, - togglePrettyPrint: _react.PropTypes.func.isRequired, - togglePaneCollapse: _react.PropTypes.func.isRequired, - showSource: _react.PropTypes.func.isRequired, - horizontal: _react.PropTypes.bool.isRequired, - startPanelCollapsed: _react.PropTypes.bool.isRequired, - endPanelCollapsed: _react.PropTypes.bool.isRequired - }; - SourceTabs.displayName = "SourceTabs"; - function getTabs(state) { - return (0, _selectors.getSourceTabs)(state).map(url => (0, _selectors.getSourceByURL)(state, url)); - } - module.exports = (0, _reactRedux.connect)(state => { return { selectedSource: (0, _selectors.getSelectedSource)(state), - sourceTabs: getTabs(state), + sourceTabs: (0, _selectors.getSourcesForTabs)(state), searchOn: (0, _selectors.getProjectSearchState)(state) }; }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SourceTabs); @@ -42463,6 +30181,10 @@ return /******/ (function(modules) { // webpackBootstrap var flag = __webpack_require__(121); + function isBrowser() { + return typeof window == "object" && typeof module == "undefined"; + } + /** * Gets a config value for a given key * e.g "chrome.webSocketPort" @@ -42480,6 +30202,14 @@ return /******/ (function(modules) { // webpackBootstrap } function isDevelopment() { + if (isBrowser()) { + if (true) { + return false; + } + var href = window.location ? window.location.href : ""; + return href.match(/^file:/) || href.match(/localhost:/); + } + if (isFirefoxPanel()) { // Default to production if compiling for the Firefox panel return ("production") === "development"; @@ -42514,13 +30244,9 @@ return /******/ (function(modules) { // webpackBootstrap function updateLocalConfig(relativePath) { var localConfigPath = path.resolve(relativePath, "../configs/local.json"); - try { - var output = JSON.stringify(config, null, 2); - fs.writeFileSync(localConfigPath, output); - return output; - } catch (err) { - return "{}"; - } + var output = JSON.stringify(config, null, 2); + fs.writeFileSync(localConfigPath, output, { flag: "w" }); + return output; } module.exports = { @@ -42543,5928 +30269,7312 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var AppConstants = __webpack_require__(831); - var clipboardHelper = __webpack_require__(832); - var DevToolsUtils = __webpack_require__(833); - var EventEmitter = __webpack_require__(844); - var FileSaver = __webpack_require__(845); - var frame = __webpack_require__(846); - var Menu = __webpack_require__(848); - var MenuItem = __webpack_require__(849); - var networkRequest = __webpack_require__(850); - var PrefsHelper = __webpack_require__(851).PrefsHelper; - var SearchBox = __webpack_require__(852); + var Menu = __webpack_require__(967); + var MenuItem = __webpack_require__(970); + + var _require = __webpack_require__(971), + PrefsHelper = _require.PrefsHelper; + var Services = __webpack_require__(29); - var sourceUtils = __webpack_require__(847); - var SplitBox = __webpack_require__(854); - var sprintf = __webpack_require__(856).sprintf; - // const Tabbar = require("./client/shared/components/tabs/tabbar"); - // const TabPanel = require("./client/shared/components/tabs/tabs"); - var Tree = __webpack_require__(857); - var WebsocketTransport = __webpack_require__(858); - var workerUtils = __webpack_require__(859); - var _require = __webpack_require__(860), - Chart = _require.Chart; - - var _require2 = __webpack_require__(861), - CurlUtils = _require2.CurlUtils; - - var _require3 = __webpack_require__(862), - DebuggerClient = _require3.DebuggerClient; - - var _require4 = __webpack_require__(866), - DebuggerTransport = _require4.DebuggerTransport; - - var defer = __webpack_require__(871); - - var _require5 = __webpack_require__(872), - gDevTools = _require5.gDevTools; - - var _require6 = __webpack_require__(873), - HTMLTooltip = _require6.HTMLTooltip; - - var _require7 = __webpack_require__(877), - KeyCodes = _require7.KeyCodes; - - var _require8 = __webpack_require__(853), - KeyShortcuts = _require8.KeyShortcuts; - - var _require9 = __webpack_require__(878), - PluralForm = _require9.PluralForm; - - var _require10 = __webpack_require__(879), - setNamedTimeout = _require10.setNamedTimeout; - - var _require11 = __webpack_require__(880), - TargetFactory = _require11.TargetFactory; - - var _require12 = __webpack_require__(881), - TimelineFront = _require12.TimelineFront; - // const { LocalizationHelper, localizeMarkup, MultiLocalizationHelper } = require("./shared/l10n"); + var _require2 = __webpack_require__(972), + KeyShortcuts = _require2.KeyShortcuts; module.exports = { - AppConstants, - Chart, - CurlUtils, - DebuggerClient, - DebuggerTransport, - defer, - DevToolsUtils, - EventEmitter, - FileSaver, - frame, - gDevTools, - HTMLTooltip, - KeyCodes, KeyShortcuts, Menu, MenuItem, - networkRequest, - PluralForm, PrefsHelper, - SearchBox, - Services, - setNamedTimeout, - sourceUtils, - SplitBox, - // LocalizationHelper, - // localizeMarkup, - // MultiLocalizationHelper, - sprintf, - // Tabbar, - // TabPanel, - TargetFactory, - TimelineFront, - Tree, - WebsocketTransport, - workerUtils, - clipboardHelper + Services }; /***/ }, -/* 831 */ -/***/ function(module, exports) { +/* 831 */, +/* 832 */, +/* 833 */, +/* 834 */, +/* 835 */, +/* 836 */, +/* 837 */, +/* 838 */, +/* 839 */, +/* 840 */, +/* 841 */, +/* 842 */, +/* 843 */, +/* 844 */, +/* 845 */, +/* 846 */, +/* 847 */, +/* 848 */, +/* 849 */, +/* 850 */, +/* 851 */, +/* 852 */, +/* 853 */, +/* 854 */, +/* 855 */, +/* 856 */, +/* 857 */, +/* 858 */, +/* 859 */, +/* 860 */, +/* 861 */, +/* 862 */, +/* 863 */, +/* 864 */, +/* 865 */, +/* 866 */, +/* 867 */, +/* 868 */, +/* 869 */, +/* 870 */, +/* 871 */, +/* 872 */, +/* 873 */, +/* 874 */, +/* 875 */, +/* 876 */, +/* 877 */, +/* 878 */, +/* 879 */, +/* 880 */, +/* 881 */, +/* 882 */, +/* 883 */ +/***/ function(module, exports, __webpack_require__) { - "use strict"; + __webpack_require__(884); + var fs = __webpack_require__(118); - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/AppConstants.jsm - */ + function Iterator(text) { + var pos = 0, length = text.length; - module.exports = { AppConstants: {} }; + this.peek = function(num) { + num = num || 0; + if(pos + num >= length) { return null; } -/***/ }, -/* 832 */ -/***/ function(module, exports) { + return text.charAt(pos + num); + }; + this.next = function(inc) { + inc = inc || 1; - "use strict"; + if(pos >= length) { return null; } - /** - * Clipboard function taken from - * https://dxr.mozilla.org/mozilla-central/source/devtools/shared/platform/content/clipboard.js - */ - function copyString(string) { - var doCopy = function (e) { - e.clipboardData.setData("text/plain", string); - e.preventDefault(); - }; - - document.addEventListener("copy", doCopy); - document.execCommand("copy", false, null); - document.removeEventListener("copy", doCopy); + return text.charAt((pos += inc) - inc); + }; + this.pos = function() { + return pos; + }; } - module.exports = { copyString }; + var rWhitespace = /\s/; + function isWhitespace(chr) { + return rWhitespace.test(chr); + } + function consumeWhiteSpace(iter) { + var start = iter.pos(); + + while(isWhitespace(iter.peek())) { iter.next(); } + + return { type: "whitespace", start: start, end: iter.pos() }; + } + + function startsComment(chr) { + return chr === "!" || chr === "#"; + } + function isEOL(chr) { + return chr == null || chr === "\n" || chr === "\r"; + } + function consumeComment(iter) { + var start = iter.pos(); + + while(!isEOL(iter.peek())) { iter.next(); } + + return { type: "comment", start: start, end: iter.pos() }; + } + + function startsKeyVal(chr) { + return !isWhitespace(chr) && !startsComment(chr); + } + function startsSeparator(chr) { + return chr === "=" || chr === ":" || isWhitespace(chr); + } + function startsEscapedVal(chr) { + return chr === "\\"; + } + function consumeEscapedVal(iter) { + var start = iter.pos(); + + iter.next(); // move past "\" + var curChar = iter.next(); + if(curChar === "u") { // encoded unicode char + iter.next(4); // Read in the 4 hex values + } + + return { type: "escaped-value", start: start, end: iter.pos() }; + } + function consumeKey(iter) { + var start = iter.pos(), children = []; + + var curChar; + while((curChar = iter.peek()) !== null) { + if(startsSeparator(curChar)) { break; } + if(startsEscapedVal(curChar)) { children.push(consumeEscapedVal(iter)); continue; } + + iter.next(); + } + + return { type: "key", start: start, end: iter.pos(), children: children }; + } + function consumeKeyValSeparator(iter) { + var start = iter.pos(); + + var seenHardSep = false, curChar; + while((curChar = iter.peek()) !== null) { + if(isEOL(curChar)) { break; } + + if(isWhitespace(curChar)) { iter.next(); continue; } + + if(seenHardSep) { break; } + + seenHardSep = (curChar === ":" || curChar === "="); + if(seenHardSep) { iter.next(); continue; } + + break; // curChar is a non-separtor char + } + + return { type: "key-value-separator", start: start, end: iter.pos() }; + } + function startsLineBreak(iter) { + return iter.peek() === "\\" && isEOL(iter.peek(1)); + } + function consumeLineBreak(iter) { + var start = iter.pos(); + + iter.next(); // consume \ + if(iter.peek() === "\r") { iter.next(); } + iter.next(); // consume \n + + var curChar; + while((curChar = iter.peek()) !== null) { + if(isEOL(curChar)) { break; } + if(!isWhitespace(curChar)) { break; } + + iter.next(); + } + + return { type: "line-break", start: start, end: iter.pos() }; + } + function consumeVal(iter) { + var start = iter.pos(), children = []; + + var curChar; + while((curChar = iter.peek()) !== null) { + if(startsLineBreak(iter)) { children.push(consumeLineBreak(iter)); continue; } + if(startsEscapedVal(curChar)) { children.push(consumeEscapedVal(iter)); continue; } + if(isEOL(curChar)) { break; } + + iter.next(); + } + + return { type: "value", start: start, end: iter.pos(), children: children }; + } + function consumeKeyVal(iter) { + return { + type: "key-value", + start: iter.pos(), + children: [ + consumeKey(iter), + consumeKeyValSeparator(iter), + consumeVal(iter) + ], + end: iter.pos() + }; + } + + var renderChild = { + "escaped-value": function(child, text) { + var type = text.charAt(child.start + 1); + + if(type === "t") { return "\t"; } + if(type === "r") { return "\r"; } + if(type === "n") { return "\n"; } + if(type === "f") { return "\f"; } + if(type !== "u") { return type; } + + return String.fromCharCode(parseInt(text.substr(child.start + 2, 4), 16)); + }, + "line-break": function (child, text) { + return ""; + } + }; + function rangeToBuffer(range, text) { + var start = range.start, buffer = []; + + for(var i = 0; i < range.children.length; i++) { + var child = range.children[i]; + + buffer.push(text.substring(start, child.start)); + buffer.push(renderChild[child.type](child, text)); + start = child.end; + } + buffer.push(text.substring(start, range.end)); + + return buffer; + } + function rangesToObject(ranges, text) { + var obj = Object.create(null); // Creates to a true hash map + + for(var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + + if(range.type !== "key-value") { continue; } + + var key = rangeToBuffer(range.children[0], text).join(""); + var val = rangeToBuffer(range.children[2], text).join(""); + obj[key] = val; + } + + return obj; + } + + function stringToRanges(text) { + var iter = new Iterator(text), ranges = []; + + var curChar; + while((curChar = iter.peek()) !== null) { + if(isWhitespace(curChar)) { ranges.push(consumeWhiteSpace(iter)); continue; } + if(startsComment(curChar)) { ranges.push(consumeComment(iter)); continue; } + if(startsKeyVal(curChar)) { ranges.push(consumeKeyVal(iter)); continue; } + + throw Error("Something crazy happened. text: '" + text + "'; curChar: '" + curChar + "'"); + } + + return ranges; + } + + function isNewLineRange(range) { + if(!range) { return false; } + + if(range.type === "whitespace") { return true; } + + if(range.type === "literal") { + return isWhitespace(range.text) && range.text.indexOf("\n") > -1; + } + + return false; + } + + function escapeMaker(escapes) { + return function escapeKey(key) { + var zeros = [ "", "0", "00", "000" ]; + var buf = []; + + for(var i = 0; i < key.length; i++) { + var chr = key.charAt(i); + + if(escapes[chr]) { buf.push(escapes[chr]); continue; } + + var code = chr.codePointAt(0); + + if(code <= 0x7F) { buf.push(chr); continue; } + + var hex = code.toString(16); + + buf.push("\\u"); + buf.push(zeros[4 - hex.length]); + buf.push(hex); + } + + return buf.join(""); + }; + } + + var escapeKey = escapeMaker({ " ": "\\ ", "\n": "\\n", ":": "\\:", "=": "\\=" }); + var escapeVal = escapeMaker({ "\n": "\\n" }); + + function Editor(text, options) { + if (typeof text === 'object') { + options = text; + text = null; + } + text = text || ""; + var path = options.path; + var separator = options.separator || '='; + + var ranges = stringToRanges(text); + var obj = rangesToObject(ranges, text); + var keyRange = Object.create(null); // Creates to a true hash map + + for(var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + + if(range.type !== "key-value") { continue; } + + var key = rangeToBuffer(range.children[0], text).join(""); + keyRange[key] = range; + } + + this.addHeadComment = function(comment) { + if(comment == null) { return; } + + ranges.unshift({ type: "literal", text: "# " + comment.replace(/\n/g, "\n# ") + "\n" }); + }; + + this.get = function(key) { return obj[key]; }; + this.set = function(key, val, comment) { + if(val == null) { this.unset(key); return; } + + obj[key] = val; + var escapedKey = escapeKey(key); + var escapedVal = escapeVal(val); + + var range = keyRange[key]; + if(!range) { + keyRange[key] = range = { + type: "literal", + text: escapedKey + separator + escapedVal + }; + + var prevRange = ranges[ranges.length - 1]; + if(prevRange != null && !isNewLineRange(prevRange)) { + ranges.push({ type: "literal", text: "\n" }); + } + ranges.push(range); + } + + // comment === null deletes comment. if comment === undefined, it's left alone + if(comment !== undefined) { + range.comment = comment && "# " + comment.replace(/\n/g, "\n# ") + "\n"; + } + + if(range.type === "literal") { + range.text = escapedKey + separator + escapedVal; + if(range.comment != null) { range.text = range.comment + range.text; } + } else if(range.type === "key-value") { + range.children[2] = { type: "literal", text: escapedVal }; + } else { + throw "Unknown node type: " + range.type; + } + }; + this.unset = function(key) { + if(!(key in obj)) { return; } + + var range = keyRange[key]; + var idx = ranges.indexOf(range); + + ranges.splice(idx, (isNewLineRange(ranges[idx + 1]) ? 2 : 1)); + + delete keyRange[key]; + delete obj[key]; + }; + this.valueOf = this.toString = function() { + var buffer = [], stack = [].concat(ranges); + + var node; + while((node = stack.shift()) != null) { + switch(node.type) { + case "literal": + buffer.push(node.text); + break; + case "key": + case "value": + case "comment": + case "whitespace": + case "key-value-separator": + case "escaped-value": + case "line-break": + buffer.push(text.substring(node.start, node.end)); + break; + case "key-value": + Array.prototype.unshift.apply(stack, node.children); + if(node.comment) { stack.unshift({ type: "literal", text: node.comment }); } + break; + } + } + + return buffer.join(""); + }; + this.save = function(newPath, callback) { + if(typeof newPath === 'function') { + callback = newPath; + newPath = path; + } + newPath = newPath || path; + + if(!newPath) { + if (callback) { + return callback("Unknown path"); + } + throw new Error("Unknown path"); + } + + if (callback) { + fs.writeFile(newPath, this.toString(), callback); + } else { + fs.writeFileSync(newPath, this.toString()); + } + + }; + } + function createEditor(/*path, options, callback*/) { + var path, options, callback; + var args = Array.prototype.slice.call(arguments); + for (var i = 0; i < args.length; i ++) { + var arg = args[i]; + if (!path && typeof arg === 'string') { + path = arg; + } else if (!options && typeof arg === 'object') { + options = arg; + } else if (!callback && typeof arg === 'function') { + callback = arg; + } + } + options = options || {}; + path = path || options.path; + callback = callback || options.callback; + options.path = path; + + if(!path) { return new Editor(options); } + + if(!callback) { return new Editor(fs.readFileSync(path).toString(), options); } + + return fs.readFile(path, function(err, text) { + if(err) { return callback(err, null); } + + text = text.toString(); + return callback(null, new Editor(text, options)); + }); + } + + function parse(text) { + text = text.toString(); + var ranges = stringToRanges(text); + return rangesToObject(ranges, text); + } + + function read(path, callback) { + if(!callback) { return parse(fs.readFileSync(path)); } + + return fs.readFile(path, function(err, data) { + if(err) { return callback(err, null); } + + return callback(null, parse(data)); + }); + } + + module.exports = { parse: parse, read: read, createEditor: createEditor }; + /***/ }, -/* 833 */ +/* 884 */ +/***/ function(module, exports) { + + /*! http://mths.be/codepointat v0.2.0 by @mathias */ + if (!String.prototype.codePointAt) { + (function() { + 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` + var defineProperty = (function() { + // IE 8 only supports `Object.defineProperty` on DOM elements + try { + var object = {}; + var $defineProperty = Object.defineProperty; + var result = $defineProperty(object, object, object) && $defineProperty; + } catch(error) {} + return result; + }()); + var codePointAt = function(position) { + if (this == null) { + throw TypeError(); + } + var string = String(this); + var size = string.length; + // `ToInteger` + var index = position ? Number(position) : 0; + if (index != index) { // better `isNaN` + index = 0; + } + // Account for out-of-bounds indices: + if (index < 0 || index >= size) { + return undefined; + } + // Get the first code unit + var first = string.charCodeAt(index); + var second; + if ( // check if it’s the start of a surrogate pair + first >= 0xD800 && first <= 0xDBFF && // high surrogate + size > index + 1 // there is a next code unit + ) { + second = string.charCodeAt(index + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; + }; + if (defineProperty) { + defineProperty(String.prototype, 'codePointAt', { + 'value': codePointAt, + 'configurable': true, + 'writable': true + }); + } else { + String.prototype.codePointAt = codePointAt; + } + }()); + } + + +/***/ }, +/* 885 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var startDebuggingNode = (() => { + var _ref = _asyncToGenerator(function* (tabId) { + var clientType = "node"; + var tabs = yield chrome.connectNodeClient(); + if (!tabs) { + return {}; + } + + var tab = tabs.find(function (t) { + return t.id.indexOf(tabId) !== -1; + }); + + if (!tab) { + return {}; + } + + yield chrome.connectNode(tab.tab); + chrome.initPage({ clientType }); + + return { tabs, tab, clientType, client: chrome }; + }); + + return function startDebuggingNode(_x) { + return _ref.apply(this, arguments); + }; + })(); + + var startDebuggingTab = (() => { + var _ref2 = _asyncToGenerator(function* (connTarget) { + var clientType = connTarget.type; + var client = clientType === "chrome" ? chrome : firefox; + + var tabs = yield client.connectClient(); + + if (!tabs) { + return; + } + + var tab = tabs.find(function (t) { + return t.id.indexOf(connTarget.param) !== -1; + }); + if (!tab) { + return; + } + + var tabConnection = yield client.connectTab(tab.tab); + + client.initPage({ tab, clientType, tabConnection }); + + return { tab, tabConnection }; + }); + + return function startDebuggingTab(_x2) { + return _ref2.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var firefox = __webpack_require__(886); + var chrome = __webpack_require__(887); + + function startDebugging(connTarget) { + if (connTarget.type === "node") { + return startDebuggingNode(connTarget.param); + } + + return startDebuggingTab(connTarget); + } + + module.exports = { + startDebugging, + firefox, + chrome + }; + +/***/ }, +/* 886 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + + var connectClient = (() => { + var _ref = _asyncToGenerator(function* () { + var useProxy = !getValue("firefox.webSocketConnection"); + var firefoxHost = getValue(useProxy ? "firefox.proxyHost" : "firefox.webSocketHost"); + + var socket = new WebSocket(`ws://${firefoxHost}`); + var transport = useProxy ? new DebuggerTransport(socket) : new WebsocketTransport(socket); + + debuggerClient = new DebuggerClient(transport); + if (!debuggerClient) { + return []; + } + + try { + yield debuggerClient.connect(); + var tabs = yield getTabs(); + return tabs; + } catch (err) { + console.log(err); + return []; + } + }); + + return function connectClient() { + return _ref.apply(this, arguments); + }; + })(); + + var connectTab = (() => { + var _ref2 = _asyncToGenerator(function* (tab) { + window.addEventListener("beforeunload", function () { + if (tabTarget !== null) { + tabTarget.destroy(); + } + }); + + var tabTarget = yield lookupTabTarget(tab); + + var _ref3 = yield tabTarget.activeTab.attachThread({}), + _ref4 = _slicedToArray(_ref3, 2), + threadClient = _ref4[1]; + + threadClient.resume(); + return { debuggerClient, threadClient, tabTarget }; + }); + + return function connectTab(_x) { + return _ref2.apply(this, arguments); + }; + })(); + + var getTabs = (() => { + var _ref5 = _asyncToGenerator(function* () { + if (!debuggerClient || !debuggerClient.mainRoot) { + return; + } + + var response = yield debuggerClient.listTabs(); + return createTabs(response.tabs); + }); + + return function getTabs() { + return _ref5.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(976), + DebuggerClient = _require.DebuggerClient, + DebuggerTransport = _require.DebuggerTransport, + TargetFactory = _require.TargetFactory, + WebsocketTransport = _require.WebsocketTransport; + + var _require2 = __webpack_require__(828), + getValue = _require2.getValue; + + var debuggerClient = null; + + function lookupTabTarget(tab) { + var options = { client: debuggerClient, form: tab, chrome: false }; + return TargetFactory.forRemoteTab(options); + } + + function createTabs(tabs) { + return tabs.map(tab => { + return { + title: tab.title, + url: tab.url, + id: tab.actor, + tab, + clientType: "firefox" + }; + }); + } + + function initPage() {} + + module.exports = { + connectClient, + connectTab, + initPage, + getTabs + }; + +/***/ }, +/* 887 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var connectClient = (() => { + var _ref2 = _asyncToGenerator(function* () { + if (!getValue("chrome.debug")) { + return createTabs([]); + } + + try { + var tabs = yield CDP.List({ + port: getValue("chrome.port"), + host: getValue("chrome.host") + }); + + return createTabs(tabs, { + clientType: "chrome", + type: "page" + }); + } catch (e) { + return []; + } + }); + + return function connectClient() { + return _ref2.apply(this, arguments); + }; + })(); + + var connectNodeClient = (() => { + var _ref3 = _asyncToGenerator(function* () { + if (!getValue("node.debug")) { + return createTabs([]); + } + + var tabs = void 0; + try { + tabs = yield CDP.List({ + port: getValue("node.port"), + host: getValue("node.host") + }); + } catch (e) { + return; + } + + return createTabs(tabs, { + clientType: "node", + type: "node" + }); + }); + + return function connectNodeClient() { + return _ref3.apply(this, arguments); + }; + })(); + + var connectTab = (() => { + var _ref4 = _asyncToGenerator(function* (tab) { + var tabConnection = yield CDP({ tab: tab.webSocketDebuggerUrl }); + return tabConnection; + }); + + return function connectTab(_x2) { + return _ref4.apply(this, arguments); + }; + })(); + + var connectNode = (() => { + var _ref5 = _asyncToGenerator(function* (tab) { + var tabConnection = yield CDP({ tab: tab.webSocketDebuggerUrl }); + + window.addEventListener("beforeunload", function () { + tabConnection.onclose = function disable() {}; + tabConnection.close(); + }); + + return tabConnection; + }); + + return function connectNode(_x3) { + return _ref5.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var CDP = __webpack_require__(126); + + var _require = __webpack_require__(828), + getValue = _require.getValue; + + var _require2 = __webpack_require__(900), + networkRequest = _require2.networkRequest; + + var connection = void 0; + + function createTabs(tabs) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + type = _ref.type, + clientType = _ref.clientType; + + return tabs.filter(tab => { + return tab.type == type; + }).map(tab => { + return { + title: tab.title, + url: tab.url, + id: tab.id, + tab, + clientType + }; + }); + } + + window.criRequest = function (options, callback) { + var host = options.host, + port = options.port, + path = options.path; + + var url = `http://${host}:${port}${path}`; + + networkRequest(url).then(res => callback(null, res.content)).catch(err => callback(err)); + }; + + function initPage(_ref6) { + var tab = _ref6.tab, + clientType = _ref6.clientType, + tabConnection = _ref6.tabConnection; + var Runtime = tabConnection.Runtime, + Page = tabConnection.Page; + + + Runtime.enable(); + + if (clientType == "node") { + Runtime.runIfWaitingForDebugger(); + } + + if (clientType == "chrome") { + Page.enable(); + } + + return connection; + } + + module.exports = { + connectClient, + connectNodeClient, + connectNode, + connectTab, + initPage + }; + +/***/ }, +/* 888 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var onConnect = (() => { + var _ref = _asyncToGenerator(function* (connection, services) { + // NOTE: the landing page does not connect to a JS process + if (!connection) { + return; + } + + var client = getClient(connection); + var commands = client.clientCommands; + + var _bootstrapStore = bootstrapStore(commands, services), + store = _bootstrapStore.store, + actions = _bootstrapStore.actions, + selectors = _bootstrapStore.selectors; + + bootstrapWorkers(); + yield client.onConnect(connection, actions); + yield loadFromPrefs(actions); + + window.getGlobalsForTesting = function () { + return { + store, + actions, + selectors, + client: client.clientCommands, + connection + }; + }; + + bootstrapApp(connection, { store, actions }); + + return { store, actions, selectors, client: commands }; + }); + + return function onConnect(_x, _x2) { + return _ref.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var firefox = __webpack_require__(889); + var chrome = __webpack_require__(893); + + var _require = __webpack_require__(226), + prefs = _require.prefs; + + var _require2 = __webpack_require__(897), + bootstrapApp = _require2.bootstrapApp, + bootstrapStore = _require2.bootstrapStore, + bootstrapWorkers = _require2.bootstrapWorkers; + + function loadFromPrefs(actions) { + var pauseOnExceptions = prefs.pauseOnExceptions, + ignoreCaughtExceptions = prefs.ignoreCaughtExceptions; + + if (pauseOnExceptions || ignoreCaughtExceptions) { + return actions.pauseOnExceptions(pauseOnExceptions, ignoreCaughtExceptions); + } + } + + function getClient(connection) { + var clientType = connection.tab.clientType; + + return clientType == "firefox" ? firefox : chrome; + } + + module.exports = { onConnect }; + +/***/ }, +/* 889 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var onConnect = exports.onConnect = (() => { + var _ref = _asyncToGenerator(function* (connection, actions) { + var _connection$tabConnec = connection.tabConnection, + tabTarget = _connection$tabConnec.tabTarget, + threadClient = _connection$tabConnec.threadClient, + debuggerClient = _connection$tabConnec.debuggerClient; + + + if (!tabTarget || !threadClient || !debuggerClient) { + return; + } + + setupCommands({ threadClient, tabTarget, debuggerClient }); + + if (actions) { + setupEvents({ threadClient, actions }); + } + + tabTarget.on("will-navigate", actions.willNavigate); + tabTarget.on("navigate", actions.navigated); + + yield threadClient.reconfigure({ observeAsmJS: true }); + + // In Firefox, we need to initially request all of the sources. This + // usually fires off individual `newSource` notifications as the + // debugger finds them, but there may be existing sources already in + // the debugger (if it's paused already, or if loading the page from + // bfcache) so explicity fire `newSource` events for all returned + // sources. + var sources = yield clientCommands.fetchSources(); + actions.newSources(sources); + + // If the threadClient is already paused, make sure to show a + // paused state. + var pausedPacket = threadClient.getLastPausePacket(); + if (pausedPacket) { + clientEvents.paused("paused", pausedPacket); + } + }); + + return function onConnect(_x, _x2) { + return _ref.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(890), + setupCommands = _require.setupCommands, + clientCommands = _require.clientCommands; + + var _require2 = __webpack_require__(892), + setupEvents = _require2.setupEvents, + clientEvents = _require2.clientEvents; + + exports.clientCommands = clientCommands; + exports.clientEvents = clientEvents; + +/***/ }, +/* 890 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var blackBox = (() => { + var _ref2 = _asyncToGenerator(function* (sourceId, isBlackBoxed) { + var sourceClient = threadClient.source({ actor: sourceId }); + if (isBlackBoxed) { + yield sourceClient.unblackBox(); + } else { + yield sourceClient.blackBox(); + } + + return { isBlackBoxed: !isBlackBoxed }; + }); + + return function blackBox(_x, _x2) { + return _ref2.apply(this, arguments); + }; + })(); + + var fetchSources = (() => { + var _ref3 = _asyncToGenerator(function* () { + var _ref4 = yield threadClient.getSources(), + sources = _ref4.sources; + + return sources.map(createSource); + }); + + return function fetchSources() { + return _ref3.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(891), + createSource = _require.createSource; + + var bpClients = void 0; + var threadClient = void 0; + var tabTarget = void 0; + var debuggerClient = void 0; + + function setupCommands(dependencies) { + threadClient = dependencies.threadClient; + tabTarget = dependencies.tabTarget; + debuggerClient = dependencies.debuggerClient; + bpClients = {}; + } + + function resume() { + return new Promise(resolve => { + threadClient.resume(resolve); + }); + } + + function stepIn() { + return new Promise(resolve => { + threadClient.stepIn(resolve); + }); + } + + function stepOver() { + return new Promise(resolve => { + threadClient.stepOver(resolve); + }); + } + + function stepOut() { + return new Promise(resolve => { + threadClient.stepOut(resolve); + }); + } + + function breakOnNext() { + return threadClient.breakOnNext(); + } + + function sourceContents(sourceId) { + var sourceClient = threadClient.source({ actor: sourceId }); + return sourceClient.source(); + } + + function setBreakpoint(location, condition, noSliding) { + var sourceClient = threadClient.source({ actor: location.sourceId }); + + return sourceClient.setBreakpoint({ + line: location.line, + column: location.column, + condition, + noSliding + }).then(res => onNewBreakpoint(location, res)); + } + + function onNewBreakpoint(location, res) { + var bpClient = res[1]; + var actualLocation = res[0].actualLocation; + bpClients[bpClient.actor] = bpClient; + + // Firefox only returns `actualLocation` if it actually changed, + // but we want it always to exist. Format `actualLocation` if it + // exists, otherwise use `location`. + actualLocation = actualLocation ? { + sourceId: actualLocation.source.actor, + line: actualLocation.line, + column: actualLocation.column + } : location; + + return { + id: bpClient.actor, + actualLocation + }; + } + + function removeBreakpoint(breakpointId) { + var bpClient = bpClients[breakpointId]; + delete bpClients[breakpointId]; + return bpClient.remove(); + } + + function setBreakpointCondition(breakpointId, location, condition, noSliding) { + var bpClient = bpClients[breakpointId]; + delete bpClients[breakpointId]; + + return bpClient.setCondition(threadClient, condition, noSliding).then(_bpClient => onNewBreakpoint(location, [{}, _bpClient])); + } + + function evaluate(script, _ref) { + var frameId = _ref.frameId; + + var params = frameId ? { frameActor: frameId } : {}; + return new Promise(resolve => { + tabTarget.activeConsole.evaluateJS(script, result => resolve(result), params); + }); + } + + function debuggeeCommand(script) { + tabTarget.activeConsole.evaluateJS(script, () => {}, {}); + + if (!debuggerClient) { + return; + } + + var consoleActor = tabTarget.form.consoleActor; + var request = debuggerClient._activeRequests.get(consoleActor); + request.emit("json-reply", {}); + debuggerClient._activeRequests.delete(consoleActor); + + return Promise.resolve(); + } + + function navigate(url) { + return tabTarget.activeTab.navigateTo(url); + } + + function reload() { + return tabTarget.activeTab.reload(); + } + + function getProperties(grip) { + var objClient = threadClient.pauseGrip(grip); + + return objClient.getPrototypeAndProperties().then(resp => { + var ownProperties = resp.ownProperties, + safeGetterValues = resp.safeGetterValues; + + for (var name in safeGetterValues) { + if (name in ownProperties) { + var getterValue = safeGetterValues[name].getterValue; + + ownProperties[name].value = getterValue; + } else { + ownProperties[name] = safeGetterValues[name]; + } + } + + return resp; + }); + } + + function pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { + return threadClient.pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions); + } + + function prettyPrint(sourceId, indentSize) { + var sourceClient = threadClient.source({ actor: sourceId }); + return sourceClient.prettyPrint(indentSize); + } + + function disablePrettyPrint(sourceId) { + var sourceClient = threadClient.source({ actor: sourceId }); + return sourceClient.disablePrettyPrint(); + } + + function interrupt() { + return threadClient.interrupt(); + } + + function eventListeners() { + return threadClient.eventListeners(); + } + + function pauseGrip(func) { + return threadClient.pauseGrip(func); + } + + var clientCommands = { + blackBox, + interrupt, + eventListeners, + pauseGrip, + resume, + stepIn, + stepOut, + stepOver, + breakOnNext, + sourceContents, + setBreakpoint, + removeBreakpoint, + setBreakpointCondition, + evaluate, + debuggeeCommand, + navigate, + reload, + getProperties, + pauseOnExceptions, + prettyPrint, + disablePrettyPrint, + fetchSources + }; + + module.exports = { + setupCommands, + clientCommands + }; + +/***/ }, +/* 891 */ +/***/ function(module, exports) { + + "use strict"; + + // This module converts Firefox specific types to the generic types + + function createFrame(frame) { + var title = void 0; + if (frame.type == "call") { + var c = frame.callee; + title = c.name || c.userDisplayName || c.displayName || "(anonymous)"; + } else { + title = `(${frame.type})`; + } + + return { + id: frame.actor, + displayName: title, + location: { + sourceId: frame.where.source.actor, + line: frame.where.line, + column: frame.where.column + }, + this: frame.this, + scope: frame.environment + }; + } + + function createSource(source) { + return { + id: source.actor, + url: source.url, + isPrettyPrinted: false, + sourceMapURL: source.sourceMapURL, + isBlackBoxed: false + }; + } + + function createPause(packet, response) { + // NOTE: useful when the debugger is already paused + var frame = packet.frame || response.frames[0]; + + return Object.assign({}, packet, { + frame: createFrame(frame), + frames: response.frames.map(createFrame) + }); + } + + module.exports = { + createFrame, + createSource, + createPause + }; + +/***/ }, +/* 892 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var paused = (() => { + var _ref = _asyncToGenerator(function* (_, packet) { + // If paused by an explicit interrupt, which are generated by the + // slow script dialog and internal events such as setting + // breakpoints, ignore the event. + var why = packet.why; + + if (why.type === "interrupted" && !packet.why.onNext) { + return; + } + + // Eagerly fetch the frames + var response = yield threadClient.getFrames(0, CALL_STACK_PAGE_SIZE); + + if (why.type != "alreadyPaused") { + var pause = createPause(packet, response); + actions.paused(pause); + } + }); + + return function paused(_x, _x2) { + return _ref.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(891), + createPause = _require.createPause, + createSource = _require.createSource; + + var _require2 = __webpack_require__(828), + isEnabled = _require2.isEnabled; + + var CALL_STACK_PAGE_SIZE = 1000; + + var threadClient = void 0; + var actions = void 0; + + function setupEvents(dependencies) { + threadClient = dependencies.threadClient; + actions = dependencies.actions; + + if (threadClient) { + Object.keys(clientEvents).forEach(eventName => { + threadClient.addListener(eventName, clientEvents[eventName]); + }); + } + } + + function resumed(_, packet) { + actions.resumed(packet); + } + + function newSource(_, _ref2) { + var source = _ref2.source; + + actions.newSource(createSource(source)); + + if (isEnabled("eventListeners")) { + actions.fetchEventListeners(); + } + } + + var clientEvents = { + paused, + resumed, + newSource + }; + + module.exports = { + setupEvents, + clientEvents + }; + +/***/ }, +/* 893 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var onConnect = exports.onConnect = (() => { + var _ref = _asyncToGenerator(function* (connection, actions) { + var tabConnection = connection.tabConnection, + type = connection.connTarget.type; + var Debugger = tabConnection.Debugger, + Runtime = tabConnection.Runtime, + Page = tabConnection.Page; + + + Debugger.enable(); + Debugger.setPauseOnExceptions({ state: "none" }); + Debugger.setAsyncCallStackDepth({ maxDepth: 0 }); + + if (type == "chrome") { + Page.frameNavigated(pageEvents.frameNavigated); + Page.frameStartedLoading(pageEvents.frameStartedLoading); + Page.frameStoppedLoading(pageEvents.frameStoppedLoading); + } + + Debugger.scriptParsed(clientEvents.scriptParsed); + Debugger.scriptFailedToParse(clientEvents.scriptFailedToParse); + Debugger.paused(clientEvents.paused); + Debugger.resumed(clientEvents.resumed); + + setupCommands({ Debugger, Runtime, Page }); + setupEvents({ actions, Page, type, Runtime }); + }); + + return function onConnect(_x, _x2) { + return _ref.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(894), + setupCommands = _require.setupCommands, + clientCommands = _require.clientCommands; + + var _require2 = __webpack_require__(896), + setupEvents = _require2.setupEvents, + clientEvents = _require2.clientEvents, + pageEvents = _require2.pageEvents; + + exports.clientCommands = clientCommands; + exports.clientEvents = clientEvents; + +/***/ }, +/* 894 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var setBreakpoint = (() => { + var _ref3 = _asyncToGenerator(function* (location, condition) { + var _ref4 = yield debuggerAgent.setBreakpoint({ + location: toServerLocation(location), + columnNumber: location.column + }), + breakpointId = _ref4.breakpointId, + serverLocation = _ref4.serverLocation; + + var actualLocation = fromServerLocation(serverLocation) || location; + + return { + id: breakpointId, + actualLocation: actualLocation + }; + }); + + return function setBreakpoint(_x, _x2) { + return _ref3.apply(this, arguments); + }; + })(); + + var getProperties = (() => { + var _ref5 = _asyncToGenerator(function* (object) { + var _ref6 = yield runtimeAgent.getProperties({ + objectId: object.objectId + }), + result = _ref6.result; + + var loadedObjects = result.map(createLoadedObject); + + return { loadedObjects }; + }); + + return function getProperties(_x3) { + return _ref5.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(895), + toServerLocation = _require.toServerLocation, + fromServerLocation = _require.fromServerLocation, + createLoadedObject = _require.createLoadedObject; + + var debuggerAgent = void 0; + var runtimeAgent = void 0; + var pageAgent = void 0; + + function setupCommands(_ref) { + var Debugger = _ref.Debugger, + Runtime = _ref.Runtime, + Page = _ref.Page; + + debuggerAgent = Debugger; + runtimeAgent = Runtime; + pageAgent = Page; + } + + function resume() { + return debuggerAgent.resume(); + } + + function stepIn() { + return debuggerAgent.stepInto(); + } + + function stepOver() { + return debuggerAgent.stepOver(); + } + + function stepOut() { + return debuggerAgent.stepOut(); + } + + function pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { + if (!shouldPauseOnExceptions) { + return debuggerAgent.setPauseOnExceptions({ state: "none" }); + } + var state = shouldIgnoreCaughtExceptions ? "uncaught" : "all"; + return debuggerAgent.setPauseOnExceptions({ state }); + } + + function breakOnNext() { + return debuggerAgent.pause(); + } + + function sourceContents(sourceId) { + return debuggerAgent.getScriptSource({ scriptId: sourceId }).then((_ref2) => { + var scriptSource = _ref2.scriptSource; + return { + source: scriptSource, + contentType: null + }; + }); + } + + function removeBreakpoint(breakpointId) { + return debuggerAgent.removeBreakpoint({ breakpointId }); + } + + function evaluate(script) { + return runtimeAgent.evaluate({ expression: script }); + } + + function debuggeeCommand(script) { + evaluate(script); + return Promise.resolve(); + } + + function navigate(url) { + return pageAgent.navigate({ url }); + } + + var clientCommands = { + resume, + stepIn, + stepOut, + stepOver, + pauseOnExceptions, + breakOnNext, + sourceContents, + setBreakpoint, + removeBreakpoint, + evaluate, + debuggeeCommand, + navigate, + getProperties + }; + + module.exports = { + setupCommands, + clientCommands + }; + +/***/ }, +/* 895 */ +/***/ function(module, exports) { + + "use strict"; + + function fromServerLocation(serverLocation) { + if (serverLocation) { + return { + sourceId: serverLocation.scriptId, + line: serverLocation.lineNumber + 1, + column: serverLocation.columnNumber + }; + } + } + + function toServerLocation(location) { + return { + scriptId: location.sourceId, + lineNumber: location.line - 1 + }; + } + + function createFrame(frame) { + return { + id: frame.callFrameId, + displayName: frame.functionName, + scopeChain: frame.scopeChain, + location: fromServerLocation(frame.location) + }; + } + + function createLoadedObject(serverObject, parentId) { + var value = serverObject.value, + name = serverObject.name; + + + return { + objectId: value.objectId, + parentId, + name, + value + }; + } + + module.exports = { + fromServerLocation, + toServerLocation, + createFrame, + createLoadedObject + }; + +/***/ }, +/* 896 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var paused = (() => { + var _ref2 = _asyncToGenerator(function* (_ref3) { + var callFrames = _ref3.callFrames, + reason = _ref3.reason, + data = _ref3.data, + hitBreakpoints = _ref3.hitBreakpoints, + asyncStackTrace = _ref3.asyncStackTrace; + + var frames = callFrames.map(createFrame); + var frame = frames[0]; + var why = Object.assign({}, { + type: reason + }, data); + + var objectId = frame.scopeChain[0].object.objectId; + + var _ref4 = yield runtimeAgent.getProperties({ + objectId + }), + result = _ref4.result; + + var loadedObjects = result.map(createLoadedObject); + + if (clientType == "chrome") { + pageAgent.configureOverlay({ message: "Paused in debugger.html" }); + } + + yield actions.paused({ frame, why, frames, loadedObjects }); + }); + + return function paused(_x) { + return _ref2.apply(this, arguments); + }; + })(); + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(895), + createFrame = _require.createFrame, + createLoadedObject = _require.createLoadedObject; + + var actions = void 0; + var pageAgent = void 0; + var clientType = void 0; + var runtimeAgent = void 0; + + function setupEvents(dependencies) { + actions = dependencies.actions; + pageAgent = dependencies.Page; + clientType = dependencies.clientType; + runtimeAgent = dependencies.Runtime; + } + + // Debugger Events + function scriptParsed(_ref) { + var scriptId = _ref.scriptId, + url = _ref.url, + startLine = _ref.startLine, + startColumn = _ref.startColumn, + endLine = _ref.endLine, + endColumn = _ref.endColumn, + executionContextId = _ref.executionContextId, + hash = _ref.hash, + isContentScript = _ref.isContentScript, + isInternalScript = _ref.isInternalScript, + isLiveEdit = _ref.isLiveEdit, + sourceMapURL = _ref.sourceMapURL, + hasSourceURL = _ref.hasSourceURL, + deprecatedCommentWasUsed = _ref.deprecatedCommentWasUsed; + + if (isContentScript) { + return; + } + + if (clientType == "node") { + sourceMapURL = undefined; + } + + actions.newSource({ + id: scriptId, + url, + sourceMapURL, + isPrettyPrinted: false + }); + } + + function scriptFailedToParse() {} + + function resumed() { + if (clientType == "chrome") { + pageAgent.configureOverlay({ suspended: false }); + } + + actions.resumed(); + } + + function globalObjectCleared() {} + + // Page Events + function frameNavigated(frame) { + actions.navigated(); + } + + function frameStartedLoading() { + actions.willNavigate(); + } + + function domContentEventFired() {} + + function loadEventFired() {} + + function frameStoppedLoading() {} + + var clientEvents = { + scriptParsed, + scriptFailedToParse, + paused, + resumed, + globalObjectCleared + }; + + var pageEvents = { + frameNavigated, + frameStartedLoading, + domContentEventFired, + loadEventFired, + frameStoppedLoading + }; + + module.exports = { + setupEvents, + pageEvents, + clientEvents + }; + +/***/ }, +/* 897 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.bootstrapStore = bootstrapStore; + exports.bootstrapApp = bootstrapApp; + exports.bootstrapWorkers = bootstrapWorkers; + exports.teardownWorkers = teardownWorkers; + + var _react = __webpack_require__(2); + + var _react2 = _interopRequireDefault(_react); + + var _redux = __webpack_require__(3); + + var _reactDom = __webpack_require__(22); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _devtoolsConfig = __webpack_require__(828); + + var _devtoolsLaunchpad = __webpack_require__(131); + + var _devtoolsSourceMap = __webpack_require__(898); + + var _prettyPrint = __webpack_require__(903); + + var _parser = __webpack_require__(827); + + var _createStore = __webpack_require__(189); + + var _createStore2 = _interopRequireDefault(_createStore); + + var _reducers = __webpack_require__(227); + + var _reducers2 = _interopRequireDefault(_reducers); + + var _selectors = __webpack_require__(242); + + var _selectors2 = _interopRequireDefault(_selectors); + + var _App = __webpack_require__(243); + + var _App2 = _interopRequireDefault(_App); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function bootstrapStore(client, services) { + var createStore = (0, _createStore2.default)({ + log: (0, _devtoolsConfig.getValue)("logging.actions"), + makeThunkArgs: (args, state) => { + return Object.assign({}, args, { client }, services); + } + }); + + var store = createStore((0, _redux.combineReducers)(_reducers2.default)); + var actions = (0, _redux.bindActionCreators)(__webpack_require__(244).default, store.dispatch); + + return { store, actions, selectors: _selectors2.default }; + } + + function bootstrapApp(connection, _ref) { + var store = _ref.store, + actions = _ref.actions; + + window.appStore = store; + + // Expose the bound actions so external things can do things like + // selecting a source. + window.actions = { + selectSource: actions.selectSource, + selectSourceURL: actions.selectSourceURL + }; + + (0, _devtoolsLaunchpad.renderRoot)(_react2.default, _reactDom2.default, _App2.default, store); + } + + function bootstrapWorkers() { + if (!(0, _devtoolsConfig.isFirefoxPanel)()) { + // When used in Firefox, the toolbox manages the source map worker. + (0, _devtoolsSourceMap.startSourceMapWorker)((0, _devtoolsConfig.getValue)("workers.sourceMapURL")); + } + (0, _prettyPrint.startPrettyPrintWorker)((0, _devtoolsConfig.getValue)("workers.prettyPrintURL")); + (0, _parser.startParserWorker)((0, _devtoolsConfig.getValue)("workers.parserURL")); + } + + function teardownWorkers() { + if (!(0, _devtoolsConfig.isFirefoxPanel)()) { + // When used in Firefox, the toolbox manages the source map worker. + (0, _devtoolsSourceMap.stopSourceMapWorker)(); + } + (0, _prettyPrint.stopPrettyPrintWorker)(); + (0, _parser.stopParserWorker)(); + } + +/***/ }, +/* 898 */ +/***/ function(module, exports, __webpack_require__) { + + const { + originalToGeneratedId, + generatedToOriginalId, + isGeneratedId, + isOriginalId + } = __webpack_require__(899); + + const { workerUtils: { WorkerDispatcher } } = __webpack_require__(900); + + const dispatcher = new WorkerDispatcher(); + + const getOriginalURLs = dispatcher.task("getOriginalURLs"); + const getGeneratedLocation = dispatcher.task("getGeneratedLocation"); + const getOriginalLocation = dispatcher.task("getOriginalLocation"); + const getOriginalSourceText = dispatcher.task("getOriginalSourceText"); + const applySourceMap = dispatcher.task("applySourceMap"); + const clearSourceMaps = dispatcher.task("clearSourceMaps"); + const hasMappedSource = dispatcher.task("hasMappedSource"); + + module.exports = { + originalToGeneratedId, + generatedToOriginalId, + isGeneratedId, + isOriginalId, + hasMappedSource, + getOriginalURLs, + getGeneratedLocation, + getOriginalLocation, + getOriginalSourceText, + applySourceMap, + clearSourceMaps, + startSourceMapWorker: dispatcher.start.bind(dispatcher), + stopSourceMapWorker: dispatcher.stop.bind(dispatcher) + }; + +/***/ }, +/* 899 */ +/***/ function(module, exports, __webpack_require__) { + + const md5 = __webpack_require__(248); + + function originalToGeneratedId(originalId) { + const match = originalId.match(/(.*)\/originalSource/); + return match ? match[1] : ""; + } + + function generatedToOriginalId(generatedId, url) { + return `${generatedId}/originalSource-${md5(url)}`; + } + + function isOriginalId(id) { + return !!id.match(/\/originalSource/); + } + + function isGeneratedId(id) { + return !isOriginalId(id); + } + + /** + * Trims the query part or reference identifier of a URL string, if necessary. + */ + function trimUrlQuery(url) { + let length = url.length; + let q1 = url.indexOf("?"); + let q2 = url.indexOf("&"); + let q3 = url.indexOf("#"); + let q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); + + return url.slice(0, q); + } + + // Map suffix to content type. + const contentMap = { + "js": "text/javascript", + "jsm": "text/javascript", + "ts": "text/typescript", + "tsx": "text/typescript-jsx", + "jsx": "text/jsx", + "coffee": "text/coffeescript", + "elm": "text/elm", + "cljs": "text/x-clojure" + }; + + /** + * Returns the content type for the specified URL. If no specific + * content type can be determined, "text/plain" is returned. + * + * @return String + * The content type. + */ + function getContentType(url) { + url = trimUrlQuery(url); + let dot = url.lastIndexOf("."); + if (dot >= 0) { + let name = url.substring(dot + 1); + if (name in contentMap) { + return contentMap[name]; + } + } + return "text/plain"; + } + + module.exports = { + originalToGeneratedId, + generatedToOriginalId, + isOriginalId, + isGeneratedId, + getContentType, + contentMapForTesting: contentMap + }; + +/***/ }, +/* 900 */ +/***/ function(module, exports, __webpack_require__) { + + const networkRequest = __webpack_require__(901); + const workerUtils = __webpack_require__(902); + + module.exports = { + networkRequest, + workerUtils + }; + +/***/ }, +/* 901 */ +/***/ function(module, exports) { + + function networkRequest(url, opts) { + return new Promise((resolve, reject) => { + const req = new XMLHttpRequest(); + + req.addEventListener("readystatechange", () => { + if (req.readyState === XMLHttpRequest.DONE) { + if (req.status === 200) { + resolve({ content: req.responseText }); + } else { + resolve(req.statusText); + } + } + }); + + // Not working yet. + // if (!opts.loadFromCache) { + // req.channel.loadFlags = ( + // Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE | + // Components.interfaces.nsIRequest.INHIBIT_CACHING | + // Components.interfaces.nsIRequest.LOAD_ANONYMOUS + // ); + // } + + req.open("GET", url); + req.send(); + }); + } + + module.exports = networkRequest; + +/***/ }, +/* 902 */ +/***/ function(module, exports) { + + + + function WorkerDispatcher() { + this.msgId = 1; + this.worker = null; + } + + WorkerDispatcher.prototype = { + start(url) { + this.worker = new Worker(url); + this.worker.onerror = () => { + console.error(`Error in worker ${url}`); + }; + }, + + stop() { + if (!this.worker) { + return; + } + + this.worker.terminate(); + this.worker = null; + }, + + task(method) { + return (...args) => { + return new Promise((resolve, reject) => { + const id = this.msgId++; + this.worker.postMessage({ id, method, args }); + + const listener = ({ data: result }) => { + if (result.id !== id) { + return; + } + + this.worker.removeEventListener("message", listener); + if (result.error) { + reject(result.error); + } else { + resolve(result.response); + } + }; + + this.worker.addEventListener("message", listener); + }); + }; + } + }; + + function workerHandler(publicInterface) { + return function workerHandler(msg) { + const { id, method, args } = msg.data; + const response = publicInterface[method].apply(undefined, args); + if (response instanceof Promise) { + response.then(val => self.postMessage({ id, response: val }), err => self.postMessage({ id, error: err })); + } else { + self.postMessage({ id, response }); + } + }; + } + + module.exports = { + WorkerDispatcher, + workerHandler + }; + +/***/ }, +/* 903 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var prettyPrint = (() => { + var _ref = _asyncToGenerator(function* (_ref2) { + var source = _ref2.source, + sourceText = _ref2.sourceText, + url = _ref2.url; + + var contentType = sourceText ? sourceText.contentType : ""; + var indent = 2; + + (0, _assert2.default)(isJavaScript(source.url, contentType), "Can't prettify non-javascript files."); + + return yield _prettyPrint({ + url, + indent, + source: sourceText ? sourceText.text : undefined + }); + }); + + return function prettyPrint(_x) { + return _ref.apply(this, arguments); + }; + })(); + + var _assert = __webpack_require__(223); + + var _assert2 = _interopRequireDefault(_assert); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + var _require = __webpack_require__(900), + WorkerDispatcher = _require.workerUtils.WorkerDispatcher; + + var _require2 = __webpack_require__(233), + isJavaScript = _require2.isJavaScript; + + var dispatcher = new WorkerDispatcher(); + var _prettyPrint = dispatcher.task("prettyPrint"); + + module.exports = { + prettyPrint, + startPrettyPrintWorker: dispatcher.start.bind(dispatcher), + stopPrettyPrintWorker: dispatcher.stop.bind(dispatcher) + }; + +/***/ }, +/* 904 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.resolveToken = undefined; + + var resolveToken = exports.resolveToken = (() => { + var _ref = _asyncToGenerator(function* (cm, token, sourceText, frame) { + var loc = getTokenLocation(cm, token); + return yield (0, _parser.resolveToken)(sourceText.toJS(), token.textContent || "", loc, frame); + }); + + return function resolveToken(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; + })(); + + exports.getTokenLocation = getTokenLocation; + exports.getThisFromFrame = getThisFromFrame; + exports.previewExpression = previewExpression; + exports.getExpressionValue = getExpressionValue; + + var _parser = __webpack_require__(827); + + var _get = __webpack_require__(67); + + var _get2 = _interopRequireDefault(_get); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + function getTokenLocation(codeMirror, tokenEl) { + var lineOffset = 1; + + var _tokenEl$getBoundingC = tokenEl.getBoundingClientRect(), + left = _tokenEl$getBoundingC.left, + top = _tokenEl$getBoundingC.top; + + var _codeMirror$coordsCha = codeMirror.coordsChar({ left, top }), + line = _codeMirror$coordsCha.line, + ch = _codeMirror$coordsCha.ch; + + return { + line: line + lineOffset, + column: ch + }; + } + + function getThisFromFrame(selectedFrame) { + if ("this" in selectedFrame) { + return { value: selectedFrame.this }; + } + + return null; + } + + // TODO Better define the value for `variables` map once we do it in + // debugger-html + function previewExpression(_ref2) { + var expression = _ref2.expression, + selectedFrame = _ref2.selectedFrame, + variables = _ref2.variables, + tokenText = _ref2.tokenText; + + if (!tokenText) { + return null; + } + + if (tokenText === "this") { + return getThisFromFrame(selectedFrame); + } + + if (variables.has(tokenText)) { + return variables.get(tokenText); + } + + return expression || null; + } + + // `getExpressionValue` and `previewExpression` are utility functions + // for resolving which expression to show in the preview. + // Get ExpressionValue, knows how to get the appropriate value for each type: + // variable, expression, raw value. + function getExpressionValue(selectedExpression, _ref3) { + var getExpression = _ref3.getExpression; + + var variableValue = (0, _get2.default)(selectedExpression, "contents.value"); + if (variableValue) { + return variableValue; + } + + var expressionValue = getExpression(selectedExpression.value); + if (expressionValue) { + return (0, _get2.default)(expressionValue, "value.result"); + } + + var rawValue = selectedExpression.value; + return rawValue; + } + +/***/ }, +/* 905 */, +/* 906 */, +/* 907 */, +/* 908 */, +/* 909 */, +/* 910 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var SplitBox = __webpack_require__(911); + + module.exports = SplitBox; + +/***/ }, +/* 911 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(22); + var Draggable = React.createFactory(__webpack_require__(912)); + var dom = React.DOM, + PropTypes = React.PropTypes; + + + __webpack_require__(913); + + /** + * This component represents a Splitter. The splitter supports vertical + * as well as horizontal mode. + */ + var SplitBox = React.createClass({ + propTypes: { + // Custom class name. You can use more names separated by a space. + className: PropTypes.string, + // Initial size of controlled panel. + initialSize: PropTypes.any, + // Optional initial width of controlled panel. + initialWidth: PropTypes.number, + // Optional initial height of controlled panel. + initialHeight: PropTypes.number, + // Left/top panel + startPanel: PropTypes.any, + // Left/top panel collapse state. + startPanelCollapsed: PropTypes.bool, + // Min panel size. + minSize: PropTypes.any, + // Max panel size. + maxSize: PropTypes.any, + // Right/bottom panel + endPanel: PropTypes.any, + // Right/bottom panel collapse state. + endPanelCollapsed: PropTypes.bool, + // True if the right/bottom panel should be controlled. + endPanelControl: PropTypes.bool, + // Size of the splitter handle bar. + splitterSize: PropTypes.number, + // True if the splitter bar is vertical (default is vertical). + vert: PropTypes.bool, + // Optional style properties passed into the splitbox + style: PropTypes.object, + // Optional callback when splitbox resize stops + onResizeEnd: PropTypes.func + }, + + displayName: "SplitBox", + + getDefaultProps() { + return { + splitterSize: 5, + vert: true, + endPanelControl: false, + endPanelCollapsed: false, + startPanelCollapsed: false + }; + }, + + /** + * The state stores the current orientation (vertical or horizontal) + * and the current size (width/height). All these values can change + * during the component's life time. + */ + getInitialState() { + return { + vert: this.props.vert, + // We use integers for these properties + width: parseInt(this.props.initialWidth || this.props.initialSize), + height: parseInt(this.props.initialHeight || this.props.initialSize) + }; + }, + + componentWillReceiveProps(nextProps) { + if (this.props.vert !== nextProps.vert) { + this.setState({ vert: nextProps.vert }); + } + }, + + // Dragging Events + + /** + * Set 'resizing' cursor on entire document during splitter dragging. + * This avoids cursor-flickering that happens when the mouse leaves + * the splitter bar area (happens frequently). + */ + onStartMove() { + var splitBox = ReactDOM.findDOMNode(this); + var doc = splitBox.ownerDocument; + var defaultCursor = doc.documentElement.style.cursor; + doc.documentElement.style.cursor = this.state.vert ? "ew-resize" : "ns-resize"; + + splitBox.classList.add("dragging"); + + this.setState({ + defaultCursor: defaultCursor + }); + }, + + onStopMove() { + var splitBox = ReactDOM.findDOMNode(this); + var doc = splitBox.ownerDocument; + doc.documentElement.style.cursor = this.state.defaultCursor; + + splitBox.classList.remove("dragging"); + + if (this.props.onResizeEnd) { + this.props.onResizeEnd(this.state.vert ? this.state.width : this.state.height); + } + }, + + /** + * Adjust size of the controlled panel. Depending on the current + * orientation we either remember the width or height of + * the splitter box. + */ + onMove(_ref) { + var movementX = _ref.movementX, + movementY = _ref.movementY; + + var node = ReactDOM.findDOMNode(this); + var doc = node.ownerDocument; + + if (this.props.endPanelControl) { + // For the end panel we need to increase the width/height when the + // movement is towards the left/top. + movementX = -movementX; + movementY = -movementY; + } + + if (this.state.vert) { + var isRtl = doc.dir === "rtl"; + if (isRtl) { + // In RTL we need to reverse the movement again -- but only for vertical + // splitters + movementX = -movementX; + } + + this.setState((state, props) => ({ + width: state.width + movementX + })); + } else { + this.setState((state, props) => ({ + height: state.height + movementY + })); + } + }, + + // Rendering + preparePanelStyles() { + var vert = this.state.vert; + var _props = this.props, + minSize = _props.minSize, + maxSize = _props.maxSize, + startPanelCollapsed = _props.startPanelCollapsed, + endPanelControl = _props.endPanelControl, + endPanelCollapsed = _props.endPanelCollapsed; + + var leftPanelStyle = void 0, + rightPanelStyle = void 0; + + // Set proper size for panels depending on the current state. + if (vert) { + var startWidth = endPanelControl ? null : this.state.width, + endWidth = endPanelControl ? this.state.width : null; + + leftPanelStyle = { + maxWidth: endPanelControl ? null : maxSize, + minWidth: endPanelControl ? null : minSize, + width: startPanelCollapsed ? 0 : startWidth + }; + rightPanelStyle = { + maxWidth: endPanelControl ? maxSize : null, + minWidth: endPanelControl ? minSize : null, + width: endPanelCollapsed ? 0 : endWidth + }; + } else { + var startHeight = endPanelControl ? null : this.state.height, + endHeight = endPanelControl ? this.state.height : null; + + leftPanelStyle = { + maxHeight: endPanelControl ? null : maxSize, + minHeight: endPanelControl ? null : minSize, + height: endPanelCollapsed ? maxSize : startHeight + }; + rightPanelStyle = { + maxHeight: endPanelControl ? maxSize : null, + minHeight: endPanelControl ? minSize : null, + height: startPanelCollapsed ? maxSize : endHeight + }; + } + + return { leftPanelStyle, rightPanelStyle }; + }, + + render() { + var vert = this.state.vert; + var _props2 = this.props, + startPanelCollapsed = _props2.startPanelCollapsed, + startPanel = _props2.startPanel, + endPanel = _props2.endPanel, + endPanelControl = _props2.endPanelControl, + splitterSize = _props2.splitterSize, + endPanelCollapsed = _props2.endPanelCollapsed; + + + var style = Object.assign({}, this.props.style); + + // Calculate class names list. + var classNames = ["split-box"]; + classNames.push(vert ? "vert" : "horz"); + if (this.props.className) { + classNames = classNames.concat(this.props.className.split(" ")); + } + + var _preparePanelStyles = this.preparePanelStyles(), + leftPanelStyle = _preparePanelStyles.leftPanelStyle, + rightPanelStyle = _preparePanelStyles.rightPanelStyle; + + // Calculate splitter size + + + var splitterStyle = { + flex: `0 0 ${splitterSize}px` + }; + + return dom.div({ + className: classNames.join(" "), + style: style + }, !startPanelCollapsed ? dom.div({ + className: endPanelControl ? "uncontrolled" : "controlled", + style: leftPanelStyle + }, startPanel) : null, Draggable({ + className: "splitter", + style: splitterStyle, + onStart: this.onStartMove, + onStop: this.onStopMove, + onMove: this.onMove + }), !endPanelCollapsed ? dom.div({ + className: endPanelControl ? "controlled" : "uncontrolled", + style: rightPanelStyle + }, endPanel) : null); + } + }); + + module.exports = SplitBox; + +/***/ }, +/* 912 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(22); + var dom = React.DOM, + PropTypes = React.PropTypes; + + + var Draggable = React.createClass({ + displayName: "Draggable", + + propTypes: { + onMove: PropTypes.func.isRequired, + onStart: PropTypes.func, + onStop: PropTypes.func, + style: PropTypes.object, + className: PropTypes.string + }, + + startDragging(ev) { + ev.preventDefault(); + var doc = ReactDOM.findDOMNode(this).ownerDocument; + doc.addEventListener("mousemove", this.onMove); + doc.addEventListener("mouseup", this.onUp); + this.props.onStart && this.props.onStart(); + }, + + onMove(ev) { + ev.preventDefault(); + // We pass the whole event because we don't know which properties + // the callee needs. + this.props.onMove(ev); + }, + + onUp(ev) { + ev.preventDefault(); + var doc = ReactDOM.findDOMNode(this).ownerDocument; + doc.removeEventListener("mousemove", this.onMove); + doc.removeEventListener("mouseup", this.onUp); + this.props.onStop && this.props.onStop(); + }, + + render() { + return dom.div({ + style: this.props.style, + className: this.props.className, + onMouseDown: this.startDragging + }); + } + }); + + module.exports = Draggable; + +/***/ }, +/* 913 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 914 */, +/* 915 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _reactRedux = __webpack_require__(151); + + var _redux = __webpack_require__(3); + + var _actions = __webpack_require__(244); + + var _actions2 = _interopRequireDefault(_actions); + + var _selectors = __webpack_require__(242); + + var _utils = __webpack_require__(234); + + var _url = __webpack_require__(334); + + var _source = __webpack_require__(233); + + __webpack_require__(917); + + var _Autocomplete2 = __webpack_require__(342); + + var _Autocomplete3 = _interopRequireDefault(_Autocomplete2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var Autocomplete = (0, _react.createFactory)(_Autocomplete3.default); + + function searchResults(sources) { + function getSourcePath(source) { + var _parseURL = (0, _url.parse)(source.get("url")), + path = _parseURL.path, + href = _parseURL.href; + // for URLs like "about:home" the path is null so we pass the full href + + + return path || href; + } + + return sources.valueSeq().filter(source => !(0, _source.isPretty)(source.toJS()) && source.get("url")).map(source => ({ + value: getSourcePath(source), + title: getSourcePath(source).split("/").pop(), + subtitle: (0, _utils.endTruncateStr)(getSourcePath(source), 100), + id: source.get("id") + })).toJS(); + } + + class ProjectSearch extends _react.Component { + + constructor(props) { + super(props); + + this.state = { + inputValue: "" + }; + + this.toggle = this.toggle.bind(this); + this.onEscape = this.onEscape.bind(this); + this.close = this.close.bind(this); + } + + componentWillUnmount() { + var shortcuts = this.context.shortcuts; + var searchKeys = [L10N.getStr("sources.search.key"), L10N.getStr("symbolSearch.search.key")]; + searchKeys.forEach(key => shortcuts.off(`CmdOrCtrl+${key}`, this.toggle)); + shortcuts.off("Escape", this.onEscape); + } + + componentDidMount() { + var shortcuts = this.context.shortcuts; + var searchKeys = [L10N.getStr("sources.search.key"), L10N.getStr("symbolSearch.search.key")]; + searchKeys.forEach(key => shortcuts.on(`CmdOrCtrl+${key}`, this.toggle)); + shortcuts.on("Escape", this.onEscape); + } + + toggle(key, e) { + e.preventDefault(); + this.props.toggleProjectSearch(); + } + + onEscape(shortcut, e) { + if (this.props.searchOn) { + e.preventDefault(); + this.close(); + } + } + + close() { + this.setState({ inputValue: "" }); + this.props.toggleProjectSearch(false); + } + + render() { + if (!this.props.searchOn) { + return null; + } + + return _react.DOM.div({ className: "search-container" }, Autocomplete({ + selectItem: (e, result) => { + this.props.selectSource(result.id); + this.close(); + }, + close: this.close, + items: searchResults(this.props.sources), + inputValue: this.state.inputValue, + placeholder: L10N.getStr("sourceSearch.search"), + size: "big" + })); + } + } + + ProjectSearch.propTypes = { + sources: _react.PropTypes.object.isRequired, + selectSource: _react.PropTypes.func.isRequired, + toggleProjectSearch: _react.PropTypes.func.isRequired, + searchOn: _react.PropTypes.bool + }; + + ProjectSearch.contextTypes = { + shortcuts: _react.PropTypes.object + }; + + ProjectSearch.displayName = "ProjectSearch"; + + exports.default = (0, _reactRedux.connect)(state => ({ + sources: (0, _selectors.getSources)(state), + searchOn: (0, _selectors.getProjectSearchState)(state) + }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(ProjectSearch); + +/***/ }, +/* 916 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */ + ;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * http://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + true + ) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + return punycode; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { // in Rhino or a web browser + root.punycode = punycode; + } + + }(this)); + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) + +/***/ }, +/* 917 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 918 */, +/* 919 */ +/***/ function(module, exports) { + + module.exports = "" + +/***/ }, +/* 920 */ +/***/ function(module, exports) { + + module.exports = "" + +/***/ }, +/* 921 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _redux = __webpack_require__(3); + + var _reactRedux = __webpack_require__(151); + + var _actions = __webpack_require__(244); + + var _actions2 = _interopRequireDefault(_actions); + + var _selectors = __webpack_require__(242); + + var _devtoolsConfig = __webpack_require__(828); + + var _parser = __webpack_require__(827); + + __webpack_require__(922); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + + class Outline extends _react.Component { + + constructor(props) { + super(props); + this.state = {}; + } + + componentWillReceiveProps(_ref) { + var sourceText = _ref.sourceText; + + if (sourceText) { + this.setSymbolDeclarations(sourceText); + } + } + + setSymbolDeclarations(sourceText) { + var _this = this; + + return _asyncToGenerator(function* () { + var symbolDeclarations = yield (0, _parser.getSymbols)(sourceText.toJS()); + + if (symbolDeclarations !== _this.state.symbolDeclarations) { + _this.setState({ + symbolDeclarations + }); + } + })(); + } + + renderFunction(func) { + return _react.DOM.li({}, func.value); + } + + renderFunctions() { + var symbolDeclarations = this.state.symbolDeclarations; + + if (!symbolDeclarations) { + return; + } + + var functions = symbolDeclarations.functions; + + + return functions.filter(func => func.value != "anonymous").map(this.renderFunction); + } + + render() { + if (!(0, _devtoolsConfig.isEnabled)("outline")) { + return null; + } + + return _react.DOM.div({ className: "outline" }, _react.DOM.ul({}, this.renderFunctions())); + } + } + + Outline.propTypes = { + selectedSource: _react.PropTypes.object + }; + + Outline.displayName = "Outline"; + + exports.default = (0, _reactRedux.connect)(state => { + var selectedSource = (0, _selectors.getSelectedSource)(state); + var sourceId = selectedSource ? selectedSource.get("id") : null; + + return { + sourceText: (0, _selectors.getSourceText)(state, sourceId) + }; + }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Outline); + +/***/ }, +/* 922 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 923 */, +/* 924 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var _require = __webpack_require__(925), + MODE = _require.MODE; + + var _require2 = __webpack_require__(926), + REPS = _require2.REPS, + getRep = _require2.getRep; + + var _require3 = __webpack_require__(927), + createFactories = _require3.createFactories, + parseURLEncodedText = _require3.parseURLEncodedText, + parseURLParams = _require3.parseURLParams, + getSelectableInInspectorGrips = _require3.getSelectableInInspectorGrips, + maybeEscapePropertyName = _require3.maybeEscapePropertyName, + getGripPreviewItems = _require3.getGripPreviewItems; + + module.exports = { + REPS, + getRep, + MODE, + createFactories, + maybeEscapePropertyName, + parseURLEncodedText, + parseURLParams, + getSelectableInInspectorGrips, + getGripPreviewItems + }; + +/***/ }, +/* 925 */ +/***/ function(module, exports) { + + "use strict"; + + module.exports = { + MODE: { + TINY: Symbol("TINY"), + SHORT: Symbol("SHORT"), + LONG: Symbol("LONG") + } + }; + +/***/ }, +/* 926 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var _require = __webpack_require__(927), + isGrip = _require.isGrip; + + // Load all existing rep templates + + + var Undefined = __webpack_require__(929); + var Null = __webpack_require__(930); + var StringRep = __webpack_require__(931); + var LongStringRep = __webpack_require__(932); + var Number = __webpack_require__(933); + var ArrayRep = __webpack_require__(934); + var Obj = __webpack_require__(936); + var SymbolRep = __webpack_require__(939); + var InfinityRep = __webpack_require__(940); + var NaNRep = __webpack_require__(941); + + // DOM types (grips) + var Attribute = __webpack_require__(942); + var DateTime = __webpack_require__(943); + var Document = __webpack_require__(944); + var Event = __webpack_require__(945); + var Func = __webpack_require__(946); + var PromiseRep = __webpack_require__(947); + var RegExp = __webpack_require__(948); + var StyleSheet = __webpack_require__(949); + var CommentNode = __webpack_require__(950); + var ElementNode = __webpack_require__(951); + var TextNode = __webpack_require__(953); + var ErrorRep = __webpack_require__(954); + var Window = __webpack_require__(955); + var ObjectWithText = __webpack_require__(956); + var ObjectWithURL = __webpack_require__(957); + var GripArray = __webpack_require__(958); + var GripMap = __webpack_require__(959); + var Grip = __webpack_require__(938); + + // List of all registered template. + // XXX there should be a way for extensions to register a new + // or modify an existing rep. + var reps = [RegExp, StyleSheet, Event, DateTime, CommentNode, ElementNode, TextNode, Attribute, LongStringRep, Func, PromiseRep, ArrayRep, Document, Window, ObjectWithText, ObjectWithURL, ErrorRep, GripArray, GripMap, Grip, Undefined, Null, StringRep, Number, SymbolRep, InfinityRep, NaNRep]; + + /** + * Generic rep that is using for rendering native JS types or an object. + * The right template used for rendering is picked automatically according + * to the current value type. The value must be passed is as 'object' + * property. + */ + var Rep = function (props) { + var object = props.object, + defaultRep = props.defaultRep; + + var rep = getRep(object, defaultRep); + return rep(props); + }; + + // Helpers + + /** + * Return a rep object that is responsible for rendering given + * object. + * + * @param object {Object} Object to be rendered in the UI. This + * can be generic JS object as well as a grip (handle to a remote + * debuggee object). + * + * @param defaultObject {React.Component} The default template + * that should be used to render given object if none is found. + */ + function getRep(object) { + var defaultRep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Obj; + + var type = typeof object; + if (type == "object" && object instanceof String) { + type = "string"; + } else if (object && type == "object" && object.type) { + type = object.type; + } + + if (isGrip(object)) { + type = object.class; + } + + for (var i = 0; i < reps.length; i++) { + var rep = reps[i]; + try { + // supportsObject could return weight (not only true/false + // but a number), which would allow to priorities templates and + // support better extensibility. + if (rep.supportsObject(object, type)) { + return rep.rep; + } + } catch (err) { + console.error(err); + } + } + + return defaultRep.rep; + } + + module.exports = { + Rep, + REPS: { + ArrayRep, + Attribute, + CommentNode, + DateTime, + Document, + ElementNode, + ErrorRep, + Event, + Func, + Grip, + GripArray, + GripMap, + InfinityRep, + LongStringRep, + NaNRep, + Null, + Number, + Obj, + ObjectWithText, + ObjectWithURL, + PromiseRep, + RegExp, + Rep, + StringRep, + StyleSheet, + SymbolRep, + TextNode, + Undefined, + Window + }, + // Exporting for tests + getRep + }; + +/***/ }, +/* 927 */ /***/ function(module, exports, __webpack_require__) { "use strict"; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + // Dependencies + var React = __webpack_require__(2); - /* General utilities used throughout devtools. */ - var _require = __webpack_require__(834), - Ci = _require.Ci, - Cu = _require.Cu, - Cc = _require.Cc, - components = _require.components; - - var promise = __webpack_require__(839); - - var _require2 = __webpack_require__(840), - FileUtils = _require2.FileUtils; + // Utils + var nodeConstants = __webpack_require__(928); /** - * Turn the error |aError| into a string, without fail. + * Create React factories for given arguments. + * Example: + * const { Rep } = createFactories(require("./rep")); */ - - - exports.safeErrorString = function safeErrorString(aError) { - try { - var errorString = aError.toString(); - if (typeof errorString == "string") { - // Attempt to attach a stack to |errorString|. If it throws an error, or - // isn't a string, don't use it. - try { - if (aError.stack) { - var stack = aError.stack.toString(); - if (typeof stack == "string") { - errorString += "\nStack: " + stack; - } - } - } catch (ee) {} - - // Append additional line and column number information to the output, - // since it might not be part of the stringified error. - if (typeof aError.lineNumber == "number" && typeof aError.columnNumber == "number") { - errorString += "Line: " + aError.lineNumber + ", column: " + aError.columnNumber; - } - - return errorString; - } - } catch (ee) {} - - // We failed to find a good error description, so do the next best thing. - return Object.prototype.toString.call(aError); - }; - - /** - * Report that |aWho| threw an exception, |aException|. - */ - exports.reportException = function reportException(aWho, aException) { - var msg = aWho + " threw an exception: " + exports.safeErrorString(aException); - - console.log(msg); - - // if (Cu && console.error) { - // /* - // * Note that the xpcshell test harness registers an observer for - // * console messages, so when we're running tests, this will cause - // * the test to quit. - // */ - // console.error(msg); - // } - }; - - /** - * Given a handler function that may throw, return an infallible handler - * function that calls the fallible handler, and logs any exceptions it - * throws. - * - * @param aHandler function - * A handler function, which may throw. - * @param aName string - * A name for aHandler, for use in error messages. If omitted, we use - * aHandler.name. - * - * (SpiderMonkey does generate good names for anonymous functions, but we - * don't have a way to get at them from JavaScript at the moment.) - */ - exports.makeInfallible = function makeInfallible(aHandler, aName) { - if (!aName) aName = aHandler.name; - - return function () /* arguments */{ - // try { - return aHandler.apply(this, arguments); - // } catch (ex) { - // let who = "Handler function"; - // if (aName) { - // who += " " + aName; - // } - // return exports.reportException(who, ex); - // } - }; - }; - - /** - * Waits for the next tick in the event loop to execute a callback. - */ - exports.executeSoon = function executeSoon(aFn) { - setTimeout(aFn, 0); - }; - - /** - * Waits for the next tick in the event loop. - * - * @return Promise - * A promise that is resolved after the next tick in the event loop. - */ - exports.waitForTick = function waitForTick() { - var deferred = promise.defer(); - exports.executeSoon(deferred.resolve); - return deferred.promise; - }; - - /** - * Waits for the specified amount of time to pass. - * - * @param number aDelay - * The amount of time to wait, in milliseconds. - * @return Promise - * A promise that is resolved after the specified amount of time passes. - */ - exports.waitForTime = function waitForTime(aDelay) { - var deferred = promise.defer(); - setTimeout(deferred.resolve, aDelay); - return deferred.promise; - }; - - /** - * Like Array.prototype.forEach, but doesn't cause jankiness when iterating over - * very large arrays by yielding to the browser and continuing execution on the - * next tick. - * - * @param Array aArray - * The array being iterated over. - * @param Function aFn - * The function called on each item in the array. If a promise is - * returned by this function, iterating over the array will be paused - * until the respective promise is resolved. - * @returns Promise - * A promise that is resolved once the whole array has been iterated - * over, and all promises returned by the aFn callback are resolved. - */ - exports.yieldingEach = function yieldingEach(aArray, aFn) { - var deferred = promise.defer(); - - var i = 0; - var len = aArray.length; - var outstanding = [deferred.promise]; - - (function loop() { - var start = Date.now(); - - while (i < len) { - // Don't block the main thread for longer than 16 ms at a time. To - // maintain 60fps, you have to render every frame in at least 16ms; we - // aren't including time spent in non-JS here, but this is Good - // Enough(tm). - if (Date.now() - start > 16) { - exports.executeSoon(loop); - return; - } - - try { - outstanding.push(aFn(aArray[i], i++)); - } catch (e) { - deferred.reject(e); - return; - } - } - - deferred.resolve(); - })(); - - return promise.all(outstanding); - }; - - /** - * Like XPCOMUtils.defineLazyGetter, but with a |this| sensitive getter that - * allows the lazy getter to be defined on a prototype and work correctly with - * instances. - * - * @param Object aObject - * The prototype object to define the lazy getter on. - * @param String aKey - * The key to define the lazy getter on. - * @param Function aCallback - * The callback that will be called to determine the value. Will be - * called with the |this| value of the current instance. - */ - exports.defineLazyPrototypeGetter = function defineLazyPrototypeGetter(aObject, aKey, aCallback) { - Object.defineProperty(aObject, aKey, { - configurable: true, - get: function () { - var value = aCallback.call(this); - - Object.defineProperty(this, aKey, { - configurable: true, - writable: true, - value: value - }); - - return value; - } - }); - }; - - /** - * Safely get the property value from a Debugger.Object for a given key. Walks - * the prototype chain until the property is found. - * - * @param Debugger.Object aObject - * The Debugger.Object to get the value from. - * @param String aKey - * The key to look for. - * @return Any - */ - exports.getProperty = function getProperty(aObj, aKey) { - var root = aObj; - try { - do { - var desc = aObj.getOwnPropertyDescriptor(aKey); - if (desc) { - if ("value" in desc) { - return desc.value; - } - // Call the getter if it's safe. - return exports.hasSafeGetter(desc) ? desc.get.call(root).return : undefined; - } - aObj = aObj.proto; - } while (aObj); - } catch (e) { - // If anything goes wrong report the error and return undefined. - exports.reportException("getProperty", e); - } - return undefined; - }; - - /** - * Determines if a descriptor has a getter which doesn't call into JavaScript. - * - * @param Object aDesc - * The descriptor to check for a safe getter. - * @return Boolean - * Whether a safe getter was found. - */ - exports.hasSafeGetter = function hasSafeGetter(aDesc) { - // Scripted functions that are CCWs will not appear scripted until after - // unwrapping. - try { - var fn = aDesc.get.unwrap(); - return fn && fn.callable && fn.class == "Function" && fn.script === undefined; - } catch (e) { - // Avoid exception 'Object in compartment marked as invisible to Debugger' - return false; - } - }; - - /** - * Check if it is safe to read properties and execute methods from the given JS - * object. Safety is defined as being protected from unintended code execution - * from content scripts (or cross-compartment code). - * - * See bugs 945920 and 946752 for discussion. - * - * @type Object aObj - * The object to check. - * @return Boolean - * True if it is safe to read properties from aObj, or false otherwise. - */ - exports.isSafeJSObject = function isSafeJSObject(aObj) { - // If we are running on a worker thread, Cu is not available. In this case, - // we always return false, just to be on the safe side. - if (isWorker) { - return false; - } - - if (Cu.getGlobalForObject(aObj) == Cu.getGlobalForObject(exports.isSafeJSObject)) { - return true; // aObj is not a cross-compartment wrapper. - } - - var principal = Cu.getObjectPrincipal(aObj); - // if (Services.scriptSecurityManager.isSystemPrincipal(principal)) { - // return true; // allow chrome objects - // } - - return Cu.isXrayWrapper(aObj); - }; - - exports.dumpn = function dumpn(str) { - if (exports.dumpn.wantLogging) { - console.log("DBG-SERVER: " + str + "\n"); - } - }; - - // We want wantLogging to be writable. The exports object is frozen by the - // loader, so define it on dumpn instead. - exports.dumpn.wantLogging = false; - - /** - * A verbose logger for low-level tracing. - */ - exports.dumpv = function (msg) { - if (exports.dumpv.wantVerbose) { - exports.dumpn(msg); - } - }; - - // We want wantLogging to be writable. The exports object is frozen by the - // loader, so define it on dumpn instead. - exports.dumpv.wantVerbose = false; - - /** - * Utility function for updating an object with the properties of - * other objects. - * - * @param aTarget Object - * The object being updated. - * @param aNewAttrs Object - * The rest params are objects to update aTarget with. You - * can pass as many as you like. - */ - exports.update = function update(aTarget) { - for (var _len = arguments.length, aArgs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - aArgs[_key - 1] = arguments[_key]; - } - - for (var attrs of aArgs) { - for (var key in attrs) { - var desc = Object.getOwnPropertyDescriptor(attrs, key); - - if (desc) { - Object.defineProperty(aTarget, key, desc); - } - } - } - - return aTarget; - }; - - /** - * Utility function for getting the values from an object as an array - * - * @param aObject Object - * The object to iterate over - */ - exports.values = function values(aObject) { - return Object.keys(aObject).map(k => aObject[k]); - }; - - /** - * Defines a getter on a specified object that will be created upon first use. - * - * @param aObject - * The object to define the lazy getter on. - * @param aName - * The name of the getter to define on aObject. - * @param aLambda - * A function that returns what the getter should return. This will - * only ever be called once. - */ - exports.defineLazyGetter = function defineLazyGetter(aObject, aName, aLambda) { - Object.defineProperty(aObject, aName, { - get: function () { - delete aObject[aName]; - return aObject[aName] = aLambda.apply(aObject); - }, - configurable: true, - enumerable: true - }); - }; - - // DEPRECATED: use DevToolsUtils.assert(condition, message) instead! - var haveLoggedDeprecationMessage = false; - exports.dbg_assert = function dbg_assert(cond, e) { - if (!haveLoggedDeprecationMessage) { - haveLoggedDeprecationMessage = true; - var deprecationMessage = "DevToolsUtils.dbg_assert is deprecated! Use DevToolsUtils.assert instead!" + Error().stack; - console.log(deprecationMessage); - if (typeof console === "object" && console && console.warn) { - console.warn(deprecationMessage); - } - } - - if (!cond) { - return e; - } - }; - - var _require3 = __webpack_require__(831), - AppConstants = _require3.AppConstants; - - /** - * No operation. The empty function. - */ - - - exports.noop = function () {}; - - function reallyAssert(condition, message) { - if (!condition) { - var err = new Error("Assertion failure: " + message); - exports.reportException("DevToolsUtils.assert", err); - throw err; + function createFactories(args) { + var result = {}; + for (var p in args) { + result[p] = React.createFactory(args[p]); } + return result; } /** - * DevToolsUtils.assert(condition, message) - * - * @param Boolean condition - * @param String message - * - * Assertions are enabled when any of the following are true: - * - This is a DEBUG_JS_MODULES build - * - This is a DEBUG build - * - DevToolsUtils.testing is set to true - * - * If assertions are enabled, then `condition` is checked and if false-y, the - * assertion failure is logged and then an error is thrown. - * - * If assertions are not enabled, then this function is a no-op. - * - * This is an improvement over `dbg_assert`, which doesn't actually cause any - * fatal behavior, and is therefore much easier to accidentally ignore. + * Returns true if the given object is a grip (see RDP protocol) */ - Object.defineProperty(exports, "assert", { - get: () => AppConstants.DEBUG || AppConstants.DEBUG_JS_MODULES || undefined.testing ? reallyAssert : exports.noop - }); + function isGrip(object) { + return object && object.actor; + } - /** - * Defines a getter on a specified object for a module. The module will not - * be imported until first use. - * - * @param aObject - * The object to define the lazy getter on. - * @param aName - * The name of the getter to define on aObject for the module. - * @param aResource - * The URL used to obtain the module. - * @param aSymbol - * The name of the symbol exported by the module. - * This parameter is optional and defaults to aName. - */ - exports.defineLazyModuleGetter = function defineLazyModuleGetter(aObject, aName, aResource, aSymbol) { - this.defineLazyGetter(aObject, aName, function XPCU_moduleLambda() { - var temp = {}; - Cu.import(aResource, temp); - return temp[aSymbol || aName]; - }); + function escapeNewLines(value) { + return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n"); + } + + // Map from character code to the corresponding escape sequence. \0 + // isn't here because it would require special treatment in some + // situations. \b, \f, and \v aren't here because they aren't very + // common. \' isn't here because there's no need, we only + // double-quote strings. + var escapeMap = { + // Tab. + 9: "\\t", + // Newline. + 0xa: "\\n", + // Carriage return. + 0xd: "\\r", + // Quote. + 0x22: "\\\"", + // Backslash. + 0x5c: "\\\\" }; - var _require4 = __webpack_require__(841), - NetUtil = _require4.NetUtil; - - var _require5 = __webpack_require__(842), - TextDecoder = _require5.TextDecoder, - OS = _require5.OS; - - var NetworkHelper = __webpack_require__(843); + // Regexp that matches any character we might possibly want to escape. + // Note that we over-match here, because it's difficult to, say, match + // an unpaired surrogate with a regexp. The details are worked out by + // the replacement function; see |escapeString|. + var escapeRegexp = new RegExp("[" + + // Quote and backslash. + "\"\\\\" + + // Controls. + "\x00-\x1f" + + // More controls. + "\x7f-\x9f" + + // BOM + "\ufeff" + + // Replacement characters and non-characters. + "\ufffc-\uffff" + + // Surrogates. + "\ud800-\udfff" + + // Mathematical invisibles. + "\u2061-\u2064" + + // Line and paragraph separators. + "\u2028-\u2029" + + // Private use area. + "\ue000-\uf8ff" + "]", "g"); /** - * Performs a request to load the desired URL and returns a promise. + * Escape a string so that the result is viewable and valid JS. + * Control characters, other invisibles, invalid characters, + * backslash, and double quotes are escaped. The resulting string is + * surrounded by double quotes. * - * @param aURL String - * The URL we will request. - * @param aOptions Object - * An object with the following optional properties: - * - loadFromCache: if false, will bypass the cache and - * always load fresh from the network (default: true) - * - policy: the nsIContentPolicy type to apply when fetching the URL - * - window: the window to get the loadGroup from - * - charset: the charset to use if the channel doesn't provide one - * @returns Promise that resolves with an object with the following members on - * success: - * - content: the document at that URL, as a string, - * - contentType: the content type of the document - * - * If an error occurs, the promise is rejected with that error. - * - * XXX: It may be better to use nsITraceableChannel to get to the sources - * without relying on caching when we can (not for eval, etc.): - * http://www.softwareishard.com/blog/firebug/nsitraceablechannel-intercept-http-traffic/ + * @param {String} str + * the input + * @param {Boolean} escapeWhitespace + * if true, TAB, CR, and NL characters will be escaped + * @return {String} the escaped string */ - function mainThreadFetch(aURL) { - var aOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { loadFromCache: true, - policy: Ci.nsIContentPolicy.TYPE_OTHER, - window: null, - charset: null }; - - // Create a channel. - var url = aURL.split(" -> ").pop(); - var channel = void 0; - try { - channel = newChannelForURL(url, aOptions); - } catch (ex) { - return promise.reject(ex); - } - - // Set the channel options. - channel.loadFlags = aOptions.loadFromCache ? channel.LOAD_FROM_CACHE : channel.LOAD_BYPASS_CACHE; - - if (aOptions.window) { - // Respect private browsing. - channel.loadGroup = aOptions.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocumentLoader).loadGroup; - } - - var deferred = promise.defer(); - var onResponse = (stream, status, request) => { - if (!components.isSuccessCode(status)) { - deferred.reject(new Error(`Failed to fetch ${url}. Code ${status}.`)); - return; + function escapeString(str, escapeWhitespace) { + return "\"" + str.replace(escapeRegexp, (match, offset) => { + var c = match.charCodeAt(0); + if (c in escapeMap) { + if (!escapeWhitespace && (c === 9 || c === 0xa || c === 0xd)) { + return match[0]; + } + return escapeMap[c]; } + if (c >= 0xd800 && c <= 0xdfff) { + // Find the full code point containing the surrogate, with a + // special case for a trailing surrogate at the start of the + // string. + if (c >= 0xdc00 && offset > 0) { + --offset; + } + var codePoint = str.codePointAt(offset); + if (codePoint >= 0xd800 && codePoint <= 0xdfff) { + // Unpaired surrogate. + return "\\u" + codePoint.toString(16); + } else if (codePoint >= 0xf0000 && codePoint <= 0x10fffd) { + // Private use area. Because we visit each pair of a such a + // character, return the empty string for one half and the + // real result for the other, to avoid duplication. + if (c <= 0xdbff) { + return "\\u{" + codePoint.toString(16) + "}"; + } + return ""; + } + // Other surrogate characters are passed through. + return match; + } + return "\\u" + ("0000" + c.toString(16)).substr(-4); + }) + "\""; + } + /** + * Escape a property name, if needed. "Escaping" in this context + * means surrounding the property name with quotes. + * + * @param {String} + * name the property name + * @return {String} either the input, or the input surrounded by + * quotes, properly quoted in JS syntax. + */ + function maybeEscapePropertyName(name) { + // Quote the property name if it needs quoting. This particular + // test is an approximation; see + // https://mathiasbynens.be/notes/javascript-properties. However, + // the full solution requires a fair amount of Unicode data, and so + // let's defer that until either it's important, or the \p regexp + // syntax lands, see + // https://github.com/tc39/proposal-regexp-unicode-property-escapes. + if (!/^\w+$/.test(name)) { + name = escapeString(name); + } + return name; + } + + function cropMultipleLines(text, limit) { + return escapeNewLines(cropString(text, limit)); + } + + function rawCropString(text, limit, alternativeText) { + if (!alternativeText) { + alternativeText = "\u2026"; + } + + // Crop the string only if a limit is actually specified. + if (!limit || limit <= 0) { + return text; + } + + // Set the limit at least to the length of the alternative text + // plus one character of the original text. + if (limit <= alternativeText.length) { + limit = alternativeText.length + 1; + } + + var halfLimit = (limit - alternativeText.length) / 2; + + if (text.length > limit) { + return text.substr(0, Math.ceil(halfLimit)) + alternativeText + text.substr(text.length - Math.floor(halfLimit)); + } + + return text; + } + + function cropString(text, limit, alternativeText) { + return rawCropString(sanitizeString(text + ""), limit, alternativeText); + } + + function sanitizeString(text) { + // Replace all non-printable characters, except of + // (horizontal) tab (HT: \x09) and newline (LF: \x0A, CR: \x0D), + // with unicode replacement character (u+fffd). + // eslint-disable-next-line no-control-regex + var re = new RegExp("[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]", "g"); + return text.replace(re, "\ufffd"); + } + + function parseURLParams(url) { + url = new URL(url); + return parseURLEncodedText(url.searchParams); + } + + function parseURLEncodedText(text) { + var params = []; + + // In case the text is empty just return the empty parameters + if (text == "") { + return params; + } + + var searchParams = new URLSearchParams(text); + var entries = [].concat(_toConsumableArray(searchParams.entries())); + return entries.map(entry => { + return { + name: entry[0], + value: entry[1] + }; + }); + } + + function getFileName(url) { + var split = splitURLBase(url); + return split.name; + } + + function splitURLBase(url) { + if (!isDataURL(url)) { + return splitURLTrue(url); + } + return {}; + } + + function getURLDisplayString(url) { + return cropString(url); + } + + function isDataURL(url) { + return url && url.substr(0, 5) == "data:"; + } + + function splitURLTrue(url) { + var reSplitFile = /(.*?):\/{2,3}([^\/]*)(.*?)([^\/]*?)($|\?.*)/; + var m = reSplitFile.exec(url); + + if (!m) { + return { + name: url, + path: url + }; + } else if (m[4] == "" && m[5] == "") { + return { + protocol: m[1], + domain: m[2], + path: m[3], + name: m[3] != "/" ? m[3] : m[2] + }; + } + + return { + protocol: m[1], + domain: m[2], + path: m[2] + m[3], + name: m[4] + m[5] + }; + } + + /** + * Wrap the provided render() method of a rep in a try/catch block that will render a + * fallback rep if the render fails. + */ + function wrapRender(renderMethod) { + var wrappedFunction = function (props) { try { - // We cannot use NetUtil to do the charset conversion as if charset - // information is not available and our default guess is wrong the method - // might fail and we lose the stream data. This means we can't fall back - // to using the locale default encoding (bug 1181345). - - // Read and decode the data according to the locale default encoding. - var available = stream.available(); - var source = NetUtil.readInputStreamToString(stream, available); - stream.close(); - - // If the channel or the caller has correct charset information, the - // content will be decoded correctly. If we have to fall back to UTF-8 and - // the guess is wrong, the conversion fails and convertToUnicode returns - // the input unmodified. Essentially we try to decode the data as UTF-8 - // and if that fails, we use the locale specific default encoding. This is - // the best we can do if the source does not provide charset info. - var charset = channel.contentCharset || aOptions.charset || "UTF-8"; - var unicodeSource = NetworkHelper.convertToUnicode(source, charset); - - deferred.resolve({ - content: unicodeSource, - contentType: request.contentType - }); - } catch (ex) { - var uri = request.originalURI; - if (ex.name === "NS_BASE_STREAM_CLOSED" && uri instanceof Ci.nsIFileURL) { - // Empty files cause NS_BASE_STREAM_CLOSED exception. Use OS.File to - // differentiate between empty files and other errors (bug 1170864). - // This can be removed when bug 982654 is fixed. - - uri.QueryInterface(Ci.nsIFileURL); - var result = OS.File.read(uri.file.path).then(bytes => { - // Convert the bytearray to a String. - var decoder = new TextDecoder(); - var content = decoder.decode(bytes); - - // We can't detect the contentType without opening a channel - // and that failed already. This is the best we can do here. - return { - content, - contentType: "text/plain" - }; - }); - - deferred.resolve(result); - } else { - deferred.reject(ex); - } + return renderMethod.call(this, props); + } catch (e) { + console.error(e); + return React.DOM.span({ + className: "objectBox objectBox-failure", + title: "This object could not be rendered, " + "please file a bug on bugzilla.mozilla.org" + }, + /* Labels have to be hardcoded for reps, see Bug 1317038. */ + "Invalid object"); } }; - - // Open the channel - try { - NetUtil.asyncFetch(channel, onResponse); - } catch (ex) { - return promise.reject(ex); - } - - return deferred.promise; + wrappedFunction.propTypes = renderMethod.propTypes; + return wrappedFunction; } /** - * Opens a channel for given URL. Tries a bit harder than NetUtil.newChannel. + * Get an array of all the items from the grip in parameter (including the grip itself) + * which can be selected in the inspector. * - * @param {String} url - The URL to open a channel for. - * @param {Object} options - The options object passed to @method fetch. - * @return {nsIChannel} - The newly created channel. Throws on failure. + * @param {Object} Grip + * @return {Array} Flat array of the grips which can be selected in the inspector */ - function newChannelForURL(url, _ref) { - var policy = _ref.policy; - - var channelOptions = { - contentPolicyType: policy, - loadUsingSystemPrincipal: true, - uri: url - }; - - try { - return NetUtil.newChannel(channelOptions); - } catch (e) { - // In the xpcshell tests, the script url is the absolute path of the test - // file, which will make a malformed URI error be thrown. Add the file - // scheme to see if it helps. - channelOptions.uri = "file://" + url; - - return NetUtil.newChannel(channelOptions); - } - } - - // Fetch is defined differently depending on whether we are on the main thread - // or a worker thread. - if (typeof WorkerGlobalScope === "undefined") { - // i.e. not in a worker - exports.fetch = mainThreadFetch; - } else { - // Services is not available in worker threads, nor is there any other way - // to fetch a URL. We need to enlist the help from the main thread here, by - // issuing an rpc request, to fetch the URL on our behalf. - exports.fetch = function (url, options) { - return rpc("fetch", url, options); - }; + function getSelectableInInspectorGrips(grip) { + var grips = new Set(getFlattenedGrips([grip])); + return [].concat(_toConsumableArray(grips)).filter(isGripSelectableInInspector); } /** - * Returns a promise that is resolved or rejected when all promises have settled - * (resolved or rejected). + * Indicate if a Grip can be selected in the inspector, + * i.e. if it represents a node element. * - * This differs from Promise.all, which will reject immediately after the first - * rejection, instead of waiting for the remaining promises to settle. - * - * @param values - * Iterable of promises that may be pending, resolved, or rejected. When - * when all promises have settled (resolved or rejected), the returned - * promise will be resolved or rejected as well. - * - * @return A new promise that is fulfilled when all values have settled - * (resolved or rejected). Its resolution value will be an array of all - * resolved values in the given order, or undefined if values is an - * empty array. The reject reason will be forwarded from the first - * promise in the list of given promises to be rejected. + * @param {Object} Grip + * @return {Boolean} */ - exports.settleAll = values => { - if (values === null || typeof values[Symbol.iterator] != "function") { - throw new Error("settleAll() expects an iterable."); - } - - var deferred = promise.defer(); - - values = Array.isArray(values) ? values : [].concat(_toConsumableArray(values)); - var countdown = values.length; - var resolutionValues = new Array(countdown); - var rejectionValue = void 0; - var rejectionOccurred = false; - - if (!countdown) { - deferred.resolve(resolutionValues); - return deferred.promise; - } - - function checkForCompletion() { - if (--countdown > 0) { - return; - } - if (!rejectionOccurred) { - deferred.resolve(resolutionValues); - } else { - deferred.reject(rejectionValue); - } - } - - var _loop = function (i) { - var index = i; - var value = values[i]; - var resolver = result => { - resolutionValues[index] = result; - checkForCompletion(); - }; - var rejecter = error => { - if (!rejectionOccurred) { - rejectionValue = error; - rejectionOccurred = true; - } - checkForCompletion(); - }; - - if (value && typeof value.then == "function") { - value.then(resolver, rejecter); - } else { - // Given value is not a promise, forward it as a resolution value. - resolver(value); - } - }; - - for (var i = 0; i < values.length; i++) { - _loop(i); - } - - return deferred.promise; - }; + function isGripSelectableInInspector(grip) { + return grip && typeof grip === "object" && grip.preview && [nodeConstants.TEXT_NODE, nodeConstants.ELEMENT_NODE].includes(grip.preview.nodeType); + } /** - * When the testing flag is set, various behaviors may be altered from - * production mode, typically to enable easier testing or enhanced debugging. + * Get a flat array of all the grips and their preview items. + * + * @param {Array} Grips + * @return {Array} Flat array of the grips and their preview items */ - var testing = false; - Object.defineProperty(exports, "testing", { - get: function () { - return testing; - }, - set: function (state) { - testing = state; - } - }); + function getFlattenedGrips(grips) { + return grips.reduce((res, grip) => { + var previewItems = getGripPreviewItems(grip); + var flatPreviewItems = previewItems.length > 0 ? getFlattenedGrips(previewItems) : []; + + return [].concat(_toConsumableArray(res), [grip], _toConsumableArray(flatPreviewItems)); + }, []); + } /** - * Open the file at the given path for reading. + * Get preview items from a Grip. * - * @param {String} filePath - * - * @returns Promise + * @param {Object} Grip from which we want the preview items + * @return {Array} Array of the preview items of the grip, or an empty array + * if the grip does not have preview items */ - exports.openFileStream = function (filePath) { - return new Promise((resolve, reject) => { - var uri = NetUtil.newURI(new FileUtils.File(filePath)); - NetUtil.asyncFetch({ uri, loadUsingSystemPrincipal: true }, (stream, result) => { - if (!components.isSuccessCode(result)) { - reject(new Error(`Could not open "${filePath}": result = ${result}`)); - return; - } - - resolve(stream); - }); - }); - }; - - exports.isGenerator = function (fn) { - if (typeof fn !== "function") { - return false; + function getGripPreviewItems(grip) { + if (!grip) { + return []; } - var proto = Object.getPrototypeOf(fn); - if (!proto) { - return false; - } - var ctor = proto.constructor; - if (!ctor) { - return false; - } - return ctor.name == "GeneratorFunction"; - }; - exports.isPromise = function (p) { - return p && typeof p.then === "function"; - }; + // Promise resolved value Grip + if (grip.promiseState && grip.promiseState.value) { + return [grip.promiseState.value]; + } + + // Array Grip + if (grip.preview && grip.preview.items) { + return grip.preview.items; + } + + // Node Grip + if (grip.preview && grip.preview.childNodes) { + return grip.preview.childNodes; + } + + // Set or Map Grip + if (grip.preview && grip.preview.entries) { + return grip.preview.entries.reduce((res, entry) => res.concat(entry), []); + } + + // Event Grip + if (grip.preview && grip.preview.target) { + var keys = Object.keys(grip.preview.properties); + var values = Object.values(grip.preview.properties); + return [grip.preview.target].concat(_toConsumableArray(keys), _toConsumableArray(values)); + } + + // RegEx Grip + if (grip.displayString) { + return [grip.displayString]; + } + + // Generic Grip + if (grip.preview && grip.preview.ownProperties) { + var propertiesValues = Object.values(grip.preview.ownProperties).map(property => property.value || property); + + var propertyKeys = Object.keys(grip.preview.ownProperties); + propertiesValues = propertiesValues.concat(propertyKeys); + + // ArrayBuffer Grip + if (grip.preview.safeGetterValues) { + propertiesValues = propertiesValues.concat(Object.values(grip.preview.safeGetterValues).map(property => property.getterValue || property)); + } + + return propertiesValues; + } + + return []; + } /** - * Return true if `thing` is a SavedFrame, false otherwise. + * Returns a new element wrapped with a component, props.objectLink if it exists, + * or a span if there are multiple children, or directly the child if only one is passed. + * + * @param {Object} props A Rep "props" object that may contain `objectLink` + * and `object` properties. + * @param {Object} config Object to pass as props to the `objectLink` component. + * @param {...Element} children Elements to be wrapped with the `objectLink` component. + * @return {Element} Element, wrapped or not, depending if `objectLink` + * was supplied in props. */ - exports.isSavedFrame = function (thing) { - return Object.prototype.toString.call(thing) === "[object SavedFrame]"; + function safeObjectLink(props, config) { + var _React$DOM; + + var objectLink = props.objectLink, + object = props.object; + + for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + children[_key - 2] = arguments[_key]; + } + + if (objectLink) { + return objectLink.apply(undefined, [Object.assign({ + object + }, config)].concat(children)); + } + + if ((!config || Object.keys(config).length === 0) && children.length === 1) { + return children[0]; + } + + return (_React$DOM = React.DOM).span.apply(_React$DOM, [config].concat(children)); + } + + module.exports = { + createFactories, + isGrip, + cropString, + rawCropString, + sanitizeString, + escapeString, + wrapRender, + cropMultipleLines, + parseURLParams, + parseURLEncodedText, + getFileName, + getURLDisplayString, + getSelectableInInspectorGrips, + maybeEscapePropertyName, + safeObjectLink, + getGripPreviewItems }; /***/ }, -/* 834 */ +/* 928 */ +/***/ function(module, exports) { + + "use strict"; + + module.exports = { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12, + + // DocumentPosition + DOCUMENT_POSITION_DISCONNECTED: 0x01, + DOCUMENT_POSITION_PRECEDING: 0x02, + DOCUMENT_POSITION_FOLLOWING: 0x04, + DOCUMENT_POSITION_CONTAINS: 0x08, + DOCUMENT_POSITION_CONTAINED_BY: 0x10, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 + }; + +/***/ }, +/* 929 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - /* - * A sham for https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/chrome + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders undefined value */ - var _require = __webpack_require__(835), - inDOMUtils = _require.inDOMUtils; - - var ourServices = { - inIDOMUtils: inDOMUtils, - nsIClipboardHelper: { - copyString: () => {} - }, - nsIXULChromeRegistry: { - isLocaleRTL: () => { - return false; - } - }, - nsIDOMParser: {} + var Undefined = function () { + return span({ className: "objectBox objectBox-undefined" }, "undefined"); }; - module.exports = { - Cc: name => { - if (typeof console !== "undefined") {} - return { - getService: name => ourServices[name], - createInstance: iface => ourServices[iface] - }; - }, - CC: (name, iface, method) => { - if (typeof console !== "undefined") {} - return {}; - }, - Ci: { - nsIThread: { - "DISPATCH_NORMAL": 0, - "DISPATCH_SYNC": 1 - }, - nsIDOMNode: typeof HTMLElement !== "undefined" ? HTMLElement : null, - nsIFocusManager: { - MOVEFOCUS_BACKWARD: 2, - MOVEFOCUS_FORWARD: 1 - }, - nsIDOMKeyEvent: {}, - nsIDOMCSSRule: { "UNKNOWN_RULE": 0, "STYLE_RULE": 1, "CHARSET_RULE": 2, "IMPORT_RULE": 3, "MEDIA_RULE": 4, "FONT_FACE_RULE": 5, "PAGE_RULE": 6, "KEYFRAMES_RULE": 7, "KEYFRAME_RULE": 8, "MOZ_KEYFRAMES_RULE": 7, "MOZ_KEYFRAME_RULE": 8, "NAMESPACE_RULE": 10, "COUNTER_STYLE_RULE": 11, "SUPPORTS_RULE": 12, "FONT_FEATURE_VALUES_RULE": 14 }, - inIDOMUtils: "inIDOMUtils", - nsIClipboardHelper: "nsIClipboardHelper", - nsIXULChromeRegistry: "nsIXULChromeRegistry" - }, - Cu: { - reportError: msg => { - typeof console !== "undefined" ? console.error(msg) : dump(msg); - }, - callFunctionWithAsyncStack: fn => fn() - }, - Cr: {}, - components: { - isSuccessCode: () => (returnCode & 0x80000000) === 0 + function supportsObject(object, type) { + if (object && object.type && object.type == "undefined") { + return true; } + + return type == "undefined"; + } + + // Exports from this module + + module.exports = { + rep: wrapRender(Undefined), + supportsObject }; /***/ }, -/* 835 */ +/* 930 */ /***/ function(module, exports, __webpack_require__) { - // A sham for inDOMUtils. + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders null value + */ + + function Null(props) { + return span({ className: "objectBox objectBox-null" }, "null"); + } + + function supportsObject(object, type) { + if (object && object.type && object.type == "null") { + return true; + } + + return object == null; + } + + // Exports from this module + + module.exports = { + rep: wrapRender(Null), + supportsObject + }; + +/***/ }, +/* 931 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + escapeString = _require.escapeString, + rawCropString = _require.rawCropString, + sanitizeString = _require.sanitizeString, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a string. String value is enclosed within quotes. + */ + + StringRep.propTypes = { + useQuotes: React.PropTypes.bool, + escapeWhitespace: React.PropTypes.bool, + style: React.PropTypes.object, + object: React.PropTypes.string.isRequired, + member: React.PropTypes.any, + cropLimit: React.PropTypes.number + }; + + function StringRep(props) { + var cropLimit = props.cropLimit, + text = props.object, + member = props.member, + style = props.style, + _props$useQuotes = props.useQuotes, + useQuotes = _props$useQuotes === undefined ? true : _props$useQuotes, + _props$escapeWhitespa = props.escapeWhitespace, + escapeWhitespace = _props$escapeWhitespa === undefined ? true : _props$escapeWhitespa; + + + var config = { className: "objectBox objectBox-string" }; + if (style) { + config.style = style; + } + + if (useQuotes) { + text = escapeString(text, escapeWhitespace); + } else { + text = sanitizeString(text); + } + + if ((!member || !member.open) && cropLimit) { + text = rawCropString(text, cropLimit); + } + + return span(config, text); + } + + function supportsObject(object, type) { + return type == "string"; + } + + // Exports from this module + + module.exports = { + rep: wrapRender(StringRep), + supportsObject + }; + +/***/ }, +/* 932 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + escapeString = _require.escapeString, + sanitizeString = _require.sanitizeString, + isGrip = _require.isGrip, + wrapRender = _require.wrapRender; + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a long string grip. + */ + + LongStringRep.propTypes = { + useQuotes: React.PropTypes.bool, + escapeWhitespace: React.PropTypes.bool, + style: React.PropTypes.object, + cropLimit: React.PropTypes.number.isRequired, + member: React.PropTypes.string, + object: React.PropTypes.object.isRequired + }; + + function LongStringRep(props) { + var cropLimit = props.cropLimit, + member = props.member, + object = props.object, + style = props.style, + _props$useQuotes = props.useQuotes, + useQuotes = _props$useQuotes === undefined ? true : _props$useQuotes, + _props$escapeWhitespa = props.escapeWhitespace, + escapeWhitespace = _props$escapeWhitespa === undefined ? true : _props$escapeWhitespa; + var fullText = object.fullText, + initial = object.initial, + length = object.length; + + + var config = { className: "objectBox objectBox-string" }; + if (style) { + config.style = style; + } + + var string = member && member.open ? fullText || initial : initial.substring(0, cropLimit); + + if (string.length < length) { + string += "\u2026"; + } + var formattedString = useQuotes ? escapeString(string, escapeWhitespace) : sanitizeString(string); + return span(config, formattedString); + } + + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return object.type === "longString"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(LongStringRep), + supportsObject + }; + +/***/ }, +/* 933 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a number + */ + + Number.propTypes = { + object: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.number, React.PropTypes.bool]).isRequired + }; + + function Number(props) { + var value = props.object; + + return span({ className: "objectBox objectBox-number" }, stringify(value)); + } + + function stringify(object) { + var isNegativeZero = Object.is(object, -0) || object.type && object.type == "-0"; + + return isNegativeZero ? "-0" : String(object); + } + + function supportsObject(object, type) { + return ["boolean", "number", "-0"].includes(type); + } + + // Exports from this module + + module.exports = { + rep: wrapRender(Number), + supportsObject + }; + +/***/ }, +/* 934 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var Caption = __webpack_require__(935); + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + var ModePropType = React.PropTypes.oneOf( + // @TODO Change this to Object.values once it's supported in Node's version of V8 + Object.keys(MODE).map(key => MODE[key])); + + // Shortcuts + var DOM = React.DOM; + + /** + * Renders an array. The array is enclosed by left and right bracket + * and the max number of rendered items depends on the current mode. + */ + ArrayRep.propTypes = { + mode: ModePropType, + objectLink: React.PropTypes.func, + object: React.PropTypes.array.isRequired + }; + + function ArrayRep(props) { + var object = props.object, + _props$mode = props.mode, + mode = _props$mode === undefined ? MODE.SHORT : _props$mode; + + + var items = void 0; + var brackets = void 0; + var needSpace = function (space) { + return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; + }; + + if (mode === MODE.TINY) { + var isEmpty = object.length === 0; + items = [DOM.span({ className: "length" }, isEmpty ? "" : object.length)]; + brackets = needSpace(false); + } else { + var max = mode === MODE.SHORT ? 3 : 10; + items = arrayIterator(props, object, max); + brackets = needSpace(items.length > 0); + } + + return DOM.span.apply(DOM, [{ + className: "objectBox objectBox-array" }, safeObjectLink(props, { + className: "arrayLeftBracket", + object: object + }, brackets.left)].concat(_toConsumableArray(items), [safeObjectLink(props, { + className: "arrayRightBracket", + object: object + }, brackets.right), DOM.span({ + className: "arrayProperties", + role: "group" })])); + } + + function arrayIterator(props, array, max) { + var items = []; + var delim = void 0; + + for (var i = 0; i < array.length && i < max; i++) { + try { + var value = array[i]; + + delim = i == array.length - 1 ? "" : ", "; + + items.push(ItemRep({ + object: value, + // Hardcode tiny mode to avoid recursive handling. + mode: MODE.TINY, + delim: delim + })); + } catch (exc) { + items.push(ItemRep({ + object: exc, + mode: MODE.TINY, + delim: delim + })); + } + } + + if (array.length > max) { + items.push(Caption({ + object: safeObjectLink(props, { + object: props.object + }, array.length - max + " more…") + })); + } + + return items; + } + + /** + * Renders array item. Individual values are separated by a comma. + */ + ItemRep.propTypes = { + object: React.PropTypes.any.isRequired, + delim: React.PropTypes.string.isRequired, + mode: ModePropType + }; + + function ItemRep(props) { + var _require3 = __webpack_require__(926), + Rep = _require3.Rep; + + var object = props.object, + delim = props.delim, + mode = props.mode; + + return DOM.span({}, Rep({ object: object, mode: mode }), delim); + } + + function supportsObject(object, type) { + return Array.isArray(object) || Object.prototype.toString.call(object) === "[object Arguments]"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ArrayRep), + supportsObject + }; + +/***/ }, +/* 935 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + var DOM = React.DOM; + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + /** + * Renders a caption. This template is used by other components + * that needs to distinguish between a simple text/value and a label. + */ + + + Caption.propTypes = { + object: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]).isRequired + }; + + function Caption(props) { + return DOM.span({ "className": "caption" }, props.object); + } + + // Exports from this module + module.exports = wrapRender(Caption); + +/***/ }, +/* 936 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var Caption = __webpack_require__(935); + var PropRep = __webpack_require__(937); + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + // Shortcuts + + + var span = React.DOM.span; + /** + * Renders an object. An object is represented by a list of its + * properties enclosed in curly brackets. + */ + + ObjectRep.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func, + title: React.PropTypes.string + }; + + function ObjectRep(props) { + var object = props.object; + var propsArray = safePropIterator(props, object); + + if (props.mode === MODE.TINY || !propsArray.length) { + return span({ className: "objectBox objectBox-object" }, getTitle(props, object)); + } + + return span.apply(undefined, [{ className: "objectBox objectBox-object" }, getTitle(props, object), safeObjectLink(props, { + className: "objectLeftBrace" + }, " { ")].concat(_toConsumableArray(propsArray), [safeObjectLink(props, { + className: "objectRightBrace" + }, " }")])); + } + + function getTitle(props, object) { + var title = props.title || object.class || "Object"; + return safeObjectLink(props, { className: "objectTitle" }, title); + } + + function safePropIterator(props, object, max) { + max = typeof max === "undefined" ? 3 : max; + try { + return propIterator(props, object, max); + } catch (err) { + console.error(err); + } + return []; + } + + function propIterator(props, object, max) { + var isInterestingProp = (type, value) => { + // Do not pick objects, it could cause recursion. + return type == "boolean" || type == "number" || type == "string" && value; + }; + + // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=945377 + if (Object.prototype.toString.call(object) === "[object Generator]") { + object = Object.getPrototypeOf(object); + } + + // Object members with non-empty values are preferred since it gives the + // user a better overview of the object. + var interestingObject = getFilteredObject(object, max, isInterestingProp); + + if (Object.keys(interestingObject).length < max) { + // There are not enough props yet (or at least, not enough props to + // be able to know whether we should print "more…" or not). + // Let's display also empty members and functions. + interestingObject = Object.assign({}, interestingObject, getFilteredObject(object, max - Object.keys(interestingObject).length, (type, value) => !isInterestingProp(type, value))); + } + + var truncated = Object.keys(object).length > max; + var propsArray = getPropsArray(interestingObject, truncated); + if (truncated) { + propsArray.push(Caption({ + object: safeObjectLink(props, {}, Object.keys(object).length - max + " more…") + })); + } + + return propsArray; + } + + /** + * Get an array of components representing the properties of the object + * + * @param {Object} object + * @param {Boolean} truncated true if the object is truncated. + * @return {Array} Array of PropRep. + */ + function getPropsArray(object, truncated) { + var propsArray = []; + + if (!object) { + return propsArray; + } + + // Hardcode tiny mode to avoid recursive handling. + var mode = MODE.TINY; + var objectKeys = Object.keys(object); + return objectKeys.map((name, i) => PropRep({ + mode, + name, + object: object[name], + equal: ": ", + delim: i !== objectKeys.length - 1 || truncated ? ", " : null + })); + } + + /** + * Get a copy of the object filtered by a given predicate. + * + * @param {Object} object. + * @param {Number} max The maximum length of keys array. + * @param {Function} filter Filter the props you want. + * @return {Object} the filtered object. + */ + function getFilteredObject(object, max, filter) { + var filteredObject = {}; + + try { + for (var name in object) { + if (Object.keys(filteredObject).length >= max) { + return filteredObject; + } + + var value = void 0; + try { + value = object[name]; + } catch (exc) { + continue; + } + + var t = typeof value; + if (filter(t, value)) { + filteredObject[name] = value; + } + } + } catch (err) { + console.error(err); + } + return filteredObject; + } + + function supportsObject(object, type) { + return true; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ObjectRep), + supportsObject + }; + +/***/ }, +/* 937 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + maybeEscapePropertyName = _require.maybeEscapePropertyName, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + // Shortcuts + + + var span = React.DOM.span; + + /** + * Property for Obj (local JS objects), Grip (remote JS objects) + * and GripMap (remote JS maps and weakmaps) reps. + * It's used to render object properties. + */ + + PropRep.propTypes = { + // Property name. + name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.object]).isRequired, + // Equal character rendered between property name and value. + equal: React.PropTypes.string, + // Delimiter character used to separate individual properties. + delim: React.PropTypes.string, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func, + // Normally a PropRep will quote a property name that isn't valid + // when unquoted; but this flag can be used to suppress the + // quoting. + suppressQuotes: React.PropTypes.bool + }; + + function PropRep(props) { + var Grip = __webpack_require__(938); + + var _require3 = __webpack_require__(926), + Rep = _require3.Rep; + + var name = props.name, + mode = props.mode, + equal = props.equal, + delim = props.delim, + suppressQuotes = props.suppressQuotes; + + + var key = void 0; + // The key can be a simple string, for plain objects, + // or another object for maps and weakmaps. + if (typeof name === "string") { + if (!suppressQuotes) { + name = maybeEscapePropertyName(name); + } + key = span({ "className": "nodeName" }, name); + } else { + key = Rep(Object.assign({}, props, { + object: name, + mode: mode || MODE.TINY, + defaultRep: Grip + })); + } + + var delimElement = void 0; + if (delim) { + delimElement = span({ + "className": "objectComma" + }, delim); + } + + return span({}, key, span({ + "className": "objectEqual" + }, equal), Rep(Object.assign({}, props)), delimElement); + } + + // Exports from this module + module.exports = wrapRender(PropRep); + +/***/ }, +/* 938 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // ReactJS + var React = __webpack_require__(2); + // Dependencies + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var Caption = __webpack_require__(935); + var PropRep = __webpack_require__(937); + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders generic grip. Grip is client representation + * of remote JS object and is used as an input object + * for this rep component. + */ + + GripRep.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + isInterestingProp: React.PropTypes.func, + title: React.PropTypes.string, + objectLink: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function GripRep(props) { + var object = props.object; + var propsArray = safePropIterator(props, object, props.mode === MODE.LONG ? 10 : 3); + + if (props.mode === MODE.TINY) { + return span({ className: "objectBox objectBox-object" }, getTitle(props, object)); + } + + return span.apply(undefined, [{ className: "objectBox objectBox-object" }, getTitle(props, object), safeObjectLink(props, { + className: "objectLeftBrace" + }, " { ")].concat(_toConsumableArray(propsArray), [safeObjectLink(props, { + className: "objectRightBrace" + }, " }")])); + } + + function getTitle(props, object) { + var title = props.title || object.class || "Object"; + return safeObjectLink(props, {}, title); + } + + function safePropIterator(props, object, max) { + max = typeof max === "undefined" ? 3 : max; + try { + return propIterator(props, object, max); + } catch (err) { + console.error(err); + } + return []; + } + + function propIterator(props, object, max) { + if (object.preview && Object.keys(object.preview).includes("wrappedValue")) { + var _require3 = __webpack_require__(926), + Rep = _require3.Rep; + + return [Rep({ + object: object.preview.wrappedValue, + mode: props.mode || MODE.TINY, + defaultRep: Grip + })]; + } + + // Property filter. Show only interesting properties to the user. + var isInterestingProp = props.isInterestingProp || ((type, value) => { + return type == "boolean" || type == "number" || type == "string" && value.length != 0; + }); + + var properties = object.preview ? object.preview.ownProperties : {}; + var propertiesLength = object.preview && object.preview.ownPropertiesLength ? object.preview.ownPropertiesLength : object.ownPropertyLength; + + if (object.preview && object.preview.safeGetterValues) { + properties = Object.assign({}, properties, object.preview.safeGetterValues); + propertiesLength += Object.keys(object.preview.safeGetterValues).length; + } + + var indexes = getPropIndexes(properties, max, isInterestingProp); + if (indexes.length < max && indexes.length < propertiesLength) { + // There are not enough props yet. Then add uninteresting props to display them. + indexes = indexes.concat(getPropIndexes(properties, max - indexes.length, (t, value, name) => { + return !isInterestingProp(t, value, name); + })); + } + + var truncate = Object.keys(properties).length > max; + // The server synthesizes some property names for a Proxy, like + // and ; we don't want to quote these because, + // as synthetic properties, they appear more natural when + // unquoted. + var suppressQuotes = object.class === "Proxy"; + var propsArray = getProps(props, properties, indexes, truncate, suppressQuotes); + if (truncate) { + // There are some undisplayed props. Then display "more...". + propsArray.push(Caption({ + object: safeObjectLink(props, {}, `${propertiesLength - max} more…`) + })); + } + + return propsArray; + } + + /** + * Get props ordered by index. + * + * @param {Object} componentProps Grip Component props. + * @param {Object} properties Properties of the object the Grip describes. + * @param {Array} indexes Indexes of properties. + * @param {Boolean} truncate true if the grip will be truncated. + * @param {Boolean} suppressQuotes true if we should suppress quotes + * on property names. + * @return {Array} Props. + */ + function getProps(componentProps, properties, indexes, truncate, suppressQuotes) { + // Make indexes ordered by ascending. + indexes.sort(function (a, b) { + return a - b; + }); + + var propertiesKeys = Object.keys(properties); + return indexes.map(i => { + var name = propertiesKeys[i]; + var value = getPropValue(properties[name]); + + return PropRep(Object.assign({}, componentProps, { + mode: MODE.TINY, + name, + object: value, + equal: ": ", + delim: i !== indexes.length - 1 || truncate ? ", " : null, + defaultRep: Grip, + // Do not propagate title and objectLink to properties reps + title: null, + objectLink: null, + suppressQuotes + })); + }); + } + + /** + * Get the indexes of props in the object. + * + * @param {Object} properties Props object. + * @param {Number} max The maximum length of indexes array. + * @param {Function} filter Filter the props you want. + * @return {Array} Indexes of interesting props in the object. + */ + function getPropIndexes(properties, max, filter) { + var indexes = []; + + try { + var i = 0; + for (var name in properties) { + if (indexes.length >= max) { + return indexes; + } + + // Type is specified in grip's "class" field and for primitive + // values use typeof. + var value = getPropValue(properties[name]); + var type = value.class || typeof value; + type = type.toLowerCase(); + + if (filter(type, value, name)) { + indexes.push(i); + } + i++; + } + } catch (err) { + console.error(err); + } + return indexes; + } + + /** + * Get the actual value of a property. + * + * @param {Object} property + * @return {Object} Value of the property. + */ + function getPropValue(property) { + var value = property; + if (typeof property === "object") { + var keys = Object.keys(property); + if (keys.includes("value")) { + value = property.value; + } else if (keys.includes("getterValue")) { + value = property.getterValue; + } + } + return value; + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return object.preview && object.preview.ownProperties; + } + + // Grip is used in propIterator and has to be defined here. + var Grip = { + rep: wrapRender(GripRep), + supportsObject + }; + + // Exports from this module + module.exports = Grip; + +/***/ }, +/* 939 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a symbol. + */ + + SymbolRep.propTypes = { + object: React.PropTypes.object.isRequired + }; + + function SymbolRep(props) { + var object = props.object; + var name = object.name; + + + return span({ className: "objectBox objectBox-symbol" }, `Symbol(${name || ""})`); + } + + function supportsObject(object, type) { + return type == "symbol"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(SymbolRep), + supportsObject + }; + +/***/ }, +/* 940 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a Infinity object + */ + + InfinityRep.propTypes = { + object: React.PropTypes.object.isRequired + }; + + function InfinityRep(props) { + return span({ className: "objectBox objectBox-number" }, props.object.type); + } + + function supportsObject(object, type) { + return type == "Infinity" || type == "-Infinity"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(InfinityRep), + supportsObject + }; + +/***/ }, +/* 941 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a NaN object + */ + + function NaNRep(props) { + return span({ className: "objectBox objectBox-nan" }, "NaN"); + } + + function supportsObject(object, type) { + return type == "NaN"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(NaNRep), + supportsObject + }; + +/***/ }, +/* 942 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(931), + StringRep = _require2.rep; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders DOM attribute + */ + + Attribute.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function Attribute(props) { + var object = props.object; + + var value = object.preview.value; + + return safeObjectLink(props, { className: "objectLink-Attr" }, span({ className: "attrTitle" }, getTitle(object)), span({ className: "attrEqual" }, "="), StringRep({ object: value })); + } + + function getTitle(grip) { + return grip.preview.nodeName; + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return type == "Attr" && grip.preview; + } + + module.exports = { + rep: wrapRender(Attribute), + supportsObject + }; + +/***/ }, +/* 943 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Used to render JS built-in Date() object. + */ + + DateTime.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function DateTime(props) { + var grip = props.object; + var date = void 0; + try { + date = span({ className: "objectBox" }, getTitle(props, grip), span({ className: "Date" }, new Date(grip.preview.timestamp).toISOString())); + } catch (e) { + date = span({ className: "objectBox" }, "Invalid Date"); + } + + return date; + } + + function getTitle(props, grip) { + return safeObjectLink(props, {}, grip.class + " "); + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return type == "Date" && grip.preview; + } + + // Exports from this module + module.exports = { + rep: wrapRender(DateTime), + supportsObject + }; + +/***/ }, +/* 944 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + getURLDisplayString = _require.getURLDisplayString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders DOM document object. + */ + + Document.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function Document(props) { + var grip = props.object; + + return span({ className: "objectBox objectBox-object" }, getTitle(props, grip), span({ className: "objectPropValue" }, getLocation(grip))); + } + + function getLocation(grip) { + var location = grip.preview.location; + return location ? getURLDisplayString(location) : ""; + } + + function getTitle(props, grip) { + return safeObjectLink(props, {}, grip.class + " "); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + + return object.preview && type == "HTMLDocument"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(Document), + supportsObject + }; + +/***/ }, +/* 945 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + var _require3 = __webpack_require__(938), + rep = _require3.rep; + + /** + * Renders DOM event objects. + */ + + + Event.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function Event(props) { + // Use `Object.assign` to keep `props` without changes because: + // 1. JSON.stringify/JSON.parse is slow. + // 2. Immutable.js is planned for the future. + var gripProps = Object.assign({}, props, { + title: getTitle(props) + }); + gripProps.object = Object.assign({}, props.object); + gripProps.object.preview = Object.assign({}, props.object.preview); + + gripProps.object.preview.ownProperties = {}; + if (gripProps.object.preview.target) { + Object.assign(gripProps.object.preview.ownProperties, { + target: gripProps.object.preview.target + }); + } + Object.assign(gripProps.object.preview.ownProperties, gripProps.object.preview.properties); + + delete gripProps.object.preview.properties; + gripProps.object.ownPropertyLength = Object.keys(gripProps.object.preview.ownProperties).length; + + switch (gripProps.object.class) { + case "MouseEvent": + gripProps.isInterestingProp = (type, value, name) => { + return ["target", "clientX", "clientY", "layerX", "layerY"].includes(name); + }; + break; + case "KeyboardEvent": + gripProps.isInterestingProp = (type, value, name) => { + return ["target", "key", "charCode", "keyCode"].includes(name); + }; + break; + case "MessageEvent": + gripProps.isInterestingProp = (type, value, name) => { + return ["target", "isTrusted", "data"].includes(name); + }; + break; + default: + gripProps.isInterestingProp = (type, value, name) => { + // We want to show the properties in the order they are declared. + return Object.keys(gripProps.object.preview.ownProperties).includes(name); + }; + } + + return rep(gripProps); + } + + function getTitle(props) { + var preview = props.object.preview; + var title = preview.type; + + if (preview.eventKind == "key" && preview.modifiers && preview.modifiers.length) { + title = `${title} ${preview.modifiers.join("-")}`; + } + return title; + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return grip.preview && grip.preview.kind == "DOMEvent"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(Event), + supportsObject + }; + +/***/ }, +/* 946 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + cropString = _require.cropString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * This component represents a template for Function objects. + */ + + FunctionRep.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function FunctionRep(props) { + var grip = props.object; + + return ( + // Set dir="ltr" to prevent function parentheses from + // appearing in the wrong direction + span({ dir: "ltr", className: "objectBox objectBox-function" }, getTitle(props, grip), summarizeFunction(grip)) + ); + } + + function getTitle(props, grip) { + var title = "function "; + if (grip.isGenerator) { + title = "function* "; + } + if (grip.isAsync) { + title = "async " + title; + } + + return safeObjectLink(props, {}, title); + } + + function summarizeFunction(grip) { + var name = grip.userDisplayName || grip.displayName || grip.name || ""; + return cropString(name + "()", 100); + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return type == "function"; + } + + return type == "Function"; + } + + // Exports from this module + + module.exports = { + rep: wrapRender(FunctionRep), + supportsObject + }; + +/***/ }, +/* 947 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // ReactJS + var React = __webpack_require__(2); + // Dependencies + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var PropRep = __webpack_require__(937); + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a DOM Promise object. + */ + + PromiseRep.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function PromiseRep(props) { + var object = props.object; + var promiseState = object.promiseState; + + + if (props.mode === MODE.TINY) { + var _require3 = __webpack_require__(926), + Rep = _require3.Rep; + + return span({ className: "objectBox objectBox-object" }, getTitle(props, object), safeObjectLink(props, { + className: "objectLeftBrace" + }, " { "), Rep({ object: promiseState.state }), safeObjectLink(props, { + className: "objectRightBrace" + }, " }")); + } + + var propsArray = getProps(props, promiseState); + return span.apply(undefined, [{ className: "objectBox objectBox-object" }, getTitle(props, object), safeObjectLink(props, { + className: "objectLeftBrace" + }, " { ")].concat(_toConsumableArray(propsArray), [safeObjectLink(props, { + className: "objectRightBrace" + }, " }")])); + } + + function getTitle(props, object) { + var title = object.class; + return safeObjectLink(props, {}, title); + } + + function getProps(props, promiseState) { + var keys = ["state"]; + if (Object.keys(promiseState).includes("value")) { + keys.push("value"); + } + + return keys.map((key, i) => { + var object = promiseState[key]; + return PropRep(Object.assign({}, props, { + mode: MODE.TINY, + name: `<${key}>`, + object, + equal: ": ", + delim: i < keys.length - 1 ? ", " : null, + suppressQuotes: true + })); + }); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return type === "Promise"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(PromiseRep), + supportsObject + }; + +/***/ }, +/* 948 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + /** + * Renders a grip object with regular expression. + */ + + + RegExp.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function RegExp(props) { + var object = props.object; + + + return safeObjectLink(props, { + className: "objectBox objectBox-regexp regexpSource" + }, getSource(object)); + } + + function getSource(grip) { + return grip.displayString; + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + + return type == "RegExp"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(RegExp), + supportsObject + }; + +/***/ }, +/* 949 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + getURLDisplayString = _require.getURLDisplayString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a grip representing CSSStyleSheet + */ + + StyleSheet.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function StyleSheet(props) { + var grip = props.object; + + return span({ className: "objectBox objectBox-object" }, getTitle(props, grip), span({ className: "objectPropValue" }, getLocation(grip))); + } + + function getTitle(props, grip) { + var title = "StyleSheet "; + return safeObjectLink(props, { className: "objectBox" }, title); + } + + function getLocation(grip) { + // Embedded stylesheets don't have URL and so, no preview. + var url = grip.preview ? grip.preview.url : ""; + return url ? getURLDisplayString(url) : ""; + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + + return type == "CSSStyleSheet"; + } + + // Exports from this module + + module.exports = { + rep: wrapRender(StyleSheet), + supportsObject + }; + +/***/ }, +/* 950 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + cropString = _require.cropString, + cropMultipleLines = _require.cropMultipleLines, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + var nodeConstants = __webpack_require__(928); + + // Shortcuts + var span = React.DOM.span; + + /** + * Renders DOM comment node. + */ + + CommentNode.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])) + }; + + function CommentNode(props) { + var object = props.object, + _props$mode = props.mode, + mode = _props$mode === undefined ? MODE.SHORT : _props$mode; + var textContent = object.preview.textContent; + + if (mode === MODE.TINY) { + textContent = cropMultipleLines(textContent, 30); + } else if (mode === MODE.SHORT) { + textContent = cropString(textContent, 50); + } + + return span({ className: "objectBox theme-comment" }, ``); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return object.preview && object.preview.nodeType === nodeConstants.COMMENT_NODE; + } + + // Exports from this module + module.exports = { + rep: wrapRender(CommentNode), + supportsObject + }; + +/***/ }, +/* 951 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // ReactJS + var React = __webpack_require__(2); + + // Utils + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + var nodeConstants = __webpack_require__(928); + var Svg = __webpack_require__(952); + + // Shortcuts + var span = React.DOM.span; + + /** + * Renders DOM element node. + */ + + ElementNode.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func, + objectLink: React.PropTypes.func + }; + + function ElementNode(props) { + var object = props.object, + mode = props.mode, + onDOMNodeMouseOver = props.onDOMNodeMouseOver, + onDOMNodeMouseOut = props.onDOMNodeMouseOut, + onInspectIconClick = props.onInspectIconClick; + + var elements = getElements(object, mode); + + var isInTree = object.preview && object.preview.isConnected === true; + + var baseConfig = { className: "objectBox objectBox-node" }; + var inspectIcon = void 0; + if (isInTree) { + if (onDOMNodeMouseOver) { + Object.assign(baseConfig, { + onMouseOver: _ => onDOMNodeMouseOver(object) + }); + } + + if (onDOMNodeMouseOut) { + Object.assign(baseConfig, { + onMouseOut: onDOMNodeMouseOut + }); + } + + if (onInspectIconClick) { + inspectIcon = Svg("open-inspector", { + element: "a", + draggable: false, + // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands + title: "Click to select the node in the inspector", + onClick: e => onInspectIconClick(object, e) + }); + } + } + + return span(baseConfig, safeObjectLink.apply(undefined, [props, {}].concat(_toConsumableArray(elements))), inspectIcon); + } + + function getElements(grip, mode) { + var _grip$preview = grip.preview, + attributes = _grip$preview.attributes, + nodeName = _grip$preview.nodeName; + + var nodeNameElement = span({ + className: "tag-name theme-fg-color3" + }, nodeName); + + if (mode === MODE.TINY) { + var elements = [nodeNameElement]; + if (attributes.id) { + elements.push(span({ className: "attr-name theme-fg-color2" }, `#${attributes.id}`)); + } + if (attributes.class) { + elements.push(span({ className: "attr-name theme-fg-color2" }, attributes.class.replace(/(^\s+)|(\s+$)/g, "").split(" ").map(cls => `.${cls}`).join(""))); + } + return elements; + } + var attributeElements = Object.keys(attributes).sort(function getIdAndClassFirst(a1, a2) { + if ([a1, a2].includes("id")) { + return 3 * (a1 === "id" ? -1 : 1); + } + if ([a1, a2].includes("class")) { + return 2 * (a1 === "class" ? -1 : 1); + } + + // `id` and `class` excepted, + // we want to keep the same order that in `attributes`. + return 0; + }).reduce((arr, name, i, keys) => { + var value = attributes[name]; + var attribute = span({}, span({ className: "attr-name theme-fg-color2" }, `${name}`), `="`, span({ className: "attr-value theme-fg-color6" }, `${value}`), `"`); + + return arr.concat([" ", attribute]); + }, []); + + return ["<", nodeNameElement].concat(_toConsumableArray(attributeElements), [">"]); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return object.preview && object.preview.nodeType === nodeConstants.ELEMENT_NODE; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ElementNode), + supportsObject + }; + +/***/ }, +/* 952 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var React = __webpack_require__(2); + var InlineSVG = __webpack_require__(346); + + var svg = { + "open-inspector": __webpack_require__(688) + }; + + module.exports = function (name, props) { + // eslint-disable-line + if (!svg[name]) { + throw new Error("Unknown SVG: " + name); + } + var className = name; + if (props && props.className) { + className = `${name} ${props.className}`; + } + if (name === "subSettings") { + className = ""; + } + props = Object.assign({}, props, { className, src: svg[name] }); + return React.createElement(InlineSVG, props); + }; + +/***/ }, +/* 953 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + cropString = _require.cropString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + var Svg = __webpack_require__(952); + + // Shortcuts + var DOM = React.DOM; + + /** + * Renders DOM #text node. + */ + TextNode.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function TextNode(props) { + var grip = props.object, + _props$mode = props.mode, + mode = _props$mode === undefined ? MODE.SHORT : _props$mode, + onDOMNodeMouseOver = props.onDOMNodeMouseOver, + onDOMNodeMouseOut = props.onDOMNodeMouseOut, + onInspectIconClick = props.onInspectIconClick; + + + var baseConfig = { className: "objectBox objectBox-textNode" }; + var inspectIcon = void 0; + var isInTree = grip.preview && grip.preview.isConnected === true; + + if (isInTree) { + if (onDOMNodeMouseOver) { + Object.assign(baseConfig, { + onMouseOver: _ => onDOMNodeMouseOver(grip) + }); + } + + if (onDOMNodeMouseOut) { + Object.assign(baseConfig, { + onMouseOut: onDOMNodeMouseOut + }); + } + + if (onInspectIconClick) { + inspectIcon = Svg("open-inspector", { + element: "a", + draggable: false, + // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands + title: "Click to select the node in the inspector", + onClick: e => onInspectIconClick(grip, e) + }); + } + } + + if (mode === MODE.TINY) { + return DOM.span(baseConfig, getTitle(props, grip), inspectIcon); + } + + return DOM.span(baseConfig, getTitle(props, grip), DOM.span({ className: "nodeValue" }, " ", `"${getTextContent(grip)}"`), inspectIcon); + } + + function getTextContent(grip) { + return cropString(grip.preview.textContent); + } + + function getTitle(props, grip) { + var title = "#text"; + return safeObjectLink(props, {}, title); + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return grip.preview && grip.class == "Text"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(TextNode), + supportsObject + }; + +/***/ }, +/* 954 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + // Utils + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + /** + * Renders Error objects. + */ + + + ErrorRep.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func + }; + + function ErrorRep(props) { + var object = props.object; + var preview = object.preview; + var name = preview && preview.name ? preview.name : "Error"; + + var content = props.mode === MODE.TINY ? name : `${name}: ${preview.message}`; + + if (preview.stack && props.mode !== MODE.TINY) { + /* + * Since Reps are used in the JSON Viewer, we can't localize + * the "Stack trace" label (defined in debugger.properties as + * "variablesViewErrorStacktrace" property), until Bug 1317038 lands. + */ + content = `${content}\nStack trace:\n${preview.stack}`; + } + + return safeObjectLink(props, { className: "objectBox-stackTrace" }, content); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + return object.preview && type === "Error"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ErrorRep), + supportsObject + }; + +/***/ }, +/* 955 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + getURLDisplayString = _require.getURLDisplayString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a grip representing a window. + */ + + WindowRep.propTypes = { + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function WindowRep(props) { + var mode = props.mode, + object = props.object; + + + if (mode === MODE.TINY) { + return span({ className: "objectBox objectBox-Window" }, getTitle(props, object)); + } + + return span({ className: "objectBox objectBox-Window" }, getTitle(props, object), " ", span({ className: "objectPropValue" }, getLocation(object))); + } + + function getTitle(props, object) { + var title = object.displayClass || object.class || "Window"; + return safeObjectLink(props, { className: "objectBox" }, title); + } + + function getLocation(object) { + return getURLDisplayString(object.preview.url); + } + + // Registration + function supportsObject(object, type) { + if (!isGrip(object)) { + return false; + } + + return object.preview && type == "Window"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(WindowRep), + supportsObject + }; + +/***/ }, +/* 956 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a grip object with textual data. + */ + + ObjectWithText.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function ObjectWithText(props) { + var grip = props.object; + return span({ className: "objectBox objectBox-" + getType(grip) }, getTitle(props, grip), span({ className: "objectPropValue" }, getDescription(grip))); + } + + function getTitle(props, grip) { + if (props.objectLink) { + return span({ className: "objectBox" }, props.objectLink({ + object: grip + }, getType(grip) + " ")); + } + return ""; + } + + function getType(grip) { + return grip.class; + } + + function getDescription(grip) { + return "\"" + grip.preview.text + "\""; + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return grip.preview && grip.preview.kind == "ObjectWithText"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ObjectWithText), + supportsObject + }; + +/***/ }, +/* 957 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + // ReactJS + var React = __webpack_require__(2); + + // Reps + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + getURLDisplayString = _require.getURLDisplayString, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders a grip object with URL data. + */ + + ObjectWithURL.propTypes = { + object: React.PropTypes.object.isRequired, + objectLink: React.PropTypes.func + }; + + function ObjectWithURL(props) { + var grip = props.object; + return span({ className: "objectBox objectBox-" + getType(grip) }, getTitle(props, grip), span({ className: "objectPropValue" }, getDescription(grip))); + } + + function getTitle(props, grip) { + return safeObjectLink(props, { className: "objectBox" }, getType(grip) + " "); + } + + function getType(grip) { + return grip.class; + } + + function getDescription(grip) { + return getURLDisplayString(grip.preview.url); + } + + // Registration + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return grip.preview && grip.preview.kind == "ObjectWithURL"; + } + + // Exports from this module + module.exports = { + rep: wrapRender(ObjectWithURL), + supportsObject + }; + +/***/ }, +/* 958 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + // Dependencies + var React = __webpack_require__(2); + + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; + + var Caption = __webpack_require__(935); + + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + + // Shortcuts + + + var span = React.DOM.span; + + /** + * Renders an array. The array is enclosed by left and right bracket + * and the max number of rendered items depends on the current mode. + */ + + GripArray.propTypes = { + object: React.PropTypes.object.isRequired, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + provider: React.PropTypes.object, + objectLink: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function GripArray(props) { + var object = props.object, + _props$mode = props.mode, + mode = _props$mode === undefined ? MODE.SHORT : _props$mode; + + + var items = void 0; + var brackets = void 0; + var needSpace = function (space) { + return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; + }; + + if (mode === MODE.TINY) { + var objectLength = getLength(object); + var isEmpty = objectLength === 0; + items = [span({ className: "length" }, isEmpty ? "" : objectLength)]; + brackets = needSpace(false); + } else { + var max = mode === MODE.SHORT ? 3 : 10; + items = arrayIterator(props, object, max); + brackets = needSpace(items.length > 0); + } + + var title = getTitle(props, object); + + return span.apply(undefined, [{ + className: "objectBox objectBox-array" }, title, safeObjectLink(props, { + className: "arrayLeftBracket" + }, brackets.left)].concat(_toConsumableArray(items), [safeObjectLink(props, { + className: "arrayRightBracket" + }, brackets.right), span({ + className: "arrayProperties", + role: "group" })])); + } + + /** + * Renders array item. Individual values are separated by + * a delimiter (a comma by default). + */ + GripArrayItem.propTypes = { + delim: React.PropTypes.string, + object: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.number, React.PropTypes.string]).isRequired, + objectLink: React.PropTypes.func, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + provider: React.PropTypes.object, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func + }; + + function GripArrayItem(props) { + var _require3 = __webpack_require__(926), + Rep = _require3.Rep; + + var delim = props.delim; + + + return span({}, Rep(Object.assign({}, props, { + mode: MODE.TINY + })), delim); + } + + function getLength(grip) { + if (!grip.preview) { + return 0; + } + + return grip.preview.length || grip.preview.childNodesLength || 0; + } + + function getTitle(props, object, context) { + if (props.mode === MODE.TINY) { + return ""; + } + + var title = props.title || object.class || "Array"; + return safeObjectLink(props, {}, title + " "); + } + + function getPreviewItems(grip) { + if (!grip.preview) { + return null; + } + + return grip.preview.items || grip.preview.childNodes || null; + } + + function arrayIterator(props, grip, max) { + var items = []; + var gripLength = getLength(grip); + + if (!gripLength) { + return items; + } + + var previewItems = getPreviewItems(grip); + if (!previewItems) { + return items; + } + + var delim = void 0; + // number of grip preview items is limited to 10, but we may have more + // items in grip-array. + var delimMax = gripLength > previewItems.length ? previewItems.length : previewItems.length - 1; + var provider = props.provider; + + for (var i = 0; i < previewItems.length && i < max; i++) { + try { + var itemGrip = previewItems[i]; + var value = provider ? provider.getValue(itemGrip) : itemGrip; + + delim = i == delimMax ? "" : ", "; + + items.push(GripArrayItem(Object.assign({}, props, { + object: value, + delim: delim, + // Do not propagate title to array items reps + title: undefined + }))); + } catch (exc) { + items.push(GripArrayItem(Object.assign({}, props, { + object: exc, + delim: delim, + // Do not propagate title to array items reps + title: undefined + }))); + } + } + if (previewItems.length > max || gripLength > previewItems.length) { + var leftItemNum = gripLength - max > 0 ? gripLength - max : gripLength - previewItems.length; + items.push(Caption({ + object: safeObjectLink(props, {}, leftItemNum + " more…") + })); + } + + return items; + } + + function supportsObject(grip, type) { + if (!isGrip(grip)) { + return false; + } + + return grip.preview && (grip.preview.kind == "ArrayLike" || type === "DocumentFragment"); + } + + // Exports from this module + module.exports = { + rep: wrapRender(GripArray), + supportsObject + }; + +/***/ }, +/* 959 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - var _require = __webpack_require__(836), - CSSLexer = _require.CSSLexer; + // Dependencies + var React = __webpack_require__(2); - var _require2 = __webpack_require__(837), - cssColors = _require2.cssColors; + var _require = __webpack_require__(927), + isGrip = _require.isGrip, + safeObjectLink = _require.safeObjectLink, + wrapRender = _require.wrapRender; - var _require3 = __webpack_require__(838), - cssProperties = _require3.cssProperties; + var Caption = __webpack_require__(935); + var PropRep = __webpack_require__(937); - var cssRGBMap; + var _require2 = __webpack_require__(925), + MODE = _require2.MODE; + // Shortcuts - // From inIDOMUtils.idl. - var EXCLUDE_SHORTHANDS = 1 << 0; - var INCLUDE_ALIASES = 1 << 1; - var TYPE_LENGTH = 0; - var TYPE_PERCENTAGE = 1; - var TYPE_COLOR = 2; - var TYPE_URL = 3; - var TYPE_ANGLE = 4; - var TYPE_FREQUENCY = 5; - var TYPE_TIME = 6; - var TYPE_GRADIENT = 7; - var TYPE_TIMING_FUNCTION = 8; - var TYPE_IMAGE_RECT = 9; - var TYPE_NUMBER = 10; - function getCSSLexer(text) { - return new CSSLexer(text); - } - - function rgbToColorName(r, g, b) { - if (!cssRGBMap) { - cssRGBMap = new Map(); - for (var name in cssColors) { - cssRGBMap.set(JSON.stringify(cssColors[name]), name); - } - } - var value = cssRGBMap.get(JSON.stringify([r, g, b])); - if (!value) { - throw new Error("no such color"); - } - return value; - } - - // Taken from dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js - function _hslValue(n1, n2, hue) { - if (hue > 6.0) { - hue -= 6.0; - } else if (hue < 0.0) { - hue += 6.0; - } - var val; - if (hue < 1.0) { - val = n1 + (n2 - n1) * hue; - } else if (hue < 3.0) { - val = n2; - } else if (hue < 4.0) { - val = n1 + (n2 - n1) * (4.0 - hue); - } else { - val = n1; - } - return val; - } - - // Taken from dom/tests/mochitest/ajax/mochikit/MochiKit/Color.js - // and then modified. - function hslToRGB(_ref) { - var _ref2 = _slicedToArray(_ref, 3), - hue = _ref2[0], - saturation = _ref2[1], - lightness = _ref2[2]; - - var red; - var green; - var blue; - if (saturation === 0) { - red = lightness; - green = lightness; - blue = lightness; - } else { - var m2; - if (lightness <= 0.5) { - m2 = lightness * (1.0 + saturation); - } else { - m2 = lightness + saturation - lightness * saturation; - } - var m1 = 2.0 * lightness - m2; - var f = _hslValue; - var h6 = hue * 6.0; - red = f(m1, m2, h6 + 2); - green = f(m1, m2, h6); - blue = f(m1, m2, h6 - 2); - } - return [red, green, blue]; - } - - function colorToRGBA(name) { - name = name.trim().toLowerCase(); - if (name in cssColors) { - return cssColors[name]; - } - - if (name === "transparent") { - return [0, 0, 0, 0]; - } - - var lexer = getCSSLexer(name); - - var getToken = function () { - while (true) { - var token = lexer.nextToken(); - if (!token || token.tokenType !== "comment" || token.tokenType !== "whitespace") { - return token; - } - } - }; - - var requireComma = function (token) { - if (token.tokenType !== "symbol" || token.text !== ",") { - return null; - } - return getToken(); - }; - - var func = getToken(); - if (!func || func.tokenType !== "function") { - return null; - } - var alpha = false; - if (func.text === "rgb" || func.text === "hsl") { - // Nothing. - } else if (func.text === "rgba" || func.text === "hsla") { - alpha = true; - } else { - return null; - } - - var vals = []; - for (var i = 0; i < 3; ++i) { - var token = getToken(); - if (i > 0) { - token = requireComma(token); - } - if (token.tokenType !== "number" || !token.isInteger) { - return null; - } - var num = token.number; - if (num < 0) { - num = 0; - } else if (num > 255) { - num = 255; - } - vals.push(num); - } - - if (func.text === "hsl" || func.text === "hsla") { - vals = hslToRGB(vals); - } - - if (alpha) { - var _token = requireComma(getToken()); - if (_token.tokenType !== "number") { - return null; - } - var _num = _token.number; - if (_num < 0) { - _num = 0; - } else if (_num > 1) { - _num = 1; - } - vals.push(_num); - } else { - vals.push(1); - } - - var parenToken = getToken(); - if (!parenToken || parenToken.tokenType !== "symbol" || parenToken.text !== ")") { - return null; - } - if (getToken() !== null) { - return null; - } - - return vals; - } - - function isValidCSSColor(name) { - return colorToRGBA(name) !== null; - } - - function isVariable(name) { - return name.startsWith("--"); - } - - function cssPropertyIsShorthand(name) { - if (isVariable(name)) { - return false; - } - if (!(name in cssProperties)) { - throw Error("unknown property " + name); - } - return !!cssProperties[name].subproperties; - } - - function getSubpropertiesForCSSProperty(name) { - if (isVariable(name)) { - return [name]; - } - if (!(name in cssProperties)) { - throw Error("unknown property " + name); - } - if ("subproperties" in cssProperties[name]) { - return cssProperties[name].subproperties.slice(); - } - return [name]; - } - - function getCSSValuesForProperty(name) { - if (isVariable(name)) { - return ["initial", "inherit", "unset"]; - } - if (!(name in cssProperties)) { - throw Error("unknown property " + name); - } - return cssProperties[name].values.slice(); - } - - function getCSSPropertyNames(flags) { - var names = Object.keys(cssProperties); - if ((flags & EXCLUDE_SHORTHANDS) !== 0) { - names = names.filter(name => cssProperties[name].subproperties); - } - if ((flags & INCLUDE_ALIASES) === 0) { - names = names.filter(name => !cssProperties[name].alias); - } - return names; - } - - function cssPropertySupportsType(name, type) { - if (isVariable(name)) { - return false; - } - if (!(name in cssProperties)) { - throw Error("unknown property " + name); - } - return (cssProperties[name].supports & 1 << type) !== 0; - } - - function isInheritedProperty(name) { - if (isVariable(name)) { - return true; - } - if (!(name in cssProperties)) { - return false; - } - return cssProperties[name].inherited; - } - - function cssPropertyIsValid(name, value) { - if (isVariable(name)) { - return true; - } - if (!(name in cssProperties)) { - return false; - } - var elt = document.createElement("div"); - elt.style = name + ":" + value; - return elt.style.length > 0; - } - - exports.inDOMUtils = { - getCSSLexer, - rgbToColorName, - colorToRGBA, - isValidCSSColor, - cssPropertyIsShorthand, - getSubpropertiesForCSSProperty, - getCSSValuesForProperty, - getCSSPropertyNames, - cssPropertySupportsType, - isInheritedProperty, - cssPropertyIsValid, - - // Constants. - EXCLUDE_SHORTHANDS, - INCLUDE_ALIASES, - TYPE_LENGTH, - TYPE_PERCENTAGE, - TYPE_COLOR, - TYPE_URL, - TYPE_ANGLE, - TYPE_FREQUENCY, - TYPE_TIME, - TYPE_GRADIENT, - TYPE_TIMING_FUNCTION, - TYPE_IMAGE_RECT, - TYPE_NUMBER - }; - -/***/ }, -/* 836 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict"; - - (function (root, factory) { - // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, - // Rhino, and plain browser loading. - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports !== 'undefined') { - factory(exports); - } else { - factory(root); - } - })(undefined, function (exports) { - - function between(num, first, last) { - return num >= first && num <= last; - } - function digit(code) { - return between(code, 0x30, 0x39); - } - function hexdigit(code) { - return digit(code) || between(code, 0x41, 0x46) || between(code, 0x61, 0x66); - } - function uppercaseletter(code) { - return between(code, 0x41, 0x5a); - } - function lowercaseletter(code) { - return between(code, 0x61, 0x7a); - } - function letter(code) { - return uppercaseletter(code) || lowercaseletter(code); - } - function nonascii(code) { - return code >= 0x80; - } - function namestartchar(code) { - return letter(code) || nonascii(code) || code == 0x5f; - } - function namechar(code) { - return namestartchar(code) || digit(code) || code == 0x2d; - } - function nonprintable(code) { - return between(code, 0, 8) || code == 0xb || between(code, 0xe, 0x1f) || code == 0x7f; - } - function newline(code) { - return code == 0xa; - } - function whitespace(code) { - return newline(code) || code == 9 || code == 0x20; - } - - var maximumallowedcodepoint = 0x10ffff; - - var InvalidCharacterError = function (message) { - this.message = message; - }; - InvalidCharacterError.prototype = new Error(); - InvalidCharacterError.prototype.name = 'InvalidCharacterError'; - - function stringFromCode(code) { - if (code <= 0xffff) return String.fromCharCode(code); - // Otherwise, encode astral char as surrogate pair. - code -= Math.pow(2, 20); - var lead = Math.floor(code / Math.pow(2, 10)) + 0xd800; - var trail = code % Math.pow(2, 10) + 0xdc00; - return String.fromCharCode(lead) + String.fromCharCode(trail); - } - - function* tokenize(str, options) { - if (options === undefined) { - options = {}; - } - if (options.loc === undefined) { - options.loc = false; - } - if (options.offsets === undefined) { - options.offsets = false; - } - if (options.keepComments === undefined) { - options.keepComments = false; - } - if (options.startOffset === undefined) { - options.startOffset = 0; - } - - var i = options.startOffset - 1; - var code; - - // Line number information. - var line = 0; - var column = 0; - // The only use of lastLineLength is in reconsume(). - var lastLineLength = 0; - var incrLineno = function () { - line += 1; - lastLineLength = column; - column = 0; - }; - var locStart = { line: line, column: column }; - var offsetStart = i; - - var codepoint = function (i) { - if (i >= str.length) { - return -1; - } - return str.charCodeAt(i); - }; - var next = function (num) { - if (num === undefined) num = 1; - if (num > 3) throw "Spec Error: no more than three codepoints of lookahead."; - - var rcode; - for (var offset = i + 1; num-- > 0; ++offset) { - rcode = codepoint(offset); - if (rcode === 0xd && codepoint(offset + 1) === 0xa) { - ++offset; - rcode = 0xa; - } else if (rcode === 0xd || rcode === 0xc) { - rcode = 0xa; - } else if (rcode === 0x0) { - rcode = 0xfffd; - } - } - - return rcode; - }; - var consume = function (num) { - if (num === undefined) num = 1; - while (num-- > 0) { - ++i; - code = codepoint(i); - if (code === 0xd && codepoint(i + 1) === 0xa) { - ++i; - code = 0xa; - } else if (code === 0xd || code === 0xc) { - code = 0xa; - } else if (code === 0x0) { - code = 0xfffd; - } - if (newline(code)) incrLineno();else column++; - } - return true; - }; - var reconsume = function () { - i -= 1; // This is ok even in the \r\n case. - if (newline(code)) { - line -= 1; - column = lastLineLength; - } else { - column -= 1; - } - return true; - }; - var eof = function (codepoint) { - if (codepoint === undefined) codepoint = code; - return codepoint == -1; - }; - var donothing = function () {}; - var parseerror = function () { - console.log("Parse error at index " + i + ", processing codepoint 0x" + code.toString(16) + ".");return true; - }; - - var consumeAToken = function () { - consume(); - if (!options.keepComments) { - while (code == 0x2f && next() == 0x2a) { - consumeAComment(); - consume(); - } - } - locStart.line = line; - locStart.column = column; - offsetStart = i; - if (whitespace(code)) { - while (whitespace(next())) { - consume(); - }return new WhitespaceToken(); - } else if (code == 0x2f && next() == 0x2a) return consumeAComment();else if (code == 0x22) return consumeAStringToken();else if (code == 0x23) { - if (namechar(next()) || areAValidEscape(next(1), next(2))) { - var token = new HashToken(); - if (wouldStartAnIdentifier(next(1), next(2), next(3))) { - token.type = "id"; - token.tokenType = "id"; - } - token.value = consumeAName(); - token.text = token.value; - return token; - } else { - return new DelimToken(code); - } - } else if (code == 0x24) { - if (next() == 0x3d) { - consume(); - return new SuffixMatchToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x27) return consumeAStringToken();else if (code == 0x28) return new OpenParenToken();else if (code == 0x29) return new CloseParenToken();else if (code == 0x2a) { - if (next() == 0x3d) { - consume(); - return new SubstringMatchToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x2b) { - if (startsWithANumber()) { - reconsume(); - return consumeANumericToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x2c) return new CommaToken();else if (code == 0x2d) { - if (startsWithANumber()) { - reconsume(); - return consumeANumericToken(); - } else if (next(1) == 0x2d && next(2) == 0x3e) { - consume(2); - return new CDCToken(); - } else if (startsWithAnIdentifier()) { - reconsume(); - return consumeAnIdentlikeToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x2e) { - if (startsWithANumber()) { - reconsume(); - return consumeANumericToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x3a) return new ColonToken();else if (code == 0x3b) return new SemicolonToken();else if (code == 0x3c) { - if (next(1) == 0x21 && next(2) == 0x2d && next(3) == 0x2d) { - consume(3); - return new CDOToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x40) { - if (wouldStartAnIdentifier(next(1), next(2), next(3))) { - return new AtKeywordToken(consumeAName()); - } else { - return new DelimToken(code); - } - } else if (code == 0x5b) return new OpenSquareToken();else if (code == 0x5c) { - if (startsWithAValidEscape()) { - reconsume(); - return consumeAnIdentlikeToken(); - } else { - parseerror(); - return new DelimToken(code); - } - } else if (code == 0x5d) return new CloseSquareToken();else if (code == 0x5e) { - if (next() == 0x3d) { - consume(); - return new PrefixMatchToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x7b) return new OpenCurlyToken();else if (code == 0x7c) { - if (next() == 0x3d) { - consume(); - return new DashMatchToken(); - // } else if(next() == 0x7c) { - // consume(); - // return new ColumnToken(); - } else { - return new DelimToken(code); - } - } else if (code == 0x7d) return new CloseCurlyToken();else if (code == 0x7e) { - if (next() == 0x3d) { - consume(); - return new IncludeMatchToken(); - } else { - return new DelimToken(code); - } - } else if (digit(code)) { - reconsume(); - return consumeANumericToken(); - } else if (namestartchar(code)) { - reconsume(); - return consumeAnIdentlikeToken(); - } else if (eof()) return new EOFToken();else return new DelimToken(code); - }; - - var consumeAComment = function () { - consume(); - var comment = ""; - while (true) { - consume(); - if (code == 0x2a && next() == 0x2f) { - consume(); - break; - } else if (eof()) { - break; - } - comment += stringFromCode(code); - } - return new CommentToken(comment); - }; - - var consumeANumericToken = function () { - var num = consumeANumber(); - var token; - if (wouldStartAnIdentifier(next(1), next(2), next(3))) { - token = new DimensionToken(); - token.value = num.value; - token.repr = num.repr; - token.type = num.type; - token.unit = consumeAName(); - token.text = token.unit; - } else if (next() == 0x25) { - consume(); - token = new PercentageToken(); - token.value = num.value; - token.repr = num.repr; - } else { - var token = new NumberToken(); - token.value = num.value; - token.repr = num.repr; - token.type = num.type; - } - token.number = token.value; - token.isInteger = token.type === "integer"; - // FIXME hasSign - return token; - }; - - var consumeAnIdentlikeToken = function () { - var str = consumeAName(); - if (str.toLowerCase() == "url" && next() == 0x28) { - consume(); - while (whitespace(next(1)) && whitespace(next(2))) { - consume(); - }if (next() == 0x22 || next() == 0x27 || whitespace(next()) && (next(2) == 0x22 || next(2) == 0x27)) { - while (whitespace(next())) { - consume(); - }consume(); - var _str = consumeAStringToken(); - while (whitespace(next())) { - consume(); - } // The closing paren. - consume(); - return new URLToken(_str.text); - } else { - return consumeAURLToken(); - } - } else if (next() == 0x28) { - consume(); - return new FunctionToken(str); - } else { - return new IdentToken(str); - } - }; - - var consumeAStringToken = function (endingCodePoint) { - if (endingCodePoint === undefined) endingCodePoint = code; - var string = ""; - while (consume()) { - if (code == endingCodePoint || eof()) { - return new StringToken(string); - } else if (newline(code)) { - reconsume(); - return new BadStringToken(string); - } else if (code == 0x5c) { - if (eof(next())) { - donothing(); - } else if (newline(next())) { - consume(); - } else { - string += stringFromCode(consumeEscape()); - } - } else { - string += stringFromCode(code); - } - } - }; - - var consumeAURLToken = function () { - var token = new URLToken(""); - while (whitespace(next())) { - consume(); - }if (eof(next())) return token; - while (consume()) { - if (code == 0x29 || eof()) { - break; - } else if (whitespace(code)) { - while (whitespace(next())) { - consume(); - }if (next() == 0x29 || eof(next())) { - consume(); - break; - } else { - consumeTheRemnantsOfABadURL(); - return new BadURLToken(); - } - } else if (code == 0x22 || code == 0x27 || code == 0x28 || nonprintable(code)) { - parseerror(); - consumeTheRemnantsOfABadURL(); - return new BadURLToken(); - } else if (code == 0x5c) { - if (startsWithAValidEscape()) { - token.value += stringFromCode(consumeEscape()); - } else { - parseerror(); - consumeTheRemnantsOfABadURL(); - return new BadURLToken(); - } - } else { - token.value += stringFromCode(code); - } - } - token.text = token.value; - return token; - }; - - var consumeEscape = function () { - // Assume the the current character is the \ - // and the next code point is not a newline. - consume(); - if (hexdigit(code)) { - // Consume 1-6 hex digits - var digits = [code]; - for (var total = 0; total < 5; total++) { - if (hexdigit(next())) { - consume(); - digits.push(code); - } else { - break; - } - } - if (whitespace(next())) consume(); - var value = parseInt(digits.map(function (x) { - return String.fromCharCode(x); - }).join(''), 16); - if (value > maximumallowedcodepoint) value = 0xfffd; - return value; - } else if (eof()) { - return 0xfffd; - } else { - return code; - } - }; - - var areAValidEscape = function (c1, c2) { - if (c1 != 0x5c) return false; - if (newline(c2)) return false; - return true; - }; - var startsWithAValidEscape = function () { - return areAValidEscape(code, next()); - }; - - var wouldStartAnIdentifier = function (c1, c2, c3) { - if (c1 == 0x2d) { - return namestartchar(c2) || c2 == 0x2d || areAValidEscape(c2, c3); - } else if (namestartchar(c1)) { - return true; - } else if (c1 == 0x5c) { - return areAValidEscape(c1, c2); - } else { - return false; - } - }; - var startsWithAnIdentifier = function () { - return wouldStartAnIdentifier(code, next(1), next(2)); - }; - - var wouldStartANumber = function (c1, c2, c3) { - if (c1 == 0x2b || c1 == 0x2d) { - if (digit(c2)) return true; - if (c2 == 0x2e && digit(c3)) return true; - return false; - } else if (c1 == 0x2e) { - if (digit(c2)) return true; - return false; - } else if (digit(c1)) { - return true; - } else { - return false; - } - }; - var startsWithANumber = function () { - return wouldStartANumber(code, next(1), next(2)); - }; - - var consumeAName = function () { - var result = ""; - while (consume()) { - if (namechar(code)) { - result += stringFromCode(code); - } else if (startsWithAValidEscape()) { - result += stringFromCode(consumeEscape()); - } else { - reconsume(); - return result; - } - } - }; - - var consumeANumber = function () { - var repr = []; - var type = "integer"; - if (next() == 0x2b || next() == 0x2d) { - consume(); - repr += stringFromCode(code); - } - while (digit(next())) { - consume(); - repr += stringFromCode(code); - } - if (next(1) == 0x2e && digit(next(2))) { - consume(); - repr += stringFromCode(code); - consume(); - repr += stringFromCode(code); - type = "number"; - while (digit(next())) { - consume(); - repr += stringFromCode(code); - } - } - var c1 = next(1), - c2 = next(2), - c3 = next(3); - if ((c1 == 0x45 || c1 == 0x65) && digit(c2)) { - consume(); - repr += stringFromCode(code); - consume(); - repr += stringFromCode(code); - type = "number"; - while (digit(next())) { - consume(); - repr += stringFromCode(code); - } - } else if ((c1 == 0x45 || c1 == 0x65) && (c2 == 0x2b || c2 == 0x2d) && digit(c3)) { - consume(); - repr += stringFromCode(code); - consume(); - repr += stringFromCode(code); - consume(); - repr += stringFromCode(code); - type = "number"; - while (digit(next())) { - consume(); - repr += stringFromCode(code); - } - } - var value = convertAStringToANumber(repr); - return { type: type, value: value, repr: repr }; - }; - - var convertAStringToANumber = function (string) { - // CSS's number rules are identical to JS, afaik. - return +string; - }; - - var consumeTheRemnantsOfABadURL = function () { - while (consume()) { - if (code == 0x2d || eof()) { - return; - } else if (startsWithAValidEscape()) { - consumeEscape(); - donothing(); - } else { - donothing(); - } - } - }; - - var iterationCount = 0; - while (!eof(next())) { - var token = consumeAToken(); - if (options.loc) { - token.loc = {}; - token.loc.start = { line: locStart.line, column: locStart.column }; - token.loc.end = { line: line, column: column }; - } - if (options.offsets) { - token.startOffset = offsetStart; - token.endOffset = i + 1; - } - yield token; - iterationCount++; - if (iterationCount > str.length * 2) return "I'm infinite-looping!"; - } - } - - function CSSParserToken() { - throw "Abstract Base Class"; - } - CSSParserToken.prototype.toJSON = function () { - return { token: this.tokenType }; - }; - CSSParserToken.prototype.toString = function () { - return this.tokenType; - }; - CSSParserToken.prototype.toSource = function () { - return '' + this; - }; - - function BadStringToken(text) { - this.text = text; - return this; - } - BadStringToken.prototype = Object.create(CSSParserToken.prototype); - BadStringToken.prototype.tokenType = "bad_string"; - - function BadURLToken() { - return this; - } - BadURLToken.prototype = Object.create(CSSParserToken.prototype); - BadURLToken.prototype.tokenType = "bad_url"; - - function WhitespaceToken() { - return this; - } - WhitespaceToken.prototype = Object.create(CSSParserToken.prototype); - WhitespaceToken.prototype.tokenType = "whitespace"; - WhitespaceToken.prototype.toString = function () { - return "WS"; - }; - WhitespaceToken.prototype.toSource = function () { - return " "; - }; - - function CDOToken() { - return this; - } - CDOToken.prototype = Object.create(CSSParserToken.prototype); - CDOToken.prototype.tokenType = "htmlcomment"; - CDOToken.prototype.toSource = function () { - return ""; - }; - - function ColonToken() { - return this; - } - ColonToken.prototype = Object.create(CSSParserToken.prototype); - ColonToken.prototype.tokenType = "symbol"; - ColonToken.prototype.text = ":"; - - function SemicolonToken() { - return this; - } - SemicolonToken.prototype = Object.create(CSSParserToken.prototype); - SemicolonToken.prototype.tokenType = "symbol"; - SemicolonToken.prototype.text = ";"; - - function CommaToken() { - return this; - } - CommaToken.prototype = Object.create(CSSParserToken.prototype); - CommaToken.prototype.tokenType = "symbol"; - CommaToken.prototype.text = ","; - - function GroupingToken() { - throw "Abstract Base Class"; - } - GroupingToken.prototype = Object.create(CSSParserToken.prototype); - - function OpenCurlyToken() { - this.value = "{";this.mirror = "}";return this; - } - OpenCurlyToken.prototype = Object.create(GroupingToken.prototype); - OpenCurlyToken.prototype.tokenType = "symbol"; - OpenCurlyToken.prototype.text = "{"; - - function CloseCurlyToken() { - this.value = "}";this.mirror = "{";return this; - } - CloseCurlyToken.prototype = Object.create(GroupingToken.prototype); - CloseCurlyToken.prototype.tokenType = "symbol"; - CloseCurlyToken.prototype.text = "}"; - - function OpenSquareToken() { - this.value = "[";this.mirror = "]";return this; - } - OpenSquareToken.prototype = Object.create(GroupingToken.prototype); - OpenSquareToken.prototype.tokenType = "symbol"; - OpenSquareToken.prototype.text = "["; - - function CloseSquareToken() { - this.value = "]";this.mirror = "[";return this; - } - CloseSquareToken.prototype = Object.create(GroupingToken.prototype); - CloseSquareToken.prototype.tokenType = "symbol"; - CloseSquareToken.prototype.text = "]"; - - function OpenParenToken() { - this.value = "(";this.mirror = ")";return this; - } - OpenParenToken.prototype = Object.create(GroupingToken.prototype); - OpenParenToken.prototype.tokenType = "symbol"; - OpenParenToken.prototype.text = "("; - - function CloseParenToken() { - this.value = ")";this.mirror = "(";return this; - } - CloseParenToken.prototype = Object.create(GroupingToken.prototype); - CloseParenToken.prototype.tokenType = "symbol"; - CloseParenToken.prototype.text = ")"; - - function IncludeMatchToken() { - return this; - } - IncludeMatchToken.prototype = Object.create(CSSParserToken.prototype); - IncludeMatchToken.prototype.tokenType = "includes"; - - function DashMatchToken() { - return this; - } - DashMatchToken.prototype = Object.create(CSSParserToken.prototype); - DashMatchToken.prototype.tokenType = "dashmatch"; - - function PrefixMatchToken() { - return this; - } - PrefixMatchToken.prototype = Object.create(CSSParserToken.prototype); - PrefixMatchToken.prototype.tokenType = "beginsmatch"; - - function SuffixMatchToken() { - return this; - } - SuffixMatchToken.prototype = Object.create(CSSParserToken.prototype); - SuffixMatchToken.prototype.tokenType = "endsmatch"; - - function SubstringMatchToken() { - return this; - } - SubstringMatchToken.prototype = Object.create(CSSParserToken.prototype); - SubstringMatchToken.prototype.tokenType = "containsmatch"; - - function ColumnToken() { - return this; - } - ColumnToken.prototype = Object.create(CSSParserToken.prototype); - ColumnToken.prototype.tokenType = "||"; - - function EOFToken() { - return this; - } - EOFToken.prototype = Object.create(CSSParserToken.prototype); - EOFToken.prototype.tokenType = "EOF"; - EOFToken.prototype.toSource = function () { - return ""; - }; - - function DelimToken(code) { - this.value = stringFromCode(code); - this.text = this.value; - return this; - } - DelimToken.prototype = Object.create(CSSParserToken.prototype); - DelimToken.prototype.tokenType = "symbol"; - DelimToken.prototype.toString = function () { - return "DELIM(" + this.value + ")"; - }; - DelimToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - return json; - }; - DelimToken.prototype.toSource = function () { - if (this.value == "\\") return "\\\n";else return this.value; - }; - - function StringValuedToken() { - throw "Abstract Base Class"; - } - StringValuedToken.prototype = Object.create(CSSParserToken.prototype); - StringValuedToken.prototype.ASCIIMatch = function (str) { - return this.value.toLowerCase() == str.toLowerCase(); - }; - StringValuedToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - return json; - }; - - function IdentToken(val) { - this.value = val; - this.text = val; - } - IdentToken.prototype = Object.create(StringValuedToken.prototype); - IdentToken.prototype.tokenType = "ident"; - IdentToken.prototype.toString = function () { - return "IDENT(" + this.value + ")"; - }; - IdentToken.prototype.toSource = function () { - return escapeIdent(this.value); - }; - - function FunctionToken(val) { - this.value = val; - this.text = val; - this.mirror = ")"; - } - FunctionToken.prototype = Object.create(StringValuedToken.prototype); - FunctionToken.prototype.tokenType = "function"; - FunctionToken.prototype.toString = function () { - return "FUNCTION(" + this.value + ")"; - }; - FunctionToken.prototype.toSource = function () { - return escapeIdent(this.value) + "("; - }; - - function AtKeywordToken(val) { - this.value = val; - this.text = val; - } - AtKeywordToken.prototype = Object.create(StringValuedToken.prototype); - AtKeywordToken.prototype.tokenType = "at"; - AtKeywordToken.prototype.toString = function () { - return "AT(" + this.value + ")"; - }; - AtKeywordToken.prototype.toSource = function () { - return "@" + escapeIdent(this.value); - }; - - function HashToken(val) { - this.value = val; - this.text = val; - this.type = "unrestricted"; - } - HashToken.prototype = Object.create(StringValuedToken.prototype); - HashToken.prototype.tokenType = "hash"; - HashToken.prototype.toString = function () { - return "HASH(" + this.value + ")"; - }; - HashToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - json.type = this.type; - return json; - }; - HashToken.prototype.toSource = function () { - if (this.type == "id") { - return "#" + escapeIdent(this.value); - } else { - return "#" + escapeHash(this.value); - } - }; - - function StringToken(val) { - this.value = val; - this.text = val; - } - StringToken.prototype = Object.create(StringValuedToken.prototype); - StringToken.prototype.tokenType = "string"; - StringToken.prototype.toString = function () { - return '"' + escapeString(this.value) + '"'; - }; - - function CommentToken(val) { - this.value = val; - } - CommentToken.prototype = Object.create(StringValuedToken.prototype); - CommentToken.prototype.tokenType = "comment"; - CommentToken.prototype.toString = function () { - return '/*' + this.value + '*/'; - }; - CommentToken.prototype.toSource = CommentToken.prototype.toString; - - function URLToken(val) { - this.value = val; - this.text = val; - } - URLToken.prototype = Object.create(StringValuedToken.prototype); - URLToken.prototype.tokenType = "url"; - URLToken.prototype.toString = function () { - return "URL(" + this.value + ")"; - }; - URLToken.prototype.toSource = function () { - return 'url("' + escapeString(this.value) + '")'; - }; - - function NumberToken() { - this.value = null; - this.type = "integer"; - this.repr = ""; - } - NumberToken.prototype = Object.create(CSSParserToken.prototype); - NumberToken.prototype.tokenType = "number"; - NumberToken.prototype.toString = function () { - if (this.type == "integer") return "INT(" + this.value + ")"; - return "NUMBER(" + this.value + ")"; - }; - NumberToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - json.type = this.type; - json.repr = this.repr; - return json; - }; - NumberToken.prototype.toSource = function () { - return this.repr; - }; - - function PercentageToken() { - this.value = null; - this.repr = ""; - } - PercentageToken.prototype = Object.create(CSSParserToken.prototype); - PercentageToken.prototype.tokenType = "percentage"; - PercentageToken.prototype.toString = function () { - return "PERCENTAGE(" + this.value + ")"; - }; - PercentageToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - json.repr = this.repr; - return json; - }; - PercentageToken.prototype.toSource = function () { - return this.repr + "%"; - }; - - function DimensionToken() { - this.value = null; - this.type = "integer"; - this.repr = ""; - this.unit = ""; - } - DimensionToken.prototype = Object.create(CSSParserToken.prototype); - DimensionToken.prototype.tokenType = "dimension"; - DimensionToken.prototype.toString = function () { - return "DIM(" + this.value + "," + this.unit + ")"; - }; - DimensionToken.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.value = this.value; - json.type = this.type; - json.repr = this.repr; - json.unit = this.unit; - return json; - }; - DimensionToken.prototype.toSource = function () { - var source = this.repr; - var unit = escapeIdent(this.unit); - if (unit[0].toLowerCase() == "e" && (unit[1] == "-" || between(unit.charCodeAt(1), 0x30, 0x39))) { - // Unit is ambiguous with scinot - // Remove the leading "e", replace with escape. - unit = "\\65 " + unit.slice(1, unit.length); - } - return source + unit; - }; - - function escapeIdent(string) { - string = '' + string; - var result = ''; - var firstcode = string.charCodeAt(0); - for (var i = 0; i < string.length; i++) { - var code = string.charCodeAt(i); - if (code === 0x0) { - throw new InvalidCharacterError('Invalid character: the input contains U+0000.'); - } - - if (between(code, 0x1, 0x1f) || code == 0x7f || i === 0 && between(code, 0x30, 0x39) || i == 1 && between(code, 0x30, 0x39) && firstcode == 0x2d) { - result += '\\' + code.toString(16) + ' '; - } else if (code >= 0x80 || code == 0x2d || code == 0x5f || between(code, 0x30, 0x39) || between(code, 0x41, 0x5a) || between(code, 0x61, 0x7a)) { - result += string[i]; - } else { - result += '\\' + string[i]; - } - } - return result; - } - - function escapeHash(string) { - // Escapes the contents of "unrestricted"-type hash tokens. - // Won't preserve the ID-ness of "id"-type hash tokens; - // use escapeIdent() for that. - string = '' + string; - var result = ''; - for (var i = 0; i < string.length; i++) { - var code = string.charCodeAt(i); - if (code === 0x0) { - throw new InvalidCharacterError('Invalid character: the input contains U+0000.'); - } - - if (code >= 0x80 || code == 0x2d || code == 0x5f || between(code, 0x30, 0x39) || between(code, 0x41, 0x5a) || between(code, 0x61, 0x7a)) { - result += string[i]; - } else { - result += '\\' + code.toString(16) + ' '; - } - } - return result; - } - - function escapeString(string) { - string = '' + string; - var result = ''; - for (var i = 0; i < string.length; i++) { - var code = string.charCodeAt(i); - - if (code === 0x0) { - throw new InvalidCharacterError('Invalid character: the input contains U+0000.'); - } - - if (between(code, 0x1, 0x1f) || code == 0x7f) { - result += '\\' + code.toString(16) + ' '; - } else if (code == 0x22 || code == 0x5c) { - result += '\\' + string[i]; - } else { - result += string[i]; - } - } - return result; - } - - // Exportation. - exports.tokenize = tokenize; - exports.IdentToken = IdentToken; - exports.FunctionToken = FunctionToken; - exports.AtKeywordToken = AtKeywordToken; - exports.HashToken = HashToken; - exports.StringToken = StringToken; - exports.BadStringToken = BadStringToken; - exports.URLToken = URLToken; - exports.BadURLToken = BadURLToken; - exports.DelimToken = DelimToken; - exports.NumberToken = NumberToken; - exports.PercentageToken = PercentageToken; - exports.DimensionToken = DimensionToken; - exports.IncludeMatchToken = IncludeMatchToken; - exports.DashMatchToken = DashMatchToken; - exports.PrefixMatchToken = PrefixMatchToken; - exports.SuffixMatchToken = SuffixMatchToken; - exports.SubstringMatchToken = SubstringMatchToken; - exports.ColumnToken = ColumnToken; - exports.WhitespaceToken = WhitespaceToken; - exports.CDOToken = CDOToken; - exports.CDCToken = CDCToken; - exports.ColonToken = ColonToken; - exports.SemicolonToken = SemicolonToken; - exports.CommaToken = CommaToken; - exports.OpenParenToken = OpenParenToken; - exports.CloseParenToken = CloseParenToken; - exports.OpenSquareToken = OpenSquareToken; - exports.CloseSquareToken = CloseSquareToken; - exports.OpenCurlyToken = OpenCurlyToken; - exports.CloseCurlyToken = CloseCurlyToken; - exports.EOFToken = EOFToken; - exports.CSSParserToken = CSSParserToken; - exports.GroupingToken = GroupingToken; - - function TokenStream(tokens) { - // Assume that tokens is a iterator. - this.tokens = tokens; - this.token = undefined; - this.stored = []; - } - TokenStream.prototype.consume = function (num) { - if (num === undefined) num = 1; - while (num-- > 0) { - if (this.stored.length > 0) { - this.token = this.stored.shift(); - } else { - var n = this.tokens.next(); - while (!n.done && n.value instanceof CommentToken) { - n = this.tokens.next(); - } - if (n.done) { - this.token = new EOFToken(); - break; - } - this.token = n.value; - } - } - //console.log(this.i, this.token); - return true; - }; - TokenStream.prototype.next = function () { - if (this.stored.length === 0) { - var n = this.tokens.next(); - while (!n.done && n.value instanceof CommentToken) { - n = this.tokens.next(); - } - if (n.done) return new EOFToken(); - this.stored.push(n.value); - } - return this.stored[0]; - }; - TokenStream.prototype.reconsume = function () { - this.stored.unshift(this.token); - }; - - function parseerror(s, msg) { - console.log("Parse error at token " + s.i + ": " + s.token + ".\n" + msg); - return true; - } - function donothing() { - return true; - } - - function consumeAListOfRules(s, topLevel) { - var rules = []; - var rule; - while (s.consume()) { - if (s.token instanceof WhitespaceToken) { - continue; - } else if (s.token instanceof EOFToken) { - return rules; - } else if (s.token instanceof CDOToken || s.token instanceof CDCToken) { - if (topLevel == "top-level") continue; - s.reconsume(); - if (rule = consumeAQualifiedRule(s)) rules.push(rule); - } else if (s.token instanceof AtKeywordToken) { - s.reconsume(); - if (rule = consumeAnAtRule(s)) rules.push(rule); - } else { - s.reconsume(); - if (rule = consumeAQualifiedRule(s)) rules.push(rule); - } - } - } - - function consumeAnAtRule(s) { - s.consume(); - var rule = new AtRule(s.token.value); - while (s.consume()) { - if (s.token instanceof SemicolonToken || s.token instanceof EOFToken) { - return rule; - } else if (s.token instanceof OpenCurlyToken) { - rule.value = consumeASimpleBlock(s); - return rule; - } else { - s.reconsume(); - rule.prelude.push(consumeAComponentValue(s)); - } - } - } - - function consumeAQualifiedRule(s) { - var rule = new QualifiedRule(); - while (s.consume()) { - if (s.token instanceof EOFToken) { - parseerror(s, "Hit EOF when trying to parse the prelude of a qualified rule."); - return; - } else if (s.token instanceof OpenCurlyToken) { - rule.value = consumeASimpleBlock(s); - return rule; - } else { - s.reconsume(); - rule.prelude.push(consumeAComponentValue(s)); - } - } - } - - function consumeAListOfDeclarations(s) { - var decls = []; - while (s.consume()) { - if (s.token instanceof WhitespaceToken || s.token instanceof SemicolonToken) { - donothing(); - } else if (s.token instanceof EOFToken) { - return decls; - } else if (s.token instanceof AtKeywordToken) { - s.reconsume(); - decls.push(consumeAnAtRule(s)); - } else if (s.token instanceof IdentToken) { - var temp = [s.token]; - while (!(s.next() instanceof SemicolonToken || s.next() instanceof EOFToken)) { - temp.push(consumeAComponentValue(s)); - }var decl; - if (decl = consumeADeclaration(new TokenStream(temp))) decls.push(decl); - } else { - parseerror(s); - s.reconsume(); - while (!(s.next() instanceof SemicolonToken || s.next() instanceof EOFToken)) { - consumeAComponentValue(s); - } - } - } - } - - function consumeADeclaration(s) { - // Assumes that the next input token will be an ident token. - s.consume(); - var decl = new Declaration(s.token.value); - while (s.next() instanceof WhitespaceToken) { - s.consume(); - }if (!(s.next() instanceof ColonToken)) { - parseerror(s); - return; - } else { - s.consume(); - } - while (!(s.next() instanceof EOFToken)) { - decl.value.push(consumeAComponentValue(s)); - } - var foundImportant = false; - for (var i = decl.value.length - 1; i >= 0; i--) { - if (decl.value[i] instanceof WhitespaceToken) { - continue; - } else if (decl.value[i] instanceof IdentToken && decl.value[i].ASCIIMatch("important")) { - foundImportant = true; - } else if (foundImportant && decl.value[i] instanceof DelimToken && decl.value[i].value == "!") { - decl.value.splice(i, decl.value.length); - decl.important = true; - break; - } else { - break; - } - } - return decl; - } - - function consumeAComponentValue(s) { - s.consume(); - if (s.token instanceof OpenCurlyToken || s.token instanceof OpenSquareToken || s.token instanceof OpenParenToken) return consumeASimpleBlock(s); - if (s.token instanceof FunctionToken) return consumeAFunction(s); - return s.token; - } - - function consumeASimpleBlock(s) { - var mirror = s.token.mirror; - var block = new SimpleBlock(s.token.value); - block.startToken = s.token; - while (s.consume()) { - if (s.token instanceof EOFToken || s.token instanceof GroupingToken && s.token.value == mirror) return block;else { - s.reconsume(); - block.value.push(consumeAComponentValue(s)); - } - } - } - - function consumeAFunction(s) { - var func = new Func(s.token.value); - while (s.consume()) { - if (s.token instanceof EOFToken || s.token instanceof CloseParenToken) return func;else { - s.reconsume(); - func.value.push(consumeAComponentValue(s)); - } - } - } - - function normalizeInput(input) { - if (typeof input == "string") return new TokenStream(tokenize(input)); - if (input instanceof TokenStream) return input; - if (typeof input.next == "function") return new TokenStream(input); - if (input.length !== undefined) return new TokenStream(input[Symbol.iterator]());else throw SyntaxError(input); - } - - function parseAStylesheet(s) { - s = normalizeInput(s); - var sheet = new Stylesheet(); - sheet.value = consumeAListOfRules(s, "top-level"); - return sheet; - } - - function parseAListOfRules(s) { - s = normalizeInput(s); - return consumeAListOfRules(s); - } - - function parseARule(s) { - s = normalizeInput(s); - while (s.next() instanceof WhitespaceToken) { - s.consume(); - }if (s.next() instanceof EOFToken) throw SyntaxError(); - var rule; - var startToken = s.next(); - if (startToken instanceof AtKeywordToken) { - rule = consumeAnAtRule(s); - } else { - rule = consumeAQualifiedRule(s); - if (!rule) throw SyntaxError(); - } - rule.startToken = startToken; - rule.endToken = s.token; - return rule; - } - - function parseADeclaration(s) { - s = normalizeInput(s); - while (s.next() instanceof WhitespaceToken) { - s.consume(); - }if (!(s.next() instanceof IdentToken)) throw SyntaxError(); - var decl = consumeADeclaration(s); - if (decl) return decl;else throw SyntaxError(); - } - - function parseAListOfDeclarations(s) { - s = normalizeInput(s); - return consumeAListOfDeclarations(s); - } - - function parseAComponentValue(s) { - s = normalizeInput(s); - while (s.next() instanceof WhitespaceToken) { - s.consume(); - }if (s.next() instanceof EOFToken) throw SyntaxError(); - var val = consumeAComponentValue(s); - if (!val) throw SyntaxError(); - while (s.next() instanceof WhitespaceToken) { - s.consume(); - }if (s.next() instanceof EOFToken) return val; - throw SyntaxError(); - } - - function parseAListOfComponentValues(s) { - s = normalizeInput(s); - var vals = []; - while (true) { - var val = consumeAComponentValue(s); - if (val instanceof EOFToken) return vals;else vals.push(val); - } - } - - function parseACommaSeparatedListOfComponentValues(s) { - s = normalizeInput(s); - var listOfCVLs = []; - while (true) { - var vals = []; - while (true) { - var val = consumeAComponentValue(s); - if (val instanceof EOFToken) { - listOfCVLs.push(vals); - return listOfCVLs; - } else if (val instanceof CommaToken) { - listOfCVLs.push(vals); - break; - } else { - vals.push(val); - } - } - } - } - - function CSSParserRule() { - throw "Abstract Base Class"; - } - CSSParserRule.prototype.toString = function (indent) { - return JSON.stringify(this, null, indent); - }; - CSSParserRule.prototype.toJSON = function () { - return { type: this.type, value: this.value }; - }; - - function Stylesheet() { - this.value = []; - return this; - } - Stylesheet.prototype = Object.create(CSSParserRule.prototype); - Stylesheet.prototype.type = "STYLESHEET"; - - function AtRule(name) { - this.name = name; - this.prelude = []; - this.value = null; - return this; - } - AtRule.prototype = Object.create(CSSParserRule.prototype); - AtRule.prototype.type = "AT-RULE"; - AtRule.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.name = this.name; - json.prelude = this.prelude; - return json; - }; - - function QualifiedRule() { - this.prelude = []; - this.value = []; - return this; - } - QualifiedRule.prototype = Object.create(CSSParserRule.prototype); - QualifiedRule.prototype.type = "QUALIFIED-RULE"; - QualifiedRule.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.prelude = this.prelude; - return json; - }; - - function Declaration(name) { - this.name = name; - this.value = []; - this.important = false; - return this; - } - Declaration.prototype = Object.create(CSSParserRule.prototype); - Declaration.prototype.type = "DECLARATION"; - Declaration.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.name = this.name; - json.important = this.important; - return json; - }; - - function SimpleBlock(type) { - this.name = type; - this.value = []; - return this; - } - SimpleBlock.prototype = Object.create(CSSParserRule.prototype); - SimpleBlock.prototype.type = "BLOCK"; - SimpleBlock.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.name = this.name; - return json; - }; - - function Func(name) { - this.name = name; - this.value = []; - return this; - } - Func.prototype = Object.create(CSSParserRule.prototype); - Func.prototype.type = "FUNCTION"; - Func.prototype.toJSON = function () { - var json = this.constructor.prototype.constructor.prototype.toJSON.call(this); - json.name = this.name; - return json; - }; - - function CSSLexer(text) { - this.stream = tokenize(text, { - loc: true, - offsets: true, - keepComments: true - }); - this.lineNumber = 0; - this.columnNumber = 0; - return this; - } - - CSSLexer.prototype.performEOFFixup = function (input, preserveBackslash) { - // Just lie for now. - return ""; - }; - - CSSLexer.prototype.nextToken = function () { - if (!this.stream) { - return null; - } - var v = this.stream.next(); - if (v.done || v.value.tokenType === "EOF") { - this.stream = null; - return null; - } - this.lineNumber = v.value.loc.start.line; - this.columnNumber = v.value.loc.start.column; - return v.value; - }; - - // Exportation. - exports.CSSParserRule = CSSParserRule; - exports.Stylesheet = Stylesheet; - exports.AtRule = AtRule; - exports.QualifiedRule = QualifiedRule; - exports.Declaration = Declaration; - exports.SimpleBlock = SimpleBlock; - exports.Func = Func; - exports.parseAStylesheet = parseAStylesheet; - exports.parseAListOfRules = parseAListOfRules; - exports.parseARule = parseARule; - exports.parseADeclaration = parseADeclaration; - exports.parseAListOfDeclarations = parseAListOfDeclarations; - exports.parseAComponentValue = parseAComponentValue; - exports.parseAListOfComponentValues = parseAListOfComponentValues; - exports.parseACommaSeparatedListOfComponentValues = parseACommaSeparatedListOfComponentValues; - exports.CSSLexer = CSSLexer; - }); - -/***/ }, -/* 837 */ -/***/ function(module, exports) { - - "use strict"; - - // auto-generated from nsColorNameList.h - var cssColors = { - aliceblue: [240, 248, 255], - antiquewhite: [250, 235, 215], - aqua: [0, 255, 255], - aquamarine: [127, 255, 212], - azure: [240, 255, 255], - beige: [245, 245, 220], - bisque: [255, 228, 196], - black: [0, 0, 0], - blanchedalmond: [255, 235, 205], - blue: [0, 0, 255], - blueviolet: [138, 43, 226], - brown: [165, 42, 42], - burlywood: [222, 184, 135], - cadetblue: [95, 158, 160], - chartreuse: [127, 255, 0], - chocolate: [210, 105, 30], - coral: [255, 127, 80], - cornflowerblue: [100, 149, 237], - cornsilk: [255, 248, 220], - crimson: [220, 20, 60], - cyan: [0, 255, 255], - darkblue: [0, 0, 139], - darkcyan: [0, 139, 139], - darkgoldenrod: [184, 134, 11], - darkgray: [169, 169, 169], - darkgreen: [0, 100, 0], - darkgrey: [169, 169, 169], - darkkhaki: [189, 183, 107], - darkmagenta: [139, 0, 139], - darkolivegreen: [85, 107, 47], - darkorange: [255, 140, 0], - darkorchid: [153, 50, 204], - darkred: [139, 0, 0], - darksalmon: [233, 150, 122], - darkseagreen: [143, 188, 143], - darkslateblue: [72, 61, 139], - darkslategray: [47, 79, 79], - darkslategrey: [47, 79, 79], - darkturquoise: [0, 206, 209], - darkviolet: [148, 0, 211], - deeppink: [255, 20, 147], - deepskyblue: [0, 191, 255], - dimgray: [105, 105, 105], - dimgrey: [105, 105, 105], - dodgerblue: [30, 144, 255], - firebrick: [178, 34, 34], - floralwhite: [255, 250, 240], - forestgreen: [34, 139, 34], - fuchsia: [255, 0, 255], - gainsboro: [220, 220, 220], - ghostwhite: [248, 248, 255], - gold: [255, 215, 0], - goldenrod: [218, 165, 32], - gray: [128, 128, 128], - grey: [128, 128, 128], - green: [0, 128, 0], - greenyellow: [173, 255, 47], - honeydew: [240, 255, 240], - hotpink: [255, 105, 180], - indianred: [205, 92, 92], - indigo: [75, 0, 130], - ivory: [255, 255, 240], - khaki: [240, 230, 140], - lavender: [230, 230, 250], - lavenderblush: [255, 240, 245], - lawngreen: [124, 252, 0], - lemonchiffon: [255, 250, 205], - lightblue: [173, 216, 230], - lightcoral: [240, 128, 128], - lightcyan: [224, 255, 255], - lightgoldenrodyellow: [250, 250, 210], - lightgray: [211, 211, 211], - lightgreen: [144, 238, 144], - lightgrey: [211, 211, 211], - lightpink: [255, 182, 193], - lightsalmon: [255, 160, 122], - lightseagreen: [32, 178, 170], - lightskyblue: [135, 206, 250], - lightslategray: [119, 136, 153], - lightslategrey: [119, 136, 153], - lightsteelblue: [176, 196, 222], - lightyellow: [255, 255, 224], - lime: [0, 255, 0], - limegreen: [50, 205, 50], - linen: [250, 240, 230], - magenta: [255, 0, 255], - maroon: [128, 0, 0], - mediumaquamarine: [102, 205, 170], - mediumblue: [0, 0, 205], - mediumorchid: [186, 85, 211], - mediumpurple: [147, 112, 219], - mediumseagreen: [60, 179, 113], - mediumslateblue: [123, 104, 238], - mediumspringgreen: [0, 250, 154], - mediumturquoise: [72, 209, 204], - mediumvioletred: [199, 21, 133], - midnightblue: [25, 25, 112], - mintcream: [245, 255, 250], - mistyrose: [255, 228, 225], - moccasin: [255, 228, 181], - navajowhite: [255, 222, 173], - navy: [0, 0, 128], - oldlace: [253, 245, 230], - olive: [128, 128, 0], - olivedrab: [107, 142, 35], - orange: [255, 165, 0], - orangered: [255, 69, 0], - orchid: [218, 112, 214], - palegoldenrod: [238, 232, 170], - palegreen: [152, 251, 152], - paleturquoise: [175, 238, 238], - palevioletred: [219, 112, 147], - papayawhip: [255, 239, 213], - peachpuff: [255, 218, 185], - peru: [205, 133, 63], - pink: [255, 192, 203], - plum: [221, 160, 221], - powderblue: [176, 224, 230], - purple: [128, 0, 128], - rebeccapurple: [102, 51, 153], - red: [255, 0, 0], - rosybrown: [188, 143, 143], - royalblue: [65, 105, 225], - saddlebrown: [139, 69, 19], - salmon: [250, 128, 114], - sandybrown: [244, 164, 96], - seagreen: [46, 139, 87], - seashell: [255, 245, 238], - sienna: [160, 82, 45], - silver: [192, 192, 192], - skyblue: [135, 206, 235], - slateblue: [106, 90, 205], - slategray: [112, 128, 144], - slategrey: [112, 128, 144], - snow: [255, 250, 250], - springgreen: [0, 255, 127], - steelblue: [70, 130, 180], - tan: [210, 180, 140], - teal: [0, 128, 128], - thistle: [216, 191, 216], - tomato: [255, 99, 71], - turquoise: [64, 224, 208], - violet: [238, 130, 238], - wheat: [245, 222, 179], - white: [255, 255, 255], - whitesmoke: [245, 245, 245], - yellow: [255, 255, 0], - yellowgreen: [154, 205, 50] - }; - module.exports = { cssColors }; - -/***/ }, -/* 838 */ -/***/ function(module, exports) { - - "use strict"; - - // auto-generated by means you would rather not know - var cssProperties = { - "-moz-appearance": { - inherited: false, - supports: 0, - values: ["-moz-gtk-info-bar", "-moz-mac-disclosure-button-closed", "-moz-mac-disclosure-button-open", "-moz-mac-fullscreen-button", "-moz-mac-help-button", "-moz-mac-vibrancy-dark", "-moz-mac-vibrancy-light", "-moz-win-borderless-glass", "-moz-win-browsertabbar-toolbox", "-moz-win-communications-toolbox", "-moz-win-exclude-glass", "-moz-win-glass", "-moz-win-media-toolbox", "-moz-window-button-box", "-moz-window-button-box-maximized", "-moz-window-button-close", "-moz-window-button-maximize", "-moz-window-button-minimize", "-moz-window-button-restore", "-moz-window-frame-bottom", "-moz-window-frame-left", "-moz-window-frame-right", "-moz-window-titlebar", "-moz-window-titlebar-maximized", "button", "button-arrow-down", "button-arrow-next", "button-arrow-previous", "button-arrow-up", "button-bevel", "button-focus", "caret", "checkbox", "checkbox-container", "checkbox-label", "checkmenuitem", "dialog", "dualbutton", "groupbox", "inherit", "initial", "listbox", "listitem", "menuarrow", "menubar", "menucheckbox", "menuimage", "menuitem", "menuitemtext", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "menupopup", "menuradio", "menuseparator", "meterbar", "meterchunk", "none", "number-input", "progressbar", "progressbar-vertical", "progresschunk", "progresschunk-vertical", "radio", "radio-container", "radio-label", "radiomenuitem", "range", "range-thumb", "resizer", "resizerpanel", "scale-horizontal", "scale-vertical", "scalethumb-horizontal", "scalethumb-vertical", "scalethumbend", "scalethumbstart", "scalethumbtick", "scrollbar", "scrollbar-small", "scrollbarbutton-down", "scrollbarbutton-left", "scrollbarbutton-right", "scrollbarbutton-up", "scrollbarthumb-horizontal", "scrollbarthumb-vertical", "scrollbartrack-horizontal", "scrollbartrack-vertical", "searchfield", "separator", "spinner", "spinner-downbutton", "spinner-textfield", "spinner-upbutton", "splitter", "statusbar", "statusbarpanel", "tab", "tab-scroll-arrow-back", "tab-scroll-arrow-forward", "tabpanel", "tabpanels", "textfield", "textfield-multiline", "toolbar", "toolbarbutton", "toolbarbutton-dropdown", "toolbargripper", "toolbox", "tooltip", "treeheader", "treeheadercell", "treeheadersortarrow", "treeitem", "treeline", "treetwisty", "treetwistyopen", "treeview", "unset", "window"] - }, - "-moz-outline-radius-topleft": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-outline-radius-topright": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-outline-radius-bottomright": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-outline-radius-bottomleft": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-tab-size": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "animation-delay": { - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "animation-direction": { - inherited: false, - supports: 0, - values: ["alternate", "alternate-reverse", "inherit", "initial", "normal", "reverse", "unset"] - }, - "animation-duration": { - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "animation-fill-mode": { - inherited: false, - supports: 0, - values: ["backwards", "both", "forwards", "inherit", "initial", "none", "unset"] - }, - "animation-iteration-count": { - inherited: false, - supports: 1024, - values: ["infinite", "inherit", "initial", "unset"] - }, - "animation-name": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "none", "unset"] - }, - "animation-play-state": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "paused", "running", "unset"] - }, - "animation-timing-function": { - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "background-attachment": { - inherited: false, - supports: 0, - values: ["fixed", "inherit", "initial", "local", "scroll", "unset"] - }, - "background-clip": { - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "background-color": { - inherited: false, - supports: 4, - values: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "background-image": { - inherited: false, - supports: 648, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "background-blend-mode": { - inherited: false, - supports: 0, - values: ["color", "color-burn", "color-dodge", "darken", "difference", "exclusion", "hard-light", "hue", "inherit", "initial", "lighten", "luminosity", "multiply", "normal", "overlay", "saturation", "screen", "soft-light", "unset"] - }, - "background-origin": { - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "background-position": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "background-repeat": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "no-repeat", "repeat", "repeat-x", "repeat-y", "unset"] - }, - "background-size": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-binding": { - inherited: false, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "block-size": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "border-block-end-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-block-end-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-block-end-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-block-start-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-block-start-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-block-start-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-bottom-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-bottom-colors": { - inherited: false, - supports: 4, - values: ["inherit", "initial", "unset"] - }, - "border-bottom-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-bottom-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-collapse": { - inherited: true, - supports: 0, - values: ["collapse", "inherit", "initial", "separate", "unset"] - }, - "border-image-source": { - inherited: false, - supports: 648, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "border-image-slice": { - inherited: false, - supports: 1026, - values: ["inherit", "initial", "unset"] - }, - "border-image-width": { - inherited: false, - supports: 1027, - values: ["inherit", "initial", "unset"] - }, - "border-image-outset": { - inherited: false, - supports: 1025, - values: ["inherit", "initial", "unset"] - }, - "border-image-repeat": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "border-inline-end-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-inline-end-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-inline-end-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-inline-start-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-inline-start-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-inline-start-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-left-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-left-colors": { - inherited: false, - supports: 4, - values: ["inherit", "initial", "unset"] - }, - "border-left-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-left-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-right-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-right-colors": { - inherited: false, - supports: 4, - values: ["inherit", "initial", "unset"] - }, - "border-right-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-right-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-spacing": { - inherited: true, - supports: 1, - values: ["inherit", "initial", "unset"] - }, - "border-top-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-top-colors": { - inherited: false, - supports: 4, - values: ["inherit", "initial", "unset"] - }, - "border-top-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-top-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-top-left-radius": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "border-top-right-radius": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "border-bottom-right-radius": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "border-bottom-left-radius": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "bottom": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "box-decoration-break": { - inherited: false, - supports: 0, - values: ["clone", "inherit", "initial", "slice", "unset"] - }, - "box-shadow": { - inherited: false, - supports: 5, - values: ["inherit", "initial", "unset"] - }, - "box-sizing": { - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "caption-side": { - inherited: true, - supports: 0, - values: ["bottom", "bottom-outside", "inherit", "initial", "left", "right", "top", "top-outside", "unset"] - }, - "clear": { - inherited: false, - supports: 0, - values: ["both", "inherit", "initial", "inline-end", "inline-start", "left", "none", "right", "unset"] - }, - "clip": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "color": { - inherited: true, - supports: 4, - values: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-column-count": { - inherited: false, - supports: 1024, - values: ["auto", "inherit", "initial", "unset"] - }, - "-moz-column-fill": { - inherited: false, - supports: 0, - values: ["auto", "balance", "inherit", "initial", "unset"] - }, - "-moz-column-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "-moz-column-gap": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "normal", "unset"] - }, - "-moz-column-rule-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-column-rule-style": { - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "-moz-column-rule-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "contain": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "layout", "none", "paint", "strict", "style", "unset"] - }, - "content": { - inherited: false, - supports: 8, - values: ["inherit", "initial", "unset"] - }, - "-moz-control-character-visibility": { - inherited: true, - supports: 0, - values: ["hidden", "inherit", "initial", "unset", "visible"] - }, - "counter-increment": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "counter-reset": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "cursor": { - inherited: true, - supports: 8, - values: ["inherit", "initial", "unset"] - }, - "direction": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "ltr", "rtl", "unset"] - }, - "display": { - inherited: false, - supports: 0, - values: ["-moz-box", "-moz-deck", "-moz-grid", "-moz-grid-group", "-moz-grid-line", "-moz-groupbox", "-moz-inline-box", "-moz-inline-grid", "-moz-inline-stack", "-moz-popup", "-moz-stack", "block", "contents", "flex", "grid", "inherit", "initial", "inline", "inline-block", "inline-flex", "inline-grid", "inline-table", "list-item", "none", "ruby", "ruby-base", "ruby-base-container", "ruby-text", "ruby-text-container", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "unset"] - }, - "empty-cells": { - inherited: true, - supports: 0, - values: ["hide", "inherit", "initial", "show", "unset"] - }, - "align-content": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "align-items": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "align-self": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "flex-basis": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "flex-direction": { - inherited: false, - supports: 0, - values: ["column", "column-reverse", "inherit", "initial", "row", "row-reverse", "unset"] - }, - "flex-grow": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "flex-shrink": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "flex-wrap": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "nowrap", "unset", "wrap", "wrap-reverse"] - }, - "order": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "justify-content": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "justify-items": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "justify-self": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "float": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "inline-end", "inline-start", "left", "none", "right", "unset"] - }, - "-moz-float-edge": { - inherited: false, - supports: 0, - values: ["content-box", "inherit", "initial", "margin-box", "unset"] - }, - "font-family": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-feature-settings": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-kerning": { - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "none", "normal", "unset"] - }, - "font-language-override": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "normal", "unset"] - }, - "font-size": { - inherited: true, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "large", "larger", "medium", "small", "smaller", "unset", "x-large", "x-small", "xx-large", "xx-small"] - }, - "font-size-adjust": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "none", "unset"] - }, - "font-stretch": { - inherited: true, - supports: 0, - values: ["condensed", "expanded", "extra-condensed", "extra-expanded", "inherit", "initial", "normal", "semi-condensed", "semi-expanded", "ultra-condensed", "ultra-expanded", "unset"] - }, - "font-style": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "italic", "normal", "oblique", "unset"] - }, - "font-synthesis": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-variant-alternates": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-variant-caps": { - inherited: true, - supports: 0, - values: ["all-petite-caps", "all-small-caps", "inherit", "initial", "normal", "petite-caps", "small-caps", "titling-caps", "unicase", "unset"] - }, - "font-variant-east-asian": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-variant-ligatures": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-variant-numeric": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "font-variant-position": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "normal", "sub", "super", "unset"] - }, - "font-weight": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-moz-force-broken-image-icon": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-auto-flow": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "grid-auto-columns": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "grid-auto-rows": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "grid-template-areas": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "grid-template-columns": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "grid-template-rows": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "grid-column-start": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-column-end": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-row-start": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-row-end": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-column-gap": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "grid-row-gap": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "height": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "image-orientation": { - inherited: true, - supports: 16, - values: ["inherit", "initial", "unset"] - }, - "-moz-image-region": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "ime-mode": { - inherited: false, - supports: 0, - values: ["active", "auto", "disabled", "inactive", "inherit", "initial", "normal", "unset"] - }, - "inline-size": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "left": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "letter-spacing": { - inherited: true, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "normal", "unset"] - }, - "line-height": { - inherited: true, - supports: 1027, - values: ["-moz-block-height", "inherit", "initial", "normal", "unset"] - }, - "list-style-image": { - inherited: true, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "list-style-position": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "inside", "outside", "unset"] - }, - "list-style-type": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "margin-block-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-block-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-bottom": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-inline-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-inline-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-left": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-right": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "margin-top": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "marker-offset": { - inherited: false, - supports: 1, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "max-block-size": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "none", "unset"] - }, - "max-height": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "calc", "inherit", "initial", "none", "unset"] - }, - "max-inline-size": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "calc", "inherit", "initial", "none", "unset"] - }, - "max-width": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "calc", "inherit", "initial", "none", "unset"] - }, - "min-height": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "min-block-size": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "min-inline-size": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "min-width": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "mix-blend-mode": { - inherited: false, - supports: 0, - values: ["color", "color-burn", "color-dodge", "darken", "difference", "exclusion", "hard-light", "hue", "inherit", "initial", "lighten", "luminosity", "multiply", "normal", "overlay", "saturation", "screen", "soft-light", "unset"] - }, - "isolation": { - inherited: false, - supports: 0, - values: ["auto", "inherit", "initial", "isolate", "unset"] - }, - "object-fit": { - inherited: false, - supports: 0, - values: ["contain", "cover", "fill", "inherit", "initial", "none", "scale-down", "unset"] - }, - "object-position": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "offset-block-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "offset-block-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "offset-inline-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "offset-inline-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "opacity": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-moz-orient": { - inherited: false, - supports: 0, - values: ["block", "horizontal", "inherit", "initial", "inline", "unset", "vertical"] - }, - "outline-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "outline-style": { - inherited: false, - supports: 0, - values: ["auto", "dashed", "dotted", "double", "groove", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "outline-width": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "outline-offset": { - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "overflow-x": { - inherited: false, - supports: 0, - values: ["-moz-hidden-unscrollable", "auto", "hidden", "inherit", "initial", "scroll", "unset", "visible"] - }, - "overflow-y": { - inherited: false, - supports: 0, - values: ["-moz-hidden-unscrollable", "auto", "hidden", "inherit", "initial", "scroll", "unset", "visible"] - }, - "padding-block-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-block-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-bottom": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-inline-end": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-inline-start": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-left": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-right": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "padding-top": { - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "page-break-after": { - inherited: false, - supports: 0, - values: ["always", "auto", "avoid", "inherit", "initial", "left", "right", "unset"] - }, - "page-break-before": { - inherited: false, - supports: 0, - values: ["always", "auto", "avoid", "inherit", "initial", "left", "right", "unset"] - }, - "page-break-inside": { - inherited: false, - supports: 0, - values: ["auto", "avoid", "inherit", "initial", "unset"] - }, - "paint-order": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "pointer-events": { - inherited: true, - supports: 0, - values: ["all", "auto", "fill", "inherit", "initial", "none", "painted", "stroke", "unset", "visible", "visiblefill", "visiblepainted", "visiblestroke"] - }, - "position": { - inherited: false, - supports: 0, - values: ["absolute", "fixed", "inherit", "initial", "relative", "static", "sticky", "unset"] - }, - "quotes": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "resize": { - inherited: false, - supports: 0, - values: ["both", "horizontal", "inherit", "initial", "none", "unset", "vertical"] - }, - "right": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "ruby-align": { - inherited: true, - supports: 0, - values: ["center", "inherit", "initial", "space-around", "space-between", "start", "unset"] - }, - "ruby-position": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "over", "under", "unset"] - }, - "scroll-behavior": { - inherited: false, - supports: 0, - values: ["auto", "inherit", "initial", "smooth", "unset"] - }, - "scroll-snap-coordinate": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "scroll-snap-destination": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "scroll-snap-points-x": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "scroll-snap-points-y": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "scroll-snap-type-x": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "mandatory", "none", "proximity", "unset"] - }, - "scroll-snap-type-y": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "mandatory", "none", "proximity", "unset"] - }, - "table-layout": { - inherited: false, - supports: 0, - values: ["auto", "fixed", "inherit", "initial", "unset"] - }, - "text-align": { - inherited: true, - supports: 0, - values: ["-moz-center", "-moz-left", "-moz-right", "center", "end", "inherit", "initial", "justify", "left", "right", "start", "unset"] - }, - "-moz-text-align-last": { - inherited: true, - supports: 0, - values: ["auto", "center", "end", "inherit", "initial", "justify", "left", "right", "start", "unset"] - }, - "text-decoration-color": { - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "text-decoration-line": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "text-decoration-style": { - inherited: false, - supports: 0, - values: ["-moz-none", "dashed", "dotted", "double", "inherit", "initial", "solid", "unset", "wavy"] - }, - "text-indent": { - inherited: true, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "text-orientation": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "mixed", "sideways", "sideways-right", "unset", "upright"] - }, - "text-overflow": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "text-shadow": { - inherited: true, - supports: 5, - values: ["inherit", "initial", "unset"] - }, - "-moz-text-size-adjust": { - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "none", "unset"] - }, - "text-transform": { - inherited: true, - supports: 0, - values: ["capitalize", "full-width", "inherit", "initial", "lowercase", "none", "unset", "uppercase"] - }, - "transform": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "transform-box": { - inherited: false, - supports: 0, - values: ["border-box", "fill-box", "inherit", "initial", "unset", "view-box"] - }, - "transform-origin": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "perspective-origin": { - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "perspective": { - inherited: false, - supports: 1, - values: ["inherit", "initial", "none", "unset"] - }, - "transform-style": { - inherited: false, - supports: 0, - values: ["flat", "inherit", "initial", "preserve-3d", "unset"] - }, - "backface-visibility": { - inherited: false, - supports: 0, - values: ["hidden", "inherit", "initial", "unset", "visible"] - }, - "top": { - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "transition-delay": { - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "transition-duration": { - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "transition-property": { - inherited: false, - supports: 0, - values: ["all", "inherit", "initial", "none", "unset"] - }, - "transition-timing-function": { - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "unicode-bidi": { - inherited: false, - supports: 0, - values: ["-moz-isolate", "-moz-isolate-override", "-moz-plaintext", "bidi-override", "embed", "inherit", "initial", "normal", "unset"] - }, - "-moz-user-focus": { - inherited: true, - supports: 0, - values: ["ignore", "inherit", "initial", "none", "normal", "select-after", "select-all", "select-before", "select-menu", "select-same", "unset"] - }, - "-moz-user-input": { - inherited: true, - supports: 0, - values: ["auto", "disabled", "enabled", "inherit", "initial", "none", "unset"] - }, - "-moz-user-modify": { - inherited: true, - supports: 0, - values: ["inherit", "initial", "read-only", "read-write", "unset", "write-only"] - }, - "-moz-user-select": { - inherited: false, - supports: 0, - values: ["-moz-all", "-moz-none", "-moz-text", "all", "auto", "element", "elements", "inherit", "initial", "none", "text", "toggle", "tri-state", "unset"] - }, - "vertical-align": { - inherited: false, - supports: 3, - values: ["-moz-calc", "-moz-middle-with-baseline", "baseline", "bottom", "calc", "inherit", "initial", "middle", "sub", "super", "text-bottom", "text-top", "top", "unset"] - }, - "visibility": { - inherited: true, - supports: 0, - values: ["collapse", "hidden", "inherit", "initial", "unset", "visible"] - }, - "white-space": { - inherited: true, - supports: 0, - values: ["-moz-pre-space", "inherit", "initial", "normal", "nowrap", "pre", "pre-line", "pre-wrap", "unset"] - }, - "width": { - inherited: false, - supports: 3, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "-moz-window-dragging": { - inherited: true, - supports: 0, - values: ["drag", "inherit", "initial", "no-drag", "unset"] - }, - "word-break": { - inherited: true, - supports: 0, - values: ["break-all", "inherit", "initial", "keep-all", "normal", "unset"] - }, - "word-spacing": { - inherited: true, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "normal", "unset"] - }, - "word-wrap": { - inherited: true, - supports: 0, - values: ["break-word", "inherit", "initial", "normal", "unset"] - }, - "hyphens": { - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "manual", "none", "unset"] - }, - "writing-mode": { - inherited: true, - supports: 0, - values: ["horizontal-tb", "inherit", "initial", "lr", "lr-tb", "rl", "rl-tb", "sideways-lr", "sideways-rl", "tb", "tb-rl", "unset", "vertical-lr", "vertical-rl"] - }, - "z-index": { - inherited: false, - supports: 1024, - values: ["auto", "inherit", "initial", "unset"] - }, - "-moz-box-align": { - inherited: false, - supports: 0, - values: ["baseline", "center", "end", "inherit", "initial", "start", "stretch", "unset"] - }, - "-moz-box-direction": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "normal", "reverse", "unset"] - }, - "-moz-box-flex": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-moz-box-orient": { - inherited: false, - supports: 0, - values: ["block-axis", "horizontal", "inherit", "initial", "inline-axis", "unset", "vertical"] - }, - "-moz-box-pack": { - inherited: false, - supports: 0, - values: ["center", "end", "inherit", "initial", "justify", "start", "unset"] - }, - "-moz-box-ordinal-group": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-moz-stack-sizing": { - inherited: false, - supports: 0, - values: ["ignore", "inherit", "initial", "stretch-to-fit", "unset"] - }, - "clip-path": { - inherited: false, - supports: 8, - values: ["inherit", "initial", "unset"] - }, - "clip-rule": { - inherited: true, - supports: 0, - values: ["evenodd", "inherit", "initial", "nonzero", "unset"] - }, - "color-interpolation": { - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "linearrgb", "srgb", "unset"] - }, - "color-interpolation-filters": { - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "linearrgb", "srgb", "unset"] - }, - "dominant-baseline": { - inherited: false, - supports: 0, - values: ["alphabetic", "auto", "central", "hanging", "ideographic", "inherit", "initial", "mathematical", "middle", "no-change", "reset-size", "text-after-edge", "text-before-edge", "unset", "use-script"] - }, - "fill": { - inherited: true, - supports: 12, - values: ["inherit", "initial", "unset"] - }, - "fill-opacity": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "fill-rule": { - inherited: true, - supports: 0, - values: ["evenodd", "inherit", "initial", "nonzero", "unset"] - }, - "filter": { - inherited: false, - supports: 8, - values: ["inherit", "initial", "unset"] - }, - "flood-color": { - inherited: false, - supports: 4, - values: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "flood-opacity": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "image-rendering": { - inherited: true, - supports: 0, - values: ["-moz-crisp-edges", "auto", "inherit", "initial", "optimizequality", "optimizespeed", "unset"] - }, - "lighting-color": { - inherited: false, - supports: 4, - values: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "marker-end": { - inherited: true, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "marker-mid": { - inherited: true, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "marker-start": { - inherited: true, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "mask": { - inherited: false, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "mask-type": { - inherited: false, - supports: 0, - values: ["alpha", "inherit", "initial", "luminance", "unset"] - }, - "shape-rendering": { - inherited: true, - supports: 0, - values: ["auto", "crispedges", "geometricprecision", "inherit", "initial", "optimizespeed", "unset"] - }, - "stop-color": { - inherited: false, - supports: 4, - values: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "stop-opacity": { - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "stroke": { - inherited: true, - supports: 12, - values: ["inherit", "initial", "unset"] - }, - "stroke-dasharray": { - inherited: true, - supports: 1027, - values: ["inherit", "initial", "unset"] - }, - "stroke-dashoffset": { - inherited: true, - supports: 1027, - values: ["inherit", "initial", "unset"] - }, - "stroke-linecap": { - inherited: true, - supports: 0, - values: ["butt", "inherit", "initial", "round", "square", "unset"] - }, - "stroke-linejoin": { - inherited: true, - supports: 0, - values: ["bevel", "inherit", "initial", "miter", "round", "unset"] - }, - "stroke-miterlimit": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "stroke-opacity": { - inherited: true, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "stroke-width": { - inherited: true, - supports: 1027, - values: ["inherit", "initial", "unset"] - }, - "text-anchor": { - inherited: true, - supports: 0, - values: ["end", "inherit", "initial", "middle", "start", "unset"] - }, - "text-rendering": { - inherited: true, - supports: 0, - values: ["auto", "geometricprecision", "inherit", "initial", "optimizelegibility", "optimizespeed", "unset"] - }, - "vector-effect": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "non-scaling-stroke", "none", "unset"] - }, - "will-change": { - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-moz-outline-radius": { - subproperties: ["-moz-outline-radius-topleft", "-moz-outline-radius-topright", "-moz-outline-radius-bottomright", "-moz-outline-radius-bottomleft"], - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "all": { - subproperties: ["-moz-appearance", "-moz-outline-radius-topleft", "-moz-outline-radius-topright", "-moz-outline-radius-bottomright", "-moz-outline-radius-bottomleft", "-moz-tab-size", "-x-system-font", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "background-attachment", "background-clip", "background-color", "background-image", "background-blend-mode", "background-origin", "background-position", "background-repeat", "background-size", "-moz-binding", "block-size", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-bottom-color", "-moz-border-bottom-colors", "border-bottom-style", "border-bottom-width", "border-collapse", "border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat", "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", "border-left-color", "-moz-border-left-colors", "border-left-style", "border-left-width", "border-right-color", "-moz-border-right-colors", "border-right-style", "border-right-width", "border-spacing", "border-top-color", "-moz-border-top-colors", "border-top-style", "border-top-width", "border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius", "bottom", "box-decoration-break", "box-shadow", "box-sizing", "caption-side", "clear", "clip", "color", "-moz-column-count", "-moz-column-fill", "-moz-column-width", "-moz-column-gap", "-moz-column-rule-color", "-moz-column-rule-style", "-moz-column-rule-width", "contain", "content", "-moz-control-character-visibility", "counter-increment", "counter-reset", "cursor", "display", "empty-cells", "align-content", "align-items", "align-self", "flex-basis", "flex-direction", "flex-grow", "flex-shrink", "flex-wrap", "order", "justify-content", "justify-items", "justify-self", "float", "-moz-float-edge", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-size", "font-size-adjust", "-moz-osx-font-smoothing", "font-stretch", "font-style", "font-synthesis", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-weight", "-moz-force-broken-image-icon", "grid-auto-flow", "grid-auto-columns", "grid-auto-rows", "grid-template-areas", "grid-template-columns", "grid-template-rows", "grid-column-start", "grid-column-end", "grid-row-start", "grid-row-end", "grid-column-gap", "grid-row-gap", "height", "image-orientation", "-moz-image-region", "ime-mode", "inline-size", "left", "letter-spacing", "line-height", "list-style-image", "list-style-position", "list-style-type", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "marker-offset", "max-block-size", "max-height", "max-inline-size", "max-width", "-moz-min-font-size-ratio", "min-height", "min-block-size", "min-inline-size", "min-width", "mix-blend-mode", "isolation", "object-fit", "object-position", "offset-block-end", "offset-block-start", "offset-inline-end", "offset-inline-start", "opacity", "-moz-orient", "outline-color", "outline-style", "outline-width", "outline-offset", "overflow-clip-box", "overflow-x", "overflow-y", "padding-block-end", "padding-block-start", "padding-bottom", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "page-break-after", "page-break-before", "page-break-inside", "paint-order", "pointer-events", "position", "quotes", "resize", "right", "ruby-align", "ruby-position", "scroll-behavior", "scroll-snap-coordinate", "scroll-snap-destination", "scroll-snap-points-x", "scroll-snap-points-y", "scroll-snap-type-x", "scroll-snap-type-y", "table-layout", "text-align", "-moz-text-align-last", "text-combine-upright", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-indent", "text-orientation", "text-overflow", "text-shadow", "-moz-text-size-adjust", "text-transform", "transform", "transform-box", "transform-origin", "perspective-origin", "perspective", "transform-style", "backface-visibility", "top", "-moz-top-layer", "touch-action", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "-moz-user-focus", "-moz-user-input", "-moz-user-modify", "-moz-user-select", "vertical-align", "visibility", "white-space", "width", "-moz-window-dragging", "-moz-window-shadow", "word-break", "word-spacing", "word-wrap", "hyphens", "writing-mode", "z-index", "-moz-box-align", "-moz-box-direction", "-moz-box-flex", "-moz-box-orient", "-moz-box-pack", "-moz-box-ordinal-group", "-moz-stack-sizing", "clip-path", "clip-rule", "color-interpolation", "color-interpolation-filters", "dominant-baseline", "fill", "fill-opacity", "fill-rule", "filter", "flood-color", "flood-opacity", "image-rendering", "lighting-color", "marker-end", "marker-mid", "marker-start", "mask", "mask-type", "shape-rendering", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-anchor", "text-rendering", "vector-effect", "will-change"], - inherited: false, - supports: 2015, - values: ["-moz-all", "-moz-available", "-moz-block-height", "-moz-box", "-moz-calc", "-moz-center", "-moz-crisp-edges", "-moz-deck", "-moz-element", "-moz-fit-content", "-moz-grid", "-moz-grid-group", "-moz-grid-line", "-moz-groupbox", "-moz-gtk-info-bar", "-moz-hidden-unscrollable", "-moz-image-rect", "-moz-inline-box", "-moz-inline-grid", "-moz-inline-stack", "-moz-left", "-moz-linear-gradient", "-moz-mac-disclosure-button-closed", "-moz-mac-disclosure-button-open", "-moz-mac-fullscreen-button", "-moz-mac-help-button", "-moz-mac-vibrancy-dark", "-moz-mac-vibrancy-light", "-moz-max-content", "-moz-middle-with-baseline", "-moz-min-content", "-moz-none", "-moz-popup", "-moz-pre-space", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "-moz-right", "-moz-stack", "-moz-text", "-moz-use-text-color", "-moz-win-borderless-glass", "-moz-win-browsertabbar-toolbox", "-moz-win-communications-toolbox", "-moz-win-exclude-glass", "-moz-win-glass", "-moz-win-media-toolbox", "-moz-window-button-box", "-moz-window-button-box-maximized", "-moz-window-button-close", "-moz-window-button-maximize", "-moz-window-button-minimize", "-moz-window-button-restore", "-moz-window-frame-bottom", "-moz-window-frame-left", "-moz-window-frame-right", "-moz-window-titlebar", "-moz-window-titlebar-maximized", "absolute", "active", "aliceblue", "all", "all-petite-caps", "all-small-caps", "alpha", "alphabetic", "alternate", "alternate-reverse", "always", "antiquewhite", "aqua", "aquamarine", "auto", "avoid", "azure", "backwards", "balance", "baseline", "beige", "bevel", "bisque", "black", "blanchedalmond", "block", "block-axis", "blue", "blueviolet", "border-box", "both", "bottom", "bottom-outside", "break-all", "break-word", "brown", "burlywood", "butt", "button", "button-arrow-down", "button-arrow-next", "button-arrow-previous", "button-arrow-up", "button-bevel", "button-focus", "cadetblue", "calc", "capitalize", "caret", "center", "central", "chartreuse", "checkbox", "checkbox-container", "checkbox-label", "checkmenuitem", "chocolate", "clone", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "condensed", "contain", "content-box", "contents", "coral", "cornflowerblue", "cornsilk", "cover", "crimson", "crispedges", "cubic-bezier", "currentColor", "cyan", "darkblue", "darkcyan", "darken", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dialog", "difference", "dimgray", "dimgrey", "disabled", "dodgerblue", "dotted", "double", "drag", "dualbutton", "ease", "ease-in", "ease-in-out", "ease-out", "element", "elements", "enabled", "end", "evenodd", "exclusion", "expanded", "extra-condensed", "extra-expanded", "fill", "fill-box", "firebrick", "fixed", "flat", "flex", "floralwhite", "forestgreen", "forwards", "fuchsia", "full-width", "gainsboro", "geometricprecision", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "grid", "groove", "groupbox", "hanging", "hard-light", "hidden", "hide", "honeydew", "horizontal", "horizontal-tb", "hotpink", "hsl", "hsla", "hue", "ideographic", "ignore", "inactive", "indianred", "indigo", "infinite", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-end", "inline-flex", "inline-grid", "inline-start", "inline-table", "inset", "inside", "isolate", "italic", "ivory", "justify", "keep-all", "khaki", "large", "larger", "lavender", "lavenderblush", "lawngreen", "layout", "left", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lighten", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linear", "linear-gradient", "linearrgb", "linen", "list-item", "listbox", "listitem", "local", "lowercase", "lr", "lr-tb", "luminance", "luminosity", "magenta", "mandatory", "manual", "margin-box", "maroon", "mathematical", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "menuarrow", "menubar", "menucheckbox", "menuimage", "menuitem", "menuitemtext", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "menupopup", "menuradio", "menuseparator", "meterbar", "meterchunk", "middle", "midnightblue", "mintcream", "mistyrose", "miter", "mixed", "moccasin", "multiply", "navajowhite", "navy", "no-change", "no-drag", "no-repeat", "non-scaling-stroke", "none", "nonzero", "normal", "nowrap", "number-input", "oblique", "oldlace", "olive", "olivedrab", "optimizelegibility", "optimizequality", "optimizespeed", "orange", "orangered", "orchid", "outset", "outside", "over", "overlay", "padding-box", "paint", "painted", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "paused", "peachpuff", "peru", "petite-caps", "pink", "plum", "powderblue", "pre", "pre-line", "pre-wrap", "preserve-3d", "progressbar", "progressbar-vertical", "progresschunk", "progresschunk-vertical", "proximity", "purple", "radial-gradient", "radio", "radio-container", "radio-label", "radiomenuitem", "range", "range-thumb", "read-only", "read-write", "rebeccapurple", "red", "relative", "repeat", "repeat-x", "repeat-y", "repeating-linear-gradient", "repeating-radial-gradient", "reset-size", "resizer", "resizerpanel", "reverse", "rgb", "rgba", "ridge", "right", "rl", "rl-tb", "rosybrown", "round", "row", "row-reverse", "royalblue", "ruby", "ruby-base", "ruby-base-container", "ruby-text", "ruby-text-container", "running", "saddlebrown", "salmon", "sandybrown", "saturation", "scale-down", "scale-horizontal", "scale-vertical", "scalethumb-horizontal", "scalethumb-vertical", "scalethumbend", "scalethumbstart", "scalethumbtick", "screen", "scroll", "scrollbar", "scrollbar-small", "scrollbarbutton-down", "scrollbarbutton-left", "scrollbarbutton-right", "scrollbarbutton-up", "scrollbarthumb-horizontal", "scrollbarthumb-vertical", "scrollbartrack-horizontal", "scrollbartrack-vertical", "seagreen", "searchfield", "seashell", "select-after", "select-all", "select-before", "select-menu", "select-same", "semi-condensed", "semi-expanded", "separate", "separator", "show", "sideways", "sideways-lr", "sideways-right", "sideways-rl", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "slice", "small", "small-caps", "smaller", "smooth", "snow", "soft-light", "solid", "space-around", "space-between", "spinner", "spinner-downbutton", "spinner-textfield", "spinner-upbutton", "splitter", "springgreen", "square", "srgb", "start", "static", "statusbar", "statusbarpanel", "steelblue", "step-end", "step-start", "steps", "sticky", "stretch", "stretch-to-fit", "strict", "stroke", "style", "sub", "super", "tab", "tab-scroll-arrow-back", "tab-scroll-arrow-forward", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "tabpanel", "tabpanels", "tan", "tb", "tb-rl", "teal", "text", "text-after-edge", "text-before-edge", "text-bottom", "text-top", "textfield", "textfield-multiline", "thick", "thin", "thistle", "titling-caps", "toggle", "tomato", "toolbar", "toolbarbutton", "toolbarbutton-dropdown", "toolbargripper", "toolbox", "tooltip", "top", "top-outside", "transparent", "treeheader", "treeheadercell", "treeheadersortarrow", "treeitem", "treeline", "treetwisty", "treetwistyopen", "treeview", "tri-state", "turquoise", "ultra-condensed", "ultra-expanded", "under", "unicase", "unset", "uppercase", "upright", "url", "use-script", "vertical", "vertical-lr", "vertical-rl", "view-box", "violet", "visible", "visiblefill", "visiblepainted", "visiblestroke", "wavy", "wheat", "white", "whitesmoke", "window", "wrap", "wrap-reverse", "write-only", "x-large", "x-small", "xx-large", "xx-small", "yellow", "yellowgreen"] - }, - "animation": { - subproperties: ["animation-duration", "animation-timing-function", "animation-delay", "animation-direction", "animation-fill-mode", "animation-iteration-count", "animation-play-state", "animation-name"], - inherited: false, - supports: 1344, - values: ["alternate", "alternate-reverse", "backwards", "both", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "forwards", "infinite", "inherit", "initial", "linear", "none", "normal", "paused", "reverse", "running", "step-end", "step-start", "steps", "unset"] - }, - "background": { - subproperties: ["background-color", "background-image", "background-repeat", "background-attachment", "background-position", "background-clip", "background-origin", "background-size"], - inherited: false, - supports: 655, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "border-box", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "content-box", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "fixed", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linear-gradient", "linen", "local", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "no-repeat", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "padding-box", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "radial-gradient", "rebeccapurple", "red", "repeat", "repeat-x", "repeat-y", "repeating-linear-gradient", "repeating-radial-gradient", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "scroll", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "url", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border": { - subproperties: ["border-top-width", "border-right-width", "border-bottom-width", "border-left-width", "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "-moz-border-top-colors", "-moz-border-right-colors", "-moz-border-bottom-colors", "-moz-border-left-colors", "border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linear-gradient", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "radial-gradient", "rebeccapurple", "red", "repeating-linear-gradient", "repeating-radial-gradient", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "url", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-block-end": { - subproperties: ["border-block-end-width", "border-block-end-style", "border-block-end-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-block-start": { - subproperties: ["border-block-start-width", "border-block-start-style", "border-block-start-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-bottom": { - subproperties: ["border-bottom-width", "border-bottom-style", "border-bottom-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-color": { - subproperties: ["border-top-color", "border-right-color", "border-bottom-color", "border-left-color"], - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-image": { - subproperties: ["border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], - inherited: false, - supports: 1675, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "border-inline-end": { - subproperties: ["border-inline-end-width", "border-inline-end-style", "border-inline-end-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-inline-start": { - subproperties: ["border-inline-start-width", "border-inline-start-style", "border-inline-start-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-left": { - subproperties: ["border-left-width", "border-left-style", "border-left-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-right": { - subproperties: ["border-right-width", "border-right-style", "border-right-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-style": { - subproperties: ["border-top-style", "border-right-style", "border-bottom-style", "border-left-style"], - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "border-top": { - subproperties: ["border-top-width", "border-top-style", "border-top-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "border-width": { - subproperties: ["border-top-width", "border-right-width", "border-bottom-width", "border-left-width"], - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "border-radius": { - subproperties: ["border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius"], - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-columns": { - subproperties: ["-moz-column-count", "-moz-column-width"], - inherited: false, - supports: 1025, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "-moz-column-rule": { - subproperties: ["-moz-column-rule-width", "-moz-column-rule-style", "-moz-column-rule-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "flex": { - subproperties: ["flex-grow", "flex-shrink", "flex-basis"], - inherited: false, - supports: 1027, - values: ["-moz-available", "-moz-calc", "-moz-fit-content", "-moz-max-content", "-moz-min-content", "auto", "calc", "inherit", "initial", "unset"] - }, - "flex-flow": { - subproperties: ["flex-direction", "flex-wrap"], - inherited: false, - supports: 0, - values: ["column", "column-reverse", "inherit", "initial", "nowrap", "row", "row-reverse", "unset", "wrap", "wrap-reverse"] - }, - "font": { - subproperties: ["font-family", "font-style", "font-weight", "font-size", "line-height", "font-size-adjust", "font-stretch", "-x-system-font", "font-feature-settings", "font-language-override", "font-kerning", "font-synthesis", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position"], - inherited: true, - supports: 1027, - values: ["-moz-block-height", "-moz-calc", "all-petite-caps", "all-small-caps", "auto", "calc", "condensed", "expanded", "extra-condensed", "extra-expanded", "inherit", "initial", "italic", "large", "larger", "medium", "none", "normal", "oblique", "petite-caps", "semi-condensed", "semi-expanded", "small", "small-caps", "smaller", "sub", "super", "titling-caps", "ultra-condensed", "ultra-expanded", "unicase", "unset", "x-large", "x-small", "xx-large", "xx-small"] - }, - "font-variant": { - subproperties: ["font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position"], - inherited: true, - supports: 0, - values: ["all-petite-caps", "all-small-caps", "inherit", "initial", "normal", "petite-caps", "small-caps", "sub", "super", "titling-caps", "unicase", "unset"] - }, - "grid-template": { - subproperties: ["grid-template-areas", "grid-template-columns", "grid-template-rows"], - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "grid": { - subproperties: ["grid-template-areas", "grid-template-columns", "grid-template-rows", "grid-auto-flow", "grid-auto-columns", "grid-auto-rows", "grid-column-gap", "grid-row-gap"], - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "grid-column": { - subproperties: ["grid-column-start", "grid-column-end"], - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-row": { - subproperties: ["grid-row-start", "grid-row-end"], - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-area": { - subproperties: ["grid-row-start", "grid-column-start", "grid-row-end", "grid-column-end"], - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "grid-gap": { - subproperties: ["grid-column-gap", "grid-row-gap"], - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "list-style": { - subproperties: ["list-style-type", "list-style-image", "list-style-position"], - inherited: true, - supports: 8, - values: ["inherit", "initial", "inside", "none", "outside", "unset", "url"] - }, - "margin": { - subproperties: ["margin-top", "margin-right", "margin-bottom", "margin-left"], - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "outline": { - subproperties: ["outline-width", "outline-style", "outline-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "auto", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "overflow": { - subproperties: ["overflow-x", "overflow-y"], - inherited: false, - supports: 0, - values: ["-moz-hidden-unscrollable", "auto", "hidden", "inherit", "initial", "scroll", "unset", "visible"] - }, - "padding": { - subproperties: ["padding-top", "padding-right", "padding-bottom", "padding-left"], - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "scroll-snap-type": { - subproperties: ["scroll-snap-type-x", "scroll-snap-type-y"], - inherited: false, - supports: 0, - values: ["inherit", "initial", "mandatory", "none", "proximity", "unset"] - }, - "text-decoration": { - subproperties: ["text-decoration-color", "text-decoration-line", "text-decoration-style"], - inherited: false, - supports: 4, - values: ["-moz-none", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wavy", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "transition": { - subproperties: ["transition-property", "transition-duration", "transition-timing-function", "transition-delay"], - inherited: false, - supports: 320, - values: ["all", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "none", "step-end", "step-start", "steps", "unset"] - }, - "marker": { - subproperties: ["marker-start", "marker-mid", "marker-end"], - inherited: true, - supports: 8, - values: ["inherit", "initial", "none", "unset", "url"] - }, - "-moz-transform": { - alias: true, - subproperties: ["transform"], - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-moz-transform-origin": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-perspective-origin": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-moz-perspective": { - alias: true, - inherited: false, - supports: 1, - values: ["inherit", "initial", "none", "unset"] - }, - "-moz-transform-style": { - alias: true, - inherited: false, - supports: 0, - values: ["flat", "inherit", "initial", "preserve-3d", "unset"] - }, - "-moz-backface-visibility": { - alias: true, - inherited: false, - supports: 0, - values: ["hidden", "inherit", "initial", "unset", "visible"] - }, - "-moz-border-image": { - alias: true, - subproperties: ["border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], - inherited: false, - supports: 1675, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "-moz-transition": { - alias: true, - subproperties: ["transition-property", "transition-duration", "transition-timing-function", "transition-delay"], - inherited: false, - supports: 320, - values: ["all", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "none", "step-end", "step-start", "steps", "unset"] - }, - "-moz-transition-delay": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-moz-transition-duration": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-moz-transition-property": { - alias: true, - inherited: false, - supports: 0, - values: ["all", "inherit", "initial", "none", "unset"] - }, - "-moz-transition-timing-function": { - alias: true, - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "-moz-animation": { - alias: true, - subproperties: ["animation-duration", "animation-timing-function", "animation-delay", "animation-direction", "animation-fill-mode", "animation-iteration-count", "animation-play-state", "animation-name"], - inherited: false, - supports: 1344, - values: ["alternate", "alternate-reverse", "backwards", "both", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "forwards", "infinite", "inherit", "initial", "linear", "none", "normal", "paused", "reverse", "running", "step-end", "step-start", "steps", "unset"] - }, - "-moz-animation-delay": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-moz-animation-direction": { - alias: true, - inherited: false, - supports: 0, - values: ["alternate", "alternate-reverse", "inherit", "initial", "normal", "reverse", "unset"] - }, - "-moz-animation-duration": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-moz-animation-fill-mode": { - alias: true, - inherited: false, - supports: 0, - values: ["backwards", "both", "forwards", "inherit", "initial", "none", "unset"] - }, - "-moz-animation-iteration-count": { - alias: true, - inherited: false, - supports: 1024, - values: ["infinite", "inherit", "initial", "unset"] - }, - "-moz-animation-name": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "none", "unset"] - }, - "-moz-animation-play-state": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "paused", "running", "unset"] - }, - "-moz-animation-timing-function": { - alias: true, - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "-moz-box-sizing": { - alias: true, - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "-moz-font-feature-settings": { - alias: true, - inherited: true, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-moz-font-language-override": { - alias: true, - inherited: true, - supports: 0, - values: ["inherit", "initial", "normal", "unset"] - }, - "-moz-padding-end": { - alias: true, - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "-moz-padding-start": { - alias: true, - inherited: false, - supports: 3, - values: ["-moz-calc", "calc", "inherit", "initial", "unset"] - }, - "-moz-margin-end": { - alias: true, - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "-moz-margin-start": { - alias: true, - inherited: false, - supports: 3, - values: ["-moz-calc", "auto", "calc", "inherit", "initial", "unset"] - }, - "-moz-border-end": { - alias: true, - subproperties: ["border-inline-end-width", "border-inline-end-style", "border-inline-end-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-end-color": { - alias: true, - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-end-style": { - alias: true, - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "-moz-border-end-width": { - alias: true, - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "-moz-border-start": { - alias: true, - subproperties: ["border-inline-start-width", "border-inline-start-style", "border-inline-start-color"], - inherited: false, - supports: 5, - values: ["-moz-calc", "-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "inset", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "ridge", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "solid", "springgreen", "steelblue", "tan", "teal", "thick", "thin", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-start-color": { - alias: true, - inherited: false, - supports: 4, - values: ["-moz-use-text-color", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "initial", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rgb", "rgba", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "unset", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] - }, - "-moz-border-start-style": { - alias: true, - inherited: false, - supports: 0, - values: ["dashed", "dotted", "double", "groove", "hidden", "inherit", "initial", "inset", "none", "outset", "ridge", "solid", "unset"] - }, - "-moz-border-start-width": { - alias: true, - inherited: false, - supports: 1, - values: ["-moz-calc", "calc", "inherit", "initial", "medium", "thick", "thin", "unset"] - }, - "-moz-hyphens": { - alias: true, - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "manual", "none", "unset"] - }, - "-webkit-animation": { - alias: true, - subproperties: ["animation-duration", "animation-timing-function", "animation-delay", "animation-direction", "animation-fill-mode", "animation-iteration-count", "animation-play-state", "animation-name"], - inherited: false, - supports: 1344, - values: ["alternate", "alternate-reverse", "backwards", "both", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "forwards", "infinite", "inherit", "initial", "linear", "none", "normal", "paused", "reverse", "running", "step-end", "step-start", "steps", "unset"] - }, - "-webkit-animation-delay": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-webkit-animation-direction": { - alias: true, - inherited: false, - supports: 0, - values: ["alternate", "alternate-reverse", "inherit", "initial", "normal", "reverse", "unset"] - }, - "-webkit-animation-duration": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-webkit-animation-fill-mode": { - alias: true, - inherited: false, - supports: 0, - values: ["backwards", "both", "forwards", "inherit", "initial", "none", "unset"] - }, - "-webkit-animation-iteration-count": { - alias: true, - inherited: false, - supports: 1024, - values: ["infinite", "inherit", "initial", "unset"] - }, - "-webkit-animation-name": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "none", "unset"] - }, - "-webkit-animation-play-state": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "paused", "running", "unset"] - }, - "-webkit-animation-timing-function": { - alias: true, - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "-webkit-text-size-adjust": { - alias: true, - inherited: true, - supports: 0, - values: ["auto", "inherit", "initial", "none", "unset"] - }, - "-webkit-transform": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-webkit-transform-origin": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-transform-style": { - alias: true, - inherited: false, - supports: 0, - values: ["flat", "inherit", "initial", "preserve-3d", "unset"] - }, - "-webkit-backface-visibility": { - alias: true, - inherited: false, - supports: 0, - values: ["hidden", "inherit", "initial", "unset", "visible"] - }, - "-webkit-perspective": { - alias: true, - inherited: false, - supports: 1, - values: ["inherit", "initial", "none", "unset"] - }, - "-webkit-perspective-origin": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-transition": { - alias: true, - subproperties: ["transition-property", "transition-duration", "transition-timing-function", "transition-delay"], - inherited: false, - supports: 320, - values: ["all", "cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "none", "step-end", "step-start", "steps", "unset"] - }, - "-webkit-transition-delay": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-webkit-transition-duration": { - alias: true, - inherited: false, - supports: 64, - values: ["inherit", "initial", "unset"] - }, - "-webkit-transition-property": { - alias: true, - inherited: false, - supports: 0, - values: ["all", "inherit", "initial", "none", "unset"] - }, - "-webkit-transition-timing-function": { - alias: true, - inherited: false, - supports: 256, - values: ["cubic-bezier", "ease", "ease-in", "ease-in-out", "ease-out", "inherit", "initial", "linear", "step-end", "step-start", "steps", "unset"] - }, - "-webkit-border-radius": { - alias: true, - subproperties: ["border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius"], - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-top-left-radius": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-top-right-radius": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-bottom-left-radius": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-bottom-right-radius": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-appearance": { - alias: true, - inherited: false, - supports: 0, - values: ["-moz-gtk-info-bar", "-moz-mac-disclosure-button-closed", "-moz-mac-disclosure-button-open", "-moz-mac-fullscreen-button", "-moz-mac-help-button", "-moz-mac-vibrancy-dark", "-moz-mac-vibrancy-light", "-moz-win-borderless-glass", "-moz-win-browsertabbar-toolbox", "-moz-win-communications-toolbox", "-moz-win-exclude-glass", "-moz-win-glass", "-moz-win-media-toolbox", "-moz-window-button-box", "-moz-window-button-box-maximized", "-moz-window-button-close", "-moz-window-button-maximize", "-moz-window-button-minimize", "-moz-window-button-restore", "-moz-window-frame-bottom", "-moz-window-frame-left", "-moz-window-frame-right", "-moz-window-titlebar", "-moz-window-titlebar-maximized", "button", "button-arrow-down", "button-arrow-next", "button-arrow-previous", "button-arrow-up", "button-bevel", "button-focus", "caret", "checkbox", "checkbox-container", "checkbox-label", "checkmenuitem", "dialog", "dualbutton", "groupbox", "inherit", "initial", "listbox", "listitem", "menuarrow", "menubar", "menucheckbox", "menuimage", "menuitem", "menuitemtext", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "menupopup", "menuradio", "menuseparator", "meterbar", "meterchunk", "none", "number-input", "progressbar", "progressbar-vertical", "progresschunk", "progresschunk-vertical", "radio", "radio-container", "radio-label", "radiomenuitem", "range", "range-thumb", "resizer", "resizerpanel", "scale-horizontal", "scale-vertical", "scalethumb-horizontal", "scalethumb-vertical", "scalethumbend", "scalethumbstart", "scalethumbtick", "scrollbar", "scrollbar-small", "scrollbarbutton-down", "scrollbarbutton-left", "scrollbarbutton-right", "scrollbarbutton-up", "scrollbarthumb-horizontal", "scrollbarthumb-vertical", "scrollbartrack-horizontal", "scrollbartrack-vertical", "searchfield", "separator", "spinner", "spinner-downbutton", "spinner-textfield", "spinner-upbutton", "splitter", "statusbar", "statusbarpanel", "tab", "tab-scroll-arrow-back", "tab-scroll-arrow-forward", "tabpanel", "tabpanels", "textfield", "textfield-multiline", "toolbar", "toolbarbutton", "toolbarbutton-dropdown", "toolbargripper", "toolbox", "tooltip", "treeheader", "treeheadercell", "treeheadersortarrow", "treeitem", "treeline", "treetwisty", "treetwistyopen", "treeview", "unset", "window"] - }, - "-webkit-background-clip": { - alias: true, - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "-webkit-background-origin": { - alias: true, - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "-webkit-background-size": { - alias: true, - inherited: false, - supports: 3, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-image": { - alias: true, - subproperties: ["border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], - inherited: false, - supports: 1675, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "-webkit-border-image-outset": { - alias: true, - inherited: false, - supports: 1025, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-image-repeat": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-image-slice": { - alias: true, - inherited: false, - supports: 1026, - values: ["inherit", "initial", "unset"] - }, - "-webkit-border-image-source": { - alias: true, - inherited: false, - supports: 648, - values: ["-moz-element", "-moz-image-rect", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "inherit", "initial", "linear-gradient", "none", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "unset", "url"] - }, - "-webkit-border-image-width": { - alias: true, - inherited: false, - supports: 1027, - values: ["inherit", "initial", "unset"] - }, - "-webkit-box-shadow": { - alias: true, - inherited: false, - supports: 5, - values: ["inherit", "initial", "unset"] - }, - "-webkit-box-sizing": { - alias: true, - inherited: false, - supports: 0, - values: ["border-box", "content-box", "inherit", "initial", "padding-box", "unset"] - }, - "-webkit-box-flex": { - alias: true, - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-webkit-box-ordinal-group": { - alias: true, - inherited: false, - supports: 1024, - values: ["inherit", "initial", "unset"] - }, - "-webkit-box-align": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-webkit-box-pack": { - alias: true, - inherited: false, - supports: 0, - values: ["inherit", "initial", "unset"] - }, - "-webkit-user-select": { - alias: true, - inherited: false, - supports: 0, - values: ["-moz-all", "-moz-none", "-moz-text", "all", "auto", "element", "elements", "inherit", "initial", "none", "text", "toggle", "tri-state", "unset"] - } - }; - module.exports = { cssProperties }; - -/***/ }, -/* 839 */ -/***/ function(module, exports) { - - "use strict"; - - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm - */ + var span = React.DOM.span; /** - * Promise.jsm is mostly the Promise web API with a `defer` method. Just drop this in here, - * and use the native web API (although building with webpack/babel, it may replace this - * with it's own version if we want to target environments that do not have `Promise`. + * Renders an map. A map is represented by a list of its + * entries enclosed in curly brackets. */ - var p = typeof window != "undefined" ? window.Promise : Promise; - p.defer = function defer() { - var resolve, reject; - var promise = new Promise(function () { - resolve = arguments[0]; - reject = arguments[1]; + GripMap.propTypes = { + object: React.PropTypes.object, + // @TODO Change this to Object.values once it's supported in Node's version of V8 + mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), + objectLink: React.PropTypes.func, + isInterestingEntry: React.PropTypes.func, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func, + title: React.PropTypes.string + }; + + function GripMap(props) { + var object = props.object; + var propsArray = safeEntriesIterator(props, object, props.mode === MODE.LONG ? 10 : 3); + + if (props.mode === MODE.TINY) { + return span({ className: "objectBox objectBox-object" }, getTitle(props, object)); + } + + return span({ className: "objectBox objectBox-object" }, getTitle(props, object), safeObjectLink(props, { + className: "objectLeftBrace" + }, " { "), propsArray, safeObjectLink(props, { + className: "objectRightBrace" + }, " }")); + } + + function getTitle(props, object) { + var title = props.title || (object && object.class ? object.class : "Map"); + return safeObjectLink(props, {}, title); + } + + function safeEntriesIterator(props, object, max) { + max = typeof max === "undefined" ? 3 : max; + try { + return entriesIterator(props, object, max); + } catch (err) { + console.error(err); + } + return []; + } + + function entriesIterator(props, object, max) { + // Entry filter. Show only interesting entries to the user. + var isInterestingEntry = props.isInterestingEntry || ((type, value) => { + return type == "boolean" || type == "number" || type == "string" && value.length != 0; }); - return { - resolve: resolve, - reject: reject, - promise: promise - }; - }; - module.exports = p; + var mapEntries = object.preview && object.preview.entries ? object.preview.entries : []; -/***/ }, -/* 840 */ -/***/ function(module, exports) { + var indexes = getEntriesIndexes(mapEntries, max, isInterestingEntry); + if (indexes.length < max && indexes.length < mapEntries.length) { + // There are not enough entries yet, so we add uninteresting entries. + indexes = indexes.concat(getEntriesIndexes(mapEntries, max - indexes.length, (t, value, name) => { + return !isInterestingEntry(t, value, name); + })); + } - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/FileUtils.jsm - */ - "use strict"; + var entries = getEntries(props, mapEntries, indexes); + if (entries.length < mapEntries.length) { + // There are some undisplayed entries. Then display "more…". + entries.push(Caption({ + key: "more", + object: safeObjectLink(props, {}, `${mapEntries.length - max} more…`) + })); + } -/***/ }, -/* 841 */ -/***/ function(module, exports) { - - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/netwerk/base/NetUtil.jsm - */ - "use strict"; - -/***/ }, -/* 842 */ -/***/ function(module, exports) { - - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/components/osfile/osfile.jsm - */ - "use strict"; - -/***/ }, -/* 843 */ -/***/ function(module, exports, __webpack_require__) { - - /* vim:set ts=2 sw=2 sts=2 et: */ - /* - * Software License Agreement (BSD License) - * - * Copyright (c) 2007, Parakey Inc. - * All rights reserved. - * - * Redistribution and use of this software in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * * Neither the name of Parakey Inc. nor the names of its - * contributors may be used to endorse or promote products - * derived from this software without specific prior - * written permission of Parakey Inc. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - /* - * Creator: - * Joe Hewitt - * Contributors - * John J. Barton (IBM Almaden) - * Jan Odvarko (Mozilla Corp.) - * Max Stepanov (Aptana Inc.) - * Rob Campbell (Mozilla Corp.) - * Hans Hillen (Paciello Group, Mozilla) - * Curtis Bartley (Mozilla Corp.) - * Mike Collins (IBM Almaden) - * Kevin Decker - * Mike Ratcliffe (Comartis AG) - * Hernan Rodríguez Colmeiro - * Austin Andrews - * Christoph Dorn - * Steven Roussey (AppCenter Inc, Network54) - * Mihai Sucan (Mozilla Corp.) - */ - - "use strict"; - - var _require = __webpack_require__(834), - components = _require.components, - Cc = _require.Cc, - Ci = _require.Ci, - Cu = _require.Cu; - - var _require2 = __webpack_require__(841), - NetUtil = _require2.NetUtil; - - var DevToolsUtils = __webpack_require__(833); - - // The cache used in the `nsIURL` function. - var gNSURLStore = new Map(); + return entries; + } /** - * Helper object for networking stuff. + * Get entries ordered by index. * - * Most of the following functions have been taken from the Firebug source. They - * have been modified to match the Firefox coding rules. + * @param {Object} props Component props. + * @param {Array} entries Entries array. + * @param {Array} indexes Indexes of entries. + * @return {Array} Array of PropRep. */ - var NetworkHelper = { - /** - * Converts aText with a given aCharset to unicode. - * - * @param string aText - * Text to convert. - * @param string aCharset - * Charset to convert the text to. - * @returns string - * Converted text. - */ - convertToUnicode: function NH_convertToUnicode(aText, aCharset) { - var conv = Cc("@mozilla.org/intl/scriptableunicodeconverter").createInstance(Ci.nsIScriptableUnicodeConverter); - try { - conv.charset = aCharset || "UTF-8"; - return conv.ConvertToUnicode(aText); - } catch (ex) { - return aText; - } - }, + function getEntries(props, entries, indexes) { + var objectLink = props.objectLink, + onDOMNodeMouseOver = props.onDOMNodeMouseOver, + onDOMNodeMouseOut = props.onDOMNodeMouseOut, + onInspectIconClick = props.onInspectIconClick; - /** - * Reads all available bytes from aStream and converts them to aCharset. - * - * @param nsIInputStream aStream - * @param string aCharset - * @returns string - * UTF-16 encoded string based on the content of aStream and aCharset. - */ - readAndConvertFromStream: function NH_readAndConvertFromStream(aStream, aCharset) { - var text = null; - try { - text = NetUtil.readInputStreamToString(aStream, aStream.available()); - return this.convertToUnicode(text, aCharset); - } catch (err) { - return text; - } - }, + // Make indexes ordered by ascending. - /** - * Reads the posted text from aRequest. - * - * @param nsIHttpChannel aRequest - * @param string aCharset - * The content document charset, used when reading the POSTed data. - * @returns string or null - * Returns the posted string if it was possible to read from aRequest - * otherwise null. - */ - readPostTextFromRequest: function NH_readPostTextFromRequest(aRequest, aCharset) { - if (aRequest instanceof Ci.nsIUploadChannel) { - var iStream = aRequest.uploadStream; + indexes.sort(function (a, b) { + return a - b; + }); - var isSeekableStream = false; - if (iStream instanceof Ci.nsISeekableStream) { - isSeekableStream = true; - } + return indexes.map((index, i) => { + var _entries$index = _slicedToArray(entries[index], 2), + key = _entries$index[0], + entryValue = _entries$index[1]; - var prevOffset = void 0; - if (isSeekableStream) { - prevOffset = iStream.tell(); - iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); - } + var value = entryValue.value !== undefined ? entryValue.value : entryValue; - // Read data from the stream. - var text = this.readAndConvertFromStream(iStream, aCharset); + return PropRep({ + // key, + name: key, + equal: ": ", + object: value, + // Do not add a trailing comma on the last entry + // if there won't be a "more..." item. + delim: i < indexes.length - 1 || indexes.length < entries.length ? ", " : null, + mode: MODE.TINY, + objectLink, + onDOMNodeMouseOver, + onDOMNodeMouseOut, + onInspectIconClick + }); + }); + } - // Seek locks the file, so seek to the beginning only if necko hasn't - // read it yet, since necko doesn't seek to 0 before reading (at lest - // not till 459384 is fixed). - if (isSeekableStream && prevOffset == 0) { - iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); - } - return text; - } - return null; - }, + /** + * Get the indexes of entries in the map. + * + * @param {Array} entries Entries array. + * @param {Number} max The maximum length of indexes array. + * @param {Function} filter Filter the entry you want. + * @return {Array} Indexes of filtered entries in the map. + */ + function getEntriesIndexes(entries, max, filter) { + return entries.reduce((indexes, _ref, i) => { + var _ref2 = _slicedToArray(_ref, 2), + key = _ref2[0], + entry = _ref2[1]; - /** - * Reads the posted text from the page's cache. - * - * @param nsIDocShell aDocShell - * @param string aCharset - * @returns string or null - * Returns the posted string if it was possible to read from - * aDocShell otherwise null. - */ - readPostTextFromPage: function NH_readPostTextFromPage(aDocShell, aCharset) { - var webNav = aDocShell.QueryInterface(Ci.nsIWebNavigation); - return this.readPostTextFromPageViaWebNav(webNav, aCharset); - }, + if (indexes.length < max) { + var value = entry && entry.value !== undefined ? entry.value : entry; + // Type is specified in grip's "class" field and for primitive + // values use typeof. + var type = (value && value.class ? value.class : typeof value).toLowerCase(); - /** - * Reads the posted text from the page's cache, given an nsIWebNavigation - * object. - * - * @param nsIWebNavigation aWebNav - * @param string aCharset - * @returns string or null - * Returns the posted string if it was possible to read from - * aWebNav, otherwise null. - */ - readPostTextFromPageViaWebNav: function NH_readPostTextFromPageViaWebNav(aWebNav, aCharset) { - if (aWebNav instanceof Ci.nsIWebPageDescriptor) { - var descriptor = aWebNav.currentDescriptor; - - if (descriptor instanceof Ci.nsISHEntry && descriptor.postData && descriptor instanceof Ci.nsISeekableStream) { - descriptor.seek(NS_SEEK_SET, 0); - - return this.readAndConvertFromStream(descriptor, aCharset); - } - } - return null; - }, - - /** - * Gets the web appId that is associated with aRequest. - * - * @param nsIHttpChannel aRequest - * @returns number|null - * The appId for the given request, if available. - */ - getAppIdForRequest: function NH_getAppIdForRequest(aRequest) { - try { - return this.getRequestLoadContext(aRequest).appId; - } catch (ex) { - // request loadContent is not always available. - } - return null; - }, - - /** - * Gets the topFrameElement that is associated with aRequest. This - * works in single-process and multiprocess contexts. It may cross - * the content/chrome boundary. - * - * @param nsIHttpChannel aRequest - * @returns nsIDOMElement|null - * The top frame element for the given request. - */ - getTopFrameForRequest: function NH_getTopFrameForRequest(aRequest) { - try { - return this.getRequestLoadContext(aRequest).topFrameElement; - } catch (ex) { - // request loadContent is not always available. - } - return null; - }, - - /** - * Gets the nsIDOMWindow that is associated with aRequest. - * - * @param nsIHttpChannel aRequest - * @returns nsIDOMWindow or null - */ - getWindowForRequest: function NH_getWindowForRequest(aRequest) { - try { - return this.getRequestLoadContext(aRequest).associatedWindow; - } catch (ex) { - // TODO: bug 802246 - getWindowForRequest() throws on b2g: there is no - // associatedWindow property. - } - return null; - }, - - /** - * Gets the nsILoadContext that is associated with aRequest. - * - * @param nsIHttpChannel aRequest - * @returns nsILoadContext or null - */ - getRequestLoadContext: function NH_getRequestLoadContext(aRequest) { - try { - return aRequest.notificationCallbacks.getInterface(Ci.nsILoadContext); - } catch (ex) {} - - try { - return aRequest.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext); - } catch (ex) {} - - return null; - }, - - /** - * Determines whether the request has been made for the top level document. - * - * @param nsIHttpChannel aRequest - * @returns Boolean True if the request represents the top level document. - */ - isTopLevelLoad: function (aRequest) { - if (aRequest instanceof Ci.nsIChannel) { - var loadInfo = aRequest.loadInfo; - if (loadInfo && loadInfo.parentOuterWindowID == loadInfo.outerWindowID) { - return aRequest.loadFlags & Ci.nsIChannel.LOAD_DOCUMENT_URI; + if (filter(type, value, key)) { + indexes.push(i); } } + return indexes; + }, []); + } + + function supportsObject(grip, type) { + if (!isGrip(grip)) { return false; - }, + } + return grip.preview && grip.preview.kind == "MapLike"; + } - /** - * Loads the content of aUrl from the cache. - * - * @param string aUrl - * URL to load the cached content for. - * @param string aCharset - * Assumed charset of the cached content. Used if there is no charset - * on the channel directly. - * @param function aCallback - * Callback that is called with the loaded cached content if available - * or null if something failed while getting the cached content. - */ - loadFromCache: function NH_loadFromCache(aUrl, aCharset, aCallback) { - var channel = NetUtil.newChannel({ uri: aUrl, loadUsingSystemPrincipal: true }); + // Exports from this module + module.exports = { + rep: wrapRender(GripMap), + supportsObject + }; - // Ensure that we only read from the cache and not the server. - channel.loadFlags = Ci.nsIRequest.LOAD_FROM_CACHE | Ci.nsICachingChannel.LOAD_ONLY_FROM_CACHE | Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY; +/***/ }, +/* 960 */ +/***/ function(module, exports) { - NetUtil.asyncFetch(channel, (aInputStream, aStatusCode, aRequest) => { - if (!components.isSuccessCode(aStatusCode)) { - aCallback(null); - return; + module.exports = "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\n# LOCALIZATION NOTE These strings are used inside the Debugger\n# which is available from the Web Developer sub-menu -> 'Debugger'.\n# The correct localization of this file might be to keep it in\n# English, or another language commonly spoken among web developers.\n# You want to make that choice consistent across the developer tools.\n# A good criteria is the language in which you'd find the best\n# documentation on web development on the web.\n\n# LOCALIZATION NOTE (collapsePanes): This is the tooltip for the button\n# that collapses the left and right panes in the debugger UI.\ncollapsePanes=Collapse panes\n\n# LOCALIZATION NOTE (copySourceUrl): This is the text that appears in the\n# context menu to copy the source URL of file open.\ncopySourceUrl=Copy Source Url\n\n# LOCALIZATION NOTE (copySourceUrl.accesskey): Access key to copy the source URL of a file from\n# the context menu.\ncopySourceUrl.accesskey=u\n\n# LOCALIZATION NOTE (copyStackTrace): This is the text that appears in the\n# context menu to copy the stack trace methods, file names and row number.\ncopyStackTrace=Copy Stack Trace\n\n# LOCALIZATION NOTE (copyStackTrace.accesskey): Access key to copy the stack trace data from\n# the context menu.\ncopyStackTrace.accesskey=c\n\n# LOCALIZATION NOTE (expandPanes): This is the tooltip for the button\n# that expands the left and right panes in the debugger UI.\nexpandPanes=Expand panes\n\n# LOCALIZATION NOTE (pauseButtonTooltip): The tooltip that is displayed for the pause\n# button when the debugger is in a running state.\npauseButtonTooltip=Pause %S\n\n# LOCALIZATION NOTE (pausePendingButtonTooltip): The tooltip that is displayed for\n# the pause button after it's been clicked but before the next JavaScript to run.\npausePendingButtonTooltip=Waiting for next execution\n\n# LOCALIZATION NOTE (resumeButtonTooltip): The label that is displayed on the pause\n# button when the debugger is in a paused state.\nresumeButtonTooltip=Resume %S\n\n# LOCALIZATION NOTE (stepOverTooltip): The label that is displayed on the\n# button that steps over a function call.\nstepOverTooltip=Step Over %S\n\n# LOCALIZATION NOTE (stepInTooltip): The label that is displayed on the\n# button that steps into a function call.\nstepInTooltip=Step In %S\n\n# LOCALIZATION NOTE (stepOutTooltip): The label that is displayed on the\n# button that steps out of a function call.\nstepOutTooltip=Step Out %S\n\n# LOCALIZATION NOTE (noWorkersText): The text to display in the workers list\n# when there are no workers.\nnoWorkersText=This page has no workers.\n\n# LOCALIZATION NOTE (noSourcesText): The text to display in the sources list\n# when there are no sources.\nnoSourcesText=This page has no sources.\n\n# LOCALIZATION NOTE (noEventListenersText): The text to display in the events tab\n# when there are no events.\nnoEventListenersText=No event listeners to display\n\n# LOCALIZATION NOTE (eventListenersHeader): The text to display in the events\n# header.\neventListenersHeader=Event Listeners\n\n# LOCALIZATION NOTE (noStackFramesText): The text to display in the call stack tab\n# when there are no stack frames.\nnoStackFramesText=No stack frames to display\n\n# LOCALIZATION NOTE (eventCheckboxTooltip): The tooltip text to display when\n# the user hovers over the checkbox used to toggle an event breakpoint.\neventCheckboxTooltip=Toggle breaking on this event\n\n# LOCALIZATION NOTE (eventOnSelector): The text to display in the events tab\n# for every event item, between the event type and event selector.\neventOnSelector=on\n\n# LOCALIZATION NOTE (eventInSource): The text to display in the events tab\n# for every event item, between the event selector and listener's owner source.\neventInSource=in\n\n# LOCALIZATION NOTE (eventNodes): The text to display in the events tab when\n# an event is listened on more than one target node.\neventNodes=%S nodes\n\n# LOCALIZATION NOTE (eventNative): The text to display in the events tab when\n# a listener is added from plugins, thus getting translated to native code.\neventNative=[native code]\n\n# LOCALIZATION NOTE (*Events): The text to display in the events tab for\n# each group of sub-level event entries.\nanimationEvents=Animation\naudioEvents=Audio\nbatteryEvents=Battery\nclipboardEvents=Clipboard\ncompositionEvents=Composition\ndeviceEvents=Device\ndisplayEvents=Display\ndragAndDropEvents=Drag and Drop\ngamepadEvents=Gamepad\nindexedDBEvents=IndexedDB\ninteractionEvents=Interaction\nkeyboardEvents=Keyboard\nmediaEvents=HTML5 Media\nmouseEvents=Mouse\nmutationEvents=Mutation\nnavigationEvents=Navigation\npointerLockEvents=Pointer Lock\nsensorEvents=Sensor\nstorageEvents=Storage\ntimeEvents=Time\ntouchEvents=Touch\notherEvents=Other\n\n# LOCALIZATION NOTE (blackboxCheckboxTooltip2): The tooltip text to display when\n# the user hovers over the checkbox used to toggle blackboxing its associated\n# source.\nblackboxCheckboxTooltip2=Toggle blackboxing\n\n# LOCALIZATION NOTE (sources.search.key): Key shortcut to open the search for\n# searching all the source files the debugger has seen.\nsources.search.key=P\n\n# LOCALIZATION NOTE (sources.noSourcesAvailable): Text shown when the debugger\n# does not have any sources.\nsources.noSourcesAvailable=This page has no sources\n\n# LOCALIZATION NOTE (sourceSearch.search.key): Key shortcut to open the search\n# for searching within a the currently opened files in the editor\nsourceSearch.search.key=F\n\n# LOCALIZATION NOTE (sourceSearch.search.placeholder): placeholder text in\n# the source search input bar\nsourceSearch.search.placeholder=Search in file…\n\n# LOCALIZATION NOTE (sourceSearch.search.again.key): Key shortcut to re-open\n# the search for re-searching the same search triggered from a sourceSearch\nsourceSearch.search.again.key=G\n\n# LOCALIZATION NOTE (sourceSearch.resultsSummary1): Shows a summary of\n# the number of matches for autocomplete\nsourceSearch.resultsSummary1=%d results\n\n# LOCALIZATION NOTE (noMatchingStringsText): The text to display in the\n# global search results when there are no matching strings after filtering.\nnoMatchingStringsText=No matches found\n\n# LOCALIZATION NOTE (emptySearchText): This is the text that appears in the\n# filter text box when it is empty and the scripts container is selected.\nemptySearchText=Search scripts (%S)\n\n# LOCALIZATION NOTE (emptyVariablesFilterText): This is the text that\n# appears in the filter text box for the variables view container.\nemptyVariablesFilterText=Filter variables\n\n# LOCALIZATION NOTE (emptyPropertiesFilterText): This is the text that\n# appears in the filter text box for the editor's variables view bubble.\nemptyPropertiesFilterText=Filter properties\n\n# LOCALIZATION NOTE (searchPanelFilter): This is the text that appears in the\n# filter panel popup for the filter scripts operation.\nsearchPanelFilter=Filter scripts (%S)\n\n# LOCALIZATION NOTE (searchPanelGlobal): This is the text that appears in the\n# filter panel popup for the global search operation.\nsearchPanelGlobal=Search in all files (%S)\n\n# LOCALIZATION NOTE (searchPanelFunction): This is the text that appears in the\n# filter panel popup for the function search operation.\nsearchPanelFunction=Search for function definition (%S)\n\n# LOCALIZATION NOTE (searchPanelToken): This is the text that appears in the\n# filter panel popup for the token search operation.\nsearchPanelToken=Find in this file (%S)\n\n# LOCALIZATION NOTE (searchPanelGoToLine): This is the text that appears in the\n# filter panel popup for the line search operation.\nsearchPanelGoToLine=Go to line (%S)\n\n# LOCALIZATION NOTE (searchPanelVariable): This is the text that appears in the\n# filter panel popup for the variables search operation.\nsearchPanelVariable=Filter variables (%S)\n\n# LOCALIZATION NOTE (breakpointMenuItem): The text for all the elements that\n# are displayed in the breakpoints menu item popup.\nbreakpointMenuItem.setConditional=Configure conditional breakpoint\nbreakpointMenuItem.enableSelf=Enable breakpoint\nbreakpointMenuItem.disableSelf=Disable breakpoint\nbreakpointMenuItem.deleteSelf=Remove breakpoint\nbreakpointMenuItem.enableOthers=Enable others\nbreakpointMenuItem.disableOthers=Disable others\nbreakpointMenuItem.deleteOthers=Remove others\nbreakpointMenuItem.enableAll=Enable all breakpoints\nbreakpointMenuItem.disableAll=Disable all breakpoints\nbreakpointMenuItem.deleteAll=Remove all breakpoints\n\n# LOCALIZATION NOTE (breakpoints.header): Breakpoints right sidebar pane header.\nbreakpoints.header=Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.none): The text that appears when there are\n# no breakpoints present\nbreakpoints.none=No Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.enable): The text that may appear as a tooltip\n# when hovering over the 'disable breakpoints' switch button in right sidebar\nbreakpoints.enable=Enable Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.disable): The text that may appear as a tooltip\n# when hovering over the 'disable breakpoints' switch button in right sidebar\nbreakpoints.disable=Disable Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.removeBreakpointTooltip): The tooltip that is displayed\n# for remove breakpoint button in right sidebar\nbreakpoints.removeBreakpointTooltip=Remove Breakpoint\n\n# LOCALIZATION NOTE (callStack.header): Call Stack right sidebar pane header.\ncallStack.header=Call Stack\n\n# LOCALIZATION NOTE (callStack.notPaused): Call Stack right sidebar pane\n# message when not paused.\ncallStack.notPaused=Not Paused\n\n# LOCALIZATION NOTE (callStack.collapse): Call Stack right sidebar pane\n# message to hide some of the frames that are shown.\ncallStack.collapse=Collapse Rows\n\n# LOCALIZATION NOTE (callStack.expand): Call Stack right sidebar pane\n# message to show more of the frames.\ncallStack.expand=Expand Rows\n\n# LOCALIZATION NOTE (editor.searchResults): Editor Search bar message\n# for the summarizing the selected search result. e.g. 5 of 10 results.\neditor.searchResults=%d of %d results\n\n# LOCALIZATION NOTE (sourceSearch.singleResult): Copy shown when there is one result.\neditor.singleResult=1 result\n\n# LOCALIZATION NOTE (editor.noResults): Editor Search bar message\n# for when no results found.\neditor.noResults=no results\n\n# LOCALIZATION NOTE (editor.searchResults.nextResults): Editor Search bar\n# tooltip for traversing to the Next Result\neditor.searchResults.nextResult=Next Result\n\n# LOCALIZATION NOTE (editor.searchResults.prevResults): Editor Search bar\n# tooltip for traversing to the Previous Result\neditor.searchResults.prevResult=Previous Result\n\n# LOCALIZATION NOTE (editor.searchTypeToggleTitle): Search bar title for\n# toggling search type buttons(function search, variable search)\neditor.searchTypeToggleTitle=Search for:\n\n# LOCALIZATION NOTE (editor.addBreakpoint): Editor gutter context menu item\n# for adding a breakpoint on a line.\neditor.addBreakpoint=Add Breakpoint\n\n# LOCALIZATION NOTE (editor.disableBreakpoint): Editor gutter context menu item\n# for disabling a breakpoint on a line.\neditor.disableBreakpoint=Disable Breakpoint\n\n# LOCALIZATION NOTE (editor.enableBreakpoint): Editor gutter context menu item\n# for enabling a breakpoint on a line.\neditor.enableBreakpoint=Enable Breakpoint\n\n# LOCALIZATION NOTE (editor.removeBreakpoint): Editor gutter context menu item\n# for removing a breakpoint on a line.\neditor.removeBreakpoint=Remove Breakpoint\n\n# LOCALIZATION NOTE (editor.editBreakpoint): Editor gutter context menu item\n# for setting a breakpoint condition on a line.\neditor.editBreakpoint=Edit Breakpoint\n\n# LOCALIZATION NOTE (editor.addConditionalBreakpoint): Editor gutter context\n# menu item for adding a breakpoint condition on a line.\neditor.addConditionalBreakpoint=Add Conditional Breakpoint\n\n# LOCALIZATION NOTE (editor.conditionalPanel.placeholder): Placeholder text for\n# input element inside ConditionalPanel component\neditor.conditionalPanel.placeholder=This breakpoint will pause when the expression is true\n\n# LOCALIZATION NOTE (editor.conditionalPanel.placeholder): Tooltip text for\n# close button inside ConditionalPanel component\neditor.conditionalPanel.close=Cancel edit breakpoint and close\n\n# LOCALIZATION NOTE (editor.jumpToMappedLocation1): Context menu item\n# for navigating to a source mapped location\neditor.jumpToMappedLocation1=Jump to %S location\n\n# LOCALIZATION NOTE (generated): Source Map term for a server source location\ngenerated=generated\n\n# LOCALIZATION NOTE (original): Source Map term for a debugger UI source location\noriginal=original\n\n# LOCALIZATION NOTE (expressions.placeholder): Placeholder text for expression\n# input element\nexpressions.placeholder=Add Watch Expression\n\n# LOCALIZATION NOTE (sourceTabs.closeTab): Editor source tab context menu item\n# for closing the selected tab below the mouse.\nsourceTabs.closeTab=Close tab\n\n# LOCALIZATION NOTE (sourceTabs.closeTab.accesskey): Access key to close the currently select\n# source tab from the editor context menu item.\nsourceTabs.closeTab.accesskey=c\n\n# LOCALIZATION NOTE (sourceTabs.closeOtherTabs): Editor source tab context menu item\n# for closing the other tabs.\nsourceTabs.closeOtherTabs=Close others\n\n# LOCALIZATION NOTE (sourceTabs.closeOtherTabs.accesskey): Access key to close other source tabs\n# from the editor context menu.\nsourceTabs.closeOtherTabs.accesskey=o\n\n# LOCALIZATION NOTE (sourceTabs.closeTabsToEnd): Editor source tab context menu item\n# for closing the tabs to the end (the right for LTR languages) of the selected tab.\nsourceTabs.closeTabsToEnd=Close tabs to the right\n\n# LOCALIZATION NOTE (sourceTabs.closeTabsToEnd.accesskey): Access key to close source tabs\n# after the selected tab from the editor context menu.\nsourceTabs.closeTabsToEnd.accesskey=e\n\n# LOCALIZATION NOTE (sourceTabs.closeAllTabs): Editor source tab context menu item\n# for closing all tabs.\nsourceTabs.closeAllTabs=Close all tabs\n\n# LOCALIZATION NOTE (sourceTabs.closeAllTabs.accesskey): Access key to close all tabs from the\n# editor context menu.\nsourceTabs.closeAllTabs.accesskey=a\n\n# LOCALIZATION NOTE (sourceTabs.revealInTree): Editor source tab context menu item\n# for revealing source in tree.\nsourceTabs.revealInTree=Reveal in Tree\n\n# LOCALIZATION NOTE (sourceTabs.revealInTree.accesskey): Access key to reveal a source in the\n# tree from the context menu.\nsourceTabs.revealInTree.accesskey=r\n\n# LOCALIZATION NOTE (sourceTabs.copyLink): Editor source tab context menu item\n# for copying a link address.\nsourceTabs.copyLink=Copy Link Address\n\n# LOCALIZATION NOTE (sourceTabs.copyLink.accesskey): Access key to copy a link addresss from the\n# editor context menu.\nsourceTabs.copyLink.accesskey=l\n\n# LOCALIZATION NOTE (sourceTabs.prettyPrint): Editor source tab context menu item\n# for pretty printing the source.\nsourceTabs.prettyPrint=Pretty Print Source\n\n# LOCALIZATION NOTE (sourceTabs.prettyPrint.accesskey): Access key to pretty print a source from\n# the editor context menu.\nsourceTabs.prettyPrint.accesskey=p\n\n# LOCALIZATION NOTE (sourceFooter.blackbox): Tooltip text associated\n# with the blackbox button\nsourceFooter.blackbox=Blackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.unblackbox): Tooltip text associated\n# with the blackbox button\nsourceFooter.unblackbox=Unblackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.blackbox.accesskey): Access key to blackbox\n# an associated source\nsourceFooter.blackbox.accesskey=b\n\n# LOCALIZATION NOTE (sourceFooter.blackboxed): Text associated\n# with a blackboxed source\nsourceFooter.blackboxed=Blackboxed Source\n\n# LOCALIZATION NOTE (sourceTabs.closeTabButtonTooltip): The tooltip that is displayed\n# for close tab button in source tabs.\nsourceTabs.closeTabButtonTooltip=Close tab\n\n# LOCALIZATION NOTE (sourceTabs.newTabButtonTooltip): The tooltip that is displayed for\n# new tab button in source tabs.\nsourceTabs.newTabButtonTooltip=Search for sources (%S)\n\n# LOCALIZATION NOTE (scopes.header): Scopes right sidebar pane header.\nscopes.header=Scopes\n\n# LOCALIZATION NOTE (scopes.notAvailable): Scopes right sidebar pane message\n# for when the debugger is paused, but there isn't pause data.\nscopes.notAvailable=Scopes Unavailable\n\n# LOCALIZATION NOTE (scopes.notPaused): Scopes right sidebar pane message\n# for when the debugger is not paused.\nscopes.notPaused=Not Paused\n\n# LOCALIZATION NOTE (scopes.block): Refers to a block of code in\n# the scopes pane when the debugger is paused.\nscopes.block=Block\n\n# LOCALIZATION NOTE (sources.header): Sources left sidebar header\nsources.header=Sources\n\n# LOCALIZATION NOTE (sources.search): Sources left sidebar prompt\n# e.g. Cmd+P to search. On a mac, we use the command unicode character.\n# On windows, it's ctrl.\nsources.search=%S to search\n\n# LOCALIZATION NOTE (watchExpressions.header): Watch Expressions right sidebar\n# pane header.\nwatchExpressions.header=Watch Expressions\n\n# LOCALIZATION NOTE (watchExpressions.refreshButton): Watch Expressions header\n# button for refreshing the expressions.\nwatchExpressions.refreshButton=Refresh\n\n# LOCALIZATION NOTE (welcome.search): The center pane welcome panel's\n# search prompt. e.g. cmd+p to search for files. On windows, it's ctrl, on\n# a mac we use the unicode character.\nwelcome.search=%S to search for sources\n\n# LOCALIZATION NOTE (sourceSearch.search): The center pane Source Search\n# prompt for searching for files.\nsourceSearch.search=Search Sources…\n\n# LOCALIZATION NOTE (sourceSearch.noResults): The center pane Source Search\n# message when the query did not match any of the sources.\nsourceSearch.noResults=No files matching %S found\n\n# LOCALIZATION NOTE (ignoreExceptions): The pause on exceptions button tooltip\n# when the debugger will not pause on exceptions.\nignoreExceptions=Ignore exceptions. Click to pause on uncaught exceptions\n\n# LOCALIZATION NOTE (pauseOnUncaughtExceptions): The pause on exceptions button\n# tooltip when the debugger will pause on uncaught exceptions.\npauseOnUncaughtExceptions=Pause on uncaught exceptions. Click to pause on all exceptions\n\n# LOCALIZATION NOTE (pauseOnExceptions): The pause on exceptions button tooltip\n# when the debugger will pause on all exceptions.\npauseOnExceptions=Pause on all exceptions. Click to ignore exceptions\n\n# LOCALIZATION NOTE (loadingText): The text that is displayed in the script\n# editor when the loading process has started but there is no file to display\n# yet.\nloadingText=Loading\\u2026\n\n# LOCALIZATION NOTE (errorLoadingText2): The text that is displayed in the debugger\n# viewer when there is an error loading a file\nerrorLoadingText2=Error loading this URL: %S\n\n# LOCALIZATION NOTE (addWatchExpressionText): The text that is displayed in the\n# watch expressions list to add a new item.\naddWatchExpressionText=Add watch expression\n\n# LOCALIZATION NOTE (addWatchExpressionButton): The button that is displayed in the\n# variables view popup.\naddWatchExpressionButton=Watch\n\n# LOCALIZATION NOTE (emptyVariablesText): The text that is displayed in the\n# variables pane when there are no variables to display.\nemptyVariablesText=No variables to display\n\n# LOCALIZATION NOTE (scopeLabel): The text that is displayed in the variables\n# pane as a header for each variable scope (e.g. \"Global scope, \"With scope\",\n# etc.).\nscopeLabel=%S scope\n\n# LOCALIZATION NOTE (watchExpressionsScopeLabel): The name of the watch\n# expressions scope. This text is displayed in the variables pane as a header for\n# the watch expressions scope.\nwatchExpressionsScopeLabel=Watch expressions\n\n# LOCALIZATION NOTE (globalScopeLabel): The name of the global scope. This text\n# is added to scopeLabel and displayed in the variables pane as a header for\n# the global scope.\nglobalScopeLabel=Global\n\n# LOCALIZATION NOTE (variablesViewErrorStacktrace): This is the text that is\n# shown before the stack trace in an error.\nvariablesViewErrorStacktrace=Stack trace:\n\n# LOCALIZATION NOTE (variablesViewMoreObjects): the text that is displayed\n# when you have an object preview that does not show all of the elements. At the end of the list\n# you see \"N more...\" in the web console output.\n# This is a semi-colon list of plural forms.\n# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals\n# #1 number of remaining items in the object\n# example: 3 more…\nvariablesViewMoreObjects=#1 more…;#1 more…\n\n# LOCALIZATION NOTE (variablesEditableNameTooltip): The text that is displayed\n# in the variables list on an item with an editable name.\nvariablesEditableNameTooltip=Double click to edit\n\n# LOCALIZATION NOTE (variablesEditableValueTooltip): The text that is displayed\n# in the variables list on an item with an editable value.\nvariablesEditableValueTooltip=Click to change value\n\n# LOCALIZATION NOTE (variablesCloseButtonTooltip): The text that is displayed\n# in the variables list on an item which can be removed.\nvariablesCloseButtonTooltip=Click to remove\n\n# LOCALIZATION NOTE (variablesEditButtonTooltip): The text that is displayed\n# in the variables list on a getter or setter which can be edited.\nvariablesEditButtonTooltip=Click to set value\n\n# LOCALIZATION NOTE (variablesEditableValueTooltip): The text that is displayed\n# in a tooltip on the \"open in inspector\" button in the the variables list for a\n# DOMNode item.\nvariablesDomNodeValueTooltip=Click to select the node in the inspector\n\n# LOCALIZATION NOTE (configurable|...|Tooltip): The text that is displayed\n# in the variables list on certain variables or properties as tooltips.\n# Expanations of what these represent can be found at the following links:\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed\n# It's probably best to keep these in English.\nconfigurableTooltip=configurable\nenumerableTooltip=enumerable\nwritableTooltip=writable\nfrozenTooltip=frozen\nsealedTooltip=sealed\nextensibleTooltip=extensible\noverriddenTooltip=overridden\nWebIDLTooltip=WebIDL\n\n# LOCALIZATION NOTE (variablesSeparatorLabel): The text that is displayed\n# in the variables list as a separator between the name and value.\nvariablesSeparatorLabel=:\n\n# LOCALIZATION NOTE (watchExpressionsSeparatorLabel2): The text that is displayed\n# in the watch expressions list as a separator between the code and evaluation.\nwatchExpressionsSeparatorLabel2=\\u0020→\n\n# LOCALIZATION NOTE (functionSearchSeparatorLabel): The text that is displayed\n# in the functions search panel as a separator between function's inferred name\n# and its real name (if available).\nfunctionSearchSeparatorLabel=←\n\n# LOCALIZATION NOTE(symbolSearch.search.functionsPlaceholder): The placeholder\n# text displayed when the user searches for functions in a file\nsymbolSearch.search.functionsPlaceholder=Search functions…\n\n# LOCALIZATION NOTE(symbolSearch.search.variablesPlaceholder): The placeholder\n# text displayed when the user searches for variables in a file\nsymbolSearch.search.variablesPlaceholder=Search variables…\n\n# LOCALIZATION NOTE(symbolSearch.search.key): The shortcut (cmd+shift+o) for\n# searching for a function or variable\nsymbolSearch.search.key=O\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.regex): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.regex=Regex\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.caseSensitive): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.caseSensitive=Case sensitive\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.wholeWord): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.wholeWord=Whole word\n\n# LOCALIZATION NOTE (resumptionOrderPanelTitle): This is the text that appears\n# as a description in the notification panel popup, when multiple debuggers are\n# open in separate tabs and the user tries to resume them in the wrong order.\n# The substitution parameter is the URL of the last paused window that must be\n# resumed first.\nresumptionOrderPanelTitle=There are one or more paused debuggers. Please resume the most-recently paused debugger first at: %S\n\nvariablesViewOptimizedOut=(optimized away)\nvariablesViewUninitialized=(uninitialized)\nvariablesViewMissingArgs=(unavailable)\n\nanonymousSourcesLabel=Anonymous Sources\n\nexperimental=This is an experimental feature\n\n# LOCALIZATION NOTE (whyPaused.debuggerStatement): The text that is displayed\n# in a info block explaining how the debugger is currently paused due to a `debugger`\n# statement in the code\nwhyPaused.debuggerStatement=Paused on debugger statement\n\n# LOCALIZATION NOTE (whyPaused.breakpoint): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a breakpoint\nwhyPaused.breakpoint=Paused on breakpoint\n\n# LOCALIZATION NOTE (whyPaused.exception): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an exception\nwhyPaused.exception=Paused on exception\n\n# LOCALIZATION NOTE (whyPaused.resumeLimit): The text that is displayed\n# in a info block explaining how the debugger is currently paused while stepping\n# in or out of the stack\nwhyPaused.resumeLimit=Paused while stepping\n\n# LOCALIZATION NOTE (whyPaused.pauseOnDOMEvents): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# dom event\nwhyPaused.pauseOnDOMEvents=Paused on event listener\n\n# LOCALIZATION NOTE (whyPaused.breakpointConditionThrown): The text that is displayed\n# in an info block when evaluating a conditional breakpoint throws an error\nwhyPaused.breakpointConditionThrown=Error with conditional breakpoint\n\n# LOCALIZATION NOTE (whyPaused.xhr): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an\n# xml http request\nwhyPaused.xhr=Paused on XMLHttpRequest\n\n# LOCALIZATION NOTE (whyPaused.promiseRejection): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# promise rejection\nwhyPaused.promiseRejection=Paused on promise rejection\n\n# LOCALIZATION NOTE (whyPaused.assert): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an\n# assert\nwhyPaused.assert=Paused on assertion\n\n# LOCALIZATION NOTE (whyPaused.debugCommand): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# debugger statement\nwhyPaused.debugCommand=Paused on debugged function\n\n# LOCALIZATION NOTE (whyPaused.other): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an event\n# listener breakpoint set\nwhyPaused.other=Debugger paused\n\n# LOCALIZATION NOTE (ctrl): The text that is used for documenting\n# keyboard shortcuts that use the control key\nctrl=Ctrl\n" + +/***/ }, +/* 961 */, +/* 962 */, +/* 963 */, +/* 964 */, +/* 965 */ +/***/ function(module, exports) { + + + /** + * slice() reference. + */ + + var slice = Array.prototype.slice; + + /** + * Expose `co`. + */ + + module.exports = co['default'] = co.co = co; + + /** + * Wrap the given generator `fn` into a + * function that returns a promise. + * This is a separate function so that + * every `co()` call doesn't create a new, + * unnecessary closure. + * + * @param {GeneratorFunction} fn + * @return {Function} + * @api public + */ + + co.wrap = function (fn) { + createPromise.__generatorFunction__ = fn; + return createPromise; + function createPromise() { + return co.call(this, fn.apply(this, arguments)); + } + }; + + /** + * Execute the generator function or a generator + * and return a promise. + * + * @param {Function} fn + * @return {Promise} + * @api public + */ + + function co(gen) { + var ctx = this; + var args = slice.call(arguments, 1) + + // we wrap everything in a promise to avoid promise chaining, + // which leads to memory leak errors. + // see https://github.com/tj/co/issues/180 + return new Promise(function(resolve, reject) { + if (typeof gen === 'function') gen = gen.apply(ctx, args); + if (!gen || typeof gen.next !== 'function') return resolve(gen); + + onFulfilled(); + + /** + * @param {Mixed} res + * @return {Promise} + * @api private + */ + + function onFulfilled(res) { + var ret; + try { + ret = gen.next(res); + } catch (e) { + return reject(e); } - - // Try to get the encoding from the channel. If there is none, then use - // the passed assumed aCharset. - var aChannel = aRequest.QueryInterface(Ci.nsIChannel); - var contentCharset = aChannel.contentCharset || aCharset; - - // Read the content of the stream using contentCharset as encoding. - aCallback(this.readAndConvertFromStream(aInputStream, contentCharset)); - }); - }, - - /** - * Parse a raw Cookie header value. - * - * @param string aHeader - * The raw Cookie header value. - * @return array - * Array holding an object for each cookie. Each object holds the - * following properties: name and value. - */ - parseCookieHeader: function NH_parseCookieHeader(aHeader) { - var cookies = aHeader.split(";"); - var result = []; - - cookies.forEach(function (aCookie) { - var equal = aCookie.indexOf("="); - var name = aCookie.substr(0, equal); - var value = aCookie.substr(equal + 1); - result.push({ name: unescape(name.trim()), - value: unescape(value.trim()) }); - }); - - return result; - }, - - /** - * Parse a raw Set-Cookie header value. - * - * @param string aHeader - * The raw Set-Cookie header value. - * @return array - * Array holding an object for each cookie. Each object holds the - * following properties: name, value, secure (boolean), httpOnly - * (boolean), path, domain and expires (ISO date string). - */ - parseSetCookieHeader: function NH_parseSetCookieHeader(aHeader) { - var rawCookies = aHeader.split(/\r\n|\n|\r/); - var cookies = []; - - rawCookies.forEach(function (aCookie) { - var equal = aCookie.indexOf("="); - var name = unescape(aCookie.substr(0, equal).trim()); - var parts = aCookie.substr(equal + 1).split(";"); - var value = unescape(parts.shift().trim()); - - var cookie = { name: name, value: value }; - - parts.forEach(function (aPart) { - var part = aPart.trim(); - if (part.toLowerCase() == "secure") { - cookie.secure = true; - } else if (part.toLowerCase() == "httponly") { - cookie.httpOnly = true; - } else if (part.indexOf("=") > -1) { - var pair = part.split("="); - pair[0] = pair[0].toLowerCase(); - if (pair[0] == "path" || pair[0] == "domain") { - cookie[pair[0]] = pair[1]; - } else if (pair[0] == "expires") { - try { - pair[1] = pair[1].replace(/-/g, ' '); - cookie.expires = new Date(pair[1]).toISOString(); - } catch (ex) {} - } - } - }); - - cookies.push(cookie); - }); - - return cookies; - }, - - // This is a list of all the mime category maps jviereck could find in the - // firebug code base. - mimeCategoryMap: { - "text/plain": "txt", - "text/html": "html", - "text/xml": "xml", - "text/xsl": "txt", - "text/xul": "txt", - "text/css": "css", - "text/sgml": "txt", - "text/rtf": "txt", - "text/x-setext": "txt", - "text/richtext": "txt", - "text/javascript": "js", - "text/jscript": "txt", - "text/tab-separated-values": "txt", - "text/rdf": "txt", - "text/xif": "txt", - "text/ecmascript": "js", - "text/vnd.curl": "txt", - "text/x-json": "json", - "text/x-js": "txt", - "text/js": "txt", - "text/vbscript": "txt", - "view-source": "txt", - "view-fragment": "txt", - "application/xml": "xml", - "application/xhtml+xml": "xml", - "application/atom+xml": "xml", - "application/rss+xml": "xml", - "application/vnd.mozilla.maybe.feed": "xml", - "application/vnd.mozilla.xul+xml": "xml", - "application/javascript": "js", - "application/x-javascript": "js", - "application/x-httpd-php": "txt", - "application/rdf+xml": "xml", - "application/ecmascript": "js", - "application/http-index-format": "txt", - "application/json": "json", - "application/x-js": "txt", - "multipart/mixed": "txt", - "multipart/x-mixed-replace": "txt", - "image/svg+xml": "svg", - "application/octet-stream": "bin", - "image/jpeg": "image", - "image/jpg": "image", - "image/gif": "image", - "image/png": "image", - "image/bmp": "image", - "application/x-shockwave-flash": "flash", - "video/x-flv": "flash", - "audio/mpeg3": "media", - "audio/x-mpeg-3": "media", - "video/mpeg": "media", - "video/x-mpeg": "media", - "audio/ogg": "media", - "application/ogg": "media", - "application/x-ogg": "media", - "application/x-midi": "media", - "audio/midi": "media", - "audio/x-mid": "media", - "audio/x-midi": "media", - "music/crescendo": "media", - "audio/wav": "media", - "audio/x-wav": "media", - "text/json": "json", - "application/x-json": "json", - "application/json-rpc": "json", - "application/x-web-app-manifest+json": "json", - "application/manifest+json": "json" - }, - - /** - * Check if the given MIME type is a text-only MIME type. - * - * @param string aMimeType - * @return boolean - */ - isTextMimeType: function NH_isTextMimeType(aMimeType) { - if (aMimeType.indexOf("text/") == 0) { - return true; - } - - // XML and JSON often come with custom MIME types, so in addition to the - // standard "application/xml" and "application/json", we also look for - // variants like "application/x-bigcorp+xml". For JSON we allow "+json" and - // "-json" as suffixes. - if (/^application\/\w+(?:[\.-]\w+)*(?:\+xml|[-+]json)$/.test(aMimeType)) { - return true; - } - - var category = this.mimeCategoryMap[aMimeType] || null; - switch (category) { - case "txt": - case "js": - case "json": - case "css": - case "html": - case "svg": - case "xml": - return true; - - default: - return false; - } - }, - - /** - * Takes a securityInfo object of nsIRequest, the nsIRequest itself and - * extracts security information from them. - * - * @param object securityInfo - * The securityInfo object of a request. If null channel is assumed - * to be insecure. - * @param object httpActivity - * The httpActivity object for the request with at least members - * { private, hostname }. - * - * @return object - * Returns an object containing following members: - * - state: The security of the connection used to fetch this - * request. Has one of following string values: - * * "insecure": the connection was not secure (only http) - * * "weak": the connection has minor security issues - * * "broken": secure connection failed (e.g. expired cert) - * * "secure": the connection was properly secured. - * If state == broken: - * - errorMessage: full error message from nsITransportSecurityInfo. - * If state == secure: - * - protocolVersion: one of TLSv1, TLSv1.1, TLSv1.2. - * - cipherSuite: the cipher suite used in this connection. - * - cert: information about certificate used in this connection. - * See parseCertificateInfo for the contents. - * - hsts: true if host uses Strict Transport Security, false otherwise - * - hpkp: true if host uses Public Key Pinning, false otherwise - * If state == weak: Same as state == secure and - * - weaknessReasons: list of reasons that cause the request to be - * considered weak. See getReasonsForWeakness. - */ - parseSecurityInfo: function NH_parseSecurityInfo(securityInfo, httpActivity) { - var info = { - state: "insecure" - }; - - // The request did not contain any security info. - if (!securityInfo) { - return info; + next(ret); } /** - * Different scenarios to consider here and how they are handled: - * - request is HTTP, the connection is not secure - * => securityInfo is null - * => state === "insecure" - * - * - request is HTTPS, the connection is secure - * => .securityState has STATE_IS_SECURE flag - * => state === "secure" - * - * - request is HTTPS, the connection has security issues - * => .securityState has STATE_IS_INSECURE flag - * => .errorCode is an NSS error code. - * => state === "broken" - * - * - request is HTTPS, the connection was terminated before the security - * could be validated - * => .securityState has STATE_IS_INSECURE flag - * => .errorCode is NOT an NSS error code. - * => .errorMessage is not available. - * => state === "insecure" - * - * - request is HTTPS but it uses a weak cipher or old protocol, see - * https://hg.mozilla.org/mozilla-central/annotate/def6ed9d1c1a/ - * security/manager/ssl/nsNSSCallbacks.cpp#l1233 - * - request is mixed content (which makes no sense whatsoever) - * => .securityState has STATE_IS_BROKEN flag - * => .errorCode is NOT an NSS error code - * => .errorMessage is not available - * => state === "weak" + * @param {Error} err + * @return {Promise} + * @api private */ - securityInfo.QueryInterface(Ci.nsITransportSecurityInfo); - securityInfo.QueryInterface(Ci.nsISSLStatusProvider); - - var wpl = Ci.nsIWebProgressListener; - var NSSErrorsService = Cc['@mozilla.org/nss_errors_service;1'].getService(Ci.nsINSSErrorsService); - var SSLStatus = securityInfo.SSLStatus; - if (!NSSErrorsService.isNSSErrorCode(securityInfo.errorCode)) { - var state = securityInfo.securityState; - - var uri = null; - if (httpActivity.channel && httpActivity.channel.URI) { - uri = httpActivity.channel.URI; + function onRejected(err) { + var ret; + try { + ret = gen.throw(err); + } catch (e) { + return reject(e); } - if (uri && !uri.schemeIs("https") && !uri.schemeIs("wss")) { - // it is not enough to look at the transport security info - schemes other than - // https and wss are subject to downgrade/etc at the scheme level and should - // always be considered insecure - info.state = "insecure"; - } else if (state & wpl.STATE_IS_SECURE) { - // The connection is secure if the scheme is sufficient - info.state = "secure"; - } else if (state & wpl.STATE_IS_BROKEN) { - // The connection is not secure, there was no error but there's some - // minor security issues. - info.state = "weak"; - info.weaknessReasons = this.getReasonsForWeakness(state); - } else if (state & wpl.STATE_IS_INSECURE) { - // This was most likely an https request that was aborted before - // validation. Return info as info.state = insecure. - return info; - } else { - DevToolsUtils.reportException("NetworkHelper.parseSecurityInfo", "Security state " + state + " has no known STATE_IS_* flags."); - return info; - } - - // Cipher suite. - info.cipherSuite = SSLStatus.cipherName; - - // Protocol version. - info.protocolVersion = this.formatSecurityProtocol(SSLStatus.protocolVersion); - - // Certificate. - info.cert = this.parseCertificateInfo(SSLStatus.serverCert); - - // HSTS and HPKP if available. - if (httpActivity.hostname) { - var sss = Cc("@mozilla.org/ssservice;1").getService(Ci.nsISiteSecurityService); - - // SiteSecurityService uses different storage if the channel is - // private. Thus we must give isSecureHost correct flags or we - // might get incorrect results. - var flags = httpActivity.private ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0; - - var host = httpActivity.hostname; - - info.hsts = sss.isSecureHost(sss.HEADER_HSTS, host, flags); - info.hpkp = sss.isSecureHost(sss.HEADER_HPKP, host, flags); - } else { - DevToolsUtils.reportException("NetworkHelper.parseSecurityInfo", "Could not get HSTS/HPKP status as hostname is not available."); - info.hsts = false; - info.hpkp = false; - } - } else { - // The connection failed. - info.state = "broken"; - info.errorMessage = securityInfo.errorMessage; + next(ret); } - return info; - }, + /** + * Get the next value in the generator, + * return a promise. + * + * @param {Object} ret + * @return {Promise} + * @api private + */ - /** - * Takes an nsIX509Cert and returns an object with certificate information. - * - * @param nsIX509Cert cert - * The certificate to extract the information from. - * @return object - * An object with following format: - * { - * subject: { commonName, organization, organizationalUnit }, - * issuer: { commonName, organization, organizationUnit }, - * validity: { start, end }, - * fingerprint: { sha1, sha256 } - * } - */ - parseCertificateInfo: function NH_parseCertifificateInfo(cert) { - var info = {}; - if (cert) { - info.subject = { - commonName: cert.commonName, - organization: cert.organization, - organizationalUnit: cert.organizationalUnit - }; - - info.issuer = { - commonName: cert.issuerCommonName, - organization: cert.issuerOrganization, - organizationUnit: cert.issuerOrganizationUnit - }; - - info.validity = { - start: cert.validity.notBeforeLocalDay, - end: cert.validity.notAfterLocalDay - }; - - info.fingerprint = { - sha1: cert.sha1Fingerprint, - sha256: cert.sha256Fingerprint - }; - } else { - DevToolsUtils.reportException("NetworkHelper.parseCertificateInfo", "Secure connection established without certificate."); + function next(ret) { + if (ret.done) return resolve(ret.value); + var value = toPromise.call(ctx, ret.value); + if (value && isPromise(value)) return value.then(onFulfilled, onRejected); + return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, ' + + 'but the following object was passed: "' + String(ret.value) + '"')); } - - return info; - }, - - /** - * Takes protocolVersion of SSLStatus object and returns human readable - * description. - * - * @param Number version - * One of nsISSLStatus version constants. - * @return string - * One of TLSv1, TLSv1.1, TLSv1.2 if @param version is valid, - * Unknown otherwise. - */ - formatSecurityProtocol: function NH_formatSecurityProtocol(version) { - switch (version) { - case Ci.nsISSLStatus.TLS_VERSION_1: - return "TLSv1"; - case Ci.nsISSLStatus.TLS_VERSION_1_1: - return "TLSv1.1"; - case Ci.nsISSLStatus.TLS_VERSION_1_2: - return "TLSv1.2"; - default: - DevToolsUtils.reportException("NetworkHelper.formatSecurityProtocol", "protocolVersion " + version + " is unknown."); - return "Unknown"; - } - }, - - /** - * Takes the securityState bitfield and returns reasons for weak connection - * as an array of strings. - * - * @param Number state - * nsITransportSecurityInfo.securityState. - * - * @return Array[String] - * List of weakness reasons. A subset of { cipher } where - * * cipher: The cipher suite is consireded to be weak (RC4). - */ - getReasonsForWeakness: function NH_getReasonsForWeakness(state) { - var wpl = Ci.nsIWebProgressListener; - - // If there's non-fatal security issues the request has STATE_IS_BROKEN - // flag set. See http://hg.mozilla.org/mozilla-central/file/44344099d119 - // /security/manager/ssl/nsNSSCallbacks.cpp#l1233 - var reasons = []; - - if (state & wpl.STATE_IS_BROKEN) { - var isCipher = state & wpl.STATE_USES_WEAK_CRYPTO; - - if (isCipher) { - reasons.push("cipher"); - } - - if (!isCipher) { - DevToolsUtils.reportException("NetworkHelper.getReasonsForWeakness", "STATE_IS_BROKEN without a known reason. Full state was: " + state); - } - } - - return reasons; - }, - - /** - * Parse a url's query string into its components - * - * @param string aQueryString - * The query part of a url - * @return array - * Array of query params {name, value} - */ - parseQueryString: function (aQueryString) { - // Make sure there's at least one param available. - // Be careful here, params don't necessarily need to have values, so - // no need to verify the existence of a "=". - if (!aQueryString) { - return; - } - - // Turn the params string into an array containing { name: value } tuples. - var paramsArray = aQueryString.replace(/^[?&]/, "").split("&").map(e => { - var param = e.split("="); - return { - name: param[0] ? NetworkHelper.convertToUnicode(unescape(param[0])) : "", - value: param[1] ? NetworkHelper.convertToUnicode(unescape(param[1])) : "" - }; - }); - - return paramsArray; - }, - - /** - * Helper for getting an nsIURL instance out of a string. - */ - nsIURL: function (aUrl) { - var aStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gNSURLStore; - - if (aStore.has(aUrl)) { - return aStore.get(aUrl); - } - - var uri = Services.io.newURI(aUrl).QueryInterface(Ci.nsIURL); - aStore.set(aUrl, uri); - return uri; - } - }; - - for (var prop of Object.getOwnPropertyNames(NetworkHelper)) { - exports[prop] = NetworkHelper[prop]; + }); } + /** + * Convert a `yield`ed value into a promise. + * + * @param {Mixed} obj + * @return {Promise} + * @api private + */ + + function toPromise(obj) { + if (!obj) return obj; + if (isPromise(obj)) return obj; + if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj); + if ('function' == typeof obj) return thunkToPromise.call(this, obj); + if (Array.isArray(obj)) return arrayToPromise.call(this, obj); + if (isObject(obj)) return objectToPromise.call(this, obj); + return obj; + } + + /** + * Convert a thunk to a promise. + * + * @param {Function} + * @return {Promise} + * @api private + */ + + function thunkToPromise(fn) { + var ctx = this; + return new Promise(function (resolve, reject) { + fn.call(ctx, function (err, res) { + if (err) return reject(err); + if (arguments.length > 2) res = slice.call(arguments, 1); + resolve(res); + }); + }); + } + + /** + * Convert an array of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Array} obj + * @return {Promise} + * @api private + */ + + function arrayToPromise(obj) { + return Promise.all(obj.map(toPromise, this)); + } + + /** + * Convert an object of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Object} obj + * @return {Promise} + * @api private + */ + + function objectToPromise(obj){ + var results = new obj.constructor(); + var keys = Object.keys(obj); + var promises = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var promise = toPromise.call(this, obj[key]); + if (promise && isPromise(promise)) defer(promise, key); + else results[key] = obj[key]; + } + return Promise.all(promises).then(function () { + return results; + }); + + function defer(promise, key) { + // predefine the key in the result + results[key] = undefined; + promises.push(promise.then(function (res) { + results[key] = res; + })); + } + } + + /** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + + function isPromise(obj) { + return 'function' == typeof obj.then; + } + + /** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + + function isGenerator(obj) { + return 'function' == typeof obj.next && 'function' == typeof obj.throw; + } + + /** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + function isGeneratorFunction(obj) { + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype); + } + + /** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + + function isObject(val) { + return Object == val.constructor; + } + + /***/ }, -/* 844 */ +/* 966 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + var _require = __webpack_require__(830), + Menu = _require.Menu, + MenuItem = _require.MenuItem; + + var _require2 = __webpack_require__(828), + isFirefoxPanel = _require2.isFirefoxPanel; + + if (!isFirefoxPanel()) { + __webpack_require__(973); + } + + function createPopup(doc) { + var popup = doc.createElement("menupopup"); + popup.className = "landing-popup"; + if (popup.openPopupAtScreen) { + return popup; + } + + function preventDefault(e) { + e.preventDefault(); + e.returnValue = false; + } + + var mask = document.querySelector("#contextmenu-mask"); + if (!mask) { + mask = doc.createElement("div"); + mask.id = "contextmenu-mask"; + document.body.appendChild(mask); + } + + mask.onclick = () => popup.hidePopup(); + + popup.openPopupAtScreen = function (clientX, clientY) { + this.style.setProperty("left", `${clientX}px`); + this.style.setProperty("top", `${clientY}px`); + mask = document.querySelector("#contextmenu-mask"); + window.onwheel = preventDefault; + mask.classList.add("show"); + this.dispatchEvent(new Event("popupshown")); + this.popupshown; + }; + + popup.hidePopup = function () { + this.remove(); + mask = document.querySelector("#contextmenu-mask"); + mask.classList.remove("show"); + window.onwheel = null; + }; + + return popup; + } + + if (!isFirefoxPanel()) { + Menu.prototype.createPopup = createPopup; + } + + function onShown(menu, popup) { + popup.childNodes.forEach((menuItemNode, i) => { + var item = menu.items[i]; + + if (!item.disabled && item.visible) { + menuItemNode.onclick = () => { + item.click(); + popup.hidePopup(); + }; + + showSubMenu(item.submenu, menuItemNode, popup); + } + }); + } + + function showMenu(evt, items) { + if (items.length === 0) { + return; + } + + var menu = new Menu(); + items.filter(item => item.visible === undefined || item.visible === true).forEach(item => { + var menuItem = new MenuItem(item); + menuItem.submenu = createSubMenu(item.submenu); + menu.append(menuItem); + }); + + if (isFirefoxPanel()) { + menu.popup(evt.screenX, evt.screenY, { doc: window.parent.document }); + return; + } + + menu.on("open", (_, popup) => onShown(menu, popup)); + menu.popup(evt.clientX, evt.clientY, { doc: document }); + } + + function createSubMenu(subItems) { + if (subItems) { + var subMenu = new Menu(); + subItems.forEach(subItem => { + subMenu.append(new MenuItem(subItem)); + }); + return subMenu; + } + return null; + } + + function showSubMenu(subMenu, menuItemNode, popup) { + if (subMenu) { + var subMenuNode = menuItemNode.querySelector("menupopup"); + + var _popup$getBoundingCli = popup.getBoundingClientRect(), + left = _popup$getBoundingCli.left, + top = _popup$getBoundingCli.top, + width = _popup$getBoundingCli.width; + + subMenuNode.style.setProperty("left", `${left + width}px`); + subMenuNode.style.setProperty("top", `${top}px`); + + var subMenuItemNodes = menuItemNode.querySelector("menupopup:not(.landing-popup)").childNodes; + subMenuItemNodes.forEach((subMenuItemNode, j) => { + var subMenuItem = subMenu.items.filter(item => item.visible === undefined || item.visible === true)[j]; + if (!subMenuItem.disabled && subMenuItem.visible) { + subMenuItemNode.onclick = () => { + subMenuItem.click(); + popup.hidePopup(); + }; + } + }); + } + } + + function buildMenu(items) { + return items.map(itm => { + var hide = typeof itm.hidden === "function" ? itm.hidden() : itm.hidden; + return hide ? null : itm.item; + }).filter(itm => itm !== null); + } + + module.exports = { + showMenu, + buildMenu + }; + +/***/ }, +/* 967 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var EventEmitter = __webpack_require__(968); /** - * EventEmitter. + * A partial implementation of the Menu API provided by electron: + * https://github.com/electron/electron/blob/master/docs/api/menu.md. + * + * Extra features: + * - Emits an 'open' and 'close' event when the menu is opened/closed + + * @param String id (non standard) + * Needed so tests can confirm the XUL implementation is working */ + function Menu() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$id = _ref.id, + id = _ref$id === undefined ? null : _ref$id; + + this.menuitems = []; + this.id = id; + + Object.defineProperty(this, "items", { + get() { + return this.menuitems; + } + }); + + EventEmitter.decorate(this); + } + + /** + * Add an item to the end of the Menu + * + * @param {MenuItem} menuItem + */ + Menu.prototype.append = function (menuItem) { + this.menuitems.push(menuItem); + }; + + /** + * Add an item to a specified position in the menu + * + * @param {int} pos + * @param {MenuItem} menuItem + */ + Menu.prototype.insert = function (pos, menuItem) { + throw Error("Not implemented"); + }; + + /** + * Show the Menu at a specified location on the screen + * + * Missing features: + * - browserWindow - BrowserWindow (optional) - Default is null. + * - positioningItem Number - (optional) OS X + * + * @param {int} screenX + * @param {int} screenY + * @param Toolbox toolbox (non standard) + * Needed so we in which window to inject XUL + */ + Menu.prototype.popup = function (screenX, screenY, toolbox) { + var doc = toolbox.doc; + var popupset = doc.querySelector("popupset"); + // See bug 1285229, on Windows, opening the same popup multiple times in a + // row ends up duplicating the popup. The newly inserted popup doesn't + // dismiss the old one. So remove any previously displayed popup before + // opening a new one. + var popup = popupset.querySelector("menupopup[menu-api=\"true\"]"); + if (popup) { + popup.hidePopup(); + } + + popup = this.createPopup(doc); + popup.setAttribute("menu-api", "true"); + + if (this.id) { + popup.id = this.id; + } + this._createMenuItems(popup); + + // Remove the menu from the DOM once it's hidden. + popup.addEventListener("popuphidden", e => { + if (e.target === popup) { + popup.remove(); + this.emit("close", popup); + } + }); + + popup.addEventListener("popupshown", e => { + if (e.target === popup) { + this.emit("open", popup); + } + }); + + popupset.appendChild(popup); + popup.openPopupAtScreen(screenX, screenY, true); + }; + + Menu.prototype.createPopup = function (doc) { + return doc.createElement("menupopup"); + }; + + Menu.prototype._createMenuItems = function (parent) { + var doc = parent.ownerDocument; + this.menuitems.forEach(item => { + if (!item.visible) { + return; + } + + if (item.submenu) { + var menupopup = doc.createElement("menupopup"); + item.submenu._createMenuItems(menupopup); + + var menuitem = doc.createElement("menuitem"); + menuitem.setAttribute("label", item.label); + menuitem.textContent = item.label; + var menu = doc.createElement("menu"); + menu.appendChild(menuitem); + menu.appendChild(menupopup); + if (item.disabled) { + menu.setAttribute("disabled", "true"); + } + if (item.accesskey) { + menu.setAttribute("accesskey", item.accesskey); + } + if (item.id) { + menu.id = item.id; + } + parent.appendChild(menu); + } else if (item.type === "separator") { + var menusep = doc.createElement("menuseparator"); + parent.appendChild(menusep); + } else { + var _menuitem = doc.createElement("menuitem"); + _menuitem.setAttribute("label", item.label); + _menuitem.textContent = item.label; + _menuitem.addEventListener("command", () => item.click()); + + if (item.type === "checkbox") { + _menuitem.setAttribute("type", "checkbox"); + } + if (item.type === "radio") { + _menuitem.setAttribute("type", "radio"); + } + if (item.disabled) { + _menuitem.setAttribute("disabled", "true"); + } + if (item.checked) { + _menuitem.setAttribute("checked", "true"); + } + if (item.accesskey) { + _menuitem.setAttribute("accesskey", item.accesskey); + } + if (item.id) { + _menuitem.id = item.id; + } + + parent.appendChild(_menuitem); + } + }); + }; + + Menu.setApplicationMenu = () => { + throw Error("Not implemented"); + }; + + Menu.sendActionToFirstResponder = () => { + throw Error("Not implemented"); + }; + + Menu.buildFromTemplate = () => { + throw Error("Not implemented"); + }; + + module.exports = Menu; + +/***/ }, +/* 968 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; var EventEmitter = function EventEmitter() {}; module.exports = EventEmitter; - var _require = __webpack_require__(834), - Cu = _require.Cu; - - var promise = __webpack_require__(839); + var promise = __webpack_require__(969); /** * Decorate an object with event emitter functionality. @@ -48598,816 +37708,41 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }, -/* 845 */ +/* 969 */ /***/ function(module, exports) { - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - /* eslint-env browser */ - "use strict"; - /** - * HTML5 file saver to provide a standard download interface with a "Save As" - * dialog - * - * @param {object} blob - A blob object will be downloaded - * @param {string} filename - Given a file name which will display in "Save As" dialog - * @param {object} document - Optional. A HTML document for creating a temporary anchor - * for triggering a file download. + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm */ - function saveAs(blob) { - var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; + /** + * Promise.jsm is mostly the Promise web API with a `defer` method. Just drop this in here, + * and use the native web API (although building with webpack/babel, it may replace this + * with it's own version if we want to target environments that do not have `Promise`. + */ - var url = URL.createObjectURL(blob); - var a = doc.createElement("a"); - doc.body.appendChild(a); - a.style = "display: none"; - a.href = url; - a.download = filename; - a.click(); - URL.revokeObjectURL(url); - a.remove(); - } + var p = typeof window != "undefined" ? window.Promise : Promise; + p.defer = function defer() { + var resolve, reject; + var promise = new Promise(function () { + resolve = arguments[0]; + reject = arguments[1]; + }); + return { + resolve: resolve, + reject: reject, + promise: promise + }; + }; - exports.saveAs = saveAs; + module.exports = p; /***/ }, -/* 846 */ -/***/ function(module, exports, __webpack_require__) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - var _require = __webpack_require__(2), - dom = _require.DOM, - createClass = _require.createClass, - PropTypes = _require.PropTypes; - - var _require2 = __webpack_require__(847), - getSourceNames = _require2.getSourceNames, - parseURL = _require2.parseURL, - isScratchpadScheme = _require2.isScratchpadScheme, - getSourceMappedFile = _require2.getSourceMappedFile; - // const { LocalizationHelper } = require("devtools/shared/l10n"); - // - // const l10n = new LocalizationHelper("devtools/client/locales/components.properties"); - // const webl10n = new LocalizationHelper("devtools/client/locales/webconsole.properties"); - - var l10n = { getStr: () => {} }; - var webl10n = { getStr: () => {} }; - - module.exports = createClass({ - displayName: "Frame", - - propTypes: { - // SavedFrame, or an object containing all the required properties. - frame: PropTypes.shape({ - functionDisplayName: PropTypes.string, - source: PropTypes.string.isRequired, - line: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - column: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) - }).isRequired, - // Clicking on the frame link -- probably should link to the debugger. - onClick: PropTypes.func.isRequired, - // Option to display a function name before the source link. - showFunctionName: PropTypes.bool, - // Option to display a function name even if it's anonymous. - showAnonymousFunctionName: PropTypes.bool, - // Option to display a host name after the source link. - showHost: PropTypes.bool, - // Option to display a host name if the filename is empty or just '/' - showEmptyPathAsHost: PropTypes.bool, - // Option to display a full source instead of just the filename. - showFullSourceUrl: PropTypes.bool, - // Service to enable the source map feature for console. - sourceMapService: PropTypes.object - }, - - getDefaultProps() { - return { - showFunctionName: false, - showAnonymousFunctionName: false, - showHost: false, - showEmptyPathAsHost: false, - showFullSourceUrl: false - }; - }, - - componentWillMount() { - var sourceMapService = this.props.sourceMapService; - if (sourceMapService) { - var source = this.getSource(); - sourceMapService.subscribe(source, this.onSourceUpdated); - } - }, - - componentWillUnmount() { - var sourceMapService = this.props.sourceMapService; - if (sourceMapService) { - var source = this.getSource(); - sourceMapService.unsubscribe(source, this.onSourceUpdated); - } - }, - - /** - * Component method to update the FrameView when a resolved location is available - * @param event - * @param location - */ - onSourceUpdated(event, location, resolvedLocation) { - var frame = this.getFrame(resolvedLocation); - this.setState({ - frame, - isSourceMapped: true - }); - }, - - /** - * Utility method to convert the Frame object to the - * Source Object model required by SourceMapService - * @param frame - * @returns {{url: *, line: *, column: *}} - */ - getSource(frame) { - frame = frame || this.props.frame; - var _frame = frame, - source = _frame.source, - line = _frame.line, - column = _frame.column; - - return { - url: source, - line, - column - }; - }, - - /** - * Utility method to convert the Source object model to the - * Frame object model required by FrameView class. - * @param source - * @returns {{source: *, line: *, column: *, functionDisplayName: *}} - */ - getFrame(source) { - var url = source.url, - line = source.line, - column = source.column; - - return { - source: url, - line, - column, - functionDisplayName: this.props.frame.functionDisplayName - }; - }, - - render() { - var frame = void 0, - isSourceMapped = void 0; - var _props = this.props, - onClick = _props.onClick, - showFunctionName = _props.showFunctionName, - showAnonymousFunctionName = _props.showAnonymousFunctionName, - showHost = _props.showHost, - showEmptyPathAsHost = _props.showEmptyPathAsHost, - showFullSourceUrl = _props.showFullSourceUrl; - - - if (this.state && this.state.isSourceMapped) { - frame = this.state.frame; - isSourceMapped = this.state.isSourceMapped; - } else { - frame = this.props.frame; - } - - var source = frame.source ? String(frame.source) : ""; - var line = frame.line != void 0 ? Number(frame.line) : null; - var column = frame.column != void 0 ? Number(frame.column) : null; - - var _getSourceNames = getSourceNames(source), - short = _getSourceNames.short, - long = _getSourceNames.long, - host = _getSourceNames.host; - // Reparse the URL to determine if we should link this; `getSourceNames` - // has already cached this indirectly. We don't want to attempt to - // link to "self-hosted" and "(unknown)". However, we do want to link - // to Scratchpad URIs. - // Source mapped sources might not necessary linkable, but they - // are still valid in the debugger. - - - var isLinkable = !!(isScratchpadScheme(source) || parseURL(source)) || isSourceMapped; - var elements = []; - var sourceElements = []; - var sourceEl = void 0; - - var tooltip = long; - - // If the source is linkable and line > 0 - var shouldDisplayLine = isLinkable && line; - - // Exclude all falsy values, including `0`, as even - // a number 0 for line doesn't make sense, and should not be displayed. - // If source isn't linkable, don't attempt to append line and column - // info, as this probably doesn't make sense. - if (shouldDisplayLine) { - tooltip += `:${line}`; - // Intentionally exclude 0 - if (column) { - tooltip += `:${column}`; - } - } - - var attributes = { - "data-url": long, - className: "frame-link" - }; - - if (showFunctionName) { - var functionDisplayName = frame.functionDisplayName; - if (!functionDisplayName && showAnonymousFunctionName) { - functionDisplayName = webl10n.getStr("stacktrace.anonymousFunction"); - } - - if (functionDisplayName) { - elements.push(dom.span({ className: "frame-link-function-display-name" }, functionDisplayName), " "); - } - } - - var displaySource = showFullSourceUrl ? long : short; - if (isSourceMapped) { - displaySource = getSourceMappedFile(displaySource); - } else if (showEmptyPathAsHost && (displaySource === "" || displaySource === "/")) { - displaySource = host; - } - - sourceElements.push(dom.span({ - className: "frame-link-filename" - }, displaySource)); - - // If source is linkable, and we have a line number > 0 - if (shouldDisplayLine) { - var lineInfo = `:${line}`; - // Add `data-line` attribute for testing - attributes["data-line"] = line; - - // Intentionally exclude 0 - if (column) { - lineInfo += `:${column}`; - // Add `data-column` attribute for testing - attributes["data-column"] = column; - } - - sourceElements.push(dom.span({ className: "frame-link-line" }, lineInfo)); - } - - // Inner el is useful for achieving ellipsis on the left and correct LTR/RTL - // ordering. See CSS styles for frame-link-source-[inner] and bug 1290056. - var sourceInnerEl = dom.span({ - className: "frame-link-source-inner", - title: isLinkable ? l10n.getFormatStr("frame.viewsourceindebugger", tooltip) : tooltip - }, sourceElements); - - // If source is not a URL (self-hosted, eval, etc.), don't make - // it an anchor link, as we can't link to it. - if (isLinkable) { - sourceEl = dom.a({ - onClick: e => { - e.preventDefault(); - onClick(this.getSource(frame)); - }, - href: source, - className: "frame-link-source", - draggable: false - }, sourceInnerEl); - } else { - sourceEl = dom.span({ - className: "frame-link-source" - }, sourceInnerEl); - } - elements.push(sourceEl); - - if (showHost && host) { - elements.push(" ", dom.span({ className: "frame-link-host" }, host)); - } - - return dom.span.apply(dom, [attributes].concat(elements)); - } - }); - -/***/ }, -/* 847 */ +/* 970 */ /***/ function(module, exports) { - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - - // const { LocalizationHelper } = require("devtools/shared/l10n"); - // - // const l10n = new LocalizationHelper("devtools/client/locales/components.properties"); - // const UNKNOWN_SOURCE_STRING = l10n.getStr("frame.unknownSource"); - - var l10n = { - getStr: () => {} - }; - - // Character codes used in various parsing helper functions. - var CHAR_CODE_A = "a".charCodeAt(0); - var CHAR_CODE_C = "c".charCodeAt(0); - var CHAR_CODE_D = "d".charCodeAt(0); - var CHAR_CODE_E = "e".charCodeAt(0); - var CHAR_CODE_F = "f".charCodeAt(0); - var CHAR_CODE_H = "h".charCodeAt(0); - var CHAR_CODE_I = "i".charCodeAt(0); - var CHAR_CODE_J = "j".charCodeAt(0); - var CHAR_CODE_L = "l".charCodeAt(0); - var CHAR_CODE_M = "m".charCodeAt(0); - var CHAR_CODE_O = "o".charCodeAt(0); - var CHAR_CODE_P = "p".charCodeAt(0); - var CHAR_CODE_R = "r".charCodeAt(0); - var CHAR_CODE_S = "s".charCodeAt(0); - var CHAR_CODE_T = "t".charCodeAt(0); - var CHAR_CODE_U = "u".charCodeAt(0); - var CHAR_CODE_COLON = ":".charCodeAt(0); - var CHAR_CODE_SLASH = "/".charCodeAt(0); - var CHAR_CODE_CAP_S = "S".charCodeAt(0); - - // The cache used in the `parseURL` function. - var gURLStore = new Map(); - // The cache used in the `getSourceNames` function. - var gSourceNamesStore = new Map(); - - /** - * Takes a string and returns an object containing all the properties - * available on an URL instance, with additional properties (fileName), - * Leverages caching. - * - * @param {String} location - * @return {Object?} An object containing most properties available - * in https://developer.mozilla.org/en-US/docs/Web/API/URL - */ - - function parseURL(location) { - var url = gURLStore.get(location); - - if (url !== void 0) { - return url; - } - - try { - url = new URL(location); - // The callers were generally written to expect a URL from - // sdk/url, which is subtly different. So, work around some - // important differences here. - url = { - href: url.href, - protocol: url.protocol, - host: url.host, - hostname: url.hostname, - port: url.port || null, - pathname: url.pathname, - search: url.search, - hash: url.hash, - username: url.username, - password: url.password, - origin: url.origin - }; - - // Definitions: - // Example: https://foo.com:8888/file.js - // `hostname`: "foo.com" - // `host`: "foo.com:8888" - var isChrome = isChromeScheme(location); - - url.fileName = url.pathname ? url.pathname.slice(url.pathname.lastIndexOf("/") + 1) || "/" : "/"; - - if (isChrome) { - url.hostname = null; - url.host = null; - } - - gURLStore.set(location, url); - return url; - } catch (e) { - gURLStore.set(location, null); - return null; - } - } - - /** - * Parse a source into a short and long name as well as a host name. - * - * @param {String} source - * The source to parse. Can be a URI or names like "(eval)" or - * "self-hosted". - * @return {Object} - * An object with the following properties: - * - {String} short: A short name for the source. - * - "http://page.com/test.js#go?q=query" -> "test.js" - * - {String} long: The full, long name for the source, with - hash/query stripped. - * - "http://page.com/test.js#go?q=query" -> "http://page.com/test.js" - * - {String?} host: If available, the host name for the source. - * - "http://page.com/test.js#go?q=query" -> "page.com" - */ - function getSourceNames(source) { - var data = gSourceNamesStore.get(source); - - if (data) { - return data; - } - - var short = void 0, - long = void 0, - host = void 0; - var sourceStr = source ? String(source) : ""; - - // If `data:...` uri - if (isDataScheme(sourceStr)) { - var commaIndex = sourceStr.indexOf(","); - if (commaIndex > -1) { - // The `short` name for a data URI becomes `data:` followed by the actual - // encoded content, omitting the MIME type, and charset. - short = `data:${sourceStr.substring(commaIndex + 1)}`.slice(0, 100); - var _result = { short, long: sourceStr }; - gSourceNamesStore.set(source, _result); - return _result; - } - } - - // If Scratchpad URI, like "Scratchpad/1"; no modifications, - // and short/long are the same. - if (isScratchpadScheme(sourceStr)) { - var _result2 = { short: sourceStr, long: sourceStr }; - gSourceNamesStore.set(source, _result2); - return _result2; - } - - var parsedUrl = parseURL(sourceStr); - - if (!parsedUrl) { - // Malformed URI. - long = sourceStr; - short = sourceStr.slice(0, 100); - } else { - host = parsedUrl.host; - - long = parsedUrl.href; - if (parsedUrl.hash) { - long = long.replace(parsedUrl.hash, ""); - } - if (parsedUrl.search) { - long = long.replace(parsedUrl.search, ""); - } - - short = parsedUrl.fileName; - // If `short` is just a slash, and we actually have a path, - // strip the slash and parse again to get a more useful short name. - // e.g. "http://foo.com/bar/" -> "bar", rather than "/" - if (short === "/" && parsedUrl.pathname !== "/") { - short = parseURL(long.replace(/\/$/, "")).fileName; - } - } - - if (!short) { - if (!long) { - long = UNKNOWN_SOURCE_STRING; - } - short = long.slice(0, 100); - } - - var result = { short, long, host }; - gSourceNamesStore.set(source, result); - return result; - } - - // For the functions below, we assume that we will never access the location - // argument out of bounds, which is indeed the vast majority of cases. - // - // They are written this way because they are hot. Each frame is checked for - // being content or chrome when processing the profile. - - function isColonSlashSlash(location) { - var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - return location.charCodeAt(++i) === CHAR_CODE_COLON && location.charCodeAt(++i) === CHAR_CODE_SLASH && location.charCodeAt(++i) === CHAR_CODE_SLASH; - } - - /** - * Checks for a Scratchpad URI, like "Scratchpad/1" - */ - function isScratchpadScheme(location) { - var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - return location.charCodeAt(i) === CHAR_CODE_CAP_S && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_H && location.charCodeAt(++i) === CHAR_CODE_P && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_D && location.charCodeAt(++i) === CHAR_CODE_SLASH; - } - - function isDataScheme(location) { - var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - return location.charCodeAt(i) === CHAR_CODE_D && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_COLON; - } - - function isContentScheme(location) { - var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - var firstChar = location.charCodeAt(i); - - switch (firstChar) { - // "http://" or "https://" - case CHAR_CODE_H: - if (location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_P) { - if (location.charCodeAt(i + 1) === CHAR_CODE_S) { - ++i; - } - return isColonSlashSlash(location, i); - } - return false; - - // "file://" - case CHAR_CODE_F: - if (location.charCodeAt(++i) === CHAR_CODE_I && location.charCodeAt(++i) === CHAR_CODE_L && location.charCodeAt(++i) === CHAR_CODE_E) { - return isColonSlashSlash(location, i); - } - return false; - - // "app://" - case CHAR_CODE_A: - if (location.charCodeAt(++i) == CHAR_CODE_P && location.charCodeAt(++i) == CHAR_CODE_P) { - return isColonSlashSlash(location, i); - } - return false; - - default: - return false; - } - } - - function isChromeScheme(location) { - var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - var firstChar = location.charCodeAt(i); - - switch (firstChar) { - // "chrome://" - case CHAR_CODE_C: - if (location.charCodeAt(++i) === CHAR_CODE_H && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_O && location.charCodeAt(++i) === CHAR_CODE_M && location.charCodeAt(++i) === CHAR_CODE_E) { - return isColonSlashSlash(location, i); - } - return false; - - // "resource://" - case CHAR_CODE_R: - if (location.charCodeAt(++i) === CHAR_CODE_E && location.charCodeAt(++i) === CHAR_CODE_S && location.charCodeAt(++i) === CHAR_CODE_O && location.charCodeAt(++i) === CHAR_CODE_U && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_E) { - return isColonSlashSlash(location, i); - } - return false; - - // "jar:file://" - case CHAR_CODE_J: - if (location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_COLON && location.charCodeAt(++i) === CHAR_CODE_F && location.charCodeAt(++i) === CHAR_CODE_I && location.charCodeAt(++i) === CHAR_CODE_L && location.charCodeAt(++i) === CHAR_CODE_E) { - return isColonSlashSlash(location, i); - } - return false; - - default: - return false; - } - } - - /** - * A utility method to get the file name from a sourcemapped location - * The sourcemap location can be in any form. This method returns a - * formatted file name for different cases like Windows or OSX. - * @param source - * @returns String - */ - function getSourceMappedFile(source) { - // If sourcemapped source is a OSX path, return - // the characters after last "/". - // If sourcemapped source is a Windowss path, return - // the characters after last "\\". - if (source.lastIndexOf("/") >= 0) { - source = source.slice(source.lastIndexOf("/") + 1); - } else if (source.lastIndexOf("\\") >= 0) { - source = source.slice(source.lastIndexOf("\\") + 1); - } - return source; - } - - exports.parseURL = parseURL; - exports.getSourceNames = getSourceNames; - exports.isScratchpadScheme = isScratchpadScheme; - exports.isChromeScheme = isChromeScheme; - exports.isContentScheme = isContentScheme; - exports.isDataScheme = isDataScheme; - exports.getSourceMappedFile = getSourceMappedFile; - -/***/ }, -/* 848 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - var EventEmitter = __webpack_require__(844); - - /** - * A partial implementation of the Menu API provided by electron: - * https://github.com/electron/electron/blob/master/docs/api/menu.md. - * - * Extra features: - * - Emits an 'open' and 'close' event when the menu is opened/closed - - * @param String id (non standard) - * Needed so tests can confirm the XUL implementation is working - */ - function Menu() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$id = _ref.id, - id = _ref$id === undefined ? null : _ref$id; - - this.menuitems = []; - this.id = id; - - Object.defineProperty(this, "items", { - get() { - return this.menuitems; - } - }); - - EventEmitter.decorate(this); - } - - /** - * Add an item to the end of the Menu - * - * @param {MenuItem} menuItem - */ - Menu.prototype.append = function (menuItem) { - this.menuitems.push(menuItem); - }; - - /** - * Add an item to a specified position in the menu - * - * @param {int} pos - * @param {MenuItem} menuItem - */ - Menu.prototype.insert = function (pos, menuItem) { - throw Error("Not implemented"); - }; - - /** - * Show the Menu at a specified location on the screen - * - * Missing features: - * - browserWindow - BrowserWindow (optional) - Default is null. - * - positioningItem Number - (optional) OS X - * - * @param {int} screenX - * @param {int} screenY - * @param Toolbox toolbox (non standard) - * Needed so we in which window to inject XUL - */ - Menu.prototype.popup = function (screenX, screenY, toolbox) { - var doc = toolbox.doc; - var popupset = doc.querySelector("popupset"); - // See bug 1285229, on Windows, opening the same popup multiple times in a - // row ends up duplicating the popup. The newly inserted popup doesn't - // dismiss the old one. So remove any previously displayed popup before - // opening a new one. - var popup = popupset.querySelector("menupopup[menu-api=\"true\"]"); - if (popup) { - popup.hidePopup(); - } - - popup = this.createPopup(doc); - popup.setAttribute("menu-api", "true"); - - if (this.id) { - popup.id = this.id; - } - this._createMenuItems(popup); - - // Remove the menu from the DOM once it's hidden. - popup.addEventListener("popuphidden", e => { - if (e.target === popup) { - popup.remove(); - this.emit("close", popup); - } - }); - - popup.addEventListener("popupshown", e => { - if (e.target === popup) { - this.emit("open", popup); - } - }); - - popupset.appendChild(popup); - popup.openPopupAtScreen(screenX, screenY, true); - }; - - Menu.prototype.createPopup = function (doc) { - return doc.createElement("menupopup"); - }; - - Menu.prototype._createMenuItems = function (parent) { - var doc = parent.ownerDocument; - this.menuitems.forEach(item => { - if (!item.visible) { - return; - } - - if (item.submenu) { - var menupopup = doc.createElement("menupopup"); - item.submenu._createMenuItems(menupopup); - - var menu = doc.createElement("menu"); - menu.appendChild(menupopup); - menu.setAttribute("label", item.label); - if (item.disabled) { - menu.setAttribute("disabled", "true"); - } - if (item.accesskey) { - menu.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menu.id = item.id; - } - parent.appendChild(menu); - } else if (item.type === "separator") { - var menusep = doc.createElement("menuseparator"); - parent.appendChild(menusep); - } else { - var menuitem = doc.createElement("menuitem"); - menuitem.setAttribute("label", item.label); - menuitem.textContent = item.label; - menuitem.addEventListener("command", () => item.click()); - - if (item.type === "checkbox") { - menuitem.setAttribute("type", "checkbox"); - } - if (item.type === "radio") { - menuitem.setAttribute("type", "radio"); - } - if (item.disabled) { - menuitem.setAttribute("disabled", "true"); - } - if (item.checked) { - menuitem.setAttribute("checked", "true"); - } - if (item.accesskey) { - menuitem.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menuitem.id = item.id; - } - - parent.appendChild(menuitem); - } - }); - }; - - Menu.setApplicationMenu = () => { - throw Error("Not implemented"); - }; - - Menu.sendActionToFirstResponder = () => { - throw Error("Not implemented"); - }; - - Menu.buildFromTemplate = () => { - throw Error("Not implemented"); - }; - - module.exports = Menu; - -/***/ }, -/* 849 */ -/***/ function(module, exports) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; /** @@ -49444,7 +37779,6 @@ return /******/ (function(modules) { // webpackBootstrap * Boolean visible * If false, the menu item will be entirely hidden. */ - function MenuItem() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$accesskey = _ref.accesskey, @@ -49480,29 +37814,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = MenuItem; /***/ }, -/* 850 */ -/***/ function(module, exports) { - - "use strict"; - - // opts is ignored because this is only used in local development and - // replaces a more powerful network request from Firefox that can be - // configured. - function networkRequest(url, opts) { - return Promise.race([fetch(`/get?url=${url}`).then(res => { - if (res.status >= 200 && res.status < 300) { - return res.text().then(text => ({ content: text })); - } - return Promise.reject(new Error(`failed to request ${url}`)); - }), new Promise((resolve, reject) => { - setTimeout(() => reject(new Error("Connect timeout error")), 6000); - })]); - } - - module.exports = networkRequest; - -/***/ }, -/* 851 */ +/* 971 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -49514,7 +37826,7 @@ return /******/ (function(modules) { // webpackBootstrap * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var Services = __webpack_require__(29); - var EventEmitter = __webpack_require__(844); + var EventEmitter = __webpack_require__(968); /** * Shortcuts for lazily accessing and setting various preferences. @@ -49691,145 +38003,18 @@ return /******/ (function(modules) { // webpackBootstrap exports.PrefsHelper = PrefsHelper; /***/ }, -/* 852 */ -/***/ function(module, exports, __webpack_require__) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - /* global window */ - - "use strict"; - - var _require = __webpack_require__(2), - dom = _require.DOM, - createClass = _require.createClass, - PropTypes = _require.PropTypes; - - var _require2 = __webpack_require__(853), - KeyShortcuts = _require2.KeyShortcuts; - - /** - * A generic search box component for use across devtools - */ - - - module.exports = createClass({ - displayName: "SearchBox", - - propTypes: { - delay: PropTypes.number, - keyShortcut: PropTypes.string, - onChange: PropTypes.func, - placeholder: PropTypes.string, - type: PropTypes.string - }, - - getInitialState() { - return { - value: "" - }; - }, - - componentDidMount() { - if (!this.props.keyShortcut) { - return; - } - - this.shortcuts = new KeyShortcuts({ - window - }); - this.shortcuts.on(this.props.keyShortcut, (name, event) => { - event.preventDefault(); - this.refs.input.focus(); - }); - }, - - componentWillUnmount() { - if (this.shortcuts) { - this.shortcuts.destroy(); - } - - // Clean up an existing timeout. - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - }, - - onChange() { - if (this.state.value !== this.refs.input.value) { - this.setState({ value: this.refs.input.value }); - } - - if (!this.props.delay) { - this.props.onChange(this.state.value); - return; - } - - // Clean up an existing timeout before creating a new one. - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - - // Execute the search after a timeout. It makes the UX - // smoother if the user is typing quickly. - this.searchTimeout = setTimeout(() => { - this.searchTimeout = null; - this.props.onChange(this.state.value); - }, this.props.delay); - }, - - onClearButtonClick() { - this.refs.input.value = ""; - this.onChange(); - }, - - render() { - var _props = this.props, - _props$type = _props.type, - type = _props$type === undefined ? "search" : _props$type, - placeholder = _props.placeholder; - var value = this.state.value; - - var divClassList = ["devtools-searchbox", "has-clear-btn"]; - var inputClassList = [`devtools-${type}input`]; - - if (value !== "") { - inputClassList.push("filled"); - } - return dom.div({ className: divClassList.join(" ") }, dom.input({ - className: inputClassList.join(" "), - onChange: this.onChange, - placeholder, - ref: "input", - value - }), dom.button({ - className: "devtools-searchinput-clear", - hidden: value == "", - onClick: this.onClearButtonClick - })); - } - }); - -/***/ }, -/* 853 */ +/* 972 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var _require = __webpack_require__(29), appinfo = _require.appinfo; - var EventEmitter = __webpack_require__(844); + var EventEmitter = __webpack_require__(968); var isOSX = appinfo.OS === "Darwin"; - "use strict"; // List of electron keys mapped to DOM API (DOM_VK_*) key code var ElectronKeysMapping = { @@ -50072,342 +38257,17 @@ return /******/ (function(modules) { // webpackBootstrap exports.KeyShortcuts = KeyShortcuts; /***/ }, -/* 854 */ -/***/ function(module, exports, __webpack_require__) { +/* 973 */ +/***/ function(module, exports) { - "use strict"; - - var React = __webpack_require__(2); - var ReactDOM = __webpack_require__(22); - var Draggable = React.createFactory(__webpack_require__(855)); - var dom = React.DOM, - PropTypes = React.PropTypes; - - /** - * This component represents a Splitter. The splitter supports vertical - * as well as horizontal mode. - */ - - var SplitBox = React.createClass({ - - propTypes: { - // Custom class name. You can use more names separated by a space. - className: PropTypes.string, - // Initial size of controlled panel. - initialSize: PropTypes.any, - // Optional initial width of controlled panel. - initialWidth: PropTypes.number, - // Optional initial height of controlled panel. - initialHeight: PropTypes.number, - // Left/top panel - startPanel: PropTypes.any, - // Left/top panel collapse state. - startPanelCollapsed: PropTypes.bool, - // Min panel size. - minSize: PropTypes.any, - // Max panel size. - maxSize: PropTypes.any, - // Right/bottom panel - endPanel: PropTypes.any, - // Right/bottom panel collapse state. - endPanelCollapsed: PropTypes.bool, - // True if the right/bottom panel should be controlled. - endPanelControl: PropTypes.bool, - // Size of the splitter handle bar. - splitterSize: PropTypes.number, - // True if the splitter bar is vertical (default is vertical). - vert: PropTypes.bool, - // Optional style properties passed into the splitbox - style: PropTypes.object - }, - - displayName: "SplitBox", - - getDefaultProps() { - return { - splitterSize: 5, - vert: true, - endPanelControl: false, - endPanelCollapsed: false, - startPanelCollapsed: false - }; - }, - - /** - * The state stores the current orientation (vertical or horizontal) - * and the current size (width/height). All these values can change - * during the component's life time. - */ - getInitialState() { - return { - vert: this.props.vert, - // We use integers for these properties - width: parseInt(this.props.initialWidth || this.props.initialSize), - height: parseInt(this.props.initialHeight || this.props.initialSize) - }; - }, - - componentWillReceiveProps(nextProps) { - if (this.props.vert !== nextProps.vert) { - this.setState({ vert: nextProps.vert }); - } - }, - - // Dragging Events - - /** - * Set 'resizing' cursor on entire document during splitter dragging. - * This avoids cursor-flickering that happens when the mouse leaves - * the splitter bar area (happens frequently). - */ - onStartMove() { - var splitBox = ReactDOM.findDOMNode(this); - var doc = splitBox.ownerDocument; - var defaultCursor = doc.documentElement.style.cursor; - doc.documentElement.style.cursor = this.state.vert ? "ew-resize" : "ns-resize"; - - splitBox.classList.add("dragging"); - - this.setState({ - defaultCursor: defaultCursor - }); - }, - - onStopMove() { - var splitBox = ReactDOM.findDOMNode(this); - var doc = splitBox.ownerDocument; - doc.documentElement.style.cursor = this.state.defaultCursor; - - splitBox.classList.remove("dragging"); - }, - - /** - * Adjust size of the controlled panel. Depending on the current - * orientation we either remember the width or height of - * the splitter box. - */ - onMove(_ref) { - var movementX = _ref.movementX, - movementY = _ref.movementY; - - var node = ReactDOM.findDOMNode(this); - var doc = node.ownerDocument; - - if (this.props.endPanelControl) { - // For the end panel we need to increase the width/height when the - // movement is towards the left/top. - movementX = -movementX; - movementY = -movementY; - } - - if (this.state.vert) { - var isRtl = doc.dir === "rtl"; - if (isRtl) { - // In RTL we need to reverse the movement again -- but only for vertical - // splitters - movementX = -movementX; - } - - this.setState((state, props) => ({ - width: state.width + movementX - })); - } else { - this.setState((state, props) => ({ - height: state.height + movementY - })); - } - }, - - // Rendering - preparePanelStyles() { - var vert = this.state.vert; - var _props = this.props, - minSize = _props.minSize, - maxSize = _props.maxSize, - startPanelCollapsed = _props.startPanelCollapsed, - endPanelControl = _props.endPanelControl, - endPanelCollapsed = _props.endPanelCollapsed; - - var leftPanelStyle = void 0, - rightPanelStyle = void 0; - - // Set proper size for panels depending on the current state. - if (vert) { - var startWidth = endPanelControl ? null : this.state.width, - endWidth = endPanelControl ? this.state.width : null; - - leftPanelStyle = { - maxWidth: endPanelControl ? null : maxSize, - minWidth: endPanelControl ? null : minSize, - width: startPanelCollapsed ? 0 : startWidth - }; - rightPanelStyle = { - maxWidth: endPanelControl ? maxSize : null, - minWidth: endPanelControl ? minSize : null, - width: endPanelCollapsed ? 0 : endWidth - }; - } else { - var startHeight = endPanelControl ? null : this.state.height, - endHeight = endPanelControl ? this.state.height : null; - - leftPanelStyle = { - maxHeight: endPanelControl ? null : maxSize, - minHeight: endPanelControl ? null : minSize, - height: endPanelCollapsed ? maxSize : startHeight - }; - rightPanelStyle = { - maxHeight: endPanelControl ? maxSize : null, - minHeight: endPanelControl ? minSize : null, - height: startPanelCollapsed ? maxSize : endHeight - }; - } - - return { leftPanelStyle, rightPanelStyle }; - }, - - render() { - var vert = this.state.vert; - var _props2 = this.props, - startPanelCollapsed = _props2.startPanelCollapsed, - startPanel = _props2.startPanel, - endPanel = _props2.endPanel, - endPanelControl = _props2.endPanelControl, - splitterSize = _props2.splitterSize, - endPanelCollapsed = _props2.endPanelCollapsed; - - - var style = Object.assign({}, this.props.style); - - // Calculate class names list. - var classNames = ["split-box"]; - classNames.push(vert ? "vert" : "horz"); - if (this.props.className) { - classNames = classNames.concat(this.props.className.split(" ")); - } - - var _preparePanelStyles = this.preparePanelStyles(), - leftPanelStyle = _preparePanelStyles.leftPanelStyle, - rightPanelStyle = _preparePanelStyles.rightPanelStyle; - - // Calculate splitter size - - - var splitterStyle = { - flex: `0 0 ${splitterSize}px` - }; - - return dom.div({ - className: classNames.join(" "), - style: style }, !startPanelCollapsed ? dom.div({ - className: endPanelControl ? "uncontrolled" : "controlled", - style: leftPanelStyle }, startPanel) : null, Draggable({ - className: "splitter", - style: splitterStyle, - onStart: this.onStartMove, - onStop: this.onStopMove, - onMove: this.onMove - }), !endPanelCollapsed ? dom.div({ - className: endPanelControl ? "controlled" : "uncontrolled", - style: rightPanelStyle }, endPanel) : null); - } - }); - - module.exports = SplitBox; + // removed by extract-text-webpack-plugin /***/ }, -/* 855 */ +/* 974 */, +/* 975 */ /***/ function(module, exports, __webpack_require__) { - "use strict"; - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - var React = __webpack_require__(2); - var ReactDOM = __webpack_require__(22); - var dom = React.DOM, - PropTypes = React.PropTypes; - - - var Draggable = React.createClass({ - displayName: "Draggable", - - propTypes: { - onMove: PropTypes.func.isRequired, - onStart: PropTypes.func, - onStop: PropTypes.func, - style: PropTypes.object, - className: PropTypes.string - }, - - startDragging(ev) { - ev.preventDefault(); - var doc = ReactDOM.findDOMNode(this).ownerDocument; - doc.addEventListener("mousemove", this.onMove); - doc.addEventListener("mouseup", this.onUp); - this.props.onStart && this.props.onStart(); - }, - - onMove(ev) { - ev.preventDefault(); - // We pass the whole event because we don't know which properties - // the callee needs. - this.props.onMove(ev); - }, - - onUp(ev) { - ev.preventDefault(); - var doc = ReactDOM.findDOMNode(this).ownerDocument; - doc.removeEventListener("mousemove", this.onMove); - doc.removeEventListener("mouseup", this.onUp); - this.props.onStop && this.props.onStop(); - }, - - render() { - return dom.div({ - style: this.props.style, - className: this.props.className, - onMouseDown: this.startDragging - }); - } - }); - - module.exports = Draggable; - -/***/ }, -/* 856 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - /** - * Copyright (c) 2007-2016, Alexandru Marasteanu - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of this software nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ + var __WEBPACK_AMD_DEFINE_RESULT__;'use strict'; /* globals window, exports, define */ @@ -50647,1685 +38507,65 @@ return /******/ (function(modules) { // webpackBootstrap if (true) { exports.sprintf = sprintf; exports.vsprintf = vsprintf; - } else { + } + if (typeof window !== 'undefined') { window.sprintf = sprintf; window.vsprintf = vsprintf; - if (typeof define === 'function' && define.amd) { - define(function () { + if (true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return { sprintf: sprintf, vsprintf: vsprintf }; - }); + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } } })(typeof window === 'undefined' ? undefined : window); /***/ }, -/* 857 */ +/* 976 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + var _require = __webpack_require__(977), + DebuggerClient = _require.DebuggerClient; - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ + var _require2 = __webpack_require__(986), + DebuggerTransport = _require2.DebuggerTransport; - var _require = __webpack_require__(2), - dom = _require.DOM, - createClass = _require.createClass, - createFactory = _require.createFactory, - PropTypes = _require.PropTypes; - // const { ViewHelpers } = - // require("resource://devtools/client/shared/widgets/ViewHelpers.jsm"); - // let { VirtualScroll } = require("react-virtualized"); - // VirtualScroll = createFactory(VirtualScroll); + var WebsocketTransport = __webpack_require__(990); - var AUTO_EXPAND_DEPTH = 0; // depth - - /** - * An arrow that displays whether its node is expanded (▼) or collapsed - * (▶). When its node has no children, it is hidden. - */ - var ArrowExpander = createFactory(createClass({ - displayName: "ArrowExpander", - - shouldComponentUpdate(nextProps, nextState) { - return this.props.item !== nextProps.item || this.props.visible !== nextProps.visible || this.props.expanded !== nextProps.expanded; - }, - - render() { - var attrs = { - className: "arrow theme-twisty", - onClick: this.props.expanded ? () => this.props.onCollapse(this.props.item) : e => this.props.onExpand(this.props.item, e.altKey) - }; - - if (this.props.expanded) { - attrs.className += " open"; - } - - if (!this.props.visible) { - attrs.style = Object.assign({}, this.props.style || {}, { - visibility: "hidden" - }); - } - - return dom.div(attrs, this.props.children); - } - })); - - var TreeNode = createFactory(createClass({ - displayName: "TreeNode", - - componentDidMount() { - if (this.props.focused) { - this.refs.button.focus(); - } - }, - - componentDidUpdate() { - if (this.props.focused) { - this.refs.button.focus(); - } - }, - - shouldComponentUpdate(nextProps) { - return this.props.item !== nextProps.item || this.props.focused !== nextProps.focused || this.props.expanded !== nextProps.expanded; - }, - - render() { - var arrow = ArrowExpander({ - item: this.props.item, - expanded: this.props.expanded, - visible: this.props.hasChildren, - onExpand: this.props.onExpand, - onCollapse: this.props.onCollapse - }); - - var isOddRow = this.props.index % 2; - return dom.div({ - className: `tree-node div ${isOddRow ? "tree-node-odd" : ""}`, - onFocus: this.props.onFocus, - onClick: this.props.onFocus, - onBlur: this.props.onBlur, - style: { - padding: 0, - margin: 0 - } - }, this.props.renderItem(this.props.item, this.props.depth, this.props.focused, arrow, this.props.expanded), - - // XXX: OSX won't focus/blur regular elements even if you set tabindex - // unless there is an input/button child. - dom.button(this._buttonAttrs)); - }, - - _buttonAttrs: { - ref: "button", - style: { - opacity: 0, - width: "0 !important", - height: "0 !important", - padding: "0 !important", - outline: "none", - MozAppearance: "none", - // XXX: Despite resetting all of the above properties (and margin), the - // button still ends up with ~79px width, so we set a large negative - // margin to completely hide it. - MozMarginStart: "-1000px !important" - } - } - })); - - /** - * Create a function that calls the given function `fn` only once per animation - * frame. - * - * @param {Function} fn - * @returns {Function} - */ - function oncePerAnimationFrame(fn) { - var animationId = null; - var argsToPass = null; - return function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - argsToPass = args; - if (animationId !== null) { - return; - } - - animationId = requestAnimationFrame(() => { - fn.call.apply(fn, [this].concat(_toConsumableArray(argsToPass))); - animationId = null; - argsToPass = null; - }); - }; - } - - var NUMBER_OF_OFFSCREEN_ITEMS = 1; - - /** - * A generic tree component. See propTypes for the public API. - * - * @see `devtools/client/memory/components/test/mochitest/head.js` for usage - * @see `devtools/client/memory/components/heap.js` for usage - */ - var Tree = module.exports = createClass({ - displayName: "Tree", - - propTypes: { - // Required props - - // A function to get an item's parent, or null if it is a root. - getParent: PropTypes.func.isRequired, - // A function to get an item's children. - getChildren: PropTypes.func.isRequired, - // A function which takes an item and ArrowExpander and returns a - // component. - renderItem: PropTypes.func.isRequired, - // A function which returns the roots of the tree (forest). - getRoots: PropTypes.func.isRequired, - // A function to get a unique key for the given item. - getKey: PropTypes.func.isRequired, - // A function to get whether an item is expanded or not. If an item is not - // expanded, then it must be collapsed. - isExpanded: PropTypes.func.isRequired, - // The height of an item in the tree including margin and padding, in - // pixels. - itemHeight: PropTypes.number.isRequired, - - // Optional props - - // The currently focused item, if any such item exists. - focused: PropTypes.any, - // Handle when a new item is focused. - onFocus: PropTypes.func, - // The depth to which we should automatically expand new items. - autoExpandDepth: PropTypes.number, - // Should auto expand all new items or just the new items under the first - // root item. - autoExpandAll: PropTypes.bool, - // Optional event handlers for when items are expanded or collapsed. - onExpand: PropTypes.func, - onCollapse: PropTypes.func - }, - - getDefaultProps() { - return { - autoExpandDepth: AUTO_EXPAND_DEPTH, - autoExpandAll: true - }; - }, - - getInitialState() { - return { - scroll: 0, - height: window.innerHeight, - seen: new Set() - }; - }, - - componentDidMount() { - window.addEventListener("resize", this._updateHeight); - this._autoExpand(this.props); - this._updateHeight(); - }, - - componentWillUnmount() { - window.removeEventListener("resize", this._updateHeight); - }, - - componentWillReceiveProps(nextProps) { - this._autoExpand(nextProps); - this._updateHeight(); - }, - - _autoExpand(props) { - if (!props.autoExpandDepth) { - return; - } - - // Automatically expand the first autoExpandDepth levels for new items. Do - // not use the usual DFS infrastructure because we don't want to ignore - // collapsed nodes. - var autoExpand = (item, currentDepth) => { - if (currentDepth >= props.autoExpandDepth || this.state.seen.has(item)) { - return; - } - - props.onExpand(item); - this.state.seen.add(item); - - var children = props.getChildren(item); - var length = children.length; - for (var i = 0; i < length; i++) { - autoExpand(children[i], currentDepth + 1); - } - }; - - var roots = props.getRoots(); - var length = roots.length; - if (props.autoExpandAll) { - for (var i = 0; i < length; i++) { - autoExpand(roots[i], 0); - } - } else if (length != 0) { - autoExpand(roots[0], 0); - } - }, - - render() { - var traversal = this._dfsFromRoots(); - - // Remove `NUMBER_OF_OFFSCREEN_ITEMS` from `begin` and add `2 * - // NUMBER_OF_OFFSCREEN_ITEMS` to `end` so that the top and bottom of the - // page are filled with the `NUMBER_OF_OFFSCREEN_ITEMS` previous and next - // items respectively, rather than whitespace if the item is not in full - // view. - // const begin = Math.max(((this.state.scroll / this.props.itemHeight) | 0) - NUMBER_OF_OFFSCREEN_ITEMS, 0); - // const end = begin + (2 * NUMBER_OF_OFFSCREEN_ITEMS) + ((this.state.height / this.props.itemHeight) | 0); - // const toRender = traversal; - - // const nodes = [ - // dom.div({ - // key: "top-spacer", - // style: { - // padding: 0, - // margin: 0, - // height: begin * this.props.itemHeight + "px" - // } - // }) - // ]; - - var renderItem = i => { - var _traversal$i = traversal[i], - item = _traversal$i.item, - depth = _traversal$i.depth; - - return TreeNode({ - key: this.props.getKey(item, i), - index: i, - item: item, - depth: depth, - renderItem: this.props.renderItem, - focused: this.props.focused === item, - expanded: this.props.isExpanded(item), - hasChildren: !!this.props.getChildren(item).length, - onExpand: this._onExpand, - onCollapse: this._onCollapse, - onFocus: () => this._focus(i, item) - }); - }; - - // nodes.push(dom.div({ - // key: "bottom-spacer", - // style: { - // padding: 0, - // margin: 0, - // height: (traversal.length - 1 - end) * this.props.itemHeight + "px" - // } - // })); - - var style = Object.assign({}, this.props.style || {}, { - padding: 0, - margin: 0 - }); - - return dom.div({ - className: "tree", - ref: "tree", - onKeyDown: this._onKeyDown, - onKeyPress: this._preventArrowKeyScrolling, - onKeyUp: this._preventArrowKeyScrolling, - onScroll: this._onScroll, - style - }, - // VirtualScroll({ - // width: this.props.width, - // height: this.props.height, - // rowsCount: traversal.length, - // rowHeight: this.props.itemHeight, - // rowRenderer: renderItem - // }) - traversal.map((v, i) => renderItem(i))); - }, - - _preventArrowKeyScrolling(e) { - switch (e.key) { - case "ArrowUp": - case "ArrowDown": - case "ArrowLeft": - case "ArrowRight": - e.preventDefault(); - e.stopPropagation(); - if (e.nativeEvent) { - if (e.nativeEvent.preventDefault) { - e.nativeEvent.preventDefault(); - } - if (e.nativeEvent.stopPropagation) { - e.nativeEvent.stopPropagation(); - } - } - } - }, - - /** - * Updates the state's height based on clientHeight. - */ - _updateHeight() { - this.setState({ - height: this.refs.tree.clientHeight - }); - }, - - /** - * Perform a pre-order depth-first search from item. - */ - _dfs(item) { - var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity; - var traversal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - - var _depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; - - traversal.push({ item, depth: _depth }); - - if (!this.props.isExpanded(item)) { - return traversal; - } - - var nextDepth = _depth + 1; - - if (nextDepth > maxDepth) { - return traversal; - } - - var children = this.props.getChildren(item); - var length = children.length; - for (var i = 0; i < length; i++) { - this._dfs(children[i], maxDepth, traversal, nextDepth); - } - - return traversal; - }, - - /** - * Perform a pre-order depth-first search over the whole forest. - */ - _dfsFromRoots() { - var maxDepth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; - - var traversal = []; - - var roots = this.props.getRoots(); - var length = roots.length; - for (var i = 0; i < length; i++) { - this._dfs(roots[i], maxDepth, traversal); - } - - return traversal; - }, - - /** - * Expands current row. - * - * @param {Object} item - * @param {Boolean} expandAllChildren - */ - _onExpand: oncePerAnimationFrame(function (item, expandAllChildren) { - if (this.props.onExpand) { - this.props.onExpand(item); - - if (expandAllChildren) { - var children = this._dfs(item); - var length = children.length; - for (var i = 0; i < length; i++) { - this.props.onExpand(children[i].item); - } - } - } - }), - - /** - * Collapses current row. - * - * @param {Object} item - */ - _onCollapse: oncePerAnimationFrame(function (item) { - if (this.props.onCollapse) { - this.props.onCollapse(item); - } - }), - - /** - * Sets the passed in item to be the focused item. - * - * @param {Number} index - * The index of the item in a full DFS traversal (ignoring collapsed - * nodes). Ignored if `item` is undefined. - * - * @param {Object|undefined} item - * The item to be focused, or undefined to focus no item. - */ - _focus(index, item) { - if (item !== undefined) { - var itemStartPosition = index * this.props.itemHeight; - var itemEndPosition = (index + 1) * this.props.itemHeight; - - // Note that if the height of the viewport (this.state.height) is less than - // `this.props.itemHeight`, we could accidentally try and scroll both up and - // down in a futile attempt to make both the item's start and end positions - // visible. Instead, give priority to the start of the item by checking its - // position first, and then using an "else if", rather than a separate "if", - // for the end position. - if (this.state.scroll > itemStartPosition) { - this.refs.tree.scrollTop = itemStartPosition; - } else if (this.state.scroll + this.state.height < itemEndPosition) { - this.refs.tree.scrollTop = itemEndPosition - this.state.height; - } - } - - if (this.props.onFocus) { - this.props.onFocus(item); - } - }, - - /** - * Sets the state to have no focused item. - */ - _onBlur() { - this._focus(0, undefined); - }, - - /** - * Fired on a scroll within the tree's container, updates - * the stored position of the view port to handle virtual view rendering. - * - * @param {Event} e - */ - _onScroll: oncePerAnimationFrame(function (e) { - this.setState({ - scroll: Math.max(this.refs.tree.scrollTop, 0), - height: this.refs.tree.clientHeight - }); - }), - - /** - * Handles key down events in the tree's container. - * - * @param {Event} e - */ - _onKeyDown(e) { - if (this.props.focused == null) { - return; - } - - // Allow parent nodes to use navigation arrows with modifiers. - if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) { - return; - } - - this._preventArrowKeyScrolling(e); - - switch (e.key) { - case "ArrowUp": - this._focusPrevNode(); - return; - - case "ArrowDown": - this._focusNextNode(); - return; - - case "ArrowLeft": - if (this.props.isExpanded(this.props.focused) && this.props.getChildren(this.props.focused).length) { - this._onCollapse(this.props.focused); - } else { - this._focusParentNode(); - } - return; - - case "ArrowRight": - if (!this.props.isExpanded(this.props.focused)) { - this._onExpand(this.props.focused); - } - return; - } - }, - - /** - * Sets the previous node relative to the currently focused item, to focused. - */ - _focusPrevNode: oncePerAnimationFrame(function () { - // Start a depth first search and keep going until we reach the currently - // focused node. Focus the previous node in the DFS, if it exists. If it - // doesn't exist, we're at the first node already. - - var prev = void 0; - var prevIndex = void 0; - - var traversal = this._dfsFromRoots(); - var length = traversal.length; - for (var i = 0; i < length; i++) { - var item = traversal[i].item; - if (item === this.props.focused) { - break; - } - prev = item; - prevIndex = i; - } - - if (prev === undefined) { - return; - } - - this._focus(prevIndex, prev); - }), - - /** - * Handles the down arrow key which will focus either the next child - * or sibling row. - */ - _focusNextNode: oncePerAnimationFrame(function () { - // Start a depth first search and keep going until we reach the currently - // focused node. Focus the next node in the DFS, if it exists. If it - // doesn't exist, we're at the last node already. - - var traversal = this._dfsFromRoots(); - var length = traversal.length; - var i = 0; - - while (i < length) { - if (traversal[i].item === this.props.focused) { - break; - } - i++; - } - - if (i + 1 < traversal.length) { - this._focus(i + 1, traversal[i + 1].item); - } - }), - - /** - * Handles the left arrow key, going back up to the current rows' - * parent row. - */ - _focusParentNode: oncePerAnimationFrame(function () { - var parent = this.props.getParent(this.props.focused); - if (!parent) { - return; - } - - var traversal = this._dfsFromRoots(); - var length = traversal.length; - var parentIndex = 0; - for (; parentIndex < length; parentIndex++) { - if (traversal[parentIndex].item === parent) { - break; - } - } - - this._focus(parentIndex, parent); - }) - }); - -/***/ }, -/* 858 */ -/***/ function(module, exports, __webpack_require__) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - var EventEmitter = __webpack_require__(844); - - function WebSocketDebuggerTransport(socket) { - EventEmitter.decorate(this); - - this.active = false; - this.hooks = null; - this.socket = socket; - } - - WebSocketDebuggerTransport.prototype = { - ready() { - if (this.active) { - return; - } - - this.socket.addEventListener("message", this); - this.socket.addEventListener("close", this); - - this.active = true; - }, - - send(object) { - this.emit("send", object); - if (this.socket) { - this.socket.send(JSON.stringify(object)); - } - }, - - startBulkSend() { - throw new Error("Bulk send is not supported by WebSocket transport"); - }, - - close() { - this.emit("close"); - this.active = false; - - this.socket.removeEventListener("message", this); - this.socket.removeEventListener("close", this); - this.socket.close(); - this.socket = null; - - if (this.hooks) { - this.hooks.onClosed(); - this.hooks = null; - } - }, - - handleEvent(event) { - switch (event.type) { - case "message": - this.onMessage(event); - break; - case "close": - this.close(); - break; - } - }, - - onMessage(_ref) { - var data = _ref.data; - - if (typeof data !== "string") { - throw new Error("Binary messages are not supported by WebSocket transport"); - } - - var object = JSON.parse(data); - this.emit("packet", object); - if (this.hooks) { - this.hooks.onPacket(object); - } - } - }; - - module.exports = WebSocketDebuggerTransport; - -/***/ }, -/* 859 */ -/***/ function(module, exports) { - - "use strict"; - - var msgId = 1; - function workerTask(worker, method) { - return function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return new Promise((resolve, reject) => { - var id = msgId++; - worker.postMessage({ id, method, args }); - - var listener = (_ref) => { - var result = _ref.data; - - if (result.id !== id) { - return; - } - - worker.removeEventListener("message", listener); - if (result.error) { - reject(result.error); - } else { - resolve(result.response); - } - }; - - worker.addEventListener("message", listener); - }); - }; - } + var _require3 = __webpack_require__(991), + TargetFactory = _require3.TargetFactory; module.exports = { - workerTask + DebuggerClient, + DebuggerTransport, + TargetFactory, + WebsocketTransport }; /***/ }, -/* 860 */ -/***/ function(module, exports, __webpack_require__) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var NET_STRINGS_URI = "devtools/client/locales/netmonitor.properties"; - var SVG_NS = "http://www.w3.org/2000/svg"; - var PI = Math.PI; - var TAU = PI * 2; - var EPSILON = 0.0000001; - var NAMED_SLICE_MIN_ANGLE = TAU / 8; - var NAMED_SLICE_TEXT_DISTANCE_RATIO = 1.9; - var HOVERED_SLICE_TRANSLATE_DISTANCE_RATIO = 20; - - var EventEmitter = __webpack_require__(844); - - /** - * A factory for creating charts. - * Example usage: let myChart = Chart.Pie(document, { ... }); - */ - var Chart = { - Pie: createPieChart, - Table: createTableChart, - PieTable: createPieTableChart - }; - - /** - * A simple pie chart proxy for the underlying view. - * Each item in the `slices` property represents a [data, node] pair containing - * the data used to create the slice and the nsIDOMNode displaying it. - * - * @param nsIDOMNode node - * The node representing the view for this chart. - */ - function PieChart(node) { - this.node = node; - this.slices = new WeakMap(); - EventEmitter.decorate(this); - } - - /** - * A simple table chart proxy for the underlying view. - * Each item in the `rows` property represents a [data, node] pair containing - * the data used to create the row and the nsIDOMNode displaying it. - * - * @param nsIDOMNode node - * The node representing the view for this chart. - */ - function TableChart(node) { - this.node = node; - this.rows = new WeakMap(); - EventEmitter.decorate(this); - } - - /** - * A simple pie+table chart proxy for the underlying view. - * - * @param nsIDOMNode node - * The node representing the view for this chart. - * @param PieChart pie - * The pie chart proxy. - * @param TableChart table - * The table chart proxy. - */ - function PieTableChart(node, pie, table) { - this.node = node; - this.pie = pie; - this.table = table; - EventEmitter.decorate(this); - } - - /** - * Creates the DOM for a pie+table chart. - * - * @param nsIDocument document - * The document responsible with creating the DOM. - * @param object - * An object containing all or some of the following properties: - * - title: a string displayed as the table chart's (description)/local - * - diameter: the diameter of the pie chart, in pixels - * - data: an array of items used to display each slice in the pie - * and each row in the table; - * @see `createPieChart` and `createTableChart` for details. - * - strings: @see `createTableChart` for details. - * - totals: @see `createTableChart` for details. - * - sorted: a flag specifying if the `data` should be sorted - * ascending by `size`. - * @return PieTableChart - * A pie+table chart proxy instance, which emits the following events: - * - "mouseover", when the mouse enters a slice or a row - * - "mouseout", when the mouse leaves a slice or a row - * - "click", when the mouse enters a slice or a row - */ - function createPieTableChart(document, _ref) { - var title = _ref.title, - diameter = _ref.diameter, - data = _ref.data, - strings = _ref.strings, - totals = _ref.totals, - sorted = _ref.sorted, - header = _ref.header; - - if (data && sorted) { - data = data.slice().sort((a, b) => +(a.size < b.size)); - } - - var pie = Chart.Pie(document, { - width: diameter, - data: data - }); - - var table = Chart.Table(document, { - title: title, - data: data, - strings: strings, - totals: totals, - header: header - }); - - var container = document.createElement("div"); - container.className = "pie-table-chart-container"; - container.appendChild(pie.node); - container.appendChild(table.node); - - var proxy = new PieTableChart(container, pie, table); - - pie.on("click", (event, item) => { - proxy.emit(event, item); - }); - - table.on("click", (event, item) => { - proxy.emit(event, item); - }); - - pie.on("mouseover", (event, item) => { - proxy.emit(event, item); - if (table.rows.has(item)) { - table.rows.get(item).setAttribute("focused", ""); - } - }); - - pie.on("mouseout", (event, item) => { - proxy.emit(event, item); - if (table.rows.has(item)) { - table.rows.get(item).removeAttribute("focused"); - } - }); - - table.on("mouseover", (event, item) => { - proxy.emit(event, item); - if (pie.slices.has(item)) { - pie.slices.get(item).setAttribute("focused", ""); - } - }); - - table.on("mouseout", (event, item) => { - proxy.emit(event, item); - if (pie.slices.has(item)) { - pie.slices.get(item).removeAttribute("focused"); - } - }); - - return proxy; - } - - /** - * Creates the DOM for a pie chart based on the specified properties. - * - * @param nsIDocument document - * The document responsible with creating the DOM. - * @param object - * An object containing all or some of the following properties: - * - data: an array of items used to display each slice; all the items - * should be objects containing a `size` and a `label` property. - * e.g: [{ - * size: 1, - * label: "foo" - * }, { - * size: 2, - * label: "bar" - * }]; - * - width: the width of the chart, in pixels - * - height: optional, the height of the chart, in pixels. - * - centerX: optional, the X-axis center of the chart, in pixels. - * - centerY: optional, the Y-axis center of the chart, in pixels. - * - radius: optional, the radius of the chart, in pixels. - * @return PieChart - * A pie chart proxy instance, which emits the following events: - * - "mouseover", when the mouse enters a slice - * - "mouseout", when the mouse leaves a slice - * - "click", when the mouse clicks a slice - */ - function createPieChart(document, _ref2) { - var data = _ref2.data, - width = _ref2.width, - height = _ref2.height, - centerX = _ref2.centerX, - centerY = _ref2.centerY, - radius = _ref2.radius; - - height = height || width; - centerX = centerX || width / 2; - centerY = centerY || height / 2; - radius = radius || (width + height) / 4; - var isPlaceholder = false; - - // Filter out very small sizes, as they'll just render invisible slices. - data = data ? data.filter(e => e.size > EPSILON) : null; - - // If there's no data available, display an empty placeholder. - if (!data) { - data = loadingPieChartData(); - isPlaceholder = true; - } - if (!data.length) { - data = emptyPieChartData(); - isPlaceholder = true; - } - - var container = document.createElementNS(SVG_NS, "svg"); - container.setAttribute("class", "generic-chart-container pie-chart-container"); - container.setAttribute("pack", "center"); - container.setAttribute("flex", "1"); - container.setAttribute("width", width); - container.setAttribute("height", height); - container.setAttribute("viewBox", "0 0 " + width + " " + height); - container.setAttribute("slices", data.length); - container.setAttribute("placeholder", isPlaceholder); - - var proxy = new PieChart(container); - - var total = data.reduce((acc, e) => acc + e.size, 0); - var angles = data.map(e => e.size / total * (TAU - EPSILON)); - var largest = data.reduce((a, b) => a.size > b.size ? a : b); - var smallest = data.reduce((a, b) => a.size < b.size ? a : b); - - var textDistance = radius / NAMED_SLICE_TEXT_DISTANCE_RATIO; - var translateDistance = radius / HOVERED_SLICE_TRANSLATE_DISTANCE_RATIO; - var startAngle = TAU; - var endAngle = 0; - var midAngle = 0; - radius -= translateDistance; - - for (var i = data.length - 1; i >= 0; i--) { - var sliceInfo = data[i]; - var sliceAngle = angles[i]; - if (!sliceInfo.size || sliceAngle < EPSILON) { - continue; - } - - endAngle = startAngle - sliceAngle; - midAngle = (startAngle + endAngle) / 2; - - var x1 = centerX + radius * Math.sin(startAngle); - var y1 = centerY - radius * Math.cos(startAngle); - var x2 = centerX + radius * Math.sin(endAngle); - var y2 = centerY - radius * Math.cos(endAngle); - var largeArcFlag = Math.abs(startAngle - endAngle) > PI ? 1 : 0; - - var pathNode = document.createElementNS(SVG_NS, "path"); - pathNode.setAttribute("class", "pie-chart-slice chart-colored-blob"); - pathNode.setAttribute("name", sliceInfo.label); - pathNode.setAttribute("d", " M " + centerX + "," + centerY + " L " + x2 + "," + y2 + " A " + radius + "," + radius + " 0 " + largeArcFlag + " 1 " + x1 + "," + y1 + " Z"); - - if (sliceInfo == largest) { - pathNode.setAttribute("largest", ""); - } - if (sliceInfo == smallest) { - pathNode.setAttribute("smallest", ""); - } - - var hoverX = translateDistance * Math.sin(midAngle); - var hoverY = -translateDistance * Math.cos(midAngle); - var hoverTransform = "transform: translate(" + hoverX + "px, " + hoverY + "px)"; - pathNode.setAttribute("style", data.length > 1 ? hoverTransform : ""); - - proxy.slices.set(sliceInfo, pathNode); - delegate(proxy, ["click", "mouseover", "mouseout"], pathNode, sliceInfo); - container.appendChild(pathNode); - - if (sliceInfo.label && sliceAngle > NAMED_SLICE_MIN_ANGLE) { - var textX = centerX + textDistance * Math.sin(midAngle); - var textY = centerY - textDistance * Math.cos(midAngle); - var label = document.createElementNS(SVG_NS, "text"); - label.appendChild(document.createTextNode(sliceInfo.label)); - label.setAttribute("class", "pie-chart-label"); - label.setAttribute("style", data.length > 1 ? hoverTransform : ""); - label.setAttribute("x", data.length > 1 ? textX : centerX); - label.setAttribute("y", data.length > 1 ? textY : centerY); - container.appendChild(label); - } - - startAngle = endAngle; - } - - return proxy; - } - - /** - * Creates the DOM for a table chart based on the specified properties. - * - * @param nsIDocument document - * The document responsible with creating the DOM. - * @param object - * An object containing all or some of the following properties: - * - title: a string displayed as the chart's (description)/local - * - data: an array of items used to display each row; all the items - * should be objects representing columns, for which the - * properties' values will be displayed in each cell of a row. - * e.g: [{ - * label1: 1, - * label2: 3, - * label3: "foo" - * }, { - * label1: 4, - * label2: 6, - * label3: "bar - * }]; - * - strings: an object specifying for which rows in the `data` array - * their cell values should be stringified and localized - * based on a predicate function; - * e.g: { - * label1: value => l10n.getFormatStr("...", value) - * } - * - totals: an object specifying for which rows in the `data` array - * the sum of their cells is to be displayed in the chart; - * e.g: { - * label1: total => l10n.getFormatStr("...", total), // 5 - * label2: total => l10n.getFormatStr("...", total), // 9 - * } - * @return TableChart - * A table chart proxy instance, which emits the following events: - * - "mouseover", when the mouse enters a row - * - "mouseout", when the mouse leaves a row - * - "click", when the mouse clicks a row - */ - function createTableChart(document, _ref3) { - var title = _ref3.title, - data = _ref3.data, - strings = _ref3.strings, - totals = _ref3.totals, - header = _ref3.header; - - strings = strings || {}; - totals = totals || {}; - var isPlaceholder = false; - - // If there's no data available, display an empty placeholder. - if (!data) { - data = loadingTableChartData(); - isPlaceholder = true; - } - if (!data.length) { - data = emptyTableChartData(); - isPlaceholder = true; - } - - var container = document.createElement("div"); - container.className = "generic-chart-container table-chart-container"; - container.setAttribute("pack", "center"); - container.setAttribute("flex", "1"); - container.setAttribute("rows", data.length); - container.setAttribute("placeholder", isPlaceholder); - container.setAttribute("style", "-moz-box-orient: vertical"); - - var proxy = new TableChart(container); - - var titleNode = document.createElement("span"); - titleNode.className = "plain table-chart-title"; - titleNode.textContent = title; - container.appendChild(titleNode); - - var tableNode = document.createElement("div"); - tableNode.className = "plain table-chart-grid"; - tableNode.setAttribute("style", "-moz-box-orient: vertical"); - container.appendChild(tableNode); - - var headerNode = document.createElement("div"); - headerNode.className = "table-chart-row"; - - var headerBoxNode = document.createElement("div"); - headerBoxNode.className = "table-chart-row-box"; - headerNode.appendChild(headerBoxNode); - - for (var _ref4 of Object.entries(header)) { - var _ref5 = _slicedToArray(_ref4, 2); - - var key = _ref5[0]; - var value = _ref5[1]; - - var headerLabelNode = document.createElement("span"); - headerLabelNode.className = "plain table-chart-row-label"; - headerLabelNode.setAttribute("name", key); - headerLabelNode.textContent = value; - - headerNode.appendChild(headerLabelNode); - } - - tableNode.appendChild(headerNode); - - for (var rowInfo of data) { - var rowNode = document.createElement("div"); - rowNode.className = "table-chart-row"; - rowNode.setAttribute("align", "center"); - - var boxNode = document.createElement("div"); - boxNode.className = "table-chart-row-box chart-colored-blob"; - boxNode.setAttribute("name", rowInfo.label); - rowNode.appendChild(boxNode); - - for (var _ref6 of Object.entries(rowInfo)) { - var _ref7 = _slicedToArray(_ref6, 2); - - var _key = _ref7[0]; - var _value = _ref7[1]; - - var index = data.indexOf(rowInfo); - var stringified = strings[_key] ? strings[_key](_value, index) : _value; - var labelNode = document.createElement("span"); - labelNode.className = "plain table-chart-row-label"; - labelNode.setAttribute("name", _key); - labelNode.textContent = stringified; - rowNode.appendChild(labelNode); - } - - proxy.rows.set(rowInfo, rowNode); - delegate(proxy, ["click", "mouseover", "mouseout"], rowNode, rowInfo); - tableNode.appendChild(rowNode); - } - - var totalsNode = document.createElement("div"); - totalsNode.className = "table-chart-totals"; - totalsNode.setAttribute("style", "-moz-box-orient: vertical"); - - var _loop = function (_key2, _value2) { - var total = data.reduce((acc, e) => acc + e[_key2], 0); - var stringified = _value2 ? _value2(total || 0) : total; - var labelNode = document.createElement("span"); - labelNode.className = "plain table-chart-summary-label"; - labelNode.setAttribute("name", _key2); - labelNode.textContent = stringified; - totalsNode.appendChild(labelNode); - }; - - for (var _ref8 of Object.entries(totals)) { - var _ref9 = _slicedToArray(_ref8, 2); - - var _key2 = _ref9[0]; - var _value2 = _ref9[1]; - - _loop(_key2, _value2); - } - - container.appendChild(totalsNode); - - return proxy; - } - - function loadingPieChartData() { - return [{ size: 1, label: "Loading" }]; - } - - function emptyPieChartData() { - return [{ size: 1, label: "Empty" }]; - } - - function loadingTableChartData() { - return [{ size: "", label: "Please wait…" }]; - } - - function emptyTableChartData() { - return [{ size: "", label: "No data available" }]; - } - - /** - * Delegates DOM events emitted by an nsIDOMNode to an EventEmitter proxy. - * - * @param EventEmitter emitter - * The event emitter proxy instance. - * @param array events - * An array of events, e.g. ["mouseover", "mouseout"]. - * @param nsIDOMNode node - * The element firing the DOM events. - * @param any args - * The arguments passed when emitting events through the proxy. - */ - function delegate(emitter, events, node, args) { - for (var event of events) { - node.addEventListener(event, emitter.emit.bind(emitter, event, args)); - } - } - - exports.Chart = Chart; - -/***/ }, -/* 861 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2008, 2009 Anthony Ricaud - * Copyright (C) 2011 Google Inc. All rights reserved. - * Copyright (C) 2009 Mozilla Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - "use strict"; - - var _require = __webpack_require__(29), - Services = _require.Services; - - var DEFAULT_HTTP_VERSION = "HTTP/1.1"; - - var Curl = { - /** - * Generates a cURL command string which can be used from the command line etc. - * - * @param object data - * Datasource to create the command from. - * The object must contain the following properties: - * - url:string, the URL of the request. - * - method:string, the request method upper cased. HEAD / GET / POST etc. - * - headers:array, an array of request headers {name:x, value:x} tuples. - * - httpVersion:string, http protocol version rfc2616 formatted. Eg. "HTTP/1.1" - * - postDataText:string, optional - the request payload. - * - * @return string - * A cURL command. - */ - generateCommand: function (data) { - var utils = CurlUtils; - - var command = ["curl"]; - var ignoredHeaders = new Set(); - - // The cURL command is expected to run on the same platform that Firefox runs - // (it may be different from the inspected page platform). - var escapeString = Services.appinfo.OS == "WINNT" ? utils.escapeStringWin : utils.escapeStringPosix; - - // Add URL. - command.push(escapeString(data.url)); - - var postDataText = null; - var multipartRequest = utils.isMultipartRequest(data); - - // Create post data. - var postData = []; - if (utils.isUrlEncodedRequest(data) || data.method == "PUT" || data.method == "POST") { - postDataText = data.postDataText; - postData.push("--data"); - postData.push(escapeString(utils.writePostDataTextParams(postDataText))); - ignoredHeaders.add("Content-Length"); - } else if (multipartRequest) { - postDataText = data.postDataText; - postData.push("--data-binary"); - var boundary = utils.getMultipartBoundary(data); - var text = utils.removeBinaryDataFromMultipartText(postDataText, boundary); - postData.push(escapeString(text)); - ignoredHeaders.add("Content-Length"); - } - - // Add method. - // For GET and POST requests this is not necessary as GET is the - // default. If --data or --binary is added POST is the default. - if (!(data.method == "GET" || data.method == "POST")) { - command.push("-X"); - command.push(data.method); - } - - // Add -I (HEAD) - // For servers that supports HEAD. - // This will fetch the header of a document only. - if (data.method == "HEAD") { - command.push("-I"); - } - - // Add http version. - if (data.httpVersion && data.httpVersion != DEFAULT_HTTP_VERSION) { - command.push("--" + data.httpVersion.split("/")[1]); - } - - // Add request headers. - var headers = data.headers; - if (multipartRequest) { - var multipartHeaders = utils.getHeadersFromMultipartText(postDataText); - headers = headers.concat(multipartHeaders); - } - for (var i = 0; i < headers.length; i++) { - var header = headers[i]; - if (header.name === "Accept-Encoding") { - command.push("--compressed"); - continue; - } - if (ignoredHeaders.has(header.name)) { - continue; - } - command.push("-H"); - command.push(escapeString(header.name + ": " + header.value)); - } - - // Add post data. - command = command.concat(postData); - - return command.join(" "); - } - }; - - exports.Curl = Curl; - - /** - * Utility functions for the Curl command generator. - */ - var CurlUtils = { - /** - * Check if the request is an URL encoded request. - * - * @param object data - * The data source. See the description in the Curl object. - * @return boolean - * True if the request is URL encoded, false otherwise. - */ - isUrlEncodedRequest: function (data) { - var postDataText = data.postDataText; - if (!postDataText) { - return false; - } - - postDataText = postDataText.toLowerCase(); - if (postDataText.includes("content-type: application/x-www-form-urlencoded")) { - return true; - } - - var contentType = this.findHeader(data.headers, "content-type"); - - return contentType && contentType.toLowerCase().includes("application/x-www-form-urlencoded"); - }, - - /** - * Check if the request is a multipart request. - * - * @param object data - * The data source. - * @return boolean - * True if the request is multipart reqeust, false otherwise. - */ - isMultipartRequest: function (data) { - var postDataText = data.postDataText; - if (!postDataText) { - return false; - } - - postDataText = postDataText.toLowerCase(); - if (postDataText.includes("content-type: multipart/form-data")) { - return true; - } - - var contentType = this.findHeader(data.headers, "content-type"); - - return contentType && contentType.toLowerCase().includes("multipart/form-data;"); - }, - - /** - * Write out paramters from post data text. - * - * @param object postDataText - * Post data text. - * @return string - * Post data parameters. - */ - writePostDataTextParams: function (postDataText) { - var lines = postDataText.split("\r\n"); - return lines[lines.length - 1]; - }, - - /** - * Finds the header with the given name in the headers array. - * - * @param array headers - * Array of headers info {name:x, value:x}. - * @param string name - * The header name to find. - * @return string - * The found header value or null if not found. - */ - findHeader: function (headers, name) { - if (!headers) { - return null; - } - - name = name.toLowerCase(); - for (var header of headers) { - if (name == header.name.toLowerCase()) { - return header.value; - } - } - - return null; - }, - - /** - * Returns the boundary string for a multipart request. - * - * @param string data - * The data source. See the description in the Curl object. - * @return string - * The boundary string for the request. - */ - getMultipartBoundary: function (data) { - var boundaryRe = /\bboundary=(-{3,}\w+)/i; - - // Get the boundary string from the Content-Type request header. - var contentType = this.findHeader(data.headers, "Content-Type"); - if (boundaryRe.test(contentType)) { - return contentType.match(boundaryRe)[1]; - } - // Temporary workaround. As of 2014-03-11 the requestHeaders array does not - // always contain the Content-Type header for mulitpart requests. See bug 978144. - // Find the header from the request payload. - var boundaryString = data.postDataText.match(boundaryRe)[1]; - if (boundaryString) { - return boundaryString; - } - - return null; - }, - - /** - * Removes the binary data from multipart text. - * - * @param string multipartText - * Multipart form data text. - * @param string boundary - * The boundary string. - * @return string - * The multipart text without the binary data. - */ - removeBinaryDataFromMultipartText: function (multipartText, boundary) { - var result = ""; - boundary = "--" + boundary; - var parts = multipartText.split(boundary); - for (var part of parts) { - // Each part is expected to have a content disposition line. - var contentDispositionLine = part.trimLeft().split("\r\n")[0]; - if (!contentDispositionLine) { - continue; - } - contentDispositionLine = contentDispositionLine.toLowerCase(); - if (contentDispositionLine.includes("content-disposition: form-data")) { - if (contentDispositionLine.includes("filename=")) { - // The header lines and the binary blob is separated by 2 CRLF's. - // Add only the headers to the result. - var headers = part.split("\r\n\r\n")[0]; - result += boundary + "\r\n" + headers + "\r\n\r\n"; - } else { - result += boundary + "\r\n" + part; - } - } - } - result += boundary + "--\r\n"; - - return result; - }, - - /** - * Get the headers from a multipart post data text. - * - * @param string multipartText - * Multipart post text. - * @return array - * An array of header objects {name:x, value:x} - */ - getHeadersFromMultipartText: function (multipartText) { - var headers = []; - if (!multipartText || multipartText.startsWith("---")) { - return headers; - } - - // Get the header section. - var index = multipartText.indexOf("\r\n\r\n"); - if (index == -1) { - return headers; - } - - // Parse the header lines. - var headersText = multipartText.substring(0, index); - var headerLines = headersText.split("\r\n"); - var lastHeaderName = null; - - for (var line of headerLines) { - // Create a header for each line in fields that spans across multiple lines. - // Subsquent lines always begins with at least one space or tab character. - // (rfc2616) - if (lastHeaderName && /^\s+/.test(line)) { - headers.push({ name: lastHeaderName, value: line.trim() }); - continue; - } - - var indexOfColon = line.indexOf(":"); - if (indexOfColon == -1) { - continue; - } - - var header = [line.slice(0, indexOfColon), line.slice(indexOfColon + 1)]; - if (header.length != 2) { - continue; - } - lastHeaderName = header[0].trim(); - headers.push({ name: lastHeaderName, value: header[1].trim() }); - } - - return headers; - }, - - /** - * Escape util function for POSIX oriented operating systems. - * Credit: Google DevTools - */ - escapeStringPosix: function (str) { - function escapeCharacter(x) { - var code = x.charCodeAt(0); - if (code < 256) { - // Add leading zero when needed to not care about the next character. - return code < 16 ? "\\x0" + code.toString(16) : "\\x" + code.toString(16); - } - code = code.toString(16); - return "\\u" + ("0000" + code).substr(code.length, 4); - } - - if (/[^\x20-\x7E]|\'/.test(str)) { - // Use ANSI-C quoting syntax. - return "$\'" + str.replace(/\\/g, "\\\\").replace(/\'/g, "\\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[^\x20-\x7E]/g, escapeCharacter) + "'"; - } - - // Use single quote syntax. - return "'" + str + "'"; - }, - - /** - * Escape util function for Windows systems. - * Credit: Google DevTools - */ - escapeStringWin: function (str) { - /* Replace quote by double quote (but not by \") because it is - recognized by both cmd.exe and MS Crt arguments parser. - Replace % by "%" because it could be expanded to an environment - variable value. So %% becomes "%""%". Even if an env variable "" - (2 doublequotes) is declared, the cmd.exe will not - substitute it with its value. - Replace each backslash with double backslash to make sure - MS Crt arguments parser won't collapse them. - Replace new line outside of quotes since cmd.exe doesn't let - to do it inside. - */ - return "\"" + str.replace(/"/g, "\"\"").replace(/%/g, "\"%\"").replace(/\\/g, "\\\\").replace(/[\r\n]+/g, "\"^$&\"") + "\""; - } - }; - - exports.CurlUtils = CurlUtils; - -/***/ }, -/* 862 */ +/* 977 */ /***/ function(module, exports, __webpack_require__) { "use strict"; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - var _require = __webpack_require__(834), + var _require = __webpack_require__(978), Ci = _require.Ci, Cu = _require.Cu, components = _require.components; - var Services = __webpack_require__(29); - var DevToolsUtils = __webpack_require__(833); + var DevToolsUtils = __webpack_require__(979); + var promise = __webpack_require__(980); + var events = __webpack_require__(982); - // WARNING I swapped the sync one for the async one here - // const promise = require("resource://devtools/shared/deprecated-sync-thenables.js", {}).Promise; - var promise = __webpack_require__(839); - - var events = __webpack_require__(863); - - var _require2 = __webpack_require__(865), + var _require2 = __webpack_require__(984), WebConsoleClient = _require2.WebConsoleClient; - /* const { DebuggerSocket } = require("../shared/security/socket");*/ - /* const Authentication = require("../shared/security/auth");*/ var noop = () => {}; @@ -52458,9 +38698,9 @@ return /******/ (function(modules) { // webpackBootstrap * state the actor is in after each message. */ var ThreadStateTypes = { - "paused": "paused", - "resumed": "attached", - "detached": "detached" + paused: "paused", + resumed: "attached", + detached: "detached" }; /** @@ -52468,34 +38708,34 @@ return /******/ (function(modules) { // webpackBootstrap * by the client. */ var UnsolicitedNotifications = { - "consoleAPICall": "consoleAPICall", - "eventNotification": "eventNotification", - "fileActivity": "fileActivity", - "lastPrivateContextExited": "lastPrivateContextExited", - "logMessage": "logMessage", - "networkEvent": "networkEvent", - "networkEventUpdate": "networkEventUpdate", - "newGlobal": "newGlobal", - "newScript": "newScript", - "tabDetached": "tabDetached", - "tabListChanged": "tabListChanged", - "reflowActivity": "reflowActivity", - "addonListChanged": "addonListChanged", - "workerListChanged": "workerListChanged", - "serviceWorkerRegistrationListChanged": "serviceWorkerRegistrationList", - "tabNavigated": "tabNavigated", - "frameUpdate": "frameUpdate", - "pageError": "pageError", - "documentLoad": "documentLoad", - "enteredFrame": "enteredFrame", - "exitedFrame": "exitedFrame", - "appOpen": "appOpen", - "appClose": "appClose", - "appInstall": "appInstall", - "appUninstall": "appUninstall", - "evaluationResult": "evaluationResult", - "newSource": "newSource", - "updatedSource": "updatedSource" + consoleAPICall: "consoleAPICall", + eventNotification: "eventNotification", + fileActivity: "fileActivity", + lastPrivateContextExited: "lastPrivateContextExited", + logMessage: "logMessage", + networkEvent: "networkEvent", + networkEventUpdate: "networkEventUpdate", + newGlobal: "newGlobal", + newScript: "newScript", + tabDetached: "tabDetached", + tabListChanged: "tabListChanged", + reflowActivity: "reflowActivity", + addonListChanged: "addonListChanged", + workerListChanged: "workerListChanged", + serviceWorkerRegistrationListChanged: "serviceWorkerRegistrationList", + tabNavigated: "tabNavigated", + frameUpdate: "frameUpdate", + pageError: "pageError", + documentLoad: "documentLoad", + enteredFrame: "enteredFrame", + exitedFrame: "exitedFrame", + appOpen: "appOpen", + appClose: "appClose", + appInstall: "appInstall", + appUninstall: "appUninstall", + evaluationResult: "evaluationResult", + newSource: "newSource", + updatedSource: "updatedSource" }; /** @@ -52503,12 +38743,12 @@ return /******/ (function(modules) { // webpackBootstrap * response to a client request. */ var UnsolicitedPauses = { - "resumeLimit": "resumeLimit", - "debuggerStatement": "debuggerStatement", - "breakpoint": "breakpoint", - "DOMEvent": "DOMEvent", - "watchpoint": "watchpoint", - "exception": "exception" + resumeLimit: "resumeLimit", + debuggerStatement: "debuggerStatement", + breakpoint: "breakpoint", + DOMEvent: "DOMEvent", + watchpoint: "watchpoint", + exception: "exception" }; /** @@ -52580,7 +38820,6 @@ return /******/ (function(modules) { // webpackBootstrap if (telemetry) { var transportType = this._transport.onOutputStreamReady === undefined ? "LOCAL_" : "REMOTE_"; var histogramId = `DEVTOOLS_DEBUGGER_RDP_${transportType}${telemetry}_MS`; - histogram = Services.telemetry.getHistogramById(histogramId); startTime = +new Date(); } var outgoingPacket = { @@ -52817,7 +39056,10 @@ return /******/ (function(modules) { // webpackBootstrap return promise.resolve([response, workerClient]); } - return this.request({ to: aWorkerActor, type: "attach" }).then(aResponse => { + return this.request({ + to: aWorkerActor, + type: "attach" + }).then(aResponse => { if (aResponse.error) { aOnResponse(aResponse, null); return [aResponse, null]; @@ -53544,7 +39786,6 @@ return /******/ (function(modules) { // webpackBootstrap } Request.prototype = { - on: function (type, listener) { events.on(this, type, listener); }, @@ -53568,7 +39809,6 @@ return /******/ (function(modules) { // webpackBootstrap get actor() { return this.request.to || this.request.actor; } - }; /** @@ -54847,7 +41087,9 @@ return /******/ (function(modules) { // webpackBootstrap }, { after: function (aResponse) { if (aResponse.iterator) { - return { iterator: new PropertyIteratorClient(this._client, aResponse.iterator) }; + return { + iterator: new PropertyIteratorClient(this._client, aResponse.iterator) + }; } return aResponse; }, @@ -55169,7 +41411,7 @@ return /******/ (function(modules) { // webpackBootstrap }), /** - * Un-blackbox this SourceClient's source. + * Un-black box this SourceClient's source. * * @param aCallback Function * The callback function called when we receive the response from the server. @@ -55402,7 +41644,6 @@ return /******/ (function(modules) { // webpackBootstrap } BreakpointClient.prototype = { - _actor: null, get actor() { return this._actor; @@ -55429,9 +41670,8 @@ return /******/ (function(modules) { // webpackBootstrap // conditional breakpoints if (root.traits.conditionalBreakpoints) { return "condition" in this; - } else { - return "conditionalExpression" in this; } + return "conditionalExpression" in this; }, /** @@ -55445,9 +41685,8 @@ return /******/ (function(modules) { // webpackBootstrap var root = this._client.mainRoot; if (root.traits.conditionalBreakpoints) { return this.condition; - } else { - return this.conditionalExpression; } + return this.conditionalExpression; }, /** @@ -55513,7 +41752,6 @@ return /******/ (function(modules) { // webpackBootstrap exports.EnvironmentClient = EnvironmentClient; EnvironmentClient.prototype = { - get actor() { return this._form.actor; }, @@ -55546,14 +41784,692 @@ return /******/ (function(modules) { // webpackBootstrap eventSource(EnvironmentClient.prototype); /***/ }, -/* 863 */ +/* 978 */ +/***/ function(module, exports) { + + 'use strict'; + + /* + * A sham for https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/chrome + */ + + var ourServices = { + nsIClipboardHelper: { + copyString: () => {} + }, + nsIXULChromeRegistry: { + isLocaleRTL: () => { + return false; + } + }, + nsIDOMParser: {} + }; + + module.exports = { + Cc: name => { + if (typeof console !== 'undefined') {} + return { + getService: name => ourServices[name], + createInstance: iface => ourServices[iface] + }; + }, + CC: (name, iface, method) => { + if (typeof console !== 'undefined') {} + return {}; + }, + Ci: { + nsIThread: { + DISPATCH_NORMAL: 0, + DISPATCH_SYNC: 1 + }, + nsIDOMNode: typeof HTMLElement !== 'undefined' ? HTMLElement : null, + nsIFocusManager: { + MOVEFOCUS_BACKWARD: 2, + MOVEFOCUS_FORWARD: 1 + }, + nsIDOMKeyEvent: {}, + nsIDOMCSSRule: { + UNKNOWN_RULE: 0, + STYLE_RULE: 1, + CHARSET_RULE: 2, + IMPORT_RULE: 3, + MEDIA_RULE: 4, + FONT_FACE_RULE: 5, + PAGE_RULE: 6, + KEYFRAMES_RULE: 7, + KEYFRAME_RULE: 8, + MOZ_KEYFRAMES_RULE: 7, + MOZ_KEYFRAME_RULE: 8, + NAMESPACE_RULE: 10, + COUNTER_STYLE_RULE: 11, + SUPPORTS_RULE: 12, + FONT_FEATURE_VALUES_RULE: 14 + }, + inIDOMUtils: 'inIDOMUtils', + nsIClipboardHelper: 'nsIClipboardHelper', + nsIXULChromeRegistry: 'nsIXULChromeRegistry' + }, + Cu: { + reportError: msg => { + typeof console !== 'undefined' ? console.error(msg) : dump(msg); + }, + callFunctionWithAsyncStack: fn => fn() + }, + Cr: {}, + components: { + isSuccessCode: () => (returnCode & 0x80000000) === 0 + } + }; + +/***/ }, +/* 979 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(module) {/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + /* General utilities used throughout devtools. */ + var _require = __webpack_require__(978), + Ci = _require.Ci, + Cu = _require.Cu, + Cc = _require.Cc, + components = _require.components; + + var promise = __webpack_require__(980); + + var _require2 = __webpack_require__(981), + AppConstants = _require2.AppConstants; + + /** + * Turn the error |aError| into a string, without fail. + */ + + + exports.safeErrorString = function safeErrorString(aError) { + try { + var errorString = aError.toString(); + if (typeof errorString == "string") { + // Attempt to attach a stack to |errorString|. If it throws an error, or + // isn't a string, don't use it. + try { + if (aError.stack) { + var stack = aError.stack.toString(); + if (typeof stack == "string") { + errorString += `\nStack: ${stack}`; + } + } + } catch (ee) {} + + // Append additional line and column number information to the output, + // since it might not be part of the stringified error. + if (typeof aError.lineNumber == "number" && typeof aError.columnNumber == "number") { + errorString += `Line: ${aError.lineNumber}, column: ${aError.columnNumber}`; + } + + return errorString; + } + } catch (ee) {} + + // We failed to find a good error description, so do the next best thing. + return Object.prototype.toString.call(aError); + }; + + /** + * Report that |aWho| threw an exception, |aException|. + */ + exports.reportException = function reportException(aWho, aException) { + var msg = `${aWho} threw an exception: ${exports.safeErrorString(aException)}`; + + console.log(msg); + + // if (Cu && console.error) { + // /* + // * Note that the xpcshell test harness registers an observer for + // * console messages, so when we're running tests, this will cause + // * the test to quit. + // */ + // console.error(msg); + // } + }; + + /** + * Given a handler function that may throw, return an infallible handler + * function that calls the fallible handler, and logs any exceptions it + * throws. + * + * @param aHandler function + * A handler function, which may throw. + * @param aName string + * A name for aHandler, for use in error messages. If omitted, we use + * aHandler.name. + * + * (SpiderMonkey does generate good names for anonymous functions, but we + * don't have a way to get at them from JavaScript at the moment.) + */ + exports.makeInfallible = function makeInfallible(aHandler, aName) { + if (!aName) { + aName = aHandler.name; + } + + return function () /* arguments */{ + // try { + return aHandler.apply(this, arguments); + // } catch (ex) { + // let who = "Handler function"; + // if (aName) { + // who += " " + aName; + // } + // return exports.reportException(who, ex); + // } + }; + }; + + /** + * Waits for the next tick in the event loop to execute a callback. + */ + exports.executeSoon = function executeSoon(aFn) { + setTimeout(aFn, 0); + }; + + /** + * Waits for the next tick in the event loop. + * + * @return Promise + * A promise that is resolved after the next tick in the event loop. + */ + exports.waitForTick = function waitForTick() { + var deferred = promise.defer(); + exports.executeSoon(deferred.resolve); + return deferred.promise; + }; + + /** + * Waits for the specified amount of time to pass. + * + * @param number aDelay + * The amount of time to wait, in milliseconds. + * @return Promise + * A promise that is resolved after the specified amount of time passes. + */ + exports.waitForTime = function waitForTime(aDelay) { + var deferred = promise.defer(); + setTimeout(deferred.resolve, aDelay); + return deferred.promise; + }; + + /** + * Like Array.prototype.forEach, but doesn't cause jankiness when iterating over + * very large arrays by yielding to the browser and continuing execution on the + * next tick. + * + * @param Array aArray + * The array being iterated over. + * @param Function aFn + * The function called on each item in the array. If a promise is + * returned by this function, iterating over the array will be paused + * until the respective promise is resolved. + * @returns Promise + * A promise that is resolved once the whole array has been iterated + * over, and all promises returned by the aFn callback are resolved. + */ + exports.yieldingEach = function yieldingEach(aArray, aFn) { + var deferred = promise.defer(); + + var i = 0; + var len = aArray.length; + var outstanding = [deferred.promise]; + + (function loop() { + var start = Date.now(); + + while (i < len) { + // Don't block the main thread for longer than 16 ms at a time. To + // maintain 60fps, you have to render every frame in at least 16ms; we + // aren't including time spent in non-JS here, but this is Good + // Enough(tm). + if (Date.now() - start > 16) { + exports.executeSoon(loop); + return; + } + + try { + outstanding.push(aFn(aArray[i], i++)); + } catch (e) { + deferred.reject(e); + return; + } + } + + deferred.resolve(); + })(); + + return promise.all(outstanding); + }; + + /** + * Like XPCOMUtils.defineLazyGetter, but with a |this| sensitive getter that + * allows the lazy getter to be defined on a prototype and work correctly with + * instances. + * + * @param Object aObject + * The prototype object to define the lazy getter on. + * @param String aKey + * The key to define the lazy getter on. + * @param Function aCallback + * The callback that will be called to determine the value. Will be + * called with the |this| value of the current instance. + */ + exports.defineLazyPrototypeGetter = function defineLazyPrototypeGetter(aObject, aKey, aCallback) { + Object.defineProperty(aObject, aKey, { + configurable: true, + get: function () { + var value = aCallback.call(this); + + Object.defineProperty(this, aKey, { + configurable: true, + writable: true, + value: value + }); + + return value; + } + }); + }; + + /** + * Safely get the property value from a Debugger.Object for a given key. Walks + * the prototype chain until the property is found. + * + * @param Debugger.Object aObject + * The Debugger.Object to get the value from. + * @param String aKey + * The key to look for. + * @return Any + */ + exports.getProperty = function getProperty(aObj, aKey) { + var root = aObj; + try { + do { + var desc = aObj.getOwnPropertyDescriptor(aKey); + if (desc) { + if ("value" in desc) { + return desc.value; + } + // Call the getter if it's safe. + return exports.hasSafeGetter(desc) ? desc.get.call(root).return : undefined; + } + aObj = aObj.proto; + } while (aObj); + } catch (e) { + // If anything goes wrong report the error and return undefined. + exports.reportException("getProperty", e); + } + return undefined; + }; + + /** + * Determines if a descriptor has a getter which doesn't call into JavaScript. + * + * @param Object aDesc + * The descriptor to check for a safe getter. + * @return Boolean + * Whether a safe getter was found. + */ + exports.hasSafeGetter = function hasSafeGetter(aDesc) { + // Scripted functions that are CCWs will not appear scripted until after + // unwrapping. + try { + var fn = aDesc.get.unwrap(); + return fn && fn.callable && fn.class == "Function" && fn.script === undefined; + } catch (e) { + // Avoid exception 'Object in compartment marked as invisible to Debugger' + return false; + } + }; + + /** + * Check if it is safe to read properties and execute methods from the given JS + * object. Safety is defined as being protected from unintended code execution + * from content scripts (or cross-compartment code). + * + * See bugs 945920 and 946752 for discussion. + * + * @type Object aObj + * The object to check. + * @return Boolean + * True if it is safe to read properties from aObj, or false otherwise. + */ + exports.isSafeJSObject = function isSafeJSObject(aObj) { + // If we are running on a worker thread, Cu is not available. In this case, + // we always return false, just to be on the safe side. + if (isWorker) { + return false; + } + + if (Cu.getGlobalForObject(aObj) == Cu.getGlobalForObject(exports.isSafeJSObject)) { + return true; // aObj is not a cross-compartment wrapper. + } + + var principal = Cu.getObjectPrincipal(aObj); + // if (Services.scriptSecurityManager.isSystemPrincipal(principal)) { + // return true; // allow chrome objects + // } + + return Cu.isXrayWrapper(aObj); + }; + + exports.dumpn = function dumpn(str) { + if (exports.dumpn.wantLogging) { + console.log(`DBG-SERVER: ${str}\n`); + } + }; + + // We want wantLogging to be writable. The exports object is frozen by the + // loader, so define it on dumpn instead. + exports.dumpn.wantLogging = false; + + /** + * A verbose logger for low-level tracing. + */ + exports.dumpv = function (msg) { + if (exports.dumpv.wantVerbose) { + exports.dumpn(msg); + } + }; + + // We want wantLogging to be writable. The exports object is frozen by the + // loader, so define it on dumpn instead. + exports.dumpv.wantVerbose = false; + + /** + * Utility function for updating an object with the properties of + * other objects. + * + * @param aTarget Object + * The object being updated. + * @param aNewAttrs Object + * The rest params are objects to update aTarget with. You + * can pass as many as you like. + */ + exports.update = function update(aTarget) { + for (var _len = arguments.length, aArgs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + aArgs[_key - 1] = arguments[_key]; + } + + for (var attrs of aArgs) { + for (var key in attrs) { + var desc = Object.getOwnPropertyDescriptor(attrs, key); + + if (desc) { + Object.defineProperty(aTarget, key, desc); + } + } + } + + return aTarget; + }; + + /** + * Utility function for getting the values from an object as an array + * + * @param aObject Object + * The object to iterate over + */ + exports.values = function values(aObject) { + return Object.keys(aObject).map(k => aObject[k]); + }; + + /** + * Defines a getter on a specified object that will be created upon first use. + * + * @param aObject + * The object to define the lazy getter on. + * @param aName + * The name of the getter to define on aObject. + * @param aLambda + * A function that returns what the getter should return. This will + * only ever be called once. + */ + exports.defineLazyGetter = function defineLazyGetter(aObject, aName, aLambda) { + Object.defineProperty(aObject, aName, { + get: function () { + delete aObject[aName]; + return aObject[aName] = aLambda.apply(aObject); + }, + configurable: true, + enumerable: true + }); + }; + + // DEPRECATED: use DevToolsUtils.assert(condition, message) instead! + var haveLoggedDeprecationMessage = false; + exports.dbg_assert = function dbg_assert(cond, e) { + if (!haveLoggedDeprecationMessage) { + haveLoggedDeprecationMessage = true; + var deprecationMessage = `DevToolsUtils.dbg_assert is deprecated! Use DevToolsUtils.assert instead!${Error().stack}`; + console.log(deprecationMessage); + if (typeof console === "object" && console && console.warn) { + console.warn(deprecationMessage); + } + } + + if (!cond) { + return e; + } + }; + + /** + * No operation. The empty function. + */ + exports.noop = function () {}; + + function reallyAssert(condition, message) { + if (!condition) { + var err = new Error(`Assertion failure: ${message}`); + exports.reportException("DevToolsUtils.assert", err); + throw err; + } + } + + /** + * DevToolsUtils.assert(condition, message) + * + * @param Boolean condition + * @param String message + * + * Assertions are enabled when any of the following are true: + * - This is a DEBUG_JS_MODULES build + * - This is a DEBUG build + * - DevToolsUtils.testing is set to true + * + * If assertions are enabled, then `condition` is checked and if false-y, the + * assertion failure is logged and then an error is thrown. + * + * If assertions are not enabled, then this function is a no-op. + * + * This is an improvement over `dbg_assert`, which doesn't actually cause any + * fatal behavior, and is therefore much easier to accidentally ignore. + */ + Object.defineProperty(exports, "assert", { + get: () => AppConstants.DEBUG || AppConstants.DEBUG_JS_MODULES || undefined.testing ? reallyAssert : exports.noop + }); + + /** + * Defines a getter on a specified object for a module. The module will not + * be imported until first use. + * + * @param aObject + * The object to define the lazy getter on. + * @param aName + * The name of the getter to define on aObject for the module. + * @param aResource + * The URL used to obtain the module. + * @param aSymbol + * The name of the symbol exported by the module. + * This parameter is optional and defaults to aName. + */ + exports.defineLazyModuleGetter = function defineLazyModuleGetter(aObject, aName, aResource, aSymbol) { + this.defineLazyGetter(aObject, aName, function XPCU_moduleLambda() { + var temp = {}; + Cu.import(aResource, temp); + return temp[aSymbol || aName]; + }); + }; + + /** + * Returns a promise that is resolved or rejected when all promises have settled + * (resolved or rejected). + * + * This differs from Promise.all, which will reject immediately after the first + * rejection, instead of waiting for the remaining promises to settle. + * + * @param values + * Iterable of promises that may be pending, resolved, or rejected. When + * when all promises have settled (resolved or rejected), the returned + * promise will be resolved or rejected as well. + * + * @return A new promise that is fulfilled when all values have settled + * (resolved or rejected). Its resolution value will be an array of all + * resolved values in the given order, or undefined if values is an + * empty array. The reject reason will be forwarded from the first + * promise in the list of given promises to be rejected. + */ + exports.settleAll = values => { + if (values === null || typeof values[Symbol.iterator] != "function") { + throw new Error("settleAll() expects an iterable."); + } + + var deferred = promise.defer(); + + values = Array.isArray(values) ? values : [].concat(_toConsumableArray(values)); + var countdown = values.length; + var resolutionValues = new Array(countdown); + var rejectionValue = void 0; + var rejectionOccurred = false; + + if (!countdown) { + deferred.resolve(resolutionValues); + return deferred.promise; + } + + function checkForCompletion() { + if (--countdown > 0) { + return; + } + if (!rejectionOccurred) { + deferred.resolve(resolutionValues); + } else { + deferred.reject(rejectionValue); + } + } + + var _loop = function (i) { + var index = i; + var value = values[i]; + var resolver = result => { + resolutionValues[index] = result; + checkForCompletion(); + }; + var rejecter = error => { + if (!rejectionOccurred) { + rejectionValue = error; + rejectionOccurred = true; + } + checkForCompletion(); + }; + + if (value && typeof value.then == "function") { + value.then(resolver, rejecter); + } else { + // Given value is not a promise, forward it as a resolution value. + resolver(value); + } + }; + + for (var i = 0; i < values.length; i++) { + _loop(i); + } + + return deferred.promise; + }; + + /** + * When the testing flag is set, various behaviors may be altered from + * production mode, typically to enable easier testing or enhanced debugging. + */ + var testing = false; + Object.defineProperty(exports, "testing", { + get: function () { + return testing; + }, + set: function (state) { + testing = state; + } + }); + + exports.isGenerator = function (fn) { + if (typeof fn !== "function") { + return false; + } + var proto = Object.getPrototypeOf(fn); + if (!proto) { + return false; + } + var ctor = proto.constructor; + if (!ctor) { + return false; + } + return ctor.name == "GeneratorFunction"; + }; + + exports.isPromise = function (p) { + return p && typeof p.then === "function"; + }; + + /** + * Return true if `thing` is a SavedFrame, false otherwise. + */ + exports.isSavedFrame = function (thing) { + return Object.prototype.toString.call(thing) === "[object SavedFrame]"; + }; + +/***/ }, +/* 980 */ +/***/ function(module, exports) { + + "use strict"; + + var p = typeof window != "undefined" ? window.Promise : Promise; + p.defer = function defer() { + var resolve, reject; + var promise = new Promise(function () { + resolve = arguments[0]; + reject = arguments[1]; + }); + return { + resolve: resolve, + reject: reject, + promise: promise + }; + }; + + module.exports = p; + +/***/ }, +/* 981 */ +/***/ function(module, exports) { + + "use strict"; + + module.exports = { AppConstants: {} }; + +/***/ }, +/* 982 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(module) {"use strict"; + module.metadata = { "stability": "unstable" }; @@ -55561,7 +42477,7 @@ return /******/ (function(modules) { // webpackBootstrap var UNCAUGHT_ERROR = 'An error event was emitted for which there was no listener.'; var BAD_LISTENER = 'The event listener must be a function.'; - var _require = __webpack_require__(864), + var _require = __webpack_require__(983), ns = _require.ns; var event = ns(); @@ -55748,7 +42664,7 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) /***/ }, -/* 864 */ +/* 983 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {/* This Source Code Form is subject to the terms of the Mozilla Public @@ -55796,25 +42712,19 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) /***/ }, -/* 865 */ +/* 984 */ /***/ function(module, exports, __webpack_require__) { - /* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ - /* vim: set ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - var _require = __webpack_require__(834), + var _require = __webpack_require__(978), Cc = _require.Cc, Ci = _require.Ci, Cu = _require.Cu; - var DevToolsUtils = __webpack_require__(833); - var EventEmitter = __webpack_require__(844); - var promise = __webpack_require__(839); + var DevToolsUtils = __webpack_require__(979); + var EventEmitter = __webpack_require__(985); + var promise = __webpack_require__(980); /** * A WebConsoleClient is used as a front end for the WebConsoleActor that is @@ -55908,11 +42818,13 @@ return /******/ (function(modules) { // webpackBootstrap method: actor.method }, isXHR: actor.isXHR, + cause: actor.cause, response: {}, timings: {}, updates: [], // track the list of network event updates private: actor.private, - fromCache: actor.fromCache + fromCache: actor.fromCache, + fromServiceWorker: actor.fromServiceWorker }; this._networkRequests.set(actor.actor, networkInfo); @@ -56458,35 +43370,179 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }, -/* 866 */ +/* 985 */ /***/ function(module, exports, __webpack_require__) { - /* eslint-env browser */ - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ + "use strict"; + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - // TODO: Get rid of this code once the marionette server loads transport.js as - // an SDK module (see bug 1000814) + /** + * EventEmitter. + */ + + var EventEmitter = function EventEmitter() {}; + module.exports = EventEmitter; + + var promise = __webpack_require__(980); + + /** + * Decorate an object with event emitter functionality. + * + * @param Object aObjectToDecorate + * Bind all public methods of EventEmitter to + * the aObjectToDecorate object. + */ + EventEmitter.decorate = function EventEmitter_decorate(aObjectToDecorate) { + var emitter = new EventEmitter(); + aObjectToDecorate.on = emitter.on.bind(emitter); + aObjectToDecorate.off = emitter.off.bind(emitter); + aObjectToDecorate.once = emitter.once.bind(emitter); + aObjectToDecorate.emit = emitter.emit.bind(emitter); + }; + + EventEmitter.prototype = { + /** + * Connect a listener. + * + * @param string aEvent + * The event name to which we're connecting. + * @param function aListener + * Called when the event is fired. + */ + on: function EventEmitter_on(aEvent, aListener) { + if (!this._eventEmitterListeners) { + this._eventEmitterListeners = new Map(); + } + if (!this._eventEmitterListeners.has(aEvent)) { + this._eventEmitterListeners.set(aEvent, []); + } + this._eventEmitterListeners.get(aEvent).push(aListener); + }, + + /** + * Listen for the next time an event is fired. + * + * @param string aEvent + * The event name to which we're connecting. + * @param function aListener + * (Optional) Called when the event is fired. Will be called at most + * one time. + * @return promise + * A promise which is resolved when the event next happens. The + * resolution value of the promise is the first event argument. If + * you need access to second or subsequent event arguments (it's rare + * that this is needed) then use aListener + */ + once: function EventEmitter_once(aEvent, aListener) { + var _this = this; + + var deferred = promise.defer(); + + var handler = function (aEvent, aFirstArg) { + for (var _len = arguments.length, aRest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + aRest[_key - 2] = arguments[_key]; + } + + _this.off(aEvent, handler); + if (aListener) { + aListener.apply(null, [aEvent, aFirstArg].concat(aRest)); + } + deferred.resolve(aFirstArg); + }; + + handler._originalListener = aListener; + this.on(aEvent, handler); + + return deferred.promise; + }, + + /** + * Remove a previously-registered event listener. Works for events + * registered with either on or once. + * + * @param string aEvent + * The event name whose listener we're disconnecting. + * @param function aListener + * The listener to remove. + */ + off: function EventEmitter_off(aEvent, aListener) { + if (!this._eventEmitterListeners) { + return; + } + var listeners = this._eventEmitterListeners.get(aEvent); + if (listeners) { + this._eventEmitterListeners.set(aEvent, listeners.filter(l => { + return l !== aListener && l._originalListener !== aListener; + })); + } + }, + + /** + * Emit an event. All arguments to this method will + * be sent to listener functions. + */ + emit: function EventEmitter_emit(aEvent) { + var _this2 = this, + _arguments = arguments; + + if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) { + return; + } + + var originalListeners = this._eventEmitterListeners.get(aEvent); + + var _loop = function (listener) { + // If the object was destroyed during event emission, stop + // emitting. + if (!_this2._eventEmitterListeners) { + return "break"; + } + + // If listeners were removed during emission, make sure the + // event handler we're going to fire wasn't removed. + if (originalListeners === _this2._eventEmitterListeners.get(aEvent) || _this2._eventEmitterListeners.get(aEvent).some(l => l === listener)) { + try { + listener.apply(null, _arguments); + } catch (ex) { + // Prevent a bad listener from interfering with the others. + var msg = `${ex}: ${ex.stack}`; + // console.error(msg); + console.log(msg); + } + } + }; + + for (var listener of this._eventEmitterListeners.get(aEvent)) { + var _ret = _loop(listener); + + if (_ret === "break") break; + } + } + }; + +/***/ }, +/* 986 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; - var DevToolsUtils = __webpack_require__(833); + var DevToolsUtils = __webpack_require__(979); var dumpn = DevToolsUtils.dumpn, dumpv = DevToolsUtils.dumpv; - var StreamUtils = __webpack_require__(867); + var StreamUtils = __webpack_require__(987); - var _require = __webpack_require__(868), + var _require = __webpack_require__(988), Packet = _require.Packet, JSONPacket = _require.JSONPacket, BulkPacket = _require.BulkPacket; - var promise = __webpack_require__(839); - var EventEmitter = __webpack_require__(844); - var utf8 = __webpack_require__(870); + var promise = __webpack_require__(980); + var EventEmitter = __webpack_require__(985); + var utf8 = __webpack_require__(989); var PACKET_HEADER_MAX = 200; @@ -56656,7 +43712,7 @@ return /******/ (function(modules) { // webpackBootstrap this.hooks = null; } if (reason) { - dumpn("Transport closed: " + DevToolsUtils.safeErrorString(reason)); + dumpn(`Transport closed: ${DevToolsUtils.safeErrorString(reason)}`); } else { dumpn("Transport closed."); } @@ -56728,9 +43784,8 @@ return /******/ (function(modules) { // webpackBootstrap if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK) { this.close(e.result); return; - } else { - throw e; } + throw e; } this._flushOutgoing(); @@ -56837,7 +43892,7 @@ return /******/ (function(modules) { // webpackBootstrap * remaining data. */ _processIncoming: function (stream, count) { - dumpv("Data available: " + count); + dumpv(`Data available: ${count}`); if (!count) { dumpv("Nothing to read, skipping"); @@ -56856,7 +43911,7 @@ return /******/ (function(modules) { // webpackBootstrap // header pattern. this._incoming = Packet.fromHeader(this._incomingHeader, this); if (!this._incoming) { - throw new Error("No packet types for header: " + this._incomingHeader); + throw new Error(`No packet types for header: ${this._incomingHeader}`); } } @@ -56866,7 +43921,7 @@ return /******/ (function(modules) { // webpackBootstrap this._incoming.read(stream); } } catch (e) { - var msg = "Error reading incoming packet: (" + e + " - " + e.stack + ")"; + var msg = `Error reading incoming packet: (${e} - ${e.stack})`; dumpn(msg); // Now in an invalid state, shut down the transport. @@ -56896,12 +43951,12 @@ return /******/ (function(modules) { // webpackBootstrap var amountToRead = PACKET_HEADER_MAX - this._incomingHeader.length; this._incomingHeader += StreamUtils.delimitedRead(stream, ":", amountToRead); if (dumpv.wantVerbose) { - dumpv("Header read: " + this._incomingHeader); + dumpv(`Header read: ${this._incomingHeader}`); } if (this._incomingHeader.endsWith(":")) { if (dumpv.wantVerbose) { - dumpv("Found packet header successfully: " + this._incomingHeader); + dumpv(`Found packet header successfully: ${this._incomingHeader}`); } return true; } @@ -56922,7 +43977,7 @@ return /******/ (function(modules) { // webpackBootstrap return; } if (dumpn.wantLogging) { - dumpn("Got: " + this._incoming); + dumpn(`Got: ${this._incoming}`); } this._destroyIncoming(); }, @@ -56974,7 +44029,6 @@ return /******/ (function(modules) { // webpackBootstrap this._incomingHeader = ""; this._incoming = null; } - }; exports.DebuggerTransport = DebuggerTransport; @@ -57017,9 +44071,9 @@ return /******/ (function(modules) { // webpackBootstrap if (dumpn.wantLogging) { /* Check 'from' first, as 'echo' packets have both. */ if (packet.from) { - dumpn("Packet " + serial + " sent from " + uneval(packet.from)); + dumpn(`Packet ${serial} sent from ${uneval(packet.from)}`); } else if (packet.to) { - dumpn("Packet " + serial + " sent to " + uneval(packet.to)); + dumpn(`Packet ${serial} sent to ${uneval(packet.to)}`); } } this._deepFreeze(packet); @@ -57028,7 +44082,7 @@ return /******/ (function(modules) { // webpackBootstrap DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { // Avoid the cost of JSON.stringify() when logging is disabled. if (dumpn.wantLogging) { - dumpn("Received packet " + serial + ": " + JSON.stringify(packet, null, 2)); + dumpn(`Received packet ${serial}: ${JSON.stringify(packet, null, 2)}`); } if (other.hooks) { other.emit("onPacket", packet); @@ -57056,7 +44110,7 @@ return /******/ (function(modules) { // webpackBootstrap var serial = this._serial.count++; - dumpn("Sent bulk packet " + serial + " for actor " + actor); + dumpn(`Sent bulk packet ${serial} for actor ${actor}`); if (!this.other) { return; } @@ -57064,7 +44118,7 @@ return /******/ (function(modules) { // webpackBootstrap var pipe = new Pipe(true, true, 0, 0, null); DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { - dumpn("Received bulk packet " + serial); + dumpn(`Received bulk packet ${serial}`); if (!this.other.hooks) { return; } @@ -57181,7 +44235,7 @@ return /******/ (function(modules) { // webpackBootstrap EventEmitter.decorate(this); this._sender = sender.QueryInterface(Ci.nsIMessageSender); - this._messageName = "debug:" + prefix + ":packet"; + this._messageName = `debug:${prefix}:packet`; } /* @@ -57233,7 +44287,7 @@ return /******/ (function(modules) { // webpackBootstrap // same worker. Consequently, each transport has a connection id, to allow // messages from multiple connections to be multiplexed on a single channel. - if (typeof WorkerGlobalScope === 'undefined') { + if (typeof WorkerGlobalScope === "undefined") { // i.e. not in a worker (function () { // Main thread @@ -57343,7 +44397,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 867 */ +/* 987 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -57352,22 +44406,17 @@ return /******/ (function(modules) { // webpackBootstrap * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - var _require = __webpack_require__(834), + var _require = __webpack_require__(978), Ci = _require.Ci, Cc = _require.Cc, Cr = _require.Cr, CC = _require.CC; - var _require2 = __webpack_require__(29), - Services = _require2.Services; + var _require2 = __webpack_require__(979), + dumpv = _require2.dumpv; - var _require3 = __webpack_require__(833), - dumpv = _require3.dumpv; - - var EventEmitter = __webpack_require__(844); - var promise = __webpack_require__(839); - - var IOUtil = Cc("@mozilla.org/io-util;1").getService(Ci.nsIIOUtil); + var EventEmitter = __webpack_require__(985); + var promise = __webpack_require__(980); var ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream", "init"); @@ -57406,141 +44455,7 @@ return /******/ (function(modules) { // webpackBootstrap * The promise is resolved when copying completes or rejected if any * (unexpected) errors occur. */ - function copyStream(input, output, length) { - var copier = new StreamCopier(input, output, length); - return copier.copy(); - } - - function StreamCopier(input, output, length) { - EventEmitter.decorate(this); - this._id = StreamCopier._nextId++; - this.input = input; - // Save off the base output stream, since we know it's async as we've required - this.baseAsyncOutput = output; - if (IOUtil.outputStreamIsBuffered(output)) { - this.output = output; - } else { - this.output = Cc("@mozilla.org/network/buffered-output-stream;1").createInstance(Ci.nsIBufferedOutputStream); - this.output.init(output, BUFFER_SIZE); - } - this._length = length; - this._amountLeft = length; - this._deferred = promise.defer(); - - this._copy = this._copy.bind(this); - this._flush = this._flush.bind(this); - this._destroy = this._destroy.bind(this); - - // Copy promise's then method up to this object. - // Allows the copier to offer a promise interface for the simple succeed or - // fail scenarios, but also emit events (due to the EventEmitter) for other - // states, like progress. - this.then = this._deferred.promise.then.bind(this._deferred.promise); - this.then(this._destroy, this._destroy); - - // Stream ready callback starts as |_copy|, but may switch to |_flush| at end - // if flushing would block the output stream. - this._streamReadyCallback = this._copy; - } - StreamCopier._nextId = 0; - - StreamCopier.prototype = { - - copy: function () { - // Dispatch to the next tick so that it's possible to attach a progress - // event listener, even for extremely fast copies (like when testing). - Services.tm.dispatchToMainThread(() => { - try { - this._copy(); - } catch (e) { - this._deferred.reject(e); - } - }); - return this; - }, - - _copy: function () { - var bytesAvailable = this.input.available(); - var amountToCopy = Math.min(bytesAvailable, this._amountLeft); - this._debug("Trying to copy: " + amountToCopy); - - var bytesCopied = void 0; - try { - bytesCopied = this.output.writeFrom(this.input, amountToCopy); - } catch (e) { - if (e.result == Cr.NS_BASE_STREAM_WOULD_BLOCK) { - this._debug("Base stream would block, will retry"); - this._debug("Waiting for output stream"); - this.baseAsyncOutput.asyncWait(this, 0, 0, Services.tm.currentThread); - return; - } else { - throw e; - } - } - - this._amountLeft -= bytesCopied; - this._debug("Copied: " + bytesCopied + ", Left: " + this._amountLeft); - this._emitProgress(); - - if (this._amountLeft === 0) { - this._debug("Copy done!"); - this._flush(); - return; - } - - this._debug("Waiting for input stream"); - this.input.asyncWait(this, 0, 0, Services.tm.currentThread); - }, - - _emitProgress: function () { - this.emit("progress", { - bytesSent: this._length - this._amountLeft, - totalBytes: this._length - }); - }, - - _flush: function () { - try { - this.output.flush(); - } catch (e) { - if (e.result == Cr.NS_BASE_STREAM_WOULD_BLOCK || e.result == Cr.NS_ERROR_FAILURE) { - this._debug("Flush would block, will retry"); - this._streamReadyCallback = this._flush; - this._debug("Waiting for output stream"); - this.baseAsyncOutput.asyncWait(this, 0, 0, Services.tm.currentThread); - return; - } else { - throw e; - } - } - this._deferred.resolve(); - }, - - _destroy: function () { - this._destroy = null; - this._copy = null; - this._flush = null; - this.input = null; - this.output = null; - }, - - // nsIInputStreamCallback - onInputStreamReady: function () { - this._streamReadyCallback(); - }, - - // nsIOutputStreamCallback - onOutputStreamReady: function () { - this._streamReadyCallback(); - }, - - _debug: function (msg) { - // Prefix logs with the copier ID, which makes logs much easier to - // understand when several copiers are running simultaneously - dumpv("Copier: " + this._id + " " + msg); - } - - }; + function copyStream(input, output, length) {} /** * Read from a stream, one byte at a time, up to the next |delimiter| @@ -57561,7 +44476,7 @@ return /******/ (function(modules) { // webpackBootstrap * end with it. */ function delimitedRead(stream, delimiter, count) { - dumpv("Starting delimited read for " + delimiter + " up to " + count + " bytes"); + dumpv(`Starting delimited read for ${delimiter} up to ${count} bytes`); var scriptableStream = void 0; if (stream.readBytes) { @@ -57595,13 +44510,9 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }, -/* 868 */ +/* 988 */ /***/ function(module, exports, __webpack_require__) { - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; /** @@ -57624,25 +44535,19 @@ return /******/ (function(modules) { // webpackBootstrap * Called to clean up at the end of use */ - var _require = __webpack_require__(834), + var _require = __webpack_require__(978), Cc = _require.Cc, Ci = _require.Ci, Cu = _require.Cu; - var DevToolsUtils = __webpack_require__(833); + var DevToolsUtils = __webpack_require__(979); var dumpn = DevToolsUtils.dumpn, dumpv = DevToolsUtils.dumpv; - var StreamUtils = __webpack_require__(867); - var promise = __webpack_require__(839); + var StreamUtils = __webpack_require__(987); + var promise = __webpack_require__(980); - /*DevToolsUtils.defineLazyGetter(this, "unicodeConverter", () => { - const unicodeConverter = Cc("@mozilla.org/intl/scriptableunicodeconverter") - .createInstance(Ci.nsIScriptableUnicodeConverter); - unicodeConverter.charset = "UTF-8"; - return unicodeConverter; - });*/ - var utf8 = __webpack_require__(869); + var utf8 = __webpack_require__(989); // The transport's previous check ensured the header length did not exceed 20 // characters. Here, we opt for the somewhat smaller, but still large limit of @@ -58024,7 +44929,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.RawPacket = RawPacket; /***/ }, -/* 869 */ +/* 989 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {'use strict'; @@ -58272,3881 +45177,101 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) /***/ }, -/* 870 */ +/* 990 */ /***/ function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {'use strict'; - - /*! https://mths.be/utf8js v2.0.0 by @mathias */ - ;(function (root) { - - // Detect free variables `exports` - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module` - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root` - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - var stringFromCharCode = String.fromCharCode; - - // Taken from https://mths.be/punycode - function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - var value; - var extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { - // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - // Taken from https://mths.be/punycode - function ucs2encode(array) { - var length = array.length; - var index = -1; - var value; - var output = ''; - while (++index < length) { - value = array[index]; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - } - return output; - } - - function checkScalarValue(codePoint) { - if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { - throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() + ' is not a scalar value'); - } - } - /*--------------------------------------------------------------------------*/ - - function createByte(codePoint, shift) { - return stringFromCharCode(codePoint >> shift & 0x3F | 0x80); - } - - function encodeCodePoint(codePoint) { - if ((codePoint & 0xFFFFFF80) == 0) { - // 1-byte sequence - return stringFromCharCode(codePoint); - } - var symbol = ''; - if ((codePoint & 0xFFFFF800) == 0) { - // 2-byte sequence - symbol = stringFromCharCode(codePoint >> 6 & 0x1F | 0xC0); - } else if ((codePoint & 0xFFFF0000) == 0) { - // 3-byte sequence - checkScalarValue(codePoint); - symbol = stringFromCharCode(codePoint >> 12 & 0x0F | 0xE0); - symbol += createByte(codePoint, 6); - } else if ((codePoint & 0xFFE00000) == 0) { - // 4-byte sequence - symbol = stringFromCharCode(codePoint >> 18 & 0x07 | 0xF0); - symbol += createByte(codePoint, 12); - symbol += createByte(codePoint, 6); - } - symbol += stringFromCharCode(codePoint & 0x3F | 0x80); - return symbol; - } - - function utf8encode(string) { - var codePoints = ucs2decode(string); - var length = codePoints.length; - var index = -1; - var codePoint; - var byteString = ''; - while (++index < length) { - codePoint = codePoints[index]; - byteString += encodeCodePoint(codePoint); - } - return byteString; - } - - /*--------------------------------------------------------------------------*/ - - function readContinuationByte() { - if (byteIndex >= byteCount) { - throw Error('Invalid byte index'); - } - - var continuationByte = byteArray[byteIndex] & 0xFF; - byteIndex++; - - if ((continuationByte & 0xC0) == 0x80) { - return continuationByte & 0x3F; - } - - // If we end up here, it’s not a continuation byte - throw Error('Invalid continuation byte'); - } - - function decodeSymbol() { - var byte1; - var byte2; - var byte3; - var byte4; - var codePoint; - - if (byteIndex > byteCount) { - throw Error('Invalid byte index'); - } - - if (byteIndex == byteCount) { - return false; - } - - // Read first byte - byte1 = byteArray[byteIndex] & 0xFF; - byteIndex++; - - // 1-byte sequence (no continuation bytes) - if ((byte1 & 0x80) == 0) { - return byte1; - } - - // 2-byte sequence - if ((byte1 & 0xE0) == 0xC0) { - var byte2 = readContinuationByte(); - codePoint = (byte1 & 0x1F) << 6 | byte2; - if (codePoint >= 0x80) { - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 3-byte sequence (may include unpaired surrogates) - if ((byte1 & 0xF0) == 0xE0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - codePoint = (byte1 & 0x0F) << 12 | byte2 << 6 | byte3; - if (codePoint >= 0x0800) { - checkScalarValue(codePoint); - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 4-byte sequence - if ((byte1 & 0xF8) == 0xF0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - byte4 = readContinuationByte(); - codePoint = (byte1 & 0x0F) << 0x12 | byte2 << 0x0C | byte3 << 0x06 | byte4; - if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { - return codePoint; - } - } - - throw Error('Invalid UTF-8 detected'); - } - - var byteArray; - var byteCount; - var byteIndex; - function utf8decode(byteString) { - byteArray = ucs2decode(byteString); - byteCount = byteArray.length; - byteIndex = 0; - var codePoints = []; - var tmp; - while ((tmp = decodeSymbol()) !== false) { - codePoints.push(tmp); - } - return ucs2encode(codePoints); - } - - /*--------------------------------------------------------------------------*/ - - var utf8 = { - 'version': '2.0.0', - 'encode': utf8encode, - 'decode': utf8decode - }; - - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if (true) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { - return utf8; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { - // in Node.js or RingoJS v0.8.0+ - freeModule.exports = utf8; - } else { - // in Narwhal or RingoJS v0.7.0- - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - for (var key in utf8) { - hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); - } - } - } else { - // in Rhino or a web browser - root.utf8 = utf8; - } - })(undefined); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) - -/***/ }, -/* 871 */ -/***/ function(module, exports, __webpack_require__) { + "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - - // See bug 1273941 to understand this choice of promise. - - var Promise = __webpack_require__(839); - - /** - * Returns a deferred object, with a resolve and reject property. - * https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred - */ - module.exports = function defer() { - var resolve = void 0, - reject = void 0; - var promise = new Promise(function () { - resolve = arguments[0]; - reject = arguments[1]; - }); - return { - resolve: resolve, - reject: reject, - promise: promise - }; - }; - -/***/ }, -/* 872 */ -/***/ function(module, exports) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - /** - * DevTools is a class that represents a set of developer tools, it holds a - * set of tools and keeps track of open toolboxes in the browser. - */ - - var DevTools = { - chromeWindowType: "navigator:browser" - }; - - exports.gDevTools = DevTools; - -/***/ }, -/* 873 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - var EventEmitter = __webpack_require__(844); - - var _require = __webpack_require__(874), - listenOnce = _require.listenOnce; - - var _require2 = __webpack_require__(875), - Task = _require2.Task; - - var _require3 = __webpack_require__(876), - TooltipToggle = _require3.TooltipToggle; - - var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - var XHTML_NS = "http://www.w3.org/1999/xhtml"; - - var POSITION = { - TOP: "top", - BOTTOM: "bottom" - }; - - module.exports.POSITION = POSITION; - - var TYPE = { - NORMAL: "normal", - ARROW: "arrow" - }; - - module.exports.TYPE = TYPE; - - var ARROW_WIDTH = 32; - - // Default offset between the tooltip's left edge and the tooltip arrow. - var ARROW_OFFSET = 20; - - var EXTRA_HEIGHT = { - "normal": 0, - // The arrow is 16px tall, but merges on 3px with the panel border - "arrow": 13 - }; - - var EXTRA_BORDER = { - "normal": 0, - "arrow": 3 - }; - - /** - * Calculate the vertical position & offsets to use for the tooltip. Will attempt to - * respect the provided height and position preferences, unless the available height - * prevents this. - * - * @param {DOMRect} anchorRect - * Bounding rectangle for the anchor, relative to the tooltip document. - * @param {DOMRect} viewportRect - * Bounding rectangle for the viewport. top/left can be different from 0 if some - * space should not be used by tooltips (for instance OS toolbars, taskbars etc.). - * @param {Number} height - * Preferred height for the tooltip. - * @param {String} pos - * Preferred position for the tooltip. Possible values: "top" or "bottom". - * @return {Object} - * - {Number} top: the top offset for the tooltip. - * - {Number} height: the height to use for the tooltip container. - * - {String} computedPosition: Can differ from the preferred position depending - * on the available height). "top" or "bottom" - */ - var calculateVerticalPosition = function (anchorRect, viewportRect, height, pos, offset) { - var TOP = POSITION.TOP, - BOTTOM = POSITION.BOTTOM; - var anchorTop = anchorRect.top, - anchorHeight = anchorRect.height; - - // Translate to the available viewport space before calculating dimensions and position. - - anchorTop -= viewportRect.top; - - // Calculate available space for the tooltip. - var availableTop = anchorTop; - var availableBottom = viewportRect.height - (anchorTop + anchorHeight); - - // Find POSITION - var keepPosition = false; - if (pos === TOP) { - keepPosition = availableTop >= height + offset; - } else if (pos === BOTTOM) { - keepPosition = availableBottom >= height + offset; - } - if (!keepPosition) { - pos = availableTop > availableBottom ? TOP : BOTTOM; - } - - // Calculate HEIGHT. - var availableHeight = pos === TOP ? availableTop : availableBottom; - height = Math.min(height, availableHeight - offset); - height = Math.floor(height); - - // Calculate TOP. - var top = pos === TOP ? anchorTop - height - offset : anchorTop + anchorHeight + offset; - - // Translate back to absolute coordinates by re-including viewport top margin. - top += viewportRect.top; - - return { top, height, computedPosition: pos }; - }; - - /** - * Calculate the vertical position & offsets to use for the tooltip. Will attempt to - * respect the provided height and position preferences, unless the available height - * prevents this. - * - * @param {DOMRect} anchorRect - * Bounding rectangle for the anchor, relative to the tooltip document. - * @param {DOMRect} viewportRect - * Bounding rectangle for the viewport. top/left can be different from 0 if some - * space should not be used by tooltips (for instance OS toolbars, taskbars etc.). - * @param {Number} width - * Preferred width for the tooltip. - * @param {String} type - * The tooltip type (e.g. "arrow"). - * @param {Number} offset - * Horizontal offset in pixels. - * @param {Boolean} isRtl - * If the anchor is in RTL, the tooltip should be aligned to the right. - * @return {Object} - * - {Number} left: the left offset for the tooltip. - * - {Number} width: the width to use for the tooltip container. - * - {Number} arrowLeft: the left offset to use for the arrow element. - */ - var calculateHorizontalPosition = function (anchorRect, viewportRect, width, type, offset, isRtl) { - var anchorWidth = anchorRect.width; - var anchorStart = isRtl ? anchorRect.right : anchorRect.left; - - // Translate to the available viewport space before calculating dimensions and position. - anchorStart -= viewportRect.left; - - // Calculate WIDTH. - width = Math.min(width, viewportRect.width); - - // Calculate LEFT. - // By default the tooltip is aligned with the anchor left edge. Unless this - // makes it overflow the viewport, in which case is shifts to the left. - var left = anchorStart + offset - (isRtl ? width : 0); - left = Math.min(left, viewportRect.width - width); - left = Math.max(0, left); - - // Calculate ARROW LEFT (tooltip's LEFT might be updated) - var arrowLeft = void 0; - // Arrow style tooltips may need to be shifted to the left - if (type === TYPE.ARROW) { - var arrowCenter = left + ARROW_OFFSET + ARROW_WIDTH / 2; - var anchorCenter = anchorStart + anchorWidth / 2; - // If the anchor is too narrow, align the arrow and the anchor center. - if (arrowCenter > anchorCenter) { - left = Math.max(0, left - (arrowCenter - anchorCenter)); - } - // Arrow's left offset relative to the anchor. - arrowLeft = Math.min(ARROW_OFFSET, (anchorWidth - ARROW_WIDTH) / 2) | 0; - // Translate the coordinate to tooltip container - arrowLeft += anchorStart - left; - // Make sure the arrow remains in the tooltip container. - arrowLeft = Math.min(arrowLeft, width - ARROW_WIDTH); - arrowLeft = Math.max(arrowLeft, 0); - } - - // Translate back to absolute coordinates by re-including viewport left margin. - left += viewportRect.left; - - return { left, width, arrowLeft }; - }; - - /** - * Get the bounding client rectangle for a given node, relative to a custom - * reference element (instead of the default for getBoundingClientRect which - * is always the element's ownerDocument). - */ - var getRelativeRect = function (node, relativeTo) { - // Width and Height can be taken from the rect. - var _node$getBoundingClie = node.getBoundingClientRect(), - width = _node$getBoundingClie.width, - height = _node$getBoundingClie.height; - - var quads = node.getBoxQuads({ relativeTo }); - var top = quads[0].bounds.top; - var left = quads[0].bounds.left; - - // Compute right and bottom coordinates using the rest of the data. - var right = left + width; - var bottom = top + height; - - return { top, right, bottom, left, width, height }; - }; - - /** - * The HTMLTooltip can display HTML content in a tooltip popup. - * - * @param {Document} toolboxDoc - * The toolbox document to attach the HTMLTooltip popup. - * @param {Object} - * - {String} type - * Display type of the tooltip. Possible values: "normal", "arrow" - * - {Boolean} autofocus - * Defaults to false. Should the tooltip be focused when opening it. - * - {Boolean} consumeOutsideClicks - * Defaults to true. The tooltip is closed when clicking outside. - * Should this event be stopped and consumed or not. - * - {Boolean} useXulWrapper - * Defaults to false. If the tooltip is hosted in a XUL document, use a XUL panel - * in order to use all the screen viewport available. - * - {String} stylesheet - * Style sheet URL to apply to the tooltip content. - */ - function HTMLTooltip(toolboxDoc) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$type = _ref.type, - type = _ref$type === undefined ? "normal" : _ref$type, - _ref$autofocus = _ref.autofocus, - autofocus = _ref$autofocus === undefined ? false : _ref$autofocus, - _ref$consumeOutsideCl = _ref.consumeOutsideClicks, - consumeOutsideClicks = _ref$consumeOutsideCl === undefined ? true : _ref$consumeOutsideCl, - _ref$useXulWrapper = _ref.useXulWrapper, - useXulWrapper = _ref$useXulWrapper === undefined ? false : _ref$useXulWrapper, - _ref$stylesheet = _ref.stylesheet, - stylesheet = _ref$stylesheet === undefined ? "" : _ref$stylesheet; + var EventEmitter = __webpack_require__(985); + function WebSocketDebuggerTransport(socket) { EventEmitter.decorate(this); - this.doc = toolboxDoc; - this.type = type; - this.autofocus = autofocus; - this.consumeOutsideClicks = consumeOutsideClicks; - this.useXulWrapper = this._isXUL() && useXulWrapper; - - // The top window is used to attach click event listeners to close the tooltip if the - // user clicks on the content page. - this.topWindow = this._getTopWindow(); - - this._position = null; - - this._onClick = this._onClick.bind(this); - this._onXulPanelHidden = this._onXulPanelHidden.bind(this); - - this._toggle = new TooltipToggle(this); - this.startTogglingOnHover = this._toggle.start.bind(this._toggle); - this.stopTogglingOnHover = this._toggle.stop.bind(this._toggle); - - this.container = this._createContainer(); - - if (stylesheet) { - this._applyStylesheet(stylesheet); - } - if (this.useXulWrapper) { - // When using a XUL panel as the wrapper, the actual markup for the tooltip is as - // follows : - // - //
- //
- this.xulPanelWrapper = this._createXulPanelWrapper(); - var inner = this.doc.createElementNS(XHTML_NS, "div"); - inner.classList.add("tooltip-xul-wrapper-inner"); - - this.doc.documentElement.appendChild(this.xulPanelWrapper); - this.xulPanelWrapper.appendChild(inner); - inner.appendChild(this.container); - } else if (this._isXUL()) { - this.doc.documentElement.appendChild(this.container); - } else { - // In non-XUL context the container is ready to use as is. - this.doc.body.appendChild(this.container); - } + this.active = false; + this.hooks = null; + this.socket = socket; } - module.exports.HTMLTooltip = HTMLTooltip; - - HTMLTooltip.prototype = { - /** - * The tooltip panel is the parentNode of the tooltip content provided in - * setContent(). - */ - get panel() { - return this.container.querySelector(".tooltip-panel"); - }, - - /** - * The arrow element. Might be null depending on the tooltip type. - */ - get arrow() { - return this.container.querySelector(".tooltip-arrow"); - }, - - /** - * Retrieve the displayed position used for the tooltip. Null if the tooltip is hidden. - */ - get position() { - return this.isVisible() ? this._position : null; - }, - - /** - * Set the tooltip content element. The preferred width/height should also be - * specified here. - * - * @param {Element} content - * The tooltip content, should be a HTML element. - * @param {Object} - * - {Number} width: preferred width for the tooltip container. If not specified - * the tooltip container will be measured before being displayed, and the - * measured width will be used as preferred width. - * - {Number} height: optional, preferred height for the tooltip container. If - * not specified, the tooltip will be able to use all the height available. - */ - setContent: function (content) { - var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref2$width = _ref2.width, - width = _ref2$width === undefined ? "auto" : _ref2$width, - _ref2$height = _ref2.height, - height = _ref2$height === undefined ? Infinity : _ref2$height; - - this.preferredWidth = width; - this.preferredHeight = height; - - this.panel.innerHTML = ""; - this.panel.appendChild(content); - }, - - /** - * Show the tooltip next to the provided anchor element. A preferred position - * can be set. The event "shown" will be fired after the tooltip is displayed. - * - * @param {Element} anchor - * The reference element with which the tooltip should be aligned - * @param {Object} - * - {String} position: optional, possible values: top|bottom - * If layout permits, the tooltip will be displayed on top/bottom - * of the anchor. If ommitted, the tooltip will be displayed where - * more space is available. - * - {Number} x: optional, horizontal offset between the anchor and the tooltip - * - {Number} y: optional, vertical offset between the anchor and the tooltip - */ - show: Task.async(function* (anchor) { - var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - position = _ref3.position, - _ref3$x = _ref3.x, - x = _ref3$x === undefined ? 0 : _ref3$x, - _ref3$y = _ref3.y, - y = _ref3$y === undefined ? 0 : _ref3$y; - - // Get anchor geometry - var anchorRect = getRelativeRect(anchor, this.doc); - if (this.useXulWrapper) { - anchorRect = this._convertToScreenRect(anchorRect); - } - - // Get viewport size - var viewportRect = this._getViewportRect(); - - var themeHeight = EXTRA_HEIGHT[this.type] + 2 * EXTRA_BORDER[this.type]; - var preferredHeight = this.preferredHeight + themeHeight; - - var _calculateVerticalPos = calculateVerticalPosition(anchorRect, viewportRect, preferredHeight, position, y), - top = _calculateVerticalPos.top, - height = _calculateVerticalPos.height, - computedPosition = _calculateVerticalPos.computedPosition; - - this._position = computedPosition; - // Apply height before measuring the content width (if width="auto"). - var isTop = computedPosition === POSITION.TOP; - this.container.classList.toggle("tooltip-top", isTop); - this.container.classList.toggle("tooltip-bottom", !isTop); - - // If the preferred height is set to Infinity, the tooltip container should grow based - // on its content's height and use as much height as possible. - this.container.classList.toggle("tooltip-flexible-height", this.preferredHeight === Infinity); - - this.container.style.height = height + "px"; - - var preferredWidth = void 0; - if (this.preferredWidth === "auto") { - preferredWidth = this._measureContainerWidth(); - } else { - var themeWidth = 2 * EXTRA_BORDER[this.type]; - preferredWidth = this.preferredWidth + themeWidth; - } - - var anchorWin = anchor.ownerDocument.defaultView; - var isRtl = anchorWin.getComputedStyle(anchor).direction === "rtl"; - - var _calculateHorizontalP = calculateHorizontalPosition(anchorRect, viewportRect, preferredWidth, this.type, x, isRtl), - left = _calculateHorizontalP.left, - width = _calculateHorizontalP.width, - arrowLeft = _calculateHorizontalP.arrowLeft; - - this.container.style.width = width + "px"; - - if (this.type === TYPE.ARROW) { - this.arrow.style.left = arrowLeft + "px"; - } - - if (this.useXulWrapper) { - yield this._showXulWrapperAt(left, top); - } else { - this.container.style.left = left + "px"; - this.container.style.top = top + "px"; - } - - this.container.classList.add("tooltip-visible"); - - // Keep a pointer on the focused element to refocus it when hiding the tooltip. - this._focusedElement = this.doc.activeElement; - - this.doc.defaultView.clearTimeout(this.attachEventsTimer); - this.attachEventsTimer = this.doc.defaultView.setTimeout(() => { - this._maybeFocusTooltip(); - // Updated the top window reference each time in case the host changes. - this.topWindow = this._getTopWindow(); - this.topWindow.addEventListener("click", this._onClick, true); - this.emit("shown"); - }, 0); - }), - - /** - * Calculate the rect of the viewport that limits the tooltip dimensions. When using a - * XUL panel wrapper, the viewport will be able to use the whole screen (excluding space - * reserved by the OS for toolbars etc.). Otherwise, the viewport is limited to the - * tooltip's document. - * - * @return {Object} DOMRect-like object with the Number properties: top, right, bottom, - * left, width, height - */ - _getViewportRect: function () { - if (this.useXulWrapper) { - // availLeft/Top are the coordinates first pixel available on the screen for - // applications (excluding space dedicated for OS toolbars, menus etc...) - // availWidth/Height are the dimensions available to applications excluding all - // the OS reserved space - var _doc$defaultView$scre = this.doc.defaultView.screen, - availLeft = _doc$defaultView$scre.availLeft, - availTop = _doc$defaultView$scre.availTop, - availHeight = _doc$defaultView$scre.availHeight, - availWidth = _doc$defaultView$scre.availWidth; - - return { - top: availTop, - right: availLeft + availWidth, - bottom: availTop + availHeight, - left: availLeft, - width: availWidth, - height: availHeight - }; - } - - return this.doc.documentElement.getBoundingClientRect(); - }, - - _measureContainerWidth: function () { - var xulParent = this.container.parentNode; - if (this.useXulWrapper && !this.isVisible()) { - // Move the container out of the XUL Panel to measure it. - this.doc.documentElement.appendChild(this.container); - } - - this.container.classList.add("tooltip-hidden"); - this.container.style.width = "auto"; - var width = this.container.getBoundingClientRect().width; - this.container.classList.remove("tooltip-hidden"); - - if (this.useXulWrapper && !this.isVisible()) { - xulParent.appendChild(this.container); - } - - return width; - }, - - /** - * Hide the current tooltip. The event "hidden" will be fired when the tooltip - * is hidden. - */ - hide: Task.async(function* () { - this.doc.defaultView.clearTimeout(this.attachEventsTimer); - if (!this.isVisible()) { - this.emit("hidden"); + WebSocketDebuggerTransport.prototype = { + ready() { + if (this.active) { return; } - this.topWindow.removeEventListener("click", this._onClick, true); - this.container.classList.remove("tooltip-visible"); - if (this.useXulWrapper) { - yield this._hideXulWrapper(); - } + this.socket.addEventListener("message", this); + this.socket.addEventListener("close", this); - this.emit("hidden"); - - var tooltipHasFocus = this.container.contains(this.doc.activeElement); - if (tooltipHasFocus && this._focusedElement) { - this._focusedElement.focus(); - this._focusedElement = null; - } - }), - - /** - * Check if the tooltip is currently displayed. - * @return {Boolean} true if the tooltip is visible - */ - isVisible: function () { - return this.container.classList.contains("tooltip-visible"); + this.active = true; }, - /** - * Destroy the tooltip instance. Hide the tooltip if displayed, remove the - * tooltip container from the document. - */ - destroy: function () { - this.hide(); - this.container.remove(); - if (this.xulPanelWrapper) { - this.xulPanelWrapper.remove(); + send(object) { + this.emit("send", object); + if (this.socket) { + this.socket.send(JSON.stringify(object)); } }, - _createContainer: function () { - var container = this.doc.createElementNS(XHTML_NS, "div"); - container.setAttribute("type", this.type); - container.classList.add("tooltip-container"); - - var html = '
'; - html += '
'; - - if (this.type === TYPE.ARROW) { - html += '
'; - } - container.innerHTML = html; - return container; + startBulkSend() { + throw new Error("Bulk send is not supported by WebSocket transport"); }, - _onClick: function (e) { - if (this._isInTooltipContainer(e.target)) { - return; - } + close() { + this.emit("close"); + this.active = false; - this.hide(); - if (this.consumeOutsideClicks && e.button === 0) { - // Consume only left click events (button === 0). - e.preventDefault(); - e.stopPropagation(); + this.socket.removeEventListener("message", this); + this.socket.removeEventListener("close", this); + this.socket.close(); + this.socket = null; + + if (this.hooks) { + this.hooks.onClosed(); + this.hooks = null; } }, - _isInTooltipContainer: function (node) { - // Check if the target is the tooltip arrow. - if (this.arrow && this.arrow === node) { - return true; - } - - var tooltipWindow = this.panel.ownerDocument.defaultView; - var win = node.ownerDocument.defaultView; - - // Check if the tooltip panel contains the node if they live in the same document. - if (win === tooltipWindow) { - return this.panel.contains(node); - } - - // Check if the node window is in the tooltip container. - while (win.parent && win.parent !== win) { - if (win.parent === tooltipWindow) { - // If the parent window is the tooltip window, check if the tooltip contains - // the current frame element. - return this.panel.contains(win.frameElement); - } - win = win.parent; - } - - return false; - }, - - _onXulPanelHidden: function () { - if (this.isVisible()) { - this.hide(); + handleEvent(event) { + switch (event.type) { + case "message": + this.onMessage(event); + break; + case "close": + this.close(); + break; } }, - /** - * If the tootlip is configured to autofocus and a focusable element can be found, - * focus it. - */ - _maybeFocusTooltip: function () { - // Simplied selector targetting elements that can receive the focus, full version at - // http://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus . - var focusableSelector = "a, button, iframe, input, select, textarea"; - var focusableElement = this.panel.querySelector(focusableSelector); - if (this.autofocus && focusableElement) { - focusableElement.focus(); - } - }, + onMessage(_ref) { + var data = _ref.data; - _getTopWindow: function () { - return this.doc.defaultView.top; - }, - - /** - * Check if the tooltip's owner document is a XUL document. - */ - _isXUL: function () { - return this.doc.documentElement.namespaceURI === XUL_NS; - }, - - _createXulPanelWrapper: function () { - var panel = this.doc.createElementNS(XUL_NS, "panel"); - - // XUL panel is only a way to display DOM elements outside of the document viewport, - // so disable all features that impact the behavior. - panel.setAttribute("animate", false); - panel.setAttribute("consumeoutsideclicks", false); - panel.setAttribute("noautofocus", true); - panel.setAttribute("ignorekeys", true); - panel.setAttribute("tooltip", "aHTMLTooltip"); - - // Use type="arrow" to prevent side effects (see Bug 1285206) - panel.setAttribute("type", "arrow"); - - panel.setAttribute("level", "top"); - panel.setAttribute("class", "tooltip-xul-wrapper"); - - return panel; - }, - - _showXulWrapperAt: function (left, top) { - this.xulPanelWrapper.addEventListener("popuphidden", this._onXulPanelHidden); - var onPanelShown = listenOnce(this.xulPanelWrapper, "popupshown"); - this.xulPanelWrapper.openPopupAtScreen(left, top, false); - return onPanelShown; - }, - - _hideXulWrapper: function () { - this.xulPanelWrapper.removeEventListener("popuphidden", this._onXulPanelHidden); - - if (this.xulPanelWrapper.state === "closed") { - // XUL panel is already closed, resolve immediately. - return Promise.resolve(); + if (typeof data !== "string") { + throw new Error("Binary messages are not supported by WebSocket transport"); } - var onPanelHidden = listenOnce(this.xulPanelWrapper, "popuphidden"); - this.xulPanelWrapper.hidePopup(); - return onPanelHidden; - }, - - /** - * Convert from coordinates relative to the tooltip's document, to coordinates relative - * to the "available" screen. By "available" we mean the screen, excluding the OS bars - * display on screen edges. - */ - _convertToScreenRect: function (_ref4) { - var left = _ref4.left, - top = _ref4.top, - width = _ref4.width, - height = _ref4.height; - - // mozInnerScreenX/Y are the coordinates of the top left corner of the window's - // viewport, excluding chrome UI. - left += this.doc.defaultView.mozInnerScreenX; - top += this.doc.defaultView.mozInnerScreenY; - return { top, right: left + width, bottom: top + height, left, width, height }; - }, - - /** - * Apply a scoped stylesheet to the container so that this css file only - * applies to it. - */ - _applyStylesheet: function (url) { - var style = this.doc.createElementNS(XHTML_NS, "style"); - style.setAttribute("scoped", "true"); - url = url.replace(/"/g, "\\\""); - style.textContent = `@import url("${url}");`; - this.container.appendChild(style); + var object = JSON.parse(data); + this.emit("packet", object); + if (this.hooks) { + this.hooks.onPacket(object); + } } }; + module.exports = WebSocketDebuggerTransport; + /***/ }, -/* 874 */ -/***/ function(module, exports, __webpack_require__) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - /** - * Helpers for async functions. Async functions are generator functions that are - * run by Tasks. An async function returns a Promise for the resolution of the - * function. When the function returns, the promise is resolved with the - * returned value. If it throws the promise rejects with the thrown error. - * - * See Task documentation at https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Task.jsm. - */ - - var _require = __webpack_require__(875), - Task = _require.Task; - - var Promise = __webpack_require__(839); - - /** - * Create an async function that only executes once per instance of an object. - * Once called on a given object, the same promise will be returned for any - * future calls for that object. - * - * @param Function func - * The generator function that to wrap as an async function. - * @return Function - * The async function. - */ - exports.asyncOnce = function asyncOnce(func) { - var promises = new WeakMap(); - return function () { - var promise = promises.get(this); - if (!promise) { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - promise = Task.spawn(func.apply(this, args)); - promises.set(this, promise); - } - return promise; - }; - }; - - /** - * Adds an event listener to the given element, and then removes its event - * listener once the event is called, returning the event object as a promise. - * @param nsIDOMElement element - * The DOM element to listen on - * @param String event - * The name of the event type to listen for - * @param Boolean useCapture - * Should we initiate the capture phase? - * @return Promise - * The promise resolved with the event object when the event first - * happens - */ - exports.listenOnce = function listenOnce(element, event, useCapture) { - return new Promise(function (resolve, reject) { - var onEvent = function (ev) { - element.removeEventListener(event, onEvent, useCapture); - resolve(ev); - }; - element.addEventListener(event, onEvent, useCapture); - }); - }; - - /** - * Call a function that expects a callback as the last argument and returns a - * promise for the result. This simplifies using callback APIs from tasks and - * async functions. - * - * @param Any obj - * The |this| value to call the function on. - * @param Function func - * The callback-expecting function to call. - * @param Array args - * Additional arguments to pass to the method. - * @return Promise - * The promise for the result. If the callback is called with only one - * argument, it is used as the resolution value. If there's multiple - * arguments, an array containing the arguments is the resolution value. - * If the method throws, the promise is rejected with the thrown value. - */ - function promisify(obj, func, args) { - return new Promise(resolve => { - args.push(function () { - for (var _len2 = arguments.length, results = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - results[_key2] = arguments[_key2]; - } - - resolve(results.length > 1 ? results : results[0]); - }); - func.apply(obj, args); - }); - } - - /** - * Call a method that expects a callback as the last argument and returns a - * promise for the result. - * - * @see promisify - */ - exports.promiseInvoke = function promiseInvoke(obj, func) { - for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { - args[_key3 - 2] = arguments[_key3]; - } - - return promisify(obj, func, args); - }; - - /** - * Call a function that expects a callback as the last argument. - * - * @see promisify - */ - exports.promiseCall = function promiseCall(func) { - for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - - return promisify(undefined, func, args); - }; - -/***/ }, -/* 875 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - /* eslint-disable spaced-comment */ - /* globals StopIteration */ - - /** - * This module implements a subset of "Task.js" . - * It is a copy of toolkit/modules/Task.jsm. Please try not to - * diverge the API here. - * - * Paraphrasing from the Task.js site, tasks make sequential, asynchronous - * operations simple, using the power of JavaScript's "yield" operator. - * - * Tasks are built upon generator functions and promises, documented here: - * - * - * - * - * The "Task.spawn" function takes a generator function and starts running it as - * a task. Every time the task yields a promise, it waits until the promise is - * fulfilled. "Task.spawn" returns a promise that is resolved when the task - * completes successfully, or is rejected if an exception occurs. - * - * ----------------------------------------------------------------------------- - * - * const {Task} = require("devtools/shared/task"); - * - * Task.spawn(function* () { - * - * // This is our task. Let's create a promise object, wait on it and capture - * // its resolution value. - * let myPromise = getPromiseResolvedOnTimeoutWithValue(1000, "Value"); - * let result = yield myPromise; - * - * // This part is executed only after the promise above is fulfilled (after - * // one second, in this imaginary example). We can easily loop while - * // calling asynchronous functions, and wait multiple times. - * for (let i = 0; i < 3; i++) { - * result += yield getPromiseResolvedOnTimeoutWithValue(50, "!"); - * } - * - * return "Resolution result for the task: " + result; - * }).then(function (result) { - * - * // result == "Resolution result for the task: Value!!!" - * - * // The result is undefined if no value was returned. - * - * }, function (exception) { - * - * // Failure! We can inspect or report the exception. - * - * }); - * - * ----------------------------------------------------------------------------- - * - * This module implements only the "Task.js" interfaces described above, with no - * additional features to control the task externally, or do custom scheduling. - * It also provides the following extensions that simplify task usage in the - * most common cases: - * - * - The "Task.spawn" function also accepts an iterator returned by a generator - * function, in addition to a generator function. This way, you can call into - * the generator function with the parameters you want, and with "this" bound - * to the correct value. Also, "this" is never bound to the task object when - * "Task.spawn" calls the generator function. - * - * - In addition to a promise object, a task can yield the iterator returned by - * a generator function. The iterator is turned into a task automatically. - * This reduces the syntax overhead of calling "Task.spawn" explicitly when - * you want to recurse into other task functions. - * - * - The "Task.spawn" function also accepts a primitive value, or a function - * returning a primitive value, and treats the value as the result of the - * task. This makes it possible to call an externally provided function and - * spawn a task from it, regardless of whether it is an asynchronous generator - * or a synchronous function. This comes in handy when iterating over - * function lists where some items have been converted to tasks and some not. - */ - - //////////////////////////////////////////////////////////////////////////////// - //// Globals - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var Promise = __webpack_require__(839); - var defer = __webpack_require__(871); - - // The following error types are considered programmer errors, which should be - // reported (possibly redundantly) so as to let programmers fix their code. - var ERRORS_TO_REPORT = ["EvalError", "RangeError", "ReferenceError", "TypeError"]; - - /** - * The Task currently being executed - */ - var gCurrentTask = null; - - /** - * If `true`, capture stacks whenever entering a Task and rewrite the - * stack any exception thrown through a Task. - */ - var gMaintainStack = false; - - /** - * Iterate through the lines of a string. - * - * @return Iterator - */ - function* linesOf(string) { - var reLine = /([^\r\n])+/g; - var match = void 0; - while (match = reLine.exec(string)) { - yield [match[0], match.index]; - } - } - - /** - * Detect whether a value is a generator. - * - * @param aValue - * The value to identify. - * @return A boolean indicating whether the value is a generator. - */ - function isGenerator(value) { - return Object.prototype.toString.call(value) == "[object Generator]"; - } - - //////////////////////////////////////////////////////////////////////////////// - //// Task - - /** - * This object provides the public module functions. - */ - var Task = { - /** - * Creates and starts a new task. - * - * @param task - * - If you specify a generator function, it is called with no - * arguments to retrieve the associated iterator. The generator - * function is a task, that is can yield promise objects to wait - * upon. - * - If you specify the iterator returned by a generator function you - * called, the generator function is also executed as a task. This - * allows you to call the function with arguments. - * - If you specify a function that is not a generator, it is called - * with no arguments, and its return value is used to resolve the - * returned promise. - * - If you specify anything else, you get a promise that is already - * resolved with the specified value. - * - * @return A promise object where you can register completion callbacks to be - * called when the task terminates. - */ - spawn: function (task) { - return createAsyncFunction(task)(); - }, - - /** - * Create and return an 'async function' that starts a new task. - * - * This is similar to 'spawn' except that it doesn't immediately start - * the task, it binds the task to the async function's 'this' object and - * arguments, and it requires the task to be a function. - * - * It simplifies the common pattern of implementing a method via a task, - * like this simple object with a 'greet' method that has a 'name' parameter - * and spawns a task to send a greeting and return its reply: - * - * let greeter = { - * message: "Hello, NAME!", - * greet: function(name) { - * return Task.spawn((function* () { - * return yield sendGreeting(this.message.replace(/NAME/, name)); - * }).bind(this); - * }) - * }; - * - * With Task.async, the method can be declared succinctly: - * - * let greeter = { - * message: "Hello, NAME!", - * greet: Task.async(function* (name) { - * return yield sendGreeting(this.message.replace(/NAME/, name)); - * }) - * }; - * - * While maintaining identical semantics: - * - * greeter.greet("Mitchell").then((reply) => { ... }); // behaves the same - * - * @param task - * The task function to start. - * - * @return A function that starts the task function and returns its promise. - */ - async: function (task) { - if (typeof task != "function") { - throw new TypeError("task argument must be a function"); - } - - return createAsyncFunction(task); - }, - - /** - * Constructs a special exception that, when thrown inside a legacy generator - * function (non-star generator), allows the associated task to be resolved - * with a specific value. - * - * Example: throw new Task.Result("Value"); - */ - Result: function (value) { - this.value = value; - } - }; - - function createAsyncFunction(task) { - var asyncFunction = function () { - var result = task; - if (task && typeof task == "function") { - if (task.isAsyncFunction) { - throw new TypeError("Cannot use an async function in place of a promise. " + "You should either invoke the async function first " + "or use 'Task.spawn' instead of 'Task.async' to start " + "the Task and return its promise."); - } - - try { - // Let's call into the function ourselves. - result = task.apply(this, arguments); - } catch (ex) { - if (ex instanceof Task.Result) { - return Promise.resolve(ex.value); - } - return Promise.reject(ex); - } - } - - if (isGenerator(result)) { - // This is an iterator resulting from calling a generator function. - return new TaskImpl(result).deferred.promise; - } - - // Just propagate the given value to the caller as a resolved promise. - return Promise.resolve(result); - }; - - asyncFunction.isAsyncFunction = true; - - return asyncFunction; - } - - //////////////////////////////////////////////////////////////////////////////// - //// TaskImpl - - /** - * Executes the specified iterator as a task, and gives access to the promise - * that is fulfilled when the task terminates. - */ - function TaskImpl(iterator) { - if (gMaintainStack) { - this._stack = new Error().stack; - } - this.deferred = defer(); - this._iterator = iterator; - this._isStarGenerator = !("send" in iterator); - this._run(true); - } - - TaskImpl.prototype = { - /** - * Includes the promise object where task completion callbacks are registered, - * and methods to resolve or reject the promise at task completion. - */ - deferred: null, - - /** - * The iterator returned by the generator function associated with this task. - */ - _iterator: null, - - /** - * Whether this Task is using a star generator. - */ - _isStarGenerator: false, - - /** - * Main execution routine, that calls into the generator function. - * - * @param sendResolved - * If true, indicates that we should continue into the generator - * function regularly (if we were waiting on a promise, it was - * resolved). If true, indicates that we should cause an exception to - * be thrown into the generator function (if we were waiting on a - * promise, it was rejected). - * @param sendValue - * Resolution result or rejection exception, if any. - */ - _run: function (sendResolved, sendValue) { - try { - gCurrentTask = this; - - if (this._isStarGenerator) { - try { - var result = sendResolved ? this._iterator.next(sendValue) : this._iterator.throw(sendValue); - - if (result.done) { - // The generator function returned. - this.deferred.resolve(result.value); - } else { - // The generator function yielded. - this._handleResultValue(result.value); - } - } catch (ex) { - // The generator function failed with an uncaught exception. - this._handleException(ex); - } - } else { - try { - var yielded = sendResolved ? this._iterator.send(sendValue) : this._iterator.throw(sendValue); - this._handleResultValue(yielded); - } catch (ex) { - if (ex instanceof Task.Result) { - // The generator function threw the special exception that - // allows it to return a specific value on resolution. - this.deferred.resolve(ex.value); - } else if (ex instanceof StopIteration) { - // The generator function terminated with no specific result. - this.deferred.resolve(undefined); - } else { - // The generator function failed with an uncaught exception. - this._handleException(ex); - } - } - } - } finally { - // - // At this stage, the Task may have finished executing, or have - // walked through a `yield` or passed control to a sub-Task. - // Regardless, if we still own `gCurrentTask`, reset it. If we - // have not finished execution of this Task, re-entering `_run` - // will set `gCurrentTask` to `this` as needed. - // - // We just need to be careful here in case we hit the following - // pattern: - // - // Task.spawn(foo); - // Task.spawn(bar); - // - // Here, `foo` and `bar` may be interleaved, so when we finish - // executing `foo`, `gCurrentTask` may actually either `foo` or - // `bar`. If `gCurrentTask` has already been set to `bar`, leave - // it be and it will be reset to `null` once `bar` is complete. - // - if (gCurrentTask == this) { - gCurrentTask = null; - } - } - }, - - /** - * Handle a value yielded by a generator. - * - * @param value - * The yielded value to handle. - */ - _handleResultValue: function (value) { - // If our task yielded an iterator resulting from calling another - // generator function, automatically spawn a task from it, effectively - // turning it into a promise that is fulfilled on task completion. - if (isGenerator(value)) { - value = Task.spawn(value); - } - - if (value && typeof value.then == "function") { - // We have a promise object now. When fulfilled, call again into this - // function to continue the task, with either a resolution or rejection - // condition. - value.then(this._run.bind(this, true), this._run.bind(this, false)); - } else { - // If our task yielded a value that is not a promise, just continue and - // pass it directly as the result of the yield statement. - this._run(true, value); - } - }, - - /** - * Handle an uncaught exception thrown from a generator. - * - * @param exception - * The uncaught exception to handle. - */ - _handleException: function (exception) { - gCurrentTask = this; - - if (exception && typeof exception == "object" && "stack" in exception) { - var stack = exception.stack; - - if (gMaintainStack && exception._capturedTaskStack != this._stack && typeof stack == "string") { - // Rewrite the stack for more readability. - - var bottomStack = this._stack; - - stack = Task.Debugging.generateReadableStack(stack); - - exception.stack = stack; - - // If exception is reinjected in the same task and rethrown, - // we don't want to perform the rewrite again. - exception._capturedTaskStack = bottomStack; - } else if (!stack) { - stack = "Not available"; - } - - if ("name" in exception && ERRORS_TO_REPORT.indexOf(exception.name) != -1) { - // We suspect that the exception is a programmer error, so we now - // display it using dump(). Note that we do not use Cu.reportError as - // we assume that this is a programming error, so we do not want end - // users to see it. Also, if the programmer handles errors correctly, - // they will either treat the error or log them somewhere. - - dump("*************************\n"); - dump("A coding exception was thrown and uncaught in a Task.\n\n"); - dump("Full message: " + exception + "\n"); - dump("Full stack: " + exception.stack + "\n"); - dump("*************************\n"); - } - } - - this.deferred.reject(exception); - }, - - get callerStack() { - // Cut `this._stack` at the last line of the first block that - for (var _ref of linesOf(this._stack || "")) { - var _ref2 = _slicedToArray(_ref, 2); - - var line = _ref2[0]; - var index = _ref2[1]; - - if (line.indexOf("/task.js:") == -1) { - return this._stack.substring(index); - } - } - return ""; - } - }; - - Task.Debugging = { - - /** - * Control stack rewriting. - * - * If `true`, any exception thrown from a Task will be rewritten to - * provide a human-readable stack trace. Otherwise, stack traces will - * be left unchanged. - * - * There is a (small but existing) runtime cost associated to stack - * rewriting, so you should probably not activate this in production - * code. - * - * @type {bool} - */ - get maintainStack() { - return gMaintainStack; - }, - set maintainStack(x) { - if (!x) { - gCurrentTask = null; - } - gMaintainStack = x; - return x; - }, - - /** - * Generate a human-readable stack for an error raised in - * a Task. - * - * @param {string} topStack The stack provided by the error. - * @param {string=} prefix Optionally, a prefix for each line. - */ - generateReadableStack: function (topStack) { - var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - - if (!gCurrentTask) { - return topStack; - } - - // Cut `topStack` at the first line that contains task.js, keep the head. - var lines = []; - for (var _ref3 of linesOf(topStack)) { - var _ref4 = _slicedToArray(_ref3, 1); - - var line = _ref4[0]; - - if (line.indexOf("/task.js:") != -1) { - break; - } - lines.push(prefix + line); - } - if (!prefix) { - lines.push(gCurrentTask.callerStack); - } else { - for (var _ref5 of linesOf(gCurrentTask.callerStack)) { - var _ref6 = _slicedToArray(_ref5, 1); - - var _line = _ref6[0]; - - lines.push(prefix + _line); - } - } - - return lines.join("\n"); - } - }; - - exports.Task = Task; - -/***/ }, -/* 876 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - var _require = __webpack_require__(875), - Task = _require.Task; - - var DEFAULT_TOGGLE_DELAY = 50; - - /** - * Tooltip helper designed to show/hide the tooltip when the mouse hovers over - * particular nodes. - * - * This works by tracking mouse movements on a base container node (baseNode) - * and showing the tooltip when the mouse stops moving. A callback can be - * provided to the start() method to know whether or not the node being - * hovered over should indeed receive the tooltip. - */ - function TooltipToggle(tooltip) { - this.tooltip = tooltip; - this.win = tooltip.doc.defaultView; - - this._onMouseMove = this._onMouseMove.bind(this); - this._onMouseOut = this._onMouseOut.bind(this); - - this._onTooltipMouseOver = this._onTooltipMouseOver.bind(this); - this._onTooltipMouseOut = this._onTooltipMouseOut.bind(this); - } - - module.exports.TooltipToggle = TooltipToggle; - - TooltipToggle.prototype = { - /** - * Start tracking mouse movements on the provided baseNode to show the - * tooltip. - * - * 2 Ways to make this work: - * - Provide a single node to attach the tooltip to, as the baseNode, and - * omit the second targetNodeCb argument - * - Provide a baseNode that is the container of possibly numerous children - * elements that may receive a tooltip. In this case, provide the second - * targetNodeCb argument to decide wether or not a child should receive - * a tooltip. - * - * Note that if you call this function a second time, it will itself call - * stop() before adding mouse tracking listeners again. - * - * @param {node} baseNode - * The container for all target nodes - * @param {Function} targetNodeCb - * A function that accepts a node argument and that checks if a tooltip - * should be displayed. Possible return values are: - * - false (or a falsy value) if the tooltip should not be displayed - * - true if the tooltip should be displayed - * - a DOM node to display the tooltip on the returned anchor - * The function can also return a promise that will resolve to one of - * the values listed above. - * If omitted, the tooltip will be shown everytime. - * @param {Object} options - Set of optional arguments: - * - {Number} toggleDelay - * An optional delay (in ms) that will be observed before showing - * and before hiding the tooltip. Defaults to DEFAULT_TOGGLE_DELAY. - * - {Boolean} interactive - * If enabled, the tooltip is not hidden when mouse leaves the - * target element and enters the tooltip. Allows the tooltip - * content to be interactive. - */ - start: function (baseNode, targetNodeCb) { - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - _ref$toggleDelay = _ref.toggleDelay, - toggleDelay = _ref$toggleDelay === undefined ? DEFAULT_TOGGLE_DELAY : _ref$toggleDelay, - _ref$interactive = _ref.interactive, - interactive = _ref$interactive === undefined ? false : _ref$interactive; - - this.stop(); - - if (!baseNode) { - // Calling tool is in the process of being destroyed. - return; - } - - this._baseNode = baseNode; - this._targetNodeCb = targetNodeCb || (() => true); - this._toggleDelay = toggleDelay; - this._interactive = interactive; - - baseNode.addEventListener("mousemove", this._onMouseMove); - baseNode.addEventListener("mouseout", this._onMouseOut); - - if (this._interactive) { - this.tooltip.container.addEventListener("mouseover", this._onTooltipMouseOver); - this.tooltip.container.addEventListener("mouseout", this._onTooltipMouseOut); - } - }, - - /** - * If the start() function has been used previously, and you want to get rid - * of this behavior, then call this function to remove the mouse movement - * tracking - */ - stop: function () { - this.win.clearTimeout(this.toggleTimer); - - if (!this._baseNode) { - return; - } - - this._baseNode.removeEventListener("mousemove", this._onMouseMove); - this._baseNode.removeEventListener("mouseout", this._onMouseOut); - - if (this._interactive) { - this.tooltip.container.removeEventListener("mouseover", this._onTooltipMouseOver); - this.tooltip.container.removeEventListener("mouseout", this._onTooltipMouseOut); - } - - this._baseNode = null; - this._targetNodeCb = null; - this._lastHovered = null; - }, - - _onMouseMove: function (event) { - if (event.target !== this._lastHovered) { - this._lastHovered = event.target; - - this.win.clearTimeout(this.toggleTimer); - this.toggleTimer = this.win.setTimeout(() => { - this.tooltip.hide(); - this.isValidHoverTarget(event.target).then(target => { - if (target === null) { - return; - } - this.tooltip.show(target); - }, reason => { - console.error("isValidHoverTarget rejected with unexpected reason:"); - console.error(reason); - }); - }, this._toggleDelay); - } - }, - - /** - * Is the given target DOMNode a valid node for toggling the tooltip on hover. - * This delegates to the user-defined _targetNodeCb callback. - * @return {Promise} a promise that will resolve the anchor to use for the - * tooltip or null if no valid target was found. - */ - isValidHoverTarget: Task.async(function* (target) { - var res = yield this._targetNodeCb(target, this.tooltip); - if (res) { - return res.nodeName ? res : target; - } - - return null; - }), - - _onMouseOut: function (event) { - // Only hide the tooltip if the mouse leaves baseNode. - if (event && this._baseNode && !this._baseNode.contains(event.relatedTarget)) { - return; - } - - this._lastHovered = null; - this.win.clearTimeout(this.toggleTimer); - this.toggleTimer = this.win.setTimeout(() => { - this.tooltip.hide(); - }, this._toggleDelay); - }, - - _onTooltipMouseOver() { - this.win.clearTimeout(this.toggleTimer); - }, - - _onTooltipMouseOut() { - this.win.clearTimeout(this.toggleTimer); - this.toggleTimer = this.win.setTimeout(() => { - this.tooltip.hide(); - }, this._toggleDelay); - }, - - destroy: function () { - this.stop(); - } - }; - -/***/ }, -/* 877 */ -/***/ function(module, exports) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - "use strict"; - - // This was copied (and slightly modified) from - // devtools/shared/gcli/source/lib/gcli/util/util.js, which in turn - // says: - - /** - * Keyboard handling is a mess. http://unixpapa.com/js/key.html - * It would be good to use DOM L3 Keyboard events, - * http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907/#events-keyboardevents - * however only Webkit supports them, and there isn't a shim on Modernizr: - * https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills - * and when the code that uses this KeyEvent was written, nothing was clear, - * so instead, we're using this unmodern shim: - * http://stackoverflow.com/questions/5681146/chrome-10-keyevent-or-something-similar-to-firefoxs-keyevent - * See BUG 664991: GCLI's keyboard handling should be updated to use DOM-L3 - * https://bugzilla.mozilla.org/show_bug.cgi?id=664991 - */ - - exports.KeyCodes = { - DOM_VK_CANCEL: 3, - DOM_VK_HELP: 6, - DOM_VK_BACK_SPACE: 8, - DOM_VK_TAB: 9, - DOM_VK_CLEAR: 12, - DOM_VK_RETURN: 13, - DOM_VK_SHIFT: 16, - DOM_VK_CONTROL: 17, - DOM_VK_ALT: 18, - DOM_VK_PAUSE: 19, - DOM_VK_CAPS_LOCK: 20, - DOM_VK_ESCAPE: 27, - DOM_VK_SPACE: 32, - DOM_VK_PAGE_UP: 33, - DOM_VK_PAGE_DOWN: 34, - DOM_VK_END: 35, - DOM_VK_HOME: 36, - DOM_VK_LEFT: 37, - DOM_VK_UP: 38, - DOM_VK_RIGHT: 39, - DOM_VK_DOWN: 40, - DOM_VK_PRINTSCREEN: 44, - DOM_VK_INSERT: 45, - DOM_VK_DELETE: 46, - DOM_VK_0: 48, - DOM_VK_1: 49, - DOM_VK_2: 50, - DOM_VK_3: 51, - DOM_VK_4: 52, - DOM_VK_5: 53, - DOM_VK_6: 54, - DOM_VK_7: 55, - DOM_VK_8: 56, - DOM_VK_9: 57, - DOM_VK_SEMICOLON: 59, - DOM_VK_EQUALS: 61, - DOM_VK_A: 65, - DOM_VK_B: 66, - DOM_VK_C: 67, - DOM_VK_D: 68, - DOM_VK_E: 69, - DOM_VK_F: 70, - DOM_VK_G: 71, - DOM_VK_H: 72, - DOM_VK_I: 73, - DOM_VK_J: 74, - DOM_VK_K: 75, - DOM_VK_L: 76, - DOM_VK_M: 77, - DOM_VK_N: 78, - DOM_VK_O: 79, - DOM_VK_P: 80, - DOM_VK_Q: 81, - DOM_VK_R: 82, - DOM_VK_S: 83, - DOM_VK_T: 84, - DOM_VK_U: 85, - DOM_VK_V: 86, - DOM_VK_W: 87, - DOM_VK_X: 88, - DOM_VK_Y: 89, - DOM_VK_Z: 90, - DOM_VK_CONTEXT_MENU: 93, - DOM_VK_NUMPAD0: 96, - DOM_VK_NUMPAD1: 97, - DOM_VK_NUMPAD2: 98, - DOM_VK_NUMPAD3: 99, - DOM_VK_NUMPAD4: 100, - DOM_VK_NUMPAD5: 101, - DOM_VK_NUMPAD6: 102, - DOM_VK_NUMPAD7: 103, - DOM_VK_NUMPAD8: 104, - DOM_VK_NUMPAD9: 105, - DOM_VK_MULTIPLY: 106, - DOM_VK_ADD: 107, - DOM_VK_SEPARATOR: 108, - DOM_VK_SUBTRACT: 109, - DOM_VK_DECIMAL: 110, - DOM_VK_DIVIDE: 111, - DOM_VK_F1: 112, - DOM_VK_F2: 113, - DOM_VK_F3: 114, - DOM_VK_F4: 115, - DOM_VK_F5: 116, - DOM_VK_F6: 117, - DOM_VK_F7: 118, - DOM_VK_F8: 119, - DOM_VK_F9: 120, - DOM_VK_F10: 121, - DOM_VK_F11: 122, - DOM_VK_F12: 123, - DOM_VK_F13: 124, - DOM_VK_F14: 125, - DOM_VK_F15: 126, - DOM_VK_F16: 127, - DOM_VK_F17: 128, - DOM_VK_F18: 129, - DOM_VK_F19: 130, - DOM_VK_F20: 131, - DOM_VK_F21: 132, - DOM_VK_F22: 133, - DOM_VK_F23: 134, - DOM_VK_F24: 135, - DOM_VK_NUM_LOCK: 144, - DOM_VK_SCROLL_LOCK: 145, - DOM_VK_COMMA: 188, - DOM_VK_PERIOD: 190, - DOM_VK_SLASH: 191, - DOM_VK_BACK_QUOTE: 192, - DOM_VK_OPEN_BRACKET: 219, - DOM_VK_BACK_SLASH: 220, - DOM_VK_CLOSE_BRACKET: 221, - DOM_VK_QUOTE: 222, - DOM_VK_META: 224, - - // A few that did not appear in gcli, but that are apparently used - // in devtools. - DOM_VK_COLON: 58, - DOM_VK_VOLUME_MUTE: 181, - DOM_VK_VOLUME_DOWN: 182, - DOM_VK_VOLUME_UP: 183 - }; - -/***/ }, -/* 878 */ -/***/ function(module, exports) { - - "use strict"; - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - /* - * The code below is mostly is a slight modification of - * intl/locale/PluralForm.jsm that removes dependencies on chrome privileged - * APIs. - * To make maintenance easier, this file is kept as close as possible to the - * original in terms of implementation. - * The modified methods here are - * - makeGetter (remove code adding the caller name to the log) - * - get ruleNum() (rely on LocalizationHelper instead of String.services) - * - log() (rely on console.log) - * - * Disable eslint warnings to preserve original code style. - */ - - /* eslint-disable */ - - // ONLY SUPPORT ENGLISH PLURAL FORM NOW,NEED L10N SUPPORT - - /** - * This module provides the PluralForm object which contains a method to figure - * out which plural form of a word to use for a given number based on the - * current localization. There is also a makeGetter method that creates a get - * function for the desired plural rule. This is useful for extensions that - * specify their own plural rule instead of relying on the browser default. - * (I.e., the extension hasn't been localized to the browser's locale.) - * - * See: http://developer.mozilla.org/en/docs/Localization_and_Plurals - * - * List of methods: - * - * string pluralForm - * get(int aNum, string aWords) - * - * int numForms - * numForms() - * - * [string pluralForm get(int aNum, string aWords), int numForms numForms()] - * makeGetter(int aRuleNum) - * Note: Basically, makeGetter returns 2 functions that do "get" and "numForm" - */ - - // These are the available plural functions that give the appropriate index - // based on the plural rule number specified. The first element is the number - // of plural forms and the second is the function to figure out the index. - var gFunctions = [ - // 0: Chinese - [1, n => 0], - // 1: English - [2, n => n != 1 ? 1 : 0], - // 2: French - [2, n => n > 1 ? 1 : 0], - // 3: Latvian - [3, n => n % 10 == 1 && n % 100 != 11 ? 1 : n != 0 ? 2 : 0], - // 4: Scottish Gaelic - [4, n => n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 0 && n < 20 ? 2 : 3], - // 5: Romanian - [3, n => n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2], - // 6: Lithuanian - [3, n => n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 2 : 1], - // 7: Russian - [3, n => n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2], - // 8: Slovak - [3, n => n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2], - // 9: Polish - [3, n => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2], - // 10: Slovenian - [4, n => n % 100 == 1 ? 0 : n % 100 == 2 ? 1 : n % 100 == 3 || n % 100 == 4 ? 2 : 3], - // 11: Irish Gaeilge - [5, n => n == 1 ? 0 : n == 2 ? 1 : n >= 3 && n <= 6 ? 2 : n >= 7 && n <= 10 ? 3 : 4], - // 12: Arabic - [6, n => n == 0 ? 5 : n == 1 ? 0 : n == 2 ? 1 : n % 100 >= 3 && n % 100 <= 10 ? 2 : n % 100 >= 11 && n % 100 <= 99 ? 3 : 4], - // 13: Maltese - [4, n => n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 <= 10 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3], - // 14: Macedonian - [3, n => n % 10 == 1 ? 0 : n % 10 == 2 ? 1 : 2], - // 15: Icelandic - [2, n => n % 10 == 1 && n % 100 != 11 ? 0 : 1], - // 16: Breton - [5, n => n % 10 == 1 && n % 100 != 11 && n % 100 != 71 && n % 100 != 91 ? 0 : n % 10 == 2 && n % 100 != 12 && n % 100 != 72 && n % 100 != 92 ? 1 : (n % 10 == 3 || n % 10 == 4 || n % 10 == 9) && n % 100 != 13 && n % 100 != 14 && n % 100 != 19 && n % 100 != 73 && n % 100 != 74 && n % 100 != 79 && n % 100 != 93 && n % 100 != 94 && n % 100 != 99 ? 2 : n % 1000000 == 0 && n != 0 ? 3 : 4]]; - - var PluralForm = { - /** - * Get the correct plural form of a word based on the number - * - * @param aNum - * The number to decide which plural form to use - * @param aWords - * A semi-colon (;) separated string of words to pick the plural form - * @return The appropriate plural form of the word - */ - get get() { - // This method will lazily load to avoid perf when it is first needed and - // creates getPluralForm function. The function it creates is based on the - // value of pluralRule specified in the intl stringbundle. - // See: http://developer.mozilla.org/en/docs/Localization_and_Plurals - - // Delete the getters to be overwritten - delete this.numForms; - delete this.get; - - // Make the plural form get function and set it as the default get - - var _makeGetter = this.makeGetter(this.ruleNum); - - var _makeGetter2 = _slicedToArray(_makeGetter, 2); - - this.get = _makeGetter2[0]; - this.numForms = _makeGetter2[1]; - - return this.get; - }, - - /** - * Create a pair of plural form functions for the given plural rule number. - * - * @param aRuleNum - * The plural rule number to create functions - * @return A pair: [function that gets the right plural form, - * function that returns the number of plural forms] - */ - makeGetter: function (aRuleNum) { - // Default to "all plural" if the value is out of bounds or invalid - if (aRuleNum < 0 || aRuleNum >= gFunctions.length || isNaN(aRuleNum)) { - log(["Invalid rule number: ", aRuleNum, " -- defaulting to 0"]); - aRuleNum = 0; - } - - // Get the desired pluralRule function - - var _gFunctions$aRuleNum = _slicedToArray(gFunctions[aRuleNum], 2), - numForms = _gFunctions$aRuleNum[0], - pluralFunc = _gFunctions$aRuleNum[1]; - - // Return functions that give 1) the number of forms and 2) gets the right - // plural form - - - return [function (aNum, aWords) { - // Figure out which index to use for the semi-colon separated words - var index = pluralFunc(aNum ? Number(aNum) : 0); - var words = aWords ? aWords.split(/;/) : [""]; - - // Explicitly check bounds to avoid strict warnings - var ret = index < words.length ? words[index] : undefined; - - // Check for array out of bounds or empty strings - if (ret == undefined || ret == "") { - // Display a message in the error console - log(["Index #", index, " of '", aWords, "' for value ", aNum, " is invalid -- plural rule #", aRuleNum, ";"]); - - // Default to the first entry (which might be empty, but not undefined) - ret = words[0]; - } - - return ret; - }, () => numForms]; - }, - - /** - * Get the number of forms for the current plural rule - * - * @return The number of forms - */ - get numForms() { - // We lazily load numForms, so trigger the init logic with get() - this.get(); - return this.numForms; - }, - - /** - * Get the plural rule number from the intl stringbundle - * - * @return The plural rule number - */ - get ruleNum() { - // Fallback to English if the pluralRule property is not available. - return 1; - } - }; - - /** - * Private helper function to log errors to the error console and command line - * - * @param aMsg - * Error message to log or an array of strings to concat - */ - function log(aMsg) { - var msg = "plural-form.js: " + (aMsg.join ? aMsg.join("") : aMsg); - console.log(msg + "\n"); - } - - exports.PluralForm = PluralForm; - - /* eslint-ensable */ - -/***/ }, -/* 879 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var _require = __webpack_require__(877), - KeyCodes = _require.KeyCodes; - - var PANE_APPEARANCE_DELAY = 50; - var PAGE_SIZE_ITEM_COUNT_RATIO = 5; - var WIDGET_FOCUSABLE_NODES = new Set(["vbox", "hbox"]); - - var namedTimeoutsStore = new Map(); - - /** - * Inheritance helpers from the addon SDK's core/heritage. - * Remove these when all devtools are loadered. - */ - exports.Heritage = { - /** - * @see extend in sdk/core/heritage. - */ - extend: function (prototype) { - var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - return Object.create(prototype, this.getOwnPropertyDescriptors(properties)); - }, - - /** - * @see getOwnPropertyDescriptors in sdk/core/heritage. - */ - getOwnPropertyDescriptors: function (object) { - return Object.getOwnPropertyNames(object).reduce((descriptor, name) => { - descriptor[name] = Object.getOwnPropertyDescriptor(object, name); - return descriptor; - }, {}); - } - }; - - /** - * Helper for draining a rapid succession of events and invoking a callback - * once everything settles down. - * - * @param string id - * A string identifier for the named timeout. - * @param number wait - * The amount of milliseconds to wait after no more events are fired. - * @param function callback - * Invoked when no more events are fired after the specified time. - */ - var setNamedTimeout = function setNamedTimeout(id, wait, callback) { - clearNamedTimeout(id); - - namedTimeoutsStore.set(id, setTimeout(() => namedTimeoutsStore.delete(id) && callback(), wait)); - }; - exports.setNamedTimeout = setNamedTimeout; - - /** - * Clears a named timeout. - * @see setNamedTimeout - * - * @param string id - * A string identifier for the named timeout. - */ - var clearNamedTimeout = function clearNamedTimeout(id) { - if (!namedTimeoutsStore) { - return; - } - clearTimeout(namedTimeoutsStore.get(id)); - namedTimeoutsStore.delete(id); - }; - exports.clearNamedTimeout = clearNamedTimeout; - - /** - * Same as `setNamedTimeout`, but invokes the callback only if the provided - * predicate function returns true. Otherwise, the timeout is re-triggered. - * - * @param string id - * A string identifier for the conditional timeout. - * @param number wait - * The amount of milliseconds to wait after no more events are fired. - * @param function predicate - * The predicate function used to determine whether the timeout restarts. - * @param function callback - * Invoked when no more events are fired after the specified time, and - * the provided predicate function returns true. - */ - var setConditionalTimeout = function setConditionalTimeout(id, wait, predicate, callback) { - setNamedTimeout(id, wait, function maybeCallback() { - if (predicate()) { - callback(); - return; - } - setConditionalTimeout(id, wait, predicate, callback); - }); - }; - exports.setConditionalTimeout = setConditionalTimeout; - - /** - * Clears a conditional timeout. - * @see setConditionalTimeout - * - * @param string id - * A string identifier for the conditional timeout. - */ - var clearConditionalTimeout = function clearConditionalTimeout(id) { - clearNamedTimeout(id); - }; - exports.clearConditionalTimeout = clearConditionalTimeout; - - /** - * Helpers for creating and messaging between UI components. - */ - var ViewHelpers = exports.ViewHelpers = { - /** - * Convenience method, dispatching a custom event. - * - * @param nsIDOMNode target - * A custom target element to dispatch the event from. - * @param string type - * The name of the event. - * @param any detail - * The data passed when initializing the event. - * @return boolean - * True if the event was cancelled or a registered handler - * called preventDefault. - */ - dispatchEvent: function (target, type, detail) { - if (!(target instanceof Node)) { - // Event cancelled. - return true; - } - var document = target.ownerDocument || target; - var dispatcher = target.ownerDocument ? target : document.documentElement; - - var event = document.createEvent("CustomEvent"); - event.initCustomEvent(type, true, true, detail); - return dispatcher.dispatchEvent(event); - }, - - /** - * Helper delegating some of the DOM attribute methods of a node to a widget. - * - * @param object widget - * The widget to assign the methods to. - * @param nsIDOMNode node - * A node to delegate the methods to. - */ - delegateWidgetAttributeMethods: function (widget, node) { - widget.getAttribute = widget.getAttribute || node.getAttribute.bind(node); - widget.setAttribute = widget.setAttribute || node.setAttribute.bind(node); - widget.removeAttribute = widget.removeAttribute || node.removeAttribute.bind(node); - }, - - /** - * Helper delegating some of the DOM event methods of a node to a widget. - * - * @param object widget - * The widget to assign the methods to. - * @param nsIDOMNode node - * A node to delegate the methods to. - */ - delegateWidgetEventMethods: function (widget, node) { - widget.addEventListener = widget.addEventListener || node.addEventListener.bind(node); - widget.removeEventListener = widget.removeEventListener || node.removeEventListener.bind(node); - }, - - /** - * Checks if the specified object looks like it's been decorated by an - * event emitter. - * - * @return boolean - * True if it looks, walks and quacks like an event emitter. - */ - isEventEmitter: function (object) { - return object && object.on && object.off && object.once && object.emit; - }, - - /** - * Checks if the specified object is an instance of a DOM node. - * - * @return boolean - * True if it's a node, false otherwise. - */ - isNode: function (object) { - return object instanceof Node || object instanceof Element || object instanceof DocumentFragment; - }, - - /** - * Prevents event propagation when navigation keys are pressed. - * - * @param Event e - * The event to be prevented. - */ - preventScrolling: function (e) { - switch (e.keyCode) { - case KeyCodes.DOM_VK_UP: - case KeyCodes.DOM_VK_DOWN: - case KeyCodes.DOM_VK_LEFT: - case KeyCodes.DOM_VK_RIGHT: - case KeyCodes.DOM_VK_PAGE_UP: - case KeyCodes.DOM_VK_PAGE_DOWN: - case KeyCodes.DOM_VK_HOME: - case KeyCodes.DOM_VK_END: - e.preventDefault(); - e.stopPropagation(); - } - }, - - /** - * Check if the enter key or space was pressed - * - * @param event event - * The event triggered by a keypress on an element - */ - isSpaceOrReturn: function (event) { - return event.keyCode === KeyCodes.DOM_VK_SPACE || event.keyCode === KeyCodes.DOM_VK_RETURN; - }, - - /** - * Sets a toggled pane hidden or visible. The pane can either be displayed on - * the side (right or left depending on the locale) or at the bottom. - * - * @param object flags - * An object containing some of the following properties: - * - visible: true if the pane should be shown, false to hide - * - animated: true to display an animation on toggle - * - delayed: true to wait a few cycles before toggle - * - callback: a function to invoke when the toggle finishes - * @param nsIDOMNode pane - * The element representing the pane to toggle. - */ - togglePane: function (flags, pane) { - // Make sure a pane is actually available first. - if (!pane) { - return; - } - - // Hiding is always handled via margins, not the hidden attribute. - pane.removeAttribute("hidden"); - - // Add a class to the pane to handle min-widths, margins and animations. - pane.classList.add("generic-toggled-pane"); - - // Avoid toggles in the middle of animation. - if (pane.hasAttribute("animated")) { - return; - } - - // Avoid useless toggles. - if (flags.visible == !pane.classList.contains("pane-collapsed")) { - if (flags.callback) { - flags.callback(); - } - return; - } - - // The "animated" attributes enables animated toggles (slide in-out). - if (flags.animated) { - pane.setAttribute("animated", ""); - } else { - pane.removeAttribute("animated"); - } - - // Computes and sets the pane margins in order to hide or show it. - var doToggle = () => { - // Negative margins are applied to "right" and "left" to support RTL and - // LTR directions, as well as to "bottom" to support vertical layouts. - // Unnecessary negative margins are forced to 0 via CSS in widgets.css. - if (flags.visible) { - pane.style.marginLeft = "0"; - pane.style.marginRight = "0"; - pane.style.marginBottom = "0"; - pane.classList.remove("pane-collapsed"); - } else { - var width = Math.floor(pane.getAttribute("width")) + 1; - var height = Math.floor(pane.getAttribute("height")) + 1; - pane.style.marginLeft = -width + "px"; - pane.style.marginRight = -width + "px"; - pane.style.marginBottom = -height + "px"; - } - - // Wait for the animation to end before calling afterToggle() - if (flags.animated) { - var options = { - useCapture: false, - once: true - }; - - pane.addEventListener("transitionend", () => { - // Prevent unwanted transitions: if the panel is hidden and the layout - // changes margins will be updated and the panel will pop out. - pane.removeAttribute("animated"); - - if (!flags.visible) { - pane.classList.add("pane-collapsed"); - } - if (flags.callback) { - flags.callback(); - } - }, options); - } else { - if (!flags.visible) { - pane.classList.add("pane-collapsed"); - } - - // Invoke the callback immediately since there's no transition. - if (flags.callback) { - flags.callback(); - } - } - }; - - // Sometimes it's useful delaying the toggle a few ticks to ensure - // a smoother slide in-out animation. - if (flags.delayed) { - pane.ownerDocument.defaultView.setTimeout(doToggle, PANE_APPEARANCE_DELAY); - } else { - doToggle(); - } - } - }; - - /** - * A generic Item is used to describe children present in a Widget. - * - * This is basically a very thin wrapper around an nsIDOMNode, with a few - * characteristics, like a `value` and an `attachment`. - * - * The characteristics are optional, and their meaning is entirely up to you. - * - The `value` should be a string, passed as an argument. - * - The `attachment` is any kind of primitive or object, passed as an argument. - * - * Iterable via "for (let childItem of parentItem) { }". - * - * @param object ownerView - * The owner view creating this item. - * @param nsIDOMNode element - * A prebuilt node to be wrapped. - * @param string value - * A string identifying the node. - * @param any attachment - * Some attached primitive/object. - */ - function Item(ownerView, element, value, attachment) { - this.ownerView = ownerView; - this.attachment = attachment; - this._value = value + ""; - this._prebuiltNode = element; - this._itemsByElement = new Map(); - } - - Item.prototype = { - get value() { - return this._value; - }, - get target() { - return this._target; - }, - get prebuiltNode() { - return this._prebuiltNode; - }, - - /** - * Immediately appends a child item to this item. - * - * @param nsIDOMNode element - * An nsIDOMNode representing the child element to append. - * @param object options [optional] - * Additional options or flags supported by this operation: - * - attachment: some attached primitive/object for the item - * - attributes: a batch of attributes set to the displayed element - * - finalize: function invoked when the child item is removed - * @return Item - * The item associated with the displayed element. - */ - append: function (element) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var item = new Item(this, element, "", options.attachment); - - // Entangle the item with the newly inserted child node. - // Make sure this is done with the value returned by appendChild(), - // to avoid storing a potential DocumentFragment. - this._entangleItem(item, this._target.appendChild(element)); - - // Handle any additional options after entangling the item. - if (options.attributes) { - options.attributes.forEach(e => item._target.setAttribute(e[0], e[1])); - } - if (options.finalize) { - item.finalize = options.finalize; - } - - // Return the item associated with the displayed element. - return item; - }, - - /** - * Immediately removes the specified child item from this item. - * - * @param Item item - * The item associated with the element to remove. - */ - remove: function (item) { - if (!item) { - return; - } - this._target.removeChild(item._target); - this._untangleItem(item); - }, - - /** - * Entangles an item (model) with a displayed node element (view). - * - * @param Item item - * The item describing a target element. - * @param nsIDOMNode element - * The element displaying the item. - */ - _entangleItem: function (item, element) { - this._itemsByElement.set(element, item); - item._target = element; - }, - - /** - * Untangles an item (model) from a displayed node element (view). - * - * @param Item item - * The item describing a target element. - */ - _untangleItem: function (item) { - if (item.finalize) { - item.finalize(item); - } - for (var childItem of item) { - item.remove(childItem); - } - - this._unlinkItem(item); - item._target = null; - }, - - /** - * Deletes an item from the its parent's storage maps. - * - * @param Item item - * The item describing a target element. - */ - _unlinkItem: function (item) { - this._itemsByElement.delete(item._target); - }, - - /** - * Returns a string representing the object. - * Avoid using `toString` to avoid accidental JSONification. - * @return string - */ - stringify: function () { - return JSON.stringify({ - value: this._value, - target: this._target + "", - prebuiltNode: this._prebuiltNode + "", - attachment: this.attachment - }, null, 2); - }, - - _value: "", - _target: null, - _prebuiltNode: null, - finalize: null, - attachment: null - }; - - /** - * Some generic Widget methods handling Item instances. - * Iterable via "for (let childItem of wrappedView) { }". - * - * Usage: - * function MyView() { - * this.widget = new MyWidget(document.querySelector(".my-node")); - * } - * - * MyView.prototype = Heritage.extend(WidgetMethods, { - * myMethod: function() {}, - * ... - * }); - * - * See https://gist.github.com/victorporof/5749386 for more details. - * The devtools/shared/widgets/SimpleListWidget.jsm is an implementation - * example. - * - * Language: - * - An "item" is an instance of an Item. - * - An "element" or "node" is a nsIDOMNode. - * - * The supplied widget can be any object implementing the following - * methods: - * - function:nsIDOMNode insertItemAt(aIndex:number, aNode:nsIDOMNode, - * aValue:string) - * - function:nsIDOMNode getItemAtIndex(aIndex:number) - * - function removeChild(aChild:nsIDOMNode) - * - function removeAllItems() - * - get:nsIDOMNode selectedItem() - * - set selectedItem(aChild:nsIDOMNode) - * - function getAttribute(aName:string) - * - function setAttribute(aName:string, aValue:string) - * - function removeAttribute(aName:string) - * - function addEventListener(aName:string, aCallback:function, - * aBubbleFlag:boolean) - * - function removeEventListener(aName:string, aCallback:function, - * aBubbleFlag:boolean) - * - * Optional methods that can be implemented by the widget: - * - function ensureElementIsVisible(aChild:nsIDOMNode) - * - * Optional attributes that may be handled (when calling - * get/set/removeAttribute): - * - "emptyText": label temporarily added when there are no items present - * - "headerText": label permanently added as a header - * - * For automagical keyboard and mouse accessibility, the widget should be an - * event emitter with the following events: - * - "keyPress" -> (aName:string, aEvent:KeyboardEvent) - * - "mousePress" -> (aName:string, aEvent:MouseEvent) - */ - var WidgetMethods = exports.WidgetMethods = { - /** - * Sets the element node or widget associated with this container. - * @param nsIDOMNode | object widget - */ - set widget(widget) { - this._widget = widget; - - // Can't use a WeakMap for _itemsByValue because keys are strings, and - // can't use one for _itemsByElement either, since it needs to be iterable. - this._itemsByValue = new Map(); - this._itemsByElement = new Map(); - this._stagedItems = []; - - // Handle internal events emitted by the widget if necessary. - if (ViewHelpers.isEventEmitter(widget)) { - widget.on("keyPress", this._onWidgetKeyPress.bind(this)); - widget.on("mousePress", this._onWidgetMousePress.bind(this)); - } - }, - - /** - * Gets the element node or widget associated with this container. - * @return nsIDOMNode | object - */ - get widget() { - return this._widget; - }, - - /** - * Prepares an item to be added to this container. This allows, for example, - * for a large number of items to be batched up before being sorted & added. - * - * If the "staged" flag is *not* set to true, the item will be immediately - * inserted at the correct position in this container, so that all the items - * still remain sorted. This can (possibly) be much slower than batching up - * multiple items. - * - * By default, this container assumes that all the items should be displayed - * sorted by their value. This can be overridden with the "index" flag, - * specifying on which position should an item be appended. The "staged" and - * "index" flags are mutually exclusive, meaning that all staged items - * will always be appended. - * - * @param nsIDOMNode element - * A prebuilt node to be wrapped. - * @param string value - * A string identifying the node. - * @param object options [optional] - * Additional options or flags supported by this operation: - * - attachment: some attached primitive/object for the item - * - staged: true to stage the item to be appended later - * - index: specifies on which position should the item be appended - * - attributes: a batch of attributes set to the displayed element - * - finalize: function invoked when the item is removed - * @return Item - * The item associated with the displayed element if an unstaged push, - * undefined if the item was staged for a later commit. - */ - push: function (_ref) { - var _ref2 = _slicedToArray(_ref, 2), - element = _ref2[0], - value = _ref2[1]; - - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var item = new Item(this, element, value, options.attachment); - - // Batch the item to be added later. - if (options.staged) { - // An ulterior commit operation will ignore any specified index, so - // no reason to keep it around. - options.index = undefined; - return void this._stagedItems.push({ item: item, options: options }); - } - // Find the target position in this container and insert the item there. - if (!("index" in options)) { - return this._insertItemAt(this._findExpectedIndexFor(item), item, options); - } - // Insert the item at the specified index. If negative or out of bounds, - // the item will be simply appended. - return this._insertItemAt(options.index, item, options); - }, - - /** - * Flushes all the prepared items into this container. - * Any specified index on the items will be ignored. Everything is appended. - * - * @param object options [optional] - * Additional options or flags supported by this operation: - * - sorted: true to sort all the items before adding them - */ - commit: function () { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var stagedItems = this._stagedItems; - - // Sort the items before adding them to this container, if preferred. - if (options.sorted) { - stagedItems.sort((a, b) => this._currentSortPredicate(a.item, b.item)); - } - // Append the prepared items to this container. - for (var _ref3 of stagedItems) { - var item = _ref3.item; - var opt = _ref3.opt; - - this._insertItemAt(-1, item, opt); - } - // Recreate the temporary items list for ulterior pushes. - this._stagedItems.length = 0; - }, - - /** - * Immediately removes the specified item from this container. - * - * @param Item item - * The item associated with the element to remove. - */ - remove: function (item) { - if (!item) { - return; - } - this._widget.removeChild(item._target); - this._untangleItem(item); - - if (!this._itemsByElement.size) { - this._preferredValue = this.selectedValue; - this._widget.selectedItem = null; - this._widget.setAttribute("emptyText", this._emptyText); - } - }, - - /** - * Removes the item at the specified index from this container. - * - * @param number index - * The index of the item to remove. - */ - removeAt: function (index) { - this.remove(this.getItemAtIndex(index)); - }, - - /** - * Removes the items in this container based on a predicate. - */ - removeForPredicate: function (predicate) { - var item = void 0; - while (item = this.getItemForPredicate(predicate)) { - this.remove(item); - } - }, - - /** - * Removes all items from this container. - */ - empty: function () { - this._preferredValue = this.selectedValue; - this._widget.selectedItem = null; - this._widget.removeAllItems(); - this._widget.setAttribute("emptyText", this._emptyText); - - for (var _ref4 of this._itemsByElement) { - var _ref5 = _slicedToArray(_ref4, 2); - - var item = _ref5[1]; - - this._untangleItem(item); - } - - this._itemsByValue.clear(); - this._itemsByElement.clear(); - this._stagedItems.length = 0; - }, - - /** - * Ensures the specified item is visible in this container. - * - * @param Item item - * The item to bring into view. - */ - ensureItemIsVisible: function (item) { - this._widget.ensureElementIsVisible(item._target); - }, - - /** - * Ensures the item at the specified index is visible in this container. - * - * @param number index - * The index of the item to bring into view. - */ - ensureIndexIsVisible: function (index) { - this.ensureItemIsVisible(this.getItemAtIndex(index)); - }, - - /** - * Sugar for ensuring the selected item is visible in this container. - */ - ensureSelectedItemIsVisible: function () { - this.ensureItemIsVisible(this.selectedItem); - }, - - /** - * If supported by the widget, the label string temporarily added to this - * container when there are no child items present. - */ - set emptyText(value) { - this._emptyText = value; - - // Apply the emptyText attribute right now if there are no child items. - if (!this._itemsByElement.size) { - this._widget.setAttribute("emptyText", value); - } - }, - - /** - * If supported by the widget, the label string permanently added to this - * container as a header. - * @param string value - */ - set headerText(value) { - this._headerText = value; - this._widget.setAttribute("headerText", value); - }, - - /** - * Toggles all the items in this container hidden or visible. - * - * This does not change the default filtering predicate, so newly inserted - * items will always be visible. Use WidgetMethods.filterContents if you care. - * - * @param boolean visibleFlag - * Specifies the intended visibility. - */ - toggleContents: function (visibleFlag) { - for (var _ref6 of this._itemsByElement) { - var _ref7 = _slicedToArray(_ref6, 1); - - var element = _ref7[0]; - - element.hidden = !visibleFlag; - } - }, - - /** - * Toggles all items in this container hidden or visible based on a predicate. - * - * @param function predicate [optional] - * Items are toggled according to the return value of this function, - * which will become the new default filtering predicate in this - * container. - * If unspecified, all items will be toggled visible. - */ - filterContents: function () { - var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._currentFilterPredicate; - - this._currentFilterPredicate = predicate; - - for (var _ref8 of this._itemsByElement) { - var _ref9 = _slicedToArray(_ref8, 2); - - var element = _ref9[0]; - var item = _ref9[1]; - - element.hidden = !predicate(item); - } - }, - - /** - * Sorts all the items in this container based on a predicate. - * - * @param function predicate [optional] - * Items are sorted according to the return value of the function, - * which will become the new default sorting predicate in this - * container. If unspecified, all items will be sorted by their value. - */ - sortContents: function () { - var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._currentSortPredicate; - - var sortedItems = this.items.sort(this._currentSortPredicate = predicate); - - for (var i = 0, len = sortedItems.length; i < len; i++) { - this.swapItems(this.getItemAtIndex(i), sortedItems[i]); - } - }, - - /** - * Visually swaps two items in this container. - * - * @param Item first - * The first item to be swapped. - * @param Item second - * The second item to be swapped. - */ - swapItems: function (first, second) { - if (first == second) { - // We're just dandy, thank you. - return; - } - var firstPrebuiltTarget = first._prebuiltNode, - firstTarget = first._target; - var secondPrebuiltTarget = second._prebuiltNode, - secondTarget = second._target; - - // If the two items were constructed with prebuilt nodes as - // DocumentFragments, then those DocumentFragments are now - // empty and need to be reassembled. - - if (firstPrebuiltTarget instanceof DocumentFragment) { - for (var node of firstTarget.childNodes) { - firstPrebuiltTarget.appendChild(node.cloneNode(true)); - } - } - if (secondPrebuiltTarget instanceof DocumentFragment) { - for (var _node of secondTarget.childNodes) { - secondPrebuiltTarget.appendChild(_node.cloneNode(true)); - } - } - - // 1. Get the indices of the two items to swap. - var i = this._indexOfElement(firstTarget); - var j = this._indexOfElement(secondTarget); - - // 2. Remeber the selection index, to reselect an item, if necessary. - var selectedTarget = this._widget.selectedItem; - var selectedIndex = -1; - if (selectedTarget == firstTarget) { - selectedIndex = i; - } else if (selectedTarget == secondTarget) { - selectedIndex = j; - } - - // 3. Silently nuke both items, nobody needs to know about this. - this._widget.removeChild(firstTarget); - this._widget.removeChild(secondTarget); - this._unlinkItem(first); - this._unlinkItem(second); - - // 4. Add the items again, but reversing their indices. - this._insertItemAt.apply(this, i < j ? [i, second] : [j, first]); - this._insertItemAt.apply(this, i < j ? [j, first] : [i, second]); - - // 5. Restore the previous selection, if necessary. - if (selectedIndex == i) { - this._widget.selectedItem = first._target; - } else if (selectedIndex == j) { - this._widget.selectedItem = second._target; - } - - // 6. Let the outside world know that these two items were swapped. - ViewHelpers.dispatchEvent(first.target, "swap", [second, first]); - }, - - /** - * Visually swaps two items in this container at specific indices. - * - * @param number first - * The index of the first item to be swapped. - * @param number second - * The index of the second item to be swapped. - */ - swapItemsAtIndices: function (first, second) { - this.swapItems(this.getItemAtIndex(first), this.getItemAtIndex(second)); - }, - - /** - * Checks whether an item with the specified value is among the elements - * shown in this container. - * - * @param string value - * The item's value. - * @return boolean - * True if the value is known, false otherwise. - */ - containsValue: function (value) { - return this._itemsByValue.has(value) || this._stagedItems.some((_ref10) => { - var item = _ref10.item; - return item._value == value; - }); - }, - - /** - * Gets the "preferred value". This is the latest selected item's value, - * remembered just before emptying this container. - * @return string - */ - get preferredValue() { - return this._preferredValue; - }, - - /** - * Retrieves the item associated with the selected element. - * @return Item | null - */ - get selectedItem() { - var selectedElement = this._widget.selectedItem; - if (selectedElement) { - return this._itemsByElement.get(selectedElement); - } - return null; - }, - - /** - * Retrieves the selected element's index in this container. - * @return number - */ - get selectedIndex() { - var selectedElement = this._widget.selectedItem; - if (selectedElement) { - return this._indexOfElement(selectedElement); - } - return -1; - }, - - /** - * Retrieves the value of the selected element. - * @return string - */ - get selectedValue() { - var selectedElement = this._widget.selectedItem; - if (selectedElement) { - return this._itemsByElement.get(selectedElement)._value; - } - return ""; - }, - - /** - * Retrieves the attachment of the selected element. - * @return object | null - */ - get selectedAttachment() { - var selectedElement = this._widget.selectedItem; - if (selectedElement) { - return this._itemsByElement.get(selectedElement).attachment; - } - return null; - }, - - _selectItem: function (item) { - // A falsy item is allowed to invalidate the current selection. - var targetElement = item ? item._target : null; - var prevElement = this._widget.selectedItem; - - // Make sure the selected item's target element is focused and visible. - if (this.autoFocusOnSelection && targetElement) { - targetElement.focus(); - } - - if (targetElement != prevElement) { - this._widget.selectedItem = targetElement; - } - }, - - /** - * Selects the element with the entangled item in this container. - * @param Item | function item - */ - set selectedItem(item) { - // A predicate is allowed to select a specific item. - // If no item is matched, then the current selection is removed. - if (typeof item == "function") { - item = this.getItemForPredicate(item); - } - - var targetElement = item ? item._target : null; - var prevElement = this._widget.selectedItem; - - if (this.maintainSelectionVisible && targetElement) { - // Some methods are optional. See the WidgetMethods object documentation - // for a comprehensive list. - if ("ensureElementIsVisible" in this._widget) { - this._widget.ensureElementIsVisible(targetElement); - } - } - - this._selectItem(item); - - // Prevent selecting the same item again and avoid dispatching - // a redundant selection event, so return early. - if (targetElement != prevElement) { - var dispTarget = targetElement || prevElement; - var dispName = this.suppressSelectionEvents ? "suppressed-select" : "select"; - ViewHelpers.dispatchEvent(dispTarget, dispName, item); - } - }, - - /** - * Selects the element at the specified index in this container. - * @param number index - */ - set selectedIndex(index) { - var targetElement = this._widget.getItemAtIndex(index); - if (targetElement) { - this.selectedItem = this._itemsByElement.get(targetElement); - return; - } - this.selectedItem = null; - }, - - /** - * Selects the element with the specified value in this container. - * @param string value - */ - set selectedValue(value) { - this.selectedItem = this._itemsByValue.get(value); - }, - - /** - * Deselects and re-selects an item in this container. - * - * Useful when you want a "select" event to be emitted, even though - * the specified item was already selected. - * - * @param Item | function item - * @see `set selectedItem` - */ - forceSelect: function (item) { - this.selectedItem = null; - this.selectedItem = item; - }, - - /** - * Specifies if this container should try to keep the selected item visible. - * (For example, when new items are added the selection is brought into view). - */ - maintainSelectionVisible: true, - - /** - * Specifies if "select" events dispatched from the elements in this container - * when their respective items are selected should be suppressed or not. - * - * If this flag is set to true, then consumers of this container won't - * be normally notified when items are selected. - */ - suppressSelectionEvents: false, - - /** - * Focus this container the first time an element is inserted? - * - * If this flag is set to true, then when the first item is inserted in - * this container (and thus it's the only item available), its corresponding - * target element is focused as well. - */ - autoFocusOnFirstItem: true, - - /** - * Focus on selection? - * - * If this flag is set to true, then whenever an item is selected in - * this container (e.g. via the selectedIndex or selectedItem setters), - * its corresponding target element is focused as well. - * - * You can disable this flag, for example, to maintain a certain node - * focused but visually indicate a different selection in this container. - */ - autoFocusOnSelection: true, - - /** - * Focus on input (e.g. mouse click)? - * - * If this flag is set to true, then whenever an item receives user input in - * this container, its corresponding target element is focused as well. - */ - autoFocusOnInput: true, - - /** - * When focusing on input, allow right clicks? - * @see WidgetMethods.autoFocusOnInput - */ - allowFocusOnRightClick: false, - - /** - * The number of elements in this container to jump when Page Up or Page Down - * keys are pressed. If falsy, then the page size will be based on the - * number of visible items in the container. - */ - pageSize: 0, - - /** - * Focuses the first visible item in this container. - */ - focusFirstVisibleItem: function () { - this.focusItemAtDelta(-this.itemCount); - }, - - /** - * Focuses the last visible item in this container. - */ - focusLastVisibleItem: function () { - this.focusItemAtDelta(+this.itemCount); - }, - - /** - * Focuses the next item in this container. - */ - focusNextItem: function () { - this.focusItemAtDelta(+1); - }, - - /** - * Focuses the previous item in this container. - */ - focusPrevItem: function () { - this.focusItemAtDelta(-1); - }, - - /** - * Focuses another item in this container based on the index distance - * from the currently focused item. - * - * @param number delta - * A scalar specifying by how many items should the selection change. - */ - focusItemAtDelta: function (delta) { - // Make sure the currently selected item is also focused, so that the - // command dispatcher mechanism has a relative node to work with. - // If there's no selection, just select an item at a corresponding index - // (e.g. the first item in this container if delta <= 1). - var selectedElement = this._widget.selectedItem; - if (selectedElement) { - selectedElement.focus(); - } else { - this.selectedIndex = Math.max(0, delta - 1); - return; - } - - var direction = delta > 0 ? "advanceFocus" : "rewindFocus"; - var distance = Math.abs(Math[delta > 0 ? "ceil" : "floor"](delta)); - while (distance--) { - if (!this._focusChange(direction)) { - // Out of bounds. - break; - } - } - - // Synchronize the selected item as being the currently focused element. - this.selectedItem = this.getItemForElement(this._focusedElement); - }, - - /** - * Focuses the next or previous item in this container. - * - * @param string direction - * Either "advanceFocus" or "rewindFocus". - * @return boolean - * False if the focus went out of bounds and the first or last item - * in this container was focused instead. - */ - _focusChange: function (direction) { - var commandDispatcher = this._commandDispatcher; - var prevFocusedElement = commandDispatcher.focusedElement; - var currFocusedElement = void 0; - - do { - commandDispatcher.suppressFocusScroll = true; - commandDispatcher[direction](); - currFocusedElement = commandDispatcher.focusedElement; - - // Make sure the newly focused item is a part of this container. If the - // focus goes out of bounds, revert the previously focused item. - if (!this.getItemForElement(currFocusedElement)) { - prevFocusedElement.focus(); - return false; - } - } while (!WIDGET_FOCUSABLE_NODES.has(currFocusedElement.tagName)); - - // Focus remained within bounds. - return true; - }, - - /** - * Gets the command dispatcher instance associated with this container's DOM. - * If there are no items displayed in this container, null is returned. - * @return nsIDOMXULCommandDispatcher | null - */ - get _commandDispatcher() { - if (this._cachedCommandDispatcher) { - return this._cachedCommandDispatcher; - } - var someElement = this._widget.getItemAtIndex(0); - if (someElement) { - var commandDispatcher = someElement.ownerDocument.commandDispatcher; - this._cachedCommandDispatcher = commandDispatcher; - return commandDispatcher; - } - return null; - }, - - /** - * Gets the currently focused element in this container. - * - * @return nsIDOMNode - * The focused element, or null if nothing is found. - */ - get _focusedElement() { - var commandDispatcher = this._commandDispatcher; - if (commandDispatcher) { - return commandDispatcher.focusedElement; - } - return null; - }, - - /** - * Gets the item in the container having the specified index. - * - * @param number index - * The index used to identify the element. - * @return Item - * The matched item, or null if nothing is found. - */ - getItemAtIndex: function (index) { - return this.getItemForElement(this._widget.getItemAtIndex(index)); - }, - - /** - * Gets the item in the container having the specified value. - * - * @param string value - * The value used to identify the element. - * @return Item - * The matched item, or null if nothing is found. - */ - getItemByValue: function (value) { - return this._itemsByValue.get(value); - }, - - /** - * Gets the item in the container associated with the specified element. - * - * @param nsIDOMNode element - * The element used to identify the item. - * @param object flags [optional] - * Additional options for showing the source. Supported options: - * - noSiblings: if siblings shouldn't be taken into consideration - * when searching for the associated item. - * @return Item - * The matched item, or null if nothing is found. - */ - getItemForElement: function (element) { - var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - while (element) { - var item = this._itemsByElement.get(element); - - // Also search the siblings if allowed. - if (!flags.noSiblings) { - item = item || this._itemsByElement.get(element.nextElementSibling) || this._itemsByElement.get(element.previousElementSibling); - } - if (item) { - return item; - } - element = element.parentNode; - } - return null; - }, - - /** - * Gets a visible item in this container validating a specified predicate. - * - * @param function predicate - * The first item which validates this predicate is returned - * @return Item - * The matched item, or null if nothing is found. - */ - getItemForPredicate: function (predicate) { - var owner = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; - - // Recursively check the items in this widget for a predicate match. - for (var _ref11 of owner._itemsByElement) { - var _ref12 = _slicedToArray(_ref11, 2); - - var element = _ref12[0]; - var item = _ref12[1]; - - var match = void 0; - if (predicate(item) && !element.hidden) { - match = item; - } else { - match = this.getItemForPredicate(predicate, item); - } - if (match) { - return match; - } - } - // Also check the staged items. No need to do this recursively since - // they're not even appended to the view yet. - for (var _ref13 of this._stagedItems) { - var _item = _ref13.item; - - if (predicate(_item)) { - return _item; - } - } - return null; - }, - - /** - * Shortcut function for getItemForPredicate which works on item attachments. - * @see getItemForPredicate - */ - getItemForAttachment: function (predicate) { - var owner = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; - - return this.getItemForPredicate(e => predicate(e.attachment)); - }, - - /** - * Finds the index of an item in the container. - * - * @param Item item - * The item get the index for. - * @return number - * The index of the matched item, or -1 if nothing is found. - */ - indexOfItem: function (item) { - return this._indexOfElement(item._target); - }, - - /** - * Finds the index of an element in the container. - * - * @param nsIDOMNode element - * The element get the index for. - * @return number - * The index of the matched element, or -1 if nothing is found. - */ - _indexOfElement: function (element) { - for (var i = 0; i < this._itemsByElement.size; i++) { - if (this._widget.getItemAtIndex(i) == element) { - return i; - } - } - return -1; - }, - - /** - * Gets the total number of items in this container. - * @return number - */ - get itemCount() { - return this._itemsByElement.size; - }, - - /** - * Returns a list of items in this container, in the displayed order. - * @return array - */ - get items() { - var store = []; - var itemCount = this.itemCount; - for (var i = 0; i < itemCount; i++) { - store.push(this.getItemAtIndex(i)); - } - return store; - }, - - /** - * Returns a list of values in this container, in the displayed order. - * @return array - */ - get values() { - return this.items.map(e => e._value); - }, - - /** - * Returns a list of attachments in this container, in the displayed order. - * @return array - */ - get attachments() { - return this.items.map(e => e.attachment); - }, - - /** - * Returns a list of all the visible (non-hidden) items in this container, - * in the displayed order - * @return array - */ - get visibleItems() { - return this.items.filter(e => !e._target.hidden); - }, - - /** - * Checks if an item is unique in this container. If an item's value is an - * empty string, "undefined" or "null", it is considered unique. - * - * @param Item item - * The item for which to verify uniqueness. - * @return boolean - * True if the item is unique, false otherwise. - */ - isUnique: function (item) { - var value = item._value; - if (value == "" || value == "undefined" || value == "null") { - return true; - } - return !this._itemsByValue.has(value); - }, - - /** - * Checks if an item is eligible for this container. By default, this checks - * whether an item is unique and has a prebuilt target node. - * - * @param Item item - * The item for which to verify eligibility. - * @return boolean - * True if the item is eligible, false otherwise. - */ - isEligible: function (item) { - return this.isUnique(item) && item._prebuiltNode; - }, - - /** - * Finds the expected item index in this container based on the default - * sort predicate. - * - * @param Item item - * The item for which to get the expected index. - * @return number - * The expected item index. - */ - _findExpectedIndexFor: function (item) { - var itemCount = this.itemCount; - for (var i = 0; i < itemCount; i++) { - if (this._currentSortPredicate(this.getItemAtIndex(i), item) > 0) { - return i; - } - } - return itemCount; - }, - - /** - * Immediately inserts an item in this container at the specified index. - * - * @param number index - * The position in the container intended for this item. - * @param Item item - * The item describing a target element. - * @param object options [optional] - * Additional options or flags supported by this operation: - * - attributes: a batch of attributes set to the displayed element - * - finalize: function when the item is untangled (removed) - * @return Item - * The item associated with the displayed element, null if rejected. - */ - _insertItemAt: function (index, item) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (!this.isEligible(item)) { - return null; - } - - // Entangle the item with the newly inserted node. - // Make sure this is done with the value returned by insertItemAt(), - // to avoid storing a potential DocumentFragment. - var node = item._prebuiltNode; - var attachment = item.attachment; - this._entangleItem(item, this._widget.insertItemAt(index, node, attachment)); - - // Handle any additional options after entangling the item. - if (!this._currentFilterPredicate(item)) { - item._target.hidden = true; - } - if (this.autoFocusOnFirstItem && this._itemsByElement.size == 1) { - item._target.focus(); - } - if (options.attributes) { - options.attributes.forEach(e => item._target.setAttribute(e[0], e[1])); - } - if (options.finalize) { - item.finalize = options.finalize; - } - - // Hide the empty text if the selection wasn't lost. - this._widget.removeAttribute("emptyText"); - - // Return the item associated with the displayed element. - return item; - }, - - /** - * Entangles an item (model) with a displayed node element (view). - * - * @param Item item - * The item describing a target element. - * @param nsIDOMNode element - * The element displaying the item. - */ - _entangleItem: function (item, element) { - this._itemsByValue.set(item._value, item); - this._itemsByElement.set(element, item); - item._target = element; - }, - - /** - * Untangles an item (model) from a displayed node element (view). - * - * @param Item item - * The item describing a target element. - */ - _untangleItem: function (item) { - if (item.finalize) { - item.finalize(item); - } - for (var childItem of item) { - item.remove(childItem); - } - - this._unlinkItem(item); - item._target = null; - }, - - /** - * Deletes an item from the its parent's storage maps. - * - * @param Item item - * The item describing a target element. - */ - _unlinkItem: function (item) { - this._itemsByValue.delete(item._value); - this._itemsByElement.delete(item._target); - }, - - /** - * The keyPress event listener for this container. - * @param string name - * @param KeyboardEvent event - */ - _onWidgetKeyPress: function (name, event) { - // Prevent scrolling when pressing navigation keys. - ViewHelpers.preventScrolling(event); - - switch (event.keyCode) { - case KeyCodes.DOM_VK_UP: - case KeyCodes.DOM_VK_LEFT: - this.focusPrevItem(); - break; - case KeyCodes.DOM_VK_DOWN: - case KeyCodes.DOM_VK_RIGHT: - this.focusNextItem(); - break; - case KeyCodes.DOM_VK_PAGE_UP: - this.focusItemAtDelta(-(this.pageSize || this.itemCount / PAGE_SIZE_ITEM_COUNT_RATIO)); - break; - case KeyCodes.DOM_VK_PAGE_DOWN: - this.focusItemAtDelta(+(this.pageSize || this.itemCount / PAGE_SIZE_ITEM_COUNT_RATIO)); - break; - case KeyCodes.DOM_VK_HOME: - this.focusFirstVisibleItem(); - break; - case KeyCodes.DOM_VK_END: - this.focusLastVisibleItem(); - break; - } - }, - - /** - * The mousePress event listener for this container. - * @param string name - * @param MouseEvent event - */ - _onWidgetMousePress: function (name, event) { - if (event.button != 0 && !this.allowFocusOnRightClick) { - // Only allow left-click to trigger this event. - return; - } - - var item = this.getItemForElement(event.target); - if (item) { - // The container is not empty and we clicked on an actual item. - this.selectedItem = item; - // Make sure the current event's target element is also focused. - this.autoFocusOnInput && item._target.focus(); - } - }, - - /** - * The predicate used when filtering items. By default, all items in this - * view are visible. - * - * @param Item item - * The item passing through the filter. - * @return boolean - * True if the item should be visible, false otherwise. - */ - _currentFilterPredicate: function (item) { - return true; - }, - - /** - * The predicate used when sorting items. By default, items in this view - * are sorted by their label. - * - * @param Item first - * The first item used in the comparison. - * @param Item second - * The second item used in the comparison. - * @return number - * -1 to sort first to a lower index than second - * 0 to leave first and second unchanged with respect to each other - * 1 to sort second to a lower index than first - */ - _currentSortPredicate: function (first, second) { - return +(first._value.toLowerCase() > second._value.toLowerCase()); - }, - - /** - * Call a method on this widget named `methodName`. Any further arguments are - * passed on to the method. Returns the result of the method call. - * - * @param String methodName - * The name of the method you want to call. - * @param args - * Optional. Any arguments you want to pass through to the method. - */ - callMethod: function (methodName) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - return this._widget[methodName].apply(this._widget, args); - }, - - _widget: null, - _emptyText: "", - _headerText: "", - _preferredValue: "", - _cachedCommandDispatcher: null - }; - - /** - * A generator-iterator over all the items in this container. - */ - Item.prototype[Symbol.iterator] = WidgetMethods[Symbol.iterator] = function* () { - yield* this._itemsByElement.values(); - }; - -/***/ }, -/* 880 */ +/* 991 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + var promise = __webpack_require__(980); + var EventEmitter = __webpack_require__(985); - var promise = __webpack_require__(839); - var EventEmitter = __webpack_require__(844); - - /* const { DebuggerServer } = require("../../server/main");*/ - - var _require = __webpack_require__(862), + var _require = __webpack_require__(977), DebuggerClient = _require.DebuggerClient; var targets = new WeakMap(); @@ -62818,8040 +45943,137 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }, -/* 881 */ -/***/ function(module, exports) { - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; - - // MOCK FOR TimelineFront - - class TimelineFront { - constructor(client, _ref) { - var timelineActor = _ref.timelineActor; - } - start(_ref2) { - var withDocLoadingEvents = _ref2.withDocLoadingEvents; - } - destroy() {} - on(evt, cb) {} - off(evt, cb) {} - }; - - exports.TimelineFront = TimelineFront; - -/***/ }, -/* 882 */ +/* 992 */ /***/ function(module, exports) { 'use strict'; - /** - * slice() reference. - */ - - var slice = Array.prototype.slice; - - /** - * Expose `co`. - */ - - module.exports = co['default'] = co.co = co; - - /** - * Wrap the given generator `fn` into a - * function that returns a promise. - * This is a separate function so that - * every `co()` call doesn't create a new, - * unnecessary closure. - * - * @param {GeneratorFunction} fn - * @return {Function} - * @api public - */ - - co.wrap = function (fn) { - createPromise.__generatorFunction__ = fn; - return createPromise; - function createPromise() { - return co.call(this, fn.apply(this, arguments)); - } - }; - - /** - * Execute the generator function or a generator - * and return a promise. - * - * @param {Function} fn - * @return {Promise} - * @api public - */ - - function co(gen) { - var ctx = this; - var args = slice.call(arguments, 1); - - // we wrap everything in a promise to avoid promise chaining, - // which leads to memory leak errors. - // see https://github.com/tj/co/issues/180 - return new Promise(function (resolve, reject) { - if (typeof gen === 'function') gen = gen.apply(ctx, args); - if (!gen || typeof gen.next !== 'function') return resolve(gen); - - onFulfilled(); - - /** - * @param {Mixed} res - * @return {Promise} - * @api private - */ - - function onFulfilled(res) { - var ret; - try { - ret = gen.next(res); - } catch (e) { - return reject(e); - } - next(ret); - } - - /** - * @param {Error} err - * @return {Promise} - * @api private - */ - - function onRejected(err) { - var ret; - try { - ret = gen.throw(err); - } catch (e) { - return reject(e); - } - next(ret); - } - - /** - * Get the next value in the generator, - * return a promise. - * - * @param {Object} ret - * @return {Promise} - * @api private - */ - - function next(ret) { - if (ret.done) return resolve(ret.value); - var value = toPromise.call(ctx, ret.value); - if (value && isPromise(value)) return value.then(onFulfilled, onRejected); - return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, ' + 'but the following object was passed: "' + String(ret.value) + '"')); - } - }); - } - - /** - * Convert a `yield`ed value into a promise. - * - * @param {Mixed} obj - * @return {Promise} - * @api private - */ - - function toPromise(obj) { - if (!obj) return obj; - if (isPromise(obj)) return obj; - if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj); - if ('function' == typeof obj) return thunkToPromise.call(this, obj); - if (Array.isArray(obj)) return arrayToPromise.call(this, obj); - if (isObject(obj)) return objectToPromise.call(this, obj); - return obj; - } - - /** - * Convert a thunk to a promise. - * - * @param {Function} - * @return {Promise} - * @api private - */ - - function thunkToPromise(fn) { - var ctx = this; - return new Promise(function (resolve, reject) { - fn.call(ctx, function (err, res) { - if (err) return reject(err); - if (arguments.length > 2) res = slice.call(arguments, 1); - resolve(res); - }); - }); - } - - /** - * Convert an array of "yieldables" to a promise. - * Uses `Promise.all()` internally. - * - * @param {Array} obj - * @return {Promise} - * @api private - */ - - function arrayToPromise(obj) { - return Promise.all(obj.map(toPromise, this)); - } - - /** - * Convert an object of "yieldables" to a promise. - * Uses `Promise.all()` internally. - * - * @param {Object} obj - * @return {Promise} - * @api private - */ - - function objectToPromise(obj) { - var results = new obj.constructor(); - var keys = Object.keys(obj); - var promises = []; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var promise = toPromise.call(this, obj[key]); - if (promise && isPromise(promise)) defer(promise, key);else results[key] = obj[key]; - } - return Promise.all(promises).then(function () { - return results; - }); - - function defer(promise, key) { - // predefine the key in the result - results[key] = undefined; - promises.push(promise.then(function (res) { - results[key] = res; - })); - } - } - - /** - * Check if `obj` is a promise. - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ - - function isPromise(obj) { - return 'function' == typeof obj.then; - } - - /** - * Check if `obj` is a generator. - * - * @param {Mixed} obj - * @return {Boolean} - * @api private - */ - - function isGenerator(obj) { - return 'function' == typeof obj.next && 'function' == typeof obj.throw; - } - - /** - * Check if `obj` is a generator function. - * - * @param {Mixed} obj - * @return {Boolean} - * @api private - */ - function isGeneratorFunction(obj) { - var constructor = obj.constructor; - if (!constructor) return false; - if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; - return isGenerator(constructor.prototype); - } - - /** - * Check for plain object. - * - * @param {Mixed} val - * @return {Boolean} - * @api private - */ - - function isObject(val) { - return Object == val.constructor; - } - -/***/ }, -/* 883 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(884); - var fs = __webpack_require__(118); - - function Iterator(text) { - var pos = 0, length = text.length; - - this.peek = function(num) { - num = num || 0; - if(pos + num >= length) { return null; } - - return text.charAt(pos + num); - }; - this.next = function(inc) { - inc = inc || 1; - - if(pos >= length) { return null; } - - return text.charAt((pos += inc) - inc); - }; - this.pos = function() { - return pos; - }; - } - - var rWhitespace = /\s/; - function isWhitespace(chr) { - return rWhitespace.test(chr); - } - function consumeWhiteSpace(iter) { - var start = iter.pos(); - - while(isWhitespace(iter.peek())) { iter.next(); } - - return { type: "whitespace", start: start, end: iter.pos() }; - } - - function startsComment(chr) { - return chr === "!" || chr === "#"; - } - function isEOL(chr) { - return chr == null || chr === "\n" || chr === "\r"; - } - function consumeComment(iter) { - var start = iter.pos(); - - while(!isEOL(iter.peek())) { iter.next(); } - - return { type: "comment", start: start, end: iter.pos() }; - } - - function startsKeyVal(chr) { - return !isWhitespace(chr) && !startsComment(chr); - } - function startsSeparator(chr) { - return chr === "=" || chr === ":" || isWhitespace(chr); - } - function startsEscapedVal(chr) { - return chr === "\\"; - } - function consumeEscapedVal(iter) { - var start = iter.pos(); - - iter.next(); // move past "\" - var curChar = iter.next(); - if(curChar === "u") { // encoded unicode char - iter.next(4); // Read in the 4 hex values - } - - return { type: "escaped-value", start: start, end: iter.pos() }; - } - function consumeKey(iter) { - var start = iter.pos(), children = []; - - var curChar; - while((curChar = iter.peek()) !== null) { - if(startsSeparator(curChar)) { break; } - if(startsEscapedVal(curChar)) { children.push(consumeEscapedVal(iter)); continue; } - - iter.next(); - } - - return { type: "key", start: start, end: iter.pos(), children: children }; - } - function consumeKeyValSeparator(iter) { - var start = iter.pos(); - - var seenHardSep = false, curChar; - while((curChar = iter.peek()) !== null) { - if(isEOL(curChar)) { break; } - - if(isWhitespace(curChar)) { iter.next(); continue; } - - if(seenHardSep) { break; } - - seenHardSep = (curChar === ":" || curChar === "="); - if(seenHardSep) { iter.next(); continue; } - - break; // curChar is a non-separtor char - } - - return { type: "key-value-separator", start: start, end: iter.pos() }; - } - function startsLineBreak(iter) { - return iter.peek() === "\\" && isEOL(iter.peek(1)); - } - function consumeLineBreak(iter) { - var start = iter.pos(); - - iter.next(); // consume \ - if(iter.peek() === "\r") { iter.next(); } - iter.next(); // consume \n - - var curChar; - while((curChar = iter.peek()) !== null) { - if(isEOL(curChar)) { break; } - if(!isWhitespace(curChar)) { break; } - - iter.next(); - } - - return { type: "line-break", start: start, end: iter.pos() }; - } - function consumeVal(iter) { - var start = iter.pos(), children = []; - - var curChar; - while((curChar = iter.peek()) !== null) { - if(startsLineBreak(iter)) { children.push(consumeLineBreak(iter)); continue; } - if(startsEscapedVal(curChar)) { children.push(consumeEscapedVal(iter)); continue; } - if(isEOL(curChar)) { break; } - - iter.next(); - } - - return { type: "value", start: start, end: iter.pos(), children: children }; - } - function consumeKeyVal(iter) { - return { - type: "key-value", - start: iter.pos(), - children: [ - consumeKey(iter), - consumeKeyValSeparator(iter), - consumeVal(iter) - ], - end: iter.pos() - }; - } - - var renderChild = { - "escaped-value": function(child, text) { - var type = text.charAt(child.start + 1); - - if(type === "t") { return "\t"; } - if(type === "r") { return "\r"; } - if(type === "n") { return "\n"; } - if(type === "f") { return "\f"; } - if(type !== "u") { return type; } - - return String.fromCharCode(parseInt(text.substr(child.start + 2, 4), 16)); - }, - "line-break": function (child, text) { - return ""; - } - }; - function rangeToBuffer(range, text) { - var start = range.start, buffer = []; - - for(var i = 0; i < range.children.length; i++) { - var child = range.children[i]; - - buffer.push(text.substring(start, child.start)); - buffer.push(renderChild[child.type](child, text)); - start = child.end; - } - buffer.push(text.substring(start, range.end)); - - return buffer; - } - function rangesToObject(ranges, text) { - var obj = Object.create(null); // Creates to a true hash map - - for(var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - - if(range.type !== "key-value") { continue; } - - var key = rangeToBuffer(range.children[0], text).join(""); - var val = rangeToBuffer(range.children[2], text).join(""); - obj[key] = val; - } - - return obj; - } - - function stringToRanges(text) { - var iter = new Iterator(text), ranges = []; - - var curChar; - while((curChar = iter.peek()) !== null) { - if(isWhitespace(curChar)) { ranges.push(consumeWhiteSpace(iter)); continue; } - if(startsComment(curChar)) { ranges.push(consumeComment(iter)); continue; } - if(startsKeyVal(curChar)) { ranges.push(consumeKeyVal(iter)); continue; } - - throw Error("Something crazy happened. text: '" + text + "'; curChar: '" + curChar + "'"); - } - - return ranges; - } - - function isNewLineRange(range) { - if(!range) { return false; } - - if(range.type === "whitespace") { return true; } - - if(range.type === "literal") { - return isWhitespace(range.text) && range.text.indexOf("\n") > -1; - } - - return false; - } - - function escapeMaker(escapes) { - return function escapeKey(key) { - var zeros = [ "", "0", "00", "000" ]; - var buf = []; - - for(var i = 0; i < key.length; i++) { - var chr = key.charAt(i); - - if(escapes[chr]) { buf.push(escapes[chr]); continue; } - - var code = chr.codePointAt(0); - - if(code <= 0x7F) { buf.push(chr); continue; } - - var hex = code.toString(16); - - buf.push("\\u"); - buf.push(zeros[4 - hex.length]); - buf.push(hex); - } - - return buf.join(""); - }; - } - - var escapeKey = escapeMaker({ " ": "\\ ", "\n": "\\n", ":": "\\:", "=": "\\=" }); - var escapeVal = escapeMaker({ "\n": "\\n" }); - - function Editor(text, options) { - if (typeof text === 'object') { - options = text; - text = null; - } - text = text || ""; - var path = options.path; - var separator = options.separator || '='; - - var ranges = stringToRanges(text); - var obj = rangesToObject(ranges, text); - var keyRange = Object.create(null); // Creates to a true hash map - - for(var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - - if(range.type !== "key-value") { continue; } - - var key = rangeToBuffer(range.children[0], text).join(""); - keyRange[key] = range; - } - - this.addHeadComment = function(comment) { - if(comment == null) { return; } - - ranges.unshift({ type: "literal", text: "# " + comment.replace(/\n/g, "\n# ") + "\n" }); - }; - - this.get = function(key) { return obj[key]; }; - this.set = function(key, val, comment) { - if(val == null) { this.unset(key); return; } - - obj[key] = val; - var escapedKey = escapeKey(key); - var escapedVal = escapeVal(val); - - var range = keyRange[key]; - if(!range) { - keyRange[key] = range = { - type: "literal", - text: escapedKey + separator + escapedVal - }; - - var prevRange = ranges[ranges.length - 1]; - if(prevRange != null && !isNewLineRange(prevRange)) { - ranges.push({ type: "literal", text: "\n" }); - } - ranges.push(range); - } - - // comment === null deletes comment. if comment === undefined, it's left alone - if(comment !== undefined) { - range.comment = comment && "# " + comment.replace(/\n/g, "\n# ") + "\n"; - } - - if(range.type === "literal") { - range.text = escapedKey + separator + escapedVal; - if(range.comment != null) { range.text = range.comment + range.text; } - } else if(range.type === "key-value") { - range.children[2] = { type: "literal", text: escapedVal }; - } else { - throw "Unknown node type: " + range.type; - } - }; - this.unset = function(key) { - if(!(key in obj)) { return; } - - var range = keyRange[key]; - var idx = ranges.indexOf(range); - - ranges.splice(idx, (isNewLineRange(ranges[idx + 1]) ? 2 : 1)); - - delete keyRange[key]; - delete obj[key]; - }; - this.valueOf = this.toString = function() { - var buffer = [], stack = [].concat(ranges); - - var node; - while((node = stack.shift()) != null) { - switch(node.type) { - case "literal": - buffer.push(node.text); - break; - case "key": - case "value": - case "comment": - case "whitespace": - case "key-value-separator": - case "escaped-value": - case "line-break": - buffer.push(text.substring(node.start, node.end)); - break; - case "key-value": - Array.prototype.unshift.apply(stack, node.children); - if(node.comment) { stack.unshift({ type: "literal", text: node.comment }); } - break; - } - } - - return buffer.join(""); - }; - this.save = function(newPath, callback) { - if(typeof newPath === 'function') { - callback = newPath; - newPath = path; - } - newPath = newPath || path; - - if(!newPath) { - if (callback) { - return callback("Unknown path"); - } - throw new Error("Unknown path"); - } - - if (callback) { - fs.writeFile(newPath, this.toString(), callback); - } else { - fs.writeFileSync(newPath, this.toString()); - } - - }; - } - function createEditor(/*path, options, callback*/) { - var path, options, callback; - var args = Array.prototype.slice.call(arguments); - for (var i = 0; i < args.length; i ++) { - var arg = args[i]; - if (!path && typeof arg === 'string') { - path = arg; - } else if (!options && typeof arg === 'object') { - options = arg; - } else if (!callback && typeof arg === 'function') { - callback = arg; - } - } - options = options || {}; - path = path || options.path; - callback = callback || options.callback; - options.path = path; - - if(!path) { return new Editor(options); } - - if(!callback) { return new Editor(fs.readFileSync(path).toString(), options); } - - return fs.readFile(path, function(err, text) { - if(err) { return callback(err, null); } - - text = text.toString(); - return callback(null, new Editor(text, options)); - }); - } - - function parse(text) { - text = text.toString(); - var ranges = stringToRanges(text); - return rangesToObject(ranges, text); - } - - function read(path, callback) { - if(!callback) { return parse(fs.readFileSync(path)); } - - return fs.readFile(path, function(err, data) { - if(err) { return callback(err, null); } - - return callback(null, parse(data)); - }); - } - - module.exports = { parse: parse, read: read, createEditor: createEditor }; - - -/***/ }, -/* 884 */ -/***/ function(module, exports) { - - /*! http://mths.be/codepointat v0.2.0 by @mathias */ - if (!String.prototype.codePointAt) { - (function() { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var defineProperty = (function() { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch(error) {} - return result; - }()); - var codePointAt = function(position) { - if (this == null) { - throw TypeError(); - } - var string = String(this); - var size = string.length; - // `ToInteger` - var index = position ? Number(position) : 0; - if (index != index) { // better `isNaN` - index = 0; - } - // Account for out-of-bounds indices: - if (index < 0 || index >= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - }; - if (defineProperty) { - defineProperty(String.prototype, 'codePointAt', { - 'value': codePointAt, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.codePointAt = codePointAt; - } - }()); - } - - -/***/ }, -/* 885 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var startDebuggingNode = (() => { - var _ref = _asyncToGenerator(function* (tabId) { - var clientType = "node"; - var tabs = yield chrome.connectNodeClient(); - if (!tabs) { - return {}; - } - - var tab = tabs.find(function (t) { - return t.id.indexOf(tabId) !== -1; - }); - - if (!tab) { - return {}; - } - - yield chrome.connectNode(tab.tab); - chrome.initPage({ clientType }); - - return { tabs, tab, clientType, client: chrome }; - }); - - return function startDebuggingNode(_x) { - return _ref.apply(this, arguments); - }; - })(); - - var startDebuggingTab = (() => { - var _ref2 = _asyncToGenerator(function* (connTarget) { - var clientType = connTarget.type; - var client = clientType === "chrome" ? chrome : firefox; - - var tabs = yield client.connectClient(); - - if (!tabs) { - return; - } - - var tab = tabs.find(function (t) { - return t.id.indexOf(connTarget.param) !== -1; - }); - if (!tab) { - return; - } - - var tabConnection = yield client.connectTab(tab.tab); - - client.initPage({ tab, clientType, tabConnection }); - - return { tab, tabConnection }; - }); - - return function startDebuggingTab(_x2) { - return _ref2.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var firefox = __webpack_require__(886); - var chrome = __webpack_require__(887); - - function startDebugging(connTarget) { - if (connTarget.type === "node") { - return startDebuggingNode(connTarget.param); - } - - return startDebuggingTab(connTarget); - } - - module.exports = { - startDebugging, - firefox, - chrome - }; - -/***/ }, -/* 886 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - var connectClient = (() => { - var _ref = _asyncToGenerator(function* () { - var useProxy = !getValue("firefox.webSocketConnection"); - var firefoxHost = getValue(useProxy ? "firefox.proxyHost" : "firefox.webSocketHost"); - - var socket = new WebSocket(`ws://${firefoxHost}`); - var transport = useProxy ? new DebuggerTransport(socket) : new WebsocketTransport(socket); - - debuggerClient = new DebuggerClient(transport); - if (!debuggerClient) { - return []; - } - - try { - yield debuggerClient.connect(); - var tabs = yield getTabs(); - return tabs; - } catch (err) { - console.log(err); - return []; - } - }); - - return function connectClient() { - return _ref.apply(this, arguments); - }; - })(); - - var connectTab = (() => { - var _ref2 = _asyncToGenerator(function* (tab) { - window.addEventListener("beforeunload", function () { - if (tabTarget !== null) { - tabTarget.destroy(); - } - }); - - var tabTarget = yield lookupTabTarget(tab); - - var _ref3 = yield tabTarget.activeTab.attachThread({}), - _ref4 = _slicedToArray(_ref3, 2), - threadClient = _ref4[1]; - - threadClient.resume(); - return { debuggerClient, threadClient, tabTarget }; - }); - - return function connectTab(_x) { - return _ref2.apply(this, arguments); - }; - })(); - - var getTabs = (() => { - var _ref5 = _asyncToGenerator(function* () { - if (!debuggerClient || !debuggerClient.mainRoot) { - return; - } - - var response = yield debuggerClient.listTabs(); - return createTabs(response.tabs); - }); - - return function getTabs() { - return _ref5.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(830), - DebuggerClient = _require.DebuggerClient, - DebuggerTransport = _require.DebuggerTransport, - TargetFactory = _require.TargetFactory, - WebsocketTransport = _require.WebsocketTransport; - - var _require2 = __webpack_require__(828), - getValue = _require2.getValue; - - var debuggerClient = null; - - function lookupTabTarget(tab) { - var options = { client: debuggerClient, form: tab, chrome: false }; - return TargetFactory.forRemoteTab(options); - } - - function createTabs(tabs) { - return tabs.map(tab => { - return { - title: tab.title, - url: tab.url, - id: tab.actor, - tab, - clientType: "firefox" - }; - }); - } - - function initPage() {} - - module.exports = { - connectClient, - connectTab, - initPage, - getTabs - }; - -/***/ }, -/* 887 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var connectClient = (() => { - var _ref2 = _asyncToGenerator(function* () { - if (!getValue("chrome.debug")) { - return createTabs([]); - } - - try { - var tabs = yield CDP.List({ - port: getValue("chrome.port"), - host: getValue("chrome.host") - }); - - return createTabs(tabs, { - clientType: "chrome", - type: "page" - }); - } catch (e) { - return []; - } - }); - - return function connectClient() { - return _ref2.apply(this, arguments); - }; - })(); - - var connectNodeClient = (() => { - var _ref3 = _asyncToGenerator(function* () { - if (!getValue("node.debug")) { - return createTabs([]); - } - - var tabs = void 0; - try { - tabs = yield CDP.List({ - port: getValue("node.port"), - host: getValue("node.host") - }); - } catch (e) { - return; - } - - return createTabs(tabs, { - clientType: "node", - type: "node" - }); - }); - - return function connectNodeClient() { - return _ref3.apply(this, arguments); - }; - })(); - - var connectTab = (() => { - var _ref4 = _asyncToGenerator(function* (tab) { - var tabConnection = yield CDP({ tab: tab.webSocketDebuggerUrl }); - return tabConnection; - }); - - return function connectTab(_x2) { - return _ref4.apply(this, arguments); - }; - })(); - - var connectNode = (() => { - var _ref5 = _asyncToGenerator(function* (tab) { - var tabConnection = yield CDP({ tab: tab.webSocketDebuggerUrl }); - - window.addEventListener("beforeunload", function () { - tabConnection.onclose = function disable() {}; - tabConnection.close(); - }); - - return tabConnection; - }); - - return function connectNode(_x3) { - return _ref5.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var CDP = __webpack_require__(126); - - var _require = __webpack_require__(828), - getValue = _require.getValue; - - var _require2 = __webpack_require__(830), - networkRequest = _require2.networkRequest; - - var connection = void 0; - - function createTabs(tabs) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - type = _ref.type, - clientType = _ref.clientType; - - return tabs.filter(tab => { - return tab.type == type; - }).map(tab => { - return { - title: tab.title, - url: tab.url, - id: tab.id, - tab, - clientType - }; - }); - } - - window.criRequest = function (options, callback) { - var host = options.host, - port = options.port, - path = options.path; - - var url = `http://${host}:${port}${path}`; - - networkRequest(url).then(res => callback(null, res.content)).catch(err => callback(err)); - }; - - function initPage(_ref6) { - var tab = _ref6.tab, - clientType = _ref6.clientType, - tabConnection = _ref6.tabConnection; - var Runtime = tabConnection.Runtime, - Page = tabConnection.Page; - - - Runtime.enable(); - - if (clientType == "node") { - Runtime.runIfWaitingForDebugger(); - } - - if (clientType == "chrome") { - Page.enable(); - } - - return connection; - } - - module.exports = { - connectClient, - connectNodeClient, - connectNode, - connectTab, - initPage - }; - -/***/ }, -/* 888 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var onConnect = (() => { - var _ref = _asyncToGenerator(function* (connection, services) { - // NOTE: the landing page does not connect to a JS process - if (!connection) { - return; - } - - var client = getClient(connection); - var commands = client.clientCommands; - - var _bootstrapStore = bootstrapStore(commands, services), - store = _bootstrapStore.store, - actions = _bootstrapStore.actions, - selectors = _bootstrapStore.selectors; - - bootstrapWorkers(); - yield client.onConnect(connection, actions); - yield loadFromPrefs(actions); - - window.getGlobalsForTesting = function () { - return { - store, - actions, - selectors, - client: client.clientCommands, - connection - }; - }; - - bootstrapApp(connection, { store, actions }); - - return { store, actions, selectors, client: commands }; - }); - - return function onConnect(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var firefox = __webpack_require__(889); - var chrome = __webpack_require__(893); - - var _require = __webpack_require__(226), - prefs = _require.prefs; - - var _require2 = __webpack_require__(897), - bootstrapApp = _require2.bootstrapApp, - bootstrapStore = _require2.bootstrapStore, - bootstrapWorkers = _require2.bootstrapWorkers; - - function loadFromPrefs(actions) { - var pauseOnExceptions = prefs.pauseOnExceptions, - ignoreCaughtExceptions = prefs.ignoreCaughtExceptions; - - if (pauseOnExceptions || ignoreCaughtExceptions) { - return actions.pauseOnExceptions(pauseOnExceptions, ignoreCaughtExceptions); - } - } - - function getClient(connection) { - var clientType = connection.tab.clientType; - - return clientType == "firefox" ? firefox : chrome; - } - - module.exports = { onConnect }; - -/***/ }, -/* 889 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var onConnect = exports.onConnect = (() => { - var _ref = _asyncToGenerator(function* (connection, actions) { - var _connection$tabConnec = connection.tabConnection, - tabTarget = _connection$tabConnec.tabTarget, - threadClient = _connection$tabConnec.threadClient, - debuggerClient = _connection$tabConnec.debuggerClient; - - - if (!tabTarget || !threadClient || !debuggerClient) { - return; - } - - setupCommands({ threadClient, tabTarget, debuggerClient }); - - if (actions) { - setupEvents({ threadClient, actions }); - } - - tabTarget.on("will-navigate", actions.willNavigate); - tabTarget.on("navigate", actions.navigated); - - yield threadClient.reconfigure({ observeAsmJS: true }); - - // In Firefox, we need to initially request all of the sources. This - // usually fires off individual `newSource` notifications as the - // debugger finds them, but there may be existing sources already in - // the debugger (if it's paused already, or if loading the page from - // bfcache) so explicity fire `newSource` events for all returned - // sources. - var sources = yield clientCommands.fetchSources(); - actions.newSources(sources); - - // If the threadClient is already paused, make sure to show a - // paused state. - var pausedPacket = threadClient.getLastPausePacket(); - if (pausedPacket) { - clientEvents.paused("paused", pausedPacket); - } - }); - - return function onConnect(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(890), - setupCommands = _require.setupCommands, - clientCommands = _require.clientCommands; - - var _require2 = __webpack_require__(892), - setupEvents = _require2.setupEvents, - clientEvents = _require2.clientEvents; - - exports.clientCommands = clientCommands; - exports.clientEvents = clientEvents; - -/***/ }, -/* 890 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var blackBox = (() => { - var _ref2 = _asyncToGenerator(function* (sourceId, isBlackBoxed) { - var sourceClient = threadClient.source({ actor: sourceId }); - if (isBlackBoxed) { - yield sourceClient.unblackBox(); - } else { - yield sourceClient.blackBox(); - } - - return { isBlackBoxed: !isBlackBoxed }; - }); - - return function blackBox(_x, _x2) { - return _ref2.apply(this, arguments); - }; - })(); - - var fetchSources = (() => { - var _ref3 = _asyncToGenerator(function* () { - var _ref4 = yield threadClient.getSources(), - sources = _ref4.sources; - - return sources.map(createSource); - }); - - return function fetchSources() { - return _ref3.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(891), - createSource = _require.createSource; - - var bpClients = void 0; - var threadClient = void 0; - var tabTarget = void 0; - var debuggerClient = void 0; - - function setupCommands(dependencies) { - threadClient = dependencies.threadClient; - tabTarget = dependencies.tabTarget; - debuggerClient = dependencies.debuggerClient; - bpClients = {}; - } - - function resume() { - return new Promise(resolve => { - threadClient.resume(resolve); - }); - } - - function stepIn() { - return new Promise(resolve => { - threadClient.stepIn(resolve); - }); - } - - function stepOver() { - return new Promise(resolve => { - threadClient.stepOver(resolve); - }); - } - - function stepOut() { - return new Promise(resolve => { - threadClient.stepOut(resolve); - }); - } - - function breakOnNext() { - return threadClient.breakOnNext(); - } - - function sourceContents(sourceId) { - var sourceClient = threadClient.source({ actor: sourceId }); - return sourceClient.source(); - } - - function setBreakpoint(location, condition, noSliding) { - var sourceClient = threadClient.source({ actor: location.sourceId }); - - return sourceClient.setBreakpoint({ - line: location.line, - column: location.column, - condition, - noSliding - }).then(res => onNewBreakpoint(location, res)); - } - - function onNewBreakpoint(location, res) { - var bpClient = res[1]; - var actualLocation = res[0].actualLocation; - bpClients[bpClient.actor] = bpClient; - - // Firefox only returns `actualLocation` if it actually changed, - // but we want it always to exist. Format `actualLocation` if it - // exists, otherwise use `location`. - actualLocation = actualLocation ? { - sourceId: actualLocation.source.actor, - line: actualLocation.line, - column: actualLocation.column - } : location; - - return { - id: bpClient.actor, - actualLocation - }; - } - - function removeBreakpoint(breakpointId) { - var bpClient = bpClients[breakpointId]; - delete bpClients[breakpointId]; - return bpClient.remove(); - } - - function setBreakpointCondition(breakpointId, location, condition, noSliding) { - var bpClient = bpClients[breakpointId]; - delete bpClients[breakpointId]; - - return bpClient.setCondition(threadClient, condition, noSliding).then(_bpClient => onNewBreakpoint(location, [{}, _bpClient])); - } - - function evaluate(script, _ref) { - var frameId = _ref.frameId; - - var params = frameId ? { frameActor: frameId } : {}; - return new Promise(resolve => { - tabTarget.activeConsole.evaluateJS(script, result => resolve(result), params); - }); - } - - function debuggeeCommand(script) { - tabTarget.activeConsole.evaluateJS(script, () => {}, {}); - - if (!debuggerClient) { - return; - } - - var consoleActor = tabTarget.form.consoleActor; - var request = debuggerClient._activeRequests.get(consoleActor); - request.emit("json-reply", {}); - debuggerClient._activeRequests.delete(consoleActor); - - return Promise.resolve(); - } - - function navigate(url) { - return tabTarget.activeTab.navigateTo(url); - } - - function reload() { - return tabTarget.activeTab.reload(); - } - - function getProperties(grip) { - var objClient = threadClient.pauseGrip(grip); - - return objClient.getPrototypeAndProperties().then(resp => { - return resp; - }); - } - - function pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { - return threadClient.pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions); - } - - function prettyPrint(sourceId, indentSize) { - var sourceClient = threadClient.source({ actor: sourceId }); - return sourceClient.prettyPrint(indentSize); - } - - function disablePrettyPrint(sourceId) { - var sourceClient = threadClient.source({ actor: sourceId }); - return sourceClient.disablePrettyPrint(); - } - - function interrupt() { - return threadClient.interrupt(); - } - - function eventListeners() { - return threadClient.eventListeners(); - } - - function pauseGrip(func) { - return threadClient.pauseGrip(func); - } - - var clientCommands = { - blackBox, - interrupt, - eventListeners, - pauseGrip, - resume, - stepIn, - stepOut, - stepOver, - breakOnNext, - sourceContents, - setBreakpoint, - removeBreakpoint, - setBreakpointCondition, - evaluate, - debuggeeCommand, - navigate, - reload, - getProperties, - pauseOnExceptions, - prettyPrint, - disablePrettyPrint, - fetchSources - }; - - module.exports = { - setupCommands, - clientCommands - }; - -/***/ }, -/* 891 */ -/***/ function(module, exports) { - - "use strict"; - - // This module converts Firefox specific types to the generic types - - function createFrame(frame) { - var title = void 0; - if (frame.type == "call") { - var c = frame.callee; - title = c.name || c.userDisplayName || c.displayName || "(anonymous)"; - } else { - title = `(${frame.type})`; - } - - return { - id: frame.actor, - displayName: title, - location: { - sourceId: frame.where.source.actor, - line: frame.where.line, - column: frame.where.column - }, - this: frame.this, - scope: frame.environment - }; - } - - function createSource(source) { - return { - id: source.actor, - url: source.url, - isPrettyPrinted: false, - sourceMapURL: source.sourceMapURL, - isBlackBoxed: false - }; - } - - function createPause(packet, response) { - // NOTE: useful when the debugger is already paused - var frame = packet.frame || response.frames[0]; - - return Object.assign({}, packet, { - frame: createFrame(frame), - frames: response.frames.map(createFrame) - }); - } - - module.exports = { - createFrame, - createSource, - createPause - }; - -/***/ }, -/* 892 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var paused = (() => { - var _ref = _asyncToGenerator(function* (_, packet) { - // If paused by an explicit interrupt, which are generated by the - // slow script dialog and internal events such as setting - // breakpoints, ignore the event. - var why = packet.why; - - if (why.type === "interrupted" && !packet.why.onNext) { - return; - } - - // Eagerly fetch the frames - var response = yield threadClient.getFrames(0, CALL_STACK_PAGE_SIZE); - - if (why.type != "alreadyPaused") { - var pause = createPause(packet, response); - actions.paused(pause); - } - }); - - return function paused(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(891), - createPause = _require.createPause, - createSource = _require.createSource; - - var _require2 = __webpack_require__(828), - isEnabled = _require2.isEnabled; - - var CALL_STACK_PAGE_SIZE = 1000; - - var threadClient = void 0; - var actions = void 0; - - function setupEvents(dependencies) { - threadClient = dependencies.threadClient; - actions = dependencies.actions; - - if (threadClient) { - Object.keys(clientEvents).forEach(eventName => { - threadClient.addListener(eventName, clientEvents[eventName]); - }); - } - } - - function resumed(_, packet) { - actions.resumed(packet); - } - - function newSource(_, _ref2) { - var source = _ref2.source; - - actions.newSource(createSource(source)); - - if (isEnabled("eventListeners")) { - actions.fetchEventListeners(); - } - } - - var clientEvents = { - paused, - resumed, - newSource - }; - - module.exports = { - setupEvents, - clientEvents - }; - -/***/ }, -/* 893 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var onConnect = exports.onConnect = (() => { - var _ref = _asyncToGenerator(function* (connection, actions) { - var tabConnection = connection.tabConnection, - type = connection.connTarget.type; - var Debugger = tabConnection.Debugger, - Runtime = tabConnection.Runtime, - Page = tabConnection.Page; - - - Debugger.enable(); - Debugger.setPauseOnExceptions({ state: "none" }); - Debugger.setAsyncCallStackDepth({ maxDepth: 0 }); - - if (type == "chrome") { - Page.frameNavigated(pageEvents.frameNavigated); - Page.frameStartedLoading(pageEvents.frameStartedLoading); - Page.frameStoppedLoading(pageEvents.frameStoppedLoading); - } - - Debugger.scriptParsed(clientEvents.scriptParsed); - Debugger.scriptFailedToParse(clientEvents.scriptFailedToParse); - Debugger.paused(clientEvents.paused); - Debugger.resumed(clientEvents.resumed); - - setupCommands({ Debugger, Runtime, Page }); - setupEvents({ actions, Page, type, Runtime }); - }); - - return function onConnect(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(894), - setupCommands = _require.setupCommands, - clientCommands = _require.clientCommands; - - var _require2 = __webpack_require__(896), - setupEvents = _require2.setupEvents, - clientEvents = _require2.clientEvents, - pageEvents = _require2.pageEvents; - - exports.clientCommands = clientCommands; - exports.clientEvents = clientEvents; - -/***/ }, -/* 894 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var setBreakpoint = (() => { - var _ref3 = _asyncToGenerator(function* (location, condition) { - var _ref4 = yield debuggerAgent.setBreakpoint({ - location: toServerLocation(location), - columnNumber: location.column - }), - breakpointId = _ref4.breakpointId, - serverLocation = _ref4.serverLocation; - - var actualLocation = fromServerLocation(serverLocation) || location; - - return { - id: breakpointId, - actualLocation: actualLocation - }; - }); - - return function setBreakpoint(_x, _x2) { - return _ref3.apply(this, arguments); - }; - })(); - - var getProperties = (() => { - var _ref5 = _asyncToGenerator(function* (object) { - var _ref6 = yield runtimeAgent.getProperties({ - objectId: object.objectId - }), - result = _ref6.result; - - var loadedObjects = result.map(createLoadedObject); - - return { loadedObjects }; - }); - - return function getProperties(_x3) { - return _ref5.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(895), - toServerLocation = _require.toServerLocation, - fromServerLocation = _require.fromServerLocation, - createLoadedObject = _require.createLoadedObject; - - var debuggerAgent = void 0; - var runtimeAgent = void 0; - var pageAgent = void 0; - - function setupCommands(_ref) { - var Debugger = _ref.Debugger, - Runtime = _ref.Runtime, - Page = _ref.Page; - - debuggerAgent = Debugger; - runtimeAgent = Runtime; - pageAgent = Page; - } - - function resume() { - return debuggerAgent.resume(); - } - - function stepIn() { - return debuggerAgent.stepInto(); - } - - function stepOver() { - return debuggerAgent.stepOver(); - } - - function stepOut() { - return debuggerAgent.stepOut(); - } - - function pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { - if (!shouldPauseOnExceptions) { - return debuggerAgent.setPauseOnExceptions({ state: "none" }); - } - var state = shouldIgnoreCaughtExceptions ? "uncaught" : "all"; - return debuggerAgent.setPauseOnExceptions({ state }); - } - - function breakOnNext() { - return debuggerAgent.pause(); - } - - function sourceContents(sourceId) { - return debuggerAgent.getScriptSource({ scriptId: sourceId }).then((_ref2) => { - var scriptSource = _ref2.scriptSource; - return { - source: scriptSource, - contentType: null - }; - }); - } - - function removeBreakpoint(breakpointId) { - return debuggerAgent.removeBreakpoint({ breakpointId }); - } - - function evaluate(script) { - return runtimeAgent.evaluate({ expression: script }); - } - - function debuggeeCommand(script) { - evaluate(script); - return Promise.resolve(); - } - - function navigate(url) { - return pageAgent.navigate({ url }); - } - - var clientCommands = { - resume, - stepIn, - stepOut, - stepOver, - pauseOnExceptions, - breakOnNext, - sourceContents, - setBreakpoint, - removeBreakpoint, - evaluate, - debuggeeCommand, - navigate, - getProperties - }; - - module.exports = { - setupCommands, - clientCommands - }; - -/***/ }, -/* 895 */ -/***/ function(module, exports) { - - "use strict"; - - function fromServerLocation(serverLocation) { - if (serverLocation) { - return { - sourceId: serverLocation.scriptId, - line: serverLocation.lineNumber + 1, - column: serverLocation.columnNumber - }; - } - } - - function toServerLocation(location) { - return { - scriptId: location.sourceId, - lineNumber: location.line - 1 - }; - } - - function createFrame(frame) { - return { - id: frame.callFrameId, - displayName: frame.functionName, - scopeChain: frame.scopeChain, - location: fromServerLocation(frame.location) - }; - } - - function createLoadedObject(serverObject, parentId) { - var value = serverObject.value, - name = serverObject.name; - - - return { - objectId: value.objectId, - parentId, - name, - value - }; - } - - module.exports = { - fromServerLocation, - toServerLocation, - createFrame, - createLoadedObject - }; - -/***/ }, -/* 896 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var paused = (() => { - var _ref2 = _asyncToGenerator(function* (_ref3) { - var callFrames = _ref3.callFrames, - reason = _ref3.reason, - data = _ref3.data, - hitBreakpoints = _ref3.hitBreakpoints, - asyncStackTrace = _ref3.asyncStackTrace; - - var frames = callFrames.map(createFrame); - var frame = frames[0]; - var why = Object.assign({}, { - type: reason - }, data); - - var objectId = frame.scopeChain[0].object.objectId; - - var _ref4 = yield runtimeAgent.getProperties({ - objectId - }), - result = _ref4.result; - - var loadedObjects = result.map(createLoadedObject); - - if (clientType == "chrome") { - pageAgent.configureOverlay({ message: "Paused in debugger.html" }); - } - - yield actions.paused({ frame, why, frames, loadedObjects }); - }); - - return function paused(_x) { - return _ref2.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(895), - createFrame = _require.createFrame, - createLoadedObject = _require.createLoadedObject; - - var actions = void 0; - var pageAgent = void 0; - var clientType = void 0; - var runtimeAgent = void 0; - - function setupEvents(dependencies) { - actions = dependencies.actions; - pageAgent = dependencies.Page; - clientType = dependencies.clientType; - runtimeAgent = dependencies.Runtime; - } - - // Debugger Events - function scriptParsed(_ref) { - var scriptId = _ref.scriptId, - url = _ref.url, - startLine = _ref.startLine, - startColumn = _ref.startColumn, - endLine = _ref.endLine, - endColumn = _ref.endColumn, - executionContextId = _ref.executionContextId, - hash = _ref.hash, - isContentScript = _ref.isContentScript, - isInternalScript = _ref.isInternalScript, - isLiveEdit = _ref.isLiveEdit, - sourceMapURL = _ref.sourceMapURL, - hasSourceURL = _ref.hasSourceURL, - deprecatedCommentWasUsed = _ref.deprecatedCommentWasUsed; - - if (isContentScript) { - return; - } - - if (clientType == "node") { - sourceMapURL = undefined; - } - - actions.newSource({ - id: scriptId, - url, - sourceMapURL, - isPrettyPrinted: false - }); - } - - function scriptFailedToParse() {} - - function resumed() { - if (clientType == "chrome") { - pageAgent.configureOverlay({ suspended: false }); - } - - actions.resumed(); - } - - function globalObjectCleared() {} - - // Page Events - function frameNavigated(frame) { - actions.navigated(); - } - - function frameStartedLoading() { - actions.willNavigate(); - } - - function domContentEventFired() {} - - function loadEventFired() {} - - function frameStoppedLoading() {} - - var clientEvents = { - scriptParsed, - scriptFailedToParse, - paused, - resumed, - globalObjectCleared - }; - - var pageEvents = { - frameNavigated, - frameStartedLoading, - domContentEventFired, - loadEventFired, - frameStoppedLoading - }; - - module.exports = { - setupEvents, - pageEvents, - clientEvents - }; - -/***/ }, -/* 897 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.bootstrapStore = bootstrapStore; - exports.bootstrapApp = bootstrapApp; - exports.bootstrapWorkers = bootstrapWorkers; - exports.teardownWorkers = teardownWorkers; - var React = __webpack_require__(2); - - var _require = __webpack_require__(3), - bindActionCreators = _require.bindActionCreators, - combineReducers = _require.combineReducers; - - var ReactDOM = __webpack_require__(22); - - var _require2 = __webpack_require__(828), - getValue = _require2.getValue, - isFirefoxPanel = _require2.isFirefoxPanel; - - var _require3 = __webpack_require__(131), - renderRoot = _require3.renderRoot; - - var _require4 = __webpack_require__(898), - startSourceMapWorker = _require4.startSourceMapWorker, - stopSourceMapWorker = _require4.stopSourceMapWorker; - - var _require5 = __webpack_require__(903), - startPrettyPrintWorker = _require5.startPrettyPrintWorker, - stopPrettyPrintWorker = _require5.stopPrettyPrintWorker; - - var _require6 = __webpack_require__(827), - startParserWorker = _require6.startParserWorker, - stopParserWorker = _require6.stopParserWorker; - - var configureStore = __webpack_require__(189); - var reducers = __webpack_require__(227); - var selectors = __webpack_require__(242); - - var App = __webpack_require__(243).default; - - function bootstrapStore(client, services) { - var createStore = configureStore({ - log: getValue("logging.actions"), - makeThunkArgs: (args, state) => { - return Object.assign({}, args, { client }, services); - } - }); - - var store = createStore(combineReducers(reducers)); - var actions = bindActionCreators(__webpack_require__(244).default, store.dispatch); - - return { store, actions, selectors }; - } - - function bootstrapApp(connection, _ref) { - var store = _ref.store, - actions = _ref.actions; - - window.appStore = store; - - // Expose the bound actions so external things can do things like - // selecting a source. - window.actions = { - selectSource: actions.selectSource, - selectSourceURL: actions.selectSourceURL - }; - - renderRoot(React, ReactDOM, App, store); - } - - function bootstrapWorkers() { - if (!isFirefoxPanel()) { - // When used in Firefox, the toolbox manages the source map worker. - startSourceMapWorker(getValue("workers.sourceMapURL")); - } - startPrettyPrintWorker(getValue("workers.prettyPrintURL")); - startParserWorker(getValue("workers.parserURL")); - } - - function teardownWorkers() { - if (!isFirefoxPanel()) { - // When used in Firefox, the toolbox manages the source map worker. - stopSourceMapWorker(); - } - stopPrettyPrintWorker(); - stopParserWorker(); - } - -/***/ }, -/* 898 */ -/***/ function(module, exports, __webpack_require__) { - - const { - originalToGeneratedId, - generatedToOriginalId, - isGeneratedId, - isOriginalId - } = __webpack_require__(899); - - const { workerUtils: { WorkerDispatcher } } = __webpack_require__(900); - - const dispatcher = new WorkerDispatcher(); - - const getOriginalURLs = dispatcher.task("getOriginalURLs"); - const getGeneratedLocation = dispatcher.task("getGeneratedLocation"); - const getOriginalLocation = dispatcher.task("getOriginalLocation"); - const getOriginalSourceText = dispatcher.task("getOriginalSourceText"); - const applySourceMap = dispatcher.task("applySourceMap"); - const clearSourceMaps = dispatcher.task("clearSourceMaps"); - const hasMappedSource = dispatcher.task("hasMappedSource"); - - module.exports = { - originalToGeneratedId, - generatedToOriginalId, - isGeneratedId, - isOriginalId, - hasMappedSource, - getOriginalURLs, - getGeneratedLocation, - getOriginalLocation, - getOriginalSourceText, - applySourceMap, - clearSourceMaps, - startSourceMapWorker: dispatcher.start.bind(dispatcher), - stopSourceMapWorker: dispatcher.stop.bind(dispatcher) - }; - -/***/ }, -/* 899 */ -/***/ function(module, exports, __webpack_require__) { - - const md5 = __webpack_require__(248); - - function originalToGeneratedId(originalId) { - const match = originalId.match(/(.*)\/originalSource/); - return match ? match[1] : ""; - } - - function generatedToOriginalId(generatedId, url) { - return `${generatedId}/originalSource-${md5(url)}`; - } - - function isOriginalId(id) { - return !!id.match(/\/originalSource/); - } - - function isGeneratedId(id) { - return !isOriginalId(id); - } - - /** - * Trims the query part or reference identifier of a URL string, if necessary. - */ - function trimUrlQuery(url) { - let length = url.length; - let q1 = url.indexOf("?"); - let q2 = url.indexOf("&"); - let q3 = url.indexOf("#"); - let q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); - - return url.slice(0, q); - } - - /** - * Returns true if the specified URL and/or content type are specific to - * JavaScript files. - * - * @return boolean - * True if the source is likely JavaScript. - */ - function isJavaScript(url, contentType = "") { - return url && /\.(jsm|js)?$/.test(trimUrlQuery(url)) || contentType.includes("javascript"); - } - - function getContentType(url) { - if (isJavaScript(url)) { - return "text/javascript"; - } - - if (url.match(/ts$/)) { - return "text/typescript"; - } - - if (url.match(/tsx$/)) { - return "text/typescript-jsx"; - } - - if (url.match(/jsx$/)) { - return "text/jsx"; - } - - if (url.match(/coffee$/)) { - return "text/coffeescript"; - } - - if (url.match(/elm$/)) { - return "text/elm"; - } - - if (url.match(/cljs$/)) { - return "text/x-clojure"; - } - - return "text/plain"; - } - - module.exports = { - originalToGeneratedId, - generatedToOriginalId, - isOriginalId, - isGeneratedId, - getContentType - }; - -/***/ }, -/* 900 */ -/***/ function(module, exports, __webpack_require__) { - - const networkRequest = __webpack_require__(901); - const workerUtils = __webpack_require__(902); - - module.exports = { - networkRequest, - workerUtils - }; - -/***/ }, -/* 901 */ -/***/ function(module, exports) { - - function networkRequest(url, opts) { - return new Promise((resolve, reject) => { - const req = new XMLHttpRequest(); - - req.addEventListener("readystatechange", () => { - if (req.readyState === XMLHttpRequest.DONE) { - if (req.status === 200) { - resolve({ content: req.responseText }); - } else { - resolve(req.statusText); - } - } - }); - - // Not working yet. - // if (!opts.loadFromCache) { - // req.channel.loadFlags = ( - // Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE | - // Components.interfaces.nsIRequest.INHIBIT_CACHING | - // Components.interfaces.nsIRequest.LOAD_ANONYMOUS - // ); - // } - - req.open("GET", url); - req.send(); - }); - } - - module.exports = networkRequest; - -/***/ }, -/* 902 */ -/***/ function(module, exports) { - - - - function WorkerDispatcher() { - this.msgId = 1; - this.worker = null; - } - - WorkerDispatcher.prototype = { - start(url) { - this.worker = new Worker(url); - this.worker.onerror = () => { - console.error(`Error in worker ${url}`); - }; - }, - - stop() { - if (!this.worker) { - return; - } - - this.worker.terminate(); - this.worker = null; - }, - - task(method) { - return (...args) => { - return new Promise((resolve, reject) => { - const id = this.msgId++; - this.worker.postMessage({ id, method, args }); - - const listener = ({ data: result }) => { - if (result.id !== id) { - return; - } - - this.worker.removeEventListener("message", listener); - if (result.error) { - reject(result.error); - } else { - resolve(result.response); - } - }; - - this.worker.addEventListener("message", listener); - }); - }; - } - }; - - function workerHandler(publicInterface) { - return function workerHandler(msg) { - const { id, method, args } = msg.data; - const response = publicInterface[method].apply(undefined, args); - if (response instanceof Promise) { - response.then(val => self.postMessage({ id, response: val }), err => self.postMessage({ id, error: err })); - } else { - self.postMessage({ id, response }); - } - }; - } - - module.exports = { - WorkerDispatcher, - workerHandler - }; - -/***/ }, -/* 903 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var prettyPrint = (() => { - var _ref = _asyncToGenerator(function* (_ref2) { - var source = _ref2.source, - sourceText = _ref2.sourceText, - url = _ref2.url; - - var contentType = sourceText ? sourceText.contentType : ""; - var indent = 2; - - assert(isJavaScript(source.url, contentType), "Can't prettify non-javascript files."); - - return yield _prettyPrint({ - url, - indent, - source: sourceText ? sourceText.text : undefined - }); - }); - - return function prettyPrint(_x) { - return _ref.apply(this, arguments); - }; - })(); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var _require = __webpack_require__(900), - WorkerDispatcher = _require.workerUtils.WorkerDispatcher; - - var _require2 = __webpack_require__(233), - isJavaScript = _require2.isJavaScript; - - var assert = __webpack_require__(223); - - var dispatcher = new WorkerDispatcher(); - var _prettyPrint = dispatcher.task("prettyPrint"); - - module.exports = { - prettyPrint, - startPrettyPrintWorker: dispatcher.start.bind(dispatcher), - stopPrettyPrintWorker: dispatcher.stop.bind(dispatcher) - }; - -/***/ }, -/* 904 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.resolveToken = undefined; - - var resolveToken = exports.resolveToken = (() => { - var _ref = _asyncToGenerator(function* (cm, token, sourceText, frame) { - var loc = getTokenLocation(cm, token); - return yield (0, _parser.resolveToken)(sourceText.toJS(), token.textContent || "", loc, frame); - }); - - return function resolveToken(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - }; - })(); - - exports.getTokenLocation = getTokenLocation; - exports.getThisFromFrame = getThisFromFrame; - exports.previewExpression = previewExpression; - exports.getExpressionValue = getExpressionValue; - - var _parser = __webpack_require__(827); - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - var get = __webpack_require__(67); - - function getTokenLocation(codeMirror, tokenEl) { - var lineOffset = 1; - - var _tokenEl$getBoundingC = tokenEl.getBoundingClientRect(), - left = _tokenEl$getBoundingC.left, - top = _tokenEl$getBoundingC.top; - - var _codeMirror$coordsCha = codeMirror.coordsChar({ left, top }), - line = _codeMirror$coordsCha.line, - ch = _codeMirror$coordsCha.ch; - - return { - line: line + lineOffset, - column: ch - }; - } - - function getThisFromFrame(selectedFrame) { - if ("this" in selectedFrame) { - return { value: selectedFrame.this }; - } - - return null; - } - - // TODO Better define the value for `variables` map once we do it in - // debugger-html - function previewExpression(_ref2) { - var expression = _ref2.expression, - selectedFrame = _ref2.selectedFrame, - variables = _ref2.variables, - tokenText = _ref2.tokenText; - - if (!tokenText) { - return null; - } - - if (tokenText === "this") { - return getThisFromFrame(selectedFrame); - } - - if (variables.has(tokenText)) { - return variables.get(tokenText); - } - - return expression || null; - } - - // `getExpressionValue` and `previewExpression` are utility functions - // for resolving which expression to show in the preview. - // Get ExpressionValue, knows how to get the appropriate value for each type: - // variable, expression, raw value. - function getExpressionValue(selectedExpression, _ref3) { - var getExpression = _ref3.getExpression; - - var variableValue = get(selectedExpression, "contents.value"); - if (variableValue) { - return variableValue; - } - - var expressionValue = getExpression(selectedExpression.value); - if (expressionValue) { - return get(expressionValue, "value.result"); - } - - var rawValue = selectedExpression.value; - return rawValue; - } - -/***/ }, -/* 905 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - /** - * Author: Hans Engel - * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun) - */ - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("clojure", function (options) { - var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHARACTER = "string-2", - ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", VAR = "variable"; - var INDENT_WORD_SKIP = options.indentUnit || 2; - var NORMAL_INDENT_UNIT = options.indentUnit || 2; - - function makeKeywords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - var atoms = makeKeywords("true false nil"); - - var keywords = makeKeywords( - "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest " + - "slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn " + - "do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync " + - "doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars " + - "binding gen-class gen-and-load-class gen-and-save-class handler-case handle"); - - var builtins = makeKeywords( - "* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* " + - "*compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* " + - "*math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* " + - "*source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> " + - "->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor " + - "aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! " + - "alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double " + - "aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 " + - "bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set " + - "bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast " + - "byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append " + - "chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors " + - "clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp " + - "conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? " + - "declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol " + - "defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc " + - "dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last " + - "drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info " + - "extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword " + - "find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? " + - "fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? " + - "gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash " + - "hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? " + - "int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep " + - "keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file " + - "load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array " + - "make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods " + - "min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty " + - "not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias " + - "ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all " + - "partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers " + - "primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str " + - "prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues " + - "quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern " + - "re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history " + - "ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods " + - "remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest " + - "restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? " + - "seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts " + - "shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? " + - "special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol " + - "symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce " + - "transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec " + - "unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int " + - "unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int "+ - "unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote " + - "unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of " + - "vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context " + - "with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap " + - "*default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! " + - "set-agent-send-off-executor! some-> some->>"); - - var indentKeys = makeKeywords( - // Built-ins - "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto " + - "locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type " + - "try catch " + - - // Binding forms - "let letfn binding loop for doseq dotimes when-let if-let " + - - // Data structures - "defstruct struct-map assoc " + - - // clojure.test - "testing deftest " + - - // contrib - "handler-case handle dotrace deftrace"); - - var tests = { - digit: /\d/, - digit_or_colon: /[\d:]/, - hex: /[0-9a-f]/i, - sign: /[+-]/, - exponent: /e/i, - keyword_char: /[^\s\(\[\;\)\]]/, - symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/, - block_indent: /^(?:def|with)[^\/]+$|\/(?:def|with)/ - }; - - function stateStack(indent, type, prev) { // represents a state stack object - this.indent = indent; - this.type = type; - this.prev = prev; - } - - function pushStack(state, indent, type) { - state.indentStack = new stateStack(indent, type, state.indentStack); - } - - function popStack(state) { - state.indentStack = state.indentStack.prev; - } - - function isNumber(ch, stream){ - // hex - if ( ch === '0' && stream.eat(/x/i) ) { - stream.eatWhile(tests.hex); - return true; - } - - // leading sign - if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) { - stream.eat(tests.sign); - ch = stream.next(); - } - - if ( tests.digit.test(ch) ) { - stream.eat(ch); - stream.eatWhile(tests.digit); - - if ( '.' == stream.peek() ) { - stream.eat('.'); - stream.eatWhile(tests.digit); - } else if ('/' == stream.peek() ) { - stream.eat('/'); - stream.eatWhile(tests.digit); - } - - if ( stream.eat(tests.exponent) ) { - stream.eat(tests.sign); - stream.eatWhile(tests.digit); - } - - return true; - } - - return false; - } - - // Eat character that starts after backslash \ - function eatCharacter(stream) { - var first = stream.next(); - // Read special literals: backspace, newline, space, return. - // Just read all lowercase letters. - if (first && first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) { - return; - } - // Read unicode character: \u1000 \uA0a1 - if (first === "u") { - stream.match(/[0-9a-z]{4}/i, true); - } - } - - return { - startState: function () { - return { - indentStack: null, - indentation: 0, - mode: false - }; - }, - - token: function (stream, state) { - if (state.indentStack == null && stream.sol()) { - // update indentation, but only if indentStack is empty - state.indentation = stream.indentation(); - } - - // skip spaces - if (state.mode != "string" && stream.eatSpace()) { - return null; - } - var returnType = null; - - switch(state.mode){ - case "string": // multi-line string parsing mode - var next, escaped = false; - while ((next = stream.next()) != null) { - if (next == "\"" && !escaped) { - - state.mode = false; - break; - } - escaped = !escaped && next == "\\"; - } - returnType = STRING; // continue on in string mode - break; - default: // default parsing mode - var ch = stream.next(); - - if (ch == "\"") { - state.mode = "string"; - returnType = STRING; - } else if (ch == "\\") { - eatCharacter(stream); - returnType = CHARACTER; - } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) { - returnType = ATOM; - } else if (ch == ";") { // comment - stream.skipToEnd(); // rest of the line is a comment - returnType = COMMENT; - } else if (isNumber(ch,stream)){ - returnType = NUMBER; - } else if (ch == "(" || ch == "[" || ch == "{" ) { - var keyWord = '', indentTemp = stream.column(), letter; - /** - Either - (indent-word .. - (non-indent-word .. - (;something else, bracket, etc. - */ - - if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != null) { - keyWord += letter; - } - - if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) || - tests.block_indent.test(keyWord))) { // indent-word - pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); - } else { // non-indent word - // we continue eating the spaces - stream.eatSpace(); - if (stream.eol() || stream.peek() == ";") { - // nothing significant after - // we restart indentation the user defined spaces after - pushStack(state, indentTemp + NORMAL_INDENT_UNIT, ch); - } else { - pushStack(state, indentTemp + stream.current().length, ch); // else we match - } - } - stream.backUp(stream.current().length - 1); // undo all the eating - - returnType = BRACKET; - } else if (ch == ")" || ch == "]" || ch == "}") { - returnType = BRACKET; - if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : (ch == "]" ? "[" :"{"))) { - popStack(state); - } - } else if ( ch == ":" ) { - stream.eatWhile(tests.symbol); - return ATOM; - } else { - stream.eatWhile(tests.symbol); - - if (keywords && keywords.propertyIsEnumerable(stream.current())) { - returnType = KEYWORD; - } else if (builtins && builtins.propertyIsEnumerable(stream.current())) { - returnType = BUILTIN; - } else if (atoms && atoms.propertyIsEnumerable(stream.current())) { - returnType = ATOM; - } else { - returnType = VAR; - } - } - } - - return returnType; - }, - - indent: function (state) { - if (state.indentStack == null) return state.indentation; - return state.indentStack.indent; - }, - - closeBrackets: {pairs: "()[]{}\"\""}, - lineComment: ";;" - }; - }); - - CodeMirror.defineMIME("text/x-clojure", "clojure"); - CodeMirror.defineMIME("text/x-clojurescript", "clojure"); - CodeMirror.defineMIME("application/edn", "clojure"); - - }); - - -/***/ }, -/* 906 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - function doFold(cm, pos, options, force) { - if (options && options.call) { - var finder = options; - options = null; - } else { - var finder = getOption(cm, options, "rangeFinder"); - } - if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); - var minSize = getOption(cm, options, "minFoldSize"); - - function getRange(allowFolded) { - var range = finder(cm, pos); - if (!range || range.to.line - range.from.line < minSize) return null; - var marks = cm.findMarksAt(range.from); - for (var i = 0; i < marks.length; ++i) { - if (marks[i].__isFold && force !== "fold") { - if (!allowFolded) return null; - range.cleared = true; - marks[i].clear(); - } - } - return range; - } - - var range = getRange(true); - if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) { - pos = CodeMirror.Pos(pos.line - 1, 0); - range = getRange(false); - } - if (!range || range.cleared || force === "unfold") return; - - var myWidget = makeWidget(cm, options); - CodeMirror.on(myWidget, "mousedown", function(e) { - myRange.clear(); - CodeMirror.e_preventDefault(e); - }); - var myRange = cm.markText(range.from, range.to, { - replacedWith: myWidget, - clearOnEnter: getOption(cm, options, "clearOnEnter"), - __isFold: true - }); - myRange.on("clear", function(from, to) { - CodeMirror.signal(cm, "unfold", cm, from, to); - }); - CodeMirror.signal(cm, "fold", cm, range.from, range.to); - } - - function makeWidget(cm, options) { - var widget = getOption(cm, options, "widget"); - if (typeof widget == "string") { - var text = document.createTextNode(widget); - widget = document.createElement("span"); - widget.appendChild(text); - widget.className = "CodeMirror-foldmarker"; - } - return widget; - } - - // Clumsy backwards-compatible interface - CodeMirror.newFoldFunction = function(rangeFinder, widget) { - return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; - }; - - // New-style interface - CodeMirror.defineExtension("foldCode", function(pos, options, force) { - doFold(this, pos, options, force); - }); - - CodeMirror.defineExtension("isFolded", function(pos) { - var marks = this.findMarksAt(pos); - for (var i = 0; i < marks.length; ++i) - if (marks[i].__isFold) return true; - }); - - CodeMirror.commands.toggleFold = function(cm) { - cm.foldCode(cm.getCursor()); - }; - CodeMirror.commands.fold = function(cm) { - cm.foldCode(cm.getCursor(), null, "fold"); - }; - CodeMirror.commands.unfold = function(cm) { - cm.foldCode(cm.getCursor(), null, "unfold"); - }; - CodeMirror.commands.foldAll = function(cm) { - cm.operation(function() { - for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); - }); - }; - CodeMirror.commands.unfoldAll = function(cm) { - cm.operation(function() { - for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); - }); - }; - - CodeMirror.registerHelper("fold", "combine", function() { - var funcs = Array.prototype.slice.call(arguments, 0); - return function(cm, start) { - for (var i = 0; i < funcs.length; ++i) { - var found = funcs[i](cm, start); - if (found) return found; - } - }; - }); - - CodeMirror.registerHelper("fold", "auto", function(cm, start) { - var helpers = cm.getHelpers(start, "fold"); - for (var i = 0; i < helpers.length; i++) { - var cur = helpers[i](cm, start); - if (cur) return cur; - } - }); - - var defaultOptions = { - rangeFinder: CodeMirror.fold.auto, - widget: "\u2194", - minFoldSize: 0, - scanUp: false, - clearOnEnter: true - }; - - CodeMirror.defineOption("foldOptions", null); - - function getOption(cm, options, name) { - if (options && options[name] !== undefined) - return options[name]; - var editorOptions = cm.options.foldOptions; - if (editorOptions && editorOptions[name] !== undefined) - return editorOptions[name]; - return defaultOptions[name]; - } - - CodeMirror.defineExtension("foldOption", function(options, name) { - return getOption(this, options, name); - }); - }); - - -/***/ }, -/* 907 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.registerHelper("fold", "brace", function(cm, start) { - var line = start.line, lineText = cm.getLine(line); - var tokenType; - - function findOpening(openCh) { - for (var at = start.ch, pass = 0;;) { - var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); - if (found == -1) { - if (pass == 1) break; - pass = 1; - at = lineText.length; - continue; - } - if (pass == 1 && found < start.ch) break; - tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); - if (!/^(comment|string)/.test(tokenType)) return found + 1; - at = found - 1; - } - } - - var startToken = "{", endToken = "}", startCh = findOpening("{"); - if (startCh == null) { - startToken = "[", endToken = "]"; - startCh = findOpening("["); - } - - if (startCh == null) return; - var count = 1, lastLine = cm.lastLine(), end, endCh; - outer: for (var i = line; i <= lastLine; ++i) { - var text = cm.getLine(i), pos = i == line ? startCh : 0; - for (;;) { - var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); - if (nextOpen < 0) nextOpen = text.length; - if (nextClose < 0) nextClose = text.length; - pos = Math.min(nextOpen, nextClose); - if (pos == text.length) break; - if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { - if (pos == nextOpen) ++count; - else if (!--count) { end = i; endCh = pos; break outer; } - } - ++pos; - } - } - if (end == null || line == end && endCh == startCh) return; - return {from: CodeMirror.Pos(line, startCh), - to: CodeMirror.Pos(end, endCh)}; - }); - - CodeMirror.registerHelper("fold", "import", function(cm, start) { - function hasImport(line) { - if (line < cm.firstLine() || line > cm.lastLine()) return null; - var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); - if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); - if (start.type != "keyword" || start.string != "import") return null; - // Now find closing semicolon, return its position - for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { - var text = cm.getLine(i), semi = text.indexOf(";"); - if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; - } - } - - var startLine = start.line, has = hasImport(startLine), prev; - if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1)) - return null; - for (var end = has.end;;) { - var next = hasImport(end.line + 1); - if (next == null) break; - end = next.end; - } - return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end}; - }); - - CodeMirror.registerHelper("fold", "include", function(cm, start) { - function hasInclude(line) { - if (line < cm.firstLine() || line > cm.lastLine()) return null; - var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); - if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); - if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; - } - - var startLine = start.line, has = hasInclude(startLine); - if (has == null || hasInclude(startLine - 1) != null) return null; - for (var end = startLine;;) { - var next = hasInclude(end + 1); - if (next == null) break; - ++end; - } - return {from: CodeMirror.Pos(startLine, has + 1), - to: cm.clipPos(CodeMirror.Pos(end))}; - }); - - }); - - -/***/ }, -/* 908 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - function lineIndent(cm, lineNo) { - var text = cm.getLine(lineNo) - var spaceTo = text.search(/\S/) - if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1)))) - return -1 - return CodeMirror.countColumn(text, null, cm.getOption("tabSize")) - } - ! - CodeMirror.registerHelper("fold", "indent", function(cm, start) { - var myIndent = lineIndent(cm, start.line) - if (myIndent < 0) return - var lastLineInFold = null - - // Go through lines until we find a line that definitely doesn't belong in - // the block we're folding, or to the end. - for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { - var indent = lineIndent(cm, i) - if (indent == -1) { - } else if (indent > myIndent) { - // Lines with a greater indent are considered part of the block. - lastLineInFold = i; - } else { - // If this line has non-space, non-comment content, and is - // indented less or equal to the start line, it is the start of - // another block. - break; - } - } - if (lastLineInFold) return { - from: CodeMirror.Pos(start.line, cm.getLine(start.line).length), - to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) - }; - }); - - }); - - -/***/ }, -/* 909 */ -/***/ function(module, exports, __webpack_require__) { - - // CodeMirror, copyright (c) by Marijn Haverbeke and others - // Distributed under an MIT license: http://codemirror.net/LICENSE - - (function(mod) { - if (true) // CommonJS - mod(__webpack_require__(306), __webpack_require__(906)); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "./foldcode"], mod); - else // Plain browser env - mod(CodeMirror); - })(function(CodeMirror) { - "use strict"; - - CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { - if (old && old != CodeMirror.Init) { - cm.clearGutter(cm.state.foldGutter.options.gutter); - cm.state.foldGutter = null; - cm.off("gutterClick", onGutterClick); - cm.off("change", onChange); - cm.off("viewportChange", onViewportChange); - cm.off("fold", onFold); - cm.off("unfold", onFold); - cm.off("swapDoc", onChange); - } - if (val) { - cm.state.foldGutter = new State(parseOptions(val)); - updateInViewport(cm); - cm.on("gutterClick", onGutterClick); - cm.on("change", onChange); - cm.on("viewportChange", onViewportChange); - cm.on("fold", onFold); - cm.on("unfold", onFold); - cm.on("swapDoc", onChange); - } - }); - - var Pos = CodeMirror.Pos; - - function State(options) { - this.options = options; - this.from = this.to = 0; - } - - function parseOptions(opts) { - if (opts === true) opts = {}; - if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; - if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; - if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; - return opts; - } - - function isFolded(cm, line) { - var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0)); - for (var i = 0; i < marks.length; ++i) - if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i]; - } - - function marker(spec) { - if (typeof spec == "string") { - var elt = document.createElement("div"); - elt.className = spec + " CodeMirror-guttermarker-subtle"; - return elt; - } else { - return spec.cloneNode(true); - } - } - - function updateFoldInfo(cm, from, to) { - var opts = cm.state.foldGutter.options, cur = from; - var minSize = cm.foldOption(opts, "minFoldSize"); - var func = cm.foldOption(opts, "rangeFinder"); - cm.eachLine(from, to, function(line) { - var mark = null; - if (isFolded(cm, cur)) { - mark = marker(opts.indicatorFolded); - } else { - var pos = Pos(cur, 0); - var range = func && func(cm, pos); - if (range && range.to.line - range.from.line >= minSize) - mark = marker(opts.indicatorOpen); - } - cm.setGutterMarker(line, opts.gutter, mark); - ++cur; - }); - } - - function updateInViewport(cm) { - var vp = cm.getViewport(), state = cm.state.foldGutter; - if (!state) return; - cm.operation(function() { - updateFoldInfo(cm, vp.from, vp.to); - }); - state.from = vp.from; state.to = vp.to; - } - - function onGutterClick(cm, line, gutter) { - var state = cm.state.foldGutter; - if (!state) return; - var opts = state.options; - if (gutter != opts.gutter) return; - var folded = isFolded(cm, line); - if (folded) folded.clear(); - else cm.foldCode(Pos(line, 0), opts.rangeFinder); - } - - function onChange(cm) { - var state = cm.state.foldGutter; - if (!state) return; - var opts = state.options; - state.from = state.to = 0; - clearTimeout(state.changeUpdate); - state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); - } - - function onViewportChange(cm) { - var state = cm.state.foldGutter; - if (!state) return; - var opts = state.options; - clearTimeout(state.changeUpdate); - state.changeUpdate = setTimeout(function() { - var vp = cm.getViewport(); - if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { - updateInViewport(cm); - } else { - cm.operation(function() { - if (vp.from < state.from) { - updateFoldInfo(cm, vp.from, state.from); - state.from = vp.from; - } - if (vp.to > state.to) { - updateFoldInfo(cm, state.to, vp.to); - state.to = vp.to; - } - }); - } - }, opts.updateViewportTimeSpan || 400); - } - - function onFold(cm, from) { - var state = cm.state.foldGutter; - if (!state) return; - var line = from.line; - if (line >= state.from && line < state.to) - updateFoldInfo(cm, line, line + 1); - } - }); - - -/***/ }, -/* 910 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var SplitBox = __webpack_require__(911); - - module.exports = SplitBox; - -/***/ }, -/* 911 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var React = __webpack_require__(2); - var ReactDOM = __webpack_require__(22); - var Draggable = React.createFactory(__webpack_require__(912)); - var dom = React.DOM, - PropTypes = React.PropTypes; - - - __webpack_require__(913); - - /** - * This component represents a Splitter. The splitter supports vertical - * as well as horizontal mode. - */ - var SplitBox = React.createClass({ - propTypes: { - // Custom class name. You can use more names separated by a space. - className: PropTypes.string, - // Initial size of controlled panel. - initialSize: PropTypes.any, - // Optional initial width of controlled panel. - initialWidth: PropTypes.number, - // Optional initial height of controlled panel. - initialHeight: PropTypes.number, - // Left/top panel - startPanel: PropTypes.any, - // Left/top panel collapse state. - startPanelCollapsed: PropTypes.bool, - // Min panel size. - minSize: PropTypes.any, - // Max panel size. - maxSize: PropTypes.any, - // Right/bottom panel - endPanel: PropTypes.any, - // Right/bottom panel collapse state. - endPanelCollapsed: PropTypes.bool, - // True if the right/bottom panel should be controlled. - endPanelControl: PropTypes.bool, - // Size of the splitter handle bar. - splitterSize: PropTypes.number, - // True if the splitter bar is vertical (default is vertical). - vert: PropTypes.bool, - // Optional style properties passed into the splitbox - style: PropTypes.object, - // Optional callback when splitbox resize stops - onResizeEnd: PropTypes.func - }, - - displayName: "SplitBox", - - getDefaultProps() { - return { - splitterSize: 5, - vert: true, - endPanelControl: false, - endPanelCollapsed: false, - startPanelCollapsed: false - }; - }, - - /** - * The state stores the current orientation (vertical or horizontal) - * and the current size (width/height). All these values can change - * during the component's life time. - */ - getInitialState() { - return { - vert: this.props.vert, - // We use integers for these properties - width: parseInt(this.props.initialWidth || this.props.initialSize), - height: parseInt(this.props.initialHeight || this.props.initialSize) - }; - }, - - componentWillReceiveProps(nextProps) { - if (this.props.vert !== nextProps.vert) { - this.setState({ vert: nextProps.vert }); - } - }, - - // Dragging Events - - /** - * Set 'resizing' cursor on entire document during splitter dragging. - * This avoids cursor-flickering that happens when the mouse leaves - * the splitter bar area (happens frequently). - */ - onStartMove() { - var splitBox = ReactDOM.findDOMNode(this); - var doc = splitBox.ownerDocument; - var defaultCursor = doc.documentElement.style.cursor; - doc.documentElement.style.cursor = this.state.vert ? "ew-resize" : "ns-resize"; - - splitBox.classList.add("dragging"); - - this.setState({ - defaultCursor: defaultCursor - }); - }, - - onStopMove() { - var splitBox = ReactDOM.findDOMNode(this); - var doc = splitBox.ownerDocument; - doc.documentElement.style.cursor = this.state.defaultCursor; - - splitBox.classList.remove("dragging"); - - if (this.props.onResizeEnd) { - this.props.onResizeEnd(this.state.vert ? this.state.width : this.state.height); - } - }, - - /** - * Adjust size of the controlled panel. Depending on the current - * orientation we either remember the width or height of - * the splitter box. - */ - onMove(_ref) { - var movementX = _ref.movementX, - movementY = _ref.movementY; - - var node = ReactDOM.findDOMNode(this); - var doc = node.ownerDocument; - - if (this.props.endPanelControl) { - // For the end panel we need to increase the width/height when the - // movement is towards the left/top. - movementX = -movementX; - movementY = -movementY; - } - - if (this.state.vert) { - var isRtl = doc.dir === "rtl"; - if (isRtl) { - // In RTL we need to reverse the movement again -- but only for vertical - // splitters - movementX = -movementX; - } - - this.setState((state, props) => ({ - width: state.width + movementX - })); - } else { - this.setState((state, props) => ({ - height: state.height + movementY - })); - } - }, - - // Rendering - preparePanelStyles() { - var vert = this.state.vert; - var _props = this.props, - minSize = _props.minSize, - maxSize = _props.maxSize, - startPanelCollapsed = _props.startPanelCollapsed, - endPanelControl = _props.endPanelControl, - endPanelCollapsed = _props.endPanelCollapsed; - - var leftPanelStyle = void 0, - rightPanelStyle = void 0; - - // Set proper size for panels depending on the current state. - if (vert) { - var startWidth = endPanelControl ? null : this.state.width, - endWidth = endPanelControl ? this.state.width : null; - - leftPanelStyle = { - maxWidth: endPanelControl ? null : maxSize, - minWidth: endPanelControl ? null : minSize, - width: startPanelCollapsed ? 0 : startWidth - }; - rightPanelStyle = { - maxWidth: endPanelControl ? maxSize : null, - minWidth: endPanelControl ? minSize : null, - width: endPanelCollapsed ? 0 : endWidth - }; - } else { - var startHeight = endPanelControl ? null : this.state.height, - endHeight = endPanelControl ? this.state.height : null; - - leftPanelStyle = { - maxHeight: endPanelControl ? null : maxSize, - minHeight: endPanelControl ? null : minSize, - height: endPanelCollapsed ? maxSize : startHeight - }; - rightPanelStyle = { - maxHeight: endPanelControl ? maxSize : null, - minHeight: endPanelControl ? minSize : null, - height: startPanelCollapsed ? maxSize : endHeight - }; - } - - return { leftPanelStyle, rightPanelStyle }; - }, - - render() { - var vert = this.state.vert; - var _props2 = this.props, - startPanelCollapsed = _props2.startPanelCollapsed, - startPanel = _props2.startPanel, - endPanel = _props2.endPanel, - endPanelControl = _props2.endPanelControl, - splitterSize = _props2.splitterSize, - endPanelCollapsed = _props2.endPanelCollapsed; - - - var style = Object.assign({}, this.props.style); - - // Calculate class names list. - var classNames = ["split-box"]; - classNames.push(vert ? "vert" : "horz"); - if (this.props.className) { - classNames = classNames.concat(this.props.className.split(" ")); - } - - var _preparePanelStyles = this.preparePanelStyles(), - leftPanelStyle = _preparePanelStyles.leftPanelStyle, - rightPanelStyle = _preparePanelStyles.rightPanelStyle; - - // Calculate splitter size - - - var splitterStyle = { - flex: `0 0 ${splitterSize}px` - }; - - return dom.div({ - className: classNames.join(" "), - style: style - }, !startPanelCollapsed ? dom.div({ - className: endPanelControl ? "uncontrolled" : "controlled", - style: leftPanelStyle - }, startPanel) : null, Draggable({ - className: "splitter", - style: splitterStyle, - onStart: this.onStartMove, - onStop: this.onStopMove, - onMove: this.onMove - }), !endPanelCollapsed ? dom.div({ - className: endPanelControl ? "controlled" : "uncontrolled", - style: rightPanelStyle - }, endPanel) : null); - } - }); - - module.exports = SplitBox; - -/***/ }, -/* 912 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - var React = __webpack_require__(2); - var ReactDOM = __webpack_require__(22); - var dom = React.DOM, - PropTypes = React.PropTypes; - - - var Draggable = React.createClass({ - displayName: "Draggable", - - propTypes: { - onMove: PropTypes.func.isRequired, - onStart: PropTypes.func, - onStop: PropTypes.func, - style: PropTypes.object, - className: PropTypes.string - }, - - startDragging(ev) { - ev.preventDefault(); - var doc = ReactDOM.findDOMNode(this).ownerDocument; - doc.addEventListener("mousemove", this.onMove); - doc.addEventListener("mouseup", this.onUp); - this.props.onStart && this.props.onStart(); - }, - - onMove(ev) { - ev.preventDefault(); - // We pass the whole event because we don't know which properties - // the callee needs. - this.props.onMove(ev); - }, - - onUp(ev) { - ev.preventDefault(); - var doc = ReactDOM.findDOMNode(this).ownerDocument; - doc.removeEventListener("mousemove", this.onMove); - doc.removeEventListener("mouseup", this.onUp); - this.props.onStop && this.props.onStop(); - }, - - render() { - return dom.div({ - style: this.props.style, - className: this.props.className, - onMouseDown: this.startDragging - }); - } - }); - - module.exports = Draggable; - -/***/ }, -/* 913 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, -/* 914 */, -/* 915 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - var _reactRedux = __webpack_require__(151); - - var _redux = __webpack_require__(3); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _selectors = __webpack_require__(242); - - var _utils = __webpack_require__(234); - - var _url = __webpack_require__(334); - - var _source = __webpack_require__(233); - - __webpack_require__(917); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var Autocomplete = (0, _react.createFactory)(__webpack_require__(342).default); - - function searchResults(sources) { - function getSourcePath(source) { - var _parseURL = (0, _url.parse)(source.get("url")), - path = _parseURL.path, - href = _parseURL.href; - // for URLs like "about:home" the path is null so we pass the full href - - - return path || href; - } - - return sources.valueSeq().filter(source => !(0, _source.isPretty)(source.toJS()) && source.get("url")).map(source => ({ - value: getSourcePath(source), - title: getSourcePath(source).split("/").pop(), - subtitle: (0, _utils.endTruncateStr)(getSourcePath(source), 100), - id: source.get("id") - })).toJS(); - } - - class ProjectSearch extends _react.Component { - - constructor(props) { - super(props); - - this.state = { - inputValue: "" - }; - - this.toggle = this.toggle.bind(this); - this.onEscape = this.onEscape.bind(this); - this.close = this.close.bind(this); - } - - componentWillUnmount() { - var shortcuts = this.context.shortcuts; - var searchKeys = [L10N.getStr("sources.search.key"), L10N.getStr("sources.searchAlt.key")]; - searchKeys.forEach(key => shortcuts.off(`CmdOrCtrl+${key}`, this.toggle)); - shortcuts.off("Escape", this.onEscape); - } - - componentDidMount() { - var shortcuts = this.context.shortcuts; - var searchKeys = [L10N.getStr("sources.search.key"), L10N.getStr("sources.searchAlt.key")]; - searchKeys.forEach(key => shortcuts.on(`CmdOrCtrl+${key}`, this.toggle)); - shortcuts.on("Escape", this.onEscape); - } - - toggle(key, e) { - e.preventDefault(); - this.props.toggleProjectSearch(); - } - - onEscape(shortcut, e) { - if (this.props.searchOn) { - e.preventDefault(); - this.close(); - } - } - - close() { - this.setState({ inputValue: "" }); - this.props.toggleProjectSearch(false); - } - - render() { - if (!this.props.searchOn) { - return null; - } - - return _react.DOM.div({ className: "search-container" }, Autocomplete({ - selectItem: result => { - this.props.selectSource(result.id); - this.close(); - }, - close: this.close, - items: searchResults(this.props.sources), - inputValue: this.state.inputValue, - placeholder: L10N.getStr("sourceSearch.search"), - size: "big" - })); - } - } - - ProjectSearch.propTypes = { - sources: _react.PropTypes.object.isRequired, - selectSource: _react.PropTypes.func.isRequired, - toggleProjectSearch: _react.PropTypes.func.isRequired, - searchOn: _react.PropTypes.bool - }; - - ProjectSearch.contextTypes = { - shortcuts: _react.PropTypes.object - }; - - ProjectSearch.displayName = "ProjectSearch"; - - exports.default = (0, _reactRedux.connect)(state => ({ - sources: (0, _selectors.getSources)(state), - searchOn: (0, _selectors.getProjectSearchState)(state) - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(ProjectSearch); - -/***/ }, -/* 916 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */ - ;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * http://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.3.2', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - true - ) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return punycode; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { // in Rhino or a web browser - root.punycode = punycode; - } - - }(this)); - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) - -/***/ }, -/* 917 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, -/* 918 */, -/* 919 */ -/***/ function(module, exports) { - - module.exports = "" - -/***/ }, -/* 920 */ -/***/ function(module, exports) { - - module.exports = "" - -/***/ }, -/* 921 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - var _redux = __webpack_require__(3); - - var _reactRedux = __webpack_require__(151); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _selectors = __webpack_require__(242); - - var _devtoolsConfig = __webpack_require__(828); - - var _parser = __webpack_require__(827); - - __webpack_require__(922); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - - class Outline extends _react.Component { - - constructor(props) { - super(props); - this.state = {}; - } - - componentWillUpdate(_ref) { - var sourceText = _ref.sourceText; - - if (sourceText) { - this.setSymbolDeclarations(sourceText); - } - } - - setSymbolDeclarations(sourceText) { - var _this = this; - - return _asyncToGenerator(function* () { - var symbolDeclarations = yield (0, _parser.getSymbols)(sourceText.toJS()); - - _this.setState({ - symbolDeclarations - }); - })(); - } - - renderFunction(func) { - return _react.DOM.li({}, func.value); - } - - renderFunctions() { - var symbolDeclarations = this.state.symbolDeclarations; - - if (!symbolDeclarations) { - return; - } - - var functions = symbolDeclarations.functions; - - - return functions.filter(func => func.value != "anonymous").map(this.renderFunction); - } - - render() { - if (!(0, _devtoolsConfig.isEnabled)("outline")) { - return null; - } - - return _react.DOM.div({ className: "outline" }, _react.DOM.ul({}, this.renderFunctions())); - } - } - - Outline.propTypes = { - selectedSource: _react.PropTypes.object - }; - - Outline.displayName = "Outline"; - - exports.default = (0, _reactRedux.connect)(state => { - var selectedSource = (0, _selectors.getSelectedSource)(state); - var sourceId = selectedSource ? selectedSource.get("id") : null; - - return { - sourceText: (0, _selectors.getSourceText)(state, sourceId) - }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Outline); - -/***/ }, -/* 922 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, -/* 923 */, -/* 924 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var _require = __webpack_require__(925), - MODE = _require.MODE; - - var _require2 = __webpack_require__(926), - REPS = _require2.REPS; - - var _require3 = __webpack_require__(927), - createFactories = _require3.createFactories, - parseURLEncodedText = _require3.parseURLEncodedText, - parseURLParams = _require3.parseURLParams, - getSelectableInInspectorGrips = _require3.getSelectableInInspectorGrips, - maybeEscapePropertyName = _require3.maybeEscapePropertyName; - - module.exports = { - REPS, - MODE, - createFactories, - maybeEscapePropertyName, - parseURLEncodedText, - parseURLParams, - getSelectableInInspectorGrips - }; - -/***/ }, -/* 925 */ -/***/ function(module, exports) { - - "use strict"; - - module.exports = { - MODE: { - TINY: Symbol("TINY"), - SHORT: Symbol("SHORT"), - LONG: Symbol("LONG") - } - }; - -/***/ }, -/* 926 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - isGrip = _require.isGrip; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - // Load all existing rep templates - - - var Undefined = __webpack_require__(929); - var Null = __webpack_require__(930); - var StringRep = __webpack_require__(931); - var LongStringRep = __webpack_require__(932); - var Number = __webpack_require__(933); - var ArrayRep = __webpack_require__(934); - var Obj = __webpack_require__(936); - var SymbolRep = __webpack_require__(939); - var InfinityRep = __webpack_require__(940); - var NaNRep = __webpack_require__(941); - - // DOM types (grips) - var Attribute = __webpack_require__(942); - var DateTime = __webpack_require__(943); - var Document = __webpack_require__(944); - var Event = __webpack_require__(945); - var Func = __webpack_require__(946); - var PromiseRep = __webpack_require__(947); - var RegExp = __webpack_require__(948); - var StyleSheet = __webpack_require__(949); - var CommentNode = __webpack_require__(950); - var ElementNode = __webpack_require__(951); - var TextNode = __webpack_require__(953); - var ErrorRep = __webpack_require__(954); - var Window = __webpack_require__(955); - var ObjectWithText = __webpack_require__(956); - var ObjectWithURL = __webpack_require__(957); - var GripArray = __webpack_require__(958); - var GripMap = __webpack_require__(959); - var Grip = __webpack_require__(938); - - // List of all registered template. - // XXX there should be a way for extensions to register a new - // or modify an existing rep. - var reps = [RegExp, StyleSheet, Event, DateTime, CommentNode, ElementNode, TextNode, Attribute, LongStringRep, Func, PromiseRep, ArrayRep, Document, Window, ObjectWithText, ObjectWithURL, ErrorRep, GripArray, GripMap, Grip, Undefined, Null, StringRep, Number, SymbolRep, InfinityRep, NaNRep]; - - /** - * Generic rep that is using for rendering native JS types or an object. - * The right template used for rendering is picked automatically according - * to the current value type. The value must be passed is as 'object' - * property. - */ - var Rep = React.createClass({ - displayName: "Rep", - - propTypes: { - object: React.PropTypes.any, - defaultRep: React.PropTypes.object, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])) - }, - - render: function () { - var rep = getRep(this.props.object, this.props.defaultRep); - return rep(this.props); - } - }); - - // Helpers - - /** - * Return a rep object that is responsible for rendering given - * object. - * - * @param object {Object} Object to be rendered in the UI. This - * can be generic JS object as well as a grip (handle to a remote - * debuggee object). - * - * @param defaultObject {React.Component} The default template - * that should be used to render given object if none is found. - */ - function getRep(object) { - var defaultRep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Obj; - - var type = typeof object; - if (type == "object" && object instanceof String) { - type = "string"; - } else if (object && type == "object" && object.type) { - type = object.type; - } - - if (isGrip(object)) { - type = object.class; - } - - for (var i = 0; i < reps.length; i++) { - var rep = reps[i]; - try { - // supportsObject could return weight (not only true/false - // but a number), which would allow to priorities templates and - // support better extensibility. - if (rep.supportsObject(object, type)) { - return React.createFactory(rep.rep); - } - } catch (err) { - console.error(err); - } - } - - return React.createFactory(defaultRep.rep); - } - - module.exports = { - Rep, - REPS: { - ArrayRep, - Attribute, - CommentNode, - DateTime, - Document, - ElementNode, - ErrorRep, - Event, - Func, - Grip, - GripArray, - GripMap, - InfinityRep, - LongStringRep, - NaNRep, - Null, - Number, - Obj, - ObjectWithText, - ObjectWithURL, - PromiseRep, - RegExp, - Rep, - StringRep, - StyleSheet, - SymbolRep, - TextNode, - Undefined, - Window - } - }; - -/***/ }, -/* 927 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // Dependencies - var React = __webpack_require__(2); - - // Utils - var nodeConstants = __webpack_require__(928); - - /** - * Create React factories for given arguments. - * Example: - * const { Rep } = createFactories(require("./rep")); - */ - function createFactories(args) { - var result = {}; - for (var p in args) { - result[p] = React.createFactory(args[p]); - } - return result; - } - - /** - * Returns true if the given object is a grip (see RDP protocol) - */ - function isGrip(object) { - return object && object.actor; - } - - function escapeNewLines(value) { - return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n"); - } - - // Map from character code to the corresponding escape sequence. \0 - // isn't here because it would require special treatment in some - // situations. \b, \f, and \v aren't here because they aren't very - // common. \' isn't here because there's no need, we only - // double-quote strings. - var escapeMap = { - // Tab. - 9: "\\t", - // Newline. - 0xa: "\\n", - // Carriage return. - 0xd: "\\r", - // Quote. - 0x22: "\\\"", - // Backslash. - 0x5c: "\\\\" - }; - - // Regexp that matches any character we might possibly want to escape. - // Note that we over-match here, because it's difficult to, say, match - // an unpaired surrogate with a regexp. The details are worked out by - // the replacement function; see |escapeString|. - var escapeRegexp = new RegExp("[" + - // Quote and backslash. - "\"\\\\" + - // Controls. - "\x00-\x1f" + - // More controls. - "\x7f-\x9f" + - // BOM - "\ufeff" + - // Replacement characters and non-characters. - "\ufffc-\uffff" + - // Surrogates. - "\ud800-\udfff" + - // Mathematical invisibles. - "\u2061-\u2064" + - // Line and paragraph separators. - "\u2028-\u2029" + - // Private use area. - "\ue000-\uf8ff" + "]", "g"); - - /** - * Escape a string so that the result is viewable and valid JS. - * Control characters, other invisibles, invalid characters, - * backslash, and double quotes are escaped. The resulting string is - * surrounded by double quotes. - * - * @param {String} str - * the input - * @return {String} the escaped string - */ - function escapeString(str) { - return "\"" + str.replace(escapeRegexp, (match, offset) => { - var c = match.charCodeAt(0); - if (c in escapeMap) { - return escapeMap[c]; - } - if (c >= 0xd800 && c <= 0xdfff) { - // Find the full code point containing the surrogate, with a - // special case for a trailing surrogate at the start of the - // string. - if (c >= 0xdc00 && offset > 0) { - --offset; - } - var codePoint = str.codePointAt(offset); - if (codePoint >= 0xd800 && codePoint <= 0xdfff) { - // Unpaired surrogate. - return "\\u" + codePoint.toString(16); - } else if (codePoint >= 0xf0000 && codePoint <= 0x10fffd) { - // Private use area. Because we visit each pair of a such a - // character, return the empty string for one half and the - // real result for the other, to avoid duplication. - if (c <= 0xdbff) { - return "\\u{" + codePoint.toString(16) + "}"; - } - return ""; - } - // Other surrogate characters are passed through. - return match; - } - return "\\u" + ("0000" + c.toString(16)).substr(-4); - }) + "\""; - } - - /** - * Escape a property name, if needed. "Escaping" in this context - * means surrounding the property name with quotes. - * - * @param {String} - * name the property name - * @return {String} either the input, or the input surrounded by - * quotes, properly quoted in JS syntax. - */ - function maybeEscapePropertyName(name) { - // Quote the property name if it needs quoting. This particular - // test is an approximation; see - // https://mathiasbynens.be/notes/javascript-properties. However, - // the full solution requires a fair amount of Unicode data, and so - // let's defer that until either it's important, or the \p regexp - // syntax lands, see - // https://github.com/tc39/proposal-regexp-unicode-property-escapes. - if (!/^\w+$/.test(name)) { - name = escapeString(name); - } - return name; - } - - function cropMultipleLines(text, limit) { - return escapeNewLines(cropString(text, limit)); - } - - function rawCropString(text, limit, alternativeText) { - if (!alternativeText) { - alternativeText = "\u2026"; - } - - // Crop the string only if a limit is actually specified. - if (!limit || limit <= 0) { - return text; - } - - // Set the limit at least to the length of the alternative text - // plus one character of the original text. - if (limit <= alternativeText.length) { - limit = alternativeText.length + 1; - } - - var halfLimit = (limit - alternativeText.length) / 2; - - if (text.length > limit) { - return text.substr(0, Math.ceil(halfLimit)) + alternativeText + text.substr(text.length - Math.floor(halfLimit)); - } - - return text; - } - - function cropString(text, limit, alternativeText) { - return rawCropString(sanitizeString(text + ""), limit, alternativeText); - } - - function sanitizeString(text) { - // Replace all non-printable characters, except of - // (horizontal) tab (HT: \x09) and newline (LF: \x0A, CR: \x0D), - // with unicode replacement character (u+fffd). - // eslint-disable-next-line no-control-regex - var re = new RegExp("[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]", "g"); - return text.replace(re, "\ufffd"); - } - - function parseURLParams(url) { - url = new URL(url); - return parseURLEncodedText(url.searchParams); - } - - function parseURLEncodedText(text) { - var params = []; - - // In case the text is empty just return the empty parameters - if (text == "") { - return params; - } - - var searchParams = new URLSearchParams(text); - var entries = [].concat(_toConsumableArray(searchParams.entries())); - return entries.map(entry => { - return { - name: entry[0], - value: entry[1] - }; - }); - } - - function getFileName(url) { - var split = splitURLBase(url); - return split.name; - } - - function splitURLBase(url) { - if (!isDataURL(url)) { - return splitURLTrue(url); - } - return {}; - } - - function getURLDisplayString(url) { - return cropString(url); - } - - function isDataURL(url) { - return url && url.substr(0, 5) == "data:"; - } - - function splitURLTrue(url) { - var reSplitFile = /(.*?):\/{2,3}([^\/]*)(.*?)([^\/]*?)($|\?.*)/; - var m = reSplitFile.exec(url); - - if (!m) { - return { - name: url, - path: url - }; - } else if (m[4] == "" && m[5] == "") { - return { - protocol: m[1], - domain: m[2], - path: m[3], - name: m[3] != "/" ? m[3] : m[2] - }; - } - - return { - protocol: m[1], - domain: m[2], - path: m[2] + m[3], - name: m[4] + m[5] - }; - } - - /** - * Wrap the provided render() method of a rep in a try/catch block that will render a - * fallback rep if the render fails. - */ - function wrapRender(renderMethod) { - return function () { - try { - return renderMethod.call(this); - } catch (e) { - return React.DOM.span({ - className: "objectBox objectBox-failure", - title: "This object could not be rendered, " + "please file a bug on bugzilla.mozilla.org" - }, - /* Labels have to be hardcoded for reps, see Bug 1317038. */ - "Invalid object"); - } - }; - } - - /** - * Get an array of all the items from the grip in parameter (including the grip itself) - * which can be selected in the inspector. - * - * @param {Object} Grip - * @return {Array} Flat array of the grips which can be selected in the inspector - */ - function getSelectableInInspectorGrips(grip) { - var grips = new Set(getFlattenedGrips([grip])); - return [].concat(_toConsumableArray(grips)).filter(isGripSelectableInInspector); - } - - /** - * Indicate if a Grip can be selected in the inspector, - * i.e. if it represents a node element. - * - * @param {Object} Grip - * @return {Boolean} - */ - function isGripSelectableInInspector(grip) { - return grip && typeof grip === "object" && grip.preview && [nodeConstants.TEXT_NODE, nodeConstants.ELEMENT_NODE].includes(grip.preview.nodeType); - } - - /** - * Get a flat array of all the grips and their preview items. - * - * @param {Array} Grips - * @return {Array} Flat array of the grips and their preview items - */ - function getFlattenedGrips(grips) { - return grips.reduce((res, grip) => { - var previewItems = getGripPreviewItems(grip); - var flatPreviewItems = previewItems.length > 0 ? getFlattenedGrips(previewItems) : []; - - return [].concat(_toConsumableArray(res), [grip], _toConsumableArray(flatPreviewItems)); - }, []); - } - - /** - * Get preview items from a Grip. - * - * @param {Object} Grip from which we want the preview items - * @return {Array} Array of the preview items of the grip, or an empty array - * if the grip does not have preview items - */ - function getGripPreviewItems(grip) { - if (!grip) { - return []; - } - - // Promise resolved value Grip - if (grip.promiseState && grip.promiseState.value) { - return [grip.promiseState.value]; - } - - // Array Grip - if (grip.preview && grip.preview.items) { - return grip.preview.items; - } - - // Node Grip - if (grip.preview && grip.preview.childNodes) { - return grip.preview.childNodes; - } - - // Set or Map Grip - if (grip.preview && grip.preview.entries) { - return grip.preview.entries.reduce((res, entry) => res.concat(entry), []); - } - - // Event Grip - if (grip.preview && grip.preview.target) { - return [grip.preview.target]; - } - - // Generic Grip - if (grip.preview && grip.preview.ownProperties) { - var propertiesValues = Object.values(grip.preview.ownProperties).map(property => property.value || property); - - // ArrayBuffer Grip - if (grip.preview.safeGetterValues) { - propertiesValues = propertiesValues.concat(Object.values(grip.preview.safeGetterValues).map(property => property.getterValue || property)); - } - - return propertiesValues; - } - - return []; - } - - module.exports = { - createFactories, - isGrip, - cropString, - rawCropString, - sanitizeString, - escapeString, - wrapRender, - cropMultipleLines, - parseURLParams, - parseURLEncodedText, - getFileName, - getURLDisplayString, - getSelectableInInspectorGrips, - maybeEscapePropertyName - }; - -/***/ }, -/* 928 */ -/***/ function(module, exports) { - - "use strict"; - - module.exports = { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12, - - // DocumentPosition - DOCUMENT_POSITION_DISCONNECTED: 0x01, - DOCUMENT_POSITION_PRECEDING: 0x02, - DOCUMENT_POSITION_FOLLOWING: 0x04, - DOCUMENT_POSITION_CONTAINS: 0x08, - DOCUMENT_POSITION_CONTAINED_BY: 0x10, - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 - }; - -/***/ }, -/* 929 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders undefined value - */ - - var Undefined = React.createClass({ - displayName: "UndefinedRep", - - render: wrapRender(function () { - return span({ className: "objectBox objectBox-undefined" }, "undefined"); - }) - }); - - function supportsObject(object, type) { - if (object && object.type && object.type == "undefined") { - return true; - } - - return type == "undefined"; - } - - // Exports from this module - - module.exports = { - rep: Undefined, - supportsObject: supportsObject - }; - -/***/ }, -/* 930 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders null value - */ - - var Null = React.createClass({ - displayName: "NullRep", - - render: wrapRender(function () { - return span({ className: "objectBox objectBox-null" }, "null"); - }) - }); - - function supportsObject(object, type) { - if (object && object.type && object.type == "null") { - return true; - } - - return object == null; - } - - // Exports from this module - - module.exports = { - rep: Null, - supportsObject: supportsObject - }; - -/***/ }, -/* 931 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - escapeString = _require.escapeString, - rawCropString = _require.rawCropString, - sanitizeString = _require.sanitizeString, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a string. String value is enclosed within quotes. - */ - - var StringRep = React.createClass({ - displayName: "StringRep", - - propTypes: { - useQuotes: React.PropTypes.bool, - style: React.PropTypes.object, - object: React.PropTypes.string.isRequired, - member: React.PropTypes.any, - cropLimit: React.PropTypes.number - }, - - getDefaultProps: function () { - return { - useQuotes: true - }; - }, - - render: wrapRender(function () { - var text = this.props.object; - var member = this.props.member; - var style = this.props.style; - - var config = { className: "objectBox objectBox-string" }; - if (style) { - config.style = style; - } - - if (this.props.useQuotes) { - text = escapeString(text); - } else { - text = sanitizeString(text); - } - - if ((!member || !member.open) && this.props.cropLimit) { - text = rawCropString(text, this.props.cropLimit); - } - - return span(config, text); - }) - }); - - function supportsObject(object, type) { - return type == "string"; + exports.__esModule = true; + exports.defaultMemoize = defaultMemoize; + exports.createSelectorCreator = createSelectorCreator; + exports.createStructuredSelector = createStructuredSelector; + function defaultEqualityCheck(a, b) { + return a === b; } - // Exports from this module - - module.exports = { - rep: StringRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 932 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - escapeString = _require.escapeString, - sanitizeString = _require.sanitizeString, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a long string grip. - */ - - var LongStringRep = React.createClass({ - displayName: "LongStringRep", - - propTypes: { - useQuotes: React.PropTypes.bool, - style: React.PropTypes.object, - cropLimit: React.PropTypes.number.isRequired, - member: React.PropTypes.string, - object: React.PropTypes.object.isRequired - }, - - getDefaultProps: function () { - return { - useQuotes: true - }; - }, - - render: wrapRender(function () { - var _props = this.props, - cropLimit = _props.cropLimit, - member = _props.member, - object = _props.object, - style = _props.style, - useQuotes = _props.useQuotes; - var fullText = object.fullText, - initial = object.initial, - length = object.length; - - - var config = { className: "objectBox objectBox-string" }; - if (style) { - config.style = style; - } - - var string = member && member.open ? fullText || initial : initial.substring(0, cropLimit); - - if (string.length < length) { - string += "\u2026"; - } - var formattedString = useQuotes ? escapeString(string) : sanitizeString(string); - return span(config, formattedString); - }) - }); - - function supportsObject(object, type) { - if (!isGrip(object)) { + function areArgumentsShallowlyEqual(equalityCheck, prev, next) { + if (prev === null || next === null || prev.length !== next.length) { return false; } - return object.type === "longString"; - } - // Exports from this module - module.exports = { - rep: LongStringRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 933 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a number - */ - - var Number = React.createClass({ - displayName: "Number", - - propTypes: { - object: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.number, React.PropTypes.bool]).isRequired - }, - - stringify: function (object) { - var isNegativeZero = Object.is(object, -0) || object.type && object.type == "-0"; - - return isNegativeZero ? "-0" : String(object); - }, - - render: wrapRender(function () { - var value = this.props.object; - - return span({ className: "objectBox objectBox-number" }, this.stringify(value)); - }) - }); - - function supportsObject(object, type) { - return ["boolean", "number", "-0"].includes(type); - } - - // Exports from this module - - module.exports = { - rep: Number, - supportsObject: supportsObject - }; - -/***/ }, -/* 934 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - wrapRender = _require.wrapRender; - - var Caption = React.createFactory(__webpack_require__(935)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - var ModePropType = React.PropTypes.oneOf( - // @TODO Change this to Object.values once it's supported in Node's version of V8 - Object.keys(MODE).map(key => MODE[key])); - - // Shortcuts - var DOM = React.DOM; - - /** - * Renders an array. The array is enclosed by left and right bracket - * and the max number of rendered items depends on the current mode. - */ - var ArrayRep = React.createClass({ - displayName: "ArrayRep", - - propTypes: { - mode: ModePropType, - objectLink: React.PropTypes.func, - object: React.PropTypes.array.isRequired - }, - - getTitle: function (object, context) { - return "[" + object.length + "]"; - }, - - arrayIterator: function (array, max) { - var items = []; - var delim = void 0; - - for (var i = 0; i < array.length && i < max; i++) { - try { - var value = array[i]; - - delim = i == array.length - 1 ? "" : ", "; - - items.push(ItemRep({ - object: value, - // Hardcode tiny mode to avoid recursive handling. - mode: MODE.TINY, - delim: delim - })); - } catch (exc) { - items.push(ItemRep({ - object: exc, - mode: MODE.TINY, - delim: delim - })); - } + // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible. + var length = prev.length; + for (var i = 0; i < length; i++) { + if (!equalityCheck(prev[i], next[i])) { + return false; } + } - if (array.length > max) { - items.push(Caption({ - object: this.safeObjectLink({ - object: this.props.object - }, array.length - max + " more…") - })); - } - - return items; - }, - - /** - * Returns true if the passed object is an array with additional (custom) - * properties, otherwise returns false. Custom properties should be - * displayed in extra expandable section. - * - * Example array with a custom property. - * let arr = [0, 1]; - * arr.myProp = "Hello"; - * - * @param {Array} array The array object. - */ - hasSpecialProperties: function (array) { - function isInteger(x) { - var y = parseInt(x, 10); - if (isNaN(y)) { - return false; - } - return x === y.toString(); - } - - var propsArray = Object.getOwnPropertyNames(array); - for (var i = 0; i < propsArray.length; i++) { - var p = propsArray[i]; - - // Valid indexes are skipped - if (isInteger(p)) { - continue; - } - - // Ignore standard 'length' property, anything else is custom. - if (p != "length") { - return true; - } - } - - return false; - }, - - // Event Handlers - - onToggleProperties: function (event) {}, - - onClickBracket: function (event) {}, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props; - - return (_props = this.props).objectLink.apply(_props, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return DOM.span.apply(DOM, [config].concat(children)); - }, - - render: wrapRender(function () { - var _props2 = this.props, - object = _props2.object, - _props2$mode = _props2.mode, - mode = _props2$mode === undefined ? MODE.SHORT : _props2$mode; - - - var items = void 0; - var brackets = void 0; - var needSpace = function (space) { - return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; - }; - - if (mode === MODE.TINY) { - var isEmpty = object.length === 0; - items = [DOM.span({ className: "length" }, isEmpty ? "" : object.length)]; - brackets = needSpace(false); - } else { - var max = mode === MODE.SHORT ? 3 : 10; - items = this.arrayIterator(object, max); - brackets = needSpace(items.length > 0); - } - - return DOM.span.apply(DOM, [{ - className: "objectBox objectBox-array" }, this.safeObjectLink({ - className: "arrayLeftBracket", - object: object - }, brackets.left)].concat(_toConsumableArray(items), [this.safeObjectLink({ - className: "arrayRightBracket", - object: object - }, brackets.right), DOM.span({ - className: "arrayProperties", - role: "group" })])); - }) - }); - - /** - * Renders array item. Individual values are separated by a comma. - */ - var ItemRep = React.createFactory(React.createClass({ - displayName: "ItemRep", - - propTypes: { - object: React.PropTypes.any.isRequired, - delim: React.PropTypes.string.isRequired, - mode: ModePropType - }, - - render: wrapRender(function () { - var _createFactories = createFactories(__webpack_require__(926)), - Rep = _createFactories.Rep; - - var object = this.props.object; - var delim = this.props.delim; - var mode = this.props.mode; - return DOM.span({}, Rep({ object: object, mode: mode }), delim); - }) - })); - - function supportsObject(object, type) { - return Array.isArray(object) || Object.prototype.toString.call(object) === "[object Arguments]"; - } - - // Exports from this module - module.exports = { - rep: ArrayRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 935 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - var DOM = React.DOM; - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - /** - * Renders a caption. This template is used by other components - * that needs to distinguish between a simple text/value and a label. - */ - - - var Caption = React.createClass({ - displayName: "Caption", - - propTypes: { - object: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]).isRequired - }, - - render: wrapRender(function () { - return DOM.span({ "className": "caption" }, this.props.object); - }) - }); - - // Exports from this module - module.exports = Caption; - -/***/ }, -/* 936 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - var Caption = React.createFactory(__webpack_require__(935)); - var PropRep = React.createFactory(__webpack_require__(937)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - /** - * Renders an object. An object is represented by a list of its - * properties enclosed in curly brackets. - */ - - var Obj = React.createClass({ - displayName: "Obj", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func, - title: React.PropTypes.string - }, - - getTitle: function (object) { - var title = this.props.title || object.class || "Object"; - return this.safeObjectLink({ className: "objectTitle" }, title); - }, - - safePropIterator: function (object, max) { - max = typeof max === "undefined" ? 3 : max; - try { - return this.propIterator(object, max); - } catch (err) { - console.error(err); - } - return []; - }, - - propIterator: function (object, max) { - var isInterestingProp = (t, value) => { - // Do not pick objects, it could cause recursion. - return t == "boolean" || t == "number" || t == "string" && value; - }; - - // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=945377 - if (Object.prototype.toString.call(object) === "[object Generator]") { - object = Object.getPrototypeOf(object); - } - - // Object members with non-empty values are preferred since it gives the - // user a better overview of the object. - var propsArray = this.getPropsArray(object, max, isInterestingProp); - - if (propsArray.length <= max) { - // There are not enough props yet (or at least, not enough props to - // be able to know whether we should print "more…" or not). - // Let's display also empty members and functions. - propsArray = propsArray.concat(this.getPropsArray(object, max, (t, value) => { - return !isInterestingProp(t, value); - })); - } - - if (propsArray.length > max) { - propsArray.pop(); - var objectLink = this.props.objectLink || span; - - propsArray.push(Caption({ - object: objectLink({ - object: object - }, Object.keys(object).length - max + " more…") - })); - } else if (propsArray.length > 0) { - // Remove the last comma. - propsArray[propsArray.length - 1] = React.cloneElement(propsArray[propsArray.length - 1], { delim: "" }); - } - - return propsArray; - }, - - getPropsArray: function (object, max, filter) { - var propsArray = []; - - max = max || 3; - if (!object) { - return propsArray; - } - - // Hardcode tiny mode to avoid recursive handling. - var mode = MODE.TINY; - - try { - for (var name in object) { - if (propsArray.length > max) { - return propsArray; - } - - var value = void 0; - try { - value = object[name]; - } catch (exc) { - continue; - } - - var t = typeof value; - if (filter(t, value)) { - propsArray.push(PropRep({ - mode: mode, - name: name, - object: value, - equal: ": ", - delim: ", " - })); - } - } - } catch (err) { - console.error(err); - } - - return propsArray; - }, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props; - - return (_props = this.props).objectLink.apply(_props, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return span.apply(undefined, [config].concat(children)); - }, - - render: wrapRender(function () { - var object = this.props.object; - var propsArray = this.safePropIterator(object); - - if (this.props.mode === MODE.TINY || !propsArray.length) { - return span({ className: "objectBox objectBox-object" }, this.getTitle(object)); - } - - return span.apply(undefined, [{ className: "objectBox objectBox-object" }, this.getTitle(object), this.safeObjectLink({ - className: "objectLeftBrace" - }, " { ")].concat(_toConsumableArray(propsArray), [this.safeObjectLink({ - className: "objectRightBrace" - }, " }")])); - }) - }); - function supportsObject(object, type) { return true; } - // Exports from this module - module.exports = { - rep: Obj, - supportsObject: supportsObject - }; + function defaultMemoize(func) { + var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck; -/***/ }, -/* 937 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - maybeEscapePropertyName = _require.maybeEscapePropertyName, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - - /** - * Property for Obj (local JS objects), Grip (remote JS objects) - * and GripMap (remote JS maps and weakmaps) reps. - * It's used to render object properties. - */ - - var PropRep = React.createClass({ - displayName: "PropRep", - - propTypes: { - // Property name. - name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.object]).isRequired, - // Equal character rendered between property name and value. - equal: React.PropTypes.string, - // Delimiter character used to separate individual properties. - delim: React.PropTypes.string, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func, - // Normally a PropRep will quote a property name that isn't valid - // when unquoted; but this flag can be used to suppress the - // quoting. - suppressQuotes: React.PropTypes.bool - }, - - render: wrapRender(function () { - var Grip = __webpack_require__(938); - - var _createFactories = createFactories(__webpack_require__(926)), - Rep = _createFactories.Rep; - - var _props = this.props, - name = _props.name, - mode = _props.mode, - equal = _props.equal, - delim = _props.delim, - suppressQuotes = _props.suppressQuotes; - - - var key = void 0; - // The key can be a simple string, for plain objects, - // or another object for maps and weakmaps. - if (typeof name === "string") { - if (!suppressQuotes) { - name = maybeEscapePropertyName(name); - } - key = span({ "className": "nodeName" }, name); - } else { - key = Rep(Object.assign({}, this.props, { - object: name, - mode: mode || MODE.TINY, - defaultRep: Grip - })); + var lastArgs = null; + var lastResult = null; + // we reference arguments instead of spreading them for performance reasons + return function () { + if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) { + // apply arguments instead of spreading for performance. + lastResult = func.apply(null, arguments); } - return span({}, key, span({ - "className": "objectEqual" - }, equal), Rep(Object.assign({}, this.props)), span({ - "className": "objectComma" - }, delim)); - }) - }); + lastArgs = arguments; + return lastResult; + }; + } - // Exports from this module - module.exports = PropRep; + function getDependencies(funcs) { + var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs; -/***/ }, -/* 938 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // ReactJS - var React = __webpack_require__(2); - // Dependencies - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var Caption = React.createFactory(__webpack_require__(935)); - var PropRep = React.createFactory(__webpack_require__(937)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders generic grip. Grip is client representation - * of remote JS object and is used as an input object - * for this rep component. - */ - - var GripRep = React.createClass({ - displayName: "Grip", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - isInterestingProp: React.PropTypes.func, - title: React.PropTypes.string, - objectLink: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - getTitle: function (object) { - var title = this.props.title || object.class || "Object"; - return this.safeObjectLink({}, title); - }, - - safePropIterator: function (object, max) { - max = typeof max === "undefined" ? 3 : max; - try { - return this.propIterator(object, max); - } catch (err) { - console.error(err); - } - return []; - }, - - propIterator: function (object, max) { - if (object.preview && Object.keys(object.preview).includes("wrappedValue")) { - var _createFactories = createFactories(__webpack_require__(926)), - Rep = _createFactories.Rep; - - return [Rep({ - object: object.preview.wrappedValue, - mode: this.props.mode || MODE.TINY, - defaultRep: Grip - })]; - } - - // Property filter. Show only interesting properties to the user. - var isInterestingProp = this.props.isInterestingProp || ((type, value) => { - return type == "boolean" || type == "number" || type == "string" && value.length != 0; - }); - - var properties = object.preview ? object.preview.ownProperties : {}; - var propertiesLength = object.preview && object.preview.ownPropertiesLength ? object.preview.ownPropertiesLength : object.ownPropertyLength; - - if (object.preview && object.preview.safeGetterValues) { - properties = Object.assign({}, properties, object.preview.safeGetterValues); - propertiesLength += Object.keys(object.preview.safeGetterValues).length; - } - - var indexes = this.getPropIndexes(properties, max, isInterestingProp); - if (indexes.length < max && indexes.length < propertiesLength) { - // There are not enough props yet. Then add uninteresting props to display them. - indexes = indexes.concat(this.getPropIndexes(properties, max - indexes.length, (t, value, name) => { - return !isInterestingProp(t, value, name); - })); - } - - var truncate = Object.keys(properties).length > max; - // The server synthesizes some property names for a Proxy, like - // and ; we don't want to quote these because, - // as synthetic properties, they appear more natural when - // unquoted. - var suppressQuotes = object.class === "Proxy"; - var propsArray = this.getProps(properties, indexes, truncate, suppressQuotes); - if (truncate) { - // There are some undisplayed props. Then display "more...". - propsArray.push(Caption({ - object: this.safeObjectLink({}, `${propertiesLength - max} more…`) - })); - } - - return propsArray; - }, - - /** - * Get props ordered by index. - * - * @param {Object} properties Props object. - * @param {Array} indexes Indexes of props. - * @param {Boolean} truncate true if the grip will be truncated. - * @param {Boolean} suppressQuotes true if we should suppress quotes - * on property names. - * @return {Array} Props. - */ - getProps: function (properties, indexes, truncate, suppressQuotes) { - var propsArray = []; - - // Make indexes ordered by ascending. - indexes.sort(function (a, b) { - return a - b; - }); - - indexes.forEach(i => { - var name = Object.keys(properties)[i]; - var value = this.getPropValue(properties[name]); - - var propRepProps = Object.assign({}, this.props, { - mode: MODE.TINY, - name: name, - object: value, - equal: ": ", - delim: i !== indexes.length - 1 || truncate ? ", " : "", - defaultRep: Grip, - // Do not propagate title to properties reps - title: undefined, - suppressQuotes - }); - delete propRepProps.objectLink; - propsArray.push(PropRep(propRepProps)); - }); - - return propsArray; - }, - - /** - * Get the indexes of props in the object. - * - * @param {Object} properties Props object. - * @param {Number} max The maximum length of indexes array. - * @param {Function} filter Filter the props you want. - * @return {Array} Indexes of interesting props in the object. - */ - getPropIndexes: function (properties, max, filter) { - var indexes = []; - - try { - var i = 0; - for (var name in properties) { - if (indexes.length >= max) { - return indexes; - } - - // Type is specified in grip's "class" field and for primitive - // values use typeof. - var value = this.getPropValue(properties[name]); - var type = value.class || typeof value; - type = type.toLowerCase(); - - if (filter(type, value, name)) { - indexes.push(i); - } - i++; - } - } catch (err) { - console.error(err); - } - return indexes; - }, - - /** - * Get the actual value of a property. - * - * @param {Object} property - * @return {Object} Value of the property. - */ - getPropValue: function (property) { - var value = property; - if (typeof property === "object") { - var keys = Object.keys(property); - if (keys.includes("value")) { - value = property.value; - } else if (keys.includes("getterValue")) { - value = property.getterValue; - } - } - return value; - }, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props; - - return (_props = this.props).objectLink.apply(_props, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return span.apply(undefined, [config].concat(children)); - }, - - render: wrapRender(function () { - var object = this.props.object; - var propsArray = this.safePropIterator(object, this.props.mode === MODE.LONG ? 10 : 3); - - if (this.props.mode === MODE.TINY) { - return span({ className: "objectBox objectBox-object" }, this.getTitle(object)); - } - - return span.apply(undefined, [{ className: "objectBox objectBox-object" }, this.getTitle(object), this.safeObjectLink({ - className: "objectLeftBrace" - }, " { ")].concat(_toConsumableArray(propsArray), [this.safeObjectLink({ - className: "objectRightBrace" - }, " }")])); - }) - }); - - // Registration - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; + if (!dependencies.every(function (dep) { + return typeof dep === 'function'; + })) { + var dependencyTypes = dependencies.map(function (dep) { + return typeof dep; + }).join(', '); + throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']')); } - return object.preview && object.preview.ownProperties; + + return dependencies; } - // Grip is used in propIterator and has to be defined here. - var Grip = { - rep: GripRep, - supportsObject: supportsObject - }; + function createSelectorCreator(memoize) { + for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + memoizeOptions[_key - 1] = arguments[_key]; + } - // Exports from this module - module.exports = Grip; + return function () { + for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + funcs[_key2] = arguments[_key2]; + } -/***/ }, -/* 939 */ -/***/ function(module, exports, __webpack_require__) { + var recomputations = 0; + var resultFunc = funcs.pop(); + var dependencies = getDependencies(funcs); - "use strict"; + var memoizedResultFunc = memoize.apply(undefined, [function () { + recomputations++; + // apply arguments instead of spreading for performance. + return resultFunc.apply(null, arguments); + }].concat(memoizeOptions)); - // Dependencies - var React = __webpack_require__(2); + // If a selector is called with the exact same arguments we don't need to traverse our dependencies again. + var selector = defaultMemoize(function () { + var params = []; + var length = dependencies.length; - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a symbol. - */ - - var SymbolRep = React.createClass({ - displayName: "SymbolRep", - - propTypes: { - object: React.PropTypes.object.isRequired - }, - - render: wrapRender(function () { - var object = this.props.object; - var name = object.name; - - - return span({ className: "objectBox objectBox-symbol" }, `Symbol(${name || ""})`); - }) - }); - - function supportsObject(object, type) { - return type == "symbol"; - } - - // Exports from this module - module.exports = { - rep: SymbolRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 940 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a Infinity object - */ - - var InfinityRep = React.createClass({ - displayName: "Infinity", - - propTypes: { - object: React.PropTypes.object.isRequired - }, - - render: wrapRender(function () { - return span({ className: "objectBox objectBox-number" }, this.props.object.type); - }) - }); - - function supportsObject(object, type) { - return type == "Infinity" || type == "-Infinity"; - } - - // Exports from this module - module.exports = { - rep: InfinityRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 941 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a NaN object - */ - - var NaNRep = React.createClass({ - displayName: "NaN", - - render: wrapRender(function () { - return span({ className: "objectBox objectBox-nan" }, "NaN"); - }) - }); - - function supportsObject(object, type) { - return type == "NaN"; - } - - // Exports from this module - module.exports = { - rep: NaNRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 942 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var StringRep = __webpack_require__(931); - - // Shortcuts - var span = React.DOM.span; - - var _createFactories = createFactories(StringRep), - StringRepFactory = _createFactories.rep; - - /** - * Renders DOM attribute - */ - - - var Attribute = React.createClass({ - displayName: "Attr", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - return grip.preview.nodeName; - }, - - render: wrapRender(function () { - var _this = this; - - var object = this.props.object; - var value = object.preview.value; - var objectLink = function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; + for (var i = 0; i < length; i++) { + // apply arguments instead of spreading and mutate a local list of params for performance. + params.push(dependencies[i].apply(null, arguments)); } - if (_this.props.objectLink) { - var _props; + // apply arguments instead of spreading for performance. + return memoizedResultFunc.apply(null, params); + }); - return (_props = _this.props).objectLink.apply(_props, [Object.assign({ object }, config)].concat(children)); - } - return span.apply(undefined, [config].concat(children)); + selector.resultFunc = resultFunc; + selector.recomputations = function () { + return recomputations; }; - - return objectLink({ className: "objectLink-Attr" }, span({ className: "attrTitle" }, this.getTitle(object)), span({ className: "attrEqual" }, "="), StringRepFactory({ object: value })); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return type == "Attr" && grip.preview; - } - - module.exports = { - rep: Attribute, - supportsObject: supportsObject - }; - -/***/ }, -/* 943 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Used to render JS built-in Date() object. - */ - - var DateTime = React.createClass({ - displayName: "Date", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - if (this.props.objectLink) { - return this.props.objectLink({ - object: grip - }, grip.class + " "); - } - return ""; - }, - - render: wrapRender(function () { - var grip = this.props.object; - var date = void 0; - try { - date = span({ className: "objectBox" }, this.getTitle(grip), span({ className: "Date" }, new Date(grip.preview.timestamp).toISOString())); - } catch (e) { - date = span({ className: "objectBox" }, "Invalid Date"); - } - - return date; - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return type == "Date" && grip.preview; - } - - // Exports from this module - module.exports = { - rep: DateTime, - supportsObject: supportsObject - }; - -/***/ }, -/* 944 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - getURLDisplayString = _require.getURLDisplayString, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders DOM document object. - */ - - var Document = React.createClass({ - displayName: "Document", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getLocation: function (grip) { - var location = grip.preview.location; - return location ? getURLDisplayString(location) : ""; - }, - - getTitle: function (grip) { - if (this.props.objectLink) { - return span({ className: "objectBox" }, this.props.objectLink({ - object: grip - }, grip.class + " ")); - } - return ""; - }, - - getTooltip: function (doc) { - return doc.location.href; - }, - - render: wrapRender(function () { - var grip = this.props.object; - - return span({ className: "objectBox objectBox-object" }, this.getTitle(grip), span({ className: "objectPropValue" }, this.getLocation(grip))); - }) - }); - - // Registration - - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - - return object.preview && type == "HTMLDocument"; - } - - // Exports from this module - module.exports = { - rep: Document, - supportsObject: supportsObject - }; - -/***/ }, -/* 945 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var _createFactories = createFactories(__webpack_require__(938)), - rep = _createFactories.rep; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - /** - * Renders DOM event objects. - */ - - - var Event = React.createClass({ - displayName: "event", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - getTitle: function (props) { - var preview = props.object.preview; - var title = preview.type; - - if (preview.eventKind == "key" && preview.modifiers && preview.modifiers.length) { - title = `${title} ${preview.modifiers.join("-")}`; - } - return title; - }, - - render: wrapRender(function () { - // Use `Object.assign` to keep `this.props` without changes because: - // 1. JSON.stringify/JSON.parse is slow. - // 2. Immutable.js is planned for the future. - var gripProps = Object.assign({}, this.props, { - title: this.getTitle(this.props) - }); - gripProps.object = Object.assign({}, this.props.object); - gripProps.object.preview = Object.assign({}, this.props.object.preview); - - gripProps.object.preview.ownProperties = {}; - if (gripProps.object.preview.target) { - Object.assign(gripProps.object.preview.ownProperties, { - target: gripProps.object.preview.target - }); - } - Object.assign(gripProps.object.preview.ownProperties, gripProps.object.preview.properties); - - delete gripProps.object.preview.properties; - gripProps.object.ownPropertyLength = Object.keys(gripProps.object.preview.ownProperties).length; - - switch (gripProps.object.class) { - case "MouseEvent": - gripProps.isInterestingProp = (type, value, name) => { - return ["target", "clientX", "clientY", "layerX", "layerY"].includes(name); - }; - break; - case "KeyboardEvent": - gripProps.isInterestingProp = (type, value, name) => { - return ["target", "key", "charCode", "keyCode"].includes(name); - }; - break; - case "MessageEvent": - gripProps.isInterestingProp = (type, value, name) => { - return ["target", "isTrusted", "data"].includes(name); - }; - break; - default: - gripProps.isInterestingProp = (type, value, name) => { - // We want to show the properties in the order they are declared. - return Object.keys(gripProps.object.preview.ownProperties).includes(name); - }; - } - - return rep(gripProps); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return grip.preview && grip.preview.kind == "DOMEvent"; - } - - // Exports from this module - module.exports = { - rep: Event, - supportsObject: supportsObject - }; - -/***/ }, -/* 946 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - cropString = _require.cropString, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * This component represents a template for Function objects. - */ - - var Func = React.createClass({ - displayName: "Func", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - var title = "function "; - if (grip.isGenerator) { - title = "function* "; - } - if (grip.isAsync) { - title = "async " + title; - } - - if (this.props.objectLink) { - return this.props.objectLink({ - object: grip - }, title); - } - - return title; - }, - - summarizeFunction: function (grip) { - var name = grip.userDisplayName || grip.displayName || grip.name || ""; - return cropString(name + "()", 100); - }, - - render: wrapRender(function () { - var grip = this.props.object; - - return ( - // Set dir="ltr" to prevent function parentheses from - // appearing in the wrong direction - span({ dir: "ltr", className: "objectBox objectBox-function" }, this.getTitle(grip), this.summarizeFunction(grip)) - ); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return type == "function"; - } - - return type == "Function"; - } - - // Exports from this module - - module.exports = { - rep: Func, - supportsObject: supportsObject - }; - -/***/ }, -/* 947 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // ReactJS - var React = __webpack_require__(2); - // Dependencies - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var PropRep = React.createFactory(__webpack_require__(937)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a DOM Promise object. - */ - - var PromiseRep = React.createClass({ - displayName: "Promise", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - getTitle: function (object) { - var title = object.class; - return this.safeObjectLink({}, title); - }, - - getProps: function (promiseState) { - var keys = ["state"]; - if (Object.keys(promiseState).includes("value")) { - keys.push("value"); - } - - return keys.map((key, i) => { - var object = promiseState[key]; - return PropRep(Object.assign({}, this.props, { - mode: MODE.TINY, - name: `<${key}>`, - object, - equal: ": ", - delim: i < keys.length - 1 ? ", " : "", - suppressQuotes: true - })); - }); - }, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props; - - return (_props = this.props).objectLink.apply(_props, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return span.apply(undefined, [config].concat(children)); - }, - - render: wrapRender(function () { - var object = this.props.object; - var promiseState = object.promiseState; - - - if (this.props.mode === MODE.TINY) { - var _createFactories = createFactories(__webpack_require__(926)), - Rep = _createFactories.Rep; - - return span({ className: "objectBox objectBox-object" }, this.getTitle(object), this.safeObjectLink({ - className: "objectLeftBrace" - }, " { "), Rep({ object: promiseState.state }), this.safeObjectLink({ - className: "objectRightBrace" - }, " }")); - } - - var propsArray = this.getProps(promiseState); - return span.apply(undefined, [{ className: "objectBox objectBox-object" }, this.getTitle(object), this.safeObjectLink({ - className: "objectLeftBrace" - }, " { ")].concat(_toConsumableArray(propsArray), [this.safeObjectLink({ - className: "objectRightBrace" - }, " }")])); - }) - }); - - // Registration - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - return type === "Promise"; - } - - // Exports from this module - module.exports = { - rep: PromiseRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 948 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a grip object with regular expression. - */ - - var RegExp = React.createClass({ - displayName: "regexp", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getSource: function (grip) { - return grip.displayString; - }, - - render: wrapRender(function () { - var _this = this; - - var object = this.props.object; - - var objectLink = function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (_this.props.objectLink) { - var _props; - - return (_props = _this.props).objectLink.apply(_props, [Object.assign({ object }, config)].concat(children)); - } - return span.apply(undefined, [config].concat(children)); + selector.resetRecomputations = function () { + return recomputations = 0; }; - - return objectLink({ - className: "objectBox objectBox-regexp regexpSource" - }, this.getSource(object)); - }) - }); - - // Registration - - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - - return type == "RegExp"; + return selector; + }; } - // Exports from this module - module.exports = { - rep: RegExp, - supportsObject: supportsObject - }; + var createSelector = exports.createSelector = createSelectorCreator(defaultMemoize); -/***/ }, -/* 949 */ -/***/ function(module, exports, __webpack_require__) { + function createStructuredSelector(selectors) { + var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector; - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - getURLDisplayString = _require.getURLDisplayString, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var DOM = React.DOM; - - /** - * Renders a grip representing CSSStyleSheet - */ - var StyleSheet = React.createClass({ - displayName: "object", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - var title = "StyleSheet "; - if (this.props.objectLink) { - return DOM.span({ className: "objectBox" }, this.props.objectLink({ - object: grip - }, title)); - } - return title; - }, - - getLocation: function (grip) { - // Embedded stylesheets don't have URL and so, no preview. - var url = grip.preview ? grip.preview.url : ""; - return url ? getURLDisplayString(url) : ""; - }, - - render: wrapRender(function () { - var grip = this.props.object; - - return DOM.span({ className: "objectBox objectBox-object" }, this.getTitle(grip), DOM.span({ className: "objectPropValue" }, this.getLocation(grip))); - }) - }); - - // Registration - - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; + if (typeof selectors !== 'object') { + throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors)); } + var objectKeys = Object.keys(selectors); + return selectorCreator(objectKeys.map(function (key) { + return selectors[key]; + }), function () { + for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + values[_key3] = arguments[_key3]; + } - return type == "CSSStyleSheet"; + return values.reduce(function (composition, value, index) { + composition[objectKeys[index]] = value; + return composition; + }, {}); + }); } - // Exports from this module - - module.exports = { - rep: StyleSheet, - supportsObject: supportsObject - }; - /***/ }, -/* 950 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - cropString = _require.cropString, - cropMultipleLines = _require.cropMultipleLines, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - var nodeConstants = __webpack_require__(928); - - // Shortcuts - var span = React.DOM.span; - - /** - * Renders DOM comment node. - */ - - var CommentNode = React.createClass({ - displayName: "CommentNode", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])) - }, - - render: wrapRender(function () { - var _props = this.props, - object = _props.object, - _props$mode = _props.mode, - mode = _props$mode === undefined ? MODE.SHORT : _props$mode; - var textContent = object.preview.textContent; - - if (mode === MODE.TINY) { - textContent = cropMultipleLines(textContent, 30); - } else if (mode === MODE.SHORT) { - textContent = cropString(textContent, 50); - } - - return span({ className: "objectBox theme-comment" }, ``); - }) - }); - - // Registration - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - return object.preview && object.preview.nodeType === nodeConstants.COMMENT_NODE; - } - - // Exports from this module - module.exports = { - rep: CommentNode, - supportsObject: supportsObject - }; - -/***/ }, -/* 951 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // ReactJS - var React = __webpack_require__(2); - - // Utils - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - var nodeConstants = __webpack_require__(928); - var Svg = __webpack_require__(952); - - // Shortcuts - var span = React.DOM.span; - - /** - * Renders DOM element node. - */ - - var ElementNode = React.createClass({ - displayName: "ElementNode", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func, - objectLink: React.PropTypes.func - }, - - getElements: function (grip, mode) { - var _grip$preview = grip.preview, - attributes = _grip$preview.attributes, - nodeName = _grip$preview.nodeName; - - var nodeNameElement = span({ - className: "tag-name theme-fg-color3" - }, nodeName); - - if (mode === MODE.TINY) { - var elements = [nodeNameElement]; - if (attributes.id) { - elements.push(span({ className: "attr-name theme-fg-color2" }, `#${attributes.id}`)); - } - if (attributes.class) { - elements.push(span({ className: "attr-name theme-fg-color2" }, attributes.class.replace(/(^\s+)|(\s+$)/g, "").split(" ").map(cls => `.${cls}`).join(""))); - } - return elements; - } - var attributeElements = Object.keys(attributes).sort(function getIdAndClassFirst(a1, a2) { - if ([a1, a2].includes("id")) { - return 3 * (a1 === "id" ? -1 : 1); - } - if ([a1, a2].includes("class")) { - return 2 * (a1 === "class" ? -1 : 1); - } - - // `id` and `class` excepted, - // we want to keep the same order that in `attributes`. - return 0; - }).reduce((arr, name, i, keys) => { - var value = attributes[name]; - var attribute = span({}, span({ className: "attr-name theme-fg-color2" }, `${name}`), `="`, span({ className: "attr-value theme-fg-color6" }, `${value}`), `"`); - - return arr.concat([" ", attribute]); - }, []); - - return ["<", nodeNameElement].concat(_toConsumableArray(attributeElements), [">"]); - }, - - render: wrapRender(function () { - var _this = this; - - var _props = this.props, - object = _props.object, - mode = _props.mode, - attachedActorIds = _props.attachedActorIds, - onDOMNodeMouseOver = _props.onDOMNodeMouseOver, - onDOMNodeMouseOut = _props.onDOMNodeMouseOut, - onInspectIconClick = _props.onInspectIconClick; - - var elements = this.getElements(object, mode); - var objectLink = function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (_this.props.objectLink) { - var _props2; - - return (_props2 = _this.props).objectLink.apply(_props2, [Object.assign({ object }, config)].concat(children)); - } - return span.apply(undefined, [config].concat(children)); - }; - - var isInTree = attachedActorIds ? attachedActorIds.includes(object.actor) : true; - - var baseConfig = { className: "objectBox objectBox-node" }; - var inspectIcon = void 0; - if (isInTree) { - if (onDOMNodeMouseOver) { - Object.assign(baseConfig, { - onMouseOver: _ => onDOMNodeMouseOver(object) - }); - } - - if (onDOMNodeMouseOut) { - Object.assign(baseConfig, { - onMouseOut: onDOMNodeMouseOut - }); - } - - if (onInspectIconClick) { - inspectIcon = Svg("open-inspector", { - element: "a", - draggable: false, - // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands - title: "Click to select the node in the inspector", - onClick: e => onInspectIconClick(object, e) - }); - } - } - - return span(baseConfig, objectLink.apply(undefined, [{}].concat(_toConsumableArray(elements))), inspectIcon); - }) - }); - - // Registration - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - return object.preview && object.preview.nodeType === nodeConstants.ELEMENT_NODE; - } - - // Exports from this module - module.exports = { - rep: ElementNode, - supportsObject: supportsObject - }; - -/***/ }, -/* 952 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var React = __webpack_require__(2); - var InlineSVG = __webpack_require__(346); - - var svg = { - "open-inspector": __webpack_require__(688) - }; - - module.exports = function (name, props) { - // eslint-disable-line - if (!svg[name]) { - throw new Error("Unknown SVG: " + name); - } - var className = name; - if (props && props.className) { - className = `${name} ${props.className}`; - } - if (name === "subSettings") { - className = ""; - } - props = Object.assign({}, props, { className, src: svg[name] }); - return React.createElement(InlineSVG, props); - }; - -/***/ }, -/* 953 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - cropString = _require.cropString, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - var Svg = __webpack_require__(952); - - // Shortcuts - var DOM = React.DOM; - - /** - * Renders DOM #text node. - */ - var TextNode = React.createClass({ - displayName: "TextNode", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - getTextContent: function (grip) { - return cropString(grip.preview.textContent); - }, - - getTitle: function (grip) { - var title = "#text"; - if (this.props.objectLink) { - return this.props.objectLink({ - object: grip - }, title); - } - return title; - }, - - render: wrapRender(function () { - var _props = this.props, - grip = _props.object, - _props$mode = _props.mode, - mode = _props$mode === undefined ? MODE.SHORT : _props$mode, - attachedActorIds = _props.attachedActorIds, - onDOMNodeMouseOver = _props.onDOMNodeMouseOver, - onDOMNodeMouseOut = _props.onDOMNodeMouseOut, - onInspectIconClick = _props.onInspectIconClick; - - - var baseConfig = { className: "objectBox objectBox-textNode" }; - var inspectIcon = void 0; - var isInTree = attachedActorIds ? attachedActorIds.includes(grip.actor) : true; - - if (isInTree) { - if (onDOMNodeMouseOver) { - Object.assign(baseConfig, { - onMouseOver: _ => onDOMNodeMouseOver(grip) - }); - } - - if (onDOMNodeMouseOut) { - Object.assign(baseConfig, { - onMouseOut: onDOMNodeMouseOut - }); - } - - if (onInspectIconClick) { - inspectIcon = Svg("open-inspector", { - element: "a", - draggable: false, - // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands - title: "Click to select the node in the inspector", - onClick: e => onInspectIconClick(grip, e) - }); - } - } - - if (mode === MODE.TINY) { - return DOM.span(baseConfig, this.getTitle(grip), inspectIcon); - } - - return DOM.span(baseConfig, this.getTitle(grip), DOM.span({ className: "nodeValue" }, " ", `"${this.getTextContent(grip)}"`), inspectIcon); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return grip.preview && grip.class == "Text"; - } - - // Exports from this module - module.exports = { - rep: TextNode, - supportsObject: supportsObject - }; - -/***/ }, -/* 954 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - // Utils - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders Error objects. - */ - - var ErrorRep = React.createClass({ - displayName: "Error", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func - }, - - render: wrapRender(function () { - var _this = this; - - var object = this.props.object; - var preview = object.preview; - var name = preview && preview.name ? preview.name : "Error"; - - var content = this.props.mode === MODE.TINY ? name : `${name}: ${preview.message}`; - - if (preview.stack && this.props.mode !== MODE.TINY) { - /* - * Since Reps are used in the JSON Viewer, we can't localize - * the "Stack trace" label (defined in debugger.properties as - * "variablesViewErrorStacktrace" property), until Bug 1317038 lands. - */ - content = `${content}\nStack trace:\n${preview.stack}`; - } - - var objectLink = function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (_this.props.objectLink) { - var _props; - - return (_props = _this.props).objectLink.apply(_props, [Object.assign({ object }, config)].concat(children)); - } - return span.apply(undefined, [config].concat(children)); - }; - - return objectLink({ className: "objectBox-stackTrace" }, content); - }) - }); - - // Registration - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - return object.preview && type === "Error"; - } - - // Exports from this module - module.exports = { - rep: ErrorRep, - supportsObject: supportsObject - }; - -/***/ }, -/* 955 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - getURLDisplayString = _require.getURLDisplayString, - wrapRender = _require.wrapRender; - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - // Shortcuts - - - var DOM = React.DOM; - - /** - * Renders a grip representing a window. - */ - var Window = React.createClass({ - displayName: "Window", - - propTypes: { - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (object) { - var title = object.displayClass || object.class || "Window"; - if (this.props.objectLink) { - return DOM.span({ className: "objectBox" }, this.props.objectLink({ - object - }, title)); - } - return title; - }, - - getLocation: function (object) { - return getURLDisplayString(object.preview.url); - }, - - render: wrapRender(function () { - var _props = this.props, - mode = _props.mode, - object = _props.object; - - - if (mode === MODE.TINY) { - return DOM.span({ className: "objectBox objectBox-Window" }, this.getTitle(object)); - } - - return DOM.span({ className: "objectBox objectBox-Window" }, this.getTitle(object), " ", DOM.span({ className: "objectPropValue" }, this.getLocation(object))); - }) - }); - - // Registration - - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - - return object.preview && type == "Window"; - } - - // Exports from this module - module.exports = { - rep: Window, - supportsObject: supportsObject - }; - -/***/ }, -/* 956 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a grip object with textual data. - */ - - var ObjectWithText = React.createClass({ - displayName: "ObjectWithText", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - if (this.props.objectLink) { - return span({ className: "objectBox" }, this.props.objectLink({ - object: grip - }, this.getType(grip) + " ")); - } - return ""; - }, - - getType: function (grip) { - return grip.class; - }, - - getDescription: function (grip) { - return "\"" + grip.preview.text + "\""; - }, - - render: wrapRender(function () { - var grip = this.props.object; - return span({ className: "objectBox objectBox-" + this.getType(grip) }, this.getTitle(grip), span({ className: "objectPropValue" }, this.getDescription(grip))); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return grip.preview && grip.preview.kind == "ObjectWithText"; - } - - // Exports from this module - module.exports = { - rep: ObjectWithText, - supportsObject: supportsObject - }; - -/***/ }, -/* 957 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - // ReactJS - var React = __webpack_require__(2); - - // Reps - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - getURLDisplayString = _require.getURLDisplayString, - wrapRender = _require.wrapRender; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders a grip object with URL data. - */ - - var ObjectWithURL = React.createClass({ - displayName: "ObjectWithURL", - - propTypes: { - object: React.PropTypes.object.isRequired, - objectLink: React.PropTypes.func - }, - - getTitle: function (grip) { - if (this.props.objectLink) { - return span({ className: "objectBox" }, this.props.objectLink({ - object: grip - }, this.getType(grip) + " ")); - } - return ""; - }, - - getType: function (grip) { - return grip.class; - }, - - getDescription: function (grip) { - return getURLDisplayString(grip.preview.url); - }, - - render: wrapRender(function () { - var grip = this.props.object; - return span({ className: "objectBox objectBox-" + this.getType(grip) }, this.getTitle(grip), span({ className: "objectPropValue" }, this.getDescription(grip))); - }) - }); - - // Registration - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return grip.preview && grip.preview.kind == "ObjectWithURL"; - } - - // Exports from this module - module.exports = { - rep: ObjectWithURL, - supportsObject: supportsObject - }; - -/***/ }, -/* 958 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - createFactories = _require.createFactories, - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var Caption = React.createFactory(__webpack_require__(935)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - - // Shortcuts - - - var span = React.DOM.span; - - /** - * Renders an array. The array is enclosed by left and right bracket - * and the max number of rendered items depends on the current mode. - */ - - var GripArray = React.createClass({ - displayName: "GripArray", - - propTypes: { - object: React.PropTypes.object.isRequired, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - provider: React.PropTypes.object, - objectLink: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - getLength: function (grip) { - if (!grip.preview) { - return 0; - } - - return grip.preview.length || grip.preview.childNodesLength || 0; - }, - - getTitle: function (object, context) { - if (this.props.mode === MODE.TINY) { - return ""; - } - - var title = this.props.title || object.class || "Array"; - return this.safeObjectLink({}, title + " "); - }, - - getPreviewItems: function (grip) { - if (!grip.preview) { - return null; - } - - return grip.preview.items || grip.preview.childNodes || null; - }, - - arrayIterator: function (grip, max) { - var items = []; - var gripLength = this.getLength(grip); - - if (!gripLength) { - return items; - } - - var previewItems = this.getPreviewItems(grip); - if (!previewItems) { - return items; - } - - var delim = void 0; - // number of grip preview items is limited to 10, but we may have more - // items in grip-array. - var delimMax = gripLength > previewItems.length ? previewItems.length : previewItems.length - 1; - var provider = this.props.provider; - - for (var i = 0; i < previewItems.length && i < max; i++) { - try { - var itemGrip = previewItems[i]; - var value = provider ? provider.getValue(itemGrip) : itemGrip; - - delim = i == delimMax ? "" : ", "; - - items.push(GripArrayItem(Object.assign({}, this.props, { - object: value, - delim: delim, - // Do not propagate title to array items reps - title: undefined - }))); - } catch (exc) { - items.push(GripArrayItem(Object.assign({}, this.props, { - object: exc, - delim: delim, - // Do not propagate title to array items reps - title: undefined - }))); - } - } - if (previewItems.length > max || gripLength > previewItems.length) { - var leftItemNum = gripLength - max > 0 ? gripLength - max : gripLength - previewItems.length; - items.push(Caption({ - object: this.safeObjectLink({}, leftItemNum + " more…") - })); - } - - return items; - }, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props; - - return (_props = this.props).objectLink.apply(_props, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return span.apply(undefined, [config].concat(children)); - }, - - render: wrapRender(function () { - var _props2 = this.props, - object = _props2.object, - _props2$mode = _props2.mode, - mode = _props2$mode === undefined ? MODE.SHORT : _props2$mode; - - - var items = void 0; - var brackets = void 0; - var needSpace = function (space) { - return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; - }; - - if (mode === MODE.TINY) { - var objectLength = this.getLength(object); - var isEmpty = objectLength === 0; - items = [span({ className: "length" }, isEmpty ? "" : objectLength)]; - brackets = needSpace(false); - } else { - var max = mode === MODE.SHORT ? 3 : 10; - items = this.arrayIterator(object, max); - brackets = needSpace(items.length > 0); - } - - var title = this.getTitle(object); - - return span.apply(undefined, [{ - className: "objectBox objectBox-array" }, title, this.safeObjectLink({ - className: "arrayLeftBracket" - }, brackets.left)].concat(_toConsumableArray(items), [this.safeObjectLink({ - className: "arrayRightBracket" - }, brackets.right), span({ - className: "arrayProperties", - role: "group" })])); - }) - }); - - /** - * Renders array item. Individual values are separated by - * a delimiter (a comma by default). - */ - var GripArrayItem = React.createFactory(React.createClass({ - displayName: "GripArrayItem", - - propTypes: { - delim: React.PropTypes.string, - object: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.number, React.PropTypes.string]).isRequired, - objectLink: React.PropTypes.func, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - provider: React.PropTypes.object, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func - }, - - render: function () { - var _createFactories = createFactories(__webpack_require__(926)), - Rep = _createFactories.Rep; - - return span({}, Rep(Object.assign({}, this.props, { - mode: MODE.TINY - })), this.props.delim); - } - })); - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - - return grip.preview && (grip.preview.kind == "ArrayLike" || type === "DocumentFragment"); - } - - // Exports from this module - module.exports = { - rep: GripArray, - supportsObject: supportsObject - }; - -/***/ }, -/* 959 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - - // Dependencies - var React = __webpack_require__(2); - - var _require = __webpack_require__(927), - isGrip = _require.isGrip, - wrapRender = _require.wrapRender; - - var Caption = React.createFactory(__webpack_require__(935)); - var PropRep = React.createFactory(__webpack_require__(937)); - - var _require2 = __webpack_require__(925), - MODE = _require2.MODE; - // Shortcuts - - - var span = React.DOM.span; - /** - * Renders an map. A map is represented by a list of its - * entries enclosed in curly brackets. - */ - - var GripMap = React.createClass({ - displayName: "GripMap", - - propTypes: { - object: React.PropTypes.object, - // @TODO Change this to Object.values once it's supported in Node's version of V8 - mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), - objectLink: React.PropTypes.func, - isInterestingEntry: React.PropTypes.func, - attachedActorIds: React.PropTypes.array, - onDOMNodeMouseOver: React.PropTypes.func, - onDOMNodeMouseOut: React.PropTypes.func, - onInspectIconClick: React.PropTypes.func, - title: React.PropTypes.string - }, - - getTitle: function (object) { - var title = this.props.title || (object && object.class ? object.class : "Map"); - return this.safeObjectLink({}, title); - }, - - safeEntriesIterator: function (object, max) { - max = typeof max === "undefined" ? 3 : max; - try { - return this.entriesIterator(object, max); - } catch (err) { - console.error(err); - } - return []; - }, - - entriesIterator: function (object, max) { - // Entry filter. Show only interesting entries to the user. - var isInterestingEntry = this.props.isInterestingEntry || ((type, value) => { - return type == "boolean" || type == "number" || type == "string" && value.length != 0; - }); - - var mapEntries = object.preview && object.preview.entries ? object.preview.entries : []; - - var indexes = this.getEntriesIndexes(mapEntries, max, isInterestingEntry); - if (indexes.length < max && indexes.length < mapEntries.length) { - // There are not enough entries yet, so we add uninteresting entries. - indexes = indexes.concat(this.getEntriesIndexes(mapEntries, max - indexes.length, (t, value, name) => { - return !isInterestingEntry(t, value, name); - })); - } - - var entries = this.getEntries(mapEntries, indexes); - if (entries.length < mapEntries.length) { - // There are some undisplayed entries. Then display "more…". - entries.push(Caption({ - key: "more", - object: this.safeObjectLink({}, `${mapEntries.length - max} more…`) - })); - } - - return entries; - }, - - /** - * Get entries ordered by index. - * - * @param {Array} entries Entries array. - * @param {Array} indexes Indexes of entries. - * @return {Array} Array of PropRep. - */ - getEntries: function (entries, indexes) { - var _props = this.props, - objectLink = _props.objectLink, - attachedActorIds = _props.attachedActorIds, - onDOMNodeMouseOver = _props.onDOMNodeMouseOver, - onDOMNodeMouseOut = _props.onDOMNodeMouseOut, - onInspectIconClick = _props.onInspectIconClick; - - // Make indexes ordered by ascending. - - indexes.sort(function (a, b) { - return a - b; - }); - - return indexes.map((index, i) => { - var _entries$index = _slicedToArray(entries[index], 2), - key = _entries$index[0], - entryValue = _entries$index[1]; - - var value = entryValue.value !== undefined ? entryValue.value : entryValue; - - return PropRep({ - // key, - name: key, - equal: ": ", - object: value, - // Do not add a trailing comma on the last entry - // if there won't be a "more..." item. - delim: i < indexes.length - 1 || indexes.length < entries.length ? ", " : "", - mode: MODE.TINY, - objectLink, - attachedActorIds, - onDOMNodeMouseOver, - onDOMNodeMouseOut, - onInspectIconClick - }); - }); - }, - - /** - * Get the indexes of entries in the map. - * - * @param {Array} entries Entries array. - * @param {Number} max The maximum length of indexes array. - * @param {Function} filter Filter the entry you want. - * @return {Array} Indexes of filtered entries in the map. - */ - getEntriesIndexes: function (entries, max, filter) { - return entries.reduce((indexes, _ref, i) => { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - entry = _ref2[1]; - - if (indexes.length < max) { - var value = entry && entry.value !== undefined ? entry.value : entry; - // Type is specified in grip's "class" field and for primitive - // values use typeof. - var type = (value && value.class ? value.class : typeof value).toLowerCase(); - - if (filter(type, value, key)) { - indexes.push(i); - } - } - - return indexes; - }, []); - }, - - safeObjectLink: function (config) { - for (var _len = arguments.length, children = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - children[_key - 1] = arguments[_key]; - } - - if (this.props.objectLink) { - var _props2; - - return (_props2 = this.props).objectLink.apply(_props2, [Object.assign({ - object: this.props.object - }, config)].concat(children)); - } - - if (Object.keys(config).length === 0 && children.length === 1) { - return children[0]; - } - - return span.apply(undefined, [config].concat(children)); - }, - - render: wrapRender(function () { - var object = this.props.object; - var propsArray = this.safeEntriesIterator(object, this.props.mode === MODE.LONG ? 10 : 3); - - if (this.props.mode === MODE.TINY) { - return span({ className: "objectBox objectBox-object" }, this.getTitle(object)); - } - - return span({ className: "objectBox objectBox-object" }, this.getTitle(object), this.safeObjectLink({ - className: "objectLeftBrace" - }, " { "), propsArray, this.safeObjectLink({ - className: "objectRightBrace" - }, " }")); - }) - }); - - function supportsObject(grip, type) { - if (!isGrip(grip)) { - return false; - } - return grip.preview && grip.preview.kind == "MapLike"; - } - - // Exports from this module - module.exports = { - rep: GripMap, - supportsObject: supportsObject - }; - -/***/ }, -/* 960 */ -/***/ function(module, exports) { - - module.exports = "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\n# LOCALIZATION NOTE These strings are used inside the Debugger\n# which is available from the Web Developer sub-menu -> 'Debugger'.\n# The correct localization of this file might be to keep it in\n# English, or another language commonly spoken among web developers.\n# You want to make that choice consistent across the developer tools.\n# A good criteria is the language in which you'd find the best\n# documentation on web development on the web.\n\n# LOCALIZATION NOTE (collapsePanes): This is the tooltip for the button\n# that collapses the left and right panes in the debugger UI.\ncollapsePanes=Collapse panes\n\n# LOCALIZATION NOTE (copySourceUrl): This is the text that appears in the\n# context menu to copy the source URL of file open.\ncopySourceUrl=Copy Source Url\n\n# LOCALIZATION NOTE (copySourceUrl.accesskey): Access key to copy the source URL of a file from\n# the context menu.\ncopySourceUrl.accesskey=u\n\n# LOCALIZATION NOTE (expandPanes): This is the tooltip for the button\n# that expands the left and right panes in the debugger UI.\nexpandPanes=Expand panes\n\n# LOCALIZATION NOTE (pauseButtonTooltip): The tooltip that is displayed for the pause\n# button when the debugger is in a running state.\npauseButtonTooltip=Pause %S\n\n# LOCALIZATION NOTE (pausePendingButtonTooltip): The tooltip that is displayed for\n# the pause button after it's been clicked but before the next JavaScript to run.\npausePendingButtonTooltip=Waiting for next execution\n\n# LOCALIZATION NOTE (resumeButtonTooltip): The label that is displayed on the pause\n# button when the debugger is in a paused state.\nresumeButtonTooltip=Resume %S\n\n# LOCALIZATION NOTE (stepOverTooltip): The label that is displayed on the\n# button that steps over a function call.\nstepOverTooltip=Step Over %S\n\n# LOCALIZATION NOTE (stepInTooltip): The label that is displayed on the\n# button that steps into a function call.\nstepInTooltip=Step In %S\n\n# LOCALIZATION NOTE (stepOutTooltip): The label that is displayed on the\n# button that steps out of a function call.\nstepOutTooltip=Step Out %S\n\n# LOCALIZATION NOTE (noWorkersText): The text to display in the workers list\n# when there are no workers.\nnoWorkersText=This page has no workers.\n\n# LOCALIZATION NOTE (noSourcesText): The text to display in the sources list\n# when there are no sources.\nnoSourcesText=This page has no sources.\n\n# LOCALIZATION NOTE (noEventListenersText): The text to display in the events tab\n# when there are no events.\nnoEventListenersText=No event listeners to display\n\n# LOCALIZATION NOTE (eventListenersHeader): The text to display in the events\n# header.\neventListenersHeader=Event Listeners\n\n# LOCALIZATION NOTE (noStackFramesText): The text to display in the call stack tab\n# when there are no stack frames.\nnoStackFramesText=No stack frames to display\n\n# LOCALIZATION NOTE (eventCheckboxTooltip): The tooltip text to display when\n# the user hovers over the checkbox used to toggle an event breakpoint.\neventCheckboxTooltip=Toggle breaking on this event\n\n# LOCALIZATION NOTE (eventOnSelector): The text to display in the events tab\n# for every event item, between the event type and event selector.\neventOnSelector=on\n\n# LOCALIZATION NOTE (eventInSource): The text to display in the events tab\n# for every event item, between the event selector and listener's owner source.\neventInSource=in\n\n# LOCALIZATION NOTE (eventNodes): The text to display in the events tab when\n# an event is listened on more than one target node.\neventNodes=%S nodes\n\n# LOCALIZATION NOTE (eventNative): The text to display in the events tab when\n# a listener is added from plugins, thus getting translated to native code.\neventNative=[native code]\n\n# LOCALIZATION NOTE (*Events): The text to display in the events tab for\n# each group of sub-level event entries.\nanimationEvents=Animation\naudioEvents=Audio\nbatteryEvents=Battery\nclipboardEvents=Clipboard\ncompositionEvents=Composition\ndeviceEvents=Device\ndisplayEvents=Display\ndragAndDropEvents=Drag and Drop\ngamepadEvents=Gamepad\nindexedDBEvents=IndexedDB\ninteractionEvents=Interaction\nkeyboardEvents=Keyboard\nmediaEvents=HTML5 Media\nmouseEvents=Mouse\nmutationEvents=Mutation\nnavigationEvents=Navigation\npointerLockEvents=Pointer Lock\nsensorEvents=Sensor\nstorageEvents=Storage\ntimeEvents=Time\ntouchEvents=Touch\notherEvents=Other\n\n# LOCALIZATION NOTE (sources.search.key): Key shortcut to open the search for\n# searching all the source files the debugger has seen.\nsources.search.key=P\n\n# LOCALIZATION NOTE (sources.noSourcesAvailable): Text shown when the debugger\n# does not have any sources.\nsources.noSourcesAvailable=This page has no sources\n\n# LOCALIZATION NOTE (sources.searchAlt.key): Alternate key shortcut to open\n# the search for searching all the source files the debugger has seen.\nsources.searchAlt.key=O\n\n# LOCALIZATION NOTE (sourceSearch.search.key): Key shortcut to open the search\n# for searching within a the currently opened files in the editor\nsourceSearch.search.key=F\n\n# LOCALIZATION NOTE (sourceSearch.search.placeholder): placeholder text in\n# the source search input bar\nsourceSearch.search.placeholder=Search in file…\n\n# LOCALIZATION NOTE (sourceSearch.search.again.key): Key shortcut to re-open\n# the search for re-searching the same search triggered from a sourceSearch\nsourceSearch.search.again.key=G\n\n# LOCALIZATION NOTE (sourceSearch.resultsSummary1): Shows a summary of\n# the number of matches for autocomplete\nsourceSearch.resultsSummary1=%d results\n\n# LOCALIZATION NOTE (noMatchingStringsText): The text to display in the\n# global search results when there are no matching strings after filtering.\nnoMatchingStringsText=No matches found\n\n# LOCALIZATION NOTE (emptySearchText): This is the text that appears in the\n# filter text box when it is empty and the scripts container is selected.\nemptySearchText=Search scripts (%S)\n\n# LOCALIZATION NOTE (emptyVariablesFilterText): This is the text that\n# appears in the filter text box for the variables view container.\nemptyVariablesFilterText=Filter variables\n\n# LOCALIZATION NOTE (emptyPropertiesFilterText): This is the text that\n# appears in the filter text box for the editor's variables view bubble.\nemptyPropertiesFilterText=Filter properties\n\n# LOCALIZATION NOTE (searchPanelFilter): This is the text that appears in the\n# filter panel popup for the filter scripts operation.\nsearchPanelFilter=Filter scripts (%S)\n\n# LOCALIZATION NOTE (searchPanelGlobal): This is the text that appears in the\n# filter panel popup for the global search operation.\nsearchPanelGlobal=Search in all files (%S)\n\n# LOCALIZATION NOTE (searchPanelFunction): This is the text that appears in the\n# filter panel popup for the function search operation.\nsearchPanelFunction=Search for function definition (%S)\n\n# LOCALIZATION NOTE (searchPanelToken): This is the text that appears in the\n# filter panel popup for the token search operation.\nsearchPanelToken=Find in this file (%S)\n\n# LOCALIZATION NOTE (searchPanelGoToLine): This is the text that appears in the\n# filter panel popup for the line search operation.\nsearchPanelGoToLine=Go to line (%S)\n\n# LOCALIZATION NOTE (searchPanelVariable): This is the text that appears in the\n# filter panel popup for the variables search operation.\nsearchPanelVariable=Filter variables (%S)\n\n# LOCALIZATION NOTE (breakpointMenuItem): The text for all the elements that\n# are displayed in the breakpoints menu item popup.\nbreakpointMenuItem.setConditional=Configure conditional breakpoint\nbreakpointMenuItem.enableSelf=Enable breakpoint\nbreakpointMenuItem.disableSelf=Disable breakpoint\nbreakpointMenuItem.deleteSelf=Remove breakpoint\nbreakpointMenuItem.enableOthers=Enable others\nbreakpointMenuItem.disableOthers=Disable others\nbreakpointMenuItem.deleteOthers=Remove others\nbreakpointMenuItem.enableAll=Enable all breakpoints\nbreakpointMenuItem.disableAll=Disable all breakpoints\nbreakpointMenuItem.deleteAll=Remove all breakpoints\n\n# LOCALIZATION NOTE (breakpoints.header): Breakpoints right sidebar pane header.\nbreakpoints.header=Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.none): The text that appears when there are\n# no breakpoints present\nbreakpoints.none=No Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.enable): The text that may appear as a tooltip\n# when hovering over the 'disable breakpoints' switch button in right sidebar\nbreakpoints.enable=Enable Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.disable): The text that may appear as a tooltip\n# when hovering over the 'disable breakpoints' switch button in right sidebar\nbreakpoints.disable=Disable Breakpoints\n\n# LOCALIZATION NOTE (breakpoints.removeBreakpointTooltip): The tooltip that is displayed\n# for remove breakpoint button in right sidebar\nbreakpoints.removeBreakpointTooltip=Remove Breakpoint\n\n# LOCALIZATION NOTE (callStack.header): Call Stack right sidebar pane header.\ncallStack.header=Call Stack\n\n# LOCALIZATION NOTE (callStack.notPaused): Call Stack right sidebar pane\n# message when not paused.\ncallStack.notPaused=Not Paused\n\n# LOCALIZATION NOTE (callStack.collapse): Call Stack right sidebar pane\n# message to hide some of the frames that are shown.\ncallStack.collapse=Collapse Rows\n\n# LOCALIZATION NOTE (callStack.expand): Call Stack right sidebar pane\n# message to show more of the frames.\ncallStack.expand=Expand Rows\n\n# LOCALIZATION NOTE (editor.searchResults): Editor Search bar message\n# for the summarizing the selected search result. e.g. 5 of 10 results.\neditor.searchResults=%d of %d results\n\n# LOCALIZATION NOTE (sourceSearch.singleResult): Copy shown when there is one result.\neditor.singleResult=1 result\n\n# LOCALIZATION NOTE (editor.noResults): Editor Search bar message\n# for when no results found.\neditor.noResults=no results\n\n# LOCALIZATION NOTE (editor.searchTypeToggleTitle): Search bar title for\n# toggling search type buttons(function search, variable search)\neditor.searchTypeToggleTitle=Search for:\n\n# LOCALIZATION NOTE (editor.addBreakpoint): Editor gutter context menu item\n# for adding a breakpoint on a line.\neditor.addBreakpoint=Add Breakpoint\n\n# LOCALIZATION NOTE (editor.disableBreakpoint): Editor gutter context menu item\n# for disabling a breakpoint on a line.\neditor.disableBreakpoint=Disable Breakpoint\n\n# LOCALIZATION NOTE (editor.enableBreakpoint): Editor gutter context menu item\n# for enabling a breakpoint on a line.\neditor.enableBreakpoint=Enable Breakpoint\n\n# LOCALIZATION NOTE (editor.removeBreakpoint): Editor gutter context menu item\n# for removing a breakpoint on a line.\neditor.removeBreakpoint=Remove Breakpoint\n\n# LOCALIZATION NOTE (editor.editBreakpoint): Editor gutter context menu item\n# for setting a breakpoint condition on a line.\neditor.editBreakpoint=Edit Breakpoint\n\n# LOCALIZATION NOTE (editor.addConditionalBreakpoint): Editor gutter context\n# menu item for adding a breakpoint condition on a line.\neditor.addConditionalBreakpoint=Add Conditional Breakpoint\n\n# LOCALIZATION NOTE (editor.conditionalPanel.placeholder): Placeholder text for\n# input element inside ConditionalPanel component\neditor.conditionalPanel.placeholder=This breakpoint will pause when the expression is true\n\n# LOCALIZATION NOTE (editor.conditionalPanel.placeholder): Tooltip text for\n# close button inside ConditionalPanel component\neditor.conditionalPanel.close=Cancel edit breakpoint and close\n\n# LOCALIZATION NOTE (editor.jumpToMappedLocation1): Context menu item\n# for navigating to a source mapped location\neditor.jumpToMappedLocation1=Jump to %S location\n\n# LOCALIZATION NOTE (generated): Source Map term for a server source location\ngenerated=generated\n\n# LOCALIZATION NOTE (original): Source Map term for a debugger UI source location\noriginal=original\n\n# LOCALIZATION NOTE (expressions.placeholder): Placeholder text for expression\n# input element\nexpressions.placeholder=Add Watch Expression\n\n# LOCALIZATION NOTE (sourceTabs.closeTab): Editor source tab context menu item\n# for closing the selected tab below the mouse.\nsourceTabs.closeTab=Close tab\n\n# LOCALIZATION NOTE (sourceTabs.closeTab.accesskey): Access key to close the currently select\n# source tab from the editor context menu item.\nsourceTabs.closeTab.accesskey=c\n\n# LOCALIZATION NOTE (sourceTabs.closeOtherTabs): Editor source tab context menu item\n# for closing the other tabs.\nsourceTabs.closeOtherTabs=Close others\n\n# LOCALIZATION NOTE (sourceTabs.closeOtherTabs.accesskey): Access key to close other source tabs\n# from the editor context menu.\nsourceTabs.closeOtherTabs.accesskey=o\n\n# LOCALIZATION NOTE (sourceTabs.closeTabsToEnd): Editor source tab context menu item\n# for closing the tabs to the end (the right for LTR languages) of the selected tab.\nsourceTabs.closeTabsToEnd=Close tabs to the right\n\n# LOCALIZATION NOTE (sourceTabs.closeTabsToEnd.accesskey): Access key to close source tabs\n# after the selected tab from the editor context menu.\nsourceTabs.closeTabsToEnd.accesskey=e\n\n# LOCALIZATION NOTE (sourceTabs.closeAllTabs): Editor source tab context menu item\n# for closing all tabs.\nsourceTabs.closeAllTabs=Close all tabs\n\n# LOCALIZATION NOTE (sourceTabs.closeAllTabs.accesskey): Access key to close all tabs from the\n# editor context menu.\nsourceTabs.closeAllTabs.accesskey=a\n\n# LOCALIZATION NOTE (sourceTabs.revealInTree): Editor source tab context menu item\n# for revealing source in tree.\nsourceTabs.revealInTree=Reveal in Tree\n\n# LOCALIZATION NOTE (sourceTabs.revealInTree.accesskey): Access key to reveal a source in the\n# tree from the context menu.\nsourceTabs.revealInTree.accesskey=r\n\n# LOCALIZATION NOTE (sourceTabs.copyLink): Editor source tab context menu item\n# for copying a link address.\nsourceTabs.copyLink=Copy Link Address\n\n# LOCALIZATION NOTE (sourceTabs.copyLink.accesskey): Access key to copy a link addresss from the\n# editor context menu.\nsourceTabs.copyLink.accesskey=l\n\n# LOCALIZATION NOTE (sourceTabs.prettyPrint): Editor source tab context menu item\n# for pretty printing the source.\nsourceTabs.prettyPrint=Pretty Print Source\n\n# LOCALIZATION NOTE (sourceTabs.prettyPrint.accesskey): Access key to pretty print a source from\n# the editor context menu.\nsourceTabs.prettyPrint.accesskey=p\n\n# LOCALIZATION NOTE (sourceFooter.blackbox): Tooltip text associated\n# with the blackbox button\nsourceFooter.blackbox=Blackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.unblackbox): Tooltip text associated\n# with the blackbox button\nsourceFooter.unblackbox=Unblackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.blackbox.accesskey): Access key to blackbox\n# an associated source\nsourceFooter.blackbox.accesskey=b\n\n# LOCALIZATION NOTE (sourceFooter.blackboxed): Text associated\n# with a blackboxed source\nsourceFooter.blackboxed=Blackboxed Source\n\n# LOCALIZATION NOTE (sourceTabs.closeTabButtonTooltip): The tooltip that is displayed\n# for close tab button in source tabs.\nsourceTabs.closeTabButtonTooltip=Close tab\n\n# LOCALIZATION NOTE (sourceTabs.newTabButtonTooltip): The tooltip that is displayed for\n# new tab button in source tabs.\nsourceTabs.newTabButtonTooltip=Search for sources (%S)\n\n# LOCALIZATION NOTE (scopes.header): Scopes right sidebar pane header.\nscopes.header=Scopes\n\n# LOCALIZATION NOTE (scopes.notAvailable): Scopes right sidebar pane message\n# for when the debugger is paused, but there isn't pause data.\nscopes.notAvailable=Scopes Unavailable\n\n# LOCALIZATION NOTE (scopes.notPaused): Scopes right sidebar pane message\n# for when the debugger is not paused.\nscopes.notPaused=Not Paused\n\n# LOCALIZATION NOTE (scopes.block): Refers to a block of code in\n# the scopes pane when the debugger is paused.\nscopes.block=Block\n\n# LOCALIZATION NOTE (sources.header): Sources left sidebar header\nsources.header=Sources\n\n# LOCALIZATION NOTE (sources.search): Sources left sidebar prompt\n# e.g. Cmd+P to search. On a mac, we use the command unicode character.\n# On windows, it's ctrl.\nsources.search=%S to search\n\n# LOCALIZATION NOTE (watchExpressions.header): Watch Expressions right sidebar\n# pane header.\nwatchExpressions.header=Watch Expressions\n\n# LOCALIZATION NOTE (watchExpressions.refreshButton): Watch Expressions header\n# button for refreshing the expressions.\nwatchExpressions.refreshButton=Refresh\n\n# LOCALIZATION NOTE (welcome.search): The center pane welcome panel's\n# search prompt. e.g. cmd+p to search for files. On windows, it's ctrl, on\n# a mac we use the unicode character.\nwelcome.search=%S to search for sources\n\n# LOCALIZATION NOTE (sourceSearch.search): The center pane Source Search\n# prompt for searching for files.\nsourceSearch.search=Search Sources…\n\n# LOCALIZATION NOTE (sourceSearch.noResults): The center pane Source Search\n# message when the query did not match any of the sources.\nsourceSearch.noResults=No files matching %S found\n\n# LOCALIZATION NOTE (ignoreExceptions): The pause on exceptions button tooltip\n# when the debugger will not pause on exceptions.\nignoreExceptions=Ignore exceptions. Click to pause on uncaught exceptions\n\n# LOCALIZATION NOTE (pauseOnUncaughtExceptions): The pause on exceptions button\n# tooltip when the debugger will pause on uncaught exceptions.\npauseOnUncaughtExceptions=Pause on uncaught exceptions. Click to pause on all exceptions\n\n# LOCALIZATION NOTE (pauseOnExceptions): The pause on exceptions button tooltip\n# when the debugger will pause on all exceptions.\npauseOnExceptions=Pause on all exceptions. Click to ignore exceptions\n\n# LOCALIZATION NOTE (loadingText): The text that is displayed in the script\n# editor when the loading process has started but there is no file to display\n# yet.\nloadingText=Loading\\u2026\n\n# LOCALIZATION NOTE (errorLoadingText2): The text that is displayed in the debugger\n# viewer when there is an error loading a file\nerrorLoadingText2=Error loading this URL: %S\n\n# LOCALIZATION NOTE (addWatchExpressionText): The text that is displayed in the\n# watch expressions list to add a new item.\naddWatchExpressionText=Add watch expression\n\n# LOCALIZATION NOTE (addWatchExpressionButton): The button that is displayed in the\n# variables view popup.\naddWatchExpressionButton=Watch\n\n# LOCALIZATION NOTE (emptyVariablesText): The text that is displayed in the\n# variables pane when there are no variables to display.\nemptyVariablesText=No variables to display\n\n# LOCALIZATION NOTE (scopeLabel): The text that is displayed in the variables\n# pane as a header for each variable scope (e.g. \"Global scope, \"With scope\",\n# etc.).\nscopeLabel=%S scope\n\n# LOCALIZATION NOTE (watchExpressionsScopeLabel): The name of the watch\n# expressions scope. This text is displayed in the variables pane as a header for\n# the watch expressions scope.\nwatchExpressionsScopeLabel=Watch expressions\n\n# LOCALIZATION NOTE (globalScopeLabel): The name of the global scope. This text\n# is added to scopeLabel and displayed in the variables pane as a header for\n# the global scope.\nglobalScopeLabel=Global\n\n# LOCALIZATION NOTE (variablesViewErrorStacktrace): This is the text that is\n# shown before the stack trace in an error.\nvariablesViewErrorStacktrace=Stack trace:\n\n# LOCALIZATION NOTE (variablesViewMoreObjects): the text that is displayed\n# when you have an object preview that does not show all of the elements. At the end of the list\n# you see \"N more...\" in the web console output.\n# This is a semi-colon list of plural forms.\n# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals\n# #1 number of remaining items in the object\n# example: 3 more…\nvariablesViewMoreObjects=#1 more…;#1 more…\n\n# LOCALIZATION NOTE (variablesEditableNameTooltip): The text that is displayed\n# in the variables list on an item with an editable name.\nvariablesEditableNameTooltip=Double click to edit\n\n# LOCALIZATION NOTE (variablesEditableValueTooltip): The text that is displayed\n# in the variables list on an item with an editable value.\nvariablesEditableValueTooltip=Click to change value\n\n# LOCALIZATION NOTE (variablesCloseButtonTooltip): The text that is displayed\n# in the variables list on an item which can be removed.\nvariablesCloseButtonTooltip=Click to remove\n\n# LOCALIZATION NOTE (variablesEditButtonTooltip): The text that is displayed\n# in the variables list on a getter or setter which can be edited.\nvariablesEditButtonTooltip=Click to set value\n\n# LOCALIZATION NOTE (variablesEditableValueTooltip): The text that is displayed\n# in a tooltip on the \"open in inspector\" button in the the variables list for a\n# DOMNode item.\nvariablesDomNodeValueTooltip=Click to select the node in the inspector\n\n# LOCALIZATION NOTE (configurable|...|Tooltip): The text that is displayed\n# in the variables list on certain variables or properties as tooltips.\n# Expanations of what these represent can be found at the following links:\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen\n# https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed\n# It's probably best to keep these in English.\nconfigurableTooltip=configurable\nenumerableTooltip=enumerable\nwritableTooltip=writable\nfrozenTooltip=frozen\nsealedTooltip=sealed\nextensibleTooltip=extensible\noverriddenTooltip=overridden\nWebIDLTooltip=WebIDL\n\n# LOCALIZATION NOTE (variablesSeparatorLabel): The text that is displayed\n# in the variables list as a separator between the name and value.\nvariablesSeparatorLabel=:\n\n# LOCALIZATION NOTE (watchExpressionsSeparatorLabel2): The text that is displayed\n# in the watch expressions list as a separator between the code and evaluation.\nwatchExpressionsSeparatorLabel2=\\u0020→\n\n# LOCALIZATION NOTE (functionSearchSeparatorLabel): The text that is displayed\n# in the functions search panel as a separator between function's inferred name\n# and its real name (if available).\nfunctionSearchSeparatorLabel=←\n\n# LOCALIZATION NOTE(symbolSearch.search.functionsPlaceholder): The placeholder\n# text displayed when the user searches for functions in a file\nsymbolSearch.search.functionsPlaceholder=Search functions…\n\n# LOCALIZATION NOTE(symbolSearch.search.variablesPlaceholder): The placeholder\n# text displayed when the user searches for variables in a file\nsymbolSearch.search.variablesPlaceholder=Search variables…\n\n# LOCALIZATION NOTE(symbolSearch.search.key): The shortcut (cmd+shift+o) for\n# searching for a function or variable\nsymbolSearch.search.key=O\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.regex): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.regex=Regex\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.caseSensitive): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.caseSensitive=Case sensitive\n\n# LOCALIZATION NOTE(symbolSearch.searchModifier.wholeWord): A search option\n# when searching text in a file\nsymbolSearch.searchModifier.wholeWord=Whole word\n\n# LOCALIZATION NOTE (resumptionOrderPanelTitle): This is the text that appears\n# as a description in the notification panel popup, when multiple debuggers are\n# open in separate tabs and the user tries to resume them in the wrong order.\n# The substitution parameter is the URL of the last paused window that must be\n# resumed first.\nresumptionOrderPanelTitle=There are one or more paused debuggers. Please resume the most-recently paused debugger first at: %S\n\nvariablesViewOptimizedOut=(optimized away)\nvariablesViewUninitialized=(uninitialized)\nvariablesViewMissingArgs=(unavailable)\n\nanonymousSourcesLabel=Anonymous Sources\n\nexperimental=This is an experimental feature\n\n# LOCALIZATION NOTE (whyPaused.debuggerStatement): The text that is displayed\n# in a info block explaining how the debugger is currently paused due to a `debugger`\n# statement in the code\nwhyPaused.debuggerStatement=Paused on debugger statement\n\n# LOCALIZATION NOTE (whyPaused.breakpoint): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a breakpoint\nwhyPaused.breakpoint=Paused on breakpoint\n\n# LOCALIZATION NOTE (whyPaused.exception): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an exception\nwhyPaused.exception=Paused on exception\n\n# LOCALIZATION NOTE (whyPaused.resumeLimit): The text that is displayed\n# in a info block explaining how the debugger is currently paused while stepping\n# in or out of the stack\nwhyPaused.resumeLimit=Paused while stepping\n\n# LOCALIZATION NOTE (whyPaused.pauseOnDOMEvents): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# dom event\nwhyPaused.pauseOnDOMEvents=Paused on event listener\n\n# LOCALIZATION NOTE (whyPaused.breakpointConditionThrown): The text that is displayed\n# in an info block when evaluating a conditional breakpoint throws an error\nwhyPaused.breakpointConditionThrown=Error with conditional breakpoint\n\n# LOCALIZATION NOTE (whyPaused.xhr): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an\n# xml http request\nwhyPaused.xhr=Paused on XMLHttpRequest\n\n# LOCALIZATION NOTE (whyPaused.promiseRejection): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# promise rejection\nwhyPaused.promiseRejection=Paused on promise rejection\n\n# LOCALIZATION NOTE (whyPaused.assert): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an\n# assert\nwhyPaused.assert=Paused on assertion\n\n# LOCALIZATION NOTE (whyPaused.debugCommand): The text that is displayed\n# in a info block explaining how the debugger is currently paused on a\n# debugger statement\nwhyPaused.debugCommand=Paused on debugged function\n\n# LOCALIZATION NOTE (whyPaused.other): The text that is displayed\n# in a info block explaining how the debugger is currently paused on an event\n# listener breakpoint set\nwhyPaused.other=Debugger paused\n\n# LOCALIZATION NOTE (ctrl): The text that is used for documenting\n# keyboard shortcuts that use the control key\nctrl=Ctrl\n" - -/***/ }, -/* 961 */, -/* 962 */, -/* 963 */, -/* 964 */, -/* 965 */ +/* 993 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -70861,11 +46083,11 @@ return /******/ (function(modules) { // webpackBootstrap }); exports.SourceEditorUtils = exports.SourceEditor = undefined; - var _sourceEditor = __webpack_require__(966); + var _sourceEditor = __webpack_require__(994); var _sourceEditor2 = _interopRequireDefault(_sourceEditor); - var _utils = __webpack_require__(969); + var _utils = __webpack_require__(995); var SourceEditorUtils = _interopRequireWildcard(_utils); @@ -70877,149 +46099,13 @@ return /******/ (function(modules) { // webpackBootstrap exports.SourceEditorUtils = SourceEditorUtils; /***/ }, -/* 966 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - /** - * CodeMirror source editor utils - * @module utils/source-editor - */ - - var CodeMirror = __webpack_require__(306); - - __webpack_require__(307); - __webpack_require__(309); - __webpack_require__(310); - __webpack_require__(313); - __webpack_require__(314); - __webpack_require__(315); - __webpack_require__(905); - __webpack_require__(318); - __webpack_require__(906); - __webpack_require__(907); - __webpack_require__(908); - __webpack_require__(909); - - __webpack_require__(967); - - // NOTE: we should eventually use debugger-html context type mode - - - // Maximum allowed margin (in number of lines) from top or bottom of the editor - // while shifting to a line which was initially out of view. - var MAX_VERTICAL_OFFSET = 3; - - class SourceEditor { - - constructor(opts) { - this.opts = opts; - } - - appendToLocalElement(node) { - this.editor = CodeMirror(node, this.opts); - } - - destroy() { - // Unlink the current document. - if (this.editor.doc) { - this.editor.doc.cm = null; - } - } - - get codeMirror() { - return this.editor; - } - - setText(str) { - this.editor.setValue(str); - } - - getText() { - return this.editor.getValue(); - } - - setMode(value) { - this.editor.setOption("mode", value); - } - - /** - * Replaces the current document with a new source document - * @memberof utils/source-editor - */ - replaceDocument(doc) { - this.editor.swapDoc(doc); - } - - /** - * Creates a CodeMirror Document - * @returns CodeMirror.Doc - * @memberof utils/source-editor - */ - createDocument() { - return new CodeMirror.Doc(""); - } - - /** - * Aligns the provided line to either "top", "center" or "bottom" of the - * editor view with a maximum margin of MAX_VERTICAL_OFFSET lines from top or - * bottom. - * @memberof utils/source-editor - */ - alignLine(line) { - var align = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "top"; - - var cm = this.editor; - var from = cm.lineAtHeight(0, "page"); - var to = cm.lineAtHeight(cm.getWrapperElement().clientHeight, "page"); - var linesVisible = to - from; - var halfVisible = Math.round(linesVisible / 2); - - // If the target line is in view, skip the vertical alignment part. - if (line <= to && line >= from) { - return; - } - - // Setting the offset so that the line always falls in the upper half - // of visible lines (lower half for bottom aligned). - // MAX_VERTICAL_OFFSET is the maximum allowed value. - var offset = Math.min(halfVisible, MAX_VERTICAL_OFFSET); - - var topLine = { - center: Math.max(line - halfVisible, 0), - bottom: Math.max(line - linesVisible + offset, 0), - top: Math.max(line - offset, 0) - }[align || "top"] || offset; - - // Bringing down the topLine to total lines in the editor if exceeding. - topLine = Math.min(topLine, cm.lineCount()); - this.setFirstVisibleLine(topLine); - } - - /** - * Scrolls the view such that the given line number is the first visible line. - * @memberof utils/source-editor - */ - setFirstVisibleLine(line) { - var _editor$charCoords = this.editor.charCoords({ line: line, ch: 0 }, "local"), - top = _editor$charCoords.top; - - this.editor.scrollTo(0, top); - } - } - - module.exports = SourceEditor; - -/***/ }, -/* 967 */ +/* 994 */ /***/ function(module, exports) { - // removed by extract-text-webpack-plugin + module.exports = __WEBPACK_EXTERNAL_MODULE_994__; /***/ }, -/* 968 */, -/* 969 */ +/* 995 */ /***/ function(module, exports) { "use strict"; @@ -71068,28 +46154,1120 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 970 */ +/* 996 */ +/***/ function(module, exports) { + + module.exports = "" + +/***/ }, +/* 997 */ +/***/ function(module, exports) { + + module.exports = "" + +/***/ }, +/* 998 */ /***/ function(module, exports) { module.exports = "" /***/ }, -/* 971 */ +/* 999 */ +/***/ function(module, exports) { + + module.exports = "icon" + +/***/ }, +/* 1000 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var Tree = __webpack_require__(1001); + + module.exports = { + Tree + }; + +/***/ }, +/* 1001 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + var _require = __webpack_require__(2), + dom = _require.DOM, + createClass = _require.createClass, + createFactory = _require.createFactory, + PropTypes = _require.PropTypes; + + var AUTO_EXPAND_DEPTH = 0; // depth + + /** + * An arrow that displays whether its node is expanded (▼) or collapsed + * (▶). When its node has no children, it is hidden. + */ + var ArrowExpander = createFactory(createClass({ + displayName: "ArrowExpander", + + shouldComponentUpdate(nextProps, nextState) { + return this.props.item !== nextProps.item || this.props.visible !== nextProps.visible || this.props.expanded !== nextProps.expanded; + }, + + render() { + var attrs = { + className: "arrow theme-twisty", + onClick: this.props.expanded ? () => this.props.onCollapse(this.props.item) : e => this.props.onExpand(this.props.item, e.altKey) + }; + + if (this.props.expanded) { + attrs.className += " open"; + } + + if (!this.props.visible) { + attrs.style = Object.assign({}, this.props.style || {}, { + visibility: "hidden" + }); + } + + return dom.div(attrs, this.props.children); + } + })); + + var TreeNode = createFactory(createClass({ + displayName: "TreeNode", + + componentDidMount() { + if (this.props.focused) { + this.refs.button.focus(); + } + }, + + componentDidUpdate() { + if (this.props.focused) { + this.refs.button.focus(); + } + }, + + shouldComponentUpdate(nextProps) { + return this.props.item !== nextProps.item || this.props.focused !== nextProps.focused || this.props.expanded !== nextProps.expanded; + }, + + render() { + var arrow = ArrowExpander({ + item: this.props.item, + expanded: this.props.expanded, + visible: this.props.hasChildren, + onExpand: this.props.onExpand, + onCollapse: this.props.onCollapse + }); + + var isOddRow = this.props.index % 2; + return dom.div({ + className: `tree-node div ${isOddRow ? "tree-node-odd" : ""}`, + onFocus: this.props.onFocus, + onClick: this.props.onFocus, + onBlur: this.props.onBlur, + style: { + padding: 0, + margin: 0 + } + }, this.props.renderItem(this.props.item, this.props.depth, this.props.focused, arrow, this.props.expanded), + + // XXX: OSX won't focus/blur regular elements even if you set tabindex + // unless there is an input/button child. + dom.button(this._buttonAttrs)); + }, + + _buttonAttrs: { + ref: "button", + style: { + opacity: 0, + width: "0 !important", + height: "0 !important", + padding: "0 !important", + outline: "none", + MozAppearance: "none", + // XXX: Despite resetting all of the above properties (and margin), the + // button still ends up with ~79px width, so we set a large negative + // margin to completely hide it. + MozMarginStart: "-1000px !important" + } + } + })); + + /** + * Create a function that calls the given function `fn` only once per animation + * frame. + * + * @param {Function} fn + * @returns {Function} + */ + function oncePerAnimationFrame(fn) { + var animationId = null; + var argsToPass = null; + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + argsToPass = args; + if (animationId !== null) { + return; + } + + animationId = requestAnimationFrame(() => { + fn.call.apply(fn, [this].concat(_toConsumableArray(argsToPass))); + animationId = null; + argsToPass = null; + }); + }; + } + + var NUMBER_OF_OFFSCREEN_ITEMS = 1; + + /** + * A generic tree component. See propTypes for the public API. + * + * @see `devtools/client/memory/components/test/mochitest/head.js` for usage + * @see `devtools/client/memory/components/heap.js` for usage + */ + var Tree = module.exports = createClass({ + displayName: "Tree", + + propTypes: { + // Required props + + // A function to get an item's parent, or null if it is a root. + getParent: PropTypes.func.isRequired, + // A function to get an item's children. + getChildren: PropTypes.func.isRequired, + // A function which takes an item and ArrowExpander and returns a + // component. + renderItem: PropTypes.func.isRequired, + // A function which returns the roots of the tree (forest). + getRoots: PropTypes.func.isRequired, + // A function to get a unique key for the given item. + getKey: PropTypes.func.isRequired, + // A function to get whether an item is expanded or not. If an item is not + // expanded, then it must be collapsed. + isExpanded: PropTypes.func.isRequired, + // The height of an item in the tree including margin and padding, in + // pixels. + itemHeight: PropTypes.number.isRequired, + + // Optional props + + // The currently focused item, if any such item exists. + focused: PropTypes.any, + // Handle when a new item is focused. + onFocus: PropTypes.func, + // The depth to which we should automatically expand new items. + autoExpandDepth: PropTypes.number, + // Should auto expand all new items or just the new items under the first + // root item. + autoExpandAll: PropTypes.bool, + // Optional event handlers for when items are expanded or collapsed. + onExpand: PropTypes.func, + onCollapse: PropTypes.func + }, + + getDefaultProps() { + return { + autoExpandDepth: AUTO_EXPAND_DEPTH, + autoExpandAll: true + }; + }, + + getInitialState() { + return { + scroll: 0, + height: window.innerHeight, + seen: new Set() + }; + }, + + componentDidMount() { + window.addEventListener("resize", this._updateHeight); + this._autoExpand(this.props); + this._updateHeight(); + }, + + componentWillUnmount() { + window.removeEventListener("resize", this._updateHeight); + }, + + componentWillReceiveProps(nextProps) { + this._autoExpand(nextProps); + this._updateHeight(); + }, + + _autoExpand(props) { + if (!props.autoExpandDepth) { + return; + } + + // Automatically expand the first autoExpandDepth levels for new items. Do + // not use the usual DFS infrastructure because we don't want to ignore + // collapsed nodes. + var autoExpand = (item, currentDepth) => { + if (currentDepth >= props.autoExpandDepth || this.state.seen.has(item)) { + return; + } + + props.onExpand(item); + this.state.seen.add(item); + + var children = props.getChildren(item); + var length = children.length; + for (var i = 0; i < length; i++) { + autoExpand(children[i], currentDepth + 1); + } + }; + + var roots = props.getRoots(); + var length = roots.length; + if (props.autoExpandAll) { + for (var i = 0; i < length; i++) { + autoExpand(roots[i], 0); + } + } else if (length != 0) { + autoExpand(roots[0], 0); + } + }, + + render() { + var traversal = this._dfsFromRoots(); + + var renderItem = i => { + var _traversal$i = traversal[i], + item = _traversal$i.item, + depth = _traversal$i.depth; + + return TreeNode({ + key: this.props.getKey(item, i), + index: i, + item: item, + depth: depth, + renderItem: this.props.renderItem, + focused: this.props.focused === item, + expanded: this.props.isExpanded(item), + hasChildren: !!this.props.getChildren(item).length, + onExpand: this._onExpand, + onCollapse: this._onCollapse, + onFocus: () => this._focus(i, item) + }); + }; + + var style = Object.assign({}, this.props.style || {}, { + padding: 0, + margin: 0 + }); + + return dom.div({ + className: "tree", + ref: "tree", + onKeyDown: this._onKeyDown, + onKeyPress: this._preventArrowKeyScrolling, + onKeyUp: this._preventArrowKeyScrolling, + onScroll: this._onScroll, + style + }, traversal.map((v, i) => renderItem(i))); + }, + + _preventArrowKeyScrolling(e) { + switch (e.key) { + case "ArrowUp": + case "ArrowDown": + case "ArrowLeft": + case "ArrowRight": + e.preventDefault(); + e.stopPropagation(); + if (e.nativeEvent) { + if (e.nativeEvent.preventDefault) { + e.nativeEvent.preventDefault(); + } + if (e.nativeEvent.stopPropagation) { + e.nativeEvent.stopPropagation(); + } + } + } + }, + + /** + * Updates the state's height based on clientHeight. + */ + _updateHeight() { + this.setState({ + height: this.refs.tree.clientHeight + }); + }, + + /** + * Perform a pre-order depth-first search from item. + */ + _dfs(item) { + var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity; + var traversal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var _depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + traversal.push({ item, depth: _depth }); + + if (!this.props.isExpanded(item)) { + return traversal; + } + + var nextDepth = _depth + 1; + + if (nextDepth > maxDepth) { + return traversal; + } + + var children = this.props.getChildren(item); + var length = children.length; + for (var i = 0; i < length; i++) { + this._dfs(children[i], maxDepth, traversal, nextDepth); + } + + return traversal; + }, + + /** + * Perform a pre-order depth-first search over the whole forest. + */ + _dfsFromRoots() { + var maxDepth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; + + var traversal = []; + + var roots = this.props.getRoots(); + var length = roots.length; + for (var i = 0; i < length; i++) { + this._dfs(roots[i], maxDepth, traversal); + } + + return traversal; + }, + + /** + * Expands current row. + * + * @param {Object} item + * @param {Boolean} expandAllChildren + */ + _onExpand: oncePerAnimationFrame(function (item, expandAllChildren) { + if (this.props.onExpand) { + this.props.onExpand(item); + + if (expandAllChildren) { + var children = this._dfs(item); + var length = children.length; + for (var i = 0; i < length; i++) { + this.props.onExpand(children[i].item); + } + } + } + }), + + /** + * Collapses current row. + * + * @param {Object} item + */ + _onCollapse: oncePerAnimationFrame(function (item) { + if (this.props.onCollapse) { + this.props.onCollapse(item); + } + }), + + /** + * Sets the passed in item to be the focused item. + * + * @param {Number} index + * The index of the item in a full DFS traversal (ignoring collapsed + * nodes). Ignored if `item` is undefined. + * + * @param {Object|undefined} item + * The item to be focused, or undefined to focus no item. + */ + _focus(index, item) { + if (item !== undefined) { + var itemStartPosition = index * this.props.itemHeight; + var itemEndPosition = (index + 1) * this.props.itemHeight; + + // Note that if the height of the viewport (this.state.height) is less than + // `this.props.itemHeight`, we could accidentally try and scroll both up and + // down in a futile attempt to make both the item's start and end positions + // visible. Instead, give priority to the start of the item by checking its + // position first, and then using an "else if", rather than a separate "if", + // for the end position. + if (this.state.scroll > itemStartPosition) { + this.refs.tree.scrollTop = itemStartPosition; + } else if (this.state.scroll + this.state.height < itemEndPosition) { + this.refs.tree.scrollTop = itemEndPosition - this.state.height; + } + } + + if (this.props.onFocus) { + this.props.onFocus(item); + } + }, + + /** + * Sets the state to have no focused item. + */ + _onBlur() { + this._focus(0, undefined); + }, + + /** + * Fired on a scroll within the tree's container, updates + * the stored position of the view port to handle virtual view rendering. + * + * @param {Event} e + */ + _onScroll: oncePerAnimationFrame(function (e) { + this.setState({ + scroll: Math.max(this.refs.tree.scrollTop, 0), + height: this.refs.tree.clientHeight + }); + }), + + /** + * Handles key down events in the tree's container. + * + * @param {Event} e + */ + _onKeyDown(e) { + if (this.props.focused == null) { + return; + } + + // Allow parent nodes to use navigation arrows with modifiers. + if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) { + return; + } + + this._preventArrowKeyScrolling(e); + + switch (e.key) { + case "ArrowUp": + this._focusPrevNode(); + return; + + case "ArrowDown": + this._focusNextNode(); + return; + + case "ArrowLeft": + if (this.props.isExpanded(this.props.focused) && this.props.getChildren(this.props.focused).length) { + this._onCollapse(this.props.focused); + } else { + this._focusParentNode(); + } + return; + + case "ArrowRight": + if (!this.props.isExpanded(this.props.focused)) { + this._onExpand(this.props.focused); + } + return; + } + }, + + /** + * Sets the previous node relative to the currently focused item, to focused. + */ + _focusPrevNode: oncePerAnimationFrame(function () { + // Start a depth first search and keep going until we reach the currently + // focused node. Focus the previous node in the DFS, if it exists. If it + // doesn't exist, we're at the first node already. + + var prev = void 0; + var prevIndex = void 0; + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + for (var i = 0; i < length; i++) { + var item = traversal[i].item; + if (item === this.props.focused) { + break; + } + prev = item; + prevIndex = i; + } + + if (prev === undefined) { + return; + } + + this._focus(prevIndex, prev); + }), + + /** + * Handles the down arrow key which will focus either the next child + * or sibling row. + */ + _focusNextNode: oncePerAnimationFrame(function () { + // Start a depth first search and keep going until we reach the currently + // focused node. Focus the next node in the DFS, if it exists. If it + // doesn't exist, we're at the last node already. + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + var i = 0; + + while (i < length) { + if (traversal[i].item === this.props.focused) { + break; + } + i++; + } + + if (i + 1 < traversal.length) { + this._focus(i + 1, traversal[i + 1].item); + } + }), + + /** + * Handles the left arrow key, going back up to the current rows' + * parent row. + */ + _focusParentNode: oncePerAnimationFrame(function () { + var parent = this.props.getParent(this.props.focused); + if (!parent) { + return; + } + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + var parentIndex = 0; + for (; parentIndex < length; parentIndex++) { + if (traversal[parentIndex].item === parent) { + break; + } + } + + this._focus(parentIndex, parent); + }) + }); + +/***/ }, +/* 1002 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, -/* 972 */, -/* 973 */ -/***/ function(module, exports) { +/* 1003 */, +/* 1004 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = simplifyDisplayName; + + var _react = __webpack_require__(2); + + var _devtoolsConfig = __webpack_require__(828); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var ReactDOM = __webpack_require__(22); + + + var breakpointSvg = document.createElement("div"); + ReactDOM.render((0, _Svg2.default)("breakpoint"), breakpointSvg); + + function makeBookmark() { + var widget = document.createElement("span"); + widget.innerText = "+"; + widget.classList.add("inline-bp"); + return widget; + } + + class ColumnBreakpoint extends _react.Component { + + constructor() { + super(); + + this.bookmark = undefined; + var self = this; + self.addBreakpoint = this.addBreakpoint.bind(this); + } + + addBreakpoint() { + if (!(0, _devtoolsConfig.isEnabled)("columnBreakpoints")) { + return; + } + + var bp = this.props.breakpoint; + var line = bp.location.line - 1; + var column = bp.location.column; + var editor = this.props.editor; + + var widget = makeBookmark(); + var bookmark = editor.setBookmark({ line, ch: column }, { widget }); + this.bookmark = bookmark; + } + shouldComponentUpdate(nextProps) { + return this.props.editor !== nextProps.editor || this.props.breakpoint.disabled !== nextProps.breakpoint.disabled || this.props.breakpoint.condition !== nextProps.breakpoint.condition; + } + componentDidMount() { + if (!this.props.editor) { + return; + } + + this.addBreakpoint(); + } + componentDidUpdate() { + this.addBreakpoint(); + } + componentWillUnmount() { + if (!this.props.editor || !this.bookmark) { + return; + } + + this.bookmark.clear(); + } + render() { + return null; + } + } + + ColumnBreakpoint.propTypes = { + breakpoint: _react.PropTypes.object.isRequired, + editor: _react.PropTypes.object.isRequired + }; + + ColumnBreakpoint.displayName = "ColumnBreakpoint"; + + exports.default = ColumnBreakpoint; + +/***/ }, +/* 1005 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _redux = __webpack_require__(3); + + var _reactRedux = __webpack_require__(151); + + var _Frame = __webpack_require__(1006); + + var _Frame2 = _interopRequireDefault(_Frame); + + var _Group2 = __webpack_require__(1008); + + var _Group3 = _interopRequireDefault(_Group2); + + var _actions = __webpack_require__(244); + + var _actions2 = _interopRequireDefault(_actions); + + var _frame = __webpack_require__(1007); + + var _selectors = __webpack_require__(242); + + __webpack_require__(1011); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + // NOTE: using require because `import get` breaks atom's syntax highlighting + var get = __webpack_require__(67); + + var FrameComponent = (0, _react.createFactory)(_Frame2.default); + + var Group = (0, _react.createFactory)(_Group3.default); + + var NUM_FRAMES_SHOWN = 7; + + class Frames extends _react.Component { + + constructor() { + super(...arguments); + + this.state = { + showAllFrames: false + }; + + this.toggleFramesDisplay = this.toggleFramesDisplay.bind(this); + } + + shouldComponentUpdate(nextProps, nextState) { + var _props = this.props, + frames = _props.frames, + selectedFrame = _props.selectedFrame; + var showAllFrames = this.state.showAllFrames; + + return frames !== nextProps.frames || selectedFrame !== nextProps.selectedFrame || showAllFrames !== nextState.showAllFrames; + } + + toggleFramesDisplay() { + this.setState({ + showAllFrames: !this.state.showAllFrames + }); + } + + truncateFrames(frames) { + var numFramesToShow = this.state.showAllFrames ? frames.length : NUM_FRAMES_SHOWN; + + return frames.slice(0, numFramesToShow); + } + + renderFrames(frames) { + var _props2 = this.props, + selectFrame = _props2.selectFrame, + selectedFrame = _props2.selectedFrame; + + + var framesOrGroups = this.truncateFrames((0, _frame.collapseFrames)(frames)); + + return _react.DOM.ul({}, framesOrGroups.map(frameOrGroup => frameOrGroup.id ? FrameComponent({ + frame: frameOrGroup, + frames, + selectFrame, + selectedFrame, + key: frameOrGroup.id + }) : Group({ + group: frameOrGroup, + selectFrame, + selectedFrame, + key: frameOrGroup[0].id + }))); + } + + renderToggleButton(frames) { + var buttonMessage = this.state.showAllFrames ? L10N.getStr("callStack.collapse") : L10N.getStr("callStack.expand"); + + frames = (0, _frame.collapseFrames)(frames); + if (frames.length < NUM_FRAMES_SHOWN) { + return null; + } + + return _react.DOM.div({ className: "show-more", onClick: this.toggleFramesDisplay }, buttonMessage); + } + + render() { + var frames = this.props.frames; + + + if (!frames) { + return _react.DOM.div({ className: "pane frames" }, _react.DOM.div({ className: "pane-info empty" }, L10N.getStr("callStack.notPaused"))); + } + + return _react.DOM.div({ className: "pane frames" }, this.renderFrames(frames), this.renderToggleButton(frames)); + } + } + + Frames.propTypes = { + frames: _react.PropTypes.array, + selectedFrame: _react.PropTypes.object, + selectFrame: _react.PropTypes.func.isRequired + }; + + Frames.displayName = "Frames"; + + function getSourceForFrame(state, frame) { + return (0, _selectors.getSource)(state, frame.location.sourceId); + } + + function appendSource(state, frame) { + return Object.assign({}, frame, { + source: getSourceForFrame(state, frame).toJS() + }); + } + + function getAndProcessFrames(state) { + var frames = (0, _selectors.getFrames)(state); + if (!frames) { + return null; + } + + frames = frames.toJS().filter(frame => getSourceForFrame(state, frame)).filter(frame => !get(frame, "source.isBlackBoxed")).map(frame => appendSource(state, frame)).map(_frame.annotateFrame); + + // frames = filterFrameworkFrames(frames); + return frames; + } + + exports.default = (0, _reactRedux.connect)(state => ({ + frames: getAndProcessFrames(state), + selectedFrame: (0, _selectors.getSelectedFrame)(state) + }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Frames); + +/***/ }, +/* 1006 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _devtoolsLaunchpad = __webpack_require__(131); + + var _classnames = __webpack_require__(175); + + var _classnames2 = _interopRequireDefault(_classnames); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + var _clipboard = __webpack_require__(423); + + var _frame = __webpack_require__(1007); + + var _source = __webpack_require__(233); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function renderFrameTitle(frame, options) { + var displayName = (0, _frame.formatDisplayName)(frame, options); + return _react.DOM.div({ className: "title" }, displayName); + } + + + function renderFrameLocation(_ref) { + var source = _ref.source, + location = _ref.location, + library = _ref.library; + + if (!source) { + return; + } + + if (library) { + return _react.DOM.div({ className: "location" }, library, (0, _Svg2.default)(library.toLowerCase(), { className: "annotation-logo" })); + } + + var filename = (0, _source.getFilename)(source); + return _react.DOM.div({ className: "location" }, `${filename}: ${location.line}`); + } + + class FrameComponent extends _react.Component { + + constructor() { + super(...arguments); + } + + onContextMenu(event, frame, frames) { + var copySourceUrlLabel = L10N.getStr("copySourceUrl"); + var copySourceUrlKey = L10N.getStr("copySourceUrl.accesskey"); + var copyStackTraceLabel = L10N.getStr("copyStackTrace"); + var copyStackTraceKey = L10N.getStr("copyStackTrace.accesskey"); + + event.stopPropagation(); + event.preventDefault(); + + var menuOptions = []; + + var source = frame.source; + if (source) { + var copySourceUrl = { + id: "node-menu-copy-source", + label: copySourceUrlLabel, + accesskey: copySourceUrlKey, + disabled: false, + click: () => (0, _clipboard.copyToTheClipboard)(source.url) + }; + + menuOptions.push(copySourceUrl); + } + + var framesToCopy = frames.map(f => (0, _frame.formatCopyName)(f)).join("\n"); + var copyStackTrace = { + id: "node-menu-copy-source", + label: copyStackTraceLabel, + accesskey: copyStackTraceKey, + disabled: false, + click: () => (0, _clipboard.copyToTheClipboard)(framesToCopy) + }; + + menuOptions.push(copyStackTrace); + + (0, _devtoolsLaunchpad.showMenu)(event, menuOptions); + } + + onMouseDown(e, frame, selectedFrame) { + if (e.nativeEvent.which == 3 && selectedFrame.id != frame.id) { + return; + } + this.props.selectFrame(frame); + } + + onKeyUp(event, frame, selectedFrame) { + if (event.key != "Enter" || selectedFrame.id == frame.id) { + return; + } + this.props.selectFrame(frame); + } + + render() { + var _props = this.props, + frame = _props.frame, + frames = _props.frames, + selectedFrame = _props.selectedFrame, + hideLocation = _props.hideLocation, + shouldMapDisplayName = _props.shouldMapDisplayName; + + + return _react.DOM.li({ + key: frame.id, + className: (0, _classnames2.default)("frame", { + selected: selectedFrame && selectedFrame.id === frame.id + }), + onMouseDown: e => this.onMouseDown(e, frame, selectedFrame), + onKeyUp: e => this.onKeyUp(e, frame, selectedFrame), + onContextMenu: e => this.onContextMenu(e, frame, frames), + tabIndex: 0 + }, renderFrameTitle(frame, { shouldMapDisplayName }), !hideLocation ? renderFrameLocation(frame) : null); + } + } + + exports.default = FrameComponent; + FrameComponent.propTypes = { + frame: _react.PropTypes.object.isRequired, + frames: _react.PropTypes.array, + selectedFrame: _react.PropTypes.object, + selectFrame: _react.PropTypes.func.isRequired, + hideLocation: _react.PropTypes.bool, + shouldMapDisplayName: _react.PropTypes.bool + }; + + FrameComponent.defaultProps = { + hideLocation: false, + shouldMapDisplayName: true + }; + + FrameComponent.displayName = "Frame"; + +/***/ }, +/* 1007 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getLibraryFromUrl = getLibraryFromUrl; + exports.annotateFrame = annotateFrame; + exports.simplifyDisplayName = simplifyDisplayName; + exports.formatDisplayName = formatDisplayName; + exports.formatCopyName = formatCopyName; + exports.collapseFrames = collapseFrames; + + var _devtoolsConfig = __webpack_require__(828); + + var _utils = __webpack_require__(234); + + var _source = __webpack_require__(233); + + var _findIndex = __webpack_require__(262); + + var _findIndex2 = _interopRequireDefault(_findIndex); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var get = __webpack_require__(67); + + + function getFrameUrl(frame) { + return get(frame, "source.url", "") || ""; + } + + function isBackbone(frame) { + return getFrameUrl(frame).match(/backbone/i); + } + + function isJQuery(frame) { + return getFrameUrl(frame).match(/jquery/i); + } + + function isReact(frame) { + return getFrameUrl(frame).match(/react/i); + } + + function isWebpack(frame) { + return getFrameUrl(frame).match(/webpack\/bootstrap/i); + } + + function getLibraryFromUrl(frame) { + if (isBackbone(frame)) { + return "Backbone"; + } + + if (isJQuery(frame)) { + return "jQuery"; + } + + if (isReact(frame)) { + return "React"; + } + + if (isWebpack(frame)) { + return "Webpack"; + } + } + + var displayNameMap = { + Backbone: { + "extend/child": "Create Class", + ".create": "Create Model" + }, + jQuery: { + "jQuery.event.dispatch": "Dispatch Event" + }, + React: { + // eslint-disable-next-line max-len + "ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext/renderedElement<": "Render" + }, + Webpack: { + // eslint-disable-next-line camelcase + __webpack_require__: "Bootstrap" + } + }; + + function mapDisplayNames(frame, library) { + var map = displayNameMap[library]; + var displayName = frame.displayName; + + return map && map[displayName] || displayName; + } + + function annotateFrame(frame) { + if (!(0, _devtoolsConfig.isEnabled)("collapseFrame")) { + return frame; + } + + var library = getLibraryFromUrl(frame); + if (library) { + return Object.assign({}, frame, { library }); + } + + return frame; + } + // Decodes an anonymous naming scheme that // spider monkey implements based on "Naming Anonymous JavaScript Functions" // http://johnjbarton.github.io/nonymous/index.html @@ -71099,6 +47277,11 @@ return /******/ (function(modules) { // webpackBootstrap var annonymousProperty = /([\w\d]+)\(\^\)$/; function simplifyDisplayName(displayName) { + // if the display name has a space it has already been mapped + if (/\s/.exec(displayName)) { + return displayName; + } + var scenarios = [objectProperty, arrayProperty, functionProperty, annonymousProperty]; for (var reg of scenarios) { @@ -71111,6 +47294,201 @@ return /******/ (function(modules) { // webpackBootstrap return displayName; } + function formatDisplayName(frame) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$shouldMapDisplay = _ref.shouldMapDisplayName, + shouldMapDisplayName = _ref$shouldMapDisplay === undefined ? true : _ref$shouldMapDisplay; + + var displayName = frame.displayName, + library = frame.library; + + if (library && shouldMapDisplayName) { + displayName = mapDisplayNames(frame, library); + } + + displayName = simplifyDisplayName(displayName); + return (0, _utils.endTruncateStr)(displayName, 25); + } + + function formatCopyName(frame) { + var displayName = formatDisplayName(frame); + var fileName = (0, _source.getFilename)(frame.source); + var frameLocation = frame.location.line; + + return `${displayName} (${fileName}#${frameLocation})`; + } + + function collapseFrames(frames) { + // We collapse groups of one so that user frames + // are not in a group of one + function addGroupToList(group, list) { + if (!group) { + return list; + } + + if (group.length > 1) { + list.push(group); + } else { + list = list.concat(group); + } + + return list; + } + + var _collapseLastFrames = collapseLastFrames(frames), + newFrames = _collapseLastFrames.newFrames, + lastGroup = _collapseLastFrames.lastGroup; + + frames = newFrames; + var items = []; + var currentGroup = null; + var prevItem = null; + for (var frame of frames) { + var prevLibrary = get(prevItem, "library"); + + if (!currentGroup) { + currentGroup = [frame]; + } else if (prevLibrary && prevLibrary == frame.library) { + currentGroup.push(frame); + } else { + items = addGroupToList(currentGroup, items); + currentGroup = [frame]; + } + + prevItem = frame; + } + + items = addGroupToList(currentGroup, items); + items = addGroupToList(lastGroup, items); + return items; + } + + function collapseLastFrames(frames) { + var index = (0, _findIndex2.default)(frames, isWebpack); + + if (index == -1) { + return { newFrames: frames, lastGroup: [] }; + } + + var newFrames = frames.slice(0, index); + var lastGroup = frames.slice(index); + return { newFrames, lastGroup }; + } + +/***/ }, +/* 1008 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _classnames = __webpack_require__(175); + + var _classnames2 = _interopRequireDefault(_classnames); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + var _frame = __webpack_require__(1007); + + __webpack_require__(1009); + + var _Frame = __webpack_require__(1006); + + var _Frame2 = _interopRequireDefault(_Frame); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var FrameComponent = (0, _react.createFactory)(_Frame2.default); + + function renderFrameLocation(frame) { + var library = (0, _frame.getLibraryFromUrl)(frame); + if (!library) { + return null; + } + + return _react.DOM.div({ className: "location" }, library, (0, _Svg2.default)(library.toLowerCase(), { className: "annotation-logo" })); + } + + class Group extends _react.Component { + + constructor() { + super(...arguments); + this.state = { expanded: false }; + var self = this; + + self.toggleFrames = this.toggleFrames.bind(this); + } + + toggleFrames() { + this.setState({ expanded: !this.state.expanded }); + } + + renderFrames() { + var _props = this.props, + group = _props.group, + selectFrame = _props.selectFrame, + selectedFrame = _props.selectedFrame; + var expanded = this.state.expanded; + + if (!expanded) { + return null; + } + return _react.DOM.div({ className: "frames-list" }, group.map(frame => FrameComponent({ + frame, + selectFrame, + selectedFrame, + key: frame.id, + hideLocation: true, + shouldMapDisplayName: false + }))); + } + + renderDescription() { + var frame = this.props.group[0]; + var displayName = (0, _frame.formatDisplayName)(frame); + return _react.DOM.li({ + key: frame.id, + className: (0, _classnames2.default)("group"), + onClick: this.toggleFrames, + tabIndex: 0 + }, _react.DOM.div({ className: "title" }, displayName), renderFrameLocation(frame)); + } + + render() { + var expanded = this.state.expanded; + + return _react.DOM.div({ className: (0, _classnames2.default)("frames-group", { expanded }) }, this.renderDescription(), this.renderFrames()); + } + } + + exports.default = Group; + Group.propTypes = { + group: _react.PropTypes.array.isRequired, + selectFrame: _react.PropTypes.func.isRequired, + selectedFrame: _react.PropTypes.object + }; + Group.displayName = "Group"; + +/***/ }, +/* 1009 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 1010 */, +/* 1011 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + /***/ } /******/ ]) }); diff --git a/devtools/client/debugger/new/index.html b/devtools/client/debugger/new/index.html index bec8bbd5ff10..b91308809651 100644 --- a/devtools/client/debugger/new/index.html +++ b/devtools/client/debugger/new/index.html @@ -17,7 +17,7 @@
- + +

Returns

+ + + + + + + + + +

Throws

+ + + + + + + + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html new file mode 100644 index 000000000000..dc3a28f8c8b1 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html @@ -0,0 +1,17 @@ + + + + + + + Debugger test page - Mutate object + + + + + + + + + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html index 14cc86701aca..68eccbd87023 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html @@ -6,16 +6,17 @@ Debugger test page - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js b/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js new file mode 100644 index 000000000000..c47a523d60e6 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js @@ -0,0 +1,20 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +function mutate() { + const phonebook = { + S: { + sarah: { + lastName: "Doe" + }, + serena: { + lastName: "Williams" + } + } + }; + + debugger; + phonebook.S.sarah.lastName = "Pierce"; + debugger; + phonebook.S.sarah.timezone = "PST"; + debugger; +} diff --git a/devtools/client/debugger/new/test/mochitest/head.js b/devtools/client/debugger/new/test/mochitest/head.js index 7b551a2887d7..22548da4c738 100644 --- a/devtools/client/debugger/new/test/mochitest/head.js +++ b/devtools/client/debugger/new/test/mochitest/head.js @@ -38,7 +38,8 @@ Services.scriptloader.loadSubScript( this ); var { Toolbox } = require("devtools/client/framework/toolbox"); -const EXAMPLE_URL = "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/"; +const EXAMPLE_URL = + "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/"; Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true); @@ -336,7 +337,7 @@ window.resumeTest = undefined; */ function pauseTest() { info("Test paused. Invoke resumeTest to continue."); - return new Promise(resolve => resumeTest = resolve); + return new Promise(resolve => (resumeTest = resolve)); } // Actions @@ -563,12 +564,12 @@ const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true }; // On Mac, going to beginning/end only works with meta+left/right. On // Windows, it only works with home/end. On Linux, apparently, either // ctrl+left/right or home/end work. -const endKey = isMac ? - { code: "VK_RIGHT", modifiers: cmdOrCtrl } : - { code: "VK_END" }; -const startKey = isMac ? - { code: "VK_LEFT", modifiers: cmdOrCtrl } : - { code: "VK_HOME" }; +const endKey = isMac + ? { code: "VK_RIGHT", modifiers: cmdOrCtrl } + : { code: "VK_END" }; +const startKey = isMac + ? { code: "VK_LEFT", modifiers: cmdOrCtrl } + : { code: "VK_HOME" }; const keyMappings = { sourceSearch: { code: "p", modifiers: cmdOrCtrl }, fileSearch: { code: "f", modifiers: cmdOrCtrl }, @@ -622,16 +623,14 @@ function isVisibleWithin(outerEl, innerEl) { const selectors = { callStackHeader: ".call-stack-pane ._header", callStackBody: ".call-stack-pane .pane", - expressionNode: i => - `.expressions-list .tree-node:nth-child(${i}) .object-label`, - expressionValue: i => - `.expressions-list .tree-node:nth-child(${i}) .object-value`, - expressionClose: i => - `.expressions-list .expression-container:nth-child(${i}) .close`, + expressionNode: i => `.expressions-list .tree-node:nth-child(${i}) .object-label`, + expressionValue: i => `.expressions-list .tree-node:nth-child(${i}) .object-value`, + expressionClose: i => `.expressions-list .expression-container:nth-child(${i}) .close`, expressionNodes: ".expressions-list .tree-node", scopesHeader: ".scopes-pane ._header", breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`, scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`, + scopeValue: i => `.scopes-list .tree-node:nth-child(${i}) .object-value`, frame: i => `.frames ul li:nth-child(${i})`, frames: ".frames ul li", gutter: i => `.CodeMirror-code *:nth-child(${i}) .CodeMirror-linenumber`, diff --git a/devtools/client/locales/en-US/debugger.properties b/devtools/client/locales/en-US/debugger.properties index 2c579a0addb8..ef515810a2b8 100644 --- a/devtools/client/locales/en-US/debugger.properties +++ b/devtools/client/locales/en-US/debugger.properties @@ -22,6 +22,14 @@ copySourceUrl=Copy Source Url # the context menu. copySourceUrl.accesskey=u +# LOCALIZATION NOTE (copyStackTrace): This is the text that appears in the +# context menu to copy the stack trace methods, file names and row number. +copyStackTrace=Copy Stack Trace + +# LOCALIZATION NOTE (copyStackTrace.accesskey): Access key to copy the stack trace data from +# the context menu. +copyStackTrace.accesskey=c + # LOCALIZATION NOTE (expandPanes): This is the tooltip for the button # that expands the left and right panes in the debugger UI. expandPanes=Expand panes @@ -128,10 +136,6 @@ sources.search.key=P # does not have any sources. sources.noSourcesAvailable=This page has no sources -# LOCALIZATION NOTE (sources.searchAlt.key): Alternate key shortcut to open -# the search for searching all the source files the debugger has seen. -sources.searchAlt.key=O - # LOCALIZATION NOTE (sourceSearch.search.key): Key shortcut to open the search # for searching within a the currently opened files in the editor sourceSearch.search.key=F @@ -246,6 +250,14 @@ editor.singleResult=1 result # for when no results found. editor.noResults=no results +# LOCALIZATION NOTE (editor.searchResults.nextResult): Editor Search bar +# tooltip for traversing to the Next Result +editor.searchResults.nextResult=Next Result + +# LOCALIZATION NOTE (editor.searchResults.prevResult): Editor Search bar +# tooltip for traversing to the Previous Result +editor.searchResults.prevResult=Previous Result + # LOCALIZATION NOTE (editor.searchTypeToggleTitle): Search bar title for # toggling search type buttons(function search, variable search) editor.searchTypeToggleTitle=Search for: