diff --git a/devtools/client/debugger/new/debugger.css b/devtools/client/debugger/new/debugger.css index b374aba1d9e6..51442a38a23d 100644 --- a/devtools/client/debugger/new/debugger.css +++ b/devtools/client/debugger/new/debugger.css @@ -106,7 +106,6 @@ border-bottom: 1px solid var(--theme-splitter-color); padding: calc(var(--base-spacing) / 2) var(--base-spacing); font-family: sans-serif; - cursor: pointer; } .landing-page .tab-sides { @@ -137,6 +136,7 @@ .landing-page .tab.active { background: var(--theme-selection-background); color: var(--theme-selection-color); + cursor: pointer; transition: var(--base-transition); } @@ -468,8 +468,11 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} cursor: default; z-index: 4; } -.CodeMirror-gutter-wrapper ::selection { background-color: transparent } -.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } +.CodeMirror-gutter-wrapper { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} .CodeMirror-lines { cursor: text; @@ -514,8 +517,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} .CodeMirror-widget {} -.CodeMirror-rtl pre { direction: rtl; } - .CodeMirror-code { outline: none; } @@ -583,6 +584,10 @@ div.CodeMirror-dragcursors { /* Help users use markselection to safely style text background */ span.CodeMirror-selectedtext { background: none; } +/* 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/. */ + :root { /* --breakpoint-background: url("chrome://devtools/skin/images/breakpoint.svg#light"); */ /* --breakpoint-hover-background: url("chrome://devtools/skin/images/breakpoint.svg#light-hover"); */ @@ -594,7 +599,7 @@ span.CodeMirror-selectedtext { background: none; } .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: rgba(0,255,175,.4); --breakpoint-active-color-hover: rgba(0,255,175,.7); /* --breakpoint-conditional-background: url("chrome://devtools/skin/images/breakpoint.svg#dark-conditional"); */ } @@ -771,64 +776,23 @@ selector in floating-scrollbar-light.css across all platforms. */ } .CodeMirror-foldgutter { - width: 10px; + width: 16px; /* Same as breakpoints gutter above */ } .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 { + font-size: 120%; + content: "\25BE"; } -.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-foldgutter-folded:after { + font-size: 120%; + content: "\25B8"; } .CodeMirror-hints { @@ -1034,6 +998,94 @@ menuseparator { * 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/. */ +.split-box { + display: flex; + flex: 1; + min-width: 0; + height: 100%; + width: 100%; +} + +.split-box.vert { + flex-direction: row; +} + +.split-box.horz { + flex-direction: column; +} + +.split-box > .uncontrolled { + display: flex; + flex: 1; + min-width: 0; + overflow: auto; +} + +.split-box > .controlled { + display: flex; + overflow: auto; +} + +.split-box > .splitter { + background-image: none; + border: 0; + border-style: solid; + border-color: transparent; + background-color: var(--theme-splitter-color); + background-clip: content-box; + position: relative; + + box-sizing: border-box; + + /* Positive z-index positions the splitter on top of its siblings and makes + it clickable on both sides. */ + z-index: 1; +} + +.split-box.vert > .splitter { + min-width: calc(var(--devtools-splitter-inline-start-width) + + var(--devtools-splitter-inline-end-width) + 1px); + + border-left-width: var(--devtools-splitter-inline-start-width); + border-right-width: var(--devtools-splitter-inline-end-width); + + margin-left: calc(-1 * var(--devtools-splitter-inline-start-width) - 1px); + margin-right: calc(-1 * var(--devtools-splitter-inline-end-width)); + + cursor: ew-resize; +} + +.split-box.horz > .splitter { + min-height: calc(var(--devtools-splitter-top-width) + + var(--devtools-splitter-bottom-width) + 1px); + + border-top-width: var(--devtools-splitter-top-width); + border-bottom-width: var(--devtools-splitter-bottom-width); + + margin-top: calc(-1 * var(--devtools-splitter-top-width) - 1px); + margin-bottom: calc(-1 * var(--devtools-splitter-bottom-width)); + + cursor: ns-resize; +} + +.split-box.disabled { + pointer-events: none; +} + +/** + * Make sure splitter panels are not processing any mouse + * events. This is good for performance during splitter + * bar dragging. + */ +.split-box.dragging > .controlled, +.split-box.dragging > .uncontrolled { + pointer-events: none; +} +/* 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/. */ + .theme-dark, .theme-light { --number-color: var(--theme-highlight-green); @@ -1210,94 +1262,6 @@ menuseparator { .theme-light .caption { font-weight: normal; } -/* 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/. */ - -.split-box { - display: flex; - flex: 1; - min-width: 0; - height: 100%; - width: 100%; -} - -.split-box.vert { - flex-direction: row; -} - -.split-box.horz { - flex-direction: column; -} - -.split-box > .uncontrolled { - display: flex; - flex: 1; - min-width: 0; - overflow: auto; -} - -.split-box > .controlled { - display: flex; - overflow: auto; -} - -.split-box > .splitter { - background-image: none; - border: 0; - border-style: solid; - border-color: transparent; - background-color: var(--theme-splitter-color); - background-clip: content-box; - position: relative; - - box-sizing: border-box; - - /* Positive z-index positions the splitter on top of its siblings and makes - it clickable on both sides. */ - z-index: 1; -} - -.split-box.vert > .splitter { - min-width: calc(var(--devtools-splitter-inline-start-width) + - var(--devtools-splitter-inline-end-width) + 1px); - - border-left-width: var(--devtools-splitter-inline-start-width); - border-right-width: var(--devtools-splitter-inline-end-width); - - margin-left: calc(-1 * var(--devtools-splitter-inline-start-width) - 1px); - margin-right: calc(-1 * var(--devtools-splitter-inline-end-width)); - - cursor: ew-resize; -} - -.split-box.horz > .splitter { - min-height: calc(var(--devtools-splitter-top-width) + - var(--devtools-splitter-bottom-width) + 1px); - - border-top-width: var(--devtools-splitter-top-width); - border-bottom-width: var(--devtools-splitter-bottom-width); - - margin-top: calc(-1 * var(--devtools-splitter-top-width) - 1px); - margin-bottom: calc(-1 * var(--devtools-splitter-bottom-width)); - - cursor: ns-resize; -} - -.split-box.disabled { - pointer-events: none; -} - -/** - * Make sure splitter panels are not processing any mouse - * events. This is good for performance during splitter - * bar dragging. - */ -.split-box.dragging > .controlled, -.split-box.dragging > .uncontrolled { - pointer-events: none; -} .search-container { position: absolute; @@ -1389,34 +1353,6 @@ html .arrow.expanded svg { .arrow.hidden { visibility: hidden; } - -.autocomplete { - flex: 1; - width: 100%; -} - -.autocomplete .no-result-msg { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; - color: var(--theme-graphs-full-red); - font-size: 24px; - padding: 4px; - word-break: break-all; -} - -.autocomplete .no-result-msg .sad-face { - width: 24px; - margin: 0 4px; - line-height: 0; - flex-shrink: 0; -} - -.autocomplete .no-result-msg .sad-face svg { - fill: var(--theme-graphs-full-red); -} .close-btn path { fill: var(--theme-comment-alt); } @@ -1425,13 +1361,11 @@ html .arrow.expanded svg { cursor: pointer; width: 14px; height: 14px; - transition: all 0.25s ease-in-out; - border: 1px solid transparent; - border-radius: 2px; - padding: 0; - margin-top: 0; - display: inline-flex; - justify-content: center; + padding: 2px; + text-align: center; + margin-top: 2px; + line-height: 7px; + transition: all 0.25s easeinout; } .close-btn .close svg { @@ -1444,26 +1378,38 @@ html .arrow.expanded svg { .close-btn:hover .close { background: var(--theme-selection-background); + border-radius: 2px; } .close-btn:hover .close path { fill: white; } -.close-btn.big { +.close-btn-big { padding: 11px; margin-right: 7px; width: 27px; height: 40px; } -.close-btn.big .close { +.close-btn-big .close { + cursor: pointer; + display: inline-block; + padding: 2px; + text-align: center; + transition: all 0.25s easeinout; + line-height: 100%; width: 16px; height: 16px; } -.close-btn.big .close svg { +.close-btn-big .close svg { width: 9px; + height: 9px; +} + +.close-btn-big .close:hover { + border-radius: 2px; } .search-field { @@ -1529,6 +1475,10 @@ html .arrow.expanded svg { stroke: var(--theme-splitter-color); } +.search-field ::-webkit-input-placeholder { + color: var(--theme-body-color-inactive); +} + .search-field input::placeholder { color: var(--theme-body-color-inactive); } @@ -1551,26 +1501,6 @@ html .arrow.expanded svg { color: var(--theme-body-color-inactive); } -.search-field .search-nav-buttons { - display: flex; - user-select: none; -} - -.search-field .search-nav-buttons .nav-btn { - display: flex; - height: 100%; - border-radius: 50%; -} - -.search-field .search-nav-buttons .nav-btn:hover path, -.search-field .search-nav-buttons .nav-btn:active path { - fill: var(--theme-comment-alt); -} - -.search-field .search-nav-buttons .nav-btn path { - fill: var(--theme-comment); -} - .result-list { list-style: none; width: 100%; @@ -1659,6 +1589,76 @@ html .arrow.expanded svg { .theme-dark .result-list { background-color: var(--theme-body-background); } + +.autocomplete { + flex: 1; + width: 100%; +} + +.autocomplete .no-result-msg { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + color: var(--theme-graphs-full-red); + font-size: 24px; + padding: 4px; + word-break: break-all; +} + +.autocomplete .no-result-msg .sad-face { + width: 24px; + margin: 0 4px; + line-height: 0; + flex-shrink: 0; +} + +.autocomplete .no-result-msg .sad-face svg { + fill: var(--theme-graphs-full-red); +} +.tree { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + + white-space: nowrap; + overflow: auto; + min-width: 100%; +} + +.tree button { + display: block; +} + +.tree .node { + padding: 2px 5px; + position: relative; + cursor: pointer; +} + +.tree .node.focused { + color: white; + background-color: var(--theme-selection-background); +} + +html:not([dir="rtl"]) .tree .node > div { + margin-left: 10px; +} + +html[dir="rtl"] .tree .node > div { + margin-right: 10px; +} + +.tree .node.focused svg { + fill: white; +} + +.tree-node button { + position: fixed; +} .sources-panel { flex: 1; display: flex; @@ -1715,55 +1715,338 @@ html .arrow.expanded svg { .theme-dark .source-list .tree .node.focused { background-color: var(--theme-tab-toolbar-background); } - -.no-sources-message { - font-size: 12px; - color: var(--theme-comment-alt); - font-weight: lighter; - padding-top: 5px; - text-align: center; +.toggle-button-start, +.toggle-button-end { + transform: translate(0, 2px); + transition: transform 0.25s ease-in-out; + cursor: pointer; + padding: 4px 2px; } -.tree { - -webkit-user-select: none; + +.toggle-button-start svg, +.toggle-button-end svg { + width: 16px; + fill: var(--theme-comment); +} + +.theme-dark .toggle-button-start svg, +.theme-dark .toggle-button-end svg { + fill: var(--theme-comment-alt); +} + +.toggle-button-end { + margin-left: auto; + margin-right: 5px; +} + +.toggle-button-start { + margin-left: 5px; +} + +html:not([dir="rtl"]) .toggle-button-end svg, +html[dir="rtl"] .toggle-button-start svg { + transform: rotate(180deg); +} + +html .toggle-button-end.vertical svg { + transform: rotate(-90deg); +} + +.toggle-button-end.vertical { + margin-bottom: 2px; +} + +.toggle-button-start.collapsed, +.toggle-button-end.collapsed { + transform: rotate(180deg); +} + +.source-footer { + background: var(--theme-toolbar-background); + border-top: 1px solid var(--theme-splitter-color); + position: absolute; + display: flex; + bottom: 0; + left: 0; + right: 1px; + opacity: 1; + z-index: 100; -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; user-select: none; - - white-space: nowrap; - overflow: auto; - min-width: 100%; + height: 27px; + box-sizing: border-box; } -.tree button { - display: block; +.source-footer .commands { + display: flex; } -.tree .node { - padding: 2px 5px; - position: relative; +.source-footer .commands * { + -moz-user-select: none; + user-select: none; +} + +.source-footer > .commands > .action { + cursor: pointer; + display: flex; + justify-content: center; + align-items: center; + transition: opacity 200ms; + border: none; + background: transparent; + padding: 8px 0.7em; +} + +.source-footer > .commands > .action i { + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; +} + +:root.theme-dark .source-footer > .commands > .action { + fill: var(--theme-body-color); +} + +:root.theme-dark .source-footer > .commands > .action:hover { + fill: var(--theme-selection-color); +} + +.source-footer > .commands > .action svg { + height: 16px; + width: 16px; +} + +.source-footer .commands .coverage { + color: var(--theme-body-color); +} + +.coverage-on .source-footer .commands .coverage { + color: var(--theme-highlight-blue); + border: 1px solid var(--theme-body-color-inactive); + border-radius: 2px; +} + +.search-bar { + display: flex; + flex-direction: column; + max-height: 50%; +} + +.search-bar .search-field { + padding-left: 7px; +} + +.search-bar .close-btn { + padding: 6px; +} + +.search-bottom-bar * { + -moz-user-select: none; + user-select: none; +} + +.search-bottom-bar { + display: flex; + flex-shrink: 0; + justify-content: space-between; + width: calc(100% - 1px); + height: 27px; + background-color: var(--theme-toolbar-background); + border-bottom: 1px solid var(--theme-splitter-color); + padding: 0 13px; +} + +.search-bottom-bar button:focus { + outline: none; +} + +.search-bottom-bar .search-modifiers { + display: flex; + align-items: center; +} + +.search-bottom-bar .search-modifiers button { + padding: 0 3px; + margin: 0 3px; + border: none; + background: none; + width: 20px; + height: 20px; + border-radius: 3px; +} + +.search-bottom-bar .search-modifiers button i { + display: flex; + justify-content: center; + align-items: center; + padding: 0; + width: 16px; +} + +.search-bottom-bar .search-modifiers button svg { + fill: var(--theme-comment-alt); + height: 16px; + width: 16px; +} + +.search-bottom-bar .search-modifiers button svg:hover { cursor: pointer; } -.tree .node.focused { - color: white; - background-color: var(--theme-selection-background); +.search-bottom-bar .search-modifiers button:active { + outline: none; } -html:not([dir="rtl"]) .tree .node > div { - margin-left: 10px; +.search-bottom-bar .search-modifiers button.active svg { + fill: var(--theme-selection-background); } -html[dir="rtl"] .tree .node > div { - margin-right: 10px; -} - -.tree .node.focused svg { +.theme-dark .search-bottom-bar .search-modifiers button.active svg { fill: white; } -.tree-node button { +.search-bottom-bar .search-modifiers button.disabled svg { + fill: var(--theme-comment-alt); +} + +.search-bottom-bar .search-type-toggles { + display: flex; + align-items: center; +} + +.search-bottom-bar .search-type-toggles .search-toggle-title { + color: var(--theme-body-color-inactive); + font-size: 11px; + font-weight: normal; + margin: 0; +} + +.search-bottom-bar .search-type-toggles .search-type-btn { + margin: 0 6px; + border: none; + background: transparent; + color: var(--theme-comment-alt); +} + +.search-bottom-bar .search-type-toggles .search-type-btn:hover { + cursor: pointer; +} + +.search-bottom-bar .search-type-toggles .search-type-btn:active { + outline: none; +} + +.search-bottom-bar .search-type-toggles .search-type-btn.active { + color: var(--theme-selection-background); +} + +.theme-dark .search-bottom-bar .search-type-toggles .search-type-btn.active { + color: white; +} + +.search-bar .result-list { + max-height: 230px; +} +.popover { position: fixed; + z-index: 4; +} + +.popover-gap { + height: 10px; + padding-top: 10px; +} + +.popover::before, +.popover::after { + content: ''; + height: 0; + width: 0; + position: absolute; + border: 10px solid transparent; + left: calc(20% - 10px); /* corresponds to calculation in Popover.js */ +} + +.popover::before { + border-bottom-color: var(--theme-comment); + top: -10px; +} + +.popover::after { + border-bottom-color: var(--theme-body-background); + top: -8px; +} +.preview { + background: var(--theme-body-background); + min-width: 200px; + min-height: 80px; + border: 1px solid var(--theme-comment); + padding: 10px; + height: auto; + min-height: inherit; + max-height: 130px; + overflow: auto; + max-width: 400px; +} + +.preview .header { + width: 100%; + line-height: 20px; + border-bottom: 1px solid #cccccc; + display: flex; + flex-direction: column; +} + +.preview .header .link { + align-self: flex-end; + color: var(--theme-highlight-blue); + text-decoration: underline; +} +.preview .header .link:hover { + cursor: pointer; +} + +.selected-token { + background-color: var(--theme-search-overlays-semitransparent); + color: var(--theme-selection-color); +} + +.selected-token:hover { + cursor: pointer; +} + +.preview .function-signature { + padding-top: 10px; +} + +.function-signature { + line-height: 20px; + align-self: center; +} + +.function-signature .function-name { + color: var(--theme-highlight-blue); +} + +.function-signature .param { + color: var(--string-color); +} + +.function-signature .paren { + color: var(--object-color); +} + +.function-signature .comma { + color: var(--object-color); +} + +.theme-dark .preview { + border-color: var(--theme-body-color); +} + +.theme-dark .preview .arrow svg { + fill: var(--theme-comment); } .conditional-breakpoint-panel { cursor: initial; @@ -1811,9 +2094,6 @@ html[dir="rtl"] .tree .node > div { width: 100%; top: 30px; left: 0px; - --editor-footer-height: 27px; - --editor-searchbar-height: 27px; - --editor-second-searchbar-height: 27px; } html[dir="rtl"] .editor-mount { @@ -1853,10 +2133,6 @@ html[dir="rtl"] .editor-mount { right: -4px; } -.editor.new-breakpoint.folding-enabled svg { - right: -16px; -} - .new-breakpoint.has-condition svg { fill: var(--theme-graphs-yellow); } @@ -1872,26 +2148,26 @@ html[dir="rtl"] .editor-mount { .editor-wrapper .editor-mount { width: 100%; + height: calc(100% - 32px); background-color: var(--theme-body-background); } +.search-bar ~ .editor-mount { + height: calc(100% - 72px); +} + .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) { +/* move the breakpoint below the linenumber */ +.new-breakpoint .CodeMirror-gutter-elt:last-child { z-index: 0; } @@ -1923,15 +2199,6 @@ html[dir="rtl"] .editor-mount { 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); @@ -1950,406 +2217,6 @@ html[dir="rtl"] .editor-mount { -moz-user-select: none; user-select: none; } -.toggle-button-start, -.toggle-button-end { - transform: translate(0, 2px); - transition: transform 0.25s ease-in-out; - cursor: pointer; - padding: 4px 2px; -} - -.toggle-button-start svg, -.toggle-button-end svg { - width: 16px; - fill: var(--theme-comment); -} - -.theme-dark .toggle-button-start svg, -.theme-dark .toggle-button-end svg { - fill: var(--theme-comment-alt); -} - -.toggle-button-end { - margin-left: auto; - margin-right: 5px; -} - -.toggle-button-start { - margin-left: 5px; -} - -html:not([dir="rtl"]) .toggle-button-end svg, -html[dir="rtl"] .toggle-button-start svg { - transform: rotate(180deg); -} - -html .toggle-button-end.vertical svg { - transform: rotate(-90deg); -} - -.toggle-button-end.vertical { - margin-bottom: 2px; -} - -.toggle-button-start.collapsed, -.toggle-button-end.collapsed { - transform: rotate(180deg); -} -.source-footer { - background: var(--theme-toolbar-background); - border-top: 1px solid var(--theme-splitter-color); - position: absolute; - display: flex; - bottom: 0; - left: 0; - right: 1px; - opacity: 1; - z-index: 100; - -moz-user-select: none; - user-select: none; - height: var(--editor-footer-height); - box-sizing: border-box; -} - -.source-footer .commands { - display: flex; - align-items: center; -} - -.source-footer .commands * { - -moz-user-select: none; - user-select: none; -} - -.source-footer > .commands > .action { - cursor: pointer; - display: flex; - justify-content: center; - align-items: center; - transition: opacity 200ms; - border: none; - background: transparent; - padding: 8px 0.7em; -} - -.source-footer > .commands > .action i { - height: 100%; - display: flex; - flex-direction: column; - justify-content: center; -} - -.source-footer > .commands > button.action:focus { - outline: none; -} - -:root.theme-dark .source-footer > .commands > .action { - fill: var(--theme-body-color); -} - -:root.theme-dark .source-footer > .commands > .action:hover { - fill: var(--theme-selection-color); -} - -.source-footer > .commands > .action svg { - height: 16px; - width: 16px; -} - -.source-footer .commands .coverage { - color: var(--theme-body-color); -} - -.coverage-on .source-footer .commands .coverage { - color: var(--theme-highlight-blue); - border: 1px solid var(--theme-body-color-inactive); - border-radius: 2px; -} - -.source-footer .black-box.blackboxed svg { - fill: var(--theme-highlight-blue); -} - -.source-footer .blackbox-summary { - color: var(--theme-body-color); -} - -.search-bar { - display: flex; - flex-direction: column; -} - -.search-bar .search-field { - padding-left: 7px; - height: var(--editor-searchbar-height); -} - -.search-bar .close-btn { - padding: 6px; -} - -.search-bottom-bar * { - -moz-user-select: none; - user-select: none; -} - -.search-bottom-bar { - display: flex; - flex-shrink: 0; - justify-content: space-between; - width: calc(100% - 1px); - height: var(--editor-second-searchbar-height); - background-color: var(--theme-toolbar-background); - border-bottom: 1px solid var(--theme-splitter-color); - padding: 0 13px; -} - -.search-bottom-bar button:focus { - outline: none; -} - -.search-bottom-bar .search-modifiers { - display: flex; - align-items: center; -} - -.search-bottom-bar .search-modifiers button { - padding: 0 3px; - margin: 0 3px; - border: none; - background: none; - width: 20px; - height: 20px; - border-radius: 3px; -} - -.search-bottom-bar .search-modifiers button i { - display: flex; - justify-content: center; - align-items: center; - padding: 0; - width: 16px; -} - -.search-bottom-bar .search-modifiers button svg { - fill: var(--theme-comment-alt); - height: 16px; - width: 16px; -} - -.search-bottom-bar .search-modifiers button svg:hover { - cursor: pointer; -} - -.search-bottom-bar .search-modifiers button:hover { - background: var(--theme-toolbar-background-hover); -} - -.search-bottom-bar .search-modifiers button:active { - outline: none; -} - -.search-bottom-bar .search-modifiers button.active svg { - fill: var(--theme-selection-background); -} - -.theme-dark .search-bottom-bar .search-modifiers button.active svg { - fill: white; -} - -.search-bottom-bar .search-modifiers button.disabled svg { - fill: var(--theme-comment-alt); - cursor: default; -} - -.search-bottom-bar .search-type-toggles { - display: flex; - align-items: center; -} - -.search-bottom-bar .search-type-toggles .search-toggle-title { - color: var(--theme-body-color-inactive); - font-size: 11px; - font-weight: normal; - margin: 0; -} - -.search-bottom-bar .search-type-toggles .search-type-btn { - margin: 0 6px; - border: none; - background: transparent; - color: var(--theme-comment-alt); -} - -.search-bottom-bar .search-type-toggles .search-type-btn:hover { - cursor: pointer; -} - -.search-bottom-bar .search-type-toggles .search-type-btn:active { - outline: none; -} - -.search-bottom-bar .search-type-toggles .search-type-btn.active { - color: var(--theme-selection-background); -} - -.theme-dark .search-bottom-bar .search-type-toggles .search-type-btn.active { - color: white; -} - -.search-bar .result-list { - max-height: 230px; -} - -.function-signature { - line-height: 20px; - align-self: center; -} - -.function-signature .function-name { - color: var(--theme-highlight-blue); -} - -.function-signature .param { - color: var(--string-color); -} - -.function-signature .paren { - color: var(--object-color); -} - -.function-signature .comma { - color: var(--object-color); -} -.popover { - position: fixed; - z-index: 100; -} - -.popover .gap { - height: 5px; - padding-top: 5px; -} - -.popover::before, -.popover::after { - content: ''; - height: 0; - width: 0; - position: absolute; - border: 7px solid transparent; - left: calc(20% - 7px); /* corresponds to calculation in Popover.js */ -} - -.popover::before { - border-bottom-color: var(--theme-splitter-color); - top: -9px; -} - -.theme-dark .popover::before { - border-bottom-color: var(--theme-body-color); -} - -.popover::after { - border-bottom-color: var(--theme-body-background); - top: -8px; -} - -.popover.up::before { - border-bottom-color: transparent; - border-top-color: var(--theme-splitter-color); - bottom: -9px; - top: initial; -} - -.theme-dark .popover.up::before { - border-top-color: var(--theme-body-color); -} - -.popover.up::after { - border-bottom-color: transparent; - border-top-color: var(--theme-body-background); - bottom: -8px; - top: initial; -} -.popover .preview { - background: var(--theme-body-background); - width: 350px; - min-height: 80px; - border: 1px solid var(--theme-splitter-color); - padding: 10px; - height: auto; - min-height: inherit; - max-height: 200px; - overflow: auto; - box-shadow: 1px 2px 4px 1px var(--theme-toolbar-background-alt); -} - -.popover .preview .header { - width: 100%; - line-height: 20px; - border-bottom: 1px solid #cccccc; - display: flex; - flex-direction: column; -} - -.popover .preview .header .link { - align-self: flex-end; - color: var(--theme-highlight-blue); - text-decoration: underline; -} -.popover .preview .header .link:hover { - cursor: pointer; -} - -.selected-token { - background-color: var(--theme-search-overlays-semitransparent); - color: var(--theme-selection-color); -} - -.selected-token:hover { - cursor: pointer; -} - -.popover .preview .function-signature { - padding-top: 10px; -} - -.theme-dark .popover .preview { - border-color: var(--theme-body-color); -} - -.theme-dark .popover .preview .arrow svg { - fill: var(--theme-comment); -} - -.tooltip { - position: fixed; - z-index: 100; -} - -.tooltip .preview { - background: var(--theme-toolbar-background); - max-width: 350px; - min-height: 80px; - border: 1px solid var(--theme-splitter-color); - box-shadow: 1px 2px 4px 1px var(--theme-toolbar-background-alt); - padding: 5px; - height: auto; - min-height: inherit; - max-height: 200px; - overflow: auto; - cursor: pointer; -} - -.theme-dark .tooltip .preview { - border-color: var(--theme-body-color); -} - -.tooltip .gap { - height: 4px; - padding-top: 4px; -} .input-expression { width: 100%; margin: 0px; @@ -2358,7 +2225,13 @@ html .toggle-button-end.vertical svg { background-color: var(--theme-body-background); font-size: 12px; padding: 0px 20px; - color: var(--theme-body-color); + color: var(--theme-highlight-blue); +} + +.input-expression::-webkit-input-placeholder { + text-align: center; + font-style: italic; + color: var(--theme-comment-alt); } .input-expression::placeholder { @@ -2407,11 +2280,11 @@ html .toggle-button-end.vertical svg { top: 6px; } -.expression-container .close-btn { +.expression-container .close { display: none; } -.expression-container:hover .close-btn { +.expression-container:hover .close { display: block; } @@ -2433,42 +2306,10 @@ html .toggle-button-end.vertical svg { .expression-error { color: var(--theme-highlight-red); } -.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); -} .why-paused { background-color: var(--breakpoint-active-color); + border: 1.7px solid var(--breakpoint-active-color); color: var(--theme-highlight-blue); padding: 10px 10px 10px 20px; white-space: normal; @@ -2489,7 +2330,7 @@ html .toggle-button-end.vertical svg { .breakpoints-list .breakpoint { font-size: 12px; color: var(--theme-content-color1); - padding: 0.5em 12px 0.5em 5px; + padding: 0.5em 1px; line-height: 1em; position: relative; transition: all 0.25s ease; @@ -2568,16 +2409,16 @@ html .breakpoints-list .breakpoint.paused { .breakpoint .close-btn { position: absolute; - offset-inline-end: 16px; + offset-inline-end: 6px; top: 12px; } .breakpoint .close { - visibility: hidden; + display: none; } .breakpoint:hover .close { - visibility: visible; + display: block; } .object-node.default-property { @@ -2606,10 +2447,6 @@ html .breakpoints-list .breakpoint.paused { .scopes-list .tree-node { overflow: hidden; } - -.scopes-list .function-signature { - display: inline-block; -} .frames ul { list-style: none; margin: 0; @@ -2622,9 +2459,6 @@ html .breakpoints-list .breakpoint.paused { overflow: hidden; display: flex; justify-content: space-between; - flex-direction: row; - align-items: center; - margin: 0; } /* Style the focused call frame like so: @@ -2642,17 +2476,8 @@ html .breakpoints-list .breakpoint.paused { background-color: var(--theme-tab-toolbar-background); } -.theme-dark .frames ul li:nth-of-type(2n) { - background-color: var(--theme-toolbar-background-alt); -} - .frames .location { font-weight: lighter; - display: flex; - justify-content: space-between; - flex-direction: row; - align-items: center; - margin: 0; } :root.theme-light .frames .location, @@ -2677,11 +2502,6 @@ html .breakpoints-list .breakpoint.paused { outline: none; } -.theme-dark .frames ul li:hover, -.theme-dark .frames ul li:focus { - background-color: var(--theme-tab-toolbar-background); -} - .frames ul li.selected { background-color: var(--theme-selection-background); color: white; @@ -2702,22 +2522,12 @@ html .breakpoints-list .breakpoint.paused { cursor: pointer; text-align: center; padding: 8px 0px; - margin: 7px 10px 7px 7px; - border: 1px solid var(--theme-splitter-color); + border-top: 1px solid var(--theme-splitter-color); background-color: var(--theme-tab-toolbar-background); } .show-more:hover { - background-color: var(--theme-toolbar-background-hover); -} - -.annotation-logo { - width: 12px; - margin-left: 2px; -} - -:root.theme-dark .annotation-logo svg path { - fill: var(--theme-highlight-blue); + background-color: var(--search-overlays-semitransparent); } .event-listeners { list-style: none; @@ -2791,7 +2601,7 @@ html .breakpoints-list .breakpoint.paused { } .accordion ._header:hover { - background-color: var(--theme-toolbar-background-hover); + background-color: var(--search-overlays-semitransparent); } .accordion ._header button svg, @@ -2861,10 +2671,6 @@ html .breakpoints-list .breakpoint.paused { fill: currentColor; } -.command-bar > button:hover { - background: var(--theme-toolbar-background-hover); -} - :root.theme-dark .command-bar > button { color: var(--theme-body-color); } @@ -2904,6 +2710,39 @@ html .command-bar > button:disabled { .command-bar button.pause-exceptions.all { color: var(--theme-highlight-blue); } +.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); @@ -2926,6 +2765,71 @@ html .welcomebox .toggle-button-end { position: absolute; top: auto; } +.dropdown { + --width: 150px; + background: var(--theme-body-background); + border: 1px solid var(--theme-splitter-color); + box-shadow: 0 4px 4px 0 var(--search-overlays-semitransparent); + max-height: 300px; + position: absolute; + right: 8px; + top: 35px; + width: var(--width); + z-index: 1000; +} + +html[dir="rtl"] .dropdown { + right: calc((var(--width) - 11px) * (-1)); +} + +.dropdown-block { + padding: 0px 2px; + position: relative; + align-self: center; +} + +.dropdown-button { + cursor: pointer; + color: var(--theme-comment); + background: none; + border: none; + padding: 0; + font-weight: 100; + margin-top: 6px; + font-size: 14px; +} + +.dropdown li { + transition: all 0.25s ease; + padding: 2px 10px 10px 5px; + overflow: hidden; + height: 30px; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dropdown li:hover { + background-color: var(--search-overlays-semitransparent); + cursor: pointer; +} + +.dropdown ul { + list-style: none; + line-height: 2em; + font-size: 1em; + margin: 0; + padding: 0; +} + +.dropdown-mask { + position: fixed; + width: 100%; + height: 100%; + background: transparent; + z-index: 999; + left: 0; + top: 0; +} .source-header { border-bottom: 1px solid var(--theme-splitter-color); width: 100%; @@ -3027,68 +2931,10 @@ html .welcomebox .toggle-button-end { .source-tab:hover .close-btn { visibility: visible; } -.dropdown { - --width: 150px; - background: var(--theme-body-background); - border: 1px solid var(--theme-splitter-color); - box-shadow: 0 4px 4px 0 var(--search-overlays-semitransparent); - max-height: 300px; - position: absolute; - right: 8px; - top: 35px; - width: var(--width); - z-index: 1000; -} -html[dir="rtl"] .dropdown { - right: calc((var(--width) - 11px) * (-1)); -} - -.dropdown-block { - padding: 0px 2px; - position: relative; - align-self: center; -} - -.dropdown-button { - cursor: pointer; - color: var(--theme-comment); - background: none; - border: none; +.source-tab .close-btn .close { padding: 0; - font-weight: 100; - margin-top: 6px; - font-size: 14px; -} - -.dropdown li { - transition: all 0.25s ease; - padding: 2px 10px 10px 5px; - overflow: hidden; - height: 30px; - text-overflow: ellipsis; - white-space: nowrap; -} - -.dropdown li:hover { - background-color: var(--search-overlays-semitransparent); - cursor: pointer; -} - -.dropdown ul { - list-style: none; - line-height: 2em; - font-size: 1em; - margin: 0; - padding: 0; -} - -.dropdown-mask { - position: fixed; - width: 100%; - height: 100%; - background: transparent; - z-index: 999; - left: 0; - top: 0; + margin-top: 0; + display: inline-flex; + justify-content: center; } diff --git a/devtools/client/debugger/new/debugger.js b/devtools/client/debugger/new/debugger.js index 109e59801f96..2f1716f2040b 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/client/shared/vendor/react-dom"), require("devtools/shared/flags")); 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/client/shared/vendor/react-dom", "devtools/shared/flags"], 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/client/shared/vendor/react-dom"), require("devtools/shared/flags")) : factory(root["devtools/client/shared/vendor/react"], root["Services"], root["devtools/client/shared/vendor/react-dom"], root["devtools/shared/flags"]); 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_31__, __WEBPACK_EXTERNAL_MODULE_121__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -64,56 +64,102 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; var React = __webpack_require__(2); + + var _require = __webpack_require__(3), + bindActionCreators = _require.bindActionCreators, + combineReducers = _require.combineReducers; + var ReactDOM = __webpack_require__(22); - var _require = __webpack_require__(131), - bootstrap = _require.bootstrap, - L10N = _require.L10N, - unmountRoot = _require.unmountRoot; + var _require2 = __webpack_require__(23), + getClient = _require2.getClient, + firefox = _require2.firefox; - var _require2 = __webpack_require__(828), - isFirefoxPanel = _require2.isFirefoxPanel; + var _require3 = __webpack_require__(131), + renderRoot = _require3.renderRoot, + bootstrap = _require3.bootstrap, + L10N = _require3.L10N, + unmountRoot = _require3.unmountRoot; - var _require3 = __webpack_require__(888), - onConnect = _require3.onConnect; + var _require4 = __webpack_require__(65), + getValue = _require4.getValue, + isFirefoxPanel = _require4.isFirefoxPanel; - var _require4 = __webpack_require__(897), - teardownWorkers = _require4.teardownWorkers; + var configureStore = __webpack_require__(189); + + var _require5 = __webpack_require__(225), + onConnect = _require5.onConnect, + onFirefoxConnect = _require5.onFirefoxConnect; + + var reducers = __webpack_require__(227); + var selectors = __webpack_require__(242); + + var App = __webpack_require__(243); + + var createStore = configureStore({ + log: getValue("logging.actions"), + makeThunkArgs: (args, state) => { + return Object.assign({}, args, { client: getClient(state) }); + } + }); + + var store = createStore(combineReducers(reducers)); + var actions = bindActionCreators(__webpack_require__(244), store.dispatch); + + if (!isFirefoxPanel()) { + window.L10N = L10N; + window.L10N.setBundle(__webpack_require__(756)); + } + + 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 + }; + + // Globals needed for mocha integration tests + window.getGlobalsForTesting = () => { + return { + debuggerStore: store, + launchpadStore: window.launchpadStore, + selectors, + actions, + threadClient: firefox.getThreadClient(), + target: firefox.getTabTarget() + }; + }; if (isFirefoxPanel()) { + var sourceMap = __webpack_require__(246); + var prettyPrint = __webpack_require__(256); + module.exports = { bootstrap: (_ref) => { var threadClient = _ref.threadClient, tabTarget = _ref.tabTarget, - debuggerClient = _ref.debuggerClient, - sourceMaps = _ref.sourceMaps; + toolbox = _ref.toolbox; - return onConnect({ - tab: { clientType: "firefox" }, - tabConnection: { - tabTarget, - threadClient, - debuggerClient - } - }, { - sourceMaps - }); + firefox.setThreadClient(threadClient); + firefox.setTabTarget(tabTarget); + renderRoot(React, ReactDOM, App, store); + firefox.initPage(actions); + return onFirefoxConnect(actions, firefox); }, destroy: () => { unmountRoot(ReactDOM); - teardownWorkers(); - } + sourceMap.destroyWorker(); + prettyPrint.destroyWorker(); + }, + store: store, + actions: actions, + selectors: selectors, + client: firefox.clientCommands }; } else { - window.L10N = L10N; - // $FlowIgnore: - window.L10N.setBundle(__webpack_require__(960)); - - bootstrap(React, ReactDOM).then(connection => { - onConnect(connection, { - sourceMaps: __webpack_require__(898) - }); - }); + bootstrap(React, ReactDOM, App, actions, store).then(conn => onConnect(conn, actions)); } /***/ }, @@ -1139,39 +1185,8854 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 23 */, -/* 24 */, -/* 25 */, -/* 26 */, -/* 27 */, -/* 28 */, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var _require = __webpack_require__(24), + Task = _require.Task; + + var firefox = __webpack_require__(25); + var chrome = __webpack_require__(125); + + var _require2 = __webpack_require__(123), + createSource = _require2.createSource; + + var clientType = null; + function getClient() { + if (clientType === "chrome" || clientType === "node") { + return chrome.clientCommands; + } + + return firefox.clientCommands; + } + + function startDebugging(connTarget, actions) { + if (connTarget.type === "node") { + return startDebuggingNode(connTarget.param, actions); + } + + return startDebuggingTab(connTarget, actions); + } + + function startDebuggingNode(tabId, actions) { + return Task.spawn(function* () { + clientType = "node"; + + var tabs = yield chrome.connectNodeClient(); + var tab = tabs.find(t => t.id.indexOf(tabId) !== -1); + + yield chrome.connectNode(tab.tab); + chrome.initPage(actions, { clientType }); + + return { tabs, tab, client: chrome }; + }); + } + + function startDebuggingTab(connTarget, actions) { + var client = connTarget.type === "chrome" ? chrome : firefox; + return Task.spawn(function* () { + var tabs = yield client.connectClient(); + var tab = tabs.find(t => t.id.indexOf(connTarget.param) !== -1); + if (tab) { + yield client.connectTab(tab.tab); + + clientType = connTarget.type; + client.initPage(actions, { clientType }); + } + return { tabs, tab, client }; + }); + } + + module.exports = { + getClient, + startDebugging, + firefox, + chrome, + createSource + }; + +/***/ }, +/* 24 */ +/***/ function(module, exports) { + + "use strict"; + + /* -*- 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/. */ + + /** + * This object provides the public module functions. + */ + var Task = { + // XXX: Not sure if this works in all cases... + async: function (task) { + return function () { + return Task.spawn(task, this, arguments); + }; + }, + + /** + * Creates and starts a new task. + * @param task A generator function + * @return A promise, resolved when the task terminates + */ + spawn: function (task, scope, args) { + return new Promise(function (resolve, reject) { + var iterator = task.apply(scope, args); + + var callNext = lastValue => { + var iteration = iterator.next(lastValue); + Promise.resolve(iteration.value).then(value => { + if (iteration.done) { + resolve(value); + } else { + callNext(value); + } + }).catch(error => { + reject(error); + iterator.throw(error); + }); + }; + + callNext(undefined); + }); + } + }; + + module.exports = { Task }; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + 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 getTabs = (() => { + var _ref2 = _asyncToGenerator(function* () { + if (!debuggerClient || !debuggerClient.mainRoot) { + return; + } + + var response = yield debuggerClient.listTabs(); + return createTabs(response.tabs); + }); + + return function getTabs() { + 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__(26), + DebuggerClient = _require.DebuggerClient, + DebuggerTransport = _require.DebuggerTransport, + TargetFactory = _require.TargetFactory, + WebsocketTransport = _require.WebsocketTransport; + + var _require2 = __webpack_require__(65), + getValue = _require2.getValue; + + var _require3 = __webpack_require__(122), + setupCommands = _require3.setupCommands, + clientCommands = _require3.clientCommands; + + var _require4 = __webpack_require__(124), + setupEvents = _require4.setupEvents, + clientEvents = _require4.clientEvents; + + var debuggerClient = null; + var threadClient = null; + var tabTarget = null; + + function getThreadClient() { + return threadClient; + } + + function setThreadClient(client) { + threadClient = client; + } + + function getTabTarget() { + return tabTarget; + } + + function setTabTarget(target) { + tabTarget = target; + } + + 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 connectTab(tab) { + return new Promise((resolve, reject) => { + window.addEventListener("beforeunload", () => { + var tt = getTabTarget(); + if (tt !== null) { + tt.destroy(); + } + }); + + lookupTabTarget(tab).then(target => { + tabTarget = target; + target.activeTab.attachThread({}, (res, _threadClient) => { + threadClient = _threadClient; + threadClient.resume(); + resolve(); + }); + }); + }); + } + + function initPage(actions) { + tabTarget = getTabTarget(); + threadClient = getThreadClient(); + + if (!threadClient || !tabTarget) { + return; + } + + setupCommands({ threadClient, tabTarget, debuggerClient }); + + if (actions) { + // Listen to all the requested events. + setupEvents({ threadClient, actions }); + Object.keys(clientEvents).forEach(eventName => { + if (threadClient) { + threadClient.addListener(eventName, clientEvents[eventName]); + } + }); + } + } + + module.exports = { + connectClient, + connectTab, + clientCommands, + clientEvents, + getThreadClient, + setThreadClient, + getTabTarget, + setTabTarget, + initPage, + getTabs + }; + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + const { KeyShortcuts } = __webpack_require__(27); + const { DebuggerTransport } = __webpack_require__(41); + const { DebuggerClient } = __webpack_require__(53); + const PrefsHelper = __webpack_require__(57).PrefsHelper; + const { TargetFactory } = __webpack_require__(58); + const DevToolsUtils = __webpack_require__(42); + const AppConstants = __webpack_require__(44); + const EventEmitter = __webpack_require__(34); + const WebsocketTransport = __webpack_require__(59); + const Menu = __webpack_require__(60); + const MenuItem = __webpack_require__(61); + const Tree = __webpack_require__(62); + const sourceUtils = __webpack_require__(63); + const frame = __webpack_require__(64); + + module.exports = { + KeyShortcuts, + PrefsHelper, + DebuggerClient, + DebuggerTransport, + TargetFactory, + DevToolsUtils, + AppConstants, + EventEmitter, + WebsocketTransport, + Menu, + MenuItem, + Tree, + sourceUtils, + frame + }; + + +/***/ }, +/* 27 */ +/***/ 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/. */ + + const { Services: { appinfo }} = __webpack_require__(28); + const EventEmitter = __webpack_require__(34); + const isOSX = appinfo.OS === "Darwin"; + "use strict"; + + // List of electron keys mapped to DOM API (DOM_VK_*) key code + const ElectronKeysMapping = { + "F1": "DOM_VK_F1", + "F2": "DOM_VK_F2", + "F3": "DOM_VK_F3", + "F4": "DOM_VK_F4", + "F5": "DOM_VK_F5", + "F6": "DOM_VK_F6", + "F7": "DOM_VK_F7", + "F8": "DOM_VK_F8", + "F9": "DOM_VK_F9", + "F10": "DOM_VK_F10", + "F11": "DOM_VK_F11", + "F12": "DOM_VK_F12", + "F13": "DOM_VK_F13", + "F14": "DOM_VK_F14", + "F15": "DOM_VK_F15", + "F16": "DOM_VK_F16", + "F17": "DOM_VK_F17", + "F18": "DOM_VK_F18", + "F19": "DOM_VK_F19", + "F20": "DOM_VK_F20", + "F21": "DOM_VK_F21", + "F22": "DOM_VK_F22", + "F23": "DOM_VK_F23", + "F24": "DOM_VK_F24", + "Space": "DOM_VK_SPACE", + "Backspace": "DOM_VK_BACK_SPACE", + "Delete": "DOM_VK_DELETE", + "Insert": "DOM_VK_INSERT", + "Return": "DOM_VK_RETURN", + "Enter": "DOM_VK_RETURN", + "Up": "DOM_VK_UP", + "Down": "DOM_VK_DOWN", + "Left": "DOM_VK_LEFT", + "Right": "DOM_VK_RIGHT", + "Home": "DOM_VK_HOME", + "End": "DOM_VK_END", + "PageUp": "DOM_VK_PAGE_UP", + "PageDown": "DOM_VK_PAGE_DOWN", + "Escape": "DOM_VK_ESCAPE", + "Esc": "DOM_VK_ESCAPE", + "Tab": "DOM_VK_TAB", + "VolumeUp": "DOM_VK_VOLUME_UP", + "VolumeDown": "DOM_VK_VOLUME_DOWN", + "VolumeMute": "DOM_VK_VOLUME_MUTE", + "PrintScreen": "DOM_VK_PRINTSCREEN", + }; + + /** + * Helper to listen for keyboard events decribed in .properties file. + * + * let shortcuts = new KeyShortcuts({ + * window + * }); + * shortcuts.on("Ctrl+F", event => { + * // `event` is the KeyboardEvent which relates to the key shortcuts + * }); + * + * @param DOMWindow window + * The window object of the document to listen events from. + * @param DOMElement target + * Optional DOM Element on which we should listen events from. + * If omitted, we listen for all events fired on `window`. + */ + function KeyShortcuts({ window, target }) { + this.window = window; + this.target = target || window; + this.keys = new Map(); + this.eventEmitter = new EventEmitter(); + this.target.addEventListener("keydown", this); + } + + /* + * Parse an electron-like key string and return a normalized object which + * allow efficient match on DOM key event. The normalized object matches DOM + * API. + * + * @param DOMWindow window + * Any DOM Window object, just to fetch its `KeyboardEvent` object + * @param String str + * The shortcut string to parse, following this document: + * https://github.com/electron/electron/blob/master/docs/api/accelerator.md + */ + KeyShortcuts.parseElectronKey = function(window, str) { + let modifiers = str.split("+"); + let key = modifiers.pop(); + + let shortcut = { + ctrl: false, + meta: false, + alt: false, + shift: false, + // Set for character keys + key: undefined, + // Set for non-character keys + keyCode: undefined, + }; + for (let mod of modifiers) { + if (mod === "Alt") { + shortcut.alt = true; + } else if (["Command", "Cmd"].includes(mod)) { + shortcut.meta = true; + } else if (["CommandOrControl", "CmdOrCtrl"].includes(mod)) { + if (isOSX) { + shortcut.meta = true; + } else { + shortcut.ctrl = true; + } + } else if (["Control", "Ctrl"].includes(mod)) { + shortcut.ctrl = true; + } else if (mod === "Shift") { + shortcut.shift = true; + } else { + console.error("Unsupported modifier:", mod, "from key:", str); + return null; + } + } + + // Plus is a special case. It's a character key and shouldn't be matched + // against a keycode as it is only accessible via Shift/Capslock + if (key === "Plus") { + key = "+"; + } + + if (typeof key === "string" && key.length === 1) { + // Match any single character + shortcut.key = key.toLowerCase(); + } else if (key in ElectronKeysMapping) { + // Maps the others manually to DOM API DOM_VK_* + key = ElectronKeysMapping[key]; + shortcut.keyCode = window.KeyboardEvent[key]; + // Used only to stringify the shortcut + shortcut.keyCodeString = key; + shortcut.key = key; + } else { + console.error("Unsupported key:", key); + return null; + } + + return shortcut; + }; + + KeyShortcuts.stringify = function(shortcut) { + let list = []; + if (shortcut.alt) { + list.push("Alt"); + } + if (shortcut.ctrl) { + list.push("Ctrl"); + } + if (shortcut.meta) { + list.push("Cmd"); + } + if (shortcut.shift) { + list.push("Shift"); + } + let key; + if (shortcut.key) { + key = shortcut.key.toUpperCase(); + } else { + key = shortcut.keyCodeString; + } + list.push(key); + return list.join("+"); + }; + + KeyShortcuts.prototype = { + destroy() { + this.target.removeEventListener("keydown", this); + this.keys.clear(); + }, + + doesEventMatchShortcut(event, shortcut) { + if (shortcut.meta != event.metaKey) { + return false; + } + if (shortcut.ctrl != event.ctrlKey) { + return false; + } + if (shortcut.alt != event.altKey) { + return false; + } + // Shift is a special modifier, it may implicitely be required if the + // expected key is a special character accessible via shift. + if (shortcut.shift != event.shiftKey && event.key && + event.key.match(/[a-zA-Z]/)) { + return false; + } + if (shortcut.keyCode) { + return event.keyCode == shortcut.keyCode; + } else if (event.key in ElectronKeysMapping) { + return ElectronKeysMapping[event.key] === shortcut.key; + } + + // get the key from the keyCode if key is not provided. + let key = event.key || String.fromCharCode(event.keyCode); + + // For character keys, we match if the final character is the expected one. + // But for digits we also accept indirect match to please azerty keyboard, + // which requires Shift to be pressed to get digits. + return key.toLowerCase() == shortcut.key || + (shortcut.key.match(/^[0-9]$/) && + event.keyCode == shortcut.key.charCodeAt(0)); + }, + + handleEvent(event) { + for (let [key, shortcut] of this.keys) { + if (this.doesEventMatchShortcut(event, shortcut)) { + this.eventEmitter.emit(key, event); + } + } + }, + + on(key, listener) { + if (typeof listener !== "function") { + throw new Error("KeyShortcuts.on() expects a function as " + + "second argument"); + } + if (!this.keys.has(key)) { + let shortcut = KeyShortcuts.parseElectronKey(this.window, key); + // The key string is wrong and we were unable to compute the key shortcut + if (!shortcut) { + return; + } + this.keys.set(key, shortcut); + } + this.eventEmitter.on(key, listener); + }, + + off(key, listener) { + this.eventEmitter.off(key, listener); + }, + }; + exports.KeyShortcuts = KeyShortcuts; + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + const Services = __webpack_require__(29); + const SplitBox = __webpack_require__(30); + // const SplitBoxCSS = require("./client/shared/components/splitter/SplitBox.css") + const sprintf = __webpack_require__(33).sprintf; + + module.exports = { + Services, + SplitBox, + // SplitBoxCSS, + sprintf + }; + + +/***/ }, /* 29 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_29__; /***/ }, -/* 30 */, -/* 31 */, -/* 32 */, -/* 33 */, -/* 34 */, -/* 35 */, -/* 36 */, -/* 37 */, -/* 38 */, -/* 39 */, -/* 40 */, -/* 41 */, -/* 42 */, -/* 43 */, -/* 44 */, -/* 45 */, -/* 46 */, -/* 47 */, -/* 48 */, -/* 49 */, -/* 50 */, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + const React = __webpack_require__(2); + const ReactDOM = __webpack_require__(31); + const Draggable = React.createFactory(__webpack_require__(32)); + const { DOM: dom, PropTypes } = React; + + /** + * This component represents a Splitter. The splitter supports vertical + * as well as horizontal mode. + */ + const 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() { + const splitBox = ReactDOM.findDOMNode(this); + const doc = splitBox.ownerDocument; + let 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() { + const splitBox = ReactDOM.findDOMNode(this); + const 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({ movementX, movementY }) { + const node = ReactDOM.findDOMNode(this); + const 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) { + const 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() { + const vert = this.state.vert; + const { + minSize, maxSize, startPanelCollapsed, endPanelControl, + endPanelCollapsed } = this.props; + let leftPanelStyle, rightPanelStyle; + + // Set proper size for panels depending on the current state. + if (vert) { + let 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 { + let 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() { + const vert = this.state.vert; + const { + startPanelCollapsed, + startPanel, + endPanel, + endPanelControl, + splitterSize, + endPanelCollapsed + } = this.props; + + let style = Object.assign({}, this.props.style); + + // Calculate class names list. + let classNames = ["split-box"]; + classNames.push(vert ? "vert" : "horz"); + if (this.props.className) { + classNames = classNames.concat(this.props.className.split(" ")); + } + + const { leftPanelStyle, rightPanelStyle } = this.preparePanelStyles(); + + // Calculate splitter size + let 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; + + +/***/ }, +/* 31 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_31__; + +/***/ }, +/* 32 */ +/***/ 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/. */ + + const React = __webpack_require__(2); + const ReactDOM = __webpack_require__(31); + const { DOM: dom, PropTypes } = React; + + const 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(); + const 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(); + const 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; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * 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. + * + */ + + /* globals window, exports, define */ + + (function(window) { + 'use strict' + + var re = { + not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, + number: /[diefg]/, + numeric_arg: /bcdiefguxX/, + json: /[j]/, + not_json: /[^j]/, + text: /^[^\x25]+/, + modulo: /^\x25{2}/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosStTuvxX])/, + key: /^([a-z_][a-z_\d]*)/i, + key_access: /^\.([a-z_][a-z_\d]*)/i, + index_access: /^\[(\d+)\]/, + sign: /^[\+\-]/ + } + + function sprintf() { + var key = arguments[0], cache = sprintf.cache + if (!(cache[key] && cache.hasOwnProperty(key))) { + cache[key] = sprintf.parse(key) + } + return sprintf.format.call(null, cache[key], arguments) + } + + sprintf.format = function(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = '' + for (i = 0; i < tree_length; i++) { + node_type = get_type(parse_tree[i]) + if (node_type === 'string') { + output[output.length] = parse_tree[i] + } + else if (node_type === 'array') { + match = parse_tree[i] // convenience purposes only + if (match[2]) { // keyword argument + arg = argv[cursor] + for (k = 0; k < match[2].length; k++) { + if (!arg.hasOwnProperty(match[2][k])) { + throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) + } + arg = arg[match[2][k]] + } + } + else if (match[1]) { // positional argument (explicit) + arg = argv[match[1]] + } + else { // positional argument (implicit) + arg = argv[cursor++] + } + + if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && get_type(arg) == 'function') { + arg = arg() + } + + if (re.numeric_arg.test(match[8]) && (get_type(arg) != 'number' && isNaN(arg))) { + throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + } + + if (re.number.test(match[8])) { + is_positive = arg >= 0 + } + + switch (match[8]) { + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': + arg = parseInt(arg, 10) + break + case 'j': + arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) + break + case 'e': + arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + break + case 'f': + arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) + break + case 'g': + arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) + break + case 'o': + arg = arg.toString(8) + break + case 's': + case 'S': + arg = String(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 't': + arg = String(!!arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'T': + arg = get_type(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'x': + arg = parseInt(arg, 10).toString(16) + break + case 'X': + arg = parseInt(arg, 10).toString(16).toUpperCase() + break + } + if (re.json.test(match[8])) { + output[output.length] = arg + } + else { + if (re.number.test(match[8]) && (!is_positive || match[3])) { + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') + } + else { + sign = '' + } + pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' + pad_length = match[6] - (sign + arg).length + pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : '') : '' + output[output.length] = match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) + } + } + } + return output.join('') + } + + sprintf.cache = {} + + sprintf.parse = function(fmt) { + var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + while (_fmt) { + if ((match = re.text.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = match[0] + } + else if ((match = re.modulo.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = '%' + } + else if ((match = re.placeholder.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1 + var field_list = [], replacement_field = match[2], field_match = [] + if ((field_match = re.key.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { + if ((field_match = re.key_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else if ((field_match = re.index_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + } + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + match[2] = field_list + } + else { + arg_names |= 2 + } + if (arg_names === 3) { + throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + } + parse_tree[parse_tree.length] = match + } + else { + throw new SyntaxError("[sprintf] unexpected placeholder") + } + _fmt = _fmt.substring(match[0].length) + } + return parse_tree + } + + var vsprintf = function(fmt, argv, _argv) { + _argv = (argv || []).slice(0) + _argv.splice(0, 0, fmt) + return sprintf.apply(null, _argv) + } + + /** + * helpers + */ + function get_type(variable) { + if (typeof variable === 'number') { + return 'number' + } + else if (typeof variable === 'string') { + return 'string' + } + else { + return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() + } + } + + var preformattedPadding = { + '0': ['', '0', '00', '000', '0000', '00000', '000000', '0000000'], + ' ': ['', ' ', ' ', ' ', ' ', ' ', ' ', ' '], + '_': ['', '_', '__', '___', '____', '_____', '______', '_______'], + } + function str_repeat(input, multiplier) { + if (multiplier >= 0 && multiplier <= 7 && preformattedPadding[input]) { + return preformattedPadding[input][multiplier] + } + return Array(multiplier + 1).join(input) + } + + /** + * export to either browser or node.js + */ + if (true) { + exports.sprintf = sprintf + exports.vsprintf = vsprintf + } + else { + window.sprintf = sprintf + window.vsprintf = vsprintf + + if (typeof define === 'function' && define.amd) { + define(function() { + return { + sprintf: sprintf, + vsprintf: vsprintf + } + }) + } + } + })(typeof window === 'undefined' ? this : window); + + +/***/ }, +/* 34 */ +/***/ 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/. */ + + /** + * EventEmitter. + */ + + var EventEmitter = function EventEmitter() {}; + module.exports = EventEmitter; + + const { Cu } = __webpack_require__(35); + const promise = __webpack_require__(40); + + /** + * 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) { + let 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) { + let deferred = promise.defer(); + + let handler = (aEvent, aFirstArg, ...aRest) => { + this.off(aEvent, handler); + if (aListener) { + aListener.apply(null, [aEvent, aFirstArg, ...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; + let 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) { + if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) { + return; + } + + let originalListeners = this._eventEmitterListeners.get(aEvent); + for (let listener of this._eventEmitterListeners.get(aEvent)) { + // If the object was destroyed during event emission, stop + // emitting. + if (!this._eventEmitterListeners) { + break; + } + + // If listeners were removed during emission, make sure the + // event handler we're going to fire wasn't removed. + if (originalListeners === this._eventEmitterListeners.get(aEvent) || + this._eventEmitterListeners.get(aEvent).some(l => l === listener)) { + try { + listener.apply(null, arguments); + } + catch (ex) { + // Prevent a bad listener from interfering with the others. + let msg = ex + ": " + ex.stack; + //console.error(msg); + console.log(msg); + } + } + } + }, + }; + + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { + + /* + * A sham for https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/chrome + */ + + var { inDOMUtils } = __webpack_require__(36); + + var ourServices = { + inIDOMUtils: inDOMUtils, + nsIClipboardHelper: { + copyString: () => {} + }, + nsIXULChromeRegistry: { + isLocaleRTL: () => {return false;} + }, + nsIDOMParser: { + + }, + }; + + module.exports = { + Cc: name => { + if(typeof console !== "undefined") { + console.log('Cc sham for', name); + } + return { + getService: (name) => ourServices[name], + createInstance: (iface) => ourServices[iface], + }; + }, + CC: (name, iface, method) => { + if(typeof console !== "undefined") { + console.log('CC sham for', name, iface, method); + } + 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, + } + }; + + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + // A sham for inDOMUtils. + + "use strict"; + + var { CSSLexer } = __webpack_require__(37); + var { cssColors } = __webpack_require__(38); + var { cssProperties } = __webpack_require__(39); + + var cssRGBMap; + + // 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 (let name in cssColors) { + cssRGBMap.set(JSON.stringify(cssColors[name]), name); + } + } + let 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([hue, saturation, lightness]) { + 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]; + } + + let lexer = getCSSLexer(name); + + let getToken = function() { + while (true) { + let token = lexer.nextToken(); + if (!token || token.tokenType !== "comment" || + token.tokenType !== "whitespace") { + return token; + } + } + }; + + let requireComma = function(token) { + if (token.tokenType !== "symbol" || token.text !== ",") { + return null; + } + return getToken(); + }; + + let func = getToken(); + if (!func || func.tokenType !== "function") { + return null; + } + let alpha = false; + if (func.text === "rgb" || func.text === "hsl") { + // Nothing. + } else if (func.text === "rgba" || func.text === "hsla") { + alpha = true; + } else { + return null; + } + + let vals = []; + for (let i = 0; i < 3; ++i) { + let token = getToken(); + if (i > 0) { + token = requireComma(token); + } + if (token.tokenType !== "number" || !token.isInteger) { + return null; + } + let 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) { + let token = requireComma(getToken()); + if (token.tokenType !== "number") { + return null; + } + let num = token.number; + if (num < 0) { + num = 0; + } else if (num > 1) { + num = 1; + } + vals.push(num); + } else { + vals.push(1); + } + + let 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) { + let 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; + } + let 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, + }; + + +/***/ }, +/* 37 */ +/***/ 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); + } + }(this, 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(); + let 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; + } + let 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; + + })); + + +/***/ }, +/* 38 */ +/***/ function(module, exports) { + + // 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 }; + + +/***/ }, +/* 39 */ +/***/ function(module, exports) { + + // 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 }; + + +/***/ }, +/* 40 */ +/***/ function(module, exports) { + + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm + */ + + /** + * 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`. + */ + + let 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; + + +/***/ }, +/* 41 */ +/***/ 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: */ + /* 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) + + "use strict"; + + const DevToolsUtils = __webpack_require__(42); + const { dumpn, dumpv } = DevToolsUtils; + const StreamUtils = __webpack_require__(48); + const { Packet, JSONPacket, BulkPacket } = + __webpack_require__(49); + const promise = __webpack_require__(40); + const EventEmitter = __webpack_require__(34); + const utf8 = __webpack_require__(52); + + const PACKET_HEADER_MAX = 200; + + /** + * An adapter that handles data transfers between the debugger client and + * server. It can work with both nsIPipe and nsIServerSocket transports so + * long as the properly created input and output streams are specified. + * (However, for intra-process connections, LocalDebuggerTransport, below, + * is more efficient than using an nsIPipe pair with DebuggerTransport.) + * + * @param input nsIAsyncInputStream + * The input stream. + * @param output nsIAsyncOutputStream + * The output stream. + * + * Given a DebuggerTransport instance dt: + * 1) Set dt.hooks to a packet handler object (described below). + * 2) Call dt.ready() to begin watching for input packets. + * 3) Call dt.send() / dt.startBulkSend() to send packets. + * 4) Call dt.close() to close the connection, and disengage from the event + * loop. + * + * A packet handler is an object with the following methods: + * + * - onPacket(packet) - called when we have received a complete packet. + * |packet| is the parsed form of the packet --- a JavaScript value, not + * a JSON-syntax string. + * + * - onBulkPacket(packet) - called when we have switched to bulk packet + * receiving mode. |packet| is an object containing: + * * actor: Name of actor that will receive the packet + * * type: Name of actor's method that should be called on receipt + * * length: Size of the data to be read + * * stream: This input stream should only be used directly if you can ensure + * that you will read exactly |length| bytes and will not close the + * stream when reading is complete + * * done: If you use the stream directly (instead of |copyTo| below), you + * must signal completion by resolving / rejecting this deferred. + * If it's rejected, the transport will be closed. If an Error is + * supplied as a rejection value, it will be logged via |dumpn|. + * If you do use |copyTo|, resolving is taken care of for you when + * copying completes. + * * copyTo: A helper function for getting your data out of the stream that + * meets the stream handling requirements above, and has the + * following signature: + * @param output nsIAsyncOutputStream + * The stream to copy to. + * @return Promise + * The promise is resolved when copying completes or rejected if any + * (unexpected) errors occur. + * This object also emits "progress" events for each chunk that is + * copied. See stream-utils.js. + * + * - onClosed(reason) - called when the connection is closed. |reason| is + * an optional nsresult or object, typically passed when the transport is + * closed due to some error in a underlying stream. + * + * See ./packets.js and the Remote Debugging Protocol specification for more + * details on the format of these packets. + */ + function DebuggerTransport(socket) { + EventEmitter.decorate(this); + + this._socket = socket; + + // The current incoming (possibly partial) header, which will determine which + // type of Packet |_incoming| below will become. + this._incomingHeader = ""; + // The current incoming Packet object + this._incoming = null; + // A queue of outgoing Packet objects + this._outgoing = []; + + this.hooks = null; + this.active = false; + + this._incomingEnabled = true; + this._outgoingEnabled = true; + + this.close = this.close.bind(this); + } + + DebuggerTransport.prototype = { + /** + * Transmit an object as a JSON packet. + * + * This method returns immediately, without waiting for the entire + * packet to be transmitted, registering event handlers as needed to + * transmit the entire packet. Packets are transmitted in the order + * they are passed to this method. + */ + send: function(object) { + this.emit("send", object); + + let packet = new JSONPacket(this); + packet.object = object; + this._outgoing.push(packet); + this._flushOutgoing(); + }, + + /** + * Transmit streaming data via a bulk packet. + * + * This method initiates the bulk send process by queuing up the header data. + * The caller receives eventual access to a stream for writing. + * + * N.B.: Do *not* attempt to close the stream handed to you, as it will + * continue to be used by this transport afterwards. Most users should + * instead use the provided |copyFrom| function instead. + * + * @param header Object + * This is modeled after the format of JSON packets above, but does not + * actually contain the data, but is instead just a routing header: + * * actor: Name of actor that will receive the packet + * * type: Name of actor's method that should be called on receipt + * * length: Size of the data to be sent + * @return Promise + * The promise will be resolved when you are allowed to write to the + * stream with an object containing: + * * stream: This output stream should only be used directly if + * you can ensure that you will write exactly |length| + * bytes and will not close the stream when writing is + * complete + * * done: If you use the stream directly (instead of |copyFrom| + * below), you must signal completion by resolving / + * rejecting this deferred. If it's rejected, the + * transport will be closed. If an Error is supplied as + * a rejection value, it will be logged via |dumpn|. If + * you do use |copyFrom|, resolving is taken care of for + * you when copying completes. + * * copyFrom: A helper function for getting your data onto the + * stream that meets the stream handling requirements + * above, and has the following signature: + * @param input nsIAsyncInputStream + * The stream to copy from. + * @return Promise + * The promise is resolved when copying completes or + * rejected if any (unexpected) errors occur. + * This object also emits "progress" events for each chunk + * that is copied. See stream-utils.js. + */ + startBulkSend: function(header) { + this.emit("startBulkSend", header); + + let packet = new BulkPacket(this); + packet.header = header; + this._outgoing.push(packet); + this._flushOutgoing(); + return packet.streamReadyForWriting; + }, + + /** + * Close the transport. + * @param reason nsresult / object (optional) + * The status code or error message that corresponds to the reason for + * closing the transport (likely because a stream closed or failed). + */ + close: function(reason) { + this.emit("onClosed", reason); + + this.active = false; + this._socket.close(); + this._destroyIncoming(); + this._destroyAllOutgoing(); + if (this.hooks) { + this.hooks.onClosed(reason); + this.hooks = null; + } + if (reason) { + dumpn("Transport closed: " + DevToolsUtils.safeErrorString(reason)); + } else { + dumpn("Transport closed."); + } + }, + + /** + * The currently outgoing packet (at the top of the queue). + */ + get _currentOutgoing() { + return this._outgoing[0]; + }, + + /** + * Flush data to the outgoing stream. Waits until the output stream notifies + * us that it is ready to be written to (via onOutputStreamReady). + */ + _flushOutgoing: function() { + if (!this._outgoingEnabled || this._outgoing.length === 0) { + return; + } + + // If the top of the packet queue has nothing more to send, remove it. + if (this._currentOutgoing.done) { + this._finishCurrentOutgoing(); + } + + if (this._outgoing.length > 0) { + setTimeout(this.onOutputStreamReady.bind(this), 0); + } + }, + + /** + * Pause this transport's attempts to write to the output stream. This is + * used when we've temporarily handed off our output stream for writing bulk + * data. + */ + pauseOutgoing: function() { + this._outgoingEnabled = false; + }, + + /** + * Resume this transport's attempts to write to the output stream. + */ + resumeOutgoing: function() { + this._outgoingEnabled = true; + this._flushOutgoing(); + }, + + // nsIOutputStreamCallback + /** + * This is called when the output stream is ready for more data to be written. + * The current outgoing packet will attempt to write some amount of data, but + * may not complete. + */ + onOutputStreamReady: DevToolsUtils.makeInfallible(function() { + if (!this._outgoingEnabled || this._outgoing.length === 0) { + return; + } + + try { + this._currentOutgoing.write({ + write: data => { + let count = data.length; + this._socket.send(data); + return count; + } + }); + } catch(e) { + if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK) { + this.close(e.result); + return; + } else { + throw e; + } + } + + this._flushOutgoing(); + }, "DebuggerTransport.prototype.onOutputStreamReady"), + + /** + * Remove the current outgoing packet from the queue upon completion. + */ + _finishCurrentOutgoing: function() { + if (this._currentOutgoing) { + this._currentOutgoing.destroy(); + this._outgoing.shift(); + } + }, + + /** + * Clear the entire outgoing queue. + */ + _destroyAllOutgoing: function() { + for (let packet of this._outgoing) { + packet.destroy(); + } + this._outgoing = []; + }, + + /** + * Initialize the input stream for reading. Once this method has been called, + * we watch for packets on the input stream, and pass them to the appropriate + * handlers via this.hooks. + */ + ready: function() { + this.active = true; + this._waitForIncoming(); + }, + + /** + * Asks the input stream to notify us (via onInputStreamReady) when it is + * ready for reading. + */ + _waitForIncoming: function() { + if (this._incomingEnabled && !this._socket.onmessage) { + this._socket.onmessage = this.onInputStreamReady.bind(this); + } + }, + + /** + * Pause this transport's attempts to read from the input stream. This is + * used when we've temporarily handed off our input stream for reading bulk + * data. + */ + pauseIncoming: function() { + this._incomingEnabled = false; + }, + + /** + * Resume this transport's attempts to read from the input stream. + */ + resumeIncoming: function() { + this._incomingEnabled = true; + this._flushIncoming(); + this._waitForIncoming(); + }, + + // nsIInputStreamCallback + /** + * Called when the stream is either readable or closed. + */ + onInputStreamReady: + DevToolsUtils.makeInfallible(function(event) { + let data = event.data; + // TODO: ws-tcp-proxy decodes utf-8, but the transport expects to see the + // encoded bytes. Simplest step is to re-encode for now. + data = utf8.encode(data); + let stream = { + available() { + return data.length; + }, + readBytes(count) { + let result = data.slice(0, count); + data = data.slice(count); + return result; + }, + }; + + try { + while (data && this._incomingEnabled && + this._processIncoming(stream, stream.available())) {} + this._waitForIncoming(); + } catch(e) { + if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK) { + this.close(e.result); + } else { + throw e; + } + } + }, "DebuggerTransport.prototype.onInputStreamReady"), + + /** + * Process the incoming data. Will create a new currently incoming Packet if + * needed. Tells the incoming Packet to read as much data as it can, but + * reading may not complete. The Packet signals that its data is ready for + * delivery by calling one of this transport's _on*Ready methods (see + * ./packets.js and the _on*Ready methods below). + * @return boolean + * Whether incoming stream processing should continue for any + * remaining data. + */ + _processIncoming: function(stream, count) { + dumpv("Data available: " + count); + + if (!count) { + dumpv("Nothing to read, skipping"); + return false; + } + + try { + if (!this._incoming) { + dumpv("Creating a new packet from incoming"); + + if (!this._readHeader(stream)) { + return false; // Not enough data to read packet type + } + + // Attempt to create a new Packet by trying to parse each possible + // header pattern. + this._incoming = Packet.fromHeader(this._incomingHeader, this); + if (!this._incoming) { + throw new Error("No packet types for header: " + + this._incomingHeader); + } + } + + if (!this._incoming.done) { + // We have an incomplete packet, keep reading it. + dumpv("Existing packet incomplete, keep reading"); + this._incoming.read(stream); + } + } catch(e) { + let msg = "Error reading incoming packet: (" + e + " - " + e.stack + ")"; + dumpn(msg); + + // Now in an invalid state, shut down the transport. + this.close(); + return false; + } + + if (!this._incoming.done) { + // Still not complete, we'll wait for more data. + dumpv("Packet not done, wait for more"); + return true; + } + + // Ready for next packet + this._flushIncoming(); + return true; + }, + + /** + * Read as far as we can into the incoming data, attempting to build up a + * complete packet header (which terminates with ":"). We'll only read up to + * PACKET_HEADER_MAX characters. + * @return boolean + * True if we now have a complete header. + */ + _readHeader: function(stream) { + let amountToRead = PACKET_HEADER_MAX - this._incomingHeader.length; + this._incomingHeader += + StreamUtils.delimitedRead(stream, ":", amountToRead); + if (dumpv.wantVerbose) { + dumpv("Header read: " + this._incomingHeader); + } + + if (this._incomingHeader.endsWith(":")) { + if (dumpv.wantVerbose) { + dumpv("Found packet header successfully: " + this._incomingHeader); + } + return true; + } + + if (this._incomingHeader.length >= PACKET_HEADER_MAX) { + throw new Error("Failed to parse packet header!"); + } + + // Not enough data yet. + return false; + }, + + /** + * If the incoming packet is done, log it as needed and clear the buffer. + */ + _flushIncoming: function() { + if (!this._incoming.done) { + return; + } + if (dumpn.wantLogging) { + dumpn("Got: " + this._incoming); + } + this._destroyIncoming(); + }, + + /** + * Handler triggered by an incoming JSONPacket completing it's |read| method. + * Delivers the packet to this.hooks.onPacket. + */ + _onJSONObjectReady: function(object) { + DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { + // Ensure the transport is still alive by the time this runs. + if (this.active) { + this.emit("onPacket", object); + this.hooks.onPacket(object); + } + }, "DebuggerTransport instance's this.hooks.onPacket")); + }, + + /** + * Handler triggered by an incoming BulkPacket entering the |read| phase for + * the stream portion of the packet. Delivers info about the incoming + * streaming data to this.hooks.onBulkPacket. See the main comment on the + * transport at the top of this file for more details. + */ + _onBulkReadReady: function(...args) { + DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { + // Ensure the transport is still alive by the time this runs. + if (this.active) { + this.emit("onBulkPacket", ...args); + this.hooks.onBulkPacket(...args); + } + }, "DebuggerTransport instance's this.hooks.onBulkPacket")); + }, + + /** + * Remove all handlers and references related to the current incoming packet, + * either because it is now complete or because the transport is closing. + */ + _destroyIncoming: function() { + if (this._incoming) { + this._incoming.destroy(); + } + this._incomingHeader = ""; + this._incoming = null; + } + + }; + + exports.DebuggerTransport = DebuggerTransport; + + /** + * An adapter that handles data transfers between the debugger client and + * server when they both run in the same process. It presents the same API as + * DebuggerTransport, but instead of transmitting serialized messages across a + * connection it merely calls the packet dispatcher of the other side. + * + * @param other LocalDebuggerTransport + * The other endpoint for this debugger connection. + * + * @see DebuggerTransport + */ + function LocalDebuggerTransport(other) { + EventEmitter.decorate(this); + + this.other = other; + this.hooks = null; + + /* + * A packet number, shared between this and this.other. This isn't used + * by the protocol at all, but it makes the packet traces a lot easier to + * follow. + */ + this._serial = this.other ? this.other._serial : { count: 0 }; + this.close = this.close.bind(this); + } + + LocalDebuggerTransport.prototype = { + /** + * Transmit a message by directly calling the onPacket handler of the other + * endpoint. + */ + send: function(packet) { + this.emit("send", packet); + + let serial = this._serial.count++; + if (dumpn.wantLogging) { + /* Check 'from' first, as 'echo' packets have both. */ + if (packet.from) { + dumpn("Packet " + serial + " sent from " + uneval(packet.from)); + } else if (packet.to) { + dumpn("Packet " + serial + " sent to " + uneval(packet.to)); + } + } + this._deepFreeze(packet); + let other = this.other; + if (other) { + 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)); + } + if (other.hooks) { + other.emit("onPacket", packet); + other.hooks.onPacket(packet); + } + }, "LocalDebuggerTransport instance's this.other.hooks.onPacket")); + } + }, + + /** + * Send a streaming bulk packet directly to the onBulkPacket handler of the + * other endpoint. + * + * This case is much simpler than the full DebuggerTransport, since there is + * no primary stream we have to worry about managing while we hand it off to + * others temporarily. Instead, we can just make a single use pipe and be + * done with it. + */ + startBulkSend: function({actor, type, length}) { + this.emit("startBulkSend", {actor, type, length}); + + let serial = this._serial.count++; + + dumpn("Sent bulk packet " + serial + " for actor " + actor); + if (!this.other) { + return; + } + + let pipe = new Pipe(true, true, 0, 0, null); + + DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { + dumpn("Received bulk packet " + serial); + if (!this.other.hooks) { + return; + } + + // Receiver + let deferred = promise.defer(); + let packet = { + actor: actor, + type: type, + length: length, + copyTo: (output) => { + let copying = + StreamUtils.copyStream(pipe.inputStream, output, length); + deferred.resolve(copying); + return copying; + }, + stream: pipe.inputStream, + done: deferred + }; + + this.other.emit("onBulkPacket", packet); + this.other.hooks.onBulkPacket(packet); + + // Await the result of reading from the stream + deferred.promise.then(() => pipe.inputStream.close(), this.close); + }, "LocalDebuggerTransport instance's this.other.hooks.onBulkPacket")); + + // Sender + let sendDeferred = promise.defer(); + + // The remote transport is not capable of resolving immediately here, so we + // shouldn't be able to either. + DevToolsUtils.executeSoon(() => { + let copyDeferred = promise.defer(); + + sendDeferred.resolve({ + copyFrom: (input) => { + let copying = + StreamUtils.copyStream(input, pipe.outputStream, length); + copyDeferred.resolve(copying); + return copying; + }, + stream: pipe.outputStream, + done: copyDeferred + }); + + // Await the result of writing to the stream + copyDeferred.promise.then(() => pipe.outputStream.close(), this.close); + }); + + return sendDeferred.promise; + }, + + /** + * Close the transport. + */ + close: function() { + this.emit("close"); + + if (this.other) { + // Remove the reference to the other endpoint before calling close(), to + // avoid infinite recursion. + let other = this.other; + this.other = null; + other.close(); + } + if (this.hooks) { + try { + this.hooks.onClosed(); + } catch(ex) { + console.error(ex); + } + this.hooks = null; + } + }, + + /** + * An empty method for emulating the DebuggerTransport API. + */ + ready: function() {}, + + /** + * Helper function that makes an object fully immutable. + */ + _deepFreeze: function(object) { + Object.freeze(object); + for (let prop in object) { + // Freeze the properties that are objects, not on the prototype, and not + // already frozen. Note that this might leave an unfrozen reference + // somewhere in the object if there is an already frozen object containing + // an unfrozen object. + if (object.hasOwnProperty(prop) && typeof object === "object" && + !Object.isFrozen(object)) { + this._deepFreeze(o[prop]); + } + } + } + }; + + exports.LocalDebuggerTransport = LocalDebuggerTransport; + + /** + * A transport for the debugging protocol that uses nsIMessageSenders to + * exchange packets with servers running in child processes. + * + * In the parent process, |sender| should be the nsIMessageSender for the + * child process. In a child process, |sender| should be the child process + * message manager, which sends packets to the parent. + * + * |prefix| is a string included in the message names, to distinguish + * multiple servers running in the same child process. + * + * This transport exchanges messages named 'debug::packet', where + * is |prefix|, whose data is the protocol packet. + */ + function ChildDebuggerTransport(sender, prefix) { + EventEmitter.decorate(this); + + this._sender = sender.QueryInterface(Ci.nsIMessageSender); + this._messageName = "debug:" + prefix + ":packet"; + } + + /* + * To avoid confusion, we use 'message' to mean something that + * nsIMessageSender conveys, and 'packet' to mean a remote debugging + * protocol packet. + */ + ChildDebuggerTransport.prototype = { + constructor: ChildDebuggerTransport, + + hooks: null, + + ready: function () { + this._sender.addMessageListener(this._messageName, this); + }, + + close: function () { + this._sender.removeMessageListener(this._messageName, this); + this.emit("onClosed"); + this.hooks.onClosed(); + }, + + receiveMessage: function ({data}) { + this.emit("onPacket", data); + this.hooks.onPacket(data); + }, + + send: function (packet) { + this.emit("send", packet); + this._sender.sendAsyncMessage(this._messageName, packet); + }, + + startBulkSend: function() { + throw new Error("Can't send bulk data to child processes."); + } + }; + + exports.ChildDebuggerTransport = ChildDebuggerTransport; + + // WorkerDebuggerTransport is defined differently depending on whether we are + // on the main thread or a worker thread. In the former case, we are required + // by the devtools loader, and isWorker will be false. Otherwise, we are + // required by the worker loader, and isWorker will be true. + // + // Each worker debugger supports only a single connection to the main thread. + // However, its theoretically possible for multiple servers to connect to the + // 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') { // i.e. not in a worker + (function () { // Main thread + /** + * A transport that uses a WorkerDebugger to send packets from the main + * thread to a worker thread. + */ + function WorkerDebuggerTransport(dbg, id) { + this._dbg = dbg; + this._id = id; + this.onMessage = this._onMessage.bind(this); + } + + WorkerDebuggerTransport.prototype = { + constructor: WorkerDebuggerTransport, + + ready: function () { + this._dbg.addListener(this); + }, + + close: function () { + this._dbg.removeListener(this); + if (this.hooks) { + this.hooks.onClosed(); + } + }, + + send: function (packet) { + this._dbg.postMessage(JSON.stringify({ + type: "message", + id: this._id, + message: packet + })); + }, + + startBulkSend: function () { + throw new Error("Can't send bulk data from worker threads!"); + }, + + _onMessage: function (message) { + let packet = JSON.parse(message); + if (packet.type !== "message" || packet.id !== this._id) { + return; + } + + if (this.hooks) { + this.hooks.onPacket(packet.message); + } + } + }; + + exports.WorkerDebuggerTransport = WorkerDebuggerTransport; + }).call(this); + } else { + (function () { // Worker thread + /* + * A transport that uses a WorkerDebuggerGlobalScope to send packets from a + * worker thread to the main thread. + */ + function WorkerDebuggerTransport(scope, id) { + this._scope = scope; + this._id = id; + this._onMessage = this._onMessage.bind(this); + } + + WorkerDebuggerTransport.prototype = { + constructor: WorkerDebuggerTransport, + + ready: function () { + this._scope.addEventListener("message", this._onMessage); + }, + + close: function () { + this._scope.removeEventListener("message", this._onMessage); + if (this.hooks) { + this.hooks.onClosed(); + } + }, + + send: function (packet) { + this._scope.postMessage(JSON.stringify({ + type: "message", + id: this._id, + message: packet + })); + }, + + startBulkSend: function () { + throw new Error("Can't send bulk data from worker threads!"); + }, + + _onMessage: function (event) { + let packet = JSON.parse(event.data); + if (packet.type !== "message" || packet.id !== this._id) { + return; + } + + if (this.hooks) { + this.hooks.onPacket(packet.message); + } + } + }; + + exports.WorkerDebuggerTransport = WorkerDebuggerTransport; + }).call(this); + } + + +/***/ }, +/* 42 */ +/***/ 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/. */ + + /* General utilities used throughout devtools. */ + var { Ci, Cu, Cc, components } = __webpack_require__(35); + const { Services } = __webpack_require__(28); + var promise = __webpack_require__(40); + + const { FileUtils } = __webpack_require__(43); + + /** + * Turn the error |aError| into a string, without fail. + */ + exports.safeErrorString = function safeErrorString(aError) { + try { + let 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) { + let 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) { + let 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() { + let 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) { + let 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) { + const deferred = promise.defer(); + + let i = 0; + let len = aArray.length; + let outstanding = [deferred.promise]; + + (function loop() { + const 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() { + const 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) { + let root = aObj; + try { + do { + const 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 { + let 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. + } + + let 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, ...aArgs) { + for (let attrs of aArgs) { + for (let key in attrs) { + let 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! + let haveLoggedDeprecationMessage = false; + exports.dbg_assert = function dbg_assert(cond, e) { + if (!haveLoggedDeprecationMessage) { + haveLoggedDeprecationMessage = true; + const 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; + } + }; + + const { AppConstants } = __webpack_require__(44); + + /** + * No operation. The empty function. + */ + exports.noop = function() { }; + + function reallyAssert(condition, message) { + if (!condition) { + const 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 || this.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]; + }); + }; + + const { NetUtil } = __webpack_require__(45); + + const { TextDecoder, OS } = __webpack_require__(46); + + const NetworkHelper = __webpack_require__(47); + + /** + * Performs a request to load the desired URL and returns a promise. + * + * @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/ + */ + function mainThreadFetch(aURL, aOptions = { loadFromCache: true, + policy: Ci.nsIContentPolicy.TYPE_OTHER, + window: null, + charset: null }) { + // Create a channel. + let url = aURL.split(" -> ").pop(); + let channel; + 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; + } + + let deferred = promise.defer(); + let onResponse = (stream, status, request) => { + if (!components.isSuccessCode(status)) { + deferred.reject(new Error(`Failed to fetch ${url}. Code ${status}.`)); + return; + } + + 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. + let available = stream.available(); + let 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. + let charset = channel.contentCharset || aOptions.charset || "UTF-8"; + let unicodeSource = NetworkHelper.convertToUnicode(source, charset); + + deferred.resolve({ + content: unicodeSource, + contentType: request.contentType + }); + } catch (ex) { + let 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); + let result = OS.File.read(uri.file.path).then(bytes => { + // Convert the bytearray to a String. + let decoder = new TextDecoder(); + let 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); + } + } + }; + + // Open the channel + try { + NetUtil.asyncFetch(channel, onResponse); + } catch (ex) { + return promise.reject(ex); + } + + return deferred.promise; + } + + /** + * Opens a channel for given URL. Tries a bit harder than NetUtil.newChannel. + * + * @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. + */ + function newChannelForURL(url, { policy }) { + let 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); + }; + } + + /** + * 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."); + } + + let deferred = promise.defer(); + + values = Array.isArray(values) ? values : [...values]; + let countdown = values.length; + let resolutionValues = new Array(countdown); + let rejectionValue; + let 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); + } + } + + for (let i = 0; i < values.length; i++) { + let index = i; + let value = values[i]; + let resolver = result => { + resolutionValues[index] = result; + checkForCompletion(); + }; + let 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); + } + } + + 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; + } + }); + + /** + * Open the file at the given path for reading. + * + * @param {String} filePath + * + * @returns Promise + */ + exports.openFileStream = function(filePath) { + return new Promise((resolve, reject) => { + const 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; + } + let proto = Object.getPrototypeOf(fn); + if (!proto) { + return false; + } + let 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]"; + }; + + +/***/ }, +/* 43 */ +/***/ function(module, exports) { + + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/FileUtils.jsm + */ + + +/***/ }, +/* 44 */ +/***/ function(module, exports) { + + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/AppConstants.jsm + */ + + module.exports = { AppConstants: {} }; + + +/***/ }, +/* 45 */ +/***/ function(module, exports) { + + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/netwerk/base/NetUtil.jsm + */ + + +/***/ }, +/* 46 */ +/***/ function(module, exports) { + + /* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/components/osfile/osfile.jsm + */ + + +/***/ }, +/* 47 */ +/***/ 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"; + + const {components, Cc, Ci, Cu} = __webpack_require__(35); + const { NetUtil } = __webpack_require__(45); + const DevToolsUtils = __webpack_require__(42); + + // The cache used in the `nsIURL` function. + const gNSURLStore = new Map(); + + /** + * Helper object for networking stuff. + * + * Most of the following functions have been taken from the Firebug source. They + * have been modified to match the Firefox coding rules. + */ + 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) + { + let conv = Cc("@mozilla.org/intl/scriptableunicodeconverter"). + createInstance(Ci.nsIScriptableUnicodeConverter); + try { + conv.charset = aCharset || "UTF-8"; + return conv.ConvertToUnicode(aText); + } + catch (ex) { + return aText; + } + }, + + /** + * 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) + { + let text = null; + try { + text = NetUtil.readInputStreamToString(aStream, aStream.available()) + return this.convertToUnicode(text, aCharset); + } + catch (err) { + return text; + } + }, + + /** + * 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) { + let iStream = aRequest.uploadStream; + + let isSeekableStream = false; + if (iStream instanceof Ci.nsISeekableStream) { + isSeekableStream = true; + } + + let prevOffset; + if (isSeekableStream) { + prevOffset = iStream.tell(); + iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); + } + + // Read data from the stream. + let text = this.readAndConvertFromStream(iStream, aCharset); + + // 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; + }, + + /** + * 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) + { + let webNav = aDocShell.QueryInterface(Ci.nsIWebNavigation); + return this.readPostTextFromPageViaWebNav(webNav, aCharset); + }, + + /** + * 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) { + let 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) { + let loadInfo = aRequest.loadInfo; + if (loadInfo && loadInfo.parentOuterWindowID == loadInfo.outerWindowID) { + return (aRequest.loadFlags & Ci.nsIChannel.LOAD_DOCUMENT_URI); + } + } + + return false; + }, + + /** + * 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) + { + let channel = NetUtil.newChannel({uri: aUrl, loadUsingSystemPrincipal: true}); + + // 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; + + NetUtil.asyncFetch( + channel, + (aInputStream, aStatusCode, aRequest) => { + if (!components.isSuccessCode(aStatusCode)) { + aCallback(null); + return; + } + + // Try to get the encoding from the channel. If there is none, then use + // the passed assumed aCharset. + let aChannel = aRequest.QueryInterface(Ci.nsIChannel); + let 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) + { + let cookies = aHeader.split(";"); + let result = []; + + cookies.forEach(function(aCookie) { + let equal = aCookie.indexOf("="); + let name = aCookie.substr(0, equal); + let 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) + { + let rawCookies = aHeader.split(/\r\n|\n|\r/); + let cookies = []; + + rawCookies.forEach(function(aCookie) { + let equal = aCookie.indexOf("="); + let name = unescape(aCookie.substr(0, equal).trim()); + let parts = aCookie.substr(equal + 1).split(";"); + let value = unescape(parts.shift().trim()); + + let cookie = {name: name, value: value}; + + parts.forEach(function(aPart) { + let part = aPart.trim(); + if (part.toLowerCase() == "secure") { + cookie.secure = true; + } + else if (part.toLowerCase() == "httponly") { + cookie.httpOnly = true; + } + else if (part.indexOf("=") > -1) { + let 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; + } + + let 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) { + const info = { + state: "insecure", + }; + + // The request did not contain any security info. + if (!securityInfo) { + return info; + } + + /** + * 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" + */ + + securityInfo.QueryInterface(Ci.nsITransportSecurityInfo); + securityInfo.QueryInterface(Ci.nsISSLStatusProvider); + + const wpl = Ci.nsIWebProgressListener; + const NSSErrorsService = Cc['@mozilla.org/nss_errors_service;1'] + .getService(Ci.nsINSSErrorsService); + const SSLStatus = securityInfo.SSLStatus; + if (!NSSErrorsService.isNSSErrorCode(securityInfo.errorCode)) { + const state = securityInfo.securityState; + + let uri = null; + if (httpActivity.channel && httpActivity.channel.URI) { + uri = httpActivity.channel.URI; + } + 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) { + const 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. + let flags = (httpActivity.private) ? + Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0; + + let 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; + } + + return info; + }, + + /** + * 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) { + let 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."); + } + + 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) { + const 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 + let reasons = []; + + if (state & wpl.STATE_IS_BROKEN) { + let 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. + let paramsArray = aQueryString.replace(/^[?&]/, "").split("&").map(e => { + let 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, aStore = 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 (let prop of Object.getOwnPropertyNames(NetworkHelper)) { + exports[prop] = NetworkHelper[prop]; + } + + +/***/ }, +/* 48 */ +/***/ 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/. */ + + const { Ci, Cc, Cr, CC } = __webpack_require__(35); + const { Services } = __webpack_require__(28); + const { dumpv } = __webpack_require__(42); + const EventEmitter = __webpack_require__(34); + const promise = __webpack_require__(40); + + const IOUtil = Cc("@mozilla.org/io-util;1").getService(Ci.nsIIOUtil); + + const ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1", + "nsIScriptableInputStream", "init"); + + const BUFFER_SIZE = 0x8000; + + /** + * This helper function (and its companion object) are used by bulk senders and + * receivers to read and write data in and out of other streams. Functions that + * make use of this tool are passed to callers when it is time to read or write + * bulk data. It is highly recommended to use these copier functions instead of + * the stream directly because the copier enforces the agreed upon length. + * Since bulk mode reuses an existing stream, the sender and receiver must write + * and read exactly the agreed upon amount of data, or else the entire transport + * will be left in a invalid state. Additionally, other methods of stream + * copying (such as NetUtil.asyncCopy) close the streams involved, which would + * terminate the debugging transport, and so it is avoided here. + * + * Overall, this *works*, but clearly the optimal solution would be able to just + * use the streams directly. If it were possible to fully implement + * nsIInputStream / nsIOutputStream in JS, wrapper streams could be created to + * enforce the length and avoid closing, and consumers could use familiar stream + * utilities like NetUtil.asyncCopy. + * + * The function takes two async streams and copies a precise number of bytes + * from one to the other. Copying begins immediately, but may complete at some + * future time depending on data size. Use the returned promise to know when + * it's complete. + * + * @param input nsIAsyncInputStream + * The stream to copy from. + * @param output nsIAsyncOutputStream + * The stream to copy to. + * @param length Integer + * The amount of data that needs to be copied. + * @return Promise + * The promise is resolved when copying completes or rejected if any + * (unexpected) errors occur. + */ + function copyStream(input, output, length) { + let 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() { + let bytesAvailable = this.input.available(); + let amountToCopy = Math.min(bytesAvailable, this._amountLeft); + this._debug("Trying to copy: " + amountToCopy); + + let bytesCopied; + 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); + } + + }; + + /** + * Read from a stream, one byte at a time, up to the next |delimiter| + * character, but stopping if we've read |count| without finding it. Reading + * also terminates early if there are less than |count| bytes available on the + * stream. In that case, we only read as many bytes as the stream currently has + * to offer. + * TODO: This implementation could be removed if bug 984651 is fixed, which + * provides a native version of the same idea. + * @param stream nsIInputStream + * The input stream to read from. + * @param delimiter string + * The character we're trying to find. + * @param count integer + * The max number of characters to read while searching. + * @return string + * The data collected. If the delimiter was found, this string will + * end with it. + */ + function delimitedRead(stream, delimiter, count) { + dumpv("Starting delimited read for " + delimiter + " up to " + + count + " bytes"); + + let scriptableStream; + if (stream.readBytes) { + scriptableStream = stream; + } else { + scriptableStream = new ScriptableInputStream(stream); + } + + let data = ""; + + // Don't exceed what's available on the stream + count = Math.min(count, stream.available()); + + if (count <= 0) { + return data; + } + + let char; + while (char !== delimiter && count > 0) { + char = scriptableStream.readBytes(1); + count--; + data += char; + } + + return data; + } + + module.exports = { + copyStream: copyStream, + delimitedRead: delimitedRead + }; + + +/***/ }, +/* 49 */ +/***/ 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"; + + /** + * Packets contain read / write functionality for the different packet types + * supported by the debugging protocol, so that a transport can focus on + * delivery and queue management without worrying too much about the specific + * packet types. + * + * They are intended to be "one use only", so a new packet should be + * instantiated for each incoming or outgoing packet. + * + * A complete Packet type should expose at least the following: + * * read(stream, scriptableStream) + * Called when the input stream has data to read + * * write(stream) + * Called when the output stream is ready to write + * * get done() + * Returns true once the packet is done being read / written + * * destroy() + * Called to clean up at the end of use + */ + + const { Cc, Ci, Cu } = __webpack_require__(35); + const DevToolsUtils = __webpack_require__(42); + const { dumpn, dumpv } = DevToolsUtils; + const StreamUtils = __webpack_require__(48); + const promise = __webpack_require__(40); + + /*DevToolsUtils.defineLazyGetter(this, "unicodeConverter", () => { + const unicodeConverter = Cc("@mozilla.org/intl/scriptableunicodeconverter") + .createInstance(Ci.nsIScriptableUnicodeConverter); + unicodeConverter.charset = "UTF-8"; + return unicodeConverter; + });*/ + const utf8 = __webpack_require__(50); + + // 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 + // 1 TiB. + const PACKET_LENGTH_MAX = Math.pow(2, 40); + + /** + * A generic Packet processing object (extended by two subtypes below). + */ + function Packet(transport) { + this._transport = transport; + this._length = 0; + } + + /** + * Attempt to initialize a new Packet based on the incoming packet header we've + * received so far. We try each of the types in succession, trying JSON packets + * first since they are much more common. + * @param header string + * The packet header string to attempt parsing. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + * @return Packet + * The parsed packet of the matching type, or null if no types matched. + */ + Packet.fromHeader = function(header, transport) { + return JSONPacket.fromHeader(header, transport) || + BulkPacket.fromHeader(header, transport); + }; + + Packet.prototype = { + + get length() { + return this._length; + }, + + set length(length) { + if (length > PACKET_LENGTH_MAX) { + throw Error("Packet length " + length + " exceeds the max length of " + + PACKET_LENGTH_MAX); + } + this._length = length; + }, + + destroy: function() { + this._transport = null; + } + + }; + + exports.Packet = Packet; + + /** + * With a JSON packet (the typical packet type sent via the transport), data is + * transferred as a JSON packet serialized into a string, with the string length + * prepended to the packet, followed by a colon ([length]:[packet]). The + * contents of the JSON packet are specified in the Remote Debugging Protocol + * specification. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + */ + function JSONPacket(transport) { + Packet.call(this, transport); + this._data = ""; + this._done = false; + } + + /** + * Attempt to initialize a new JSONPacket based on the incoming packet header + * we've received so far. + * @param header string + * The packet header string to attempt parsing. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + * @return JSONPacket + * The parsed packet, or null if it's not a match. + */ + JSONPacket.fromHeader = function(header, transport) { + let match = this.HEADER_PATTERN.exec(header); + + if (!match) { + return null; + } + + dumpv("Header matches JSON packet"); + let packet = new JSONPacket(transport); + packet.length = +match[1]; + return packet; + }; + + JSONPacket.HEADER_PATTERN = /^(\d+):$/; + + JSONPacket.prototype = Object.create(Packet.prototype); + + Object.defineProperty(JSONPacket.prototype, "object", { + /** + * Gets the object (not the serialized string) being read or written. + */ + get: function() { return this._object; }, + + /** + * Sets the object to be sent when write() is called. + */ + set: function(object) { + this._object = object; + let data = JSON.stringify(object); + this._data = data; + this.length = this._data.length; + } + }); + + JSONPacket.prototype.read = function(stream, scriptableStream) { + dumpv("Reading JSON packet"); + + // Read in more packet data. + this._readData(stream, scriptableStream); + + if (!this.done) { + // Don't have a complete packet yet. + return; + } + + let json = this._data; + try { + json = utf8.decode(json); + this._object = JSON.parse(json); + } catch(e) { + let msg = "Error parsing incoming packet: " + json + " (" + e + + " - " + e.stack + ")"; + if (console.error) { + console.error(msg); + } + dumpn(msg); + return; + } + + this._transport._onJSONObjectReady(this._object); + } + + JSONPacket.prototype._readData = function(stream, scriptableStream) { + if (!scriptableStream) { + scriptableStream = stream; + } + if (dumpv.wantVerbose) { + dumpv("Reading JSON data: _l: " + this.length + " dL: " + + this._data.length + " sA: " + stream.available()); + } + let bytesToRead = Math.min(this.length - this._data.length, + stream.available()); + this._data += scriptableStream.readBytes(bytesToRead); + this._done = this._data.length === this.length; + } + + JSONPacket.prototype.write = function(stream) { + dumpv("Writing JSON packet"); + + if (this._outgoing === undefined) { + // Format the serialized packet to a buffer + this._outgoing = this.length + ":" + this._data; + } + + let written = stream.write(this._outgoing, this._outgoing.length); + this._outgoing = this._outgoing.slice(written); + this._done = !this._outgoing.length; + } + + Object.defineProperty(JSONPacket.prototype, "done", { + get: function() { return this._done; } + }); + + JSONPacket.prototype.toString = function() { + return JSON.stringify(this._object, null, 2); + } + + exports.JSONPacket = JSONPacket; + + /** + * With a bulk packet, data is transferred by temporarily handing over the + * transport's input or output stream to the application layer for writing data + * directly. This can be much faster for large data sets, and avoids various + * stages of copies and data duplication inherent in the JSON packet type. The + * bulk packet looks like: + * + * bulk [actor] [type] [length]:[data] + * + * The interpretation of the data portion depends on the kind of actor and the + * packet's type. See the Remote Debugging Protocol Stream Transport spec for + * more details. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + */ + function BulkPacket(transport) { + Packet.call(this, transport); + this._done = false; + this._readyForWriting = promise.defer(); + } + + /** + * Attempt to initialize a new BulkPacket based on the incoming packet header + * we've received so far. + * @param header string + * The packet header string to attempt parsing. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + * @return BulkPacket + * The parsed packet, or null if it's not a match. + */ + BulkPacket.fromHeader = function(header, transport) { + let match = this.HEADER_PATTERN.exec(header); + + if (!match) { + return null; + } + + dumpv("Header matches bulk packet"); + let packet = new BulkPacket(transport); + packet.header = { + actor: match[1], + type: match[2], + length: +match[3] + }; + return packet; + }; + + BulkPacket.HEADER_PATTERN = /^bulk ([^: ]+) ([^: ]+) (\d+):$/; + + BulkPacket.prototype = Object.create(Packet.prototype); + + BulkPacket.prototype.read = function(stream) { + dumpv("Reading bulk packet, handing off input stream"); + + // Temporarily pause monitoring of the input stream + this._transport.pauseIncoming(); + + let deferred = promise.defer(); + + this._transport._onBulkReadReady({ + actor: this.actor, + type: this.type, + length: this.length, + copyTo: (output) => { + dumpv("CT length: " + this.length); + let copying = StreamUtils.copyStream(stream, output, this.length); + deferred.resolve(copying); + return copying; + }, + stream: stream, + done: deferred + }); + + // Await the result of reading from the stream + deferred.promise.then(() => { + dumpv("onReadDone called, ending bulk mode"); + this._done = true; + this._transport.resumeIncoming(); + }, this._transport.close); + + // Ensure this is only done once + this.read = () => { + throw new Error("Tried to read() a BulkPacket's stream multiple times."); + }; + } + + BulkPacket.prototype.write = function(stream) { + dumpv("Writing bulk packet"); + + if (this._outgoingHeader === undefined) { + dumpv("Serializing bulk packet header"); + // Format the serialized packet header to a buffer + this._outgoingHeader = "bulk " + this.actor + " " + this.type + " " + + this.length + ":"; + } + + // Write the header, or whatever's left of it to write. + if (this._outgoingHeader.length) { + dumpv("Writing bulk packet header"); + let written = stream.write(this._outgoingHeader, + this._outgoingHeader.length); + this._outgoingHeader = this._outgoingHeader.slice(written); + return; + } + + dumpv("Handing off output stream"); + + // Temporarily pause the monitoring of the output stream + this._transport.pauseOutgoing(); + + let deferred = promise.defer(); + + this._readyForWriting.resolve({ + copyFrom: (input) => { + dumpv("CF length: " + this.length); + let copying = StreamUtils.copyStream(input, stream, this.length); + deferred.resolve(copying); + return copying; + }, + stream: stream, + done: deferred + }); + + // Await the result of writing to the stream + deferred.promise.then(() => { + dumpv("onWriteDone called, ending bulk mode"); + this._done = true; + this._transport.resumeOutgoing(); + }, this._transport.close); + + // Ensure this is only done once + this.write = () => { + throw new Error("Tried to write() a BulkPacket's stream multiple times."); + }; + } + + Object.defineProperty(BulkPacket.prototype, "streamReadyForWriting", { + get: function() { + return this._readyForWriting.promise; + } + }); + + Object.defineProperty(BulkPacket.prototype, "header", { + get: function() { + return { + actor: this.actor, + type: this.type, + length: this.length + }; + }, + + set: function(header) { + this.actor = header.actor; + this.type = header.type; + this.length = header.length; + }, + }); + + Object.defineProperty(BulkPacket.prototype, "done", { + get: function() { return this._done; }, + }); + + + BulkPacket.prototype.toString = function() { + return "Bulk: " + JSON.stringify(this.header, null, 2); + } + + exports.BulkPacket = BulkPacket; + + /** + * RawPacket is used to test the transport's error handling of malformed + * packets, by writing data directly onto the stream. + * @param transport DebuggerTransport + * The transport instance that will own the packet. + * @param data string + * The raw string to send out onto the stream. + */ + function RawPacket(transport, data) { + Packet.call(this, transport); + this._data = data; + this.length = data.length; + this._done = false; + } + + RawPacket.prototype = Object.create(Packet.prototype); + + RawPacket.prototype.read = function(stream) { + // This hasn't yet been needed for testing. + throw Error("Not implmented."); + } + + RawPacket.prototype.write = function(stream) { + let written = stream.write(this._data, this._data.length); + this._data = this._data.slice(written); + this._done = !this._data.length; + } + + Object.defineProperty(RawPacket.prototype, "done", { + get: function() { return this._done; } + }); + + exports.RawPacket = RawPacket; + + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! 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; + } + + }(this)); + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) + +/***/ }, /* 51 */ /***/ function(module, exports) { @@ -1188,21 +10049,6858 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 52 */, -/* 53 */, -/* 54 */, -/* 55 */, -/* 56 */, -/* 57 */, -/* 58 */, -/* 59 */, -/* 60 */, -/* 61 */, -/* 62 */, -/* 63 */, -/* 64 */, -/* 65 */, -/* 66 */, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! 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; + } + + }(this)); + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module), (function() { return this; }()))) + +/***/ }, +/* 53 */ +/***/ 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/. */ + + const { Ci, Cu, components } = __webpack_require__(35); + const { Services } = __webpack_require__(28); + const DevToolsUtils = __webpack_require__(42); + + // WARNING I swapped the sync one for the async one here + // const promise = require("resource://devtools/shared/deprecated-sync-thenables.js", {}).Promise; + const promise = __webpack_require__(40); + + const events = __webpack_require__(54); + const { WebConsoleClient } = __webpack_require__(56); + /* const { DebuggerSocket } = require("../shared/security/socket");*/ + /* const Authentication = require("../shared/security/auth");*/ + + const noop = () => {}; + + /** + * TODO: Get rid of this API in favor of EventTarget (bug 1042642) + * + * Add simple event notification to a prototype object. Any object that has + * some use for event notifications or the observer pattern in general can be + * augmented with the necessary facilities by passing its prototype to this + * function. + * + * @param aProto object + * The prototype object that will be modified. + */ + function eventSource(aProto) { + /** + * Add a listener to the event source for a given event. + * + * @param aName string + * The event to listen for. + * @param aListener function + * Called when the event is fired. If the same listener + * is added more than once, it will be called once per + * addListener call. + */ + aProto.addListener = function(aName, aListener) { + if (typeof aListener != "function") { + throw TypeError("Listeners must be functions."); + } + + if (!this._listeners) { + this._listeners = {}; + } + + this._getListeners(aName).push(aListener); + }; + + /** + * Add a listener to the event source for a given event. The + * listener will be removed after it is called for the first time. + * + * @param aName string + * The event to listen for. + * @param aListener function + * Called when the event is fired. + */ + aProto.addOneTimeListener = function(aName, aListener) { + let l = (...args) => { + this.removeListener(aName, l); + aListener.apply(null, args); + }; + this.addListener(aName, l); + }; + + /** + * Remove a listener from the event source previously added with + * addListener(). + * + * @param aName string + * The event name used during addListener to add the listener. + * @param aListener function + * The callback to remove. If addListener was called multiple + * times, all instances will be removed. + */ + aProto.removeListener = function(aName, aListener) { + if (!this._listeners || (aListener && !this._listeners[aName])) { + return; + } + + if (!aListener) { + this._listeners[aName] = []; + } + else { + this._listeners[aName] = + this._listeners[aName].filter(function(l) { return l != aListener; }); + } + }; + + /** + * Returns the listeners for the specified event name. If none are defined it + * initializes an empty list and returns that. + * + * @param aName string + * The event name. + */ + aProto._getListeners = function(aName) { + if (aName in this._listeners) { + return this._listeners[aName]; + } + this._listeners[aName] = []; + return this._listeners[aName]; + }; + + /** + * Notify listeners of an event. + * + * @param aName string + * The event to fire. + * @param arguments + * All arguments will be passed along to the listeners, + * including the name argument. + */ + aProto.emit = function() { + if (!this._listeners) { + return; + } + + let name = arguments[0]; + let listeners = this._getListeners(name).slice(0); + + for (let listener of listeners) { + try { + listener.apply(null, arguments); + } catch (e) { + // Prevent a bad listener from interfering with the others. + DevToolsUtils.reportException("notify event '" + name + "'", e); + } + } + }; + } + + /** + * Set of protocol messages that affect thread state, and the + * state the actor is in after each message. + */ + const ThreadStateTypes = { + "paused": "paused", + "resumed": "attached", + "detached": "detached" + }; + + /** + * Set of protocol messages that are sent by the server without a prior request + * by the client. + */ + const 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", + }; + + /** + * Set of pause types that are sent by the server and not as an immediate + * response to a client request. + */ + const UnsolicitedPauses = { + "resumeLimit": "resumeLimit", + "debuggerStatement": "debuggerStatement", + "breakpoint": "breakpoint", + "DOMEvent": "DOMEvent", + "watchpoint": "watchpoint", + "exception": "exception" + }; + + /** + * Creates a client for the remote debugging protocol server. This client + * provides the means to communicate with the server and exchange the messages + * required by the protocol in a traditional JavaScript API. + */ + const DebuggerClient = exports.DebuggerClient = function(aTransport) + { + this._transport = aTransport; + this._transport.hooks = this; + + // Map actor ID to client instance for each actor type. + this._clients = new Map(); + + this._pendingRequests = new Map(); + this._activeRequests = new Map(); + this._eventsEnabled = true; + + this.traits = {}; + + this.request = this.request.bind(this); + this.localTransport = this._transport.onOutputStreamReady === undefined; + + /* + * As the first thing on the connection, expect a greeting packet from + * the connection's root actor. + */ + this.mainRoot = null; + this.expectReply("root", (aPacket) => { + this.mainRoot = new RootClient(this, aPacket); + this.emit("connected", aPacket.applicationType, aPacket.traits); + }); + }; + + /** + * A declarative helper for defining methods that send requests to the server. + * + * @param aPacketSkeleton + * The form of the packet to send. Can specify fields to be filled from + * the parameters by using the |args| function. + * @param telemetry + * The unique suffix of the telemetry histogram id. + * @param before + * The function to call before sending the packet. Is passed the packet, + * and the return value is used as the new packet. The |this| context is + * the instance of the client object we are defining a method for. + * @param after + * The function to call after the response is received. It is passed the + * response, and the return value is considered the new response that + * will be passed to the callback. The |this| context is the instance of + * the client object we are defining a method for. + * @return Request + * The `Request` object that is a Promise object and resolves once + * we receive the response. (See request method for more details) + */ + DebuggerClient.requester = function(aPacketSkeleton, config = {}) { + let { telemetry, before, after } = config; + return DevToolsUtils.makeInfallible(function(...args) { + let histogram, startTime; + if (telemetry) { + let transportType = this._transport.onOutputStreamReady === undefined + ? "LOCAL_" + : "REMOTE_"; + let histogramId = "DEVTOOLS_DEBUGGER_RDP_" + + transportType + telemetry + "_MS"; + histogram = Services.telemetry.getHistogramById(histogramId); + startTime = +new Date(); + } + let outgoingPacket = { + to: aPacketSkeleton.to || this.actor + }; + + let maxPosition = -1; + for (let k of Object.keys(aPacketSkeleton)) { + if (aPacketSkeleton[k] instanceof DebuggerClient.Argument) { + let { position } = aPacketSkeleton[k]; + outgoingPacket[k] = aPacketSkeleton[k].getArgument(args); + maxPosition = Math.max(position, maxPosition); + } else { + outgoingPacket[k] = aPacketSkeleton[k]; + } + } + + if (before) { + outgoingPacket = before.call(this, outgoingPacket); + } + + return this.request(outgoingPacket, DevToolsUtils.makeInfallible((aResponse) => { + if (after) { + let { from } = aResponse; + aResponse = after.call(this, aResponse); + if (!aResponse.from) { + aResponse.from = from; + } + } + + // The callback is always the last parameter. + let thisCallback = args[maxPosition + 1]; + if (thisCallback) { + thisCallback(aResponse); + } + + if (histogram) { + histogram.add(+new Date() - startTime); + } + }, "DebuggerClient.requester request callback")); + }, "DebuggerClient.requester"); + }; + + function args(aPos) { + return new DebuggerClient.Argument(aPos); + } + + DebuggerClient.Argument = function(aPosition) { + this.position = aPosition; + }; + + DebuggerClient.Argument.prototype.getArgument = function(aParams) { + if (!(this.position in aParams)) { + throw new Error("Bad index into params: " + this.position); + } + return aParams[this.position]; + }; + + // Expose these to save callers the trouble of importing DebuggerSocket + DebuggerClient.socketConnect = function(options) { + // Defined here instead of just copying the function to allow lazy-load + return DebuggerSocket.connect(options); + }; + DevToolsUtils.defineLazyGetter(DebuggerClient, "Authenticators", () => { + return Authentication.Authenticators; + }); + DevToolsUtils.defineLazyGetter(DebuggerClient, "AuthenticationResult", () => { + return Authentication.AuthenticationResult; + }); + + DebuggerClient.prototype = { + /** + * Connect to the server and start exchanging protocol messages. + * + * @param aOnConnected function + * If specified, will be called when the greeting packet is + * received from the debugging server. + * + * @return Promise + * Resolves once connected with an array whose first element + * is the application type, by default "browser", and the second + * element is the traits object (help figure out the features + * and behaviors of the server we connect to. See RootActor). + */ + connect: function(aOnConnected) { + return Promise.race([ + new Promise((resolve, reject) => { + this.emit("connect"); + + // Also emit the event on the |DebuggerClient| object (not on the instance), + // so it's possible to track all instances. + events.emit(DebuggerClient, "connect", this); + + this.addOneTimeListener("connected", (aName, aApplicationType, aTraits) => { + this.traits = aTraits; + if (aOnConnected) { + aOnConnected(aApplicationType, aTraits); + } + resolve([aApplicationType, aTraits]); + }); + + this._transport.ready(); + }), + new Promise((resolve, reject) => { + setTimeout(() => reject(new Error("Connect timeout error")), 6000); + }) + ]); + }, + + /** + * Shut down communication with the debugging server. + * + * @param aOnClosed function + * If specified, will be called when the debugging connection + * has been closed. + */ + close: function(aOnClosed) { + // Disable detach event notifications, because event handlers will be in a + // cleared scope by the time they run. + this._eventsEnabled = false; + + let cleanup = () => { + this._transport.close(); + this._transport = null; + }; + + // If the connection is already closed, + // there is no need to detach client + // as we won't be able to send any message. + if (this._closed) { + cleanup(); + if (aOnClosed) { + aOnClosed(); + } + return; + } + + if (aOnClosed) { + this.addOneTimeListener("closed", function(aEvent) { + aOnClosed(); + }); + } + + // Call each client's `detach` method by calling + // lastly registered ones first to give a chance + // to detach child clients first. + let clients = [...this._clients.values()]; + this._clients.clear(); + const detachClients = () => { + let client = clients.pop(); + if (!client) { + // All clients detached. + cleanup(); + return; + } + if (client.detach) { + client.detach(detachClients); + return; + } + detachClients(); + }; + detachClients(); + }, + + /* + * This function exists only to preserve DebuggerClient's interface; + * new code should say 'client.mainRoot.listTabs()'. + */ + listTabs: function(aOnResponse) { return this.mainRoot.listTabs(aOnResponse); }, + + /* + * This function exists only to preserve DebuggerClient's interface; + * new code should say 'client.mainRoot.listAddons()'. + */ + listAddons: function(aOnResponse) { return this.mainRoot.listAddons(aOnResponse); }, + + getTab: function(aFilter) { return this.mainRoot.getTab(aFilter); }, + + /** + * Attach to a tab actor. + * + * @param string aTabActor + * The actor ID for the tab to attach. + * @param function aOnResponse + * Called with the response packet and a TabClient + * (which will be undefined on error). + */ + attachTab: function(aTabActor, aOnResponse = noop) { + if (this._clients.has(aTabActor)) { + let cachedTab = this._clients.get(aTabActor); + let cachedResponse = { + cacheDisabled: cachedTab.cacheDisabled, + javascriptEnabled: cachedTab.javascriptEnabled, + traits: cachedTab.traits, + }; + DevToolsUtils.executeSoon(() => aOnResponse(cachedResponse, cachedTab)); + return promise.resolve([cachedResponse, cachedTab]); + } + + let packet = { + to: aTabActor, + type: "attach" + }; + return this.request(packet).then(aResponse => { + let tabClient; + if (!aResponse.error) { + tabClient = new TabClient(this, aResponse); + this.registerClient(tabClient); + } + aOnResponse(aResponse, tabClient); + return [aResponse, tabClient]; + }); + }, + + attachWorker: function DC_attachWorker(aWorkerActor, aOnResponse = noop) { + let workerClient = this._clients.get(aWorkerActor); + if (workerClient !== undefined) { + let response = { + from: workerClient.actor, + type: "attached", + url: workerClient.url + }; + DevToolsUtils.executeSoon(() => aOnResponse(response, workerClient)); + return promise.resolve([response, workerClient]); + } + + return this.request({ to: aWorkerActor, type: "attach" }).then(aResponse => { + if (aResponse.error) { + aOnResponse(aResponse, null); + return [aResponse, null]; + } + + let workerClient = new WorkerClient(this, aResponse); + this.registerClient(workerClient); + aOnResponse(aResponse, workerClient); + return [aResponse, workerClient]; + }); + }, + + /** + * Attach to an addon actor. + * + * @param string aAddonActor + * The actor ID for the addon to attach. + * @param function aOnResponse + * Called with the response packet and a AddonClient + * (which will be undefined on error). + */ + attachAddon: function DC_attachAddon(aAddonActor, aOnResponse = noop) { + let packet = { + to: aAddonActor, + type: "attach" + }; + return this.request(packet).then(aResponse => { + let addonClient; + if (!aResponse.error) { + addonClient = new AddonClient(this, aAddonActor); + this.registerClient(addonClient); + this.activeAddon = addonClient; + } + aOnResponse(aResponse, addonClient); + return [aResponse, addonClient]; + }); + }, + + /** + * Attach to a Web Console actor. + * + * @param string aConsoleActor + * The ID for the console actor to attach to. + * @param array aListeners + * The console listeners you want to start. + * @param function aOnResponse + * Called with the response packet and a WebConsoleClient + * instance (which will be undefined on error). + */ + attachConsole: + function(aConsoleActor, aListeners, aOnResponse = noop) { + let packet = { + to: aConsoleActor, + type: "startListeners", + listeners: aListeners, + }; + + return this.request(packet).then(aResponse => { + let consoleClient; + if (!aResponse.error) { + if (this._clients.has(aConsoleActor)) { + consoleClient = this._clients.get(aConsoleActor); + } else { + consoleClient = new WebConsoleClient(this, aResponse); + this.registerClient(consoleClient); + } + } + aOnResponse(aResponse, consoleClient); + return [aResponse, consoleClient]; + }); + }, + + /** + * Attach to a global-scoped thread actor for chrome debugging. + * + * @param string aThreadActor + * The actor ID for the thread to attach. + * @param function aOnResponse + * Called with the response packet and a ThreadClient + * (which will be undefined on error). + * @param object aOptions + * Configuration options. + * - useSourceMaps: whether to use source maps or not. + */ + attachThread: function(aThreadActor, aOnResponse = noop, aOptions = {}) { + if (this._clients.has(aThreadActor)) { + let client = this._clients.get(aThreadActor); + DevToolsUtils.executeSoon(() => aOnResponse({}, client)); + return promise.resolve([{}, client]); + } + + let packet = { + to: aThreadActor, + type: "attach", + options: aOptions + }; + return this.request(packet).then(aResponse => { + if (!aResponse.error) { + var threadClient = new ThreadClient(this, aThreadActor); + this.registerClient(threadClient); + } + aOnResponse(aResponse, threadClient); + return [aResponse, threadClient]; + }); + }, + + /** + * Attach to a trace actor. + * + * @param string aTraceActor + * The actor ID for the tracer to attach. + * @param function aOnResponse + * Called with the response packet and a TraceClient + * (which will be undefined on error). + */ + attachTracer: function(aTraceActor, aOnResponse = noop) { + if (this._clients.has(aTraceActor)) { + let client = this._clients.get(aTraceActor); + DevToolsUtils.executeSoon(() => aOnResponse({}, client)); + return promise.resolve([{}, client]); + } + + let packet = { + to: aTraceActor, + type: "attach" + }; + return this.request(packet).then(aResponse => { + if (!aResponse.error) { + var traceClient = new TraceClient(this, aTraceActor); + this.registerClient(traceClient); + } + aOnResponse(aResponse, traceClient); + return [aResponse, traceClient]; + }); + }, + + /** + * Fetch the ChromeActor for the main process or ChildProcessActor for a + * a given child process ID. + * + * @param number aId + * The ID for the process to attach (returned by `listProcesses`). + * Connected to the main process if omitted, or is 0. + */ + getProcess: function(aId) { + let packet = { + to: "root", + type: "getProcess" + }; + if (typeof (aId) == "number") { + packet.id = aId; + } + return this.request(packet); + }, + + /** + * Release an object actor. + * + * @param string aActor + * The actor ID to send the request to. + * @param aOnResponse function + * If specified, will be called with the response packet when + * debugging server responds. + */ + release: DebuggerClient.requester({ + to: args(0), + type: "release" + }, { + telemetry: "RELEASE" + }), + + /** + * Send a request to the debugging server. + * + * @param aRequest object + * A JSON packet to send to the debugging server. + * @param aOnResponse function + * If specified, will be called with the JSON response packet when + * debugging server responds. + * @return Request + * This object emits a number of events to allow you to respond to + * different parts of the request lifecycle. + * It is also a Promise object, with a `then` method, that is resolved + * whenever a JSON or a Bulk response is received; and is rejected + * if the response is an error. + * Note: This return value can be ignored if you are using JSON alone, + * because the callback provided in |aOnResponse| will be bound to the + * "json-reply" event automatically. + * + * Events emitted: + * * json-reply: The server replied with a JSON packet, which is + * passed as event data. + * * bulk-reply: The server replied with bulk data, which you can read + * using the event data object containing: + * * actor: Name of actor that received the packet + * * type: Name of actor's method that was called on receipt + * * length: Size of the data to be read + * * stream: This input stream should only be used directly if you + * can ensure that you will read exactly |length| bytes + * and will not close the stream when reading is complete + * * done: If you use the stream directly (instead of |copyTo| + * below), you must signal completion by resolving / + * rejecting this deferred. If it's rejected, the + * transport will be closed. If an Error is supplied as a + * rejection value, it will be logged via |dumpn|. If you + * do use |copyTo|, resolving is taken care of for you + * when copying completes. + * * copyTo: A helper function for getting your data out of the + * stream that meets the stream handling requirements + * above, and has the following signature: + * @param output nsIAsyncOutputStream + * The stream to copy to. + * @return Promise + * The promise is resolved when copying completes or + * rejected if any (unexpected) errors occur. + * This object also emits "progress" events for each chunk + * that is copied. See stream-utils.js. + */ + request: function(aRequest, aOnResponse) { + if (!this.mainRoot) { + throw Error("Have not yet received a hello packet from the server."); + } + let type = aRequest.type || ""; + if (!aRequest.to) { + throw Error("'" + type + "' request packet has no destination."); + } + if (this._closed) { + let msg = "'" + type + "' request packet to " + + "'" + aRequest.to + "' " + + "can't be sent as the connection is closed."; + let resp = { error: "connectionClosed", message: msg }; + if (aOnResponse) { + aOnResponse(resp); + } + return promise.reject(resp); + } + + let request = new Request(aRequest); + request.format = "json"; + request.stack = components.stack; + if (aOnResponse) { + request.on("json-reply", aOnResponse); + } + + this._sendOrQueueRequest(request); + + // Implement a Promise like API on the returned object + // that resolves/rejects on request response + let deferred = promise.defer(); + function listenerJson(resp) { + request.off("json-reply", listenerJson); + request.off("bulk-reply", listenerBulk); + if (resp.error) { + deferred.reject(resp); + } else { + deferred.resolve(resp); + } + } + function listenerBulk(resp) { + request.off("json-reply", listenerJson); + request.off("bulk-reply", listenerBulk); + deferred.resolve(resp); + } + request.on("json-reply", listenerJson); + request.on("bulk-reply", listenerBulk); + request.then = deferred.promise.then.bind(deferred.promise); + + return request; + }, + + /** + * Transmit streaming data via a bulk request. + * + * This method initiates the bulk send process by queuing up the header data. + * The caller receives eventual access to a stream for writing. + * + * Since this opens up more options for how the server might respond (it could + * send back either JSON or bulk data), and the returned Request object emits + * events for different stages of the request process that you may want to + * react to. + * + * @param request Object + * This is modeled after the format of JSON packets above, but does not + * actually contain the data, but is instead just a routing header: + * * actor: Name of actor that will receive the packet + * * type: Name of actor's method that should be called on receipt + * * length: Size of the data to be sent + * @return Request + * This object emits a number of events to allow you to respond to + * different parts of the request lifecycle. + * + * Events emitted: + * * bulk-send-ready: Ready to send bulk data to the server, using the + * event data object containing: + * * stream: This output stream should only be used directly if + * you can ensure that you will write exactly |length| + * bytes and will not close the stream when writing is + * complete + * * done: If you use the stream directly (instead of |copyFrom| + * below), you must signal completion by resolving / + * rejecting this deferred. If it's rejected, the + * transport will be closed. If an Error is supplied as + * a rejection value, it will be logged via |dumpn|. If + * you do use |copyFrom|, resolving is taken care of for + * you when copying completes. + * * copyFrom: A helper function for getting your data onto the + * stream that meets the stream handling requirements + * above, and has the following signature: + * @param input nsIAsyncInputStream + * The stream to copy from. + * @return Promise + * The promise is resolved when copying completes or + * rejected if any (unexpected) errors occur. + * This object also emits "progress" events for each chunk + * that is copied. See stream-utils.js. + * * json-reply: The server replied with a JSON packet, which is + * passed as event data. + * * bulk-reply: The server replied with bulk data, which you can read + * using the event data object containing: + * * actor: Name of actor that received the packet + * * type: Name of actor's method that was called on receipt + * * length: Size of the data to be read + * * stream: This input stream should only be used directly if you + * can ensure that you will read exactly |length| bytes + * and will not close the stream when reading is complete + * * done: If you use the stream directly (instead of |copyTo| + * below), you must signal completion by resolving / + * rejecting this deferred. If it's rejected, the + * transport will be closed. If an Error is supplied as a + * rejection value, it will be logged via |dumpn|. If you + * do use |copyTo|, resolving is taken care of for you + * when copying completes. + * * copyTo: A helper function for getting your data out of the + * stream that meets the stream handling requirements + * above, and has the following signature: + * @param output nsIAsyncOutputStream + * The stream to copy to. + * @return Promise + * The promise is resolved when copying completes or + * rejected if any (unexpected) errors occur. + * This object also emits "progress" events for each chunk + * that is copied. See stream-utils.js. + */ + startBulkRequest: function(request) { + if (!this.traits.bulk) { + throw Error("Server doesn't support bulk transfers"); + } + if (!this.mainRoot) { + throw Error("Have not yet received a hello packet from the server."); + } + if (!request.type) { + throw Error("Bulk packet is missing the required 'type' field."); + } + if (!request.actor) { + throw Error("'" + request.type + "' bulk packet has no destination."); + } + if (!request.length) { + throw Error("'" + request.type + "' bulk packet has no length."); + } + + request = new Request(request); + request.format = "bulk"; + + this._sendOrQueueRequest(request); + + return request; + }, + + /** + * If a new request can be sent immediately, do so. Otherwise, queue it. + */ + _sendOrQueueRequest(request) { + let actor = request.actor; + if (!this._activeRequests.has(actor)) { + this._sendRequest(request); + } else { + this._queueRequest(request); + } + }, + + /** + * Send a request. + * @throws Error if there is already an active request in flight for the same + * actor. + */ + _sendRequest(request) { + let actor = request.actor; + this.expectReply(actor, request); + + if (request.format === "json") { + this._transport.send(request.request); + return false; + } + + this._transport.startBulkSend(request.request).then((...args) => { + request.emit("bulk-send-ready", ...args); + }); + }, + + /** + * Queue a request to be sent later. Queues are only drained when an in + * flight request to a given actor completes. + */ + _queueRequest(request) { + let actor = request.actor; + let queue = this._pendingRequests.get(actor) || []; + queue.push(request); + this._pendingRequests.set(actor, queue); + }, + + /** + * Attempt the next request to a given actor (if any). + */ + _attemptNextRequest(actor) { + if (this._activeRequests.has(actor)) { + return; + } + let queue = this._pendingRequests.get(actor); + if (!queue) { + return; + } + let request = queue.shift(); + if (queue.length === 0) { + this._pendingRequests.delete(actor); + } + this._sendRequest(request); + }, + + /** + * Arrange to hand the next reply from |aActor| to the handler bound to + * |aRequest|. + * + * DebuggerClient.prototype.request / startBulkRequest usually takes care of + * establishing the handler for a given request, but in rare cases (well, + * greetings from new root actors, is the only case at the moment) we must be + * prepared for a "reply" that doesn't correspond to any request we sent. + */ + expectReply: function(aActor, aRequest) { + if (this._activeRequests.has(aActor)) { + throw Error("clashing handlers for next reply from " + uneval(aActor)); + } + + // If a handler is passed directly (as it is with the handler for the root + // actor greeting), create a dummy request to bind this to. + if (typeof aRequest === "function") { + let handler = aRequest; + aRequest = new Request(); + aRequest.on("json-reply", handler); + } + + this._activeRequests.set(aActor, aRequest); + }, + + // Transport hooks. + + /** + * Called by DebuggerTransport to dispatch incoming packets as appropriate. + * + * @param aPacket object + * The incoming packet. + */ + onPacket: function(aPacket) { + if (!aPacket.from) { + DevToolsUtils.reportException( + "onPacket", + new Error("Server did not specify an actor, dropping packet: " + + JSON.stringify(aPacket))); + return; + } + + // If we have a registered Front for this actor, let it handle the packet + // and skip all the rest of this unpleasantness. + let front = this.getActor(aPacket.from); + if (front) { + front.onPacket(aPacket); + return; + } + + if (this._clients.has(aPacket.from) && aPacket.type) { + let client = this._clients.get(aPacket.from); + let type = aPacket.type; + if (client.events.indexOf(type) != -1) { + client.emit(type, aPacket); + // we ignore the rest, as the client is expected to handle this packet. + return; + } + } + + let activeRequest; + // See if we have a handler function waiting for a reply from this + // actor. (Don't count unsolicited notifications or pauses as + // replies.) + if (this._activeRequests.has(aPacket.from) && + !(aPacket.type in UnsolicitedNotifications) && + !(aPacket.type == ThreadStateTypes.paused && + aPacket.why.type in UnsolicitedPauses)) { + activeRequest = this._activeRequests.get(aPacket.from); + this._activeRequests.delete(aPacket.from); + } + + // If there is a subsequent request for the same actor, hand it off to the + // transport. Delivery of packets on the other end is always async, even + // in the local transport case. + this._attemptNextRequest(aPacket.from); + + // Packets that indicate thread state changes get special treatment. + if (aPacket.type in ThreadStateTypes && + this._clients.has(aPacket.from) && + typeof this._clients.get(aPacket.from)._onThreadState == "function") { + this._clients.get(aPacket.from)._onThreadState(aPacket); + } + + // TODO: Bug 1151156 - Remove once Gecko 40 is on b2g-stable. + if (!this.traits.noNeedToFakeResumptionOnNavigation) { + // On navigation the server resumes, so the client must resume as well. + // We achieve that by generating a fake resumption packet that triggers + // the client's thread state change listeners. + if (aPacket.type == UnsolicitedNotifications.tabNavigated && + this._clients.has(aPacket.from) && + this._clients.get(aPacket.from).thread) { + let thread = this._clients.get(aPacket.from).thread; + let resumption = { from: thread._actor, type: "resumed" }; + thread._onThreadState(resumption); + } + } + + // Only try to notify listeners on events, not responses to requests + // that lack a packet type. + if (aPacket.type) { + this.emit(aPacket.type, aPacket); + } + + if (activeRequest) { + let emitReply = () => activeRequest.emit("json-reply", aPacket); + if (activeRequest.stack) { + Cu.callFunctionWithAsyncStack(emitReply, activeRequest.stack, + "DevTools RDP"); + } else { + emitReply(); + } + } + }, + + /** + * Called by the DebuggerTransport to dispatch incoming bulk packets as + * appropriate. + * + * @param packet object + * The incoming packet, which contains: + * * actor: Name of actor that will receive the packet + * * type: Name of actor's method that should be called on receipt + * * length: Size of the data to be read + * * stream: This input stream should only be used directly if you can + * ensure that you will read exactly |length| bytes and will + * not close the stream when reading is complete + * * done: If you use the stream directly (instead of |copyTo| + * below), you must signal completion by resolving / + * rejecting this deferred. If it's rejected, the transport + * will be closed. If an Error is supplied as a rejection + * value, it will be logged via |dumpn|. If you do use + * |copyTo|, resolving is taken care of for you when copying + * completes. + * * copyTo: A helper function for getting your data out of the stream + * that meets the stream handling requirements above, and has + * the following signature: + * @param output nsIAsyncOutputStream + * The stream to copy to. + * @return Promise + * The promise is resolved when copying completes or rejected + * if any (unexpected) errors occur. + * This object also emits "progress" events for each chunk + * that is copied. See stream-utils.js. + */ + onBulkPacket: function(packet) { + let { actor, type, length } = packet; + + if (!actor) { + DevToolsUtils.reportException( + "onBulkPacket", + new Error("Server did not specify an actor, dropping bulk packet: " + + JSON.stringify(packet))); + return; + } + + // See if we have a handler function waiting for a reply from this + // actor. + if (!this._activeRequests.has(actor)) { + return; + } + + let activeRequest = this._activeRequests.get(actor); + this._activeRequests.delete(actor); + + // If there is a subsequent request for the same actor, hand it off to the + // transport. Delivery of packets on the other end is always async, even + // in the local transport case. + this._attemptNextRequest(actor); + + activeRequest.emit("bulk-reply", packet); + }, + + /** + * Called by DebuggerTransport when the underlying stream is closed. + * + * @param aStatus nsresult + * The status code that corresponds to the reason for closing + * the stream. + */ + onClosed: function(aStatus) { + this._closed = true; + this.emit("closed"); + + // Reject all pending and active requests + let reject = function(type, request, actor) { + // Server can send packets on its own and client only pass a callback + // to expectReply, so that there is no request object. + let msg; + if (request.request) { + msg = "'" + request.request.type + "' " + type + " request packet" + + " to '" + actor + "' " + + "can't be sent as the connection just closed."; + } else { + msg = "server side packet from '" + actor + "' can't be received " + + "as the connection just closed."; + } + let packet = { error: "connectionClosed", message: msg }; + request.emit("json-reply", packet); + }; + + let pendingRequests = new Map(this._pendingRequests); + this._pendingRequests.clear(); + pendingRequests.forEach((list, actor) => { + list.forEach(request => reject("pending", request, actor)); + }); + let activeRequests = new Map(this._activeRequests); + this._activeRequests.clear(); + activeRequests.forEach(reject.bind(null, "active")); + + // The |_pools| array on the client-side currently is used only by + // protocol.js to store active fronts, mirroring the actor pools found in + // the server. So, read all usages of "pool" as "protocol.js front". + // + // In the normal case where we shutdown cleanly, the toolbox tells each tool + // to close, and they each call |destroy| on any fronts they were using. + // When |destroy| or |cleanup| is called on a protocol.js front, it also + // removes itself from the |_pools| array. Once the toolbox has shutdown, + // the connection is closed, and we reach here. All fronts (should have + // been) |destroy|ed, so |_pools| should empty. + // + // If the connection instead aborts unexpectedly, we may end up here with + // all fronts used during the life of the connection. So, we call |cleanup| + // on them clear their state, reject pending requests, and remove themselves + // from |_pools|. This saves the toolbox from hanging indefinitely, in case + // it waits for some server response before shutdown that will now never + // arrive. + for (let pool of this._pools) { + pool.cleanup(); + } + }, + + registerClient: function(client) { + let actorID = client.actor; + if (!actorID) { + throw new Error("DebuggerServer.registerClient expects " + + "a client instance with an `actor` attribute."); + } + if (!Array.isArray(client.events)) { + throw new Error("DebuggerServer.registerClient expects " + + "a client instance with an `events` attribute " + + "that is an array."); + } + if (client.events.length > 0 && typeof (client.emit) != "function") { + throw new Error("DebuggerServer.registerClient expects " + + "a client instance with non-empty `events` array to" + + "have an `emit` function."); + } + if (this._clients.has(actorID)) { + throw new Error("DebuggerServer.registerClient already registered " + + "a client for this actor."); + } + this._clients.set(actorID, client); + }, + + unregisterClient: function(client) { + let actorID = client.actor; + if (!actorID) { + throw new Error("DebuggerServer.unregisterClient expects " + + "a Client instance with a `actor` attribute."); + } + this._clients.delete(actorID); + }, + + /** + * Actor lifetime management, echos the server's actor pools. + */ + __pools: null, + get _pools() { + if (this.__pools) { + return this.__pools; + } + this.__pools = new Set(); + return this.__pools; + }, + + addActorPool: function(pool) { + this._pools.add(pool); + }, + removeActorPool: function(pool) { + this._pools.delete(pool); + }, + getActor: function(actorID) { + let pool = this.poolFor(actorID); + return pool ? pool.get(actorID) : null; + }, + + poolFor: function(actorID) { + for (let pool of this._pools) { + if (pool.has(actorID)) return pool; + } + return null; + }, + + /** + * Currently attached addon. + */ + activeAddon: null + }; + + eventSource(DebuggerClient.prototype); + + function Request(request) { + this.request = request; + } + + Request.prototype = { + + on: function(type, listener) { + events.on(this, type, listener); + }, + + off: function(type, listener) { + events.off(this, type, listener); + }, + + once: function(type, listener) { + events.once(this, type, listener); + }, + + emit: function(type, ...args) { + events.emit(this, type, ...args); + }, + + get actor() { return this.request.to || this.request.actor; } + + }; + + /** + * Creates a tab client for the remote debugging protocol server. This client + * is a front to the tab actor created in the server side, hiding the protocol + * details in a traditional JavaScript API. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aForm object + * The protocol form for this tab. + */ + function TabClient(aClient, aForm) { + this.client = aClient; + this._actor = aForm.from; + this._threadActor = aForm.threadActor; + this.javascriptEnabled = aForm.javascriptEnabled; + this.cacheDisabled = aForm.cacheDisabled; + this.thread = null; + this.request = this.client.request; + this.traits = aForm.traits || {}; + this.events = ["workerListChanged"]; + } + + TabClient.prototype = { + get actor() { return this._actor; }, + get _transport() { return this.client._transport; }, + + /** + * Attach to a thread actor. + * + * @param object aOptions + * Configuration options. + * - useSourceMaps: whether to use source maps or not. + * @param function aOnResponse + * Called with the response packet and a ThreadClient + * (which will be undefined on error). + */ + attachThread: function(aOptions = {}, aOnResponse = noop) { + if (this.thread) { + DevToolsUtils.executeSoon(() => aOnResponse({}, this.thread)); + return promise.resolve([{}, this.thread]); + } + + let packet = { + to: this._threadActor, + type: "attach", + options: aOptions + }; + return this.request(packet).then(aResponse => { + if (!aResponse.error) { + this.thread = new ThreadClient(this, this._threadActor); + this.client.registerClient(this.thread); + } + aOnResponse(aResponse, this.thread); + return [aResponse, this.thread]; + }); + }, + + /** + * Detach the client from the tab actor. + * + * @param function aOnResponse + * Called with the response packet. + */ + detach: DebuggerClient.requester({ + type: "detach" + }, { + before: function(aPacket) { + if (this.thread) { + this.thread.detach(); + } + return aPacket; + }, + after: function(aResponse) { + this.client.unregisterClient(this); + return aResponse; + }, + telemetry: "TABDETACH" + }), + + /** + * Bring the window to the front. + */ + focus: DebuggerClient.requester({ + type: "focus" + }, {}), + + /** + * Reload the page in this tab. + * + * @param [optional] object options + * An object with a `force` property indicating whether or not + * this reload should skip the cache + */ + reload: function(options = { force: false }) { + return this._reload(options); + }, + _reload: DebuggerClient.requester({ + type: "reload", + options: args(0) + }, { + telemetry: "RELOAD" + }), + + /** + * Navigate to another URL. + * + * @param string url + * The URL to navigate to. + */ + navigateTo: DebuggerClient.requester({ + type: "navigateTo", + url: args(0) + }, { + telemetry: "NAVIGATETO" + }), + + /** + * Reconfigure the tab actor. + * + * @param object aOptions + * A dictionary object of the new options to use in the tab actor. + * @param function aOnResponse + * Called with the response packet. + */ + reconfigure: DebuggerClient.requester({ + type: "reconfigure", + options: args(0) + }, { + telemetry: "RECONFIGURETAB" + }), + + listWorkers: DebuggerClient.requester({ + type: "listWorkers" + }, { + telemetry: "LISTWORKERS" + }), + + attachWorker: function(aWorkerActor, aOnResponse) { + this.client.attachWorker(aWorkerActor, aOnResponse); + }, + + /** + * Resolve a location ({ url, line, column }) to its current + * source mapping location. + * + * @param {String} arg[0].url + * @param {Number} arg[0].line + * @param {Number?} arg[0].column + */ + resolveLocation: DebuggerClient.requester({ + type: "resolveLocation", + location: args(0) + }), + }; + + eventSource(TabClient.prototype); + + function WorkerClient(aClient, aForm) { + this.client = aClient; + this._actor = aForm.from; + this._isClosed = false; + this._url = aForm.url; + + this._onClose = this._onClose.bind(this); + + this.addListener("close", this._onClose); + + this.traits = {}; + } + + WorkerClient.prototype = { + get _transport() { + return this.client._transport; + }, + + get request() { + return this.client.request; + }, + + get actor() { + return this._actor; + }, + + get url() { + return this._url; + }, + + get isClosed() { + return this._isClosed; + }, + + detach: DebuggerClient.requester({ type: "detach" }, { + after: function(aResponse) { + if (this.thread) { + this.client.unregisterClient(this.thread); + } + this.client.unregisterClient(this); + return aResponse; + }, + + telemetry: "WORKERDETACH" + }), + + attachThread: function(aOptions = {}, aOnResponse = noop) { + if (this.thread) { + let response = [{ + type: "connected", + threadActor: this.thread._actor, + consoleActor: this.consoleActor, + }, this.thread]; + DevToolsUtils.executeSoon(() => aOnResponse(response)); + return response; + } + + // The connect call on server doesn't attach the thread as of version 44. + return this.request({ + to: this._actor, + type: "connect", + options: aOptions, + }).then(connectReponse => { + if (connectReponse.error) { + aOnResponse(connectReponse, null); + return [connectResponse, null]; + } + + return this.request({ + to: connectReponse.threadActor, + type: "attach", + options: aOptions + }).then(attachResponse => { + if (attachResponse.error) { + aOnResponse(attachResponse, null); + } + + this.thread = new ThreadClient(this, connectReponse.threadActor); + this.consoleActor = connectReponse.consoleActor; + this.client.registerClient(this.thread); + + aOnResponse(connectReponse, this.thread); + return [connectResponse, this.thread]; + }); + }); + }, + + _onClose: function() { + this.removeListener("close", this._onClose); + + if (this.thread) { + this.client.unregisterClient(this.thread); + } + this.client.unregisterClient(this); + this._isClosed = true; + }, + + reconfigure: function() { + return Promise.resolve(); + }, + + events: ["close"] + }; + + eventSource(WorkerClient.prototype); + + function AddonClient(aClient, aActor) { + this._client = aClient; + this._actor = aActor; + this.request = this._client.request; + this.events = []; + } + + AddonClient.prototype = { + get actor() { return this._actor; }, + get _transport() { return this._client._transport; }, + + /** + * Detach the client from the addon actor. + * + * @param function aOnResponse + * Called with the response packet. + */ + detach: DebuggerClient.requester({ + type: "detach" + }, { + after: function(aResponse) { + if (this._client.activeAddon === this) { + this._client.activeAddon = null; + } + this._client.unregisterClient(this); + return aResponse; + }, + telemetry: "ADDONDETACH" + }) + }; + + /** + * A RootClient object represents a root actor on the server. Each + * DebuggerClient keeps a RootClient instance representing the root actor + * for the initial connection; DebuggerClient's 'listTabs' and + * 'listChildProcesses' methods forward to that root actor. + * + * @param aClient object + * The client connection to which this actor belongs. + * @param aGreeting string + * The greeting packet from the root actor we're to represent. + * + * Properties of a RootClient instance: + * + * @property actor string + * The name of this child's root actor. + * @property applicationType string + * The application type, as given in the root actor's greeting packet. + * @property traits object + * The traits object, as given in the root actor's greeting packet. + */ + function RootClient(aClient, aGreeting) { + this._client = aClient; + this.actor = aGreeting.from; + this.applicationType = aGreeting.applicationType; + this.traits = aGreeting.traits; + } + exports.RootClient = RootClient; + + RootClient.prototype = { + constructor: RootClient, + + /** + * List the open tabs. + * + * @param function aOnResponse + * Called with the response packet. + */ + listTabs: DebuggerClient.requester({ type: "listTabs" }, + { telemetry: "LISTTABS" }), + + /** + * List the installed addons. + * + * @param function aOnResponse + * Called with the response packet. + */ + listAddons: DebuggerClient.requester({ type: "listAddons" }, + { telemetry: "LISTADDONS" }), + + /** + * List the registered workers. + * + * @param function aOnResponse + * Called with the response packet. + */ + listWorkers: DebuggerClient.requester({ type: "listWorkers" }, + { telemetry: "LISTWORKERS" }), + + /** + * List the registered service workers. + * + * @param function aOnResponse + * Called with the response packet. + */ + listServiceWorkerRegistrations: DebuggerClient.requester({ type: "listServiceWorkerRegistrations" }, + { telemetry: "LISTSERVICEWORKERREGISTRATIONS" }), + + /** + * List the running processes. + * + * @param function aOnResponse + * Called with the response packet. + */ + listProcesses: DebuggerClient.requester({ type: "listProcesses" }, + { telemetry: "LISTPROCESSES" }), + + /** + * Fetch the TabActor for the currently selected tab, or for a specific + * tab given as first parameter. + * + * @param [optional] object aFilter + * A dictionary object with following optional attributes: + * - outerWindowID: used to match tabs in parent process + * - tabId: used to match tabs in child processes + * - tab: a reference to xul:tab element + * If nothing is specified, returns the actor for the currently + * selected tab. + */ + getTab: function(aFilter) { + let packet = { + to: this.actor, + type: "getTab" + }; + + if (aFilter) { + if (typeof (aFilter.outerWindowID) == "number") { + packet.outerWindowID = aFilter.outerWindowID; + } else if (typeof (aFilter.tabId) == "number") { + packet.tabId = aFilter.tabId; + } else if ("tab" in aFilter) { + let browser = aFilter.tab.linkedBrowser; + if (browser.frameLoader.tabParent) { + // Tabs in child process + packet.tabId = browser.frameLoader.tabParent.tabId; + } else { + // Tabs in parent process + let windowUtils = browser.contentWindow + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + packet.outerWindowID = windowUtils.outerWindowID; + } + } else { + // Throw if a filter object have been passed but without + // any clearly idenfified filter. + throw new Error("Unsupported argument given to getTab request"); + } + } + + return this.request(packet); + }, + + /** + * Description of protocol's actors and methods. + * + * @param function aOnResponse + * Called with the response packet. + */ + protocolDescription: DebuggerClient.requester({ type: "protocolDescription" }, + { telemetry: "PROTOCOLDESCRIPTION" }), + + /* + * Methods constructed by DebuggerClient.requester require these forwards + * on their 'this'. + */ + get _transport() { return this._client._transport; }, + get request() { return this._client.request; } + }; + + /** + * Creates a thread client for the remote debugging protocol server. This client + * is a front to the thread actor created in the server side, hiding the + * protocol details in a traditional JavaScript API. + * + * @param aClient DebuggerClient|TabClient + * The parent of the thread (tab for tab-scoped debuggers, DebuggerClient + * for chrome debuggers). + * @param aActor string + * The actor ID for this thread. + */ + function ThreadClient(aClient, aActor) { + this._parent = aClient; + this.client = aClient instanceof DebuggerClient ? aClient : aClient.client; + this._actor = aActor; + this._frameCache = []; + this._scriptCache = {}; + this._pauseGrips = {}; + this._threadGrips = {}; + this.request = this.client.request; + } + + ThreadClient.prototype = { + _state: "paused", + get state() { return this._state; }, + get paused() { return this._state === "paused"; }, + + _pauseOnExceptions: false, + _ignoreCaughtExceptions: false, + _pauseOnDOMEvents: null, + + _actor: null, + get actor() { return this._actor; }, + + get _transport() { return this.client._transport; }, + + _assertPaused: function(aCommand) { + if (!this.paused) { + throw Error(aCommand + " command sent while not paused. Currently " + this._state); + } + }, + + /** + * Resume a paused thread. If the optional aLimit parameter is present, then + * the thread will also pause when that limit is reached. + * + * @param [optional] object aLimit + * An object with a type property set to the appropriate limit (next, + * step, or finish) per the remote debugging protocol specification. + * Use null to specify no limit. + * @param function aOnResponse + * Called with the response packet. + */ + _doResume: DebuggerClient.requester({ + type: "resume", + resumeLimit: args(0) + }, { + before: function(aPacket) { + this._assertPaused("resume"); + + // Put the client in a tentative "resuming" state so we can prevent + // further requests that should only be sent in the paused state. + this._state = "resuming"; + + if (this._pauseOnExceptions) { + aPacket.pauseOnExceptions = this._pauseOnExceptions; + } + if (this._ignoreCaughtExceptions) { + aPacket.ignoreCaughtExceptions = this._ignoreCaughtExceptions; + } + if (this._pauseOnDOMEvents) { + aPacket.pauseOnDOMEvents = this._pauseOnDOMEvents; + } + return aPacket; + }, + after: function(aResponse) { + if (aResponse.error) { + // There was an error resuming, back to paused state. + this._state = "paused"; + } + return aResponse; + }, + telemetry: "RESUME" + }), + + /** + * Reconfigure the thread actor. + * + * @param object aOptions + * A dictionary object of the new options to use in the thread actor. + * @param function aOnResponse + * Called with the response packet. + */ + reconfigure: DebuggerClient.requester({ + type: "reconfigure", + options: args(0) + }, { + telemetry: "RECONFIGURETHREAD" + }), + + /** + * Resume a paused thread. + */ + resume: function(aOnResponse) { + return this._doResume(null, aOnResponse); + }, + + /** + * Resume then pause without stepping. + * + * @param function aOnResponse + * Called with the response packet. + */ + resumeThenPause: function(aOnResponse) { + return this._doResume({ type: "break" }, aOnResponse); + }, + + /** + * Step over a function call. + * + * @param function aOnResponse + * Called with the response packet. + */ + stepOver: function(aOnResponse) { + return this._doResume({ type: "next" }, aOnResponse); + }, + + /** + * Step into a function call. + * + * @param function aOnResponse + * Called with the response packet. + */ + stepIn: function(aOnResponse) { + return this._doResume({ type: "step" }, aOnResponse); + }, + + /** + * Step out of a function call. + * + * @param function aOnResponse + * Called with the response packet. + */ + stepOut: function(aOnResponse) { + return this._doResume({ type: "finish" }, aOnResponse); + }, + + /** + * Immediately interrupt a running thread. + * + * @param function aOnResponse + * Called with the response packet. + */ + interrupt: function(aOnResponse) { + return this._doInterrupt(null, aOnResponse); + }, + + /** + * Pause execution right before the next JavaScript bytecode is executed. + * + * @param function aOnResponse + * Called with the response packet. + */ + breakOnNext: function(aOnResponse) { + return this._doInterrupt("onNext", aOnResponse); + }, + + /** + * Interrupt a running thread. + * + * @param function aOnResponse + * Called with the response packet. + */ + _doInterrupt: DebuggerClient.requester({ + type: "interrupt", + when: args(0) + }, { + telemetry: "INTERRUPT" + }), + + /** + * Enable or disable pausing when an exception is thrown. + * + * @param boolean aFlag + * Enables pausing if true, disables otherwise. + * @param function aOnResponse + * Called with the response packet. + */ + pauseOnExceptions: function(aPauseOnExceptions, + aIgnoreCaughtExceptions, + aOnResponse = noop) { + this._pauseOnExceptions = aPauseOnExceptions; + this._ignoreCaughtExceptions = aIgnoreCaughtExceptions; + + // Otherwise send the flag using a standard resume request. + if (!this.paused) { + return this.interrupt(aResponse => { + if (aResponse.error) { + // Can't continue if pausing failed. + aOnResponse(aResponse); + return aResponse; + } + return this.resume(aOnResponse); + }); + } + + aOnResponse(); + return promise.resolve(); + }, + + /** + * Enable pausing when the specified DOM events are triggered. Disabling + * pausing on an event can be realized by calling this method with the updated + * array of events that doesn't contain it. + * + * @param array|string events + * An array of strings, representing the DOM event types to pause on, + * or "*" to pause on all DOM events. Pass an empty array to + * completely disable pausing on DOM events. + * @param function onResponse + * Called with the response packet in a future turn of the event loop. + */ + pauseOnDOMEvents: function(events, onResponse = noop) { + this._pauseOnDOMEvents = events; + // If the debuggee is paused, the value of the array will be communicated in + // the next resumption. Otherwise we have to force a pause in order to send + // the array. + if (this.paused) { + DevToolsUtils.executeSoon(() => onResponse({})); + return {}; + } + return this.interrupt(response => { + // Can't continue if pausing failed. + if (response.error) { + onResponse(response); + return response; + } + return this.resume(onResponse); + }); + }, + + /** + * Send a clientEvaluate packet to the debuggee. Response + * will be a resume packet. + * + * @param string aFrame + * The actor ID of the frame where the evaluation should take place. + * @param string aExpression + * The expression that will be evaluated in the scope of the frame + * above. + * @param function aOnResponse + * Called with the response packet. + */ + eval: DebuggerClient.requester({ + type: "clientEvaluate", + frame: args(0), + expression: args(1) + }, { + before: function(aPacket) { + this._assertPaused("eval"); + // Put the client in a tentative "resuming" state so we can prevent + // further requests that should only be sent in the paused state. + this._state = "resuming"; + return aPacket; + }, + after: function(aResponse) { + if (aResponse.error) { + // There was an error resuming, back to paused state. + this._state = "paused"; + } + return aResponse; + }, + telemetry: "CLIENTEVALUATE" + }), + + /** + * Detach from the thread actor. + * + * @param function aOnResponse + * Called with the response packet. + */ + detach: DebuggerClient.requester({ + type: "detach" + }, { + after: function(aResponse) { + this.client.unregisterClient(this); + this._parent.thread = null; + return aResponse; + }, + telemetry: "THREADDETACH" + }), + + /** + * Release multiple thread-lifetime object actors. If any pause-lifetime + * actors are included in the request, a |notReleasable| error will return, + * but all the thread-lifetime ones will have been released. + * + * @param array actors + * An array with actor IDs to release. + */ + releaseMany: DebuggerClient.requester({ + type: "releaseMany", + actors: args(0), + }, { + telemetry: "RELEASEMANY" + }), + + /** + * Promote multiple pause-lifetime object actors to thread-lifetime ones. + * + * @param array actors + * An array with actor IDs to promote. + */ + threadGrips: DebuggerClient.requester({ + type: "threadGrips", + actors: args(0) + }, { + telemetry: "THREADGRIPS" + }), + + /** + * Return the event listeners defined on the page. + * + * @param aOnResponse Function + * Called with the thread's response. + */ + eventListeners: DebuggerClient.requester({ + type: "eventListeners" + }, { + telemetry: "EVENTLISTENERS" + }), + + /** + * Request the loaded sources for the current thread. + * + * @param aOnResponse Function + * Called with the thread's response. + */ + getSources: DebuggerClient.requester({ + type: "sources" + }, { + telemetry: "SOURCES" + }), + + /** + * Clear the thread's source script cache. A scriptscleared event + * will be sent. + */ + _clearScripts: function() { + if (Object.keys(this._scriptCache).length > 0) { + this._scriptCache = {}; + this.emit("scriptscleared"); + } + }, + + /** + * Request frames from the callstack for the current thread. + * + * @param aStart integer + * The number of the youngest stack frame to return (the youngest + * frame is 0). + * @param aCount integer + * The maximum number of frames to return, or null to return all + * frames. + * @param aOnResponse function + * Called with the thread's response. + */ + getFrames: DebuggerClient.requester({ + type: "frames", + start: args(0), + count: args(1) + }, { + telemetry: "FRAMES" + }), + + /** + * An array of cached frames. Clients can observe the framesadded and + * framescleared event to keep up to date on changes to this cache, + * and can fill it using the fillFrames method. + */ + get cachedFrames() { return this._frameCache; }, + + /** + * true if there are more stack frames available on the server. + */ + get moreFrames() { + return this.paused && (!this._frameCache || this._frameCache.length == 0 + || !this._frameCache[this._frameCache.length - 1].oldest); + }, + + /** + * Ensure that at least aTotal stack frames have been loaded in the + * ThreadClient's stack frame cache. A framesadded event will be + * sent when the stack frame cache is updated. + * + * @param aTotal number + * The minimum number of stack frames to be included. + * @param aCallback function + * Optional callback function called when frames have been loaded + * @returns true if a framesadded notification should be expected. + */ + fillFrames: function(aTotal, aCallback = noop) { + this._assertPaused("fillFrames"); + if (this._frameCache.length >= aTotal) { + return false; + } + + let numFrames = this._frameCache.length; + + this.getFrames(numFrames, aTotal - numFrames, (aResponse) => { + if (aResponse.error) { + aCallback(aResponse); + return; + } + + let threadGrips = DevToolsUtils.values(this._threadGrips); + + for (let i in aResponse.frames) { + let frame = aResponse.frames[i]; + if (!frame.where.source) { + // Older servers use urls instead, so we need to resolve + // them to source actors + for (let grip of threadGrips) { + if (grip instanceof SourceClient && grip.url === frame.url) { + frame.where.source = grip._form; + } + } + } + + this._frameCache[frame.depth] = frame; + } + + // If we got as many frames as we asked for, there might be more + // frames available. + this.emit("framesadded"); + + aCallback(aResponse); + }); + + return true; + }, + + /** + * Clear the thread's stack frame cache. A framescleared event + * will be sent. + */ + _clearFrames: function() { + if (this._frameCache.length > 0) { + this._frameCache = []; + this.emit("framescleared"); + } + }, + + /** + * Return a ObjectClient object for the given object grip. + * + * @param aGrip object + * A pause-lifetime object grip returned by the protocol. + */ + pauseGrip: function(aGrip) { + if (aGrip.actor in this._pauseGrips) { + return this._pauseGrips[aGrip.actor]; + } + + let client = new ObjectClient(this.client, aGrip); + this._pauseGrips[aGrip.actor] = client; + return client; + }, + + /** + * Get or create a long string client, checking the grip client cache if it + * already exists. + * + * @param aGrip Object + * The long string grip returned by the protocol. + * @param aGripCacheName String + * The property name of the grip client cache to check for existing + * clients in. + */ + _longString: function(aGrip, aGripCacheName) { + if (aGrip.actor in this[aGripCacheName]) { + return this[aGripCacheName][aGrip.actor]; + } + + let client = new LongStringClient(this.client, aGrip); + this[aGripCacheName][aGrip.actor] = client; + return client; + }, + + /** + * Return an instance of LongStringClient for the given long string grip that + * is scoped to the current pause. + * + * @param aGrip Object + * The long string grip returned by the protocol. + */ + pauseLongString: function(aGrip) { + return this._longString(aGrip, "_pauseGrips"); + }, + + /** + * Return an instance of LongStringClient for the given long string grip that + * is scoped to the thread lifetime. + * + * @param aGrip Object + * The long string grip returned by the protocol. + */ + threadLongString: function(aGrip) { + return this._longString(aGrip, "_threadGrips"); + }, + + /** + * Clear and invalidate all the grip clients from the given cache. + * + * @param aGripCacheName + * The property name of the grip cache we want to clear. + */ + _clearObjectClients: function(aGripCacheName) { + for (let id in this[aGripCacheName]) { + this[aGripCacheName][id].valid = false; + } + this[aGripCacheName] = {}; + }, + + /** + * Invalidate pause-lifetime grip clients and clear the list of current grip + * clients. + */ + _clearPauseGrips: function() { + this._clearObjectClients("_pauseGrips"); + }, + + /** + * Invalidate thread-lifetime grip clients and clear the list of current grip + * clients. + */ + _clearThreadGrips: function() { + this._clearObjectClients("_threadGrips"); + }, + + /** + * Handle thread state change by doing necessary cleanup and notifying all + * registered listeners. + */ + _onThreadState: function(aPacket) { + this._state = ThreadStateTypes[aPacket.type]; + // The debugger UI may not be initialized yet so we want to keep + // the packet around so it knows what to pause state to display + // when it's initialized + this._lastPausePacket = aPacket.type === "resumed" ? null : aPacket; + this._clearFrames(); + this._clearPauseGrips(); + aPacket.type === ThreadStateTypes.detached && this._clearThreadGrips(); + this.client._eventsEnabled && this.emit(aPacket.type, aPacket); + }, + + getLastPausePacket: function() { + return this._lastPausePacket; + }, + + /** + * Return an EnvironmentClient instance for the given environment actor form. + */ + environment: function(aForm) { + return new EnvironmentClient(this.client, aForm); + }, + + /** + * Return an instance of SourceClient for the given source actor form. + */ + source: function(aForm) { + if (aForm.actor in this._threadGrips) { + return this._threadGrips[aForm.actor]; + } + + return this._threadGrips[aForm.actor] = new SourceClient(this, aForm); + }, + + /** + * Request the prototype and own properties of mutlipleObjects. + * + * @param aOnResponse function + * Called with the request's response. + * @param actors [string] + * List of actor ID of the queried objects. + */ + getPrototypesAndProperties: DebuggerClient.requester({ + type: "prototypesAndProperties", + actors: args(0) + }, { + telemetry: "PROTOTYPESANDPROPERTIES" + }), + + events: ["newSource"] + }; + + eventSource(ThreadClient.prototype); + + /** + * Creates a tracing profiler client for the remote debugging protocol + * server. This client is a front to the trace actor created on the + * server side, hiding the protocol details in a traditional + * JavaScript API. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aActor string + * The actor ID for this thread. + */ + function TraceClient(aClient, aActor) { + this._client = aClient; + this._actor = aActor; + this._activeTraces = new Set(); + this._waitingPackets = new Map(); + this._expectedPacket = 0; + this.request = this._client.request; + this.events = []; + } + + TraceClient.prototype = { + get actor() { return this._actor; }, + get tracing() { return this._activeTraces.size > 0; }, + + get _transport() { return this._client._transport; }, + + /** + * Detach from the trace actor. + */ + detach: DebuggerClient.requester({ + type: "detach" + }, { + after: function(aResponse) { + this._client.unregisterClient(this); + return aResponse; + }, + telemetry: "TRACERDETACH" + }), + + /** + * Start a new trace. + * + * @param aTrace [string] + * An array of trace types to be recorded by the new trace. + * + * @param aName string + * The name of the new trace. + * + * @param aOnResponse function + * Called with the request's response. + */ + startTrace: DebuggerClient.requester({ + type: "startTrace", + name: args(1), + trace: args(0) + }, { + after: function(aResponse) { + if (aResponse.error) { + return aResponse; + } + + if (!this.tracing) { + this._waitingPackets.clear(); + this._expectedPacket = 0; + } + this._activeTraces.add(aResponse.name); + + return aResponse; + }, + telemetry: "STARTTRACE" + }), + + /** + * End a trace. If a name is provided, stop the named + * trace. Otherwise, stop the most recently started trace. + * + * @param aName string + * The name of the trace to stop. + * + * @param aOnResponse function + * Called with the request's response. + */ + stopTrace: DebuggerClient.requester({ + type: "stopTrace", + name: args(0) + }, { + after: function(aResponse) { + if (aResponse.error) { + return aResponse; + } + + this._activeTraces.delete(aResponse.name); + + return aResponse; + }, + telemetry: "STOPTRACE" + }) + }; + + /** + * Grip clients are used to retrieve information about the relevant object. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aGrip object + * A pause-lifetime object grip returned by the protocol. + */ + function ObjectClient(aClient, aGrip) + { + this._grip = aGrip; + this._client = aClient; + this.request = this._client.request; + } + exports.ObjectClient = ObjectClient; + + ObjectClient.prototype = { + get actor() { return this._grip.actor; }, + get _transport() { return this._client._transport; }, + + valid: true, + + get isFrozen() { + return this._grip.frozen; + }, + get isSealed() { + return this._grip.sealed; + }, + get isExtensible() { + return this._grip.extensible; + }, + + getDefinitionSite: DebuggerClient.requester({ + type: "definitionSite" + }, { + before: function(aPacket) { + if (this._grip.class != "Function") { + throw new Error("getDefinitionSite is only valid for function grips."); + } + return aPacket; + } + }), + + /** + * Request the names of a function's formal parameters. + * + * @param aOnResponse function + * Called with an object of the form: + * { parameterNames:[, ...] } + * where each is the name of a parameter. + */ + getParameterNames: DebuggerClient.requester({ + type: "parameterNames" + }, { + before: function(aPacket) { + if (this._grip.class !== "Function") { + throw new Error("getParameterNames is only valid for function grips."); + } + return aPacket; + }, + telemetry: "PARAMETERNAMES" + }), + + /** + * Request the names of the properties defined on the object and not its + * prototype. + * + * @param aOnResponse function Called with the request's response. + */ + getOwnPropertyNames: DebuggerClient.requester({ + type: "ownPropertyNames" + }, { + telemetry: "OWNPROPERTYNAMES" + }), + + /** + * Request the prototype and own properties of the object. + * + * @param aOnResponse function Called with the request's response. + */ + getPrototypeAndProperties: DebuggerClient.requester({ + type: "prototypeAndProperties" + }, { + telemetry: "PROTOTYPEANDPROPERTIES" + }), + + /** + * Request a PropertyIteratorClient instance to ease listing + * properties for this object. + * + * @param options Object + * A dictionary object with various boolean attributes: + * - ignoreSafeGetters Boolean + * If true, do not iterate over safe getters. + * - ignoreIndexedProperties Boolean + * If true, filters out Array items. + * e.g. properties names between `0` and `object.length`. + * - ignoreNonIndexedProperties Boolean + * If true, filters out items that aren't array items + * e.g. properties names that are not a number between `0` + * and `object.length`. + * - sort Boolean + * If true, the iterator will sort the properties by name + * before dispatching them. + * @param aOnResponse function Called with the client instance. + */ + enumProperties: DebuggerClient.requester({ + type: "enumProperties", + options: args(0) + }, { + after: function(aResponse) { + if (aResponse.iterator) { + return { iterator: new PropertyIteratorClient(this._client, aResponse.iterator) }; + } + return aResponse; + }, + telemetry: "ENUMPROPERTIES" + }), + + /** + * Request a PropertyIteratorClient instance to enumerate entries in a + * Map/Set-like object. + * + * @param aOnResponse function Called with the request's response. + */ + enumEntries: DebuggerClient.requester({ + type: "enumEntries" + }, { + before: function(packet) { + if (!["Map", "WeakMap", "Set", "WeakSet"].includes(this._grip.class)) { + throw new Error("enumEntries is only valid for Map/Set-like grips."); + } + return packet; + }, + after: function(response) { + if (response.iterator) { + return { + iterator: new PropertyIteratorClient(this._client, response.iterator) + }; + } + return response; + } + }), + + /** + * Request the property descriptor of the object's specified property. + * + * @param aName string The name of the requested property. + * @param aOnResponse function Called with the request's response. + */ + getProperty: DebuggerClient.requester({ + type: "property", + name: args(0) + }, { + telemetry: "PROPERTY" + }), + + /** + * Request the prototype of the object. + * + * @param aOnResponse function Called with the request's response. + */ + getPrototype: DebuggerClient.requester({ + type: "prototype" + }, { + telemetry: "PROTOTYPE" + }), + + /** + * Request the display string of the object. + * + * @param aOnResponse function Called with the request's response. + */ + getDisplayString: DebuggerClient.requester({ + type: "displayString" + }, { + telemetry: "DISPLAYSTRING" + }), + + /** + * Request the scope of the object. + * + * @param aOnResponse function Called with the request's response. + */ + getScope: DebuggerClient.requester({ + type: "scope" + }, { + before: function(aPacket) { + if (this._grip.class !== "Function") { + throw new Error("scope is only valid for function grips."); + } + return aPacket; + }, + telemetry: "SCOPE" + }), + + /** + * Request the promises directly depending on the current promise. + */ + getDependentPromises: DebuggerClient.requester({ + type: "dependentPromises" + }, { + before: function(aPacket) { + if (this._grip.class !== "Promise") { + throw new Error("getDependentPromises is only valid for promise " + + "grips."); + } + return aPacket; + } + }), + + /** + * Request the stack to the promise's allocation point. + */ + getPromiseAllocationStack: DebuggerClient.requester({ + type: "allocationStack" + }, { + before: function(aPacket) { + if (this._grip.class !== "Promise") { + throw new Error("getAllocationStack is only valid for promise grips."); + } + return aPacket; + } + }), + + /** + * Request the stack to the promise's fulfillment point. + */ + getPromiseFulfillmentStack: DebuggerClient.requester({ + type: "fulfillmentStack" + }, { + before: function(packet) { + if (this._grip.class !== "Promise") { + throw new Error("getPromiseFulfillmentStack is only valid for " + + "promise grips."); + } + return packet; + } + }), + + /** + * Request the stack to the promise's rejection point. + */ + getPromiseRejectionStack: DebuggerClient.requester({ + type: "rejectionStack" + }, { + before: function(packet) { + if (this._grip.class !== "Promise") { + throw new Error("getPromiseRejectionStack is only valid for " + + "promise grips."); + } + return packet; + } + }) + }; + + /** + * A PropertyIteratorClient provides a way to access to property names and + * values of an object efficiently, slice by slice. + * Note that the properties can be sorted in the backend, + * this is controled while creating the PropertyIteratorClient + * from ObjectClient.enumProperties. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aGrip Object + * A PropertyIteratorActor grip returned by the protocol via + * TabActor.enumProperties request. + */ + function PropertyIteratorClient(aClient, aGrip) { + this._grip = aGrip; + this._client = aClient; + this.request = this._client.request; + } + + PropertyIteratorClient.prototype = { + get actor() { return this._grip.actor; }, + + /** + * Get the total number of properties available in the iterator. + */ + get count() { return this._grip.count; }, + + /** + * Get one or more property names that correspond to the positions in the + * indexes parameter. + * + * @param indexes Array + * An array of property indexes. + * @param aCallback Function + * The function called when we receive the property names. + */ + names: DebuggerClient.requester({ + type: "names", + indexes: args(0) + }, {}), + + /** + * Get a set of following property value(s). + * + * @param start Number + * The index of the first property to fetch. + * @param count Number + * The number of properties to fetch. + * @param aCallback Function + * The function called when we receive the property values. + */ + slice: DebuggerClient.requester({ + type: "slice", + start: args(0), + count: args(1) + }, {}), + + /** + * Get all the property values. + * + * @param aCallback Function + * The function called when we receive the property values. + */ + all: DebuggerClient.requester({ + type: "all" + }, {}), + }; + + /** + * A LongStringClient provides a way to access "very long" strings from the + * debugger server. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aGrip Object + * A pause-lifetime long string grip returned by the protocol. + */ + function LongStringClient(aClient, aGrip) { + this._grip = aGrip; + this._client = aClient; + this.request = this._client.request; + } + exports.LongStringClient = LongStringClient; + + LongStringClient.prototype = { + get actor() { return this._grip.actor; }, + get length() { return this._grip.length; }, + get initial() { return this._grip.initial; }, + get _transport() { return this._client._transport; }, + + valid: true, + + /** + * Get the substring of this LongString from aStart to aEnd. + * + * @param aStart Number + * The starting index. + * @param aEnd Number + * The ending index. + * @param aCallback Function + * The function called when we receive the substring. + */ + substring: DebuggerClient.requester({ + type: "substring", + start: args(0), + end: args(1) + }, { + telemetry: "SUBSTRING" + }), + }; + + /** + * A SourceClient provides a way to access the source text of a script. + * + * @param aClient ThreadClient + * The thread client parent. + * @param aForm Object + * The form sent across the remote debugging protocol. + */ + function SourceClient(aClient, aForm) { + this._form = aForm; + this._isBlackBoxed = aForm.isBlackBoxed; + this._isPrettyPrinted = aForm.isPrettyPrinted; + this._activeThread = aClient; + this._client = aClient.client; + } + + SourceClient.prototype = { + get _transport() { + return this._client._transport; + }, + get isBlackBoxed() { + return this._isBlackBoxed; + }, + get isPrettyPrinted() { + return this._isPrettyPrinted; + }, + get actor() { + return this._form.actor; + }, + get request() { + return this._client.request; + }, + get url() { + return this._form.url; + }, + + /** + * Black box this SourceClient's source. + * + * @param aCallback Function + * The callback function called when we receive the response from the server. + */ + blackBox: DebuggerClient.requester({ + type: "blackbox" + }, { + telemetry: "BLACKBOX", + after: function(aResponse) { + if (!aResponse.error) { + this._isBlackBoxed = true; + if (this._activeThread) { + this._activeThread.emit("blackboxchange", this); + } + } + return aResponse; + } + }), + + /** + * Un-black box this SourceClient's source. + * + * @param aCallback Function + * The callback function called when we receive the response from the server. + */ + unblackBox: DebuggerClient.requester({ + type: "unblackbox" + }, { + telemetry: "UNBLACKBOX", + after: function(aResponse) { + if (!aResponse.error) { + this._isBlackBoxed = false; + if (this._activeThread) { + this._activeThread.emit("blackboxchange", this); + } + } + return aResponse; + } + }), + + /** + * Get Executable Lines from a source + * + * @param aCallback Function + * The callback function called when we receive the response from the server. + */ + getExecutableLines: function(cb = noop) { + let packet = { + to: this._form.actor, + type: "getExecutableLines" + }; + + return this._client.request(packet).then(res => { + cb(res.lines); + return res.lines; + }); + }, + + /** + * Get a long string grip for this SourceClient's source. + */ + source: function(aCallback = noop) { + let packet = { + to: this._form.actor, + type: "source" + }; + return this._client.request(packet).then(aResponse => { + return this._onSourceResponse(aResponse, aCallback); + }); + }, + + /** + * Pretty print this source's text. + */ + prettyPrint: function(aIndent, aCallback = noop) { + const packet = { + to: this._form.actor, + type: "prettyPrint", + indent: aIndent + }; + return this._client.request(packet).then(aResponse => { + if (!aResponse.error) { + this._isPrettyPrinted = true; + this._activeThread._clearFrames(); + this._activeThread.emit("prettyprintchange", this); + } + return this._onSourceResponse(aResponse, aCallback); + }); + }, + + /** + * Stop pretty printing this source's text. + */ + disablePrettyPrint: function(aCallback = noop) { + const packet = { + to: this._form.actor, + type: "disablePrettyPrint" + }; + return this._client.request(packet).then(aResponse => { + if (!aResponse.error) { + this._isPrettyPrinted = false; + this._activeThread._clearFrames(); + this._activeThread.emit("prettyprintchange", this); + } + return this._onSourceResponse(aResponse, aCallback); + }); + }, + + _onSourceResponse: function(aResponse, aCallback) { + if (aResponse.error) { + aCallback(aResponse); + return aResponse; + } + + if (typeof aResponse.source === "string") { + aCallback(aResponse); + return aResponse; + } + + let { contentType, source } = aResponse; + let longString = this._activeThread.threadLongString(source); + return longString.substring(0, longString.length).then(function(aResponse) { + if (aResponse.error) { + aCallback(aResponse); + return aReponse; + } + + let response = { + source: aResponse.substring, + contentType: contentType + }; + aCallback(response); + return response; + }); + }, + + /** + * Request to set a breakpoint in the specified location. + * + * @param object aLocation + * The location and condition of the breakpoint in + * the form of { line[, column, condition] }. + * @param function aOnResponse + * Called with the thread's response. + */ + setBreakpoint: function({ line, column, condition, noSliding }, aOnResponse = noop) { + // A helper function that sets the breakpoint. + let doSetBreakpoint = aCallback => { + let root = this._client.mainRoot; + let location = { + line: line, + column: column + }; + + let packet = { + to: this.actor, + type: "setBreakpoint", + location: location, + condition: condition, + noSliding: noSliding + }; + + // Backwards compatibility: send the breakpoint request to the + // thread if the server doesn't support Debugger.Source actors. + if (!root.traits.debuggerSourceActors) { + packet.to = this._activeThread.actor; + packet.location.url = this.url; + } + + return this._client.request(packet).then(aResponse => { + // Ignoring errors, since the user may be setting a breakpoint in a + // dead script that will reappear on a page reload. + let bpClient; + if (aResponse.actor) { + bpClient = new BreakpointClient( + this._client, + this, + aResponse.actor, + location, + root.traits.conditionalBreakpoints ? condition : undefined + ); + } + aOnResponse(aResponse, bpClient); + if (aCallback) { + aCallback(); + } + return [aResponse, bpClient]; + }); + }; + + // If the debuggee is paused, just set the breakpoint. + if (this._activeThread.paused) { + return doSetBreakpoint(); + } + // Otherwise, force a pause in order to set the breakpoint. + return this._activeThread.interrupt().then(aResponse => { + if (aResponse.error) { + // Can't set the breakpoint if pausing failed. + aOnResponse(aResponse); + return aResponse; + } + + const { type, why } = aResponse; + const cleanUp = type == "paused" && why.type == "interrupted" + ? () => this._activeThread.resume() + : noop; + + return doSetBreakpoint(cleanUp); + }); + } + }; + + /** + * Breakpoint clients are used to remove breakpoints that are no longer used. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aSourceClient SourceClient + * The source where this breakpoint exists + * @param aActor string + * The actor ID for this breakpoint. + * @param aLocation object + * The location of the breakpoint. This is an object with two properties: + * url and line. + * @param aCondition string + * The conditional expression of the breakpoint + */ + function BreakpointClient(aClient, aSourceClient, aActor, aLocation, aCondition) { + this._client = aClient; + this._actor = aActor; + this.location = aLocation; + this.location.actor = aSourceClient.actor; + this.location.url = aSourceClient.url; + this.source = aSourceClient; + this.request = this._client.request; + + // The condition property should only exist if it's a truthy value + if (aCondition) { + this.condition = aCondition; + } + } + + BreakpointClient.prototype = { + + _actor: null, + get actor() { return this._actor; }, + get _transport() { return this._client._transport; }, + + /** + * Remove the breakpoint from the server. + */ + remove: DebuggerClient.requester({ + type: "delete" + }, { + telemetry: "DELETE" + }), + + /** + * Determines if this breakpoint has a condition + */ + hasCondition: function() { + let root = this._client.mainRoot; + // XXX bug 990137: We will remove support for client-side handling of + // conditional breakpoints + if (root.traits.conditionalBreakpoints) { + return "condition" in this; + } else { + return "conditionalExpression" in this; + } + }, + + /** + * Get the condition of this breakpoint. Currently we have to + * support locally emulated conditional breakpoints until the + * debugger servers are updated (see bug 990137). We used a + * different property when moving it server-side to ensure that we + * are testing the right code. + */ + getCondition: function() { + let root = this._client.mainRoot; + if (root.traits.conditionalBreakpoints) { + return this.condition; + } else { + return this.conditionalExpression; + } + }, + + /** + * Set the condition of this breakpoint + */ + setCondition: function(gThreadClient, aCondition, noSliding) { + let root = this._client.mainRoot; + let deferred = promise.defer(); + + if (root.traits.conditionalBreakpoints) { + let info = { + line: this.location.line, + column: this.location.column, + condition: aCondition, + noSliding + }; + + // Remove the current breakpoint and add a new one with the + // condition. + this.remove(aResponse => { + if (aResponse && aResponse.error) { + deferred.reject(aResponse); + return; + } + + this.source.setBreakpoint(info, (aResponse, aNewBreakpoint) => { + if (aResponse && aResponse.error) { + deferred.reject(aResponse); + } else { + deferred.resolve(aNewBreakpoint); + } + }); + }); + } else { + // The property shouldn't even exist if the condition is blank + if (aCondition === "") { + delete this.conditionalExpression; + } + else { + this.conditionalExpression = aCondition; + } + deferred.resolve(this); + } + + return deferred.promise; + } + }; + + eventSource(BreakpointClient.prototype); + + /** + * Environment clients are used to manipulate the lexical environment actors. + * + * @param aClient DebuggerClient + * The debugger client parent. + * @param aForm Object + * The form sent across the remote debugging protocol. + */ + function EnvironmentClient(aClient, aForm) { + this._client = aClient; + this._form = aForm; + this.request = this._client.request; + } + exports.EnvironmentClient = EnvironmentClient; + + EnvironmentClient.prototype = { + + get actor() { + return this._form.actor; + }, + get _transport() { return this._client._transport; }, + + /** + * Fetches the bindings introduced by this lexical environment. + */ + getBindings: DebuggerClient.requester({ + type: "bindings" + }, { + telemetry: "BINDINGS" + }), + + /** + * Changes the value of the identifier whose name is name (a string) to that + * represented by value (a grip). + */ + assign: DebuggerClient.requester({ + type: "assign", + name: args(0), + value: args(1) + }, { + telemetry: "ASSIGN" + }) + }; + + eventSource(EnvironmentClient.prototype); + + +/***/ }, +/* 54 */ +/***/ 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"; + + module.metadata = { + "stability": "unstable" + }; + + const UNCAUGHT_ERROR = 'An error event was emitted for which there was no listener.'; + const BAD_LISTENER = 'The event listener must be a function.'; + + const { ns } = __webpack_require__(55); + + const event = ns(); + + const EVENT_TYPE_PATTERN = /^on([A-Z]\w+$)/; + exports.EVENT_TYPE_PATTERN = EVENT_TYPE_PATTERN; + + // Utility function to access given event `target` object's event listeners for + // the specific event `type`. If listeners for this type does not exists they + // will be created. + const observers = function observers(target, type) { + if (!target) throw TypeError("Event target must be an object"); + let listeners = event(target); + return type in listeners ? listeners[type] : listeners[type] = []; + }; + + /** + * Registers an event `listener` that is called every time events of + * specified `type` is emitted on the given event `target`. + * @param {Object} target + * Event target object. + * @param {String} type + * The type of event. + * @param {Function} listener + * The listener function that processes the event. + */ + function on(target, type, listener) { + if (typeof(listener) !== 'function') + throw new Error(BAD_LISTENER); + + let listeners = observers(target, type); + if (!~listeners.indexOf(listener)) + listeners.push(listener); + } + exports.on = on; + + + var onceWeakMap = new WeakMap(); + + + /** + * Registers an event `listener` that is called only the next time an event + * of the specified `type` is emitted on the given event `target`. + * @param {Object} target + * Event target object. + * @param {String} type + * The type of the event. + * @param {Function} listener + * The listener function that processes the event. + */ + function once(target, type, listener) { + let replacement = function observer(...args) { + off(target, type, observer); + onceWeakMap.delete(listener); + listener.apply(target, args); + }; + onceWeakMap.set(listener, replacement); + on(target, type, replacement); + } + exports.once = once; + + /** + * Execute each of the listeners in order with the supplied arguments. + * All the exceptions that are thrown by listeners during the emit + * are caught and can be handled by listeners of 'error' event. Thrown + * exceptions are passed as an argument to an 'error' event listener. + * If no 'error' listener is registered exception will be logged into an + * error console. + * @param {Object} target + * Event target object. + * @param {String} type + * The type of event. + * @params {Object|Number|String|Boolean} args + * Arguments that will be passed to listeners. + */ + function emit (target, type, ...args) { + emitOnObject(target, type, target, ...args); + } + exports.emit = emit; + + /** + * A variant of emit that allows setting the this property for event listeners + */ + function emitOnObject(target, type, thisArg, ...args) { + let all = observers(target, '*').length; + let state = observers(target, type); + let listeners = state.slice(); + let count = listeners.length; + let index = 0; + + // If error event and there are no handlers (explicit or catch-all) + // then print error message to the console. + if (count === 0 && type === 'error' && all === 0) + console.exception(args[0]); + while (index < count) { + try { + let listener = listeners[index]; + // Dispatch only if listener is still registered. + if (~state.indexOf(listener)) + listener.apply(thisArg, args); + } + catch (error) { + // If exception is not thrown by a error listener and error listener is + // registered emit `error` event. Otherwise dump exception to the console. + if (type !== 'error') emit(target, 'error', error); + else console.exception(error); + } + index++; + } + // Also emit on `"*"` so that one could listen for all events. + if (type !== '*') emit(target, '*', type, ...args); + } + exports.emitOnObject = emitOnObject; + + /** + * Removes an event `listener` for the given event `type` on the given event + * `target`. If no `listener` is passed removes all listeners of the given + * `type`. If `type` is not passed removes all the listeners of the given + * event `target`. + * @param {Object} target + * The event target object. + * @param {String} type + * The type of event. + * @param {Function} listener + * The listener function that processes the event. + */ + function off(target, type, listener) { + let length = arguments.length; + if (length === 3) { + if (onceWeakMap.has(listener)) { + listener = onceWeakMap.get(listener); + onceWeakMap.delete(listener); + } + + let listeners = observers(target, type); + let index = listeners.indexOf(listener); + if (~index) + listeners.splice(index, 1); + } + else if (length === 2) { + observers(target, type).splice(0); + } + else if (length === 1) { + let listeners = event(target); + Object.keys(listeners).forEach(type => delete listeners[type]); + } + } + exports.off = off; + + /** + * Returns a number of event listeners registered for the given event `type` + * on the given event `target`. + */ + function count(target, type) { + return observers(target, type).length; + } + exports.count = count; + + /** + * Registers listeners on the given event `target` from the given `listeners` + * dictionary. Iterates over the listeners and if property name matches name + * pattern `onEventType` and property is a function, then registers it as + * an `eventType` listener on `target`. + * + * @param {Object} target + * The type of event. + * @param {Object} listeners + * Dictionary of listeners. + */ + function setListeners(target, listeners) { + Object.keys(listeners || {}).forEach(key => { + let match = EVENT_TYPE_PATTERN.exec(key); + let type = match && match[1].toLowerCase(); + if (!type) return; + + let listener = listeners[key]; + if (typeof(listener) === 'function') + on(target, type, listener); + }); + } + exports.setListeners = setListeners; + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) + +/***/ }, +/* 55 */ +/***/ 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"; + + module.metadata = { + "stability": "unstable" + }; + + const create = Object.create; + const prototypeOf = Object.getPrototypeOf; + + /** + * Returns a new namespace, function that may can be used to access an + * namespaced object of the argument argument. Namespaced object are associated + * with owner objects via weak references. Namespaced objects inherit from the + * owners ancestor namespaced object. If owner's ancestor is `null` then + * namespaced object inherits from given `prototype`. Namespaces can be used + * to define internal APIs that can be shared via enclosing `namespace` + * function. + * @examples + * const internals = ns(); + * internals(object).secret = secret; + */ + function ns() { + const map = new WeakMap(); + return function namespace(target) { + if (!target) // If `target` is not an object return `target` itself. + return target; + // If target has no namespaced object yet, create one that inherits from + // the target prototype's namespaced object. + if (!map.has(target)) + map.set(target, create(namespace(prototypeOf(target) || null))); + + return map.get(target); + }; + }; + + // `Namespace` is a e4x function in the scope, so we export the function also as + // `ns` as alias to avoid clashing. + exports.ns = ns; + exports.Namespace = ns; + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) + +/***/ }, +/* 56 */ +/***/ 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"; + + const {Cc, Ci, Cu} = __webpack_require__(35); + const DevToolsUtils = __webpack_require__(42); + const EventEmitter = __webpack_require__(34); + const promise = __webpack_require__(40); + const {LongStringClient} = __webpack_require__(53); + + /** + * A WebConsoleClient is used as a front end for the WebConsoleActor that is + * created on the server, hiding implementation details. + * + * @param object aDebuggerClient + * The DebuggerClient instance we live for. + * @param object aResponse + * The response packet received from the "startListeners" request sent to + * the WebConsoleActor. + */ + function WebConsoleClient(aDebuggerClient, aResponse) + { + this._actor = aResponse.from; + this._client = aDebuggerClient; + this._longStrings = {}; + this.traits = aResponse.traits || {}; + this.events = []; + this._networkRequests = new Map(); + + this.pendingEvaluationResults = new Map(); + this.onEvaluationResult = this.onEvaluationResult.bind(this); + this.onNetworkEvent = this._onNetworkEvent.bind(this); + this.onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this); + + this._client.addListener("evaluationResult", this.onEvaluationResult); + this._client.addListener("networkEvent", this.onNetworkEvent); + this._client.addListener("networkEventUpdate", this.onNetworkEventUpdate); + EventEmitter.decorate(this); + } + + exports.WebConsoleClient = WebConsoleClient; + + WebConsoleClient.prototype = { + _longStrings: null, + traits: null, + + /** + * Holds the network requests currently displayed by the Web Console. Each key + * represents the connection ID and the value is network request information. + * @private + * @type object + */ + _networkRequests: null, + + getNetworkRequest(actorId) { + return this._networkRequests.get(actorId); + }, + + hasNetworkRequest(actorId) { + return this._networkRequests.has(actorId); + }, + + removeNetworkRequest(actorId) { + this._networkRequests.delete(actorId); + }, + + getNetworkEvents() { + return this._networkRequests.values(); + }, + + get actor() { return this._actor; }, + + /** + * The "networkEvent" message type handler. We redirect any message to + * the UI for displaying. + * + * @private + * @param string type + * Message type. + * @param object packet + * The message received from the server. + */ + _onNetworkEvent: function (type, packet) + { + if (packet.from == this._actor) { + let actor = packet.eventActor; + let networkInfo = { + _type: "NetworkEvent", + timeStamp: actor.timeStamp, + node: null, + actor: actor.actor, + discardRequestBody: true, + discardResponseBody: true, + startedDateTime: actor.startedDateTime, + request: { + url: actor.url, + method: actor.method, + }, + isXHR: actor.isXHR, + response: {}, + timings: {}, + updates: [], // track the list of network event updates + private: actor.private, + fromCache: actor.fromCache + }; + this._networkRequests.set(actor.actor, networkInfo); + + this.emit("networkEvent", networkInfo); + } + }, + + /** + * The "networkEventUpdate" message type handler. We redirect any message to + * the UI for displaying. + * + * @private + * @param string type + * Message type. + * @param object packet + * The message received from the server. + */ + _onNetworkEventUpdate: function (type, packet) + { + let networkInfo = this.getNetworkRequest(packet.from); + if (!networkInfo) { + return; + } + + networkInfo.updates.push(packet.updateType); + + switch (packet.updateType) { + case "requestHeaders": + networkInfo.request.headersSize = packet.headersSize; + break; + case "requestPostData": + networkInfo.discardRequestBody = packet.discardRequestBody; + networkInfo.request.bodySize = packet.dataSize; + break; + case "responseStart": + networkInfo.response.httpVersion = packet.response.httpVersion; + networkInfo.response.status = packet.response.status; + networkInfo.response.statusText = packet.response.statusText; + networkInfo.response.headersSize = packet.response.headersSize; + networkInfo.response.remoteAddress = packet.response.remoteAddress; + networkInfo.response.remotePort = packet.response.remotePort; + networkInfo.discardResponseBody = packet.response.discardResponseBody; + break; + case "responseContent": + networkInfo.response.content = { + mimeType: packet.mimeType, + }; + networkInfo.response.bodySize = packet.contentSize; + networkInfo.response.transferredSize = packet.transferredSize; + networkInfo.discardResponseBody = packet.discardResponseBody; + break; + case "eventTimings": + networkInfo.totalTime = packet.totalTime; + break; + case "securityInfo": + networkInfo.securityInfo = packet.state; + break; + } + + this.emit("networkEventUpdate", { + packet: packet, + networkInfo + }); + }, + + /** + * Retrieve the cached messages from the server. + * + * @see this.CACHED_MESSAGES + * @param array types + * The array of message types you want from the server. See + * this.CACHED_MESSAGES for known types. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getCachedMessages: function WCC_getCachedMessages(types, aOnResponse) + { + let packet = { + to: this._actor, + type: "getCachedMessages", + messageTypes: types, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Inspect the properties of an object. + * + * @param string aActor + * The WebConsoleObjectActor ID to send the request to. + * @param function aOnResponse + * The function invoked when the response is received. + */ + inspectObjectProperties: + function WCC_inspectObjectProperties(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "inspectProperties", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Evaluate a JavaScript expression. + * + * @param string aString + * The code you want to evaluate. + * @param function aOnResponse + * The function invoked when the response is received. + * @param object [aOptions={}] + * Options for evaluation: + * + * - bindObjectActor: an ObjectActor ID. The OA holds a reference to + * a Debugger.Object that wraps a content object. This option allows + * you to bind |_self| to the D.O of the given OA, during string + * evaluation. + * + * See: Debugger.Object.executeInGlobalWithBindings() for information + * about bindings. + * + * Use case: the variable view needs to update objects and it does so + * by knowing the ObjectActor it inspects and binding |_self| to the + * D.O of the OA. As such, variable view sends strings like these for + * eval: + * _self["prop"] = value; + * + * - frameActor: a FrameActor ID. The FA holds a reference to + * a Debugger.Frame. This option allows you to evaluate the string in + * the frame of the given FA. + * + * - url: the url to evaluate the script as. Defaults to + * "debugger eval code". + * + * - selectedNodeActor: the NodeActor ID of the current selection in the + * Inspector, if such a selection exists. This is used by helper functions + * that can reference the currently selected node in the Inspector, like + * $0. + */ + evaluateJS: function WCC_evaluateJS(aString, aOnResponse, aOptions = {}) + { + let packet = { + to: this._actor, + type: "evaluateJS", + text: aString, + bindObjectActor: aOptions.bindObjectActor, + frameActor: aOptions.frameActor, + url: aOptions.url, + selectedNodeActor: aOptions.selectedNodeActor, + selectedObjectActor: aOptions.selectedObjectActor, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Evaluate a JavaScript expression asynchronously. + * See evaluateJS for parameter and response information. + */ + evaluateJSAsync: function(aString, aOnResponse, aOptions = {}) + { + // Pre-37 servers don't support async evaluation. + if (!this.traits.evaluateJSAsync) { + this.evaluateJS(aString, aOnResponse, aOptions); + return; + } + + let packet = { + to: this._actor, + type: "evaluateJSAsync", + text: aString, + bindObjectActor: aOptions.bindObjectActor, + frameActor: aOptions.frameActor, + url: aOptions.url, + selectedNodeActor: aOptions.selectedNodeActor, + selectedObjectActor: aOptions.selectedObjectActor, + }; + + this._client.request(packet, response => { + // Null check this in case the client has been detached while waiting + // for a response. + if (this.pendingEvaluationResults) { + this.pendingEvaluationResults.set(response.resultID, aOnResponse); + } + }); + }, + + /** + * Handler for the actors's unsolicited evaluationResult packet. + */ + onEvaluationResult: function(aNotification, aPacket) { + // The client on the main thread can receive notification packets from + // multiple webconsole actors: the one on the main thread and the ones + // on worker threads. So make sure we should be handling this request. + if (aPacket.from !== this._actor) { + return; + } + + // Find the associated callback based on this ID, and fire it. + // In a sync evaluation, this would have already been called in + // direct response to the client.request function. + let onResponse = this.pendingEvaluationResults.get(aPacket.resultID); + if (onResponse) { + onResponse(aPacket); + this.pendingEvaluationResults.delete(aPacket.resultID); + } else { + DevToolsUtils.reportException("onEvaluationResult", + "No response handler for an evaluateJSAsync result (resultID: " + aPacket.resultID + ")"); + } + }, + + /** + * Autocomplete a JavaScript expression. + * + * @param string aString + * The code you want to autocomplete. + * @param number aCursor + * Cursor location inside the string. Index starts from 0. + * @param function aOnResponse + * The function invoked when the response is received. + * @param string aFrameActor + * The id of the frame actor that made the call. + */ + autocomplete: function WCC_autocomplete(aString, aCursor, aOnResponse, aFrameActor) + { + let packet = { + to: this._actor, + type: "autocomplete", + text: aString, + cursor: aCursor, + frameActor: aFrameActor, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Clear the cache of messages (page errors and console API calls). + */ + clearMessagesCache: function WCC_clearMessagesCache() + { + let packet = { + to: this._actor, + type: "clearMessagesCache", + }; + this._client.request(packet); + }, + + /** + * Get Web Console-related preferences on the server. + * + * @param array aPreferences + * An array with the preferences you want to retrieve. + * @param function [aOnResponse] + * Optional function to invoke when the response is received. + */ + getPreferences: function WCC_getPreferences(aPreferences, aOnResponse) + { + let packet = { + to: this._actor, + type: "getPreferences", + preferences: aPreferences, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Set Web Console-related preferences on the server. + * + * @param object aPreferences + * An object with the preferences you want to change. + * @param function [aOnResponse] + * Optional function to invoke when the response is received. + */ + setPreferences: function WCC_setPreferences(aPreferences, aOnResponse) + { + let packet = { + to: this._actor, + type: "setPreferences", + preferences: aPreferences, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the request headers from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getRequestHeaders: function WCC_getRequestHeaders(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getRequestHeaders", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the request cookies from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getRequestCookies: function WCC_getRequestCookies(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getRequestCookies", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the request post data from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getRequestPostData: function WCC_getRequestPostData(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getRequestPostData", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the response headers from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getResponseHeaders: function WCC_getResponseHeaders(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getResponseHeaders", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the response cookies from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getResponseCookies: function WCC_getResponseCookies(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getResponseCookies", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the response content from the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getResponseContent: function WCC_getResponseContent(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getResponseContent", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the timing information for the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getEventTimings: function WCC_getEventTimings(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getEventTimings", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Retrieve the security information for the given NetworkEventActor. + * + * @param string aActor + * The NetworkEventActor ID. + * @param function aOnResponse + * The function invoked when the response is received. + */ + getSecurityInfo: function WCC_getSecurityInfo(aActor, aOnResponse) + { + let packet = { + to: aActor, + type: "getSecurityInfo", + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Send a HTTP request with the given data. + * + * @param string aData + * The details of the HTTP request. + * @param function aOnResponse + * The function invoked when the response is received. + */ + sendHTTPRequest: function WCC_sendHTTPRequest(aData, aOnResponse) { + let packet = { + to: this._actor, + type: "sendHTTPRequest", + request: aData + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Start the given Web Console listeners. + * + * @see this.LISTENERS + * @param array aListeners + * Array of listeners you want to start. See this.LISTENERS for + * known listeners. + * @param function aOnResponse + * Function to invoke when the server response is received. + */ + startListeners: function WCC_startListeners(aListeners, aOnResponse) + { + let packet = { + to: this._actor, + type: "startListeners", + listeners: aListeners, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Stop the given Web Console listeners. + * + * @see this.LISTENERS + * @param array aListeners + * Array of listeners you want to stop. See this.LISTENERS for + * known listeners. + * @param function aOnResponse + * Function to invoke when the server response is received. + */ + stopListeners: function WCC_stopListeners(aListeners, aOnResponse) + { + let packet = { + to: this._actor, + type: "stopListeners", + listeners: aListeners, + }; + this._client.request(packet, aOnResponse); + }, + + /** + * Return an instance of LongStringClient for the given long string grip. + * + * @param object aGrip + * The long string grip returned by the protocol. + * @return object + * The LongStringClient for the given long string grip. + */ + longString: function WCC_longString(aGrip) + { + if (aGrip.actor in this._longStrings) { + return this._longStrings[aGrip.actor]; + } + + let client = new LongStringClient(this._client, aGrip); + this._longStrings[aGrip.actor] = client; + return client; + }, + + /** + * Close the WebConsoleClient. This stops all the listeners on the server and + * detaches from the console actor. + * + * @param function aOnResponse + * Function to invoke when the server response is received. + */ + detach: function WCC_detach(aOnResponse) + { + this._client.removeListener("evaluationResult", this.onEvaluationResult); + this._client.removeListener("networkEvent", this.onNetworkEvent); + this._client.removeListener("networkEventUpdate", this.onNetworkEventUpdate); + this.stopListeners(null, aOnResponse); + this._longStrings = null; + this._client = null; + this.pendingEvaluationResults.clear(); + this.pendingEvaluationResults = null; + this.clearNetworkRequests(); + this._networkRequests = null; + }, + + clearNetworkRequests: function () { + this._networkRequests.clear(); + }, + + /** + * Fetches the full text of a LongString. + * + * @param object | string stringGrip + * The long string grip containing the corresponding actor. + * If you pass in a plain string (by accident or because you're lazy), + * then a promise of the same string is simply returned. + * @return object Promise + * A promise that is resolved when the full string contents + * are available, or rejected if something goes wrong. + */ + getString: function(stringGrip) { + // Make sure this is a long string. + if (typeof stringGrip != "object" || stringGrip.type != "longString") { + return promise.resolve(stringGrip); // Go home string, you're drunk. + } + + // Fetch the long string only once. + if (stringGrip._fullText) { + return stringGrip._fullText.promise; + } + + let deferred = stringGrip._fullText = promise.defer(); + let { actor, initial, length } = stringGrip; + let longStringClient = this.longString(stringGrip); + + longStringClient.substring(initial.length, length, aResponse => { + if (aResponse.error) { + DevToolsUtils.reportException("getString", + aResponse.error + ": " + aResponse.message); + + deferred.reject(aResponse); + return; + } + deferred.resolve(initial + aResponse.substring); + }); + + return deferred.promise; + } + }; + + +/***/ }, +/* 57 */ +/***/ 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/. */ + + const { Services } = __webpack_require__(28); + const EventEmitter = __webpack_require__(34); + + /** + * Shortcuts for lazily accessing and setting various preferences. + * Usage: + * let prefs = new Prefs("root.path.to.branch", { + * myIntPref: ["Int", "leaf.path.to.my-int-pref"], + * myCharPref: ["Char", "leaf.path.to.my-char-pref"], + * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], + * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] + * ... + * }); + * + * Get/set: + * prefs.myCharPref = "foo"; + * let aux = prefs.myCharPref; + * + * Observe: + * prefs.registerObserver(); + * prefs.on("pref-changed", (prefName, prefValue) => { + * ... + * }); + * + * @param string prefsRoot + * The root path to the required preferences branch. + * @param object prefsBlueprint + * An object containing { accessorName: [prefType, prefName] } keys. + */ + function PrefsHelper(prefsRoot = "", prefsBlueprint = {}) { + EventEmitter.decorate(this); + + let cache = new Map(); + + for (let accessorName in prefsBlueprint) { + let [prefType, prefName] = prefsBlueprint[accessorName]; + map(this, cache, accessorName, prefType, prefsRoot, prefName); + } + + let observer = makeObserver(this, cache, prefsRoot, prefsBlueprint); + this.registerObserver = () => observer.register(); + this.unregisterObserver = () => observer.unregister(); + } + + /** + * Helper method for getting a pref value. + * + * @param Map cache + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @return any + */ + function get(cache, prefType, prefsRoot, prefName) { + let cachedPref = cache.get(prefName); + if (cachedPref !== undefined) { + return cachedPref; + } + let value = Services.prefs["get" + prefType + "Pref"]( + [prefsRoot, prefName].join(".") + ); + cache.set(prefName, value); + return value; + } + + /** + * Helper method for setting a pref value. + * + * @param Map cache + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @param any value + */ + function set(cache, prefType, prefsRoot, prefName, value) { + Services.prefs["set" + prefType + "Pref"]( + [prefsRoot, prefName].join("."), + value + ); + cache.set(prefName, value); + } + + /** + * Maps a property name to a pref, defining lazy getters and setters. + * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" + * type and casting), and "Json" (which is basically just sugar for "Char" + * using the standard JSON serializer). + * + * @param PrefsHelper self + * @param Map cache + * @param string accessorName + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @param array serializer [optional] + */ + function map(self, cache, accessorName, prefType, prefsRoot, prefName, + serializer = { in: e => e, out: e => e }) { + if (prefName in self) { + throw new Error(`Can't use ${prefName} because it overrides a property` + + "on the instance."); + } + if (prefType == "Json") { + map(self, cache, accessorName, "Char", prefsRoot, prefName, { + in: JSON.parse, + out: JSON.stringify + }); + return; + } + if (prefType == "Float") { + map(self, cache, accessorName, "Char", prefsRoot, prefName, { + in: Number.parseFloat, + out: (n) => n + "" + }); + return; + } + + Object.defineProperty(self, accessorName, { + get: () => serializer.in(get(cache, prefType, prefsRoot, prefName)), + set: (e) => set(cache, prefType, prefsRoot, prefName, serializer.out(e)) + }); + } + + /** + * Finds the accessor for the provided pref, based on the blueprint object + * used in the constructor. + * + * @param PrefsHelper self + * @param object prefsBlueprint + * @return string + */ + function accessorNameForPref(somePrefName, prefsBlueprint) { + for (let accessorName in prefsBlueprint) { + let [, prefName] = prefsBlueprint[accessorName]; + if (somePrefName == prefName) { + return accessorName; + } + } + return ""; + } + + /** + * Creates a pref observer for `self`. + * + * @param PrefsHelper self + * @param Map cache + * @param string prefsRoot + * @param object prefsBlueprint + * @return object + */ + function makeObserver(self, cache, prefsRoot, prefsBlueprint) { + return { + register: function() { + this._branch = Services.prefs.getBranch(prefsRoot + "."); + this._branch.addObserver("", this); + }, + unregister: function() { + this._branch.removeObserver("", this); + }, + observe: function(subject, topic, prefName) { + // If this particular pref isn't handled by the blueprint object, + // even though it's in the specified branch, ignore it. + let accessorName = accessorNameForPref(prefName, prefsBlueprint); + if (!(accessorName in self)) { + return; + } + cache.delete(prefName); + self.emit("pref-changed", accessorName, self[accessorName]); + } + }; + } + + exports.PrefsHelper = PrefsHelper; + + +/***/ }, +/* 58 */ +/***/ 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/. */ + + const promise = __webpack_require__(40); + const EventEmitter = __webpack_require__(34); + + /* const { DebuggerServer } = require("../../server/main");*/ + const { DebuggerClient } = __webpack_require__(53); + + const targets = new WeakMap(); + const promiseTargets = new WeakMap(); + + /** + * Functions for creating Targets + */ + exports.TargetFactory = { + /** + * Construct a Target + * @param {XULTab} tab + * The tab to use in creating a new target. + * + * @return A target object + */ + forTab: function(tab) { + let target = targets.get(tab); + if (target == null) { + target = new TabTarget(tab); + targets.set(tab, target); + } + return target; + }, + + /** + * Return a promise of a Target for a remote tab. + * @param {Object} options + * The options object has the following properties: + * { + * form: the remote protocol form of a tab, + * client: a DebuggerClient instance + * (caller owns this and is responsible for closing), + * chrome: true if the remote target is the whole process + * } + * + * @return A promise of a target object + */ + forRemoteTab: function(options) { + let targetPromise = promiseTargets.get(options); + if (targetPromise == null) { + let target = new TabTarget(options); + targetPromise = target.makeRemote().then(() => target); + promiseTargets.set(options, targetPromise); + } + return targetPromise; + }, + + forWorker: function(workerClient) { + let target = targets.get(workerClient); + if (target == null) { + target = new WorkerTarget(workerClient); + targets.set(workerClient, target); + } + return target; + }, + + /** + * Creating a target for a tab that is being closed is a problem because it + * allows a leak as a result of coming after the close event which normally + * clears things up. This function allows us to ask if there is a known + * target for a tab without creating a target + * @return true/false + */ + isKnownTab: function(tab) { + return targets.has(tab); + }, + }; + + /** + * A Target represents something that we can debug. Targets are generally + * read-only. Any changes that you wish to make to a target should be done via + * a Tool that attaches to the target. i.e. a Target is just a pointer saying + * "the thing to debug is over there". + * + * Providing a generalized abstraction of a web-page or web-browser (available + * either locally or remotely) is beyond the scope of this class (and maybe + * also beyond the scope of this universe) However Target does attempt to + * abstract some common events and read-only properties common to many Tools. + * + * Supported read-only properties: + * - name, isRemote, url + * + * Target extends EventEmitter and provides support for the following events: + * - close: The target window has been closed. All tools attached to this + * target should close. This event is not currently cancelable. + * - navigate: The target window has navigated to a different URL + * + * Optional events: + * - will-navigate: The target window will navigate to a different URL + * - hidden: The target is not visible anymore (for TargetTab, another tab is + * selected) + * - visible: The target is visible (for TargetTab, tab is selected) + * + * Comparing Targets: 2 instances of a Target object can point at the same + * thing, so t1 !== t2 and t1 != t2 even when they represent the same object. + * To compare to targets use 't1.equals(t2)'. + */ + + /** + * A TabTarget represents a page living in a browser tab. Generally these will + * be web pages served over http(s), but they don't have to be. + */ + function TabTarget(tab) { + EventEmitter.decorate(this); + this.destroy = this.destroy.bind(this); + this._handleThreadState = this._handleThreadState.bind(this); + this.on("thread-resumed", this._handleThreadState); + this.on("thread-paused", this._handleThreadState); + this.activeTab = this.activeConsole = null; + // Only real tabs need initialization here. Placeholder objects for remote + // targets will be initialized after a makeRemote method call. + if (tab && !["client", "form", "chrome"].every(tab.hasOwnProperty, tab)) { + this._tab = tab; + this._setupListeners(); + } else { + this._form = tab.form; + this._client = tab.client; + this._chrome = tab.chrome; + } + // Default isTabActor to true if not explicitly specified + if (typeof tab.isTabActor == "boolean") { + this._isTabActor = tab.isTabActor; + } else { + this._isTabActor = true; + } + } + + TabTarget.prototype = { + _webProgressListener: null, + + /** + * Returns a promise for the protocol description from the root actor. Used + * internally with `target.actorHasMethod`. Takes advantage of caching if + * definition was fetched previously with the corresponding actor information. + * Actors are lazily loaded, so not only must the tool using a specific actor + * be in use, the actors are only registered after invoking a method (for + * performance reasons, added in bug 988237), so to use these actor detection + * methods, one must already be communicating with a specific actor of that + * type. + * + * Must be a remote target. + * + * @return {Promise} + * { + * "category": "actor", + * "typeName": "longstractor", + * "methods": [{ + * "name": "substring", + * "request": { + * "type": "substring", + * "start": { + * "_arg": 0, + * "type": "primitive" + * }, + * "end": { + * "_arg": 1, + * "type": "primitive" + * } + * }, + * "response": { + * "substring": { + * "_retval": "primitive" + * } + * } + * }], + * "events": {} + * } + */ + getActorDescription: function(actorName) { + if (!this.client) { + throw new Error("TabTarget#getActorDescription() can only be called on " + + "remote tabs."); + } + + let deferred = promise.defer(); + + if (this._protocolDescription && + this._protocolDescription.types[actorName]) { + deferred.resolve(this._protocolDescription.types[actorName]); + } else { + this.client.mainRoot.protocolDescription(description => { + this._protocolDescription = description; + deferred.resolve(description.types[actorName]); + }); + } + + return deferred.promise; + }, + + /** + * Returns a boolean indicating whether or not the specific actor + * type exists. Must be a remote target. + * + * @param {String} actorName + * @return {Boolean} + */ + hasActor: function(actorName) { + if (!this.client) { + throw new Error("TabTarget#hasActor() can only be called on remote " + + "tabs."); + } + if (this.form) { + return !!this.form[actorName + "Actor"]; + } + return false; + }, + + /** + * Queries the protocol description to see if an actor has + * an available method. The actor must already be lazily-loaded (read + * the restrictions in the `getActorDescription` comments), + * so this is for use inside of tool. Returns a promise that + * resolves to a boolean. Must be a remote target. + * + * @param {String} actorName + * @param {String} methodName + * @return {Promise} + */ + actorHasMethod: function(actorName, methodName) { + if (!this.client) { + throw new Error("TabTarget#actorHasMethod() can only be called on " + + "remote tabs."); + } + return this.getActorDescription(actorName).then(desc => { + if (desc && desc.methods) { + return !!desc.methods.find(method => method.name === methodName); + } + return false; + }); + }, + + /** + * Returns a trait from the root actor. + * + * @param {String} traitName + * @return {Mixed} + */ + getTrait: function(traitName) { + if (!this.client) { + throw new Error("TabTarget#getTrait() can only be called on remote " + + "tabs."); + } + + // If the targeted actor exposes traits and has a defined value for this + // traits, override the root actor traits + if (this.form.traits && traitName in this.form.traits) { + return this.form.traits[traitName]; + } + + return this.client.traits[traitName]; + }, + + get tab() { + return this._tab; + }, + + get form() { + return this._form; + }, + + // Get a promise of the root form returned by a listTabs request. This promise + // is cached. + get root() { + if (!this._root) { + this._root = this._getRoot(); + } + return this._root; + }, + + _getRoot: function() { + return new Promise((resolve, reject) => { + this.client.listTabs(response => { + if (response.error) { + reject(new Error(response.error + ": " + response.message)); + return; + } + + resolve(response); + }); + }); + }, + + get client() { + return this._client; + }, + + // Tells us if we are debugging content document + // or if we are debugging chrome stuff. + // Allows to controls which features are available against + // a chrome or a content document. + get chrome() { + return this._chrome; + }, + + // Tells us if the related actor implements TabActor interface + // and requires to call `attach` request before being used + // and `detach` during cleanup + get isTabActor() { + return this._isTabActor; + }, + + get window() { + // XXX - this is a footgun for e10s - there .contentWindow will be null, + // and even though .contentWindowAsCPOW *might* work, it will not work + // in all contexts. Consumers of .window need to be refactored to not + // rely on this. + // if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { + // console.error("The .window getter on devtools' |target| object isn't " + + // "e10s friendly!\n" + Error().stack); + // } + // Be extra careful here, since this may be called by HS_getHudByWindow + // during shutdown. + if (this._tab && this._tab.linkedBrowser) { + return this._tab.linkedBrowser.contentWindow; + } + return null; + }, + + get name() { + if (this._tab && this._tab.linkedBrowser.contentDocument) { + return this._tab.linkedBrowser.contentDocument.title; + } + if (this.isAddon) { + return this._form.name; + } + return this._form.title; + }, + + get url() { + return this._tab ? this._tab.linkedBrowser.currentURI.spec : + this._form.url; + }, + + get isRemote() { + return !this.isLocalTab; + }, + + get isAddon() { + return !!(this._form && this._form.actor && + this._form.actor.match(/conn\d+\.addon\d+/)); + }, + + get isLocalTab() { + return !!this._tab; + }, + + get isMultiProcess() { + return !this.window; + }, + + get isThreadPaused() { + return !!this._isThreadPaused; + }, + + /** + * Adds remote protocol capabilities to the target, so that it can be used + * for tools that support the Remote Debugging Protocol even for local + * connections. + */ + makeRemote: function() { + if (this._remote) { + return this._remote.promise; + } + + this._remote = promise.defer(); + + if (this.isLocalTab) { + // Since a remote protocol connection will be made, let's start the + // DebuggerServer here, once and for all tools. + if (!DebuggerServer.initialized) { + DebuggerServer.init(); + DebuggerServer.addBrowserActors(); + } + + this._client = new DebuggerClient(DebuggerServer.connectPipe()); + // A local TabTarget will never perform chrome debugging. + this._chrome = false; + } + + this._setupRemoteListeners(); + + let attachTab = () => { + this._client.attachTab(this._form.actor, (response, tabClient) => { + if (!tabClient) { + this._remote.reject("Unable to attach to the tab"); + return; + } + this.activeTab = tabClient; + this.threadActor = response.threadActor; + attachConsole(); + }); + }; + + let onConsoleAttached = (response, consoleClient) => { + if (!consoleClient) { + this._remote.reject("Unable to attach to the console"); + return; + } + this.activeConsole = consoleClient; + this._remote.resolve(null); + }; + + let attachConsole = () => { + this._client.attachConsole(this._form.consoleActor, + [ "NetworkActivity" ], + onConsoleAttached); + }; + + if (this.isLocalTab) { + this._client.connect(() => { + this._client.getTab({ tab: this.tab }).then(response => { + this._form = response.tab; + attachTab(); + }); + }); + } else if (this.isTabActor) { + // In the remote debugging case, the protocol connection will have been + // already initialized in the connection screen code. + attachTab(); + } else { + // AddonActor and chrome debugging on RootActor doesn't inherits from + // TabActor and doesn't need to be attached. + attachConsole(); + } + + return this._remote.promise; + }, + + /** + * Listen to the different events. + */ + _setupListeners: function() { + this._webProgressListener = new TabWebProgressListener(this); + this.tab.linkedBrowser.addProgressListener(this._webProgressListener); + this.tab.addEventListener("TabClose", this); + this.tab.parentNode.addEventListener("TabSelect", this); + this.tab.ownerDocument.defaultView.addEventListener("unload", this); + }, + + /** + * Teardown event listeners. + */ + _teardownListeners: function() { + if (this._webProgressListener) { + this._webProgressListener.destroy(); + } + + this._tab.ownerDocument.defaultView.removeEventListener("unload", this); + this._tab.removeEventListener("TabClose", this); + this._tab.parentNode.removeEventListener("TabSelect", this); + }, + + /** + * Setup listeners for remote debugging, updating existing ones as necessary. + */ + _setupRemoteListeners: function() { + this.client.addListener("closed", this.destroy); + + this._onTabDetached = (aType, aPacket) => { + // We have to filter message to ensure that this detach is for this tab + if (aPacket.from == this._form.actor) { + this.destroy(); + } + }; + this.client.addListener("tabDetached", this._onTabDetached); + + this._onTabNavigated = (aType, aPacket) => { + let event = Object.create(null); + event.url = aPacket.url; + event.title = aPacket.title; + event.nativeConsoleAPI = aPacket.nativeConsoleAPI; + event.isFrameSwitching = aPacket.isFrameSwitching; + // Send any stored event payload (DOMWindow or nsIRequest) for backwards + // compatibility with non-remotable tools. + if (aPacket.state == "start") { + event._navPayload = this._navRequest; + this.emit("will-navigate", event); + this._navRequest = null; + } else { + event._navPayload = this._navWindow; + this.emit("navigate", event); + this._navWindow = null; + } + }; + this.client.addListener("tabNavigated", this._onTabNavigated); + + this._onFrameUpdate = (aType, aPacket) => { + this.emit("frame-update", aPacket); + }; + this.client.addListener("frameUpdate", this._onFrameUpdate); + }, + + /** + * Teardown listeners for remote debugging. + */ + _teardownRemoteListeners: function() { + this.client.removeListener("closed", this.destroy); + this.client.removeListener("tabNavigated", this._onTabNavigated); + this.client.removeListener("tabDetached", this._onTabDetached); + this.client.removeListener("frameUpdate", this._onFrameUpdate); + }, + + /** + * Handle tabs events. + */ + handleEvent: function(event) { + switch (event.type) { + case "TabClose": + case "unload": + this.destroy(); + break; + case "TabSelect": + if (this.tab.selected) { + this.emit("visible", event); + } else { + this.emit("hidden", event); + } + break; + } + }, + + /** + * Handle script status. + */ + _handleThreadState: function(event) { + switch (event) { + case "thread-resumed": + this._isThreadPaused = false; + break; + case "thread-paused": + this._isThreadPaused = true; + break; + } + }, + + /** + * Target is not alive anymore. + */ + destroy: function() { + // If several things call destroy then we give them all the same + // destruction promise so we're sure to destroy only once + if (this._destroyer) { + return this._destroyer.promise; + } + + this._destroyer = promise.defer(); + + // Before taking any action, notify listeners that destruction is imminent. + this.emit("close"); + + // First of all, do cleanup tasks that pertain to both remoted and + // non-remoted targets. + this.off("thread-resumed", this._handleThreadState); + this.off("thread-paused", this._handleThreadState); + + if (this._tab) { + this._teardownListeners(); + } + + let cleanupAndResolve = () => { + this._cleanup(); + this._destroyer.resolve(null); + }; + // If this target was not remoted, the promise will be resolved before the + // function returns. + if (this._tab && !this._client) { + cleanupAndResolve(); + } else if (this._client) { + // If, on the other hand, this target was remoted, the promise will be + // resolved after the remote connection is closed. + this._teardownRemoteListeners(); + + if (this.isLocalTab) { + // We started with a local tab and created the client ourselves, so we + // should close it. + this._client.close(cleanupAndResolve); + } else if (this.activeTab) { + // The client was handed to us, so we are not responsible for closing + // it. We just need to detach from the tab, if already attached. + // |detach| may fail if the connection is already dead, so proceed with + // cleanup directly after this. + this.activeTab.detach(); + cleanupAndResolve(); + } else { + cleanupAndResolve(); + } + } + + return this._destroyer.promise; + }, + + /** + * Clean up references to what this target points to. + */ + _cleanup: function() { + if (this._tab) { + targets.delete(this._tab); + } else { + promiseTargets.delete(this._form); + } + this.activeTab = null; + this.activeConsole = null; + this._client = null; + this._tab = null; + this._form = null; + this._remote = null; + }, + + toString: function() { + let id = this._tab ? this._tab : (this._form && this._form.actor); + return `TabTarget:${id}`; + }, + }; + + function WorkerTarget(workerClient) { + EventEmitter.decorate(this); + this._workerClient = workerClient; + } + + /** + * A WorkerTarget represents a worker. Unlike TabTarget, which can represent + * either a local or remote tab, WorkerTarget always represents a remote worker. + * Moreover, unlike TabTarget, which is constructed with a placeholder object + * for remote tabs (from which a TabClient can then be lazily obtained), + * WorkerTarget is constructed with a WorkerClient directly. + * + * WorkerClient is designed to mimic the interface of TabClient as closely as + * possible. This allows us to debug workers as if they were ordinary tabs, + * requiring only minimal changes to the rest of the frontend. + */ + WorkerTarget.prototype = { + destroy: function() {}, + + get isRemote() { + return true; + }, + + get isTabActor() { + return true; + }, + + get url() { + return this._workerClient.url; + }, + + get isWorkerTarget() { + return true; + }, + + get form() { + return { + consoleActor: this._workerClient.consoleActor + }; + }, + + get activeTab() { + return this._workerClient; + }, + + get client() { + return this._workerClient.client; + }, + + destroy: function() {}, + + hasActor: function(name) { + return false; + }, + + getTrait: function() { + return undefined; + }, + + makeRemote: function() { + return Promise.resolve(); + } + }; + + +/***/ }, +/* 59 */ +/***/ 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"; + + const EventEmitter = __webpack_require__(34); + + 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({ data }) { + if (typeof data !== "string") { + throw new Error("Binary messages are not supported by WebSocket transport"); + } + + let object = JSON.parse(data); + this.emit("packet", object); + if (this.hooks) { + this.hooks.onPacket(object); + } + }, + }; + + module.exports = WebSocketDebuggerTransport; + + +/***/ }, +/* 60 */ +/***/ 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"; + + const EventEmitter = __webpack_require__(34); + + /** + * 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({ id = null } = {}) { + 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) { + let doc = toolbox.doc; + let 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. + let 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) { + let doc = parent.ownerDocument; + this.menuitems.forEach(item => { + if (!item.visible) { + return; + } + + if (item.submenu) { + let menupopup = doc.createElement("menupopup"); + item.submenu._createMenuItems(menupopup); + + let 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") { + let menusep = doc.createElement("menuseparator"); + parent.appendChild(menusep); + } else { + let 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; + + +/***/ }, +/* 61 */ +/***/ 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"; + + /** + * A partial implementation of the MenuItem API provided by electron: + * https://github.com/electron/electron/blob/master/docs/api/menu-item.md. + * + * Missing features: + * - id String - Unique within a single menu. If defined then it can be used + * as a reference to this item by the position attribute. + * - role String - Define the action of the menu item; when specified the + * click property will be ignored + * - sublabel String + * - accelerator Accelerator + * - icon NativeImage + * - position String - This field allows fine-grained definition of the + * specific location within a given menu. + * + * Implemented features: + * @param Object options + * Function click + * Will be called with click(menuItem, browserWindow) when the menu item + * is clicked + * String type + * Can be normal, separator, submenu, checkbox or radio + * String label + * Boolean enabled + * If false, the menu item will be greyed out and unclickable. + * Boolean checked + * Should only be specified for checkbox or radio type menu items. + * Menu submenu + * Should be specified for submenu type menu items. If submenu is specified, + * the type: 'submenu' can be omitted. If the value is not a Menu then it + * will be automatically converted to one using Menu.buildFromTemplate. + * Boolean visible + * If false, the menu item will be entirely hidden. + */ + function MenuItem({ + accesskey = null, + checked = false, + click = () => {}, + disabled = false, + label = "", + id = null, + submenu = null, + type = "normal", + visible = true, + } = { }) { + this.accesskey = accesskey; + this.checked = checked; + this.click = click; + this.disabled = disabled; + this.id = id; + this.label = label; + this.submenu = submenu; + this.type = type; + this.visible = visible; + } + + module.exports = MenuItem; + + +/***/ }, +/* 62 */ +/***/ 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/. */ + + const { DOM: dom, createClass, createFactory, PropTypes } = __webpack_require__(2); + // const { ViewHelpers } = + // require("resource://devtools/client/shared/widgets/ViewHelpers.jsm"); + // let { VirtualScroll } = require("react-virtualized"); + // VirtualScroll = createFactory(VirtualScroll); + + const 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. + */ + const 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() { + const 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); + } + })); + + const 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() { + const arrow = ArrowExpander({ + item: this.props.item, + expanded: this.props.expanded, + visible: this.props.hasChildren, + onExpand: this.props.onExpand, + onCollapse: this.props.onCollapse, + }); + + let 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) { + let animationId = null; + let argsToPass = null; + return function(...args) { + argsToPass = args; + if (animationId !== null) { + return; + } + + animationId = requestAnimationFrame(() => { + fn.call(this, ...argsToPass); + animationId = null; + argsToPass = null; + }); + }; + } + + const 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 + */ + const 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. + const autoExpand = (item, currentDepth) => { + if (currentDepth >= props.autoExpandDepth || + this.state.seen.has(item)) { + return; + } + + props.onExpand(item); + this.state.seen.add(item); + + const children = props.getChildren(item); + const length = children.length; + for (let i = 0; i < length; i++) { + autoExpand(children[i], currentDepth + 1); + } + }; + + const roots = props.getRoots(); + const length = roots.length; + if (props.autoExpandAll) { + for (let i = 0; i < length; i++) { + autoExpand(roots[i], 0); + } + } else if (length != 0) { + autoExpand(roots[0], 0); + } + }, + + render() { + const 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" + // } + // }) + // ]; + + const renderItem = i => { + let { item, depth } = traversal[i]; + 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" + // } + // })); + + const 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, maxDepth = Infinity, traversal = [], _depth = 0) { + traversal.push({ item, depth: _depth }); + + if (!this.props.isExpanded(item)) { + return traversal; + } + + const nextDepth = _depth + 1; + + if (nextDepth > maxDepth) { + return traversal; + } + + const children = this.props.getChildren(item); + const length = children.length; + for (let 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(maxDepth = Infinity) { + const traversal = []; + + const roots = this.props.getRoots(); + const length = roots.length; + for (let 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) { + const children = this._dfs(item); + const length = children.length; + for (let 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) { + const itemStartPosition = index * this.props.itemHeight; + const 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); + } else { + this._focusNextNode(); + } + 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. + + let prev; + let prevIndex; + + const traversal = this._dfsFromRoots(); + const length = traversal.length; + for (let i = 0; i < length; i++) { + const 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. + + const traversal = this._dfsFromRoots(); + const length = traversal.length; + let 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() { + const parent = this.props.getParent(this.props.focused); + if (!parent) { + return; + } + + const traversal = this._dfsFromRoots(); + const length = traversal.length; + let parentIndex = 0; + for (; parentIndex < length; parentIndex++) { + if (traversal[parentIndex].item === parent) { + break; + } + } + + this._focus(parentIndex, parent); + }), + }); + + +/***/ }, +/* 63 */ +/***/ 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"); + + const l10n = { + getStr: () => {} + } + + // Character codes used in various parsing helper functions. + const CHAR_CODE_A = "a".charCodeAt(0); + const CHAR_CODE_C = "c".charCodeAt(0); + const CHAR_CODE_D = "d".charCodeAt(0); + const CHAR_CODE_E = "e".charCodeAt(0); + const CHAR_CODE_F = "f".charCodeAt(0); + const CHAR_CODE_H = "h".charCodeAt(0); + const CHAR_CODE_I = "i".charCodeAt(0); + const CHAR_CODE_J = "j".charCodeAt(0); + const CHAR_CODE_L = "l".charCodeAt(0); + const CHAR_CODE_M = "m".charCodeAt(0); + const CHAR_CODE_O = "o".charCodeAt(0); + const CHAR_CODE_P = "p".charCodeAt(0); + const CHAR_CODE_R = "r".charCodeAt(0); + const CHAR_CODE_S = "s".charCodeAt(0); + const CHAR_CODE_T = "t".charCodeAt(0); + const CHAR_CODE_U = "u".charCodeAt(0); + const CHAR_CODE_COLON = ":".charCodeAt(0); + const CHAR_CODE_SLASH = "/".charCodeAt(0); + const CHAR_CODE_CAP_S = "S".charCodeAt(0); + + // The cache used in the `parseURL` function. + const gURLStore = new Map(); + // The cache used in the `getSourceNames` function. + const 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) { + let 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" + let 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) { + let data = gSourceNamesStore.get(source); + + if (data) { + return data; + } + + let short, long, host; + const sourceStr = source ? String(source) : ""; + + // If `data:...` uri + if (isDataScheme(sourceStr)) { + let 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); + let 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)) { + let result = { short: sourceStr, long: sourceStr }; + gSourceNamesStore.set(source, result); + return result; + } + + const 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); + } + + let 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, i = 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, i = 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, i = 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, i = 0) { + let 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, i = 0) { + let 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; + + +/***/ }, +/* 64 */ +/***/ 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"; + + const { DOM: dom, createClass, PropTypes } = __webpack_require__(2); + const { getSourceNames, parseURL, + isScratchpadScheme, getSourceMappedFile } = __webpack_require__(63); + // const { LocalizationHelper } = require("devtools/shared/l10n"); + // + // const l10n = new LocalizationHelper("devtools/client/locales/components.properties"); + // const webl10n = new LocalizationHelper("devtools/client/locales/webconsole.properties"); + + const l10n = { getStr: () => {} }; + const 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() { + const sourceMapService = this.props.sourceMapService; + if (sourceMapService) { + const source = this.getSource(); + sourceMapService.subscribe(source, this.onSourceUpdated); + } + }, + + componentWillUnmount() { + const sourceMapService = this.props.sourceMapService; + if (sourceMapService) { + const 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) { + const 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; + const { source, line, column } = frame; + 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) { + const { url, line, column } = source; + return { + source: url, + line, + column, + functionDisplayName: this.props.frame.functionDisplayName, + }; + }, + + render() { + let frame, isSourceMapped; + let { + onClick, + showFunctionName, + showAnonymousFunctionName, + showHost, + showEmptyPathAsHost, + showFullSourceUrl + } = this.props; + + if (this.state && this.state.isSourceMapped) { + frame = this.state.frame; + isSourceMapped = this.state.isSourceMapped; + } else { + frame = this.props.frame; + } + + let source = frame.source ? String(frame.source) : ""; + let line = frame.line != void 0 ? Number(frame.line) : null; + let column = frame.column != void 0 ? Number(frame.column) : null; + + const { short, long, host } = getSourceNames(source); + // 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. + const isLinkable = !!(isScratchpadScheme(source) || parseURL(source)) + || isSourceMapped; + const elements = []; + const sourceElements = []; + let sourceEl; + + let tooltip = long; + + // If the source is linkable and line > 0 + const 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}`; + } + } + + let attributes = { + "data-url": long, + className: "frame-link", + }; + + if (showFunctionName) { + let functionDisplayName = frame.functionDisplayName; + if (!functionDisplayName && showAnonymousFunctionName) { + functionDisplayName = webl10n.getStr("stacktrace.anonymousFunction"); + } + + if (functionDisplayName) { + elements.push( + dom.span({ className: "frame-link-function-display-name" }, + functionDisplayName), + " " + ); + } + } + + let 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) { + let 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. + let 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(attributes, ...elements); + } + }); + + +/***/ }, +/* 65 */ +/***/ function(module, exports, __webpack_require__) { + + const feature = __webpack_require__(66); + + module.exports = feature; + + +/***/ }, +/* 66 */ +/***/ function(module, exports, __webpack_require__) { + + const pick = __webpack_require__(67); + const put = __webpack_require__(112); + const fs = __webpack_require__(118); + const path = __webpack_require__(119); + + let config; + + const flag = __webpack_require__(121); + + /** + * Gets a config value for a given key + * e.g "chrome.webSocketPort" + */ + function getValue(key) { + return pick(config, key); + } + + function setValue(key, value) { + return put(config, key, value); + } + + function isEnabled(key) { + return config.features && + typeof config.features[key] == "object" ? + config.features[key].enabled : + config.features[key]; + } + + function isDevelopment() { + if (isFirefoxPanel()) { + // Default to production if compiling for the Firefox panel + return ("production") === "development"; + } + return ("production") !== "production"; + } + + function isTesting() { + return flag.testing; + } + + function isFirefoxPanel() { + return ("firefox-panel") == "firefox-panel"; + } + + function isApplication() { + return ("firefox-panel") == "application"; + } + + function isFirefox() { + return /firefox/i.test(navigator.userAgent); + } + + function setConfig(value) { + config = value; + } + + function getConfig() { + return config; + } + + function updateLocalConfig(relativePath) { + const localConfigPath = path.resolve(relativePath, "../configs/local.json"); + try { + const output = JSON.stringify(config, null, 2); + fs.writeFileSync(localConfigPath, output); + return output; + } catch (err) { + return "{}"; + } + } + + module.exports = { + isEnabled, + getValue, + setValue, + isDevelopment, + isTesting, + isFirefoxPanel, + isApplication, + isFirefox, + getConfig, + setConfig, + updateLocalConfig + }; + + +/***/ }, /* 67 */ /***/ function(module, exports, __webpack_require__) { @@ -3209,10 +18907,478 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = __WEBPACK_EXTERNAL_MODULE_121__; /***/ }, -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */, +/* 122 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var fetchSources = (() => { + var _ref2 = _asyncToGenerator(function* () { + var _ref3 = yield threadClient.getSources(), + sources = _ref3.sources; + + return sources.map(createSource); + }); + + return function fetchSources() { + 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__(123), + 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 = { + 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 + }; + +/***/ }, +/* 123 */ +/***/ 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 + }; + } + + 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 + }; + +/***/ }, +/* 124 */ +/***/ 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. + if (packet.why.type === "interrupted" && !packet.why.onNext) { + return; + } + + // Eagerly fetch the frames + var response = yield threadClient.getFrames(0, CALL_STACK_PAGE_SIZE); + + 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__(123), + createPause = _require.createPause, + createSource = _require.createSource; + + var _require2 = __webpack_require__(65), + 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; + } + + 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 + }; + +/***/ }, +/* 125 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var CDP = __webpack_require__(126); + + var _require = __webpack_require__(65), + getValue = _require.getValue; + + var networkRequest = __webpack_require__(127); + + var _require2 = __webpack_require__(128), + setupCommands = _require2.setupCommands, + clientCommands = _require2.clientCommands; + + var _require3 = __webpack_require__(130), + setupEvents = _require3.setupEvents, + clientEvents = _require3.clientEvents, + pageEvents = _require3.pageEvents; + + 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 connectClient() { + if (!getValue("chrome.debug")) { + return Promise.resolve(createTabs([])); + } + + return CDP.List({ + port: getValue("chrome.port"), + host: getValue("chrome.host") + }).then(tabs => createTabs(tabs, { + clientType: "chrome", type: "page" + })).catch(() => {}); + } + + function connectNodeClient() { + if (!getValue("node.debug")) { + return Promise.resolve(createTabs([])); + } + + return CDP.List({ + port: getValue("node.port"), + host: getValue("node.host") + }).then(tabs => createTabs(tabs, { + clientType: "node", type: "node" + })).catch(() => {}); + } + + function connectTab(tab) { + return CDP({ tab: tab.webSocketDebuggerUrl }).then(conn => { + connection = conn; + }); + } + + function connectNode(tab) { + return CDP({ tab: tab.webSocketDebuggerUrl }).then(conn => { + connection = conn; + window.addEventListener("beforeunload", () => { + connection.onclose = function disable() {}; + connection.close(); + }); + }); + } + + function initPage(actions, _ref2) { + var clientType = _ref2.clientType; + var _connection = connection, + Debugger = _connection.Debugger, + Runtime = _connection.Runtime, + Page = _connection.Page; + + + setupCommands({ Debugger, Runtime, Page }); + setupEvents({ actions, Page, clientType, Runtime }); + + Debugger.enable(); + Debugger.setPauseOnExceptions({ state: "none" }); + Debugger.setAsyncCallStackDepth({ maxDepth: 0 }); + + Runtime.enable(); + + if (clientType == "node") { + Runtime.runIfWaitingForDebugger(); + } + + if (clientType == "chrome") { + Page.enable(); + 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); + } + + module.exports = { + connectClient, + connectNodeClient, + clientCommands, + connectNode, + connectTab, + initPage + }; + +/***/ }, /* 126 */ /***/ function(module, exports) { @@ -3228,10 +19394,373 @@ return /******/ (function(modules) { // webpackBootstrap var a=e[t.tab(e)];a?(o=a.webSocketDebuggerUrl,o?n(o):i(r)):i(new Error("Invalid tab index"))}).catch(i);break;default:i(new Error("Invalid requested tab"))}})}function d(e){var t=this;return new Promise(function(n,i){try{t._ws=new f(e,{perMessageDeflate:!1})}catch(e){return void i(e)}t._ws.on("open",function(){n()}),t._ws.on("message",function(e){var n=JSON.parse(e);l.call(t,n)}),t._ws.on("close",function(){t._notifier.emit("disconnect")}),t._ws.on("error",function(e){i(e)})})}function l(e){var t=this;if(e.id){var n=t._callbacks[e.id];if(!n)return;e.error?n(!0,e.error):n(!1,e.result||{}),delete t._callbacks[e.id],0===Object.keys(t._callbacks).length&&t.emit("ready")}else e.method&&(t.emit("event",e),t.emit(e.method,e.params))}var m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=n(2),h=n(27),f=n(42),y=n(43),g=n(38),b=n(3),v=function(e){function t(e,n){i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e=e||{},o.host=e.host||g.HOST,o.port=e.port||g.PORT,o.protocol=e.protocol,o.remote=!!e.remote,o.tab=e.tab||e.chooseTab||function(){return 0},u.call(o),o._notifier=n,o._callbacks={},o._nextCommandId=1,s.call(o),o}return o(t,e),t}(u);v.prototype.inspect=function(e,t){return t.customInspect=!1,h.inspect(this,t)},v.prototype.send=function(e,t,n){var i=this;return"function"==typeof t&&(n=t,t=void 0),"function"!=typeof n?new Promise(function(n,r){a.call(i,e,t,function(e,t){e?r(t):n(t)})}):void a.call(i,e,t,n)},v.prototype.close=function(e){function t(e){n._ws.removeAllListeners("close"),n._ws.close(),n._ws.once("close",function(){n._ws.removeAllListeners(),e()})}var n=this;return"function"!=typeof e?new Promise(function(e,n){t(e)}):void t(e)},e.exports=v}).call(t,n(1))},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n { + 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; + + +/***/ }, +/* 128 */ +/***/ 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__(129), + 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(toggle) { + var state = toggle ? "uncaught" : "none"; + 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 + }; + +/***/ }, +/* 129 */ +/***/ 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 + }; + +/***/ }, +/* 130 */ +/***/ 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__(129), + 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 + }; + +/***/ }, /* 131 */ /***/ function(module, exports, __webpack_require__) { @@ -3262,7 +19791,7 @@ return /******/ (function(modules) { // webpackBootstrap var createStore = configureStore({ log: getValue("logging.actions"), makeThunkArgs: function (args, state) { - return Object.assign({}, args, {}); + return Object.assign({}, args, { client: getClient(state) }); } }); @@ -3287,12 +19816,12 @@ return /******/ (function(modules) { // webpackBootstrap var connectClients = (() => { var _ref3 = _asyncToGenerator(function* (actions) { - var firefoxTabs = yield firefox.connectClient(); - actions.newTabs(firefoxTabs); - chrome.connectClient().then(actions.newTabs); chrome.connectNodeClient().then(actions.newTabs); + + var firefoxTabs = yield firefox.connectClient(); + actions.newTabs(firefoxTabs); }); return function connectClients(_x) { @@ -3303,14 +19832,8 @@ return /******/ (function(modules) { // webpackBootstrap var getTabs = (() => { var _ref4 = _asyncToGenerator(function* (actions) { var firefoxTabs = yield firefox.getTabs(); - var chromeTabs = yield chrome.connectClient(); - var nodeTabs = yield chrome.connectNodeClient(); - actions.clearTabs(); - actions.newTabs(firefoxTabs); - actions.newTabs(chromeTabs); - actions.newTabs(nodeTabs); }); return function getTabs(_x2) { @@ -3319,15 +19842,17 @@ return /******/ (function(modules) { // webpackBootstrap })(); var bootstrap = (() => { - var _ref5 = _asyncToGenerator(function* (React, ReactDOM) { + var _ref5 = _asyncToGenerator(function* (React, ReactDOM, App, appActions, appStore) { var connTarget = getTargetFromQuery(); if (connTarget) { - var _ref6 = yield startDebugging(connTarget), + var _ref6 = yield startDebugging(connTarget, appActions), tab = _ref6.tab, - tabConnection = _ref6.tabConnection; + client = _ref6.client; yield updateConfig(); - return { tab, connTarget, tabConnection }; + debugGlobal("client", client.clientCommands); + renderRoot(React, ReactDOM, App, appStore); + return { tab, connTarget, client }; } var _ref7 = yield initApp(), @@ -3342,7 +19867,7 @@ return /******/ (function(modules) { // webpackBootstrap }), 3000); }); - return function bootstrap(_x3, _x4) { + return function bootstrap(_x3, _x4, _x5, _x6, _x7) { return _ref5.apply(this, arguments); }; })(); @@ -3358,15 +19883,14 @@ return /******/ (function(modules) { // webpackBootstrap var _require2 = __webpack_require__(151), Provider = _require2.Provider; - var _require3 = __webpack_require__(830), + var _require3 = __webpack_require__(26), DevToolsUtils = _require3.DevToolsUtils, - AppConstants = _require3.AppConstants, - defer = _require3.defer; + AppConstants = _require3.AppConstants; var _require4 = __webpack_require__(184), debugGlobal = _require4.debugGlobal; - var _require5 = __webpack_require__(828), + var _require5 = __webpack_require__(65), setConfig = _require5.setConfig, getValue = _require5.getValue, isDevelopment = _require5.isDevelopment; @@ -3377,14 +19901,15 @@ return /******/ (function(modules) { // webpackBootstrap 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","baseWorkerURL":"resource://devtools/client/debugger/new/","logging":false,"clientLogging":false,"firefox":{"mcPath":"./firefox"},"features":{"watchExpressions":{"enabled":true},"chromeScopes":{"enabled":false},"eventListeners":{"enabled":false},"codeCoverage":{"enabled":false},"searchModifiers":{"enabled":true},"functionSearch":{"enabled":true},"editorPreview":{"enabled":true},"showSource":{"enabled":true}}})); // Set various flags before requiring app code. if (getValue("logging.client")) { DevToolsUtils.dumpn.wantLogging = true; } - var _require7 = __webpack_require__(885), + var _require7 = __webpack_require__(23), + getClient = _require7.getClient, firefox = _require7.firefox, chrome = _require7.chrome, startDebugging = _require7.startDebugging; @@ -3468,13 +19993,12 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = { bootstrap, - buildMenu, - debugGlobal, - defer, renderRoot, + unmountRoot, + debugGlobal, L10N, showMenu, - unmountRoot, + buildMenu, updateTheme, updateDir }; @@ -3654,7 +20178,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__(828), + var _require = __webpack_require__(65), isDevelopment = _require.isDevelopment; /** @@ -3690,15 +20214,14 @@ 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), - defer = _require.defer; + var defer = __webpack_require__(137); - var _require2 = __webpack_require__(138), - entries = _require2.entries, - toObject = _require2.toObject; + var _require = __webpack_require__(138), + entries = _require.entries, + toObject = _require.toObject; - var _require3 = __webpack_require__(140), - executeSoon = _require3.executeSoon; + var _require2 = __webpack_require__(140), + executeSoon = _require2.executeSoon; var PROMISE = exports.PROMISE = "@@dispatch/promise"; var seqIdVal = 1; @@ -3752,7 +20275,26 @@ return /******/ (function(modules) { // webpackBootstrap exports.promise = promiseMiddleware; /***/ }, -/* 137 */, +/* 137 */ +/***/ function(module, exports) { + + "use strict"; + + 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 +20310,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__(139); function asPaused(client, func) { if (client.state != "paused") { @@ -3980,7 +20522,249 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }, -/* 139 */, +/* 139 */ +/***/ 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); + } + 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; + } + + +/***/ }, /* 140 */ /***/ function(module, exports, __webpack_require__) { @@ -4084,7 +20868,7 @@ return /******/ (function(modules) { // webpackBootstrap switch (action.type) { case constants.CLEAR_TABS: - return state.setIn(["tabs"], Immutable.Map()).setIn("selectedTab", null); + return initialState; case constants.ADD_TABS: var tabs = action.value; @@ -9231,7 +26015,7 @@ return /******/ (function(modules) { // webpackBootstrap getFilterString = _require3.getFilterString, getConfig = _require3.getConfig; - var _require4 = __webpack_require__(828), + var _require4 = __webpack_require__(65), getValue = _require4.getValue; var LandingPage = React.createFactory(__webpack_require__(167)); @@ -9348,10 +26132,6 @@ return /******/ (function(modules) { // webpackBootstrap function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { - for (var _len = arguments.length, rest = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { - rest[_key - 6] = arguments[_key]; - } - propFullName = propFullName || propName; componentName = componentName || ANONYMOUS; if (props[propName] == null) { @@ -9360,7 +26140,7 @@ return /******/ (function(modules) { // webpackBootstrap return new Error("Required " + locationName + " `" + propFullName + "` was not specified in " + ("`" + componentName + "`.")); } } else { - return validate.apply(undefined, [props, propName, componentName, location, propFullName].concat(rest)); + return validate(props, propName, componentName, location, propFullName); } } @@ -9385,10 +26165,6 @@ return /******/ (function(modules) { // webpackBootstrap function createIterableTypeChecker(typeChecker, immutableClassName, immutableClassTypeValidator) { function validate(props, propName, componentName, location, propFullName) { - for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { - rest[_key - 5] = arguments[_key]; - } - var propValue = props[propName]; if (!immutableClassTypeValidator(propValue)) { var locationName = location; @@ -9402,30 +26178,7 @@ return /******/ (function(modules) { // webpackBootstrap var propValues = propValue.toArray(); for (var i = 0, len = propValues.length; i < len; i++) { - var error = typeChecker.apply(undefined, [propValues, i, componentName, location, "" + propFullName + "[" + i + "]"].concat(rest)); - if (error instanceof Error) { - return error; - } - } - } - return createChainableTypeChecker(validate); - } - - function createKeysTypeChecker(typeChecker) { - - function validate(props, propName, componentName, location, propFullName) { - for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { - rest[_key - 5] = arguments[_key]; - } - - var propValue = props[propName]; - if (typeof typeChecker !== "function") { - return new Error("Invalid keysTypeChecker (optional second argument) supplied to `" + componentName + "` " + ("for propType `" + propFullName + "`, expected a function.")); - } - - var keys = propValue.keySeq().toArray(); - for (var i = 0, len = keys.length; i < len; i++) { - var error = typeChecker.apply(undefined, [keys, i, componentName, location, "" + propFullName + " -> key(" + keys[i] + ")"].concat(rest)); + var error = typeChecker(propValues, i, componentName, location, "" + propFullName + "[" + i + "]"); if (error instanceof Error) { return error; } @@ -9438,24 +26191,12 @@ return /******/ (function(modules) { // webpackBootstrap return createIterableTypeChecker(typeChecker, "List", Immutable.List.isList); } - function createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, immutableClassName, immutableClassTypeValidator) { - function validate() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return createIterableTypeChecker(valuesTypeChecker, immutableClassName, immutableClassTypeValidator).apply(undefined, args) || keysTypeChecker && createKeysTypeChecker(keysTypeChecker).apply(undefined, args); - } - - return createChainableTypeChecker(validate); + function createMapOfTypeChecker(typeChecker) { + return createIterableTypeChecker(typeChecker, "Map", Immutable.Map.isMap); } - function createMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) { - return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, "Map", Immutable.Map.isMap); - } - - function createOrderedMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) { - return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, "OrderedMap", Immutable.OrderedMap.isOrderedMap); + function createOrderedMapOfTypeChecker(typeChecker) { + return createIterableTypeChecker(typeChecker, "OrderedMap", Immutable.OrderedMap.isOrderedMap); } function createSetOfTypeChecker(typeChecker) { @@ -9476,10 +26217,6 @@ return /******/ (function(modules) { // webpackBootstrap function createRecordOfTypeChecker(recordKeys) { function validate(props, propName, componentName, location, propFullName) { - for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { - rest[_key - 5] = arguments[_key]; - } - var propValue = props[propName]; if (!(propValue instanceof Immutable.Record)) { var propType = getPropType(propValue); @@ -9492,7 +26229,7 @@ return /******/ (function(modules) { // webpackBootstrap continue; } var mutablePropValue = propValue.toObject(); - var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, "" + propFullName + "." + key].concat(rest)); + var error = checker(mutablePropValue, key, componentName, location, "" + propFullName + "." + key); if (error) { return error; } @@ -9507,10 +26244,6 @@ return /******/ (function(modules) { // webpackBootstrap var immutableClassTypeValidator = arguments[2] === undefined ? Immutable.Iterable.isIterable : arguments[2]; function validate(props, propName, componentName, location, propFullName) { - for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { - rest[_key - 5] = arguments[_key]; - } - var propValue = props[propName]; if (!immutableClassTypeValidator(propValue)) { var propType = getPropType(propValue); @@ -9523,7 +26256,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!checker) { continue; } - var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, "" + propFullName + "." + key].concat(rest)); + var error = checker(mutablePropValue, key, componentName, location, "" + propFullName + "." + key); if (error) { return error; } @@ -11638,16 +28371,9 @@ return /******/ (function(modules) { // webpackBootstrap click: () => setConfig(key, "dark") }; - var firebugMenuItem = { - id: "node-menu-firebug", - label: "firebug", - disabled: config[key] === "firebug", - click: () => setConfig(key, "firebug") - }; - var items = { "dir": [{ item: ltrMenuItem }, { item: rtlMenuItem }], - "theme": [{ item: lightMenuItem }, { item: darkMenuItem }, { item: firebugMenuItem }] + "theme": [{ item: lightMenuItem }, { item: darkMenuItem }] }; showMenu(event, buildMenu(items[key])); }, @@ -11659,10 +28385,7 @@ return /******/ (function(modules) { // webpackBootstrap }, renderConfig(config) { - var configs = [{ name: "dir", label: "direction" }, { name: "theme", label: "theme" } - // Hiding hotReloading option for now. See Issue #242 - // { name: "hotReloading", label: "hot reloading", bool: true } - ]; + var configs = [{ name: "dir", label: "direction" }, { name: "theme", label: "theme" }, { name: "hotReloading", label: "hot reloading", bool: true }]; return dom.ul({ className: "tab-list" }, configs.map(c => { return dom.li({ key: c.name, className: "tab tab-sides" }, dom.div({ className: "tab-title" }, c.label), c.bool ? dom.input({ @@ -11703,11 +28426,11 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var _require = __webpack_require__(830), + var _require = __webpack_require__(26), Menu = _require.Menu, MenuItem = _require.MenuItem; - var _require2 = __webpack_require__(828), + var _require2 = __webpack_require__(65), isFirefoxPanel = _require2.isFirefoxPanel; function createPopup(doc) { @@ -11906,7 +28629,7 @@ 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 _require = __webpack_require__(828), + var _require = __webpack_require__(65), _setConfig = _require.setConfig; var _require2 = __webpack_require__(131), @@ -11989,7 +28712,7 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var _require = __webpack_require__(828), + var _require = __webpack_require__(65), isDevelopment = _require.isDevelopment, isTesting = _require.isTesting; @@ -12011,17 +28734,13 @@ 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__(28), sprintf = _require.sprintf; - var _require2 = __webpack_require__(883), - parse = _require2.parse; - var strings = {}; function setBundle(bundle) { - bundle = parse(bundle); - strings = Object.assign(strings, bundle); + strings = bundle; } function getStr(key) { @@ -12039,37 +28758,10 @@ return /******/ (function(modules) { // webpackBootstrap return sprintf.apply(undefined, [getStr(name)].concat(_toConsumableArray(args))); } - function numberWithDecimals(number) { - var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - // If this is an integer, don't do anything special. - if (number === (number | 0)) { - return number; - } - // If this isn't a number (and yes, `isNaN(null)` is false), return zero. - if (isNaN(number) || number === null) { - return "0"; - } - - var localized = number.toLocaleString(); - - // If no grouping or decimal separators are available, bail out, because - // padding with zeros at the end of the string won't make sense anymore. - if (!localized.match(/[^\d]/)) { - return localized; - } - - return number.toLocaleString(undefined, { - maximumFractionDigits: decimals, - minimumFractionDigits: decimals - }); - } - module.exports = { - setBundle, getStr, getFormatStr, - numberWithDecimals + setBundle }; /***/ }, @@ -12279,7 +28971,7 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var _require = __webpack_require__(828), + var _require = __webpack_require__(65), isDevelopment = _require.isDevelopment; /** @@ -13267,7 +29959,11 @@ return /******/ (function(modules) { // webpackBootstrap setTimeout(fn, 0); } - module.exports = { reportException, executeSoon, assert }; + module.exports = { + reportException, + executeSoon, + assert + }; /***/ }, /* 223 */ @@ -13312,15 +30008,114 @@ return /******/ (function(modules) { // webpackBootstrap exports.thunk = thunk; /***/ }, -/* 225 */, +/* 225 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var onFirefoxConnect = (() => { + var _ref = _asyncToGenerator(function* (actions) { + var tabTarget = firefox.getTabTarget(); + var threadClient = firefox.getThreadClient(); + var client = firefox.clientCommands; + var newSources = actions.newSources; + + + if (!tabTarget || !threadClient) { + return; + } + + loadFromPrefs(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 client.fetchSources(); + newSources(sources); + + // If the threadClient is already paused, make sure to show a + // paused state. + var pausedPacket = threadClient.getLastPausePacket(); + if (pausedPacket) { + firefox.clientEvents.paused("paused", pausedPacket); + } + }); + + return function onFirefoxConnect(_x) { + return _ref.apply(this, arguments); + }; + })(); + + var onChromeConnect = (() => { + var _ref2 = _asyncToGenerator(function* (actions) { + loadFromPrefs(actions); + }); + + return function onChromeConnect(_x2) { + return _ref2.apply(this, arguments); + }; + })(); + + var onConnect = (() => { + var _ref3 = _asyncToGenerator(function* (connection, actions) { + // NOTE: the landing page does not connect to a JS process + if (!connection) { + return; + } + + var tab = connection.tab; + + if (tab.clientType == "firefox") { + return onFirefoxConnect(actions); + } + + return onChromeConnect(actions); + }); + + return function onConnect(_x3, _x4) { + 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__(23), + firefox = _require.firefox; + + var _require2 = __webpack_require__(226), + prefs = _require2.prefs; + + function loadFromPrefs(actions) { + var pauseOnExceptions = prefs.pauseOnExceptions, + ignoreCaughtExceptions = prefs.ignoreCaughtExceptions; + + if (pauseOnExceptions || ignoreCaughtExceptions) { + actions.pauseOnExceptions(pauseOnExceptions, ignoreCaughtExceptions); + } + } + + module.exports = { + onFirefoxConnect, + onConnect + }; + +/***/ }, /* 226 */ /***/ function(module, exports, __webpack_require__) { // @flow - var { PrefsHelper } = __webpack_require__(830); - const { Services: { pref } } = __webpack_require__(830); - const { isDevelopment } = __webpack_require__(828); + var { PrefsHelper } = __webpack_require__(26); + const { Services: { pref }} = __webpack_require__(28); + const { isDevelopment } = __webpack_require__(65); if (isDevelopment()) { pref("devtools.debugger.client-source-maps-enabled", true); @@ -13332,8 +30127,6 @@ return /******/ (function(modules) { // webpackBootstrap pref("devtools.debugger.end-panel-collapsed", false); pref("devtools.debugger.tabs", "[]"); pref("devtools.debugger.pending-selected-location", "{}"); - pref("devtools.debugger.pending-breakpoints", "[]"); - pref("devtools.debugger.expressions", "[]"); } const prefs = new PrefsHelper("devtools", { @@ -13345,9 +30138,7 @@ return /******/ (function(modules) { // webpackBootstrap startPanelCollapsed: ["Bool", "debugger.start-panel-collapsed"], endPanelCollapsed: ["Bool", "debugger.end-panel-collapsed"], tabs: ["Json", "debugger.tabs"], - pendingSelectedLocation: ["Json", "debugger.pending-selected-location"], - pendingBreakpoints: ["Json", "debugger.pending-breakpoints"], - expressions: ["Json", "debugger.expressions"] + pendingSelectedLocation: ["Json", "debugger.pending-selected-location"] }); module.exports = { prefs }; @@ -13389,31 +30180,12 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.State = undefined; - exports.update = update; - exports.getExpressions = getExpressions; - exports.getVisibleExpressions = getVisibleExpressions; - exports.getExpression = getExpression; + var constants = __webpack_require__(229); + var makeRecord = __webpack_require__(230); + var I = __webpack_require__(146); - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _makeRecord = __webpack_require__(230); - - var _makeRecord2 = _interopRequireDefault(_makeRecord); - - var _immutable = __webpack_require__(146); - - var _prefs = __webpack_require__(226); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var State = exports.State = (0, _makeRecord2.default)({ - expressions: (0, _immutable.List)(restoreExpressions()) + var State = makeRecord({ + expressions: I.List() }); function update() { @@ -13421,86 +30193,64 @@ return /******/ (function(modules) { // webpackBootstrap var action = arguments[1]; switch (action.type) { - case _constants2.default.ADD_EXPRESSION: + + case constants.ADD_EXPRESSION: return appendToList(state, ["expressions"], { input: action.input, value: null, - updating: true, - visible: action.visible + updating: true }); - case _constants2.default.UPDATE_EXPRESSION: + case constants.UPDATE_EXPRESSION: var key = action.expression.input; return updateItemInList(state, ["expressions"], key, { input: action.input, value: null, - updating: true, - visible: action.visible + updating: true }); - case _constants2.default.EVALUATE_EXPRESSION: + case constants.EVALUATE_EXPRESSION: if (action.status === "done") { return updateItemInList(state, ["expressions"], action.input, { input: action.input, value: action.value, - updating: false, - visible: action.visible + updating: false }); } break; - case _constants2.default.DELETE_EXPRESSION: + case constants.DELETE_EXPRESSION: return deleteExpression(state, action.input); } return state; } - function restoreExpressions() { - var exprs = _prefs.prefs.expressions; - if (exprs.length == 0) { - return; - } - return exprs; - } - - function storeExpressions(state) { - _prefs.prefs.expressions = state.getIn(["expressions"]).filter(e => e.visible).toJS(); - } - function appendToList(state, path, value) { - var newState = state.updateIn(path, () => { + return state.updateIn(path, () => { return state.getIn(path).push(value); }); - storeExpressions(newState); - return newState; } function updateItemInList(state, path, key, value) { - var newState = state.updateIn(path, () => { + return state.updateIn(path, () => { var list = state.getIn(path); var index = list.findIndex(e => e.input == key); return list.update(index, () => value); }); - storeExpressions(newState); - return newState; } function deleteExpression(state, input) { var index = getExpressions({ expressions: state }).findKey(e => e.input == input); - var newState = state.deleteIn(["expressions", index]); - storeExpressions(newState); - return newState; + return state.deleteIn(["expressions", index]); } function getExpressions(state) { return state.expressions.get("expressions"); } - function getVisibleExpressions(state) { - return state.expressions.get("expressions").filter(e => e.visible); - } - - function getExpression(state, input) { - return getExpressions(state).find(exp => exp.input == input); - } + module.exports = { + State, + update, + getExpressions + }; /***/ }, /* 229 */ @@ -13554,10 +30304,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.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.SET_FILE_SEARCH = "SET_FILE_SEARCH"; exports.SHOW_SOURCE = "SHOW_SOURCE"; exports.TOGGLE_PANE = "TOGGLE_PANE"; @@ -13603,25 +30350,17 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.update = update; - exports.getEventListeners = getEventListeners; + /* 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 }; } + var constants = __webpack_require__(229); var initialState = { activeEventNames: [], listeners: [], fetchingListeners: false - }; /* 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/. */ + }; function update() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; @@ -13629,11 +30368,11 @@ return /******/ (function(modules) { // webpackBootstrap var emit = arguments[2]; switch (action.type) { - case _constants2.default.UPDATE_EVENT_BREAKPOINTS: + case constants.UPDATE_EVENT_BREAKPOINTS: state.activeEventNames = action.eventNames; // emit("activeEventNames", state.activeEventNames); break; - case _constants2.default.FETCH_EVENT_LISTENERS: + case constants.FETCH_EVENT_LISTENERS: if (action.status === "begin") { state.fetchingListeners = true; } else if (action.status === "done") { @@ -13641,7 +30380,7 @@ return /******/ (function(modules) { // webpackBootstrap state.listeners = action.listeners; } break; - case _constants2.default.NAVIGATE: + case constants.NAVIGATE: return initialState; } @@ -13652,6 +30391,11 @@ return /******/ (function(modules) { // webpackBootstrap return state.eventListeners.listeners; } + module.exports = { + update, + getEventListeners + }; + /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { @@ -13914,9 +30658,7 @@ return /******/ (function(modules) { // webpackBootstrap } function getSourceText(state, id) { - if (id) { - return state.sources.sourcesText.get(id); - } + return state.sources.sourcesText.get(id); } function getSourceTabs(state) { @@ -14072,9 +30814,8 @@ return /******/ (function(modules) { // webpackBootstrap }, "text/jsx": "jsx", "text/x-elm": "elm", - "text/x-clojure": "clojure", "text/wasm": { name: "text" }, - html: { name: "htmlmixed" } + "html": { name: "htmlmixed" } }; /** @@ -14096,7 +30837,7 @@ return /******/ (function(modules) { // webpackBootstrap return contentTypeModeMap["text/typescript"]; } - if (/script|elm|jsx|clojure|wasm/.test(contentType)) { + if (/script|elm|jsx|wasm/.test(contentType)) { if (contentType in contentTypeModeMap) { return contentTypeModeMap[contentType]; } @@ -14113,6 +30854,34 @@ return /******/ (function(modules) { // webpackBootstrap return { name: "text" }; } + 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"; + } + + return "text/plain"; + } + module.exports = { isJavaScript, isPretty, @@ -14120,25 +30889,24 @@ return /******/ (function(modules) { // webpackBootstrap getRawSourceURL, getFilename, getFilenameFromURL, - getMode + getMode, + getContentType }; /***/ }, /* 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 }; } - 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/. */ + /** * Utils for utils, by utils * @module utils/utils @@ -14184,6 +30952,41 @@ return /******/ (function(modules) { // webpackBootstrap return str; } + var msgId = 1; + /** + * @memberof utils/utils + * @static + */ + function workerTask(worker, method) { + return function () { + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + 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); + }); + }; + } + /** * @memberof utils/utils * @static @@ -14200,8 +31003,8 @@ return /******/ (function(modules) { // webpackBootstrap var timeout = void 0, _this = void 0; return function () { - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; } _this = this; @@ -14218,26 +31021,14 @@ 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, + workerTask, updateObj, throttle, - waitForMs, - filterDuplicates + waitForMs }; /***/ }, @@ -14268,11 +31059,7 @@ return /******/ (function(modules) { // webpackBootstrap } module.exports = { - basename, - dirname, - isURL, - isAbsolute, - join + basename, dirname, isURL, isAbsolute, join }; /***/ }, @@ -14298,12 +31085,8 @@ return /******/ (function(modules) { // webpackBootstrap 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 }); @@ -14341,18 +31124,73 @@ return /******/ (function(modules) { // webpackBootstrap switch (action.type) { case "ADD_BREAKPOINT": { - var newState = addBreakpoint(state, action); - if (newState) { - setPendingBreakpoints(newState); + var id = makeLocationId(action.breakpoint.location); + + if (action.status === "start") { + var bp = state.breakpoints.get(id) || action.breakpoint; + + return state.setIn(["breakpoints", id], updateObj(bp, { + disabled: false, + loading: true, + // We want to do an OR here, but we can't because we need + // empty strings to be truthy, i.e. an empty string is a valid + // condition. + condition: firstString(action.condition, bp.condition) + })).set("breakpointsDisabled", false); + } else if (action.status === "done") { + var _action$value = action.value, + breakpointId = _action$value.id, + text = _action$value.text; + + var location = action.breakpoint.location; + var actualLocation = action.value.actualLocation; + + // If the breakpoint moved, update the map + + if (locationMoved(location, actualLocation)) { + state = state.deleteIn(["breakpoints", id]); + + var movedId = makeLocationId(actualLocation); + var currentBp = state.breakpoints.get(movedId) || fromJS(action.breakpoint); + var newBp = updateObj(currentBp, { location: actualLocation }); + state = state.setIn(["breakpoints", movedId], newBp); + location = actualLocation; + } + + var locationId = makeLocationId(location); + var _bp = state.breakpoints.get(locationId); + return state.setIn(["breakpoints", locationId], updateObj(_bp, { + id: breakpointId, + disabled: false, + loading: false, + text: text + })); + } else if (action.status === "error") { + // Remove the optimistic update + return state.deleteIn(["breakpoints", id]); } - return newState; + break; } case "REMOVE_BREAKPOINT": { - var _newState = removeBreakpoint(state, action); - setPendingBreakpoints(_newState); - return _newState; + if (action.status === "done") { + var _id = makeLocationId(action.breakpoint.location); + + if (action.disabled) { + var _bp2 = state.breakpoints.get(_id); + var _updatedState = state.setIn(["breakpoints", _id], updateObj(_bp2, { + loading: false, disabled: true + })); + + return _updatedState.set("breakpointsDisabled", allBreakpointsDisabled(_updatedState)); + } + + var updatedState = state.deleteIn(["breakpoints", _id]); + + return updatedState.set("breakpointsDisabled", allBreakpointsDisabled(updatedState)); + } + break; } case "TOGGLE_BREAKPOINTS": @@ -14365,22 +31203,22 @@ return /******/ (function(modules) { // webpackBootstrap case "SET_BREAKPOINT_CONDITION": { - var id = makeLocationId(action.breakpoint.location); + var _id2 = makeLocationId(action.breakpoint.location); if (action.status === "start") { - var bp = state.breakpoints.get(id); - return state.setIn(["breakpoints", id], updateObj(bp, { + var _bp3 = state.breakpoints.get(_id2); + return state.setIn(["breakpoints", _id2], updateObj(_bp3, { loading: true, condition: action.condition })); } else if (action.status === "done") { - var _bp = state.breakpoints.get(id); - return state.setIn(["breakpoints", id], updateObj(_bp, { + var _bp4 = state.breakpoints.get(_id2); + return state.setIn(["breakpoints", _id2], updateObj(_bp4, { id: action.value.id, loading: false })); } else if (action.status === "error") { - return state.deleteIn(["breakpoints", id]); + return state.deleteIn(["breakpoints", _id2]); } break; @@ -14390,104 +31228,6 @@ return /******/ (function(modules) { // webpackBootstrap return state; } - function addBreakpoint(state, action) { - var id = makeLocationId(action.breakpoint.location); - - if (action.status === "start") { - var bp = state.breakpoints.get(id) || action.breakpoint; - - return state.setIn(["breakpoints", id], updateObj(bp, { - disabled: false, - loading: true, - // We want to do an OR here, but we can't because we need - // empty strings to be truthy, i.e. an empty string is a valid - // condition. - condition: firstString(action.condition, bp.condition) - })).set("breakpointsDisabled", false); - } - - if (action.status === "done") { - var _action$value = action.value, - breakpointId = _action$value.id, - text = _action$value.text; - - var location = action.breakpoint.location; - var actualLocation = action.value.actualLocation; - - // If the breakpoint moved, update the map - - if (locationMoved(location, actualLocation)) { - state = state.deleteIn(["breakpoints", id]); - - var movedId = makeLocationId(actualLocation); - var currentBp = state.breakpoints.get(movedId) || fromJS(action.breakpoint); - var newBp = 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, { - id: breakpointId, - disabled: false, - loading: false, - text: text - })); - } - - if (action.status === "error") { - // Remove the optimistic update - return state.deleteIn(["breakpoints", id]); - } - } - - function removeBreakpoint(state, action) { - if (action.status === "done") { - var id = makeLocationId(action.breakpoint.location); - - if (action.disabled) { - var bp = state.breakpoints.get(id); - var _updatedState = state.setIn(["breakpoints", id], updateObj(bp, { - loading: false, - disabled: true - })); - - return _updatedState.set("breakpointsDisabled", allBreakpointsDisabled(_updatedState)); - } - - var updatedState = state.deleteIn(["breakpoints", id]); - - return updatedState.set("breakpointsDisabled", allBreakpointsDisabled(updatedState)); - } - - return state; - } - - function makePendingBreakpoint(bp) { - var _bp$location = bp.location, - sourceUrl = _bp$location.sourceUrl, - line = _bp$location.line, - condition = bp.condition, - disabled = bp.disabled; - - - var location = { sourceUrl, line }; - return { condition, disabled, location }; - } - - function filterByNotLoading(bp) { - return !bp.loading; - } - - function setPendingBreakpoints(state) { - prefs.pendingBreakpoints = Object.values(state.get("breakpoints").toJS()).filter(filterByNotLoading).map(makePendingBreakpoint); - } - - function restorePendingBreakpoints() { - return prefs.pendingBreakpoints; - } - // Selectors function getBreakpoint(state, location) { @@ -14515,10 +31255,6 @@ return /******/ (function(modules) { // webpackBootstrap return breakpoints.size > 0 && isLoading; } - function getPendingBreakpoints(state) { - return state.breakpoints.pendingBreakpoints; - } - module.exports = { State, update, @@ -14527,8 +31263,7 @@ return /******/ (function(modules) { // webpackBootstrap getBreakpoints, getBreakpointsForSource, getBreakpointsDisabled, - getBreakpointsLoading, - getPendingBreakpoints + getBreakpointsLoading }; /***/ }, @@ -14553,7 +31288,7 @@ return /******/ (function(modules) { // webpackBootstrap length confuses Immutable's internal algorithm. */ function createMap(value) { - var hasLength = value.hasOwnProperty && value.hasOwnProperty("length"); + var hasLength = value.hasOwnProperty("length"); var length = value.length; if (hasLength) { @@ -14587,7 +31322,7 @@ return /******/ (function(modules) { // webpackBootstrap if (Array.isArray(value)) { return createList(value); } - if (value && value.constructor && value.constructor.meta) { + if (value && value.constructor.meta) { // This adds support for tcomb objects which are native JS objects // but are not "plain", so the above checks fail. Since they // behave the same we can use the same constructors, but we need @@ -14681,8 +31416,7 @@ return /******/ (function(modules) { // webpackBootstrap selectedFrameId: undefined, loadedObjects: I.Map(), shouldPauseOnExceptions: prefs.pauseOnExceptions, - shouldIgnoreCaughtExceptions: prefs.ignoreCaughtExceptions, - debuggeeUrl: "" + shouldIgnoreCaughtExceptions: prefs.ignoreCaughtExceptions }); function update() { @@ -14754,16 +31488,12 @@ return /******/ (function(modules) { // webpackBootstrap var ownSymbols = action.value.ownSymbols || []; var prototype = action.value.prototype; - return state.setIn(["loadedObjects", action.objectId], { - ownProperties, - prototype, - ownSymbols - }); + return state.setIn(["loadedObjects", action.objectId], { ownProperties, prototype, ownSymbols }); } break; case constants.NAVIGATE: - return State().set("debuggeeUrl", action.url); + return State(); case constants.PAUSE_ON_EXCEPTIONS: var _shouldPauseOnExceptions = action.shouldPauseOnExceptions, @@ -14835,10 +31565,6 @@ return /******/ (function(modules) { // webpackBootstrap return frames.find(frame => frame.get("id") == selectedFrameId).toJS(); } - function getDebuggeeUrl(state) { - return state.pause.get("debuggeeUrl"); - } - // NOTE: currently only used for chrome function getChromeScopes(state) { var frame = getSelectedFrame(state); @@ -14857,8 +31583,7 @@ return /******/ (function(modules) { // webpackBootstrap getShouldPauseOnExceptions, getShouldIgnoreCaughtExceptions, getFrames, - getSelectedFrame, - getDebuggeeUrl + getSelectedFrame }; /***/ }, @@ -14879,14 +31604,7 @@ return /******/ (function(modules) { // webpackBootstrap prefs = _require.prefs; var State = makeRecord({ - fileSearchOn: false, - fileSearchQuery: "", - fileSearchModifiers: makeRecord({ - caseSensitive: true, - wholeWord: false, - regexMatch: false - })(), - projectSearchOn: false, + searchOn: false, shownSource: "", startPanelCollapsed: prefs.startPanelCollapsed, endPanelCollapsed: prefs.endPanelCollapsed @@ -14897,24 +31615,9 @@ return /******/ (function(modules) { // webpackBootstrap var action = arguments[1]; switch (action.type) { - case constants.TOGGLE_PROJECT_SEARCH: + case constants.SET_FILE_SEARCH: { - return state.set("projectSearchOn", action.value); - } - - case constants.TOGGLE_FILE_SEARCH: - { - return state.set("fileSearchOn", action.value); - } - - case constants.UPDATE_FILE_SEARCH_QUERY: - { - return state.set("fileSearchQuery", action.query); - } - - case constants.TOGGLE_FILE_SEARCH_MODIFIER: - { - return state.setIn(["fileSearchModifiers", action.modifier], !state.getIn(["fileSearchModifiers", action.modifier])); + return state.set("searchOn", action.searchOn); } case constants.SHOW_SOURCE: @@ -14943,21 +31646,11 @@ 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 getSearchState(field, state) { - return state.ui.get(field); - } - function getFileSearchQueryState(state) { - return state.ui.get("fileSearchQuery"); + function getFileSearchState(state) { + return state.ui.get("searchOn"); } - function getFileSearchModifierState(state) { - return state.ui.get("fileSearchModifiers"); - } - - var getProjectSearchState = getSearchState.bind(null, "projectSearchOn"); - var getFileSearchState = getSearchState.bind(null, "fileSearchOn"); - function getShownSource(state) { return state.ui.get("shownSource"); } @@ -14973,10 +31666,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = { State, update, - getProjectSearchState, getFileSearchState, - getFileSearchQueryState, - getFileSearchModifierState, getShownSource, getPaneCollapse }; @@ -15069,7 +31759,6 @@ return /******/ (function(modules) { // webpackBootstrap getBreakpoint: breakpoints.getBreakpoint, getBreakpoints: breakpoints.getBreakpoints, - getPendingBreakpoints: breakpoints.getPendingBreakpoints, getBreakpointsForSource: breakpoints.getBreakpointsForSource, getBreakpointsDisabled: breakpoints.getBreakpointsDisabled, getBreakpointsLoading: breakpoints.getBreakpointsLoading, @@ -15084,23 +31773,17 @@ return /******/ (function(modules) { // webpackBootstrap getShouldIgnoreCaughtExceptions: pause.getShouldIgnoreCaughtExceptions, getFrames: pause.getFrames, getSelectedFrame: pause.getSelectedFrame, - getDebuggeeUrl: pause.getDebuggeeUrl, getHitCountForSource: coverage.getHitCountForSource, getCoverageEnabled: coverage.getCoverageEnabled, getEventListeners: eventListeners.getEventListeners, - getProjectSearchState: ui.getProjectSearchState, getFileSearchState: ui.getFileSearchState, - getFileSearchQueryState: ui.getFileSearchQueryState, - getFileSearchModifierState: ui.getFileSearchModifierState, getShownSource: ui.getShownSource, getPaneCollapse: ui.getPaneCollapse, - getExpressions: expressions.getExpressions, - getVisibleExpressions: expressions.getVisibleExpressions, - getExpression: expressions.getExpression + getExpressions: expressions.getExpressions }; /***/ }, @@ -15109,93 +31792,94 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; - var _react = __webpack_require__(2); + var _require = __webpack_require__(151), + connect = _require.connect; - var _reactRedux = __webpack_require__(151); + var _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; - var _redux = __webpack_require__(3); + var actions = __webpack_require__(244); - var _actions = __webpack_require__(244); + var _require3 = __webpack_require__(242), + getSources = _require3.getSources, + getSelectedSource = _require3.getSelectedSource, + getPaneCollapse = _require3.getPaneCollapse; - var _actions2 = _interopRequireDefault(_actions); + var _require4 = __webpack_require__(26), + KeyShortcuts = _require4.KeyShortcuts; - var _selectors = __webpack_require__(242); - - var _devtoolsModules = __webpack_require__(830); - - __webpack_require__(323); - - __webpack_require__(325); - - __webpack_require__(327); - - __webpack_require__(331); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var shortcuts = new _devtoolsModules.KeyShortcuts({ window }); + var shortcuts = new 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)); + __webpack_require__(323); + __webpack_require__(325); + __webpack_require__(327); + __webpack_require__(329); + __webpack_require__(331); - class App extends _react.Component { + var _require5 = __webpack_require__(28), + SplitBox = _require5.SplitBox; - constructor(props) { - super(props); - this.state = { - horizontal: verticalLayoutBreakpoint.matches, - startPanelSize: 0, - endPanelSize: 0 - }; + SplitBox = createFactory(SplitBox); - this.getChildContext = this.getChildContext.bind(this); - this.onLayoutChange = this.onLayoutChange.bind(this); - this.renderEditorPane = this.renderEditorPane.bind(this); - this.renderVerticalLayout = this.renderVerticalLayout.bind(this); - } + var SourceSearch = createFactory(__webpack_require__(333)); + var Sources = createFactory(__webpack_require__(388)); + var Editor = createFactory(__webpack_require__(426)); + var SecondaryPanes = createFactory(__webpack_require__(718)); + var WelcomeBox = createFactory(__webpack_require__(747)); + var EditorTabs = createFactory(__webpack_require__(750)); + + var App = React.createClass({ + propTypes: { + sources: PropTypes.object, + selectSource: PropTypes.func, + selectedSource: PropTypes.object, + startPanelCollapsed: PropTypes.bool, + endPanelCollapsed: PropTypes.bool + }, + + displayName: "App", getChildContext() { return { shortcuts }; - } + }, componentDidMount() { verticalLayoutBreakpoint.addListener(this.onLayoutChange); - } + }, componentWillUnmount() { verticalLayoutBreakpoint.removeListener(this.onLayoutChange); - } + }, + + getInitialState() { + return { horizontal: verticalLayoutBreakpoint.matches }; + }, onLayoutChange() { - this.setState({ horizontal: verticalLayoutBreakpoint.matches }); - } + this.setState({ + horizontal: verticalLayoutBreakpoint.matches + }); + }, renderEditorPane() { var _props = this.props, startPanelCollapsed = _props.startPanelCollapsed, endPanelCollapsed = _props.endPanelCollapsed; - var _state = this.state, - horizontal = _state.horizontal, - endPanelSize = _state.endPanelSize; + var horizontal = this.state.horizontal; - return _react.DOM.div({ className: "editor-pane" }, _react.DOM.div({ className: "editor-container" }, EditorTabs({ + return dom.div({ className: "editor-pane" }, dom.div({ className: "editor-container" }, EditorTabs({ startPanelCollapsed, endPanelCollapsed, - horizontal, - endPanelSize - }), Editor({ horizontal }), !this.props.selectedSource ? WelcomeBox({ horizontal }) : null, ProjectSearch())); - } + horizontal + }), Editor({ horizontal }), !this.props.selectedSource ? WelcomeBox({ horizontal }) : null, SourceSearch())); + }, renderHorizontalLayout() { var _props2 = this.props, @@ -15207,13 +31891,12 @@ return /******/ (function(modules) { // webpackBootstrap var overflowX = endPanelCollapsed ? "hidden" : "auto"; - return _react.DOM.div({ className: "debugger" }, SplitBox({ + return dom.div({ className: "debugger" }, SplitBox({ style: { width: "100vw" }, initialSize: "250px", minSize: 10, maxSize: "50%", splitterSize: 1, - onResizeEnd: size => this.setState({ startPanelSize: size }), startPanel: Sources({ sources, horizontal }), startPanelCollapsed, endPanel: SplitBox({ @@ -15222,7 +31905,6 @@ return /******/ (function(modules) { // webpackBootstrap minSize: 10, maxSize: "80%", splitterSize: 1, - onResizeEnd: size => this.setState({ endPanelSize: size }), endPanelControl: true, startPanel: this.renderEditorPane(), endPanel: SecondaryPanes({ horizontal }), @@ -15230,7 +31912,7 @@ return /******/ (function(modules) { // webpackBootstrap vert: horizontal }) })); - } + }, renderVerticalLayout() { var _props3 = this.props, @@ -15240,7 +31922,7 @@ return /******/ (function(modules) { // webpackBootstrap var horizontal = this.state.horizontal; - return _react.DOM.div({ className: "debugger" }, SplitBox({ + return dom.div({ className: "debugger" }, SplitBox({ style: { width: "100vw" }, initialSize: "300px", minSize: 30, @@ -15260,31 +31942,22 @@ return /******/ (function(modules) { // webpackBootstrap endPanel: SecondaryPanes({ horizontal }), endPanelCollapsed })); - } + }, render() { return this.state.horizontal ? this.renderHorizontalLayout() : this.renderVerticalLayout(); } - } + }); - App.propTypes = { - sources: _react.PropTypes.object, - selectSource: _react.PropTypes.func, - selectedSource: _react.PropTypes.object, - startPanelCollapsed: _react.PropTypes.bool, - endPanelCollapsed: _react.PropTypes.bool + App.childContextTypes = { + shortcuts: PropTypes.object }; - App.displayName = "App"; - - 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") - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(App); + module.exports = connect(state => ({ sources: getSources(state), + selectedSource: getSelectedSource(state), + startPanelCollapsed: getPaneCollapse(state, "start"), + endPanelCollapsed: getPaneCollapse(state, "end") + }), dispatch => bindActionCreators(actions, dispatch))(App); /***/ }, /* 244 */ @@ -15292,45 +31965,16 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var breakpoints = __webpack_require__(245); + var expressions = __webpack_require__(252); + var eventListeners = __webpack_require__(253); + var sources = __webpack_require__(254); + var pause = __webpack_require__(319); + var navigation = __webpack_require__(320); + var ui = __webpack_require__(321); + var coverage = __webpack_require__(322); - var _breakpoints = __webpack_require__(245); - - var breakpoints = _interopRequireWildcard(_breakpoints); - - var _expressions = __webpack_require__(252); - - var expressions = _interopRequireWildcard(_expressions); - - var _eventListeners = __webpack_require__(253); - - var eventListeners = _interopRequireWildcard(_eventListeners); - - var _sources = __webpack_require__(254); - - var sources = _interopRequireWildcard(_sources); - - var _pause = __webpack_require__(319); - - var pause = _interopRequireWildcard(_pause); - - var _navigation = __webpack_require__(320); - - var navigation = _interopRequireWildcard(_navigation); - - var _ui = __webpack_require__(321); - - var ui = _interopRequireWildcard(_ui); - - var _coverage = __webpack_require__(322); - - var coverage = _interopRequireWildcard(_coverage); - - 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; } } - - exports.default = Object.assign(navigation, breakpoints, expressions, eventListeners, sources, pause, ui, coverage); + module.exports = Object.assign(navigation, breakpoints, expressions, eventListeners, sources, pause, ui, coverage); /***/ }, /* 245 */ @@ -15338,30 +31982,10 @@ return /******/ (function(modules) { // webpackBootstrap "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"); } }; }(); - exports.enableBreakpoint = enableBreakpoint; - exports.addBreakpoint = addBreakpoint; - exports.disableBreakpoint = disableBreakpoint; - exports.removeBreakpoint = removeBreakpoint; - exports.toggleAllBreakpoints = toggleAllBreakpoints; - exports.setBreakpointCondition = setBreakpointCondition; - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _promise = __webpack_require__(193); - - var _selectors = __webpack_require__(242); - - 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"); }); }; } + /* 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/. */ @@ -15371,13 +31995,28 @@ return /******/ (function(modules) { // webpackBootstrap * @module actions/breakpoints */ + var constants = __webpack_require__(229); + + var _require = __webpack_require__(193), + PROMISE = _require.PROMISE; + + var _require2 = __webpack_require__(242), + getBreakpoint = _require2.getBreakpoint, + getBreakpoints = _require2.getBreakpoints, + getSource = _require2.getSource; + + var _require3 = __webpack_require__(246), + getOriginalLocation = _require3.getOriginalLocation, + getGeneratedLocation = _require3.getGeneratedLocation, + isOriginalId = _require3.isOriginalId; + function _breakpointExists(state, location) { - var currentBp = (0, _selectors.getBreakpoint)(state, location); + var currentBp = getBreakpoint(state, location); return currentBp && !currentBp.disabled; } function _getOrCreateBreakpoint(state, location, condition) { - return (0, _selectors.getBreakpoint)(state, location) || { location, condition, text: "" }; + return getBreakpoint(state, location) || { location, condition, text: "" }; } /** @@ -15407,8 +32046,7 @@ return /******/ (function(modules) { // webpackBootstrap return (_ref2) => { var dispatch = _ref2.dispatch, getState = _ref2.getState, - client = _ref2.client, - sourceMaps = _ref2.sourceMaps; + client = _ref2.client; if (_breakpointExists(getState(), location)) { return Promise.resolve(); @@ -15417,21 +32055,21 @@ return /******/ (function(modules) { // webpackBootstrap var bp = _getOrCreateBreakpoint(getState(), location, condition); return dispatch({ - type: _constants2.default.ADD_BREAKPOINT, + type: constants.ADD_BREAKPOINT, breakpoint: bp, condition: condition, - [_promise.PROMISE]: _asyncToGenerator(function* () { - if (sourceMaps.isOriginalId(bp.location.sourceId)) { - var source = (0, _selectors.getSource)(getState(), bp.location.sourceId); - location = yield sourceMaps.getGeneratedLocation(bp.location, source.toJS()); + [PROMISE]: _asyncToGenerator(function* () { + if (isOriginalId(bp.location.sourceId)) { + var source = getSource(getState(), bp.location.sourceId); + location = yield getGeneratedLocation(bp.location, source.toJS()); } - var _ref4 = yield client.setBreakpoint(location, bp.condition, sourceMaps.isOriginalId(bp.location.sourceId)), + var _ref4 = yield client.setBreakpoint(location, bp.condition, isOriginalId(bp.location.sourceId)), id = _ref4.id, actualLocation = _ref4.actualLocation, hitCount = _ref4.hitCount; - actualLocation = yield sourceMaps.getOriginalLocation(actualLocation); + actualLocation = yield getOriginalLocation(actualLocation); // If this breakpoint is being re-enabled, it already has a // text snippet. @@ -15472,7 +32110,7 @@ return /******/ (function(modules) { // webpackBootstrap getState = _ref5.getState, client = _ref5.client; - var bp = (0, _selectors.getBreakpoint)(getState(), location); + var bp = getBreakpoint(getState(), location); if (!bp) { throw new Error("attempt to remove breakpoint that does not exist"); } @@ -15483,7 +32121,7 @@ return /******/ (function(modules) { // webpackBootstrap } var action = { - type: _constants2.default.REMOVE_BREAKPOINT, + type: constants.REMOVE_BREAKPOINT, breakpoint: bp, disabled: isDisabled }; @@ -15494,7 +32132,7 @@ return /******/ (function(modules) { // webpackBootstrap // will be removed completely from the state. if (!bp.disabled) { return dispatch(Object.assign({}, action, { - [_promise.PROMISE]: client.removeBreakpoint(bp.id) + [PROMISE]: client.removeBreakpoint(bp.id) })); } return dispatch(Object.assign({}, action, { status: "done" })); @@ -15512,11 +32150,11 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref6.dispatch, getState = _ref6.getState; - var breakpoints = (0, _selectors.getBreakpoints)(getState()); + var breakpoints = getBreakpoints(getState()); return dispatch({ - type: _constants2.default.TOGGLE_BREAKPOINTS, + type: constants.TOGGLE_BREAKPOINTS, shouldDisableBreakpoints, - [_promise.PROMISE]: _asyncToGenerator(function* () { + [PROMISE]: _asyncToGenerator(function* () { for (var _ref8 of breakpoints) { var _ref9 = _slicedToArray(_ref8, 2); @@ -15553,10 +32191,9 @@ return /******/ (function(modules) { // webpackBootstrap return (_ref11) => { var dispatch = _ref11.dispatch, getState = _ref11.getState, - client = _ref11.client, - sourceMaps = _ref11.sourceMaps; + client = _ref11.client; - var bp = (0, _selectors.getBreakpoint)(getState(), location); + var bp = getBreakpoint(getState(), location); if (!bp) { return dispatch(addBreakpoint(location, { condition, getTextForLine })); } @@ -15568,17 +32205,136 @@ return /******/ (function(modules) { // webpackBootstrap } return dispatch({ - type: _constants2.default.SET_BREAKPOINT_CONDITION, + type: constants.SET_BREAKPOINT_CONDITION, breakpoint: bp, condition: condition, - [_promise.PROMISE]: client.setBreakpointCondition(bp.id, location, condition, sourceMaps.isOriginalId(bp.location.sourceId)) + [PROMISE]: client.setBreakpointCondition(bp.id, location, condition, isOriginalId(bp.location.sourceId)) }); }; } + module.exports = { + enableBreakpoint, + addBreakpoint, + disableBreakpoint, + removeBreakpoint, + toggleAllBreakpoints, + setBreakpointCondition + }; + +/***/ }, +/* 246 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var hasMappedSource = (() => { + var _ref = _asyncToGenerator(function* (location) { + if (isOriginalId(location.sourceId)) { + return true; + } + + var loc = yield getOriginalLocation(location); + return loc.sourceId !== location.sourceId; + }); + + return function hasMappedSource(_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__(65), + getValue = _require.getValue; + + var _require2 = __webpack_require__(234), + workerTask = _require2.workerTask; + + var _require3 = __webpack_require__(247), + originalToGeneratedId = _require3.originalToGeneratedId, + generatedToOriginalId = _require3.generatedToOriginalId, + isGeneratedId = _require3.isGeneratedId, + isOriginalId = _require3.isOriginalId; + + var _require4 = __webpack_require__(226), + prefs = _require4.prefs; + + var sourceMapWorker = void 0; + function restartWorker() { + if (sourceMapWorker) { + sourceMapWorker.terminate(); + } + sourceMapWorker = new Worker(`${getValue("baseWorkerURL")}source-map-worker.js`); + + sourceMapWorker.postMessage({ id: 0, method: "enableSourceMaps" }); + } + restartWorker(); + + function destroyWorker() { + if (sourceMapWorker) { + sourceMapWorker.terminate(); + sourceMapWorker = null; + } + } + + function shouldSourceMap() { + return prefs.clientSourceMapsEnabled; + } + + var getOriginalURLs = workerTask(sourceMapWorker, "getOriginalURLs"); + var getGeneratedLocation = workerTask(sourceMapWorker, "getGeneratedLocation"); + var getOriginalLocation = workerTask(sourceMapWorker, "getOriginalLocation"); + var getOriginalSourceText = workerTask(sourceMapWorker, "getOriginalSourceText"); + var applySourceMap = workerTask(sourceMapWorker, "applySourceMap"); + var clearSourceMaps = workerTask(sourceMapWorker, "clearSourceMaps"); + + module.exports = { + originalToGeneratedId, + generatedToOriginalId, + isGeneratedId, + isOriginalId, + hasMappedSource, + getOriginalURLs, + getGeneratedLocation, + getOriginalLocation, + getOriginalSourceText, + applySourceMap, + clearSourceMaps, + destroyWorker, + shouldSourceMap + }; + +/***/ }, +/* 247 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var md5 = __webpack_require__(248); + + function originalToGeneratedId(originalId) { + var 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); + } + + module.exports = { + originalToGeneratedId, generatedToOriginalId, isOriginalId, isGeneratedId + }; + /***/ }, -/* 246 */, -/* 247 */, /* 248 */ /***/ function(module, exports, __webpack_require__) { @@ -15918,26 +32674,17 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.addExpression = addExpression; - exports.updateExpression = updateExpression; - exports.deleteExpression = deleteExpression; - exports.evaluateExpressions = evaluateExpressions; - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _promise = __webpack_require__(193); - - var _selectors = __webpack_require__(242); - - 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 constants = __webpack_require__(229); + + var _require = __webpack_require__(193), + PROMISE = _require.PROMISE; + + var _require2 = __webpack_require__(242), + getExpressions = _require2.getExpressions, + getSelectedFrame = _require2.getSelectedFrame; + function expressionExists(expressions, input) { return !!expressions.find(e => e.input == input); } @@ -15951,59 +32698,42 @@ return /******/ (function(modules) { // webpackBootstrap * @static */ function addExpression(input) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$visible = _ref.visible, - visible = _ref$visible === undefined ? true : _ref$visible; + return (_ref) => { + var dispatch = _ref.dispatch, + getState = _ref.getState; - return (() => { - var _ref2 = _asyncToGenerator(function* (_ref3) { - var dispatch = _ref3.dispatch, - getState = _ref3.getState; + var expressions = getExpressions(getState()); + if (!input || expressionExists(expressions, input)) { + return; + } - var expressions = (0, _selectors.getExpressions)(getState()); - if (!input || expressionExists(expressions, input)) { - var expression = (0, _selectors.getExpression)(getState(), input); - if (!expression.visible && visible) { - yield dispatch(deleteExpression(expression)); - } else { - return; - } - } - - dispatch({ - type: _constants2.default.ADD_EXPRESSION, - input, - visible - }); - - var selectedFrame = (0, _selectors.getSelectedFrame)(getState()); - var selectedFrameId = selectedFrame ? selectedFrame.id : null; - dispatch(evaluateExpression({ input, visible }, selectedFrameId)); + dispatch({ + type: constants.ADD_EXPRESSION, + input }); - return function (_x2) { - return _ref2.apply(this, arguments); - }; - })(); + var selectedFrame = getSelectedFrame(getState()); + var selectedFrameId = selectedFrame ? selectedFrame.id : null; + dispatch(evaluateExpression({ input }, selectedFrameId)); + }; } function updateExpression(input, expression) { - return (_ref4) => { - var dispatch = _ref4.dispatch, - getState = _ref4.getState; + return (_ref2) => { + var dispatch = _ref2.dispatch, + getState = _ref2.getState; if (!input || input == expression.input) { return; } dispatch({ - type: _constants2.default.UPDATE_EXPRESSION, + type: constants.UPDATE_EXPRESSION, expression, - input: input, - visible: expression.visible + input: input }); - var selectedFrame = (0, _selectors.getSelectedFrame)(getState()); + var selectedFrame = getSelectedFrame(getState()); var selectedFrameId = selectedFrame ? selectedFrame.id : null; dispatch(evaluateExpressions(selectedFrameId)); }; @@ -16017,11 +32747,11 @@ return /******/ (function(modules) { // webpackBootstrap * @static */ function deleteExpression(expression) { - return (_ref5) => { - var dispatch = _ref5.dispatch; + return (_ref3) => { + var dispatch = _ref3.dispatch; dispatch({ - type: _constants2.default.DELETE_EXPRESSION, + type: constants.DELETE_EXPRESSION, input: expression.input }); }; @@ -16035,32 +32765,27 @@ return /******/ (function(modules) { // webpackBootstrap */ function evaluateExpressions(frameId) { return (() => { - var _ref6 = _asyncToGenerator(function* (_ref7) { - var dispatch = _ref7.dispatch, - getState = _ref7.getState, - client = _ref7.client; + var _ref4 = _asyncToGenerator(function* (_ref5) { + var dispatch = _ref5.dispatch, + getState = _ref5.getState, + client = _ref5.client; - var expressions = (0, _selectors.getExpressions)(getState()).toJS(); - if (!frameId) { - var selectedFrame = (0, _selectors.getSelectedFrame)(getState()); - frameId = selectedFrame ? selectedFrame.id : null; - } - for (var expression of expressions) { + for (var expression of getExpressions(getState())) { yield dispatch(evaluateExpression(expression, frameId)); } }); - return function (_x3) { - return _ref6.apply(this, arguments); + return function (_x) { + return _ref4.apply(this, arguments); }; })(); } function evaluateExpression(expression, frameId) { - return function (_ref8) { - var dispatch = _ref8.dispatch, - getState = _ref8.getState, - client = _ref8.client; + return function (_ref6) { + var dispatch = _ref6.dispatch, + getState = _ref6.getState, + client = _ref6.client; if (!expression.input) { console.warn("Expressions should not be empty"); @@ -16068,31 +32793,33 @@ return /******/ (function(modules) { // webpackBootstrap } return dispatch({ - type: _constants2.default.EVALUATE_EXPRESSION, + type: constants.EVALUATE_EXPRESSION, input: expression.input, - visible: expression.visible, - [_promise.PROMISE]: client.evaluate(expression.input, { frameId }) + [PROMISE]: client.evaluate(expression.input, { frameId }) }); }; } + module.exports = { + addExpression, + updateExpression, + deleteExpression, + evaluateExpressions + }; + /***/ }, /* 253 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** * @memberof utils/utils * @static */ var asPaused = (() => { var _ref = _asyncToGenerator(function* (state, client, func) { - if (!(0, _selectors.getPause)(state)) { + if (!getPause(state)) { yield client.interrupt(); var result = void 0; @@ -16172,7 +32899,7 @@ return /******/ (function(modules) { // webpackBootstrap response = yield grip.getDefinitionSite(); } catch (e) { // Don't make this error fatal, it would break the entire events pane. - (0, _DevToolsUtils.reportException)("_getDefinitionSite", e); + reportException("_getDefinitionSite", e); return null; } @@ -16191,22 +32918,11 @@ return /******/ (function(modules) { // webpackBootstrap */ - exports.fetchEventListeners = fetchEventListeners; - exports.updateEventBreakpoints = updateEventBreakpoints; + 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 _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _DevToolsUtils = __webpack_require__(222); - - var _selectors = __webpack_require__(242); - - 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"); }); }; } /* 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/. */ + /* 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 gThreadClient setNamedTimeout services EVENTS */ /* eslint no-shadow: 0 */ @@ -16215,7 +32931,18 @@ return /******/ (function(modules) { // webpackBootstrap * @module actions/event-listeners */ + var constants = __webpack_require__(229); + + var _require = __webpack_require__(222), + reportException = _require.reportException; + + var _require2 = __webpack_require__(242), + getPause = _require2.getPause, + getSourceByURL = _require2.getSourceByURL; + // delay is in ms + + var FETCH_EVENT_LISTENERS_DELAY = 200; var fetchListenersTimerID = void 0;function fetchEventListeners() { return (_ref2) => { @@ -16236,20 +32963,20 @@ return /******/ (function(modules) { // webpackBootstrap if (getState().eventListeners.fetchingListeners) { dispatch({ type: services.WAIT_UNTIL, - predicate: action => action.type === _constants2.default.FETCH_EVENT_LISTENERS && action.status === "done", + predicate: action => action.type === constants.FETCH_EVENT_LISTENERS && action.status === "done", run: dispatch => dispatch(fetchEventListeners()) }); return; } dispatch({ - type: _constants2.default.FETCH_EVENT_LISTENERS, + type: constants.FETCH_EVENT_LISTENERS, status: "begin" }); asPaused(getState(), client, _getEventListeners).then(listeners => { dispatch({ - type: _constants2.default.FETCH_EVENT_LISTENERS, + type: constants.FETCH_EVENT_LISTENERS, status: "done", listeners: formatListeners(getState(), listeners) }); @@ -16263,7 +32990,7 @@ return /******/ (function(modules) { // webpackBootstrap return { selector: l.node.selector, type: l.type, - sourceId: (0, _selectors.getSourceByURL)(state, l.function.location.url).get("id"), + sourceId: getSourceByURL(state, l.function.location.url).get("id"), line: l.function.location.line }; }); @@ -16277,7 +33004,7 @@ return /******/ (function(modules) { // webpackBootstrap window.emit(EVENTS.EVENT_BREAKPOINTS_UPDATED); dispatch({ - type: _constants2.default.UPDATE_EVENT_BREAKPOINTS, + type: constants.UPDATE_EVENT_BREAKPOINTS, eventNames: eventNames }); }); @@ -16285,60 +33012,16 @@ return /******/ (function(modules) { // webpackBootstrap }; } + module.exports = { updateEventBreakpoints, fetchEventListeners }; + /***/ }, /* 254 */ /***/ 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"); } }; }(); - exports.newSource = newSource; - exports.newSources = newSources; - exports.selectSourceURL = selectSourceURL; - exports.selectSource = selectSource; - exports.jumpToMappedLocation = jumpToMappedLocation; - exports.closeTab = closeTab; - exports.closeTabs = closeTabs; - exports.togglePrettyPrint = togglePrettyPrint; - exports.toggleBlackBox = toggleBlackBox; - exports.loadSourceText = loadSourceText; - exports.getTextForSources = getTextForSources; - - var _defer = __webpack_require__(194); - - var _defer2 = _interopRequireDefault(_defer); - - var _promise = __webpack_require__(193); - - var _assert = __webpack_require__(223); - - var _assert2 = _interopRequireDefault(_assert); - - var _pause = __webpack_require__(255); - - var _breakpoints = __webpack_require__(245); - - var _prettyPrint = __webpack_require__(903); - - var _source = __webpack_require__(233); - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _prefs = __webpack_require__(226); - - var _editor = __webpack_require__(257); - - var _selectors = __webpack_require__(242); - - 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"); }); }; } /* This Source Code Form is subject to the terms of the Mozilla Public @@ -16350,37 +33033,44 @@ return /******/ (function(modules) { // webpackBootstrap * @module actions/sources */ - // If a request has been made to show this source, go ahead and - // select it. - function checkSelectedSource(state, dispatch, source) { - var pendingLocation = (0, _selectors.getPendingSelectedLocation)(state); - if (pendingLocation && pendingLocation.url === source.url) { - dispatch(selectSource(source.id, { line: pendingLocation.line })); - } - } + var defer = __webpack_require__(194); - function checkPendingBreakpoints(state, dispatch, source) { - var pendingBreakpoints = (0, _selectors.getPendingBreakpoints)(state); + var _require = __webpack_require__(193), + PROMISE = _require.PROMISE; - if (pendingBreakpoints) { - pendingBreakpoints.forEach(pendingBreakpoint => { - var _pendingBreakpoint$lo = pendingBreakpoint.location, - line = _pendingBreakpoint$lo.line, - sourceUrl = _pendingBreakpoint$lo.sourceUrl, - condition = pendingBreakpoint.condition; + var assert = __webpack_require__(223); - var sameSource = sourceUrl && sourceUrl == source.url; + var _require2 = __webpack_require__(255), + updateFrameLocations = _require2.updateFrameLocations; - var location = { sourceId: source.id, sourceUrl, line }; + var _require3 = __webpack_require__(246), + getOriginalURLs = _require3.getOriginalURLs, + getOriginalSourceText = _require3.getOriginalSourceText, + generatedToOriginalId = _require3.generatedToOriginalId, + isOriginalId = _require3.isOriginalId, + getOriginalLocation = _require3.getOriginalLocation, + getGeneratedLocation = _require3.getGeneratedLocation, + isGeneratedId = _require3.isGeneratedId, + applySourceMap = _require3.applySourceMap, + shouldSourceMap = _require3.shouldSourceMap; - var bp = (0, _selectors.getBreakpoint)(state, location); + var _require4 = __webpack_require__(256), + prettyPrint = _require4.prettyPrint; - if (sameSource && !bp) { - dispatch((0, _breakpoints.addBreakpoint)(location, { condition })); - } - }); - } - } + var _require5 = __webpack_require__(233), + getPrettySourceURL = _require5.getPrettySourceURL; + + var constants = __webpack_require__(229); + + var _require6 = __webpack_require__(257), + removeDocument = _require6.removeDocument; + + var _require7 = __webpack_require__(242), + getSource = _require7.getSource, + getSourceByURL = _require7.getSourceByURL, + getSourceText = _require7.getSourceText, + getPendingSelectedLocation = _require7.getPendingSelectedLocation, + getFrames = _require7.getFrames; /** * Handler for the debugger client's unsolicited newSource notification. @@ -16392,14 +33082,21 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref.dispatch, getState = _ref.getState; - if (_prefs.prefs.clientSourceMapsEnabled) { + if (shouldSourceMap()) { dispatch(loadSourceMap(source)); } - dispatch({ type: _constants2.default.ADD_SOURCE, source }); + dispatch({ + type: constants.ADD_SOURCE, + source + }); - checkSelectedSource(getState(), dispatch, source); - checkPendingBreakpoints(getState(), dispatch, source); + // If a request has been made to show this source, go ahead and + // select it. + var pendingLocation = getPendingSelectedLocation(getState()); + if (pendingLocation && pendingLocation.url === source.url) { + dispatch(selectSource(source.id, { line: pendingLocation.line })); + } }; } @@ -16408,7 +33105,7 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref2.dispatch, getState = _ref2.getState; - sources.filter(source => !(0, _selectors.getSource)(getState(), source.id)).forEach(source => dispatch(newSource(source))); + sources.filter(source => !getSource(getState(), source.id)).forEach(source => dispatch(newSource(source))); }; } @@ -16420,29 +33117,25 @@ return /******/ (function(modules) { // webpackBootstrap return (() => { var _ref3 = _asyncToGenerator(function* (_ref4) { var dispatch = _ref4.dispatch, - getState = _ref4.getState, - sourceMaps = _ref4.sourceMaps; + getState = _ref4.getState; - var urls = yield sourceMaps.getOriginalURLs(generatedSource); + var urls = yield getOriginalURLs(generatedSource); if (!urls) { // If this source doesn't have a sourcemap, do nothing. return; } - var state = getState(); var originalSources = urls.map(function (originalUrl) { return { url: originalUrl, - id: sourceMaps.generatedToOriginalId(generatedSource.id, originalUrl), + id: generatedToOriginalId(generatedSource.id, originalUrl), isPrettyPrinted: false }; }); - dispatch({ type: _constants2.default.ADD_SOURCES, sources: originalSources }); - - originalSources.forEach(function (source) { - checkSelectedSource(state, dispatch, source); - checkPendingBreakpoints(state, dispatch, source); + dispatch({ + type: constants.ADD_SOURCES, + sources: originalSources }); }); @@ -16468,12 +33161,12 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref5.dispatch, getState = _ref5.getState; - var source = (0, _selectors.getSourceByURL)(getState(), url); + var source = getSourceByURL(getState(), url); if (source) { dispatch(selectSource(source.get("id"), options)); } else { dispatch({ - type: _constants2.default.SELECT_SOURCE_URL, + type: constants.SELECT_SOURCE_URL, url: url, tabIndex: options.tabIndex, line: options.line @@ -16500,21 +33193,15 @@ return /******/ (function(modules) { // webpackBootstrap return; } - var source = (0, _selectors.getSource)(getState(), id); - - if (!source) { - return; - } - - source = source.toJS(); + var source = getSource(getState(), id).toJS(); // Make sure to start a request to load the source text. dispatch(loadSourceText(source)); - dispatch({ type: _constants2.default.TOGGLE_PROJECT_SEARCH, value: false }); + dispatch({ type: constants.SET_FILE_SEARCH, searchOn: false }); dispatch({ - type: _constants2.default.SELECT_SOURCE, + type: constants.SELECT_SOURCE, source: source, tabIndex: options.tabIndex, line: options.line @@ -16531,20 +33218,14 @@ return /******/ (function(modules) { // webpackBootstrap var _ref7 = _asyncToGenerator(function* (_ref8) { var dispatch = _ref8.dispatch, getState = _ref8.getState, - client = _ref8.client, - sourceMaps = _ref8.sourceMaps; + client = _ref8.client; if (!client) { return; } - var source = (0, _selectors.getSource)(getState(), sourceLocation.sourceId); - var pairedLocation = void 0; - if (sourceMaps.isOriginalId(sourceLocation.sourceId)) { - pairedLocation = yield sourceMaps.getGeneratedLocation(sourceLocation, source.toJS()); - } else { - pairedLocation = yield sourceMaps.getOriginalLocation(sourceLocation, source.toJS()); - } + var source = getSource(getState(), sourceLocation.sourceId); + var pairedLocation = isOriginalId(sourceLocation.sourceId) ? yield getGeneratedLocation(sourceLocation, source.toJS()) : yield getOriginalLocation(sourceLocation, source.toJS()); return dispatch(selectSource(pairedLocation.sourceId, { line: pairedLocation.line })); }); @@ -16560,8 +33241,11 @@ return /******/ (function(modules) { // webpackBootstrap * @static */ function closeTab(url) { - (0, _editor.removeDocument)(url); - return { type: _constants2.default.CLOSE_TAB, url }; + removeDocument(url); + return { + type: constants.CLOSE_TAB, + url + }; } /** @@ -16575,13 +33259,16 @@ return /******/ (function(modules) { // webpackBootstrap client = _ref9.client; urls.forEach(url => { - var source = (0, _selectors.getSourceByURL)(getState(), url); + var source = getSourceByURL(getState(), url); if (source) { - (0, _editor.removeDocument)(source.get("id")); + removeDocument(source.get("id")); } }); - dispatch({ type: _constants2.default.CLOSE_TABS, urls }); + dispatch({ + type: constants.CLOSE_TABS, + urls + }); }; } @@ -16601,101 +33288,77 @@ return /******/ (function(modules) { // webpackBootstrap return (_ref10) => { var dispatch = _ref10.dispatch, getState = _ref10.getState, - client = _ref10.client, - sourceMaps = _ref10.sourceMaps; + client = _ref10.client; - var source = (0, _selectors.getSource)(getState(), sourceId).toJS(); - var sourceText = (0, _selectors.getSourceText)(getState(), sourceId); - if (sourceText) { - sourceText = sourceText.toJS(); - } + var source = getSource(getState(), sourceId).toJS(); + var sourceText = getSourceText(getState(), sourceId).toJS(); - if (sourceText && sourceText.loading) { + if (sourceText.loading) { return {}; } - (0, _assert2.default)(sourceMaps.isGeneratedId(sourceId), "Pretty-printing only allowed on generated sources"); + assert(isGeneratedId(sourceId), "Pretty-printing only allowed on generated sources"); - var url = (0, _source.getPrettySourceURL)(source.url); - var id = sourceMaps.generatedToOriginalId(source.id, url); + var url = getPrettySourceURL(source.url); + var id = generatedToOriginalId(source.id, url); var originalSource = { url, id, isPrettyPrinted: false }; - dispatch({ type: _constants2.default.ADD_SOURCE, source: originalSource }); + dispatch({ + type: constants.ADD_SOURCE, + source: originalSource + }); return dispatch({ - type: _constants2.default.TOGGLE_PRETTY_PRINT, + type: constants.TOGGLE_PRETTY_PRINT, source: originalSource, - [_promise.PROMISE]: _asyncToGenerator(function* () { - var _ref12 = yield (0, _prettyPrint.prettyPrint)({ - source, - sourceText, - url + [PROMISE]: _asyncToGenerator(function* () { + var _ref12 = yield prettyPrint({ + source, sourceText, url }), code = _ref12.code, mappings = _ref12.mappings; - yield sourceMaps.applySourceMap(source.id, url, code, mappings); + yield applySourceMap(source.id, url, code, mappings); - var frames = (0, _selectors.getFrames)(getState()); + var frames = getFrames(getState()); if (frames) { - frames = yield (0, _pause.updateFrameLocations)(frames.toJS(), sourceMaps); + frames = yield updateFrameLocations(frames.toJS()); } dispatch(selectSource(originalSource.id)); - return { text: code, contentType: "text/javascript", frames }; + return { + text: code, + contentType: "text/javascript", + frames + }; })() }); }; } - function toggleBlackBox(source) { - return (() => { - var _ref13 = _asyncToGenerator(function* (_ref14) { - var dispatch = _ref14.dispatch, - getState = _ref14.getState, - client = _ref14.client, - sourceMaps = _ref14.sourceMaps; - var isBlackBoxed = source.isBlackBoxed, - id = source.id; - - - return dispatch({ - type: _constants2.default.BLACKBOX, - source, - [_promise.PROMISE]: client.blackBox(id, isBlackBoxed) - }); - }); - - return function (_x5) { - return _ref13.apply(this, arguments); - }; - })(); - } - /** * @memberof actions/sources * @static */ function loadSourceText(source) { - return (_ref15) => { - var dispatch = _ref15.dispatch, - getState = _ref15.getState, - client = _ref15.client, - sourceMaps = _ref15.sourceMaps; + return (_ref13) => { + var dispatch = _ref13.dispatch, + getState = _ref13.getState, + client = _ref13.client; // Fetch the source text only once. - var textInfo = (0, _selectors.getSourceText)(getState(), source.id); + var textInfo = getSourceText(getState(), source.id); if (textInfo) { // It's already loaded or is loading return Promise.resolve(textInfo); } return dispatch({ - type: _constants2.default.LOAD_SOURCE_TEXT, + type: constants.LOAD_SOURCE_TEXT, source: source, - [_promise.PROMISE]: _asyncToGenerator(function* () { - if (sourceMaps.isOriginalId(source.id)) { - return yield sourceMaps.getOriginalSourceText(source); + [PROMISE]: _asyncToGenerator(function* () { + if (isOriginalId(source.id)) { + return yield getOriginalSourceText(source); } var response = yield client.sourceContents(source.id); @@ -16734,11 +33397,11 @@ return /******/ (function(modules) { // webpackBootstrap * A promise that is resolved after source texts have been fetched. */ function getTextForSources(actors) { - return (_ref17) => { - var dispatch = _ref17.dispatch, - getState = _ref17.getState; + return (_ref15) => { + var dispatch = _ref15.dispatch, + getState = _ref15.getState; - var deferred = (0, _defer2.default)(); + var deferred = defer(); var pending = new Set(actors); var fetched = []; @@ -16747,13 +33410,14 @@ return /******/ (function(modules) { // webpackBootstrap // everything is considered rejected, thus no other subsequent source will // be getting fetched. We don't want that. Something like Q's allSettled // would work like a charm here. + // Try to fetch as many sources as possible. var _loop = function (actor) { - var source = (0, _selectors.getSource)(getState(), actor); - dispatch(loadSourceText(source)).then((_ref26) => { - var text = _ref26.text, - contentType = _ref26.contentType; + var source = getSource(getState(), actor); + dispatch(loadSourceText(source)).then((_ref24) => { + var text = _ref24.text, + contentType = _ref24.contentType; onFetch([source, text, contentType]); }, err => { @@ -16774,11 +33438,11 @@ return /******/ (function(modules) { // webpackBootstrap } /* Called if fetching a source finishes successfully. */ - function onFetch(_ref18) { - var _ref19 = _slicedToArray(_ref18, 3), - aSource = _ref19[0], - aText = _ref19[1], - aContentType = _ref19[2]; + function onFetch(_ref16) { + var _ref17 = _slicedToArray(_ref16, 3), + aSource = _ref17[0], + aText = _ref17[1], + aContentType = _ref17[2]; // If fetching the source has previously timed out, discard it this time. if (!pending.has(aSource.actor)) { @@ -16790,10 +33454,10 @@ return /******/ (function(modules) { // webpackBootstrap } /* Called if fetching a source failed because of an error. */ - function onError(_ref20) { - var _ref21 = _slicedToArray(_ref20, 2), - aSource = _ref21[0], - aError = _ref21[1]; + function onError(_ref18) { + var _ref19 = _slicedToArray(_ref18, 2), + aSource = _ref19[0], + aError = _ref19[1]; pending.delete(aSource.actor); maybeFinish(); @@ -16806,12 +33470,12 @@ return /******/ (function(modules) { // webpackBootstrap if (pending.size == 0) { // Sort the fetched sources alphabetically by their url. if (deferred) { - deferred.resolve(fetched.sort((_ref22, _ref23) => { - var _ref25 = _slicedToArray(_ref22, 1), - aFirst = _ref25[0]; + deferred.resolve(fetched.sort((_ref20, _ref21) => { + var _ref23 = _slicedToArray(_ref20, 1), + aFirst = _ref23[0]; - var _ref24 = _slicedToArray(_ref23, 1), - aSecond = _ref24[0]; + var _ref22 = _slicedToArray(_ref21, 1), + aSecond = _ref22[0]; return aFirst > aSecond ? -1 : 1; })); @@ -16823,24 +33487,35 @@ return /******/ (function(modules) { // webpackBootstrap }; } + module.exports = { + newSource, + newSources, + selectSource, + selectSourceURL, + jumpToMappedLocation, + closeTab, + closeTabs, + togglePrettyPrint, + loadSourceText, + getTextForSources + }; + /***/ }, /* 255 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.updateFrameLocations = updateFrameLocations; - exports.getPauseReason = getPauseReason; - function updateFrameLocations(frames, sourceMaps) { + var _require = __webpack_require__(246), + getOriginalLocation = _require.getOriginalLocation; + + function updateFrameLocations(frames) { if (!frames || frames.length == 0) { return Promise.resolve(frames); } return Promise.all(frames.map(frame => { - return sourceMaps.getOriginalLocation(frame.location).then(loc => { + return getOriginalLocation(frame.location).then(loc => { return Object.assign(frame, { location: loc }); @@ -16852,23 +33527,22 @@ return /******/ (function(modules) { // webpackBootstrap // These are the known unhandled reasons: // "breakpointConditionThrown", "clientEvaluated" // "interrupted", "attached" - var reasons = { - debuggerStatement: "whyPaused.debuggerStatement", - breakpoint: "whyPaused.breakpoint", - exception: "whyPaused.exception", - resumeLimit: "whyPaused.resumeLimit", - pauseOnDOMEvents: "whyPaused.pauseOnDOMEvents", - breakpointConditionThrown: "whyPaused.breakpointConditionThrown", + "debuggerStatement": "whyPaused.debuggerStatement", + "breakpoint": "whyPaused.breakpoint", + "exception": "whyPaused.exception", + "resumeLimit": "whyPaused.resumeLimit", + "pauseOnDOMEvents": "whyPaused.pauseOnDOMEvents", + "breakpointConditionThrown": "whyPaused.breakpointConditionThrown", // V8 - DOM: "whyPaused.breakpoint", - EventListener: "whyPaused.pauseOnDOMEvents", - XHR: "whyPaused.xhr", - promiseRejection: "whyPaused.promiseRejection", - assert: "whyPaused.assert", - debugCommand: "whyPaused.debugCommand", - other: "whyPaused.other" + "DOM": "whyPaused.breakpoint", + "EventListener": "whyPaused.pauseOnDOMEvents", + "XHR": "whyPaused.xhr", + "promiseRejection": "whyPaused.promiseRejection", + "assert": "whyPaused.assert", + "debugCommand": "whyPaused.debugCommand", + "other": "whyPaused.other" }; function getPauseReason(pauseInfo) { @@ -16883,41 +33557,99 @@ return /******/ (function(modules) { // webpackBootstrap return reasons[reasonType]; } + module.exports = { + updateFrameLocations, + getPauseReason + }; + +/***/ }, +/* 256 */ +/***/ 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.text + }); + }); + + 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__(65), + getValue = _require.getValue; + + var _require2 = __webpack_require__(234), + workerTask = _require2.workerTask; + + var _require3 = __webpack_require__(233), + isJavaScript = _require3.isJavaScript; + + var assert = __webpack_require__(223); + + var prettyPrintWorker = new Worker(`${getValue("baseWorkerURL")}pretty-print-worker.js`); + + function destroyWorker() { + if (prettyPrintWorker != null) { + prettyPrintWorker.terminate(); + prettyPrintWorker = null; + } + } + + var _prettyPrint = workerTask(prettyPrintWorker, "prettyPrint"); + + module.exports = { + prettyPrint, + destroyWorker + }; + /***/ }, -/* 256 */, /* 257 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - var _expression = __webpack_require__(904); + var _require = __webpack_require__(233), + isPretty = _require.isPretty, + isJavaScript = _require.isJavaScript; - var expressionUtils = _interopRequireWildcard(_expression); - - 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; - - var _require2 = __webpack_require__(233), - isPretty = _require2.isPretty, - isJavaScript = _require2.isJavaScript; - - var _require3 = __webpack_require__(898), - isOriginalId = _require3.isOriginalId; + var _require2 = __webpack_require__(246), + isOriginalId = _require2.isOriginalId; var buildQuery = __webpack_require__(258); - var sourceDocumentUtils = __webpack_require__(260); - var getDocument = sourceDocumentUtils.getDocument; + var _require3 = __webpack_require__(260), + getDocument = _require3.getDocument, + setDocument = _require3.setDocument, + removeDocument = _require3.removeDocument, + clearDocuments = _require3.clearDocuments; - var sourceSearchUtils = __webpack_require__(261); - var findNext = sourceSearchUtils.findNext, - findPrev = sourceSearchUtils.findPrev; + var _require4 = __webpack_require__(261), + countMatches = _require4.countMatches, + find = _require4.find, + findNext = _require4.findNext, + findPrev = _require4.findPrev, + removeOverlay = _require4.removeOverlay, + clearIndex = _require4.clearIndex; - var _require4 = __webpack_require__(965), - SourceEditor = _require4.SourceEditor, - SourceEditorUtils = _require4.SourceEditorUtils; + var SourceEditor = __webpack_require__(305); function shouldShowPrettyPrint(selectedSource) { if (!selectedSource) { @@ -16937,6 +33669,24 @@ return /******/ (function(modules) { // webpackBootstrap return true; } + function onKeyDown(codeMirror, e) { + var key = e.key, + target = e.target; + + var codeWrapper = codeMirror.getWrapperElement(); + var textArea = codeWrapper.querySelector("textArea"); + + if (key === "Escape" && target == textArea) { + e.stopPropagation(); + e.preventDefault(); + codeWrapper.focus(); + } else if (key === "Enter" && target == codeWrapper) { + e.preventDefault(); + // Focus into editor's text area + textArea.focus(); + } + } + function shouldShowFooter(selectedSource, horizontal) { if (!horizontal) { return true; @@ -16945,6 +33695,20 @@ return /******/ (function(modules) { // webpackBootstrap return shouldShowPrettyPrint(selectedSource); } + function forEachLine(codeMirror, iter) { + codeMirror.doc.iter(0, codeMirror.lineCount(), iter); + } + + function removeLineClass(codeMirror, line, className) { + codeMirror.removeLineClass(line, "line", className); + } + + function clearLineClass(codeMirror, className) { + forEachLine(codeMirror, line => { + removeLineClass(codeMirror, line, className); + }); + } + function isTextForSource(sourceText) { return !sourceText.get("loading") && !sourceText.get("error"); } @@ -16955,6 +33719,26 @@ return /******/ (function(modules) { // webpackBootstrap }); } + function getTextForLine(codeMirror, line) { + return codeMirror.getLine(line - 1).trim(); + } + + function getCursorLine(codeMirror) { + return codeMirror.getCursor().line; + } + /** + * Forces the breakpoint gutter to be the same size as the line + * numbers gutter. Editor CSS will absolutely position the gutter + * beneath the line numbers. This makes it easy to be flexible with + * how we overlay breakpoints. + */ + function resizeBreakpointGutter(editor) { + var gutters = editor.display.gutters; + var lineNumbers = gutters.querySelector(".CodeMirror-linenumbers"); + var breakpoints = gutters.querySelector(".breakpoints"); + breakpoints.style.width = `${lineNumbers.clientWidth}px`; + } + function traverseResults(e, ctx, query, dir, modifiers) { e.stopPropagation(); e.preventDefault(); @@ -16967,22 +33751,16 @@ return /******/ (function(modules) { // webpackBootstrap } function createEditor() { - var gutters = ["breakpoints", "hit-markers", "CodeMirror-linenumbers"]; - - if (isEnabled("codeFolding")) { - gutters.push("CodeMirror-foldgutter"); - } - return new SourceEditor({ mode: "javascript", - foldGutter: isEnabled("codeFolding"), readOnly: true, lineNumbers: true, theme: "mozilla", lineWrapping: false, matchBrackets: true, showAnnotationRuler: true, - gutters, + enableCodeFolding: false, + gutters: ["breakpoints", "hit-markers"], value: " ", extraKeys: { // Override code mirror keymap to avoid conflicts with split console. @@ -16993,26 +33771,30 @@ return /******/ (function(modules) { // webpackBootstrap }); } - function updateDocument(editor, selectedSource, sourceText) { - if (selectedSource) { - var sourceId = selectedSource.get("id"); - var doc = getDocument(sourceId) || editor.createDocument(); - editor.replaceDocument(doc); - } else if (sourceText) { - this.setText(sourceText.get("text")); - } - } - - module.exports = Object.assign({}, expressionUtils, sourceDocumentUtils, sourceSearchUtils, SourceEditorUtils, { + module.exports = { createEditor, shouldShowPrettyPrint, shouldShowFooter, + clearLineClass, + onKeyDown, buildQuery, + getDocument, + setDocument, + removeDocument, + clearDocuments, + countMatches, + find, + findNext, + findPrev, + clearIndex, + removeOverlay, isTextForSource, breakpointAtLine, - traverseResults, - updateDocument - }); + getTextForLine, + getCursorLine, + resizeBreakpointGutter, + traverseResults + }; /***/ }, /* 258 */ @@ -17196,15 +33978,11 @@ return /******/ (function(modules) { // webpackBootstrap */ function getSearchState(cm, query, modifiers) { var state = cm.state.search || (cm.state.search = new SearchState()); + var cursor = getSearchCursor(cm, query, null, modifiers); - // avoid generating a cursor and iterating over the results for an empty query - if (query) { - var cursor = getSearchCursor(cm, query, null, modifiers); - - state.results = []; - while (cursor.findNext()) { - state.results.push(cursor.pos); - } + state.results = []; + while (cursor.findNext()) { + state.results.push(cursor.pos); } return state; @@ -19113,7 +35891,132 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 305 */, +/* 305 */ +/***/ 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__(316); + __webpack_require__(318); + + // 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; + +/***/ }, /* 306 */ /***/ function(module, exports, __webpack_require__) { @@ -19127,59 +36030,58 @@ return /******/ (function(modules) { // webpackBootstrap // at http://marijnhaverbeke.nl/blog/#cm-internals . (function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.CodeMirror = 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 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 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); + var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.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 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; } + 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); + 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); + 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 : ""); + 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); } + { e.removeChild(e.firstChild) } return e } @@ -19188,44 +36090,38 @@ return /******/ (function(modules) { // webpackBootstrap } 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"); + 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 } - var range; + var range if (document.createRange) { range = function(node, start, end, endNode) { - var r = document.createRange(); - r.setEnd(endNode || node, end); - r.setStart(node, start); + 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); } + 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); + 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; } + { child = child.parentNode } if (parent.contains) { return parent.contains(child) } do { - if (child.nodeType == 11) { child = child.host; } + if (child.nodeType == 11) { child = child.host } if (child == parent) { return true } } while (child = child.parentNode) } @@ -19234,44 +36130,44 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var activeElement try { - activeElement = document.activeElement; + activeElement = document.activeElement } catch(e) { - activeElement = document.body || null; + activeElement = document.body || null } - while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) - { activeElement = activeElement.shadowRoot.activeElement; } + while (activeElement && activeElement.root && activeElement.root.activeElement) + { activeElement = activeElement.root.activeElement } return activeElement } function addClass(node, cls) { - var current = node.className; - if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; } + var current = node.className + if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls } } function joinClasses(a, b) { - var as = a.split(" "); + var as = a.split(" ") for (var i = 0; i < as.length; i++) - { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } } + { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } } return b } - var selectInput = function(node) { node.select(); }; + 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; }; } + { 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) {} }; } + { selectInput = function(node) { try { node.select() } catch(_e) {} } } function bind(f) { - var args = Array.prototype.slice.call(arguments, 1); + var args = Array.prototype.slice.call(arguments, 1) return function(){return f.apply(null, args)} } function copyObj(obj, target, overwrite) { - if (!target) { target = {}; } + if (!target) { target = {} } for (var prop in obj) { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) - { target[prop] = obj[prop]; } } + { target[prop] = obj[prop] } } return target } @@ -19279,23 +36175,23 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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); + 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; + n += nextTab - i + n += tabSize - (n % tabSize) + i = nextTab + 1 } } - var Delayed = function() {this.id = null;}; + var Delayed = function() {this.id = null}; Delayed.prototype.set = function (ms, f) { - clearTimeout(this.id); - this.id = setTimeout(f, ms); + clearTimeout(this.id) + this.id = setTimeout(f, ms) }; function indexOf(array, elt) { @@ -19305,69 +36201,68 @@ return /******/ (function(modules) { // webpackBootstrap } // Number of pixels added to scroller and sizer to hide scrollbar - var scrollerGap = 30; + var scrollerGap = 30 // Returned or thrown by various protocols to signal 'I'm not // handling this'. - var Pass = {toString: function(){return "CodeMirror.Pass"}}; + 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; + 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; + col += nextTab - pos + col += tabSize - (col % tabSize) + pos = nextTab + 1 if (col >= goal) { return pos } } } - var spaceStrs = [""]; + var spaceStrs = [""] function spaceStr(n) { while (spaceStrs.length <= n) - { spaceStrs.push(lst(spaceStrs) + " "); } + { 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); } + 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); + 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; + var inst if (Object.create) { - inst = Object.create(base); + inst = Object.create(base) } else { - nothing.prototype = base; - inst = new nothing(); + nothing.prototype = base + inst = new nothing() } - if (props) { copyObj(props, inst); } + 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]/; + 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)) @@ -19388,12 +36283,12 @@ return /******/ (function(modules) { // webpackBootstrap // 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]/; + 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; } + while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir } return pos } @@ -19402,9 +36297,9 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + var mid = Math.floor((from + to) / 2) + if (pred(mid)) { to = mid } + else { from = mid } } } @@ -19413,114 +36308,113 @@ return /******/ (function(modules) { // webpackBootstrap // display-related state. function Display(place, doc, input) { - var d = this; - this.input = 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"); + 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"); + 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"); + d.lineDiv = elt("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"); + 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"); + 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"); + 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"); + d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], + null, "position: relative; outline: none") // Moved around its parent to cover visible view. - d.mover = elt("div", [lines], null, "position: relative"); + d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative") // Set to the height of the document, allowing scrolling. - d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); - d.sizerWidth = null; + 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;"); + 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; + 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"); + 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"); + 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 (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); } + 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; + d.viewFrom = d.viewTo = doc.first + d.reportedViewFrom = d.reportedViewTo = doc.first // Information about the rendered lines. - d.view = []; - d.renderedView = null; + 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; + d.externalMeasured = null // Empty space (in pixels) above the view - d.viewOffset = 0; - d.lastWrapHeight = d.lastWrapWidth = 0; - d.updateLineNumbers = null; + d.viewOffset = 0 + d.lastWrapHeight = d.lastWrapWidth = 0 + d.updateLineNumbers = null - d.nativeBarWidth = d.barHeight = d.barWidth = 0; - d.scrollbarsClipped = false; + 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; + 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.alignWidgets = false - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; + 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; + d.maxLine = null + d.maxLineLength = 0 + d.maxLineChanged = false // Used for measuring wheel scrolling granularity - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; + d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null // True when shift is held down. - d.shift = false; + d.shift = false // Used to track whether anything happened since the context menu // was opened. - d.selForContextMenu = null; + d.selForContextMenu = null - d.activeTouch = null; + d.activeTouch = null - input.init(d); + input.init(d) } // Find the line object corresponding to the given line number. function getLine(doc, n) { - n -= doc.first; + 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; + var chunk = doc while (!chunk.lines) { for (var i = 0;; ++i) { - var child = chunk.children[i], sz = child.chunkSize(); + var child = chunk.children[i], sz = child.chunkSize() if (n < sz) { chunk = child; break } - n -= sz; + n -= sz } } return chunk.lines[n] @@ -19529,39 +36423,39 @@ return /******/ (function(modules) { // webpackBootstrap // Get the part of a document between two positions, as an array of // strings. function getBetween(doc, start, end) { - var out = [], n = start.line; + 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; - }); + 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 + 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; } } + 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); + 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(); + no += chunk.children[i].chunkSize() } } return no + cur.first @@ -19570,21 +36464,21 @@ return /******/ (function(modules) { // webpackBootstrap // Find the line at the given vertical position, using the height // information in the document tree. function lineAtHeight(chunk, h) { - var n = chunk.first; + 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; + var child = chunk.children[i$1], ch = child.height if (h < ch) { chunk = child; continue outer } - h -= ch; - n += child.chunkSize(); + h -= ch + n += child.chunkSize() } return n } while (!chunk.lines) - var i = 0; + var i = 0 for (; i < chunk.lines.length; ++i) { - var line = chunk.lines[i], lh = line.height; + var line = chunk.lines[i], lh = line.height if (h < lh) { break } - h -= lh; + h -= lh } return n + i } @@ -19600,9 +36494,9 @@ return /******/ (function(modules) { // webpackBootstrap 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; + this.line = line + this.ch = ch + this.sticky = sticky } // Compare two positions, return 0 if they are the same, a negative @@ -19620,60 +36514,59 @@ return /******/ (function(modules) { // webpackBootstrap 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; + 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; + 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]); } + 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; + sawReadOnlySpans = true } function seeCollapsedSpans() { - sawCollapsedSpans = true; + sawCollapsedSpans = true } // TEXTMARKER SPANS function MarkedSpan(marker, from, to) { - this.marker = marker; - this.from = from; this.to = 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]; + 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; + var r for (var i = 0; i < spans.length; ++i) - { if (spans[i] != span) { (r || (r = [])).push(spans[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); + 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 @@ -19681,24 +36574,26 @@ return /******/ (function(modules) { // webpackBootstrap // character position, returning an array of remaining chunks (or // undefined if nothing remains). function markedSpansBefore(old, startCh, isInsert) { - var nw; + 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); + 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)); + 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; + 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); + 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)); + 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 @@ -19712,60 +36607,60 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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; + 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); + 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); + 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]; + 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; } + 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; } + 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); + var found$1 = getMarkedSpanFor(first, span$1.marker) if (!found$1) { - span$1.from = offset; - if (sameLine) { (first || (first = [])).push(span$1); } + span$1.from = offset + if (sameLine) { (first || (first = [])).push(span$1) } } } else { - span$1.from += offset; - if (sameLine) { (first || (first = [])).push(span$1); } + 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); } + if (first) { first = clearEmptySpans(first) } + if (last && last != first) { last = clearEmptySpans(last) } - var newMarkers = [first]; + var newMarkers = [first] if (!sameLine) { // Fill gap with whole-line-spans - var gap = change.text.length - 2, gapMarkers; + 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)); } } } + { (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); + { newMarkers.push(gapMarkers) } + newMarkers.push(last) } return newMarkers } @@ -19774,9 +36669,9 @@ return /******/ (function(modules) { // webpackBootstrap // option of false. function clearEmptySpans(spans) { for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; + var span = spans[i] if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) - { spans.splice(i--, 1); } + { spans.splice(i--, 1) } } if (!spans.length) { return null } return spans @@ -19784,28 +36679,28 @@ return /******/ (function(modules) { // webpackBootstrap // Used to 'clip' out readOnly ranges when making a change. function removeReadOnlyRanges(doc, from, to) { - var markers = null; + 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; + var mark = line.markedSpans[i].marker if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) - { (markers || (markers = [])).push(mark); } + { (markers || (markers = [])).push(mark) } } } - }); + }) if (!markers) { return null } - var parts = [{from: from, to: to}]; + var parts = [{from: from, to: to}] for (var i = 0; i < markers.length; ++i) { - var mk = markers[i], m = mk.find(0); + var mk = markers[i], m = mk.find(0) for (var j = 0; j < parts.length; ++j) { - var p = parts[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); + 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}); } + { 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; + { newParts.push({from: m.to, to: p.to}) } + parts.splice.apply(parts, newParts) + j += newParts.length - 3 } } return parts @@ -19813,17 +36708,17 @@ return /******/ (function(modules) { // webpackBootstrap // Connect or disconnect spans from a line. function detachMarkedSpans(line) { - var spans = line.markedSpans; + var spans = line.markedSpans if (!spans) { return } for (var i = 0; i < spans.length; ++i) - { spans[i].marker.detachLine(line); } - line.markedSpans = null; + { 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; + { spans[i].marker.attachLine(line) } + line.markedSpans = spans } // Helpers used when computing which overlapping collapsed span @@ -19835,12 +36730,12 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + 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); + var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b) if (toCmp) { return toCmp } return b.id - a.id } @@ -19848,12 +36743,12 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var sps = sawCollapsedSpans && line.markedSpans, found if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { - sp = sps[i]; + sp = sps[i] if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.marker) < 0)) - { found = sp.marker; } + { found = sp.marker } } } return found } @@ -19863,15 +36758,15 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + function conflictingCollapsedRange(doc, lineNo, from, to, marker) { + var line = getLine(doc, lineNo) + var sps = sawCollapsedSpans && line.markedSpans if (sps) { for (var i = 0; i < sps.length; ++i) { - var sp = sps[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); + 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)) @@ -19884,26 +36779,26 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var merged while (merged = collapsedSpanAtStart(line)) - { line = merged.find(-1, true).line; } + { line = merged.find(-1, true).line } return line } function visualLineEnd(line) { - var merged; + var merged while (merged = collapsedSpanAtEnd(line)) - { line = merged.find(1, true).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; + var merged, lines while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line - ;(lines || (lines = [])).push(line); + ;(lines || (lines = [])).push(line) } return lines } @@ -19911,7 +36806,7 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + var line = getLine(doc, lineN), vis = visualLine(line) if (line == vis) { return lineN } return lineNo(vis) } @@ -19920,10 +36815,10 @@ return /******/ (function(modules) { // webpackBootstrap // the given line. function visualLineEndNo(doc, lineN) { if (lineN > doc.lastLine()) { return lineN } - var line = getLine(doc, lineN), merged; + var line = getLine(doc, lineN), merged if (!lineIsHidden(doc, line)) { return lineN } while (merged = collapsedSpanAtEnd(line)) - { line = merged.find(1, true).line; } + { line = merged.find(1, true).line } return lineNo(line) + 1 } @@ -19931,9 +36826,9 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var sps = sawCollapsedSpans && line.markedSpans if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { - sp = sps[i]; + sp = sps[i] if (!sp.marker.collapsed) { continue } if (sp.from == null) { return true } if (sp.marker.widgetNode) { continue } @@ -19943,13 +36838,13 @@ return /******/ (function(modules) { // webpackBootstrap } function lineIsHiddenInner(doc, line, span) { if (span.to == null) { - var end = span.marker.find(1, true); + 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]; + 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) && @@ -19959,19 +36854,19 @@ return /******/ (function(modules) { // webpackBootstrap // Find the height above the given line. function heightAtLine(lineObj) { - lineObj = visualLine(lineObj); + lineObj = visualLine(lineObj) - var h = 0, chunk = lineObj.parent; + var h = 0, chunk = lineObj.parent for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i]; + var line = chunk.lines[i] if (line == lineObj) { break } - else { h += line.height; } + 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]; + var cur = p.children[i$1] if (cur == chunk) { break } - else { h += cur.height; } + else { h += cur.height } } } return h @@ -19982,66 +36877,66 @@ return /******/ (function(modules) { // webpackBootstrap // other lines onto it. function lineLength(line) { if (line.height == 0) { return 0 } - var len = line.text.length, merged, cur = line; + 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; + var found = merged.find(0, true) + cur = found.from.line + len += found.from.ch - found.to.ch } - cur = line; + 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; + 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; + 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); + var len = lineLength(line) if (len > d.maxLineLength) { - d.maxLineLength = len; - d.maxLine = line; + d.maxLineLength = len + d.maxLine = line } - }); + }) } // BIDI HELPERS function iterateBidiSections(order, from, to, f) { if (!order) { return f(from, to, "ltr") } - var found = false; + var found = false for (var i = 0; i < order.length; ++i) { - var part = order[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; + f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr") + found = true } } - if (!found) { f(from, to, "ltr"); } + if (!found) { f(from, to, "ltr") } } - var bidiOther = null; + var bidiOther = null function getBidiPartAt(order, ch, sticky) { - var found; - bidiOther = null; + var found + bidiOther = null for (var i = 0; i < order.length; ++i) { - var cur = order[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 != 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; } + if (cur.from != cur.to && sticky != "before") { found = i } + else { bidiOther = i } } } return found != null ? found : bidiOther @@ -20072,9 +36967,9 @@ return /******/ (function(modules) { // webpackBootstrap // 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"; + var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN" // Character types for codepoints 0x600 to 0x6f9 - var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"; + var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111" function charType(code) { if (code <= 0xf7) { return lowTypes.charAt(code) } else if (0x590 <= code && code <= 0x5f4) { return "R" } @@ -20085,30 +36980,30 @@ return /******/ (function(modules) { // webpackBootstrap else { return "L" } } - var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; - var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/ + var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/ + // Browsers seem to always treat the boundaries of block elements as being L. + var outerType = "L" function BidiSpan(level, from, to) { - this.level = level; - this.from = from; this.to = 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 = []; + return function(str) { + if (!bidiRE.test(str)) { return false } + var len = str.length, types = [] for (var i = 0; i < len; ++i) - { types.push(charType(str.charCodeAt(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; } + 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 @@ -20117,20 +37012,20 @@ return /******/ (function(modules) { // webpackBootstrap // 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"; } } + 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"; } + 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; + (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 } + prev$1 = type$2 } // W5. A sequence of European terminators adjacent to European @@ -20138,14 +37033,14 @@ return /******/ (function(modules) { // webpackBootstrap // 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"; } + var type$3 = types[i$4] + if (type$3 == ",") { types[i$4] = "N" } else if (type$3 == "%") { - var end = (void 0); + 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; + 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 } } @@ -20153,9 +37048,9 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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 @@ -20166,13 +37061,13 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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; + 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 ? "L" : "R" + for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 } + i$6 = end$1 - 1 } } @@ -20181,67 +37076,67 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var order = [], m for (var i$7 = 0; i$7 < len;) { if (countsAsLeft.test(types[i$7])) { - var start = 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)); + order.push(new BidiSpan(0, start, i$7)) } else { - var pos = i$7, at = order.length; + 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; + 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; } + 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 (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)); + 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)); + lst(order).to -= m[0].length + order.push(new BidiSpan(0, len - m[0].length, len)) } - return direction == "rtl" ? order.reverse() : order + return 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); } + function getOrder(line) { + var order = line.order + if (order == null) { order = line.order = bidiOrdering(line.text) } return order } function moveCharLogically(line, ch, dir) { - var target = skipExtendingChars(line.text, ch + dir, 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); + 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); + var order = getOrder(lineObj) if (order) { - var part = dir < 0 ? lst(order) : order[0]; - var moveInStorageOrder = (dir < 0) == (part.level == 1); - var sticky = moveInStorageOrder ? "after" : "before"; - var ch; + 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. @@ -20249,12 +37144,12 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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) } } @@ -20262,37 +37157,36 @@ return /******/ (function(modules) { // webpackBootstrap } function moveVisually(cm, line, start, dir) { - var bidi = getOrder(line, cm.doc.direction); + var bidi = getOrder(line) if (!bidi) { return moveLogically(line, start, dir) } if (start.ch >= line.text.length) { - start.ch = line.text.length; - start.sticky = "before"; + start.ch = line.text.length + start.sticky = "before" } else if (start.ch <= 0) { - start.ch = 0; - start.sticky = "after"; + 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, + var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos] + if (part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) { + // Case 1: We move within an ltr part. 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 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); + prep = prep || prepareMeasureForLine(cm, line) return wrappedLineExtentChar(cm, line, prep, ch) - }; - var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.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"; + if (part.level % 2 == 1) { + var ch = mv(start, -dir) + if (ch != null && (dir > 0 ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) { + // Case 2: We move within an rtl part on the same visual line + var sticky = dir < 0 ? "before" : "after" return new Pos(start.line, ch, sticky) } } @@ -20303,26 +37197,26 @@ return /******/ (function(modules) { // webpackBootstrap 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"); }; + : 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); + 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); + 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); + 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); + 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)); + res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh)) if (res) { return res } } @@ -20335,18 +37229,18 @@ return /******/ (function(modules) { // webpackBootstrap // Lightweight event framework. on/off also work on DOM nodes, // registering native DOM handlers. - var noHandlers = []; + var noHandlers = [] var on = function(emitter, type, f) { if (emitter.addEventListener) { - emitter.addEventListener(type, f, false); + emitter.addEventListener(type, f, false) } else if (emitter.attachEvent) { - emitter.attachEvent("on" + type, f); + emitter.attachEvent("on" + type, f) } else { - var map$$1 = emitter._handlers || (emitter._handlers = {}); - map$$1[type] = (map$$1[type] || noHandlers).concat(f); + var map = emitter._handlers || (emitter._handlers = {}) + map[type] = (map[type] || noHandlers).concat(f) } - }; + } function getHandlers(emitter, type) { return emitter._handlers && emitter._handlers[type] || noHandlers @@ -20354,24 +37248,24 @@ return /******/ (function(modules) { // webpackBootstrap function off(emitter, type, f) { if (emitter.removeEventListener) { - emitter.removeEventListener(type, f, false); + emitter.removeEventListener(type, f, false) } else if (emitter.detachEvent) { - emitter.detachEvent("on" + type, f); + emitter.detachEvent("on" + type, f) } else { - var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type]; + var map = emitter._handlers, arr = map && map[type] if (arr) { - var index = indexOf(arr, f); + var index = indexOf(arr, f) if (index > -1) - { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); } + { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) } } } } function signal(emitter, type /*, values...*/) { - var handlers = getHandlers(emitter, type); + 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); } + 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 @@ -20379,17 +37273,17 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + { 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; + var arr = cm._handlers && cm._handlers.cursorActivity if (!arr) { return } - var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); + 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]); } } + { set.push(arr[i]) } } } function hasHandler(emitter, type) { @@ -20399,35 +37293,35 @@ return /******/ (function(modules) { // webpackBootstrap // 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);}; + 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; } + if (e.preventDefault) { e.preventDefault() } + else { e.returnValue = false } } function e_stopPropagation(e) { - if (e.stopPropagation) { e.stopPropagation(); } - else { e.cancelBubble = true; } + 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_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; + 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 (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; } + if (mac && e.ctrlKey && b == 1) { b = 3 } return b } @@ -20436,32 +37330,32 @@ return /******/ (function(modules) { // webpackBootstrap // 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'); + var div = elt('div') return "draggable" in div || "dragDrop" in div - }(); + }() - var zwspSupported; + var zwspSupported function zeroWidthElement(measure) { if (zwspSupported == null) { - var test = elt("span", "\u200b"); - removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); + 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); } + { 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", ""); + 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; + 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); + 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) } @@ -20469,77 +37363,75 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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"); + 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; + result.push(line.slice(0, rt)) + pos += rt + 1 } else { - result.push(line); - pos = nl + 1; + result.push(line) + pos = nl + 1 } } return result - } : function (string) { return string.split(/\r\n?|\n/); }; + } : 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();} + var range + try {range = te.ownerDocument.selection.createRange()} catch(e) {} - if (!range$$1 || range$$1.parentElement() != te) { return false } - return range$$1.compareEndPoints("StartToEnd", range$$1) != 0 - }; + if (!range || range.parentElement() != te) { return false } + return range.compareEndPoints("StartToEnd", range) != 0 + } var hasCopyEvent = (function () { - var e = elt("div"); + var e = elt("div") if ("oncopy" in e) { return true } - e.setAttribute("oncopy", "return;"); + e.setAttribute("oncopy", "return;") return typeof e.oncopy == "function" - })(); + })() - var badZoomedRects = null; + 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(); + 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; + { mode.dependencies = Array.prototype.slice.call(arguments, 2) } + modes[name] = mode } function defineMIME(mime, spec) { - mimeModes[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]; + 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; + 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)) { @@ -20552,42 +37444,42 @@ return /******/ (function(modules) { // webpackBootstrap // 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]; + spec = resolveMode(spec) + var mfactory = modes[spec.name] if (!mfactory) { return getMode(options, "text/plain") } - var modeObj = mfactory(options, spec); + var modeObj = mfactory(options, spec) if (modeExtensions.hasOwnProperty(spec.name)) { - var exts = modeExtensions[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]; + if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] } + modeObj[prop] = exts[prop] } } - modeObj.name = spec.name; - if (spec.helperType) { modeObj.helperType = spec.helperType; } + 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]; } } + { 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 = {}; + var modeExtensions = {} function extendMode(mode, properties) { - var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); - copyObj(properties, exts); + 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 = {}; + var nstate = {} for (var n in state) { - var val = state[n]; - if (val instanceof Array) { val = val.concat([]); } - nstate[n] = val; + var val = state[n] + if (val instanceof Array) { val = val.concat([]) } + nstate[n] = val } return nstate } @@ -20595,12 +37487,12 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var info while (mode.innerMode) { - info = mode.innerMode(state); + info = mode.innerMode(state) if (!info || info.mode == mode) { break } - state = info.state; - mode = info.mode; + state = info.state + mode = info.mode } return info || {mode: mode, state: state} } @@ -20615,11 +37507,11 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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}; @@ -20630,34 +37522,34 @@ return /******/ (function(modules) { // webpackBootstrap { 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)); } + 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; + 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; } + 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.skipToEnd = function () {this.pos = this.string.length}; StringStream.prototype.skipTo = function (ch) { - var found = this.string.indexOf(ch, this.pos); + 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.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; + 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) }; @@ -20667,24 +37559,24 @@ return /******/ (function(modules) { // webpackBootstrap }; 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); + 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; } + if (consume !== false) { this.pos += pattern.length } return true } } else { - var match = this.string.slice(this.pos).match(pattern); + 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; } + 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; + this.lineStart += n try { return inner() } - finally { this.lineStart -= n; } + finally { this.lineStart -= n } }; // Compute a style array (an array starting with a mode generation @@ -20694,35 +37586,35 @@ return /******/ (function(modules) { // webpackBootstrap 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 = {}; + 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); + lineClasses, forceToEnd) // Run overlays, adjust style array. var loop = function ( o ) { - var overlay = cm.state.overlays[o], i = 1, at = 0; + var overlay = cm.state.overlays[o], i = 1, at = 0 runMode(cm, line.text, overlay.mode, true, function (end, style) { - var start = i; + 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]; + 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); + { 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; + 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; + var cur = st[start+1] + st[start+1] = (cur ? cur + " " : "") + "overlay " + style } } - }, lineClasses); + }, lineClasses) }; for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); @@ -20732,30 +37624,30 @@ return /******/ (function(modules) { // webpackBootstrap 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++; } + 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; + 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); } + 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; } + 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 } @@ -20763,27 +37655,27 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + 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; + 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); + 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 (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.") @@ -20796,72 +37688,72 @@ return /******/ (function(modules) { // webpackBootstrap 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 = []; } + 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)); } + 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+)/); + 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"; + 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]; } + { output[prop] = lineClass[2] } else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) - { output[prop] += " " + lineClass[2]; } + { 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); } + 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; + 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); + style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses) } if (inner) { - var mName = inner[0].name; - if (mName) { style = "m-" + (style ? mName + " " + style : mName); } + 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); + curStart = Math.min(stream.start, curStart + 5000) + f(curStart, curStyle) } - curStyle = style; + curStyle = style } - stream.start = stream.pos; + 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; + var pos = Math.min(stream.pos, curStart + 5000) + f(pos, curStyle) + curStart = pos } } @@ -20871,16 +37763,16 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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); + var line = getLine(doc, search - 1) if (line.stateAfter && (!precise || search <= doc.frontier)) { return search } - var indented = countColumn(line.text, null, cm.options.tabSize); + var indented = countColumn(line.text, null, cm.options.tabSize) if (minline == null || minindent > indented) { - minline = search - 1; - minindent = indented; + minline = search - 1 + minindent = indented } } return minline @@ -20891,32 +37783,32 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + this.text = text + attachMarkedSpans(this, markedSpans) + this.height = estimateHeight ? estimateHeight(this) : 1 }; Line.prototype.lineNo = function () { return lineNo(this) }; - eventMixin(Line); + 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); } + 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); + line.parent = null + detachMarkedSpans(line) } // Convert a style as returned by a mode (either null, or a string @@ -20926,7 +37818,7 @@ return /******/ (function(modules) { // webpackBootstrap var styleToClassCacheWithMode = {}; function interpretTokenStyle(style, options) { if (!style || /^\s*$/.test(style)) { return null } - var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; + var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache return cache[style] || (cache[style] = style.replace(/\S+/g, "cm-$&")) } @@ -20940,64 +37832,67 @@ return /******/ (function(modules) { // webpackBootstrap // 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, + var content = elt("span", null, null, webkit ? "padding-right: .1px" : null) + var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content, col: 0, pos: 0, cm: cm, trailingSpace: false, - splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}; - lineView.measure = {}; + splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")} + // hide from accessibility tree + content.setAttribute("role", "presentation") + builder.pre.setAttribute("role", "presentation") + 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; + 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 (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) + { 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 || ""); } + { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") } if (line.styleClasses.textClass) - { builder.textClass = joinClasses(line.styleClasses.textClass, builder.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))); } + { 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 = {}; + 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({}); + ;(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; + 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"; } + { builder.content.className = "cm-tab-wrap-hack" } } - signal(cm, "renderLine", cm, lineView.line, builder.pre); + signal(cm, "renderLine", cm, lineView.line, builder.pre) if (builder.pre.className) - { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); } + { 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); + var token = elt("span", "\u2022", "cm-invalidchar") + token.title = "\\u" + ch.charCodeAt(0).toString(16) + token.setAttribute("aria-label", token.title) return token } @@ -21005,75 +37900,75 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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; + 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; + 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; + 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; + 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); + 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; + 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; + 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; + 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.map.push(builder.pos, builder.pos + 1, txt$1) + builder.pos++ } } - builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32; + 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; } + 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); + builder.content.appendChild(content) } function splitSpaces(text, trailingBefore) { if (text.length > 1 && !/ /.test(text)) { return text } - var spaceBefore = trailingBefore, result = ""; + var spaceBefore = trailingBefore, result = "" for (var i = 0; i < text.length; i++) { - var ch = text.charAt(i); + var ch = text.charAt(i) if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) - { ch = "\u00a0"; } - result += ch; - spaceBefore = ch == " "; + { ch = "\u00a0" } + result += ch + spaceBefore = ch == " " } return result } @@ -21082,106 +37977,106 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + var part = (void 0) for (var i = 0; i < order.length; i++) { - part = order[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; + 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); } + 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); + { 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.cm.display.input.setUneditable(widget) + builder.content.appendChild(widget) } - builder.pos += size; - builder.trailingSpace = false; + 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; + 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)); } + { 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; + 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); + 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; + var sp = spans[j], m = sp.marker if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { - foundBookmarks.push(m); + 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 = ""; + 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.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; } + { collapsed = sp } } else if (sp.from > pos && nextChange > sp.from) { - 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 (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]); } } + { 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); + collapsed.marker, collapsed.from == null) if (collapsed.to == null) { return } - if (collapsed.to == pos) { collapsed = false; } + if (collapsed.to == pos) { collapsed = false } } } if (pos >= len) { break } - var upto = Math.min(len, nextChange); + var upto = Math.min(len, nextChange) while (true) { if (text) { - var end = pos + text.length; + var end = pos + text.length if (!collapsed) { - var tokenText = end > upto ? text.slice(0, upto - pos) : text; + 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); + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css) } if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} - pos = end; - spanStartStyle = ""; + pos = end + spanStartStyle = "" } - text = allText.slice(at, at = styles[i++]); - style = interpretTokenStyle(styles[i++], builder.cm.options); + text = allText.slice(at, at = styles[i++]) + style = interpretTokenStyle(styles[i++], builder.cm.options) } } } @@ -21192,67 +38087,67 @@ return /******/ (function(modules) { // webpackBootstrap // logical lines, if those are connected by collapsed ranges. function LineView(doc, line, lineN) { // The starting line - this.line = line; + this.line = line // Continuing lines, if any - this.rest = visualLineContinued(line); + 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); + 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; + 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); + var view = new LineView(cm.doc, getLine(cm.doc, pos), pos) + nextPos = pos + view.size + array.push(view) } return array } - var operationGroup = null; + var operationGroup = null function pushOperation(op) { if (operationGroup) { - operationGroup.ops.push(op); + 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; + var callbacks = group.delayedCallbacks, i = 0 do { for (; i < callbacks.length; i++) - { callbacks[i].call(null); } + { callbacks[i].call(null) } for (var j = 0; j < group.ops.length; j++) { - var op = group.ops[j]; + var op = group.ops[j] if (op.cursorActivityHandlers) { while (op.cursorActivityCalled < op.cursorActivityHandlers.length) - { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } } + { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } } } } while (i < callbacks.length) } function finishOperation(op, endCb) { - var group = op.ownsGroup; + var group = op.ownsGroup if (!group) { return } - try { fireCallbacksForOps(group); } + try { fireCallbacksForOps(group) } finally { - operationGroup = null; - endCb(group); + operationGroup = null + endCb(group) } } - var orphanDelayedCallbacks = null; + 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 @@ -21262,19 +38157,19 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + var arr = getHandlers(emitter, type) if (!arr.length) { return } - var args = Array.prototype.slice.call(arguments, 2), list; + var args = Array.prototype.slice.call(arguments, 2), list if (operationGroup) { - list = operationGroup.delayedCallbacks; + list = operationGroup.delayedCallbacks } else if (orphanDelayedCallbacks) { - list = orphanDelayedCallbacks; + list = orphanDelayedCallbacks } else { - list = orphanDelayedCallbacks = []; - setTimeout(fireOrphanDelayed, 0); + list = orphanDelayedCallbacks = [] + setTimeout(fireOrphanDelayed, 0) } var loop = function ( i ) { - list.push(function () { return arr[i].apply(null, args); }); + list.push(function () { return arr[i].apply(null, args); }) }; for (var i = 0; i < arr.length; ++i) @@ -21282,9 +38177,9 @@ return /******/ (function(modules) { // webpackBootstrap } function fireOrphanDelayed() { - var delayed = orphanDelayedCallbacks; - orphanDelayedCallbacks = null; - for (var i = 0; i < delayed.length; ++i) { delayed[i](); } + 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 @@ -21292,48 +38187,47 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + 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(lineView) } + else if (type == "widget") { updateLineWidgets(cm, lineView, dims) } } - lineView.changes = null; + 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"); + 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; } + { 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"; } + function updateLineBackground(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; } + 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); + var wrap = ensureLineWrapped(lineView) + lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild) } } // Wrapper around buildLineContent which will reuse the structure // in display.externalMeasured when possible. function getLineContent(cm, lineView) { - var ext = cm.display.externalMeasured; + var ext = cm.display.externalMeasured if (ext && ext.line == lineView.line) { - cm.display.externalMeasured = null; - lineView.measure = ext.measure; + cm.display.externalMeasured = null + lineView.measure = ext.measure return ext.built } return buildLineContent(cm, lineView) @@ -21343,144 +38237,143 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + lineView.bgClass = built.bgClass + lineView.textClass = built.textClass + updateLineClasses(lineView) } else if (cls) { - lineView.text.className = cls; + lineView.text.className = cls } } - function updateLineClasses(cm, lineView) { - updateLineBackground(cm, lineView); + function updateLineClasses(lineView) { + updateLineBackground(lineView) if (lineView.line.wrapClass) - { ensureLineWrapped(lineView).className = 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 || ""; + { 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; + lineView.node.removeChild(lineView.gutter) + lineView.gutter = null } if (lineView.gutterBackground) { - lineView.node.removeChild(lineView.gutterBackground); - lineView.gutterBackground = null; + lineView.node.removeChild(lineView.gutterBackground) + lineView.gutterBackground = null } if (lineView.line.gutterClass) { - var wrap = ensureLineWrapped(lineView); + 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); + ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px")) + wrap.insertBefore(lineView.gutterBackground, lineView.text) } - var markers = lineView.line.gutterMarkers; + 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); + 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; } + { 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"))); } + ("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]; + 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"))); } + ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) } } } } } function updateLineWidgets(cm, lineView, dims) { - if (lineView.alignable) { lineView.alignable = null; } + if (lineView.alignable) { lineView.alignable = null } for (var node = lineView.node.firstChild, next = (void 0); node; node = next) { - next = node.nextSibling; + next = node.nextSibling if (node.className == "CodeMirror-linewidget") - { lineView.node.removeChild(node); } + { lineView.node.removeChild(node) } } - insertLineWidgets(cm, lineView, dims); + 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; } + 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); + updateLineClasses(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); + 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); } } + { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } } } function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { if (!line.widgets) { return } - var wrap = ensureLineWrapped(lineView); + 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); + 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); } + { wrap.insertBefore(node, lineView.gutter || lineView.text) } else - { wrap.appendChild(node); } - signalLater(widget, "redraw"); + { 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"; + ;(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"; + width -= dims.gutterTotalWidth + node.style.paddingLeft = dims.gutterTotalWidth + "px" } - node.style.width = width + "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"; } + 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; + var cm = widget.doc.cm if (!cm) { return 0 } if (!contains(document.body, widget.node)) { - var parentStyle = "position: relative;"; + var parentStyle = "position: relative;" if (widget.coverGutter) - { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; } + { 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)); + { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" } + removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)) } return widget.height = widget.node.parentNode.offsetHeight } @@ -21500,10 +38393,10 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + 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 } @@ -21520,20 +38413,20 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + var wrapping = cm.options.lineWrapping + var curWidth = wrapping && displayWidth(cm) if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { - var heights = lineView.measure.heights = []; + var heights = lineView.measure.heights = [] if (wrapping) { - lineView.measure.width = curWidth; - var rects = lineView.text.firstChild.getClientRects(); + 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]; + 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((cur.bottom + next.top) / 2 - rect.top) } } } - heights.push(rect.bottom - rect.top); + heights.push(rect.bottom - rect.top) } } @@ -21554,13 +38447,13 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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 } @@ -21574,7 +38467,7 @@ return /******/ (function(modules) { // webpackBootstrap 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; + var ext = cm.display.externalMeasured if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) { return ext } } @@ -21585,18 +38478,18 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + var lineN = lineNo(line) + var view = findViewForLine(cm, lineN) if (view && !view.text) { - view = null; + view = null } else if (view && view.changes) { - updateLineForChanges(cm, view, lineN, getDimensions(cm)); - cm.curOp.forceUpdate = true; + updateLineForChanges(cm, view, lineN, getDimensions(cm)) + cm.curOp.forceUpdate = true } if (!view) - { view = updateExternalMeasurement(cm, line); } + { view = updateExternalMeasurement(cm, line) } - var info = mapFromLineView(view, line, lineN); + var info = mapFromLineView(view, line, lineN) return { line: line, view: view, rect: null, map: info.map, cache: info.cache, before: info.before, @@ -21607,58 +38500,58 @@ return /******/ (function(modules) { // webpackBootstrap // 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.before) { ch = -1 } + var key = ch + (bias || ""), found if (prepared.cache.hasOwnProperty(key)) { - found = prepared.cache[key]; + found = prepared.cache[key] } else { if (!prepared.rect) - { prepared.rect = prepared.view.text.getBoundingClientRect(); } + { prepared.rect = prepared.view.text.getBoundingClientRect() } if (!prepared.hasHeights) { - ensureLineHeights(cm, prepared.view, prepared.rect); - prepared.hasHeights = true; + ensureLineHeights(cm, prepared.view, prepared.rect) + prepared.hasHeights = true } - found = measureCharInner(cm, prepared, ch, bias); - if (!found.bogus) { prepared.cache[key] = found; } + 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}; + var nullRect = {left: 0, right: 0, top: 0, bottom: 0} - function nodeAndOffsetInLineMap(map$$1, ch, bias) { - var node, start, end, collapse, mStart, mEnd; + function nodeAndOffsetInLineMap(map, 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]; + for (var i = 0; i < map.length; i += 3) { + mStart = map[i] + mEnd = map[i + 1] if (ch < mStart) { - start = 0; end = 1; - collapse = "left"; + 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"; } + start = ch - mStart + end = start + 1 + } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { + end = mEnd - mStart + start = end - 1 + if (ch >= mEnd) { collapse = "right" } } if (start != null) { - node = map$$1[i + 2]; + node = map[i + 2] if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) - { collapse = bias; } + { 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"; + { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { + node = map[(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"; + { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { + node = map[(i += 3) + 2] + collapse = "right" } } break } @@ -21667,7 +38560,7 @@ return /******/ (function(modules) { // webpackBootstrap } function getUsefulRect(rects, bias) { - var rect = nullRect; + 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--) { @@ -21677,52 +38570,52 @@ return /******/ (function(modules) { // webpackBootstrap } 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 place = nodeAndOffsetInLineMap(prepared.map, ch, bias) + var node = place.node, start = place.start, end = place.end, collapse = place.collapse - var rect; + 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; } + 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(); } + { rect = node.parentNode.getBoundingClientRect() } else - { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); } + { rect = getUsefulRect(range(node, start, end).getClientRects(), bias) } if (rect.left || rect.right || start == 0) { break } - end = start; - start = start - 1; - collapse = "right"; + end = start + start = start - 1 + collapse = "right" } - if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); } + 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 (start > 0) { collapse = bias = "right" } + var rects if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) - { rect = rects[bias == "right" ? rects.length - 1 : 0]; } + { rect = rects[bias == "right" ? rects.length - 1 : 0] } else - { rect = node.getBoundingClientRect(); } + { rect = node.getBoundingClientRect() } } if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { - var rSpan = node.parentNode.getClientRects()[0]; + var rSpan = node.parentNode.getClientRects()[0] if (rSpan) - { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; } + { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} } else - { rect = nullRect; } + { 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; + 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 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; } + top: top, bottom: bot} + if (!rect.left && !rect.right) { result.bogus = true } + if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot } return result } @@ -21733,33 +38626,33 @@ return /******/ (function(modules) { // webpackBootstrap 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; + 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; + lineView.measure.cache = {} + lineView.measure.heights = null if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) - { lineView.measure.caches[i] = {}; } } + { lineView.measure.caches[i] = {} } } } } function clearLineMeasurementCache(cm) { - cm.display.externalMeasure = null; - removeChildren(cm.display.lineMeasure); + cm.display.externalMeasure = null + removeChildren(cm.display.lineMeasure) for (var i = 0; i < cm.display.view.length; i++) - { clearLineMeasurementCacheFor(cm.display.view[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; + 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 } @@ -21771,21 +38664,21 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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) { 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; + 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; + rect.top += yOff; rect.bottom += yOff return rect } @@ -21793,23 +38686,23 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var left = coords.left, top = coords.top // First move into "page" coordinate system if (context == "page") { - left -= pageScrollX(); - top -= pageScrollY(); + left -= pageScrollX() + top -= pageScrollY() } else if (context == "local" || !context) { - var localBox = cm.display.sizer.getBoundingClientRect(); - left += localBox.left; - top += localBox.top; + var localBox = cm.display.sizer.getBoundingClientRect() + left += localBox.left + top += localBox.top } - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); + 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); } + if (!lineObj) { lineObj = getLine(cm.doc, pos.line) } return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context) } @@ -21830,42 +38723,42 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + 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; } + 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; + var order = getOrder(lineObj), ch = pos.ch, sticky = pos.sticky if (ch >= lineObj.text.length) { - ch = lineObj.text.length; - sticky = "before"; + ch = lineObj.text.length + sticky = "before" } else if (ch <= 0) { - ch = 0; - sticky = "after"; + 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; + 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"); } + 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); + 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} } @@ -21876,139 +38769,139 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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; + 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; + 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; } + if (x < 0) { x = 0 } - var lineObj = getLine(doc, lineN); + 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); + 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); } + { 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); + 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; + 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); + function coordsCharInner(cm, lineObj, lineNo, x, y) { + y -= heightAtLine(lineObj) + var begin = 0, end = lineObj.text.length + var preparedMeasure = prepareMeasureForLine(cm, lineObj) + var pos + var order = getOrder(lineObj) if (order) { if (cm.options.lineWrapping) { - var assign; - ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign)); + ;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; + pos = new Pos(lineNo, 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); + 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; + pos = prevPos break } - diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x; + 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; + pos = prevPos } } else { var ch = findFirst(function (ch) { - var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); + var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line") if (box.top > y) { // For the cursor stickiness - end = Math.min(ch, end); + 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"); + }, begin, end) + ch = skipExtendingChars(lineObj.text, ch, 1) + pos = new Pos(lineNo, 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); + 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; + var measureText // Compute the default text height. function textHeight(display) { if (display.cachedTextHeight != null) { return display.cachedTextHeight } if (measureText == null) { - measureText = elt("pre"); + 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")) + measureText.appendChild(elt("br")) } - measureText.appendChild(document.createTextNode("x")); + measureText.appendChild(document.createTextNode("x")) } - removeChildrenAndAdd(display.measure, measureText); - var height = measureText.offsetHeight / 50; - if (height > 3) { display.cachedTextHeight = height; } - removeChildren(display.measure); + 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; } + 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; + 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; + 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, @@ -22028,14 +38921,14 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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; + 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 (line.widgets[i].height) { widgetsHeight += line.widgets[i].height } } } if (wrapping) @@ -22046,11 +38939,11 @@ return /******/ (function(modules) { // webpackBootstrap } function estimateLineHeights(cm) { - var doc = cm.doc, est = estimateHeight(cm); + var doc = cm.doc, est = estimateHeight(cm) doc.iter(function (line) { - var estHeight = est(line); - if (estHeight != line.height) { updateLineHeight(line, estHeight); } - }); + var estHeight = est(line) + if (estHeight != line.height) { updateLineHeight(line, estHeight) } + }) } // Given a mouse event, find the corresponding position. If liberal @@ -22059,17 +38952,17 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var display = cm.display if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } - var x, y, space = display.lineSpace.getBoundingClientRect(); + 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; } + try { x = e.clientX - space.left; y = e.clientY - space.top } catch (e) { return null } - var coords = coordsChar(cm, x, y), line; + 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)); + 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 } @@ -22078,206 +38971,206 @@ return /******/ (function(modules) { // webpackBootstrap // when the line isn't visible. function findViewIndex(cm, n) { if (n >= cm.display.viewTo) { return null } - n -= cm.display.viewFrom; + n -= cm.display.viewFrom if (n < 0) { return null } - var view = cm.display.view; + var view = cm.display.view for (var i = 0; i < view.length; i++) { - n -= view[i].size; + n -= view[i].size if (n < 0) { return i } } } function updateSelection(cm) { - cm.display.input.showSelection(cm.display.input.prepareSelection()); + 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(); + 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(); + var range = doc.sel.ranges[i] + if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } + var collapsed = range.empty() if (collapsed || cm.options.showCursorWhenSelecting) - { drawSelectionCursor(cm, range$$1.head, curFragment); } + { drawSelectionCursor(cm, range.head, curFragment) } if (!collapsed) - { drawSelectionRange(cm, range$$1, selFragment); } + { drawSelectionRange(cm, range, 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 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"; + 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"; + 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 drawSelectionRange(cm, range, 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"))); + 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; + 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; + iterateBidiSections(getOrder(lineObj), 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; + 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; + 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 (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); } + 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 (toArg == null && to == lineLen) { right = rightSide } if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) - { start = leftPos; } + { 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); - }); + { 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(); + var sFrom = range.from(), sTo = range.to() if (sFrom.line == sTo.line) { - drawForLine(sFrom.line, sFrom.ch, sTo.ch); + 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; + 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); + 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); + add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom) } } if (leftEnd.bottom < rightStart.top) - { add(leftSide, leftEnd.bottom, null, rightStart.top); } + { add(leftSide, leftEnd.bottom, null, rightStart.top) } } - output.appendChild(fragment); + 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 = ""; + 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); } + cm.options.cursorBlinkRate) } else if (cm.options.cursorBlinkRate < 0) - { display.cursorDiv.style.visibility = "hidden"; } + { display.cursorDiv.style.visibility = "hidden" } } function ensureFocus(cm) { - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); } + if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) } } function delayBlurEvent(cm) { - cm.state.delayingBlurEvent = true; + cm.state.delayingBlurEvent = true setTimeout(function () { if (cm.state.delayingBlurEvent) { - cm.state.delayingBlurEvent = false; - onBlur(cm); - } }, 100); + cm.state.delayingBlurEvent = false + onBlur(cm) + } }, 100) } function onFocus(cm, e) { - if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; } + 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"); + 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.reset() + if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730 } - cm.display.input.receivedFocus(); + cm.display.input.receivedFocus() } - restartBlink(cm); + 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"); + 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); + 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; + 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"; + 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; } + { view[i].gutter.style.left = left } if (view[i].gutterBackground) - { view[i].gutterBackground.style.left = left; } + { view[i].gutterBackground.style.left = left } } - var align = view[i].alignable; + var align = view[i].alignable if (align) { for (var j = 0; j < align.length; j++) - { align[j].style.left = left; } } + { align[j].style.left = left } } } } if (cm.options.fixedGutter) - { display.gutters.style.left = (comp + gutterW) + "px"; } + { display.gutters.style.left = (comp + gutterW) + "px" } } // Used to ensure that the line number gutter is still the right @@ -22285,17 +39178,17 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + "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 @@ -22304,26 +39197,26 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + 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; + 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 box = cur.node.getBoundingClientRect() + height = box.bottom - box.top } - var diff = cur.line.height - height; - if (height < 2) { height = textHeight(display); } + var diff = cur.line.height - height + if (height < 2) { height = textHeight(display) } if (diff > .001 || diff < -.001) { - updateLineHeight(cur.line, height); - updateWidgetHeight(cur.line); + updateLineHeight(cur.line, height) + updateWidgetHeight(cur.line) if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) - { updateWidgetHeight(cur.rest[j]); } } + { updateWidgetHeight(cur.rest[j]) } } } } } @@ -22332,28 +39225,28 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } } + { 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 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); + 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; + 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); + 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; + from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight) + to = ensureTo } } return {from: from, to: Math.max(to, from + 1)} @@ -22363,22 +39256,22 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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); + 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 @@ -22398,32 +39291,32 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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; } + 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; + 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 delta = wheelEventDelta(e), dx = delta.x, dy = delta.y - var display = cm.display, scroll = display.scroller; + 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; + 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 @@ -22434,7 +39327,7 @@ return /******/ (function(modules) { // webpackBootstrap 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; + cm.display.currentWheelTarget = cur break outer } } @@ -22449,45 +39342,45 @@ return /******/ (function(modules) { // webpackBootstrap // 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))); + { 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 + { 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}); + 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; + 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 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; + (movedX && display.wheelDX && movedX / display.wheelDX) + display.wheelStartX = display.wheelStartY = null if (!sample) { return } - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); - ++wheelSamples; - }, 200); + wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1) + ++wheelSamples + }, 200) } else { - display.wheelDX += dx; display.wheelDY += dy; + display.wheelDX += dx; display.wheelDY += dy } } } @@ -22497,8 +39390,8 @@ return /******/ (function(modules) { // webpackBootstrap // 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)); + 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, @@ -22513,80 +39406,80 @@ return /******/ (function(modules) { // webpackBootstrap } 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); + 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"); } - }); + if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") } + }) on(horiz, "scroll", function () { - if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); } - }); + if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") } + }) - this.checkedZeroWidth = false; + 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"; } + 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; + 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); + 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"; + Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px" } else { - this.vert.style.display = ""; - this.vert.firstChild.style.height = "0"; + 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.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"; + Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px" } else { - this.horiz.style.display = ""; - this.horiz.firstChild.style.width = "0"; + this.horiz.style.display = "" + this.horiz.firstChild.style.width = "0" } if (!this.checkedZeroWidth && measure.clientHeight > 0) { - if (sWidth == 0) { this.zeroWidthHack(); } - this.checkedZeroWidth = true; + 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); } + 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); } + 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; + 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"; + 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 @@ -22594,18 +39487,18 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + var box = bar.getBoundingClientRect() + var elt = document.elementFromPoint(box.left + 1, box.bottom - 1) + if (elt != bar) { bar.style.pointerEvents = "none" } + else { delay.set(1000, maybeDisable) } } - 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 parent = this.horiz.parentNode + parent.removeChild(this.horiz) + parent.removeChild(this.vert) }; var NullScrollbars = function () {}; @@ -22616,78 +39509,78 @@ return /******/ (function(modules) { // webpackBootstrap 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); + 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; + { 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); + 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"; + 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 = ""; } + 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 = ""; } + 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}; + var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars} function initScrollbars(cm) { if (cm.display.scrollbars) { - cm.display.scrollbars.clear(); + cm.display.scrollbars.clear() if (cm.display.scrollbars.addClass) - { rmClass(cm.display.wrapper, 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); + 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"); + 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 (axis == "horizontal") { setScrollLeft(cm, pos) } + else { setScrollTop(cm, pos) } + }, cm) if (cm.display.scrollbars.addClass) - { addClass(cm.display.wrapper, 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) { + function maybeScrollWindow(cm, coords) { 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; } + var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null + if (coords.top + box.top < 0) { doScroll = true } + else if (coords.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); + var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (coords.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (coords.left) + "px; width: 2px;")) + cm.display.lineSpace.appendChild(scrollNode) + scrollNode.scrollIntoView(doScroll) + cm.display.lineSpace.removeChild(scrollNode) } } @@ -22695,90 +39588,89 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + if (margin == null) { margin = 0 } + var coords 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; + var changed = false + coords = cursorCoords(cm, pos) + var endCoords = !end || end == pos ? coords : cursorCoords(cm, end) + var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), + Math.min(coords.top, endCoords.top) - margin, + Math.max(coords.left, endCoords.left), + Math.max(coords.bottom, endCoords.bottom) + margin) + 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; } + 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; } + setScrollLeft(cm, scrollPos.scrollLeft) + if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true } } if (!changed) { break } } - return rect + return coords } // 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); } + function scrollIntoView(cm, x1, y1, x2, y2) { + var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2) + 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; } + function calculateScrollPos(cm, x1, y1, x2, y2) { + var display = cm.display, snapMargin = textHeight(cm.display) + if (y1 < 0) { y1 = 0 } + var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop + var screen = displayHeight(cm), result = {} + if (y2 - y1 > screen) { y2 = y1 + screen } + var docBottom = cm.doc.height + paddingVert(display) + var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin + if (y1 < screentop) { + result.scrollTop = atTop ? 0 : y1 + } else if (y2 > screentop + screen) { + var newTop = Math.min(y1, (atBottom ? docBottom : y2) - 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; } + 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 = x2 - x1 > screenw + if (tooWide) { x2 = x1 + screenw } + if (x1 < 10) + { result.scrollLeft = 0 } + else if (x1 < screenleft) + { result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)) } + else if (x2 > screenw + screenleft - 3) + { result.scrollLeft = x2 + (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 || top != null) { resolveScrollToPos(cm) } if (left != null) - { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; } + { 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; } + { 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; + 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); + 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}; + cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true} } // When an operation has its scrollToPos property set, and another @@ -22786,17 +39678,15 @@ return /******/ (function(modules) { // webpackBootstrap // '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); + var range = cm.curOp.scrollToPos + if (range) { + cm.curOp.scrollToPos = null + var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to) + var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), + Math.min(from.top, to.top) - range.margin, + Math.max(from.right, to.right), + Math.max(from.bottom, to.bottom) + range.margin) + cm.scrollTo(sPos.scrollLeft, sPos.scrollTop) } } @@ -22806,7 +39696,7 @@ return /******/ (function(modules) { // webpackBootstrap // error-prone). Instead, display updates are batched and then all // combined and executed at once. - var nextOpId = 0; + var nextOpId = 0 // Start a new operation. function startOperation(cm) { cm.curOp = { @@ -22825,159 +39715,159 @@ return /******/ (function(modules) { // webpackBootstrap scrollToPos: null, // Used to scroll to a specific position focus: false, id: ++nextOpId // Unique ID - }; - pushOperation(cm.curOp); + } + pushOperation(cm.curOp) } // Finish an operation, updating the display and signalling delayed events function endOperation(cm) { - var op = cm.curOp; + 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); - }); + { 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; + var ops = group.ops for (var i = 0; i < ops.length; i++) // Read DOM - { endOperation_R1(ops[i]); } + { endOperation_R1(ops[i]) } for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) - { endOperation_W1(ops[i$1]); } + { endOperation_W1(ops[i$1]) } for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM - { endOperation_R2(ops[i$2]); } + { endOperation_R2(ops[i$2]) } for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) - { endOperation_W2(ops[i$3]); } + { endOperation_W2(ops[i$3]) } for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM - { endOperation_finish(ops[i$4]); } + { endOperation_finish(ops[i$4]) } } function endOperation_R1(op) { - var cm = op.cm, display = cm.display; - maybeClipScrollbars(cm); - if (op.updateMaxLine) { findMaxLine(cm); } + 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; + display.maxLineChanged && cm.options.lineWrapping op.update = op.mustUpdate && - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); + 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); + 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); } + var cm = op.cm, display = cm.display + if (op.updatedDisplay) { updateHeightsInViewport(cm) } - op.barMeasure = measureForScrollbars(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.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)); + 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); } + { op.preparedSelection = display.input.prepareSelection(op.focus) } } function endOperation_W2(op) { - var cm = op.cm; + var cm = op.cm if (op.adjustWidthTo != null) { - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; + 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; + { 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()); + var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()) if (op.preparedSelection) - { cm.display.input.showSelection(op.preparedSelection, takeFocus); } + { cm.display.input.showSelection(op.preparedSelection, takeFocus) } if (op.updatedDisplay || op.startHeight != cm.doc.height) - { updateScrollbars(cm, op.barMeasure); } + { updateScrollbars(cm, op.barMeasure) } if (op.updatedDisplay) - { setDocumentHeight(cm, op.barMeasure); } + { setDocumentHeight(cm, op.barMeasure) } - if (op.selectionChanged) { restartBlink(cm); } + if (op.selectionChanged) { restartBlink(cm) } if (cm.state.focused && op.updateInput) - { cm.display.input.reset(op.typing); } - if (takeFocus) { ensureFocus(op.cm); } + { 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; + var cm = op.cm, display = cm.display, doc = cm.doc - if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); } + 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; } + { 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; + 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); + 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); + var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), + clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin) + if (op.scrollToPos.isCursor && cm.state.focused) { maybeScrollWindow(cm, coords) } } // Fire events for markers that are hidden/unidden by editing or // undoing - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; + 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 (!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 (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } } if (display.wrapper.offsetHeight) - { doc.scrollTop = cm.display.scroller.scrollTop; } + { doc.scrollTop = cm.display.scroller.scrollTop } // Fire change events, and delayed event handlers if (op.changeObjs) - { signal(cm, "changes", cm, op.changeObjs); } + { signal(cm, "changes", cm, op.changeObjs) } if (op.update) - { op.update.finish(); } + { op.update.finish() } } // Run the given function in an operation function runInOp(cm, f) { if (cm.curOp) { return f() } - startOperation(cm); + startOperation(cm) try { return f() } - finally { endOperation(cm); } + 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); + startOperation(cm) try { return f.apply(cm, arguments) } - finally { endOperation(cm); } + finally { endOperation(cm) } } } // Used to add methods to editor and doc instances, wrapping them in @@ -22985,18 +39875,18 @@ return /******/ (function(modules) { // webpackBootstrap function methodOp(f) { return function() { if (this.curOp) { return f.apply(this, arguments) } - startOperation(this); + startOperation(this) try { return f.apply(this, arguments) } - finally { endOperation(this); } + finally { endOperation(this) } } } function docMethodOp(f) { return function() { - var cm = this.cm; + var cm = this.cm if (!cm || cm.curOp) { return f.apply(this, arguments) } - startOperation(cm); + startOperation(cm) try { return f.apply(this, arguments) } - finally { endOperation(cm); } + finally { endOperation(cm) } } } @@ -23007,111 +39897,111 @@ return /******/ (function(modules) { // webpackBootstrap // 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; } + 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; + var display = cm.display if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers > from)) - { display.updateLineNumbers = from; } + { display.updateLineNumbers = from } - cm.curOp.viewChanged = true; + cm.curOp.viewChanged = true if (from >= display.viewTo) { // Change after if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) - { resetView(cm); } + { resetView(cm) } } else if (to <= display.viewFrom) { // Change before if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { - resetView(cm); + resetView(cm) } else { - display.viewFrom += lendiff; - display.viewTo += lendiff; + display.viewFrom += lendiff + display.viewTo += lendiff } } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap - resetView(cm); + resetView(cm) } else if (from <= display.viewFrom) { // Top overlap - var cut = viewCuttingPoint(cm, to, to + lendiff, 1); + var cut = viewCuttingPoint(cm, to, to + lendiff, 1) if (cut) { - display.view = display.view.slice(cut.index); - display.viewFrom = cut.lineN; - display.viewTo += lendiff; + display.view = display.view.slice(cut.index) + display.viewFrom = cut.lineN + display.viewTo += lendiff } else { - resetView(cm); + resetView(cm) } } else if (to >= display.viewTo) { // Bottom overlap - var cut$1 = viewCuttingPoint(cm, from, from, -1); + 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; + display.view = display.view.slice(0, cut$1.index) + display.viewTo = cut$1.lineN } else { - resetView(cm); + resetView(cm) } } else { // Gap in the middle - var cutTop = viewCuttingPoint(cm, from, from, -1); - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); + 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; + .concat(display.view.slice(cutBot.index)) + display.viewTo += lendiff } else { - resetView(cm); + resetView(cm) } } - var ext = display.externalMeasured; + var ext = display.externalMeasured if (ext) { if (to < ext.lineN) - { ext.lineN += lendiff; } + { ext.lineN += lendiff } else if (from < ext.lineN + ext.size) - { display.externalMeasured = null; } + { 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; + 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; } + { display.externalMeasured = null } if (line < display.viewFrom || line >= display.viewTo) { return } - var lineView = display.view[findViewIndex(cm, line)]; + 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); } + 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; + 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; + 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; + var n = cm.display.viewFrom for (var i = 0; i < index; i++) - { n += view[i].size; } + { n += view[i].size } if (n != oldN) { if (dir > 0) { if (index == view.length - 1) { return null } - diff = (n + view[index].size) - oldN; - index++; + diff = (n + view[index].size) - oldN + index++ } else { - diff = n - oldN; + diff = n - oldN } - oldN += diff; newN += diff; + 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; + newN += dir * view[index - (dir < 0 ? 1 : 0)].size + index += dir } return {index: index, lineN: newN} } @@ -23119,31 +40009,31 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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; + display.view = buildViewArray(cm, from, to) + display.viewFrom = from } else { if (display.viewFrom > from) - { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); } + { 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; + { 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)); } + { 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.view = display.view.slice(0, findViewIndex(cm, to)) } } - display.viewTo = 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; + 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; } + var lineView = view[i] + if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty } } return dirty } @@ -23152,83 +40042,83 @@ return /******/ (function(modules) { // webpackBootstrap function startWorker(cm, time) { if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) - { cm.state.highlight.set(time, bind(highlightWorker, cm)); } + { cm.state.highlight.set(time, bind(highlightWorker, cm)) } } function highlightWorker(cm) { - var doc = cm.doc; - if (doc.frontier < doc.first) { doc.frontier = doc.first; } + 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 = []; + 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 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); + 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; + { processLine(cm, line.text, state) } + line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null } - ++doc.frontier; + ++doc.frontier if (+new Date > end) { - startWorker(cm, cm.options.workDelay); + 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"); } - }); } + { regLineChange(cm, changedLines[i], "text") } + }) } } // DISPLAY DRAWING var DisplayUpdate = function(cm, viewport, force) { - var display = cm.display; + var display = cm.display - this.viewport = viewport; + 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 = []; + 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); } + { 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]); } + { signal.apply(null, this$1.events[i]) } }; function maybeClipScrollbars(cm) { - var display = cm.display; + 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; + 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 } } @@ -23236,10 +40126,10 @@ return /******/ (function(modules) { // webpackBootstrap // (returning false) when there is nothing to be done and forced is // false. function updateDisplayIfNeeded(cm, update) { - var display = cm.display, doc = cm.doc; + var display = cm.display, doc = cm.doc if (update.editorIsHidden) { - resetView(cm); + resetView(cm) return false } @@ -23251,101 +40141,101 @@ return /******/ (function(modules) { // webpackBootstrap { return false } if (maybeUpdateLineNumberWidth(cm)) { - resetView(cm); - update.dims = getDimensions(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); } + 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); + 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.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth + adjustView(cm, from, to) - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); + 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"; + cm.display.mover.style.top = display.viewOffset + "px" - var toUpdate = countDirtyView(cm); + 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; + 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(); } + 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; + 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.lastWrapHeight = update.wrapperHeight + display.lastWrapWidth = update.wrapperWidth + startWorker(cm, 400) } - display.updateLineNumbers = null; + display.updateLineNumbers = null return true } function postUpdateDisplay(cm, update) { - var viewport = update.viewport; + 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)}; } + { 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); + 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); + updateHeightsInViewport(cm) + var barMeasure = measureForScrollbars(cm) + updateSelection(cm) + updateScrollbars(cm, barMeasure) + setDocumentHeight(cm, barMeasure) } - update.signal(cm, "update", cm); + 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; + 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); + 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(); + updateHeightsInViewport(cm) + postUpdateDisplay(cm, update) + var barMeasure = measureForScrollbars(cm) + updateSelection(cm) + updateScrollbars(cm, barMeasure) + setDocumentHeight(cm, barMeasure) + update.finish() } } @@ -23354,85 +40244,85 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var display = cm.display, lineNumbers = cm.options.lineNumbers + var container = display.lineDiv, cur = container.firstChild function rm(node) { - var next = node.nextSibling; + 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"; } + { node.style.display = "none" } else - { node.parentNode.removeChild(node); } + { node.parentNode.removeChild(node) } return next } - var view = display.view, lineN = display.viewFrom; + 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]; + 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); + var node = buildLineElement(cm, lineView, lineN, dims) + container.insertBefore(node, cur) } else { // Already drawn - while (cur != lineView.node) { cur = rm(cur); } + while (cur != lineView.node) { cur = rm(cur) } var updateNumber = lineNumbers && updateNumbersFrom != null && - updateNumbersFrom <= lineN && lineView.lineNumber; + updateNumbersFrom <= lineN && lineView.lineNumber if (lineView.changes) { - if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; } - updateLineForChanges(cm, lineView, lineN, dims); + 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))); + removeChildren(lineView.lineNumber) + lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))) } - cur = lineView.node.nextSibling; + cur = lineView.node.nextSibling } - lineN += lineView.size; + lineN += lineView.size } - while (cur) { cur = rm(cur); } + while (cur) { cur = rm(cur) } } function updateGutterSpace(cm) { - var width = cm.display.gutters.offsetWidth; - cm.display.sizer.style.marginLeft = width + "px"; + 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"; + 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; + 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)); + 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"; + cm.display.lineGutter = gElt + gElt.style.width = (cm.display.lineNumWidth || 1) + "px" } } - gutters.style.display = i ? "" : "none"; - updateGutterSpace(cm); + 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"); + var found = indexOf(options.gutters, "CodeMirror-linenumbers") if (found == -1 && options.lineNumbers) { - options.gutters = options.gutters.concat(["CodeMirror-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); + options.gutters = options.gutters.slice(0) + options.gutters.splice(found, 1) } } @@ -23442,8 +40332,8 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + this.ranges = ranges + this.primIndex = primIndex }; Selection.prototype.primary = function () { return this.ranges[this.primIndex] }; @@ -23454,7 +40344,7 @@ return /******/ (function(modules) { // webpackBootstrap 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]; + 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 @@ -23463,9 +40353,9 @@ return /******/ (function(modules) { // webpackBootstrap Selection.prototype.deepCopy = function () { var this$1 = this; - var out = []; + 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)); } + { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) } return new Selection(out, this.primIndex) }; @@ -23480,9 +40370,9 @@ return /******/ (function(modules) { // webpackBootstrap Selection.prototype.contains = function (pos, end) { var this$1 = this; - if (!end) { end = pos; } + if (!end) { end = pos } for (var i = 0; i < this.ranges.length; i++) { - var range = this$1.ranges[i]; + var range = this$1.ranges[i] if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) { return i } } @@ -23490,7 +40380,7 @@ return /******/ (function(modules) { // webpackBootstrap }; var Range = function(anchor, head) { - this.anchor = anchor; this.head = head; + this.anchor = anchor; this.head = head }; Range.prototype.from = function () { return minPos(this.anchor, this.head) }; @@ -23501,16 +40391,16 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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]; + 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)); + 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) @@ -23534,17 +40424,17 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + 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 = []; + var out = [] for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; + var range = doc.sel.ranges[i] out.push(new Range(adjustForChange(range.anchor, change), - adjustForChange(range.head, change))); + adjustForChange(range.head, change))) } return normalizeSelection(out, doc.sel.primIndex) } @@ -23559,19 +40449,19 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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; + 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); + 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); + out[i] = new Range(from, from) } } return new Selection(out, doc.sel.primIndex) @@ -23580,19 +40470,19 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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); } + 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 @@ -23606,117 +40496,105 @@ return /******/ (function(modules) { // webpackBootstrap } // Perform a change on the document data structure. - function updateDoc(doc, change, markedSpans, estimateHeight$$1) { + function updateDoc(doc, change, markedSpans, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { - updateLine(line, text, spans, estimateHeight$$1); - signalLater(line, "change", line, change); + updateLine(line, text, spans, estimateHeight) + signalLater(line, "change", line, change) } function linesFor(start, end) { - var result = []; + var result = [] for (var i = start; i < end; ++i) - { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); } + { result.push(new Line(text[i], spansFor(i), estimateHeight)) } 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; + 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); + 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); } + 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); + 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); + var added$1 = linesFor(1, text.length - 1) + added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)) + 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); + 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); + 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); + 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]; + var rel = doc.linked[i] if (rel.doc == skip) { continue } - var shared = sharedHist && rel.sharedHist; + var shared = sharedHist && rel.sharedHist if (sharedHistOnly && !shared) { continue } - f(rel.doc, shared); - propagate(rel.doc, doc, shared); + f(rel.doc, shared) + propagate(rel.doc, doc, shared) } } } - propagate(doc, null, true); + 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); - }); + cm.doc = doc + doc.cm = cm + estimateLineHeights(cm) + loadMode(cm) + if (!cm.options.lineWrapping) { findMaxLine(cm) } + cm.options.mode = doc.modeOption + 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; + 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; + 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; + 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); + 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 } @@ -23724,8 +40602,8 @@ return /******/ (function(modules) { // webpackBootstrap // a change event. function clearSelectionEvents(array) { while (array.length) { - var last = lst(array); - if (last.ranges) { array.pop(); } + var last = lst(array) + if (last.ranges) { array.pop() } else { break } } } @@ -23734,12 +40612,12 @@ return /******/ (function(modules) { // webpackBootstrap // events that are in the way. function lastChangeEvent(hist, force) { if (force) { - clearSelectionEvents(hist.done); + 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(); + hist.done.pop() return lst(hist.done) } } @@ -23748,10 +40626,10 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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 && @@ -23759,39 +40637,39 @@ return /******/ (function(modules) { // webpackBootstrap change.origin.charAt(0) == "*")) && (cur = lastChangeEvent(hist, hist.lastOp == opId))) { // Merge this change into the last event - last = lst(cur.changes); + 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); + last.to = changeEnd(change) } else { // Add new sub-event - cur.changes.push(historyChangeFromChange(doc, change)); + cur.changes.push(historyChangeFromChange(doc, change)) } } else { // Can not be merged, start a new event. - var before = lst(hist.done); + var before = lst(hist.done) if (!before || !before.ranges) - { pushSelectionToHistory(doc.sel, hist.done); } + { pushSelectionToHistory(doc.sel, hist.done) } cur = {changes: [historyChangeFromChange(doc, change)], - generation: hist.generation}; - hist.done.push(cur); + 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.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; + 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"); } + if (!last) { signal(doc, "historyAdded") } } function selectionEventCanBeMerged(doc, origin, prev, sel) { - var ch = origin.charAt(0); + var ch = origin.charAt(0) return ch == "*" || ch == "+" && prev.ranges.length == sel.ranges.length && @@ -23804,7 +40682,7 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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 @@ -23814,52 +40692,52 @@ return /******/ (function(modules) { // webpackBootstrap (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; } + { hist.done[hist.done.length - 1] = sel } else - { pushSelectionToHistory(sel, hist.done); } + { pushSelectionToHistory(sel, hist.done) } - hist.lastSelTime = +new Date; - hist.lastSelOrigin = origin; - hist.lastSelOp = opId; + hist.lastSelTime = +new Date + hist.lastSelOrigin = origin + hist.lastSelOp = opId if (options && options.clearRedo !== false) - { clearSelectionEvents(hist.undone); } + { clearSelectionEvents(hist.undone) } } function pushSelectionToHistory(sel, dest) { - var top = lst(dest); + var top = lst(dest) if (!(top && top.ranges && top.equals(sel))) - { dest.push(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; + 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; - }); + { (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; + 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]); } + 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]; + var found = change["spans_" + doc.id] if (!found) { return null } - var nw = []; + var nw = [] for (var i = 0; i < change.text.length; ++i) - { nw.push(removeClearedSpans(found[i])); } + { nw.push(removeClearedSpans(found[i])) } return nw } @@ -23868,22 +40746,22 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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]; + var oldCur = old[i], stretchCur = stretched[i] if (oldCur && stretchCur) { spans: for (var j = 0; j < stretchCur.length; ++j) { - var span = stretchCur[j]; + var span = stretchCur[j] for (var k = 0; k < oldCur.length; ++k) { if (oldCur[k].marker == span.marker) { continue spans } } - oldCur.push(span); + oldCur.push(span) } } else if (stretchCur) { - old[i] = stretchCur; + old[i] = stretchCur } } return old @@ -23892,22 +40770,22 @@ return /******/ (function(modules) { // webpackBootstrap // 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 = []; + var copy = [] for (var i = 0; i < events.length; ++i) { - var event = events[i]; + var event = events[i] if (event.ranges) { - copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); + copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event) continue } - var changes = event.changes, newChanges = []; - copy.push({changes: newChanges}); + 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}); + 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]; + lst(newChanges)[prop] = change[prop] + delete change[prop] } } } } } @@ -23925,14 +40803,14 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var anchor = range.anchor if (other) { - var posBefore = cmp(head, anchor) < 0; + var posBefore = cmp(head, anchor) < 0 if (posBefore != (cmp(other, anchor) < 0)) { - anchor = head; - head = other; + anchor = head + head = other } else if (posBefore != (cmp(head, other) < 0)) { - head = other; + head = other } } return new Range(anchor, head) @@ -23943,29 +40821,29 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + 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 = []; + 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); + { 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); + 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); + setSelection(doc, simpleSelection(anchor, head), options) } // Give beforeSelectionChange handlers a change to influence a @@ -23976,90 +40854,90 @@ return /******/ (function(modules) { // webpackBootstrap update: function(ranges) { var this$1 = this; - this.ranges = []; + 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)); } + clipPos(doc, ranges[i].head)) } }, origin: options && options.origin - }; - signal(doc, "beforeSelectionChange", doc, obj); - if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); } + } + 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); + var done = doc.history.done, last = lst(done) if (last && last.ranges) { - done[done.length - 1] = sel; - setSelectionNoUndo(doc, sel, options); + done[done.length - 1] = sel + setSelectionNoUndo(doc, sel, options) } else { - setSelection(doc, sel, options); + 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); + 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); } + { 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)); + (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); } + { ensureCursorVisible(doc.cm) } } function setSelectionInner(doc, sel) { if (sel.equals(doc.sel)) { return } - doc.sel = sel; + doc.sel = sel if (doc.cm) { - doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true; - signalCursorActivity(doc.cm); + doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true + signalCursorActivity(doc.cm) } - signalLater(doc, "cursorActivity", doc); + 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); + 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; + 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); + 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); + 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); + 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; + 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"); + signal(m, "beforeCursorEnter") if (m.explicitlyCleared) { if (!line.markedSpans) { break } else {--i; continue} @@ -24068,16 +40946,16 @@ return /******/ (function(modules) { // webpackBootstrap if (!m.atomic) { continue } if (oldPos) { - var near = m.find(dir < 0 ? 1 : -1), diff = (void 0); + 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); } + { 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); + 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); } + { far = movePos(doc, far, dir, far.line == pos.line ? line : null) } return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null } } } @@ -24086,13 +40964,13 @@ return /******/ (function(modules) { // webpackBootstrap // Ensure a given position is not inside an atomic range. function skipAtomic(doc, pos, oldPos, bias, mayClear) { - var dir = bias || 1; + 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)); + (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)) if (!found) { - doc.cantEdit = true; + doc.cantEdit = true return Pos(doc.first, 0) } return found @@ -24111,7 +40989,7 @@ return /******/ (function(modules) { // webpackBootstrap } function selectAll(cm) { - cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll); + cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll) } // UPDATING @@ -24125,15 +41003,15 @@ return /******/ (function(modules) { // webpackBootstrap 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 (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} @@ -24148,101 +41026,101 @@ return /******/ (function(modules) { // webpackBootstrap } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { - change = filterChange(doc, change, true); + 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); + 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}); } + { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) } } else { - makeChangeInner(doc, change); + 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); + 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 = []; + 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); + rebaseHist(doc.history, change) + rebased.push(doc.history) } - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); - }); + 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; + 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; + var i = 0 for (; i < source.length; i++) { - event = source[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; + hist.lastOrigin = hist.lastSelOrigin = null for (;;) { - event = source.pop(); + event = source.pop() if (event.ranges) { - pushSelectionToHistory(event, dest); + pushSelectionToHistory(event, dest) if (allowSelectionOnly && !event.equals(doc.sel)) { - setSelection(doc, event, {clearRedo: false}); + setSelection(doc, event, {clearRedo: false}) return } - selAfter = event; + 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 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 filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange") var loop = function ( i ) { - var change = event.changes[i]; - change.origin = type; + var change = event.changes[i] + change.origin = type if (filter && !filterChange(doc, change, false)) { - source.length = 0; + source.length = 0 return {} } - antiChanges.push(historyChangeFromChange(doc, change)); + 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 = []; + 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); + rebaseHist(doc.history, change) + rebased.push(doc.history) } - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); - }); + makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)) + }) }; for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { @@ -24256,15 +41134,15 @@ return /******/ (function(modules) { // webpackBootstrap // above or below them in the parent document. function shiftDoc(doc, distance) { if (distance == 0) { return } - doc.first += distance; + 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); + ); }), doc.sel.primIndex) if (doc.cm) { - regChange(doc.cm, doc.first, doc.first - distance, distance); + 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"); } + { regLineChange(doc.cm, l, "gutter") } } } @@ -24275,108 +41153,108 @@ return /******/ (function(modules) { // webpackBootstrap { 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)); + 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); + 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}; + text: [lst(change.text)], origin: change.origin} } - var last = doc.lastLine(); + 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}; + text: [change.text[0]], origin: change.origin} } - change.removed = getBetween(doc, change.from, change.to); + 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); + 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 doc = cm.doc, display = cm.display, from = change.from, to = change.to - var recomputeMaxLength = false, checkWidthStart = from.line; + var recomputeMaxLength = false, checkWidthStart = from.line if (!cm.options.lineWrapping) { - checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); + checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) doc.iter(checkWidthStart, to.line + 1, function (line) { if (line == display.maxLine) { - recomputeMaxLength = true; + recomputeMaxLength = true return true } - }); + }) } if (doc.sel.contains(change.from, change.to) > -1) - { signalCursorActivity(cm); } + { signalCursorActivity(cm) } - updateDoc(doc, change, spans, estimateHeight(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); + var len = lineLength(line) if (len > display.maxLineLength) { - display.maxLine = line; - display.maxLineLength = len; - display.maxLineChanged = true; - recomputeMaxLength = false; + display.maxLine = line + display.maxLineLength = len + display.maxLineChanged = true + recomputeMaxLength = false } - }); - if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } + }) + if (recomputeMaxLength) { cm.curOp.updateMaxLine = true } } // Adjust frontier, schedule worker - doc.frontier = Math.min(doc.frontier, from.line); - startWorker(cm, 400); + doc.frontier = Math.min(doc.frontier, from.line) + startWorker(cm, 400) - var lendiff = change.text.length - (to.line - from.line) - 1; + var lendiff = change.text.length - (to.line - from.line) - 1 // Remember that these lines changed, for updating the display if (change.full) - { regChange(cm); } + { regChange(cm) } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) - { regLineChange(cm, from.line, "text"); } + { regLineChange(cm, from.line, "text") } else - { regChange(cm, from.line, to.line + 1, lendiff); } + { regChange(cm, from.line, to.line + 1, lendiff) } - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); + 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); } + } + if (changeHandler) { signalLater(cm, "change", cm, obj) } + if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) } } - cm.display.selForContextMenu = null; + 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}); + 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; + pos.line += diff } else if (from < pos.line) { - pos.line = from; - pos.ch = 0; + pos.line = from + pos.ch = 0 } } @@ -24389,47 +41267,47 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var sub = array[i], ok = true if (sub.ranges) { - if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } + 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); + 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]; + 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); + 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; + ok = false break } } if (!ok) { - array.splice(0, i + 1); - i = 0; + 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); + 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); } + 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); } + if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) } return line } @@ -24449,14 +41327,14 @@ return /******/ (function(modules) { // webpackBootstrap var LeafChunk = function(lines) { var this$1 = this; - this.lines = lines; - this.parent = null; - var height = 0; + 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; + lines[i].parent = this$1 + height += lines[i].height } - this.height = height; + this.height = height }; LeafChunk.prototype.chunkSize = function () { return this.lines.length }; @@ -24466,17 +41344,17 @@ return /******/ (function(modules) { // webpackBootstrap 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"); + var line = this$1.lines[i] + this$1.height -= line.height + cleanUpLine(line) + signalLater(line, "delete") } - this.lines.splice(at, n); + 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); + lines.push.apply(lines, this.lines) }; // Insert the given array of lines at offset 'at', count them as @@ -24484,9 +41362,9 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + 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. @@ -24500,16 +41378,16 @@ return /******/ (function(modules) { // webpackBootstrap var BranchChunk = function(children) { var this$1 = this; - this.children = children; - var size = 0, height = 0; + 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; + var ch = children[i] + size += ch.chunkSize(); height += ch.height + ch.parent = this$1 } - this.size = size; - this.height = height; - this.parent = null; + this.size = size + this.height = height + this.parent = null }; BranchChunk.prototype.chunkSize = function () { return this.size }; @@ -24517,97 +41395,97 @@ return /******/ (function(modules) { // webpackBootstrap BranchChunk.prototype.removeInner = function (at, n) { var this$1 = this; - this.size -= n; + this.size -= n for (var i = 0; i < this.children.length; ++i) { - var child = this$1.children[i], sz = child.chunkSize(); + 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; } + 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; } + 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; + 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); } + 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; + 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(); + var child = this$1.children[i], sz = child.chunkSize() if (at <= sz) { - child.insertInner(at, lines, height); + 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; + 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; + 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(); + child.lines = child.lines.slice(0, remaining) + this$1.maybeSpill() } break } - at -= sz; + 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; + var me = this do { - var spilled = me.children.splice(me.children.length - 5, 5); - var sibling = new BranchChunk(spilled); + 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; + 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); + 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; + sibling.parent = me.parent } while (me.children.length > 10) - me.parent.maybeSpill(); + 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(); + var child = this$1.children[i], sz = child.chunkSize() if (at < sz) { - var used = Math.min(n, sz - at); + 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; } + at = 0 + } else { at -= sz } } }; @@ -24617,70 +41495,70 @@ return /******/ (function(modules) { // webpackBootstrap 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; + { 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); + 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)); + 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); + 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; + 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); + 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)); - }); + cm.curOp.forceUpdate = true + adjustScrollWhenAboveVisible(cm, line, diff) + signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line)) + }) } }; - eventMixin(LineWidget); + eventMixin(LineWidget) function adjustScrollWhenAboveVisible(cm, line, diff) { if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) - { addToScrollPos(cm, null, diff); } + { 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; } + 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; + 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; + 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)); + }) + signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)) return widget } @@ -24699,13 +41577,13 @@ return /******/ (function(modules) { // webpackBootstrap // 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 nextMarkerId = 0 var TextMarker = function(doc, type) { - this.lines = []; - this.type = type; - this.doc = doc; - this.id = ++nextMarkerId; + this.lines = [] + this.type = type + this.doc = doc + this.id = ++nextMarkerId }; // Clear the marker. @@ -24713,44 +41591,44 @@ return /******/ (function(modules) { // webpackBootstrap var this$1 = this; if (this.explicitlyCleared) { return } - var cm = this.doc.cm, withOp = cm && !cm.curOp; - if (withOp) { startOperation(cm); } + 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 found = this.find() + if (found) { signalLater(this, "clear", found.from, found.to) } } - var min = null, max = null; + 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"); } + 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); } + if (span.to != null) { max = lineNo(line) } + if (span.from != null) { min = lineNo(line) } } - line.markedSpans = removeMarkedSpan(line.markedSpans, span); + line.markedSpans = removeMarkedSpan(line.markedSpans, span) if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm) - { updateLineHeight(line, textHeight(cm.display)); } + { 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); + 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; + 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 (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); } + 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(); } + 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, @@ -24761,17 +41639,17 @@ return /******/ (function(modules) { // webpackBootstrap TextMarker.prototype.find = function (side, lineObj) { var this$1 = this; - if (side == null && this.type == "bookmark") { side = 1; } - var from, to; + 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); + 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); + 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); + to = Pos(lineObj ? line : lineNo(line), span.to) if (side == 1) { return to } } } @@ -24783,43 +41661,44 @@ return /******/ (function(modules) { // webpackBootstrap TextMarker.prototype.changed = function () { var this$1 = this; - var pos = this.find(-1, true), widget = this, cm = this.doc.cm; + 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); + var line = pos.line, lineN = lineNo(pos.line) + var view = findViewForLine(cm, lineN) if (view) { - clearLineMeasurementCacheFor(view); - cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; + clearLineMeasurementCacheFor(view) + cm.curOp.selectionChanged = cm.curOp.forceUpdate = true } - cm.curOp.updateMaxLine = 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; + var oldHeight = widget.height + widget.height = null + var dHeight = widgetHeight(widget) - oldHeight if (dHeight) - { updateLineHeight(line, line.height + dHeight); } + { updateLineHeight(line, line.height + dHeight) } } - signalLater(cm, "markerChanged", cm, this$1); - }); + signalLater(cm, "markerChanged", cm, this$1) + }) }; TextMarker.prototype.attachLine = function (line) { if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; + var op = this.doc.cm.curOp if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) - { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); } + { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) } } - this.lines.push(line); + this.lines.push(line) }; TextMarker.prototype.detachLine = function (line) { - this.lines.splice(indexOf(this.lines, line), 1); + 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); + var op = this.doc.cm.curOp + ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this) } }; - eventMixin(TextMarker); + eventMixin(TextMarker) // Create a marker, wire it up to the right lines, and function markText(doc, from, to, options, type) { @@ -24830,63 +41709,64 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + 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; } + marker.collapsed = true + marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget") + marker.widgetNode.setAttribute("role", "presentation") // hide from accessibility tree + 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(); + seeCollapsedSpans() } if (marker.addToHistory) - { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); } + { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) } - var curLine = from.line, cm = doc.cm, updateMaxLine; + 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); } + { 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; - }); + 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 (lineIsHidden(doc, line)) { updateLineHeight(line, 0) } + }) } - if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); } + if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) } if (marker.readOnly) { - seeReadOnlySpans(); + seeReadOnlySpans() if (doc.history.done.length || doc.history.undone.length) - { doc.clearHistory(); } + { doc.clearHistory() } } if (marker.collapsed) { - marker.id = ++nextMarkerId; - marker.atomic = true; + marker.id = ++nextMarkerId + marker.atomic = true } if (cm) { // Sync editor state - if (updateMaxLine) { cm.curOp.updateMaxLine = true; } + if (updateMaxLine) { cm.curOp.updateMaxLine = true } if (marker.collapsed) - { regChange(cm, from.line, to.line + 1); } + { 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); + { 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 } @@ -24899,39 +41779,39 @@ return /******/ (function(modules) { // webpackBootstrap var SharedTextMarker = function(markers, primary) { var this$1 = this; - this.markers = markers; - this.primary = primary; + this.markers = markers + this.primary = primary for (var i = 0; i < markers.length; ++i) - { markers[i].parent = this$1; } + { markers[i].parent = this$1 } }; SharedTextMarker.prototype.clear = function () { var this$1 = this; if (this.explicitlyCleared) { return } - this.explicitlyCleared = true; + this.explicitlyCleared = true for (var i = 0; i < this.markers.length; ++i) - { this$1.markers[i].clear(); } - signalLater(this, "clear"); + { this$1.markers[i].clear() } + signalLater(this, "clear") }; SharedTextMarker.prototype.find = function (side, lineObj) { return this.primary.find(side, lineObj) }; - eventMixin(SharedTextMarker); + 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; + 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)); + 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); - }); + primary = lst(markers) + }) return new SharedTextMarker(markers, primary) } @@ -24941,25 +41821,25 @@ return /******/ (function(modules) { // webpackBootstrap 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); + 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; + 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); }); + 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]; + var subMarker = marker.markers[j] if (indexOf(linked, subMarker.doc) == -1) { - subMarker.parent = null; - marker.markers.splice(j--, 1); + subMarker.parent = null + marker.markers.splice(j--, 1) } } }; @@ -24967,30 +41847,29 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + var nextDocId = 0 + var Doc = function(text, mode, firstLine, lineSep) { + if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep) } + 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; + 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.extend = false - if (typeof text == "string") { text = this.splitLines(text); } - updateDoc(this, {from: start, to: start, text: text}); - setSelection(this, simpleSelection(start), sel_dontScroll); - }; + 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, @@ -24999,39 +41878,39 @@ return /******/ (function(modules) { // webpackBootstrap // 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); } + 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); + 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); }, + 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); + 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; + 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)); + 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); + 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)); + var lines = getBetween(this, clipPos(this, from), clipPos(this, to)) if (lineSep === false) { return lines } return lines.join(lineSep || this.lineSeparator()) }, @@ -25042,7 +41921,7 @@ return /******/ (function(modules) { // webpackBootstrap getLineNumber: function(line) {return lineNo(line)}, getLineHandleVisualStart: function(line) { - if (typeof line == "number") { line = getLine(this, line); } + if (typeof line == "number") { line = getLine(this, line) } return visualLine(line) }, @@ -25053,56 +41932,56 @@ return /******/ (function(modules) { // webpackBootstrap 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(); } + var range = this.sel.primary(), pos + if (start == null || start == "head") { pos = range.head } + else if (start == "anchor") { pos = range.anchor } + else if (start == "end" || start == "to" || start === false) { pos = range.to() } + else { pos = range.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); + 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); + 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); + extendSelection(this, clipPos(this, head), other && clipPos(this, other), options) }), extendSelections: docMethodOp(function(heads, options) { - extendSelections(this, clipPosArray(this, 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); + 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 = []; + 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); + 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); + 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; + 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; + 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()) } @@ -25110,56 +41989,56 @@ return /******/ (function(modules) { // webpackBootstrap getSelections: function(lineSep) { var this$1 = this; - var parts = [], ranges = this.sel.ranges; + 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; + 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 = []; + var dup = [] for (var i = 0; i < this.sel.ranges.length; i++) - { dup[i] = code; } - this.replaceSelections(dup, collapse, origin || "+input"); + { dup[i] = code } + this.replaceSelections(dup, collapse, origin || "+input") }, replaceSelections: docMethodOp(function(code, collapse, origin) { var this$1 = this; - var changes = [], sel = this.sel; + 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 range = sel.ranges[i] + changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin} } - var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); + 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); } + { 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);}), + 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;}, + 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; } } + 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);}, + clearHistory: function() {this.history = new History(this.history.maxGeneration)}, markClean: function() { - this.cleanGeneration = this.changeGeneration(true); + this.cleanGeneration = this.changeGeneration(true) }, changeGeneration: function(forceSplit) { if (forceSplit) - { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; } + { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null } return this.history.generation }, isClean: function (gen) { @@ -25171,16 +42050,16 @@ return /******/ (function(modules) { // webpackBootstrap 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); + 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; } + var markers = line.gutterMarkers || (line.gutterMarkers = {}) + markers[gutterID] = value + if (!value && isEmpty(markers)) { line.gutterMarkers = null } return true }) }), @@ -25191,23 +42070,23 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + line.gutterMarkers[gutterID] = null + if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null } return true - }); + }) } - }); + }) }), lineInfo: function(line) { - var n; + var n if (typeof line == "number") { if (!isLine(this, line)) { return null } - n = line; - line = getLine(this, line); + n = line + line = getLine(this, line) if (!line) { return null } } else { - n = lineNo(line); + n = lineNo(line) if (n == null) { return null } } return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, @@ -25219,10 +42098,10 @@ return /******/ (function(modules) { // webpackBootstrap 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; } + : where == "gutter" ? "gutterClass" : "wrapClass" + if (!line[prop]) { line[prop] = cls } else if (classTest(cls).test(line[prop])) { return false } - else { line[prop] += " " + cls; } + else { line[prop] += " " + cls } return true }) }), @@ -25230,15 +42109,15 @@ return /******/ (function(modules) { // webpackBootstrap 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]; + : where == "gutter" ? "gutterClass" : "wrapClass" + var cur = line[prop] if (!cur) { return false } - else if (cls == null) { line[prop] = null; } + else if (cls == null) { line[prop] = null } else { - var found = cur.match(classTest(cls)); + 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; + 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 }) @@ -25247,7 +42126,7 @@ return /******/ (function(modules) { // webpackBootstrap addLineWidget: docMethodOp(function(handle, node, options) { return addLineWidget(this, handle, node, options) }), - removeLineWidget: function(widget) { widget.clear(); }, + removeLineWidget: function(widget) { widget.clear() }, markText: function(from, to, options) { return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range") @@ -25256,116 +42135,116 @@ return /******/ (function(modules) { // webpackBootstrap 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); + 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; + 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]; + 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); } + { 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; + from = clipPos(this, from); to = clipPos(this, to) + var found = [], lineNo = from.line this.iter(from.line, to.line + 1, function (line) { - var spans = line.markedSpans; + 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) && + var span = spans[i] + if (!(span.to != null && lineNo == from.line && from.ch >= span.to || + span.from == null && lineNo != from.line || + span.from != null && lineNo == to.line && span.from >= to.ch) && (!filter || filter(span.marker))) - { found.push(span.marker.parent || span.marker); } + { found.push(span.marker.parent || span.marker) } } } - ++lineNo$$1; - }); + ++lineNo + }) return found }, getAllMarks: function() { - var markers = []; + var markers = [] this.iter(function (line) { - var sps = line.markedSpans; + var sps = line.markedSpans if (sps) { for (var i = 0; i < sps.length; ++i) - { if (sps[i].from != null) { markers.push(sps[i].marker); } } } - }); + { 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; + var ch, lineNo = this.first, sepSize = this.lineSeparator().length this.iter(function (line) { - var sz = line.text.length + sepSize; + var sz = line.text.length + sepSize if (sz > off) { ch = off; return true } - off -= sz; - ++lineNo$$1; - }); - return clipPos(this, Pos(lineNo$$1, ch)) + off -= sz + ++lineNo + }) + return clipPos(this, Pos(lineNo, ch)) }, indexFromPos: function (coords) { - coords = clipPos(this, coords); - var index = coords.ch; + coords = clipPos(this, coords) + var index = coords.ch if (coords.line < this.first || coords.ch < 0) { return 0 } - var sepSize = this.lineSeparator().length; + 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; - }); + 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; + this.modeOption, this.first, this.lineSep) + 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()); + 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) { 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) 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)); + ; }(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 (other instanceof CodeMirror) { other = other.doc } if (this.linked) { for (var i = 0; i < this.linked.length; ++i) { - var link = this$1.linked[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)); + 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); + 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);}, + iterLinkedDocs: function(f) {linkedDocs(this, f)}, getMode: function() {return this.mode}, getEditor: function() {return this.cm}, @@ -25374,78 +42253,70 @@ return /******/ (function(modules) { // webpackBootstrap 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); } - }) - }); + lineSeparator: function() { return this.lineSep || "\n" } + }) // Public alias. - Doc.prototype.eachLine = Doc.prototype.iter; + 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; + var lastDrop = 0 function onDrop(e) { - var cm = this; - clearDragCursor(cm); + 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; + 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 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; + 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; + var content = reader.result + if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = "" } + text[i] = content if (++read == n) { - pos = clipPos(cm.doc, pos); + 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))); + 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); } + }) + 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); + cm.state.draggingText(e) // Ensure the editor is re-focused - setTimeout(function () { return cm.display.input.focus(); }, 20); + setTimeout(function () { return cm.display.input.focus(); }, 20) return } try { - var text$1 = e.dataTransfer.getData("Text"); + var text$1 = e.dataTransfer.getData("Text") if (text$1) { - var selected; + var selected if (cm.state.draggingText && !cm.state.draggingText.copy) - { selected = cm.listSelections(); } - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); + { 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(); + { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag") } } + cm.replaceSelection(text$1, "around", "paste") + cm.display.input.focus() } } catch(e){} @@ -25456,41 +42327,41 @@ return /******/ (function(modules) { // webpackBootstrap 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"; + 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=="; + 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); + 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; + img._top = img.offsetTop } - e.dataTransfer.setDragImage(img, 0, 0); - if (presto) { img.parentNode.removeChild(img); } + e.dataTransfer.setDragImage(img, 0, 0) + if (presto) { img.parentNode.removeChild(img) } } } function onDragOver(cm, e) { - var pos = posFromMouse(cm, e); + var pos = posFromMouse(cm, e) if (!pos) { return } - var frag = document.createDocumentFragment(); - drawSelectionCursor(cm, pos, frag); + 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); + 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); + removeChildrenAndAdd(cm.display.dragCursor, frag) } function clearDragCursor(cm) { if (cm.display.dragCursor) { - cm.display.lineSpace.removeChild(cm.display.dragCursor); - cm.display.dragCursor = null; + cm.display.lineSpace.removeChild(cm.display.dragCursor) + cm.display.dragCursor = null } } @@ -25500,40 +42371,40 @@ return /******/ (function(modules) { // webpackBootstrap function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) { return } - var byClass = document.body.getElementsByClassName("CodeMirror"); + var byClass = document.body.getElementsByClassName("CodeMirror") for (var i = 0; i < byClass.length; i++) { - var cm = byClass[i].CodeMirror; - if (cm) { f(cm); } + var cm = byClass[i].CodeMirror + if (cm) { f(cm) } } } - var globalsRegistered = false; + var globalsRegistered = false function ensureGlobalHandlers() { if (globalsRegistered) { return } - registerGlobalHandlers(); - globalsRegistered = true; + registerGlobalHandlers() + globalsRegistered = true } function registerGlobalHandlers() { // When the window resizes, we need to refresh active editors. - var resizeTimer; + var resizeTimer on(window, "resize", function () { if (resizeTimer == null) { resizeTimer = setTimeout(function () { - resizeTimer = null; - forEachCodeMirror(onResize); - }, 100); } - }); + 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); }); + on(window, "blur", function () { return forEachCodeMirror(onBlur); }) } // Called when the window resizes function onResize(cm) { - var d = cm.display; + 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(); + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null + d.scrollbarsClipped = false + cm.setSize() } var keyNames = { @@ -25545,16 +42416,16 @@ return /******/ (function(modules) { // webpackBootstrap 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); } + 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); } + 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; } + for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2 } - var keyMap = {}; + var keyMap = {} keyMap.basic = { "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", @@ -25563,7 +42434,7 @@ return /******/ (function(modules) { // webpackBootstrap "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. @@ -25576,7 +42447,7 @@ return /******/ (function(modules) { // webpackBootstrap "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", @@ -25584,7 +42455,7 @@ return /******/ (function(modules) { // webpackBootstrap "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", @@ -25594,27 +42465,27 @@ return /******/ (function(modules) { // webpackBootstrap "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["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; + 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; } + 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; } + if (alt) { name = "Alt-" + name } + if (ctrl) { name = "Ctrl-" + name } + if (cmd) { name = "Cmd-" + name } + if (shift) { name = "Shift-" + name } return name } @@ -25624,44 +42495,44 @@ return /******/ (function(modules) { // webpackBootstrap // new normalized keymap, and then updates the old object to reflect // this. function normalizeKeyMap(keymap) { - var copy = {}; + var copy = {} for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { - var value = keymap[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); + var keys = map(keyname.split(" "), normalizeKeyName) for (var i = 0; i < keys.length; i++) { - var val = (void 0), name = (void 0); + var val = (void 0), name = (void 0) if (i == keys.length - 1) { - name = keys.join(" "); - val = value; + name = keys.join(" ") + val = value } else { - name = keys.slice(0, i + 1).join(" "); - val = "..."; + name = keys.slice(0, i + 1).join(" ") + val = "..." } - var prev = copy[name]; - if (!prev) { copy[name] = val; } + var prev = copy[name] + if (!prev) { copy[name] = val } else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } } - delete keymap[keyname]; + delete keymap[keyname] } } - for (var prop in copy) { keymap[prop] = copy[prop]; } + 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]; + function lookupKey(key, map, handle, context) { + map = getKeyMap(map) + var found = map.call ? map.call(key, context) : map[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 (map.fallthrough) { + if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") + { return lookupKey(key, map.fallthrough, handle, context) } + for (var i = 0; i < map.fallthrough.length; i++) { + var result = lookupKey(key, map.fallthrough[i], handle, context) if (result) { return result } } } @@ -25670,19 +42541,19 @@ return /******/ (function(modules) { // webpackBootstrap // 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]; + 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; + 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; } + 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 } @@ -25693,26 +42564,26 @@ return /******/ (function(modules) { // webpackBootstrap // 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 = []; + 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]); + var toKill = compute(ranges[i]) while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { - var replaced = kill.pop(); + var replaced = kill.pop() if (cmp(replaced.from, toKill.from) < 0) { - toKill.from = replaced.from; + toKill.from = replaced.from break } } - kill.push(toKill); + 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); - }); + { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") } + ensureCursorVisible(cm) + }) } // Commands are parameter-less actions that can be performed on an @@ -25722,7 +42593,7 @@ return /******/ (function(modules) { // webpackBootstrap 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; + 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 @@ -25739,13 +42610,13 @@ return /******/ (function(modules) { // webpackBootstrap 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"); + 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"); + 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(); }, @@ -25764,16 +42635,16 @@ return /******/ (function(modules) { // webpackBootstrap {origin: "+move", bias: -1} ); }, goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) { - var top = cm.charCoords(range.head, "div").top + 5; + 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; + 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"); + 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); }, @@ -25800,17 +42671,17 @@ return /******/ (function(modules) { // webpackBootstrap 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; + 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)); + var pos = ranges[i].from() + var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize) + spaces.push(spaceStr(tabSize - col % tabSize)) } - cm.replaceSelections(spaces); + cm.replaceSelections(spaces) }, defaultTab: function (cm) { - if (cm.somethingSelected()) { cm.indentSelection("add"); } - else { cm.execCommand("insertTab"); } + 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. @@ -25820,63 +42691,63 @@ return /******/ (function(modules) { // webpackBootstrap // 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 = []; + 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; + 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 == line.length) { cur = new Pos(cur.line, cur.ch - 1) } if (cur.ch > 0) { - cur = new Pos(cur.line, cur.ch + 1); + 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"); + Pos(cur.line, cur.ch - 2), cur, "+transpose") } else if (cur.line > cm.doc.first) { - var prev = getLine(cm.doc, cur.line - 1).text; + var prev = getLine(cm.doc, cur.line - 1).text if (prev) { - cur = new Pos(cur.line, 1); + 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"); + Pos(cur.line - 1, prev.length - 1), cur, "+transpose") } } } - newSel.push(new Range(cur, cur)); + newSel.push(new Range(cur, cur)) } - cm.setSelections(newSel); + cm.setSelections(newSel) }); }, newlineAndIndent: function (cm) { return runInOp(cm, function () { - var sels = cm.listSelections(); + 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(); + { 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); + { 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); } + 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); } + 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); + var start = lineStart(cm, pos.line) + var line = getLine(cm.doc, start.line) + var order = getOrder(line) 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; + 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 @@ -25885,60 +42756,60 @@ return /******/ (function(modules) { // webpackBootstrap // Run a handler that was bound to a key. function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { - bound = commands[bound]; + 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; + 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; + 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; + 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); + 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; + var stopSeq = new Delayed function dispatchKey(cm, name, e, handle) { - var seq = cm.state.keySeq; + 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(); + cm.state.keySeq = null + cm.display.input.reset() } - }); - name = seq + " " + name; + }) + name = seq + " " + name } - var result = lookupKeyForEditor(cm, name, handle); + var result = lookupKeyForEditor(cm, name, handle) if (result == "multi") - { cm.state.keySeq = name; } + { cm.state.keySeq = name } if (result == "handled") - { signalLater(cm, "keyHandled", cm, name, e); } + { signalLater(cm, "keyHandled", cm, name, e) } if (result == "handled" || result == "multi") { - e_preventDefault(e); - restartBlink(cm); + e_preventDefault(e) + restartBlink(cm) } if (seq && !result && /\'$/.test(name)) { - e_preventDefault(e); + e_preventDefault(e) return true } return !!result @@ -25946,7 +42817,7 @@ return /******/ (function(modules) { // webpackBootstrap // Handle a key from the keydown event. function handleKeyBinding(cm, e) { - var name = keyName(e, true); + var name = keyName(e, true) if (!name) { return false } if (e.shiftKey && !cm.state.keySeq) { @@ -25968,59 +42839,59 @@ return /******/ (function(modules) { // webpackBootstrap return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) } - var lastStoppedKey = null; + var lastStoppedKey = null function onKeyDown(e) { - var cm = this; - cm.curOp.focus = activeElt(); + 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 (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; + 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"); } + { 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); } + { showCrossHair(cm) } } function showCrossHair(cm) { - var lineDiv = cm.display.lineDiv; - addClass(lineDiv, "CodeMirror-crosshair"); + 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); + rmClass(lineDiv, "CodeMirror-crosshair") + off(document, "keyup", up) + off(document, "mouseover", up) } } - on(document, "keyup", up); - on(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); + if (e.keyCode == 16) { this.doc.sel.shift = false } + signalDOMEvent(this, e) } function onKeyPress(e) { - var cm = this; + 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; + 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); + 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); + cm.display.input.onKeyPress(e) } // A mouse down can be a single click, double click, triple click, @@ -26029,43 +42900,43 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var cm = this, display = cm.display if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } - display.input.ensurePolled(); - display.shift = e.shiftKey; + 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); + 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(); + 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); } + { cm.state.selectingText(e) } else if (start) - { leftButtonDown(cm, e, start); } + { leftButtonDown(cm, e, start) } else if (e_target(e) == display.scroller) - { e_preventDefault(e); } + { 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); + 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); } + if (captureRightClick) { onContextMenu(cm, e) } + else { delayBlurEvent(cm) } break } } @@ -26073,228 +42944,228 @@ return /******/ (function(modules) { // webpackBootstrap var lastClick; var lastDoubleClick; function leftButtonDown(cm, e, start) { - if (ie) { setTimeout(bind(ensureFocus, cm), 0); } - else { cm.curOp.focus = activeElt(); } + if (ie) { setTimeout(bind(ensureFocus, cm), 0) } + else { cm.curOp.focus = activeElt() } - var now = +new Date, type; + var now = +new Date, type if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { - type = "triple"; + type = "triple" } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { - type = "double"; - lastDoubleClick = {time: now, pos: start}; + type = "double" + lastDoubleClick = {time: now, pos: start} } else { - type = "single"; - lastClick = {time: now, pos: start}; + type = "single" + lastClick = {time: now, pos: start} } - var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; + 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); } + { leftButtonStartDrag(cm, e, start, modifier) } else - { leftButtonSelect(cm, e, start, type, modifier); } + { 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 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 (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); + e_preventDefault(e2) if (!modifier && +new Date - 200 < startTime) - { extendSelection(cm.doc, start); } + { 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); } + { setTimeout(function () {document.body.focus(); display.input.focus()}, 20) } else - { display.input.focus(); } + { 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; + 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); + 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 display = cm.display, doc = cm.doc + e_preventDefault(e) - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; + var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges if (addNew && !e.shiftKey) { - ourIndex = doc.sel.contains(start); + ourIndex = doc.sel.contains(start) if (ourIndex > -1) - { ourRange = ranges[ourIndex]; } + { ourRange = ranges[ourIndex] } else - { ourRange = new Range(start, start); } + { ourRange = new Range(start, start) } } else { - ourRange = doc.sel.primary(); - ourIndex = doc.sel.primIndex; + 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; + 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); + var word = cm.findWordAt(start) if (cm.display.shift || doc.extend) - { ourRange = extendRange(doc, ourRange, word.anchor, word.head); } + { ourRange = extendRange(doc, ourRange, word.anchor, word.head) } else - { ourRange = word; } + { ourRange = word } } else if (type == "triple") { - var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))); + 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); } + { ourRange = extendRange(doc, ourRange, line.anchor, line.head) } else - { ourRange = line; } + { ourRange = line } } else { - ourRange = extendRange(doc, ourRange, start); + ourRange = extendRange(doc, ourRange, start) } if (!addNew) { - ourIndex = 0; - setSelection(doc, new Selection([ourRange], 0), sel_mouse); - startSel = doc.sel; + ourIndex = 0 + setSelection(doc, new Selection([ourRange], 0), sel_mouse) + startSel = doc.sel } else if (ourIndex == -1) { - ourIndex = ranges.length; + ourIndex = ranges.length setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), - {scroll: false, origin: "*mouse"}); + {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; + {scroll: false, origin: "*mouse"}) + startSel = doc.sel } else { - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); + replaceOneSelection(doc, ourIndex, ourRange, sel_mouse) } - var lastPos = start; + var lastPos = start function extendTo(pos) { if (cmp(lastPos, pos) == 0) { return } - lastPos = pos; + 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); + 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); + var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize) if (left == right) - { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } + { 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)))); } + { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) } } - if (!ranges.length) { ranges.push(new Range(start, start)); } + 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); + {origin: "*mouse", scroll: false}) + cm.scrollIntoView(pos) } else { - var oldRange = ourRange; - var anchor = oldRange.anchor, head = pos; + var oldRange = ourRange + var anchor = oldRange.anchor, head = pos if (type != "single") { - var range$$1; + var range if (type == "double") - { range$$1 = cm.findWordAt(pos); } + { range = 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); + { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) } + if (cmp(range.anchor, anchor) > 0) { + head = range.head + anchor = minPos(oldRange.from(), range.anchor) } else { - head = range$$1.anchor; - anchor = maxPos(oldRange.to(), range$$1.head); + head = range.anchor + anchor = maxPos(oldRange.to(), range.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 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(); + 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; + var counter = 0 function extend(e) { - var curCount = ++counter; - var cur = posFromMouse(cm, e, true, type == "rect"); + 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); + 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); } + { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) } } else { - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; + 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); } + 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; + 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); + 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; } + 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); } + if (prevent) { e_preventDefault(e) } - var display = cm.display; - var lineBox = display.lineDiv.getBoundingClientRect(); + 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; + mY -= lineBox.top - display.viewOffset for (var i = 0; i < cm.options.gutters.length; ++i) { - var g = display.gutters.childNodes[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); + var line = lineAtHeight(cm.doc, mY) + var gutter = cm.options.gutters[i] + signal(cm, type, cm, line, gutter, e) return e_defaultPrevented(e) } } @@ -26312,7 +43183,7 @@ return /******/ (function(modules) { // webpackBootstrap function onContextMenu(cm, e) { if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } if (signalDOMEvent(cm, e, "contextmenu")) { return } - cm.display.input.onContextMenu(e); + cm.display.input.onContextMenu(e) } function contextMenuInGutter(cm, e) { @@ -26322,208 +43193,207 @@ return /******/ (function(modules) { // webpackBootstrap 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); + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-") + clearCaches(cm) } - var Init = {toString: function(){return "CodeMirror.Init"}}; + var Init = {toString: function(){return "CodeMirror.Init"}} - var defaults = {}; - var optionHandlers = {}; + var defaults = {} + var optionHandlers = {} function defineOptions(CodeMirror) { - var optionHandlers = CodeMirror.optionHandlers; + var optionHandlers = CodeMirror.optionHandlers function option(name, deflt, handle, notOnInit) { - CodeMirror.defaults[name] = deflt; + CodeMirror.defaults[name] = deflt if (handle) { optionHandlers[name] = - notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; } + notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old) }} : handle } } - CodeMirror.defineOption = option; + CodeMirror.defineOption = option // Passed to option handlers when there is no old value. - CodeMirror.Init = Init; + 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("value", "", function (cm, val) { return cm.setValue(val); }, true) option("mode", null, function (cm, val) { - cm.doc.modeOption = val; - loadMode(cm); - }, true); + cm.doc.modeOption = val + loadMode(cm) + }, true) - option("indentUnit", 2, loadMode, true); - option("indentWithTabs", false); - option("smartIndent", true); + option("indentUnit", 2, loadMode, true) + option("indentWithTabs", false) + option("smartIndent", true) option("tabSize", 4, function (cm) { - resetModeState(cm); - clearCaches(cm); - regChange(cm); - }, true); + resetModeState(cm) + clearCaches(cm) + regChange(cm) + }, true) option("lineSeparator", null, function (cm, val) { - cm.doc.lineSep = val; + cm.doc.lineSep = val if (!val) { return } - var newBreaks = [], lineNo = cm.doc.first; + var newBreaks = [], lineNo = cm.doc.first cm.doc.iter(function (line) { for (var pos = 0;;) { - var found = line.text.indexOf(val, pos); + var found = line.text.indexOf(val, pos) if (found == -1) { break } - pos = found + val.length; - newBreaks.push(Pos(lineNo, found)); + pos = found + val.length + newBreaks.push(Pos(lineNo, found)) } - lineNo++; - }); + 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); + { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) } + }) + option("specialChars", /[\u0000-\u001f\u007f\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); + }, 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); + 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); + 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("lineWrapping", false, wrappingChanged, true) option("gutters", [], function (cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); + 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); + 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); + 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); + 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("resetSelectionOnContextMenu", true) + option("lineWiseCopyCut", true) option("readOnly", false, function (cm, val) { if (val == "nocursor") { - onBlur(cm); - cm.display.input.blur(); - cm.display.disabled = true; + onBlur(cm) + cm.display.input.blur() + cm.display.disabled = true } else { - cm.display.disabled = false; + 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); + 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("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(); } - }); + 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); + option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; }) + option("autofocus", null) } function guttersChanged(cm) { - updateGutters(cm); - regChange(cm); - alignHorizontally(cm); + updateGutters(cm) + regChange(cm) + alignHorizontally(cm) } function dragDropChanged(cm, value, old) { - var wasOn = old && old != Init; + 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); + 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; + addClass(cm.display.wrapper, "CodeMirror-wrap") + cm.display.sizer.style.minWidth = "" + cm.display.sizerWidth = null } else { - rmClass(cm.display.wrapper, "CodeMirror-wrap"); - findMaxLine(cm); + rmClass(cm.display.wrapper, "CodeMirror-wrap") + findMaxLine(cm) } - estimateLineHeights(cm); - regChange(cm); - clearCaches(cm); - setTimeout(function () { return updateScrollbars(cm); }, 100); + 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) { + function CodeMirror(place, options) { var this$1 = this; - if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) } + if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } - this.options = options = options ? copyObj(options) : {}; + this.options = options = options ? copyObj(options) : {} // Determine effective options based on given values and defaults. - copyObj(defaults, options, false); - setGuttersForLineNumbers(options); + 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 doc = options.value + if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator) } + 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); + var input = new CodeMirror.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.display.wrapper.className += " CodeMirror-wrap" } + initScrollbars(this) this.state = { keyMaps: [], // stores maps added by addKeyMap @@ -26539,154 +43409,154 @@ return /******/ (function(modules) { // webpackBootstrap highlight: new Delayed(), // stores highlight worker timeout keySeq: null, // Unfinished key sequence specialChars: null - }; + } - if (options.autofocus && !mobile) { display.input.focus(); } + 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); } + if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) } - registerEventHandlers(this); - ensureGlobalHandlers(); + registerEventHandlers(this) + ensureGlobalHandlers() - startOperation(this); - this.curOp.forceUpdate = true; - attachDoc(this, doc); + startOperation(this) + this.curOp.forceUpdate = true + attachDoc(this, doc) if ((options.autofocus && !mobile) || this.hasFocus()) - { setTimeout(bind(onFocus, this), 20); } + { setTimeout(bind(onFocus, this), 20) } else - { onBlur(this); } + { 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); + { 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"; } + { display.lineDiv.style.textRendering = "auto" } } // The default configuration options. - CodeMirror$1.defaults = defaults; + CodeMirror.defaults = defaults // Functions to run when options are changed. - CodeMirror$1.optionHandlers = optionHandlers; + CodeMirror.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)); + 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); + 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); - })); } + 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); }); } + { 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); }); } + 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}; + 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; + 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]; + 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; + 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.input.ensurePolled() + clearTimeout(touchFinished) + var now = +new Date d.activeTouch = {start: now, moved: false, - prev: now - prevTouch.end <= 300 ? prevTouch : null}; + 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; + 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; } - }); + if (d.activeTouch) { d.activeTouch.moved = true } + }) on(d.scroller, "touchend", function (e) { - var touch = d.activeTouch; + 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; + var pos = cm.coordsChar(d.activeTouch, "page"), range if (!touch.prev || farAway(touch, touch.prev)) // Single tap - { range = new Range(pos, pos); } + { range = new Range(pos, pos) } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap - { range = cm.findWordAt(pos); } + { 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); + { 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); + 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); + 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); }); + 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; }); + 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); }}, + 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); }} - }; + 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 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); }; + var initHooks = [] + CodeMirror.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 @@ -26694,58 +43564,58 @@ return /******/ (function(modules) { // webpackBootstrap // 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"; } + 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); } + 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; + 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"; + indentation = 0 + how = "not" } else if (how == "smart") { - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); + indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text) if (indentation == Pass || indentation > 150) { if (!aggressive) { return } - how = "prev"; + how = "prev" } } if (how == "prev") { - if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); } - else { indentation = 0; } + 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; + indentation = curSpace + cm.options.indentUnit } else if (how == "subtract") { - indentation = curSpace - cm.options.indentUnit; + indentation = curSpace - cm.options.indentUnit } else if (typeof how == "number") { - indentation = curSpace + how; + indentation = curSpace + how } - indentation = Math.max(0, indentation); + indentation = Math.max(0, indentation) - var indentString = "", pos = 0; + 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); } + { 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; + 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]; + 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)); + var pos$1 = Pos(n, curSpaceString.length) + replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)) break } } @@ -26755,66 +43625,66 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var lastCopied = null function setLastCopied(newLastCopied) { - lastCopied = newLastCopied; + lastCopied = newLastCopied } function applyTextInput(cm, inserted, deleted, sel, origin) { - var doc = cm.doc; - cm.display.shift = false; - if (!sel) { sel = doc.sel; } + 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; + 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 = []; + multiPaste = [] for (var i = 0; i < lastCopied.text.length; i++) - { multiPaste.push(doc.splitLines(lastCopied.text[i])); } + { multiPaste.push(doc.splitLines(lastCopied.text[i])) } } } else if (textLines.length == sel.ranges.length) { - multiPaste = map(textLines, function (l) { return [l]; }); + multiPaste = map(textLines, function (l) { return [l]; }) } } - var updateInput; + 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()) { + var range = sel.ranges[i$1] + var from = range.from(), to = range.to() + if (range.empty()) { if (deleted && deleted > 0) // Handle deletion - { from = Pos(from.line, from.ch - deleted); } + { 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)); } + { 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); } + { from = to = Pos(from.line, 0) } } - updateInput = cm.curOp.updateInput; + 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); + origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")} + makeChange(cm.doc, changeEvent) + signalLater(cm, "inputRead", cm, changeEvent) } if (inserted && !paste) - { triggerElectric(cm, inserted); } + { triggerElectric(cm, inserted) } - ensureCursorVisible(cm); - cm.curOp.updateInput = updateInput; - cm.curOp.typing = true; - cm.state.pasteIncoming = cm.state.cutIncoming = false; + 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"); + var pasted = e.clipboardData && e.clipboardData.getData("Text") if (pasted) { - e.preventDefault(); + e.preventDefault() if (!cm.isReadOnly() && !cm.options.disableInput) - { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); } + { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }) } return true } } @@ -26822,56 +43692,56 @@ return /******/ (function(modules) { // webpackBootstrap 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; + 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; + var range = sel.ranges[i] + if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue } + var mode = cm.getModeAt(range.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"); + indented = indentLine(cm, range.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 (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) + { indented = indentLine(cm, range.head.line, "smart") } } - if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); } + if (indented) { signalLater(cm, "electricInput", cm, range.head.line) } } } function copyableRanges(cm) { - var text = [], ranges = []; + 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)); + 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); + 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;"); + 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 (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); + if (ios) { te.style.border = "1px solid black" } + disableBrowserMagic(te) return div } @@ -26883,59 +43753,59 @@ return /******/ (function(modules) { // webpackBootstrap // CodeMirror.prototype, for backwards compatibility and // convenience. - var addEditorMethods = function(CodeMirror) { - var optionHandlers = CodeMirror.optionHandlers; + function addEditorMethods(CodeMirror) { + var optionHandlers = CodeMirror.optionHandlers - var helpers = CodeMirror.helpers = {}; + var helpers = CodeMirror.helpers = {} CodeMirror.prototype = { constructor: CodeMirror, - focus: function(){window.focus(); this.display.input.focus();}, + focus: function(){window.focus(); this.display.input.focus()}, setOption: function(option, value) { - var options = this.options, old = options[option]; + var options = this.options, old = options[option] if (options[option] == value && option != "mode") { return } - options[option] = value; + options[option] = value if (optionHandlers.hasOwnProperty(option)) - { operation(this, optionHandlers[option])(this, value, old); } - signal(this, "optionChange", this, 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)); + addKeyMap: function(map, bottom) { + this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)) }, - removeKeyMap: function(map$$1) { - var maps = this.state.keyMaps; + removeKeyMap: function(map) { + 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); + { if (maps[i] == map || maps[i].name == map) { + maps.splice(i, 1) return true } } }, addOverlay: methodOp(function(spec, options) { - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); + 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); + function (overlay) { return overlay.priority; }) + this.state.modeGen++ + regChange(this) }), removeOverlay: methodOp(function(spec) { var this$1 = this; - var overlays = this.state.overlays; + var overlays = this.state.overlays for (var i = 0; i < overlays.length; ++i) { - var cur = overlays[i].modeSpec; + 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); + overlays.splice(i, 1) + this$1.state.modeGen++ + regChange(this$1) return } } @@ -26943,30 +43813,30 @@ return /******/ (function(modules) { // webpackBootstrap 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 (dir == null) { dir = this.options.smartIndent ? "smart" : "prev" } + else { dir = dir ? "add" : "subtract" } } - if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); } + 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; + 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; + var range = ranges[i] + if (!range.empty()) { + var from = range.from(), to = range.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; + { 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); } + { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) } + } else if (range.head.line > end) { + indentLine(this$1, range.head.line, how, true) + end = range.head.line + if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) } } } }), @@ -26982,23 +43852,23 @@ return /******/ (function(modules) { // webpackBootstrap }, 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]; } + 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; } + 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; + 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; + var mode = this.doc.mode if (!mode.innerMode) { return mode } return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode }, @@ -27010,40 +43880,40 @@ return /******/ (function(modules) { // webpackBootstrap getHelpers: function(pos, type) { var this$1 = this; - var found = []; + var found = [] if (!helpers.hasOwnProperty(type)) { return found } - var help = helpers[type], mode = this.getModeAt(pos); + var help = helpers[type], mode = this.getModeAt(pos) if (typeof mode[type] == "string") { - if (help[mode[type]]) { found.push(help[mode[type]]); } + 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); } + var val = help[mode[type][i]] + if (val) { found.push(val) } } } else if (mode.helperType && help[mode.helperType]) { - found.push(help[mode.helperType]); + found.push(help[mode.helperType]) } else if (help[mode.name]) { - found.push(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]; + var cur = help._global[i$1] if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1) - { found.push(cur.val); } + { 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); + 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(); } + var pos, range = this.doc.sel.primary() + if (start == null) { pos = range.head } + else if (typeof start == "object") { pos = clipPos(this.doc, start) } + else { pos = start ? range.from() : range.to() } return cursorCoords(this, pos, mode || "page") }, @@ -27052,23 +43922,23 @@ return /******/ (function(modules) { // webpackBootstrap }, coordsChar: function(coords, mode) { - coords = fromCoordSystem(this, coords, mode || "page"); + 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; + 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; + 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); + 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; + lineObj = line } return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + (end ? this.doc.height - heightAtLine(lineObj) : 0) @@ -27080,38 +43950,38 @@ return /******/ (function(modules) { // webpackBootstrap 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); + 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; + 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); + 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; } + { top = pos.top - node.offsetHeight } else if (pos.bottom + node.offsetHeight <= vspace) - { top = pos.bottom; } + { top = pos.bottom } if (left + node.offsetWidth > hspace) - { left = hspace - node.offsetWidth; } + { left = hspace - node.offsetWidth } } - node.style.top = top + "px"; - node.style.left = node.style.right = ""; + node.style.top = top + "px" + node.style.left = node.style.right = "" if (horiz == "right") { - left = display.sizer.clientWidth - node.offsetWidth; - node.style.right = "0px"; + 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 (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}); } + { scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight) } }, triggerOnKeyDown: methodOp(onKeyDown), @@ -27123,16 +43993,16 @@ return /******/ (function(modules) { // webpackBootstrap { return commands[cmd].call(null, this) } }, - triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), + 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); + 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); + cur = findPosH(this$1.doc, cur, dir, unit, visually) if (cur.hitSide) { break } } return cur @@ -27141,36 +44011,36 @@ return /******/ (function(modules) { // webpackBootstrap 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) } + this.extendSelectionsBy(function (range) { + if (this$1.display.shift || this$1.doc.extend || range.empty()) + { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) } else - { return dir < 0 ? range$$1.from() : range$$1.to() } - }, sel_move); + { return dir < 0 ? range.from() : range.to() } + }, sel_move) }), deleteH: methodOp(function(dir, unit) { - var sel = this.doc.sel, doc = this.doc; + var sel = this.doc.sel, doc = this.doc if (sel.somethingSelected()) - { doc.replaceSelection("", null, "+delete"); } + { 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} - }); } + { deleteNearSelection(this, function (range) { + var other = findPosH(doc, range.head, dir, unit, false) + return dir < 0 ? {from: other, to: range.head} : {from: range.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); + 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); + 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 @@ -27179,37 +44049,37 @@ return /******/ (function(modules) { // webpackBootstrap 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) { + var doc = this.doc, goals = [] + var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected() + doc.extendSelectionsBy(function (range) { 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 dir < 0 ? range.from() : range.to() } + var headPos = cursorCoords(this$1, range.head, "div") + if (range.goalColumn != null) { headPos.left = range.goalColumn } + goals.push(headPos.left) + var pos = findPosV(this$1, headPos, dir, unit) + if (unit == "page" && range == doc.sel.primary()) + { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top) } return pos - }, sel_move); + }, sel_move) if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) - { doc.sel.ranges[i].goalColumn = goals[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; + 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 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; } + : 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)) }, @@ -27217,94 +44087,92 @@ return /******/ (function(modules) { // webpackBootstrap toggleOverwrite: function(value) { if (value != null && value == this.state.overwrite) { return } if (this.state.overwrite = !this.state.overwrite) - { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); } + { addClass(this.display.cursorDiv, "CodeMirror-overwrite") } else - { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); } + { rmClass(this.display.cursorDiv, "CodeMirror-overwrite") } - signal(this, "overwriteToggle", this, this.state.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; } + 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; + 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}; + scrollIntoView: methodOp(function(range, margin) { + if (range == null) { + range = {from: this.doc.sel.primary().head, to: null} + if (margin == null) { margin = this.options.cursorScrollMargin } + } else if (typeof range == "number") { + range = {from: Pos(range, 0), to: null} + } else if (range.from == null) { + range = {from: range, to: null} } - if (!range$$1.to) { range$$1.to = range$$1.from; } - range$$1.margin = margin || 0; + if (!range.to) { range.to = range.from } + range.margin = margin || 0 - if (range$$1.from.line != null) { - resolveScrollToPos(this); - this.curOp.scrollToPos = range$$1; + if (range.from.line != null) { + resolveScrollToPos(this) + this.curOp.scrollToPos = range } 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); + var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), + Math.min(range.from.top, range.to.top) - range.margin, + Math.max(range.from.right, range.to.right), + Math.max(range.from.bottom, range.to.bottom) + range.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) { + 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 = this.display.viewFrom + this.doc.iter(lineNo, 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); + { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } } + ++lineNo + }) + 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); + 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); + { 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); + 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 }), @@ -27312,18 +44180,18 @@ return /******/ (function(modules) { // webpackBootstrap getWrapperElement: function(){return this.display.wrapper}, getScrollerElement: function(){return this.display.scroller}, getGutterElement: function(){return this.display.gutters} - }; - eventMixin(CodeMirror); + } + eventMixin(CodeMirror) CodeMirror.registerHelper = function(type, name, value) { - if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; } - helpers[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}); - }; - }; + 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 @@ -27335,59 +44203,59 @@ return /******/ (function(modules) { // webpackBootstrap // 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); + var oldPos = pos + var origDir = dir + var lineObj = getLine(doc, pos.line) function findNextLine() { - var l = pos.line + dir; + var l = pos.line + dir if (l < doc.first || l >= doc.first + doc.size) { return false } - pos = new Pos(l, pos.ch, pos.sticky); + pos = new Pos(l, pos.ch, pos.sticky) return lineObj = getLine(doc, l) } function moveOnce(boundToLine) { - var next; + var next if (visually) { - next = moveVisually(doc.cm, lineObj, pos, dir); + next = moveVisually(doc.cm, lineObj, pos, dir) } else { - next = moveLogically(lineObj, pos, dir); + next = moveLogically(lineObj, pos, dir) } if (next == null) { if (!boundToLine && findNextLine()) - { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); } + { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir) } else { return false } } else { - pos = next; + pos = next } return true } if (unit == "char") { - moveOnce(); + moveOnce() } else if (unit == "column") { - moveOnce(true); + moveOnce(true) } else if (unit == "word" || unit == "group") { - var sawType = null, group = unit == "group"; - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); + 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 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"; } + : "p" + if (group && !first && !type) { type = "s" } if (sawType && sawType != type) { - if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";} + if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after"} break } - if (type) { sawType = type; } + 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; } + var result = skipAtomic(doc, pos, oldPos, origDir, true) + if (equalCursorPos(oldPos, result)) { result.hitSide = true } return result } @@ -27395,21 +44263,21 @@ return /******/ (function(modules) { // webpackBootstrap // "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; + 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; + 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; + y = dir > 0 ? pos.bottom + 3 : pos.top - 3 } - var target; + var target for (;;) { - target = coordsChar(cm, x, y); + target = coordsChar(cm, x, y) if (!target.outside) { break } if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } - y += dir * 5; + y += dir * 5 } return target } @@ -27417,438 +44285,399 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + 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); + 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); } - }); + if (ie_version <= 11) { setTimeout(operation(cm, function () { + if (!input.pollContent()) { regChange(cm) } + }), 20) } + }) on(div, "compositionstart", function (e) { - this$1.composing = {data: e.data, done: false}; - }); + 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}; } - }); + 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; + if (e.data != this$1.composing.data) { this$1.readFromDOMSoon() } + this$1.composing.done = true } - }); + }) - on(div, "touchstart", function () { return input.forceCompositionEnd(); }); + on(div, "touchstart", function () { return input.forceCompositionEnd(); }) on(div, "input", function () { - if (!this$1.composing) { this$1.readFromDOMSoon(); } - }); + 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"); } + 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}); + 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"); - }); + cm.setSelections(ranges.ranges, 0, sel_dontScroll) + cm.replaceSelection("", null, "cut") + }) } } if (e.clipboardData) { - e.clipboardData.clearData(); - var content = lastCopied.text.join("\n"); + 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); + e.clipboardData.setData("Text", content) if (e.clipboardData.getData("Text") == content) { - e.preventDefault(); + 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); + 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); + cm.display.lineSpace.removeChild(kludge) + hadFocus.focus() + if (hadFocus == div) { input.showPrimarySelection() } + }, 50) } - on(div, "copy", onCopyCut); - on(div, "cut", onCopyCut); + on(div, "copy", onCopyCut) + on(div, "cut", onCopyCut) }; ContentEditableInput.prototype.prepareSelection = function () { - var result = prepareSelection(this.cm, false); - result.focus = this.cm.state.focused; + 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); + 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); + 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 start = posToDOM(this.cm, prim.from()) + var end = posToDOM(this.cm, prim.to()) + if (!start && !end) { return } - var view = this.cm.display.view; - var old = sel.rangeCount && sel.getRangeAt(0); + var view = this.cm.display.view + var old = sel.rangeCount && sel.getRangeAt(0) if (!start) { - start = {node: view[0].measure.map[2], offset: 0}; + 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 measure = view[view.length - 1].measure + var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map + end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]} } - var rng; - try { rng = range(start.node, start.offset, end.offset, end.node); } + 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); + sel.collapse(start.node, start.offset) if (!rng.collapsed) { - sel.removeAllRanges(); - sel.addRange(rng); + sel.removeAllRanges() + sel.addRange(rng) } } else { - sel.removeAllRanges(); - sel.addRange(rng); + sel.removeAllRanges() + sel.addRange(rng) } - if (old && sel.anchorNode == null) { sel.addRange(old); } - else if (gecko) { this.startGracePeriod(); } + if (old && sel.anchorNode == null) { sel.addRange(old) } + else if (gecko) { this.startGracePeriod() } } - this.rememberSelection(); + this.rememberSelection() }; ContentEditableInput.prototype.startGracePeriod = function () { var this$1 = this; - clearTimeout(this.gracePeriod); + clearTimeout(this.gracePeriod) this.gracePeriod = setTimeout(function () { - this$1.gracePeriod = false; + this$1.gracePeriod = false if (this$1.selectionChanged()) - { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); } - }, 20); + { 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); + 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; + 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(); + var sel = window.getSelection() if (!sel.rangeCount) { return false } - var node = sel.getRangeAt(0).commonAncestorContainer; + 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(); + { this.showSelection(this.prepareSelection(), true) } + this.div.focus() } }; - ContentEditableInput.prototype.blur = function () { this.div.blur(); }; + 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; + var input = this if (this.selectionInEditor()) - { this.pollSelection(); } + { this.pollSelection() } else - { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } + { 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); + input.pollSelection() + input.polling.set(input.cm.options.pollInterval, poll) } } - this.polling.set(this.cm.options.pollInterval, poll); + this.polling.set(this.cm.options.pollInterval, poll) }; ContentEditableInput.prototype.selectionChanged = function () { - var sel = window.getSelection(); + 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 && this.readDOMTimeout == null && !this.gracePeriod && this.selectionChanged()) { + var sel = window.getSelection(), cm = this.cm + 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 } + }) } } - 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; + 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(); + 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); } + { 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); } + { to = Pos(to.line + 1, 0) } if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false } - var fromIndex, fromLine, fromNode; + 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; + 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; + fromLine = lineNo(display.view[fromIndex].line) + fromNode = display.view[fromIndex - 1].node.nextSibling } - var toIndex = findViewIndex(cm, to.line); - var toLine, toNode; + var toIndex = findViewIndex(cm, to.line) + var toLine, toNode if (toIndex == display.view.length - 1) { - toLine = display.viewTo - 1; - toNode = display.lineDiv.lastChild; + toLine = display.viewTo - 1 + toNode = display.lineDiv.lastChild } else { - toLine = lineNo(display.view[toIndex + 1].line) - 1; - toNode = display.view[toIndex + 1].node.previousSibling; + 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)); + 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++; } + 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); + 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); + { ++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)); + 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++; - } - } + { ++cutEnd } - newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, ""); - newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, ""); + 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); + 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"); + replaceRange(cm.doc, newText, chFrom, chTo, "+input") return true } }; ContentEditableInput.prototype.ensurePolled = function () { - this.forceCompositionEnd(); + this.forceCompositionEnd() }; ContentEditableInput.prototype.reset = function () { - this.forceCompositionEnd(); + this.forceCompositionEnd() }; ContentEditableInput.prototype.forceCompositionEnd = function () { if (!this.composing) { return } - clearTimeout(this.readDOMTimeout); - this.composing = null; - this.updateFromDOM(); - this.div.blur(); - this.div.focus(); + clearTimeout(this.readDOMTimeout) + this.composing = null + if (!this.pollContent()) { regChange(this.cm) } + 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; + this$1.readDOMTimeout = null if (this$1.composing) { - if (this$1.composing.done) { this$1.composing = null; } + 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); }); } + if (this$1.cm.isReadOnly() || !this$1.pollContent()) + { runInOp(this$1.cm, function () { return regChange(this$1.cm); }) } + }, 80) }; ContentEditableInput.prototype.setUneditable = function (node) { - node.contentEditable = "false"; + node.contentEditable = "false" }; ContentEditableInput.prototype.onKeyPress = function (e) { if (e.charCode == 0) { return } - e.preventDefault(); + e.preventDefault() if (!this.cm.isReadOnly()) - { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); } + { 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"); + this.div.contentEditable = String(val != "nocursor") }; ContentEditableInput.prototype.onContextMenu = function () {}; ContentEditableInput.prototype.resetPosition = function () {}; - ContentEditableInput.prototype.needsContentAttribute = true; + ContentEditableInput.prototype.needsContentAttribute = true function posToDOM(cm, pos) { - var view = findViewForLine(cm, pos.line); + 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 line = getLine(cm.doc, pos.line) + var info = mapFromLineView(view, line, pos.line) - var order = getOrder(line, cm.doc.direction), side = "left"; + var order = getOrder(line), side = "left" if (order) { - var partPos = getBidiPartAt(order, pos.ch); - side = partPos % 2 ? "right" : "left"; + 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; + 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(); + 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"); + var cmText = node.getAttribute("cm-text") if (cmText != null) { - addText(cmText || node.textContent.replace(/\u200b/g, "")); + if (cmText == "") { text += node.textContent.replace(/\u200b/g, "") } + else { text += cmText } return } - var markerID = node.getAttribute("cm-marker"), range$$1; + var markerID = node.getAttribute("cm-marker"), range 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)); } + var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)) + if (found.length && (range = found[0].find())) + { text += getBetween(cm.doc, range.from, range.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; } + { walk(node.childNodes[i]) } + if (/^(pre|div|p)$/i.test(node.nodeName)) + { closing = true } } else if (node.nodeType == 3) { - addText(node.nodeValue); + var val = node.nodeValue + if (!val) { return } + if (closing) { + text += lineSep + closing = false + } + text += val } } for (;;) { - walk(from); + walk(from) if (from == to) { break } - from = from.nextSibling; + from = from.nextSibling } return text } function domToPos(cm, node, offset) { - var lineNode; + var lineNode if (node == cm.display.lineDiv) { - lineNode = cm.display.lineDiv.childNodes[offset]; + lineNode = cm.display.lineDiv.childNodes[offset] if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) } - node = null; offset = 0; + node = null; offset = 0 } else { for (lineNode = node;; lineNode = lineNode.parentNode) { if (!lineNode || lineNode == cm.display.lineDiv) { return null } @@ -27856,196 +44685,196 @@ return /******/ (function(modules) { // webpackBootstrap } } for (var i = 0; i < cm.display.view.length; i++) { - var lineView = cm.display.view[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; + 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; + bad = true + node = wrapper.childNodes[offset] + offset = 0 if (!node) { - var line = lineView.rest ? lst(lineView.rest) : lineView.line; + 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; + 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; } + textNode = node.firstChild + if (offset) { offset = textNode.nodeValue.length } } - while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; } - var measure = lineView.measure, maps = measure.maps; + 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]; + var map = i < 0 ? measure.map : maps[i] + for (var j = 0; j < map.length; j += 3) { + var curNode = map[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)]; } + var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]) + var ch = map[j] + offset + if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)] } return Pos(line, ch) } } } } - var found = find(textNode, topNode, offset); + 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); + found = find(after, after.firstChild, 0) if (found) { return badPos(Pos(found.line, found.ch - dist), bad) } else - { dist += after.textContent.length; } + { dist += after.textContent.length } } for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) { - found = find(before, before.firstChild, -1); + found = find(before, before.firstChild, -1) if (found) { return badPos(Pos(found.line, found.ch + dist$1), bad) } else - { dist$1 += before.textContent.length; } + { dist$1 += before.textContent.length } } } // TEXTAREA INPUT STYLE var TextareaInput = function(cm) { - this.cm = cm; + this.cm = cm // See input.poll and input.reset - this.prevInput = ""; + 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; + this.pollingFast = false // Self-resetting timeout for the poller - this.polling = new Delayed(); + 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; + 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; + this.hasSelection = false + this.composing = null }; TextareaInput.prototype.init = function (display) { var this$1 = this; - var input = this, cm = this.cm; + var input = this, cm = this.cm // Wraps and hides input textarea - var div = this.wrapper = hiddenTextarea(); + 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); + 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"; } + if (ios) { te.style.width = "0px" } on(te, "input", function () { - if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; } - input.poll(); - }); + 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(); - }); + cm.state.pasteIncoming = true + input.fastPoll() + }) function prepareCopyCut(e) { if (signalDOMEvent(cm, e)) { return } if (cm.somethingSelected()) { - setLastCopied({lineWise: false, text: cm.getSelections()}); + setLastCopied({lineWise: false, text: cm.getSelections()}) if (input.inaccurateSelection) { - input.prevInput = ""; - input.inaccurateSelection = false; - te.value = lastCopied.text.join("\n"); - selectInput(te); + 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}); + var ranges = copyableRanges(cm) + setLastCopied({lineWise: true, text: ranges.text}) if (e.type == "cut") { - cm.setSelections(ranges.ranges, null, sel_dontScroll); + cm.setSelections(ranges.ranges, null, sel_dontScroll) } else { - input.prevInput = ""; - te.value = ranges.text.join("\n"); - selectInput(te); + input.prevInput = "" + te.value = ranges.text.join("\n") + selectInput(te) } } - if (e.type == "cut") { cm.state.cutIncoming = true; } + if (e.type == "cut") { cm.state.cutIncoming = true } } - on(te, "cut", prepareCopyCut); - on(te, "copy", prepareCopyCut); + 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(); - }); + 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); } - }); + if (!eventInWidget(display, e)) { e_preventDefault(e) } + }) on(te, "compositionstart", function () { - var start = cm.getCursor("from"); - if (input.composing) { input.composing.range.clear(); } + 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; + 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); + 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(); + 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)); + headPos.top + lineOff.top - wrapOff.top)) result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, - headPos.left + lineOff.left - wrapOff.left)); + 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); + 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"; + this.wrapper.style.top = drawn.teTop + "px" + this.wrapper.style.left = drawn.teLeft + "px" } }; @@ -28053,21 +44882,21 @@ return /******/ (function(modules) { // webpackBootstrap // 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; + var minimal, selected, cm = this.cm, doc = cm.doc if (cm.somethingSelected()) { - this.prevInput = ""; - var range$$1 = doc.sel.primary(); + this.prevInput = "" + var range = 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; } + (range.to().line - range.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.prevInput = this.textarea.value = "" + if (ie && ie_version >= 9) { this.hasSelection = null } } - this.inaccurateSelection = minimal; + this.inaccurateSelection = minimal }; TextareaInput.prototype.getField = function () { return this.textarea }; @@ -28076,18 +44905,18 @@ return /******/ (function(modules) { // webpackBootstrap TextareaInput.prototype.focus = function () { if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { - try { this.textarea.focus(); } + 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.blur = function () { this.textarea.blur() }; TextareaInput.prototype.resetPosition = function () { - this.wrapper.style.top = this.wrapper.style.left = 0; + this.wrapper.style.top = this.wrapper.style.left = 0 }; - TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); }; + 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. @@ -28096,23 +44925,23 @@ return /******/ (function(modules) { // webpackBootstrap if (this.pollingFast) { return } this.polling.set(this.cm.options.pollInterval, function () { - this$1.poll(); - if (this$1.cm.state.focused) { this$1.slowPoll(); } - }); + 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; + 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();} + 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); + input.polling.set(20, p) }; // Read input from the textarea, and update the document to match. @@ -28124,7 +44953,7 @@ return /******/ (function(modules) { // webpackBootstrap TextareaInput.prototype.poll = function () { var this$1 = this; - var cm = this.cm, input = this.textarea, prevInput = this.prevInput; + 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, @@ -28134,7 +44963,7 @@ return /******/ (function(modules) { // webpackBootstrap cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) { return false } - var text = input.value; + var text = input.value // If nothing changed, bail. if (text == prevInput && !cm.somethingSelected()) { return false } // Work around nonsensical selection resetting in IE9/10, and @@ -28142,288 +44971,287 @@ return /******/ (function(modules) { // webpackBootstrap // some key combos in Mac (#2689). if (ie && ie_version >= 9 && this.hasSelection === text || mac && /[\uf700-\uf7ff]/.test(text)) { - cm.display.input.reset(); + cm.display.input.reset() return false } if (cm.doc.sel == cm.display.selForContextMenu) { - var first = text.charCodeAt(0); - if (first == 0x200b && !prevInput) { prevInput = "\u200b"; } + 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; } + 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); + 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 (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.clear() this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"), - {className: "CodeMirror-composing"}); + {className: "CodeMirror-composing"}) } - }); + }) return true }; TextareaInput.prototype.ensurePolled = function () { - if (this.pollingFast && this.poll()) { this.pollingFast = false; } + if (this.pollingFast && this.poll()) { this.pollingFast = false } }; TextareaInput.prototype.onKeyPress = function () { - if (ie && ie_version >= 9) { this.hasSelection = null; } - this.fastPoll(); + 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; + 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; + var reset = cm.options.resetSelectionOnContextMenu if (reset && cm.doc.sel.contains(pos) == -1) - { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); } + { 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(); + 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); + 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; + 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; + 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); } + 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(); } + 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); + operation(cm, selectAll)(cm) } else if (i++ < 10) { - display.detectingSelectAll = setTimeout(poll, 500); + display.detectingSelectAll = setTimeout(poll, 500) } else { - display.selForContextMenu = null; - display.input.reset(); + display.selForContextMenu = null + display.input.reset() } - }; - display.detectingSelectAll = setTimeout(poll, 200); + } + display.detectingSelectAll = setTimeout(poll, 200) } } - if (ie && ie_version >= 9) { prepareSelectAllHack(); } + if (ie && ie_version >= 9) { prepareSelectAllHack() } if (captureRightClick) { - e_stop(e); + e_stop(e) var mouseup = function () { - off(window, "mouseup", mouseup); - setTimeout(rehide, 20); - }; - on(window, "mouseup", mouseup); + off(window, "mouseup", mouseup) + setTimeout(rehide, 20) + } + on(window, "mouseup", mouseup) } else { - setTimeout(rehide, 50); + setTimeout(rehide, 50) } }; TextareaInput.prototype.readOnlyChanged = function (val) { - if (!val) { this.reset(); } + if (!val) { this.reset() } }; TextareaInput.prototype.setUneditable = function () {}; - TextareaInput.prototype.needsContentAttribute = false; + TextareaInput.prototype.needsContentAttribute = false function fromTextArea(textarea, options) { - options = options ? copyObj(options) : {}; - options.value = textarea.value; + options = options ? copyObj(options) : {} + options.value = textarea.value if (!options.tabindex && textarea.tabIndex) - { options.tabindex = textarea.tabIndex; } + { options.tabindex = textarea.tabIndex } if (!options.placeholder && textarea.placeholder) - { 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(); + var hasFocus = activeElt() options.autofocus = hasFocus == textarea || - textarea.getAttribute("autofocus") != null && hasFocus == document.body; + textarea.getAttribute("autofocus") != null && hasFocus == document.body } - function save() {textarea.value = cm.getValue();} + function save() {textarea.value = cm.getValue()} - var realSubmit; + var realSubmit if (textarea.form) { - on(textarea.form, "submit", save); + 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; + var form = textarea.form + realSubmit = form.submit try { var wrappedSubmit = form.submit = function () { - save(); - form.submit = realSubmit; - form.submit(); - form.submit = wrappedSubmit; - }; + save() + form.submit = realSubmit + form.submit() + form.submit = wrappedSubmit + } } catch(e) {} } } options.finishInit = function (cm) { - cm.save = save; - cm.getTextArea = function () { return textarea; }; + 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 = ""; + 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); + off(textarea.form, "submit", save) if (typeof textarea.form.submit == "function") - { textarea.form.submit = realSubmit; } + { textarea.form.submit = realSubmit } } - }; - }; + } + } - textarea.style.display = "none"; - var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); }, - options); + textarea.style.display = "none" + var cm = CodeMirror(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; + 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); + defineOptions(CodeMirror) - addEditorMethods(CodeMirror$1); + addEditorMethods(CodeMirror) // Set up methods on CodeMirror's prototype to redirect to the editor's document. - var dontDelegate = "iter insert remove copy getEditor constructor".split(" "); + 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) { + { CodeMirror.prototype[prop] = (function(method) { return function() {return method.apply(this.doc, arguments)} - })(Doc.prototype[prop]); } } + })(Doc.prototype[prop]) } } - eventMixin(Doc); + eventMixin(Doc) // INPUT HANDLING - CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}; + CodeMirror.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.defineMode = function(name/*, mode, …*/) { + if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name } + defineMode.apply(this, arguments) + } - CodeMirror$1.defineMIME = defineMIME; + CodeMirror.defineMIME = defineMIME // Minimal default mode. - CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }); - CodeMirror$1.defineMIME("text/plain", "null"); + CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }) + CodeMirror.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.defineExtension = function (name, func) { + CodeMirror.prototype[name] = func + } + CodeMirror.defineDocExtension = function (name, func) { + Doc.prototype[name] = func + } - CodeMirror$1.fromTextArea = fromTextArea; + CodeMirror.fromTextArea = fromTextArea - addLegacyProps(CodeMirror$1); + addLegacyProps(CodeMirror) - CodeMirror$1.version = "5.25.0"; + CodeMirror.version = "5.24.2" - return CodeMirror$1; + return CodeMirror; }))); - /***/ }, /* 307 */ /***/ function(module, exports) { @@ -29071,7 +45899,6 @@ return /******/ (function(modules) { // webpackBootstrap 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); @@ -29099,7 +45926,6 @@ return /******/ (function(modules) { // webpackBootstrap 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) { @@ -30470,7 +47296,7 @@ return /******/ (function(modules) { // webpackBootstrap "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", + "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "tamil", @@ -31361,7 +48187,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 316 */, +/* 316 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, /* 317 */, /* 318 */ /***/ function(module, exports, __webpack_require__) { @@ -31563,39 +48394,26 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.resumed = resumed; - exports.paused = paused; - exports.pauseOnExceptions = pauseOnExceptions; - exports.command = command; - exports.stepIn = stepIn; - exports.stepOver = stepOver; - exports.stepOut = stepOut; - exports.resume = resume; - exports.breakOnNext = breakOnNext; - exports.selectFrame = selectFrame; - exports.loadObjectProperties = loadObjectProperties; - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _sources = __webpack_require__(254); - - var _promise = __webpack_require__(193); - - var _selectors = __webpack_require__(242); - - var _pause = __webpack_require__(255); - - var _expressions = __webpack_require__(252); - - 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 constants = __webpack_require__(229); + + var _require = __webpack_require__(254), + selectSource = _require.selectSource; + + var _require2 = __webpack_require__(193), + PROMISE = _require2.PROMISE; + + var _require3 = __webpack_require__(242), + getPause = _require3.getPause, + getLoadedObject = _require3.getLoadedObject; + + var _require4 = __webpack_require__(255), + updateFrameLocations = _require4.updateFrameLocations; + + var _require5 = __webpack_require__(252), + evaluateExpressions = _require5.evaluateExpressions; + /** * Redux actions for the pause state * @module actions/pause @@ -31615,7 +48433,7 @@ return /******/ (function(modules) { // webpackBootstrap // dispatch(evaluateExpressions(null)); return dispatch({ - type: _constants2.default.RESUME, + type: constants.RESUME, value: undefined }); }; @@ -31633,26 +48451,25 @@ return /******/ (function(modules) { // webpackBootstrap var _ref2 = _asyncToGenerator(function* (_ref3) { var dispatch = _ref3.dispatch, getState = _ref3.getState, - client = _ref3.client, - sourceMaps = _ref3.sourceMaps; + client = _ref3.client; var frames = pauseInfo.frames, why = pauseInfo.why, loadedObjects = pauseInfo.loadedObjects; - frames = yield (0, _pause.updateFrameLocations)(frames, sourceMaps); + frames = yield updateFrameLocations(frames); var frame = frames[0]; dispatch({ - type: _constants2.default.PAUSED, + type: constants.PAUSED, pauseInfo: { why, frame }, frames: frames, selectedFrameId: frame.id, loadedObjects: loadedObjects || [] }); - dispatch((0, _expressions.evaluateExpressions)(frame.id)); + dispatch(evaluateExpressions(frame.id)); - dispatch((0, _sources.selectSource)(frame.location.sourceId, { line: frame.location.line })); + dispatch(selectSource(frame.location.sourceId, { line: frame.location.line })); }); return function (_x) { @@ -31672,10 +48489,10 @@ return /******/ (function(modules) { // webpackBootstrap client = _ref4.client; dispatch({ - type: _constants2.default.PAUSE_ON_EXCEPTIONS, + type: constants.PAUSE_ON_EXCEPTIONS, shouldPauseOnExceptions, shouldIgnoreCaughtExceptions, - [_promise.PROMISE]: client.pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) + [PROMISE]: client.pauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) }); }; } @@ -31698,7 +48515,7 @@ return /******/ (function(modules) { // webpackBootstrap client[type](); return dispatch({ - type: _constants2.default.COMMAND, + type: constants.COMMAND, value: undefined }); }; @@ -31715,7 +48532,7 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref7.dispatch, getState = _ref7.getState; - if ((0, _selectors.getPause)(getState())) { + if (getPause(getState())) { return dispatch(command({ type: "stepIn" })); } }; @@ -31732,7 +48549,7 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref8.dispatch, getState = _ref8.getState; - if ((0, _selectors.getPause)(getState())) { + if (getPause(getState())) { return dispatch(command({ type: "stepOver" })); } }; @@ -31749,7 +48566,7 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref9.dispatch, getState = _ref9.getState; - if ((0, _selectors.getPause)(getState())) { + if (getPause(getState())) { return dispatch(command({ type: "stepOut" })); } }; @@ -31766,7 +48583,7 @@ return /******/ (function(modules) { // webpackBootstrap var dispatch = _ref10.dispatch, getState = _ref10.getState; - if ((0, _selectors.getPause)(getState())) { + if (getPause(getState())) { return dispatch(command({ type: "resume" })); } }; @@ -31788,7 +48605,7 @@ return /******/ (function(modules) { // webpackBootstrap client.breakOnNext(); return dispatch({ - type: _constants2.default.BREAK_ON_NEXT, + type: constants.BREAK_ON_NEXT, value: true }); }; @@ -31802,10 +48619,10 @@ return /******/ (function(modules) { // webpackBootstrap return (_ref12) => { var dispatch = _ref12.dispatch; - dispatch((0, _expressions.evaluateExpressions)(frame.id)); - dispatch((0, _sources.selectSource)(frame.location.sourceId, { line: frame.location.line })); + dispatch(evaluateExpressions(frame.id)); + dispatch(selectSource(frame.location.sourceId, { line: frame.location.line })); dispatch({ - type: _constants2.default.SELECT_FRAME, + type: constants.SELECT_FRAME, frame }); }; @@ -31823,46 +48640,57 @@ return /******/ (function(modules) { // webpackBootstrap var objectId = object.actor || object.objectId; - if ((0, _selectors.getLoadedObject)(getState(), objectId)) { + if (getLoadedObject(getState(), objectId)) { return; } dispatch({ - type: _constants2.default.LOAD_OBJECT_PROPERTIES, + type: constants.LOAD_OBJECT_PROPERTIES, objectId, - [_promise.PROMISE]: client.getProperties(object) + [PROMISE]: client.getProperties(object) }); }; } + module.exports = { + resumed, + paused, + pauseOnExceptions, + command, + stepIn, + stepOut, + stepOver, + resume, + breakOnNext, + selectFrame, + loadObjectProperties + }; + /***/ }, /* 320 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.willNavigate = willNavigate; - exports.navigated = navigated; - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - var _editor = __webpack_require__(257); - - var _sources = __webpack_require__(232); - - var _utils = __webpack_require__(234); - - var _sources2 = __webpack_require__(254); - - 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 constants = __webpack_require__(229); + + var _require = __webpack_require__(246), + clearSourceMaps = _require.clearSourceMaps; + + var _require2 = __webpack_require__(257), + clearDocuments = _require2.clearDocuments; + + var _require3 = __webpack_require__(232), + getSources = _require3.getSources; + + var _require4 = __webpack_require__(234), + waitForMs = _require4.waitForMs; + + var _require5 = __webpack_require__(254), + newSources = _require5.newSources; + /** * Redux actions for the navigation state * @module actions/navigation @@ -31872,27 +48700,13 @@ return /******/ (function(modules) { // webpackBootstrap * @memberof actions/navigation * @static */ - function willNavigate(_, event) { - return (() => { - var _ref = _asyncToGenerator(function* (_ref2) { - var dispatch = _ref2.dispatch, - getState = _ref2.getState, - client = _ref2.client, - sourceMaps = _ref2.sourceMaps; - yield sourceMaps.clearSourceMaps(); - (0, _editor.clearDocuments)(); - dispatch({ - type: _constants2.default.NAVIGATE, - url: event.url - }); - }); + function willNavigate() { + clearSourceMaps(); + clearDocuments(); - return function (_x) { - return _ref.apply(this, arguments); - }; - })(); + return { type: constants.NAVIGATE }; } /** @@ -31901,105 +48715,68 @@ return /******/ (function(modules) { // webpackBootstrap */ function navigated() { return (() => { - var _ref3 = _asyncToGenerator(function* (_ref4) { - var dispatch = _ref4.dispatch, - getState = _ref4.getState, - client = _ref4.client; + var _ref = _asyncToGenerator(function* (_ref2) { + var dispatch = _ref2.dispatch, + getState = _ref2.getState, + client = _ref2.client; - yield (0, _utils.waitForMs)(100); - if ((0, _sources.getSources)(getState()).size == 0) { + yield waitForMs(100); + if (getSources(getState()).size == 0) { var sources = yield client.fetchSources(); - dispatch((0, _sources2.newSources)(sources)); + dispatch(newSources(sources)); } }); - return function (_x2) { - return _ref3.apply(this, arguments); + return function (_x) { + return _ref.apply(this, arguments); }; })(); } + module.exports = { + willNavigate, + navigated + }; + /***/ }, /* 321 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.toggleProjectSearch = toggleProjectSearch; - exports.toggleFileSearch = toggleFileSearch; - exports.setFileSearchQuery = setFileSearchQuery; - exports.toggleFileSearchModifier = toggleFileSearchModifier; - exports.showSource = showSource; - exports.togglePaneCollapse = togglePaneCollapse; + var constants = __webpack_require__(229); - var _constants = __webpack_require__(229); + var _require = __webpack_require__(242), + getSource = _require.getSource, + getFileSearchState = _require.getFileSearchState; - var _constants2 = _interopRequireDefault(_constants); - - var _selectors = __webpack_require__(242); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function toggleProjectSearch(toggleValue) { + function toggleFileSearch() { return (_ref) => { var dispatch = _ref.dispatch, getState = _ref.getState; - if (toggleValue != null) { - dispatch({ - type: _constants2.default.TOGGLE_PROJECT_SEARCH, - value: toggleValue - }); - } else { - dispatch({ - type: _constants2.default.TOGGLE_PROJECT_SEARCH, - value: !(0, _selectors.getProjectSearchState)(getState()) - }); - } + dispatch({ + type: constants.SET_FILE_SEARCH, + searchOn: !getFileSearchState(getState()) + }); }; } - function toggleFileSearch(toggleValue) { + function closeFileSearch() { + return { + type: constants.SET_FILE_SEARCH, + searchOn: false + }; + } + + function showSource(sourceId) { return (_ref2) => { var dispatch = _ref2.dispatch, getState = _ref2.getState; - if (toggleValue != null) { - dispatch({ - type: _constants2.default.TOGGLE_FILE_SEARCH, - value: toggleValue - }); - } else { - dispatch({ - type: _constants2.default.TOGGLE_FILE_SEARCH, - value: !(0, _selectors.getFileSearchState)(getState()) - }); - } - }; - } - - function setFileSearchQuery(query) { - return { - type: _constants2.default.UPDATE_FILE_SEARCH_QUERY, - query - }; - } - - function toggleFileSearchModifier(modifier) { - return { type: _constants2.default.TOGGLE_FILE_SEARCH_MODIFIER, modifier }; - } - - function showSource(sourceId) { - return (_ref3) => { - var dispatch = _ref3.dispatch, - getState = _ref3.getState; - - var source = (0, _selectors.getSource)(getState(), sourceId); + var source = getSource(getState(), sourceId); dispatch({ - type: _constants2.default.SHOW_SOURCE, + type: constants.SHOW_SOURCE, sourceUrl: source.get("url") }); }; @@ -32007,31 +48784,30 @@ return /******/ (function(modules) { // webpackBootstrap function togglePaneCollapse(position, paneCollapsed) { return { - type: _constants2.default.TOGGLE_PANE, + type: constants.TOGGLE_PANE, position, paneCollapsed }; } + module.exports = { + toggleFileSearch, + closeFileSearch, + showSource, + togglePaneCollapse + }; + /***/ }, /* 322 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.recordCoverage = recordCoverage; - - var _constants = __webpack_require__(229); - - var _constants2 = _interopRequireDefault(_constants); - - 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 constants = __webpack_require__(229); + + function recordCoverage() { return (() => { var _ref = _asyncToGenerator(function* (_ref2) { @@ -32043,7 +48819,7 @@ return /******/ (function(modules) { // webpackBootstrap coverage = _ref3.coverage; return dispatch({ - type: _constants2.default.RECORD_COVERAGE, + type: constants.RECORD_COVERAGE, value: { coverage } }); }); @@ -32054,6 +48830,10 @@ return /******/ (function(modules) { // webpackBootstrap })(); } + module.exports = { + recordCoverage + }; + /***/ }, /* 323 */ /***/ function(module, exports) { @@ -32076,7 +48856,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 328 */, -/* 329 */, +/* 329 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, /* 330 */, /* 331 */ /***/ function(module, exports) { @@ -32085,7 +48870,144 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 332 */, -/* 333 */, +/* 333 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; + + var _require = __webpack_require__(151), + connect = _require.connect; + + var _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; + + var actions = __webpack_require__(244); + + var _require3 = __webpack_require__(242), + getSources = _require3.getSources, + getSelectedSource = _require3.getSelectedSource, + getFileSearchState = _require3.getFileSearchState; + + var _require4 = __webpack_require__(234), + endTruncateStr = _require4.endTruncateStr; + + var _require5 = __webpack_require__(334), + parseURL = _require5.parse; + + var _require6 = __webpack_require__(233), + isPretty = _require6.isPretty; + + __webpack_require__(340); + + var Autocomplete = createFactory(__webpack_require__(342)); + + function searchResults(sources) { + function getSourcePath(source) { + var _parseURL = parseURL(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 => !isPretty(source.toJS()) && source.get("url")).map(source => ({ + value: getSourcePath(source), + title: getSourcePath(source).split("/").pop(), + subtitle: endTruncateStr(getSourcePath(source), 100), + id: source.get("id") + })).toJS(); + } + + var Search = React.createClass({ + propTypes: { + sources: PropTypes.object.isRequired, + selectSource: PropTypes.func.isRequired, + selectedSource: PropTypes.object, + toggleFileSearch: PropTypes.func.isRequired, + closeFileSearch: PropTypes.func.isRequired, + searchOn: PropTypes.bool + }, + + contextTypes: { + shortcuts: PropTypes.object + }, + + displayName: "Search", + + getInitialState() { + return { + inputValue: "" + }; + }, + + 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.toggleFileSearch(); + }, + + onEscape(shortcut, e) { + if (this.props.searchOn) { + e.preventDefault(); + this.setState({ inputValue: "" }); + this.props.closeFileSearch(); + } + }, + + close() { + var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + + this.setState({ inputValue }); + this.props.closeFileSearch(); + }, + + render() { + if (!this.props.searchOn) { + return null; + } + + return 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" + })); + } + + }); + + module.exports = connect(state => ({ + sources: getSources(state), + selectedSource: getSelectedSource(state), + searchOn: getFileSearchState(state) + }), dispatch => bindActionCreators(actions, dispatch))(Search); + +/***/ }, /* 334 */ /***/ function(module, exports, __webpack_require__) { @@ -32112,7 +49034,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var punycode = __webpack_require__(916); + var punycode = __webpack_require__(335); var util = __webpack_require__(336); exports.parse = urlParse; @@ -32824,7 +49746,541 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 335 */, +/* 335 */ +/***/ 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; }()))) + +/***/ }, /* 336 */ /***/ function(module, exports) { @@ -33013,71 +50469,79 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 340 */, +/* 340 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, /* 341 */, /* 342 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - var _fuzzaldrinPlus = __webpack_require__(161); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _resultList = __webpack_require__(343); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - __webpack_require__(386); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; 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 _require2 = __webpack_require__(161), + filter = _require2.filter; - class Autocomplete extends _react.Component { + var classnames = __webpack_require__(175); - constructor(props) { - super(props); + var _require3 = __webpack_require__(343), + scrollList = _require3.scrollList; - this.onKeyDown = this.onKeyDown.bind(this); - this.state = { - inputValue: props.inputValue, + var Svg = __webpack_require__(344); + var SearchInput = createFactory(__webpack_require__(377)); + var ResultList = createFactory(__webpack_require__(383)); + + __webpack_require__(386); + + var Autocomplete = React.createClass({ + propTypes: { + selectItem: PropTypes.func.isRequired, + onSelectedItem: PropTypes.func, + items: PropTypes.array, + close: PropTypes.func.isRequired, + inputValue: PropTypes.string.isRequired, + placeholder: PropTypes.string, + size: PropTypes.string + }, + + displayName: "Autocomplete", + + getInitialState() { + return { + inputValue: this.props.inputValue, selectedIndex: 0, focused: false }; - } + }, + + getDefaultProps() { + return { + size: "" + }; + }, componentDidMount() { var endOfInput = this.state.inputValue.length; - var node = findDOMNode(this); - if (node instanceof HTMLElement) { - var searchInput = node.querySelector("input"); - if (searchInput instanceof HTMLInputElement) { - searchInput.focus(); - searchInput.setSelectionRange(endOfInput, endOfInput); - } - } - } + var searchInput = findDOMNode(this).querySelector("input"); + searchInput.focus(); + searchInput.setSelectionRange(endOfInput, endOfInput); + }, componentDidUpdate() { if (this.refs.resultList && this.refs.resultList.refs) { - (0, _resultList.scrollList)(this.refs.resultList.refs, this.state.selectedIndex); + scrollList(this.refs.resultList.refs, this.state.selectedIndex); } - } + }, getSearchResults() { var inputValue = this.state.inputValue; @@ -33085,27 +50549,27 @@ return /******/ (function(modules) { // webpackBootstrap if (inputValue == "") { return []; } - return (0, _fuzzaldrinPlus.filter)(this.props.items, this.state.inputValue, { + return filter(this.props.items, this.state.inputValue, { key: "value" }); - } + }, onKeyDown(e) { var searchResults = this.getSearchResults(), resultCount = searchResults.length; if (e.key === "ArrowUp") { - var _selectedIndex = Math.max(0, this.state.selectedIndex - 1); - this.setState({ selectedIndex: _selectedIndex }); + var selectedIndex = Math.max(0, this.state.selectedIndex - 1); + this.setState({ selectedIndex }); if (this.props.onSelectedItem) { - this.props.onSelectedItem(searchResults[_selectedIndex]); + this.props.onSelectedItem(searchResults[selectedIndex]); } e.preventDefault(); } else if (e.key === "ArrowDown") { - var _selectedIndex2 = Math.min(resultCount - 1, this.state.selectedIndex + 1); - this.setState({ selectedIndex: _selectedIndex2 }); + var _selectedIndex = Math.min(resultCount - 1, this.state.selectedIndex + 1); + this.setState({ selectedIndex: _selectedIndex }); if (this.props.onSelectedItem) { - this.props.onSelectedItem(searchResults[_selectedIndex2]); + this.props.onSelectedItem(searchResults[_selectedIndex]); } e.preventDefault(); } else if (e.key === "Enter") { @@ -33119,7 +50583,7 @@ return /******/ (function(modules) { // webpackBootstrap this.props.close(this.state.inputValue); e.preventDefault(); } - } + }, renderResults(results) { var size = this.props.size; @@ -33135,9 +50599,9 @@ return /******/ (function(modules) { // webpackBootstrap ref: "resultList" }); } else if (this.state.inputValue && !results.length) { - return _react.DOM.div({ className: "no-result-msg" }, (0, _Svg2.default)("sad-face"), L10N.getFormatStr("sourceSearch.noResults", this.state.inputValue)); + return dom.div({ className: "no-result-msg" }, Svg("sad-face"), L10N.getFormatStr("sourceSearch.noResults", this.state.inputValue)); } - } + }, render() { var focused = this.state.focused; @@ -33145,7 +50609,7 @@ return /******/ (function(modules) { // webpackBootstrap var searchResults = this.getSearchResults(); var summaryMsg = L10N.getFormatStr("sourceSearch.resultsSummary1", searchResults.length); - return _react.DOM.div({ className: (0, _classnames2.default)("autocomplete", { focused }) }, SearchInput({ + return dom.div({ className: classnames("autocomplete", { focused }) }, SearchInput({ query: this.state.inputValue, count: searchResults.length, placeholder: this.props.placeholder, @@ -33161,24 +50625,9 @@ return /******/ (function(modules) { // webpackBootstrap handleClose: this.props.close }), this.renderResults(searchResults)); } - } + }); - exports.default = Autocomplete; - Autocomplete.propTypes = { - selectItem: _react.PropTypes.func.isRequired, - onSelectedItem: _react.PropTypes.func, - items: _react.PropTypes.array, - close: _react.PropTypes.func.isRequired, - inputValue: _react.PropTypes.string.isRequired, - placeholder: _react.PropTypes.string, - size: _react.PropTypes.string - }; - - Autocomplete.displayName = "Autocomplete"; - - Autocomplete.defaultProps = { - size: "" - }; + module.exports = Autocomplete; /***/ }, /* 343 */ @@ -33186,7 +50635,7 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - var _require = __webpack_require__(828), + var _require = __webpack_require__(65), isFirefox = _require.isFirefox; function scrollList(resultList, index) { @@ -33257,22 +50706,14 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _Svg = __webpack_require__(345); - - var _Svg2 = _interopRequireDefault(_Svg); - - 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. */ + var Svg = __webpack_require__(345); - exports.default = _Svg2.default; + __webpack_require__(375); + + module.exports = Svg; /***/ }, /* 345 */ @@ -33285,36 +50726,33 @@ return /******/ (function(modules) { // webpackBootstrap var svg = { "angle-brackets": __webpack_require__(347), - arrow: __webpack_require__(348), - blackBox: __webpack_require__(349), - breakpoint: __webpack_require__(350), + "arrow": __webpack_require__(348), + "blackBox": __webpack_require__(349), + "breakpoint": __webpack_require__(350), "case-match": __webpack_require__(351), - close: __webpack_require__(352), - domain: __webpack_require__(353), - file: __webpack_require__(354), - folder: __webpack_require__(355), - globe: __webpack_require__(356), + "close": __webpack_require__(352), + "domain": __webpack_require__(353), + "file": __webpack_require__(354), + "folder": __webpack_require__(355), + "globe": __webpack_require__(356), "magnifying-glass": __webpack_require__(357), - "arrow-up": __webpack_require__(919), - "arrow-down": __webpack_require__(920), - pause: __webpack_require__(358), + "pause": __webpack_require__(358), "pause-exceptions": __webpack_require__(359), - plus: __webpack_require__(360), - prettyPrint: __webpack_require__(361), - react: __webpack_require__(970), + "plus": __webpack_require__(360), + "prettyPrint": __webpack_require__(361), "regex-match": __webpack_require__(362), - resume: __webpack_require__(363), - settings: __webpack_require__(364), - stepIn: __webpack_require__(365), - stepOut: __webpack_require__(366), - stepOver: __webpack_require__(367), - subSettings: __webpack_require__(368), - toggleBreakpoints: __webpack_require__(369), - togglePanes: __webpack_require__(370), + "resume": __webpack_require__(363), + "settings": __webpack_require__(364), + "stepIn": __webpack_require__(365), + "stepOut": __webpack_require__(366), + "stepOver": __webpack_require__(367), + "subSettings": __webpack_require__(368), + "toggleBreakpoints": __webpack_require__(369), + "togglePanes": __webpack_require__(370), "whole-word-match": __webpack_require__(371), - worker: __webpack_require__(372), + "worker": __webpack_require__(372), "sad-face": __webpack_require__(373), - refresh: __webpack_require__(374) + "refresh": __webpack_require__(374) }; module.exports = function (name, props) { @@ -33666,37 +51104,38 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); - - var _devtoolsConfig = __webpack_require__(828); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _Close = __webpack_require__(378); - - var _Close2 = _interopRequireDefault(_Close); + var classnames = __webpack_require__(175); + var Svg = __webpack_require__(344); + var CloseButton = __webpack_require__(378); __webpack_require__(381); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var SearchInput = React.createClass({ + propTypes: { + query: PropTypes.string.isRequired, + count: PropTypes.number.isRequired, + placeholder: PropTypes.string.isRequired, + summaryMsg: PropTypes.string.isRequired, + onChange: PropTypes.func.isRequired, + handleClose: PropTypes.func.isRequired, + onKeyUp: PropTypes.func, + onKeyDown: PropTypes.func, + onFocus: PropTypes.func, + onBlur: PropTypes.func, + size: PropTypes.string + }, - class SearchInput extends _react.Component { + displayName: "SearchInput", - static get defaultProps() { + getDefaultProps() { return { size: "" }; - } + }, renderSvg() { var _props = this.props, @@ -33705,56 +51144,31 @@ return /******/ (function(modules) { // webpackBootstrap if (count == 0 && query.trim() != "") { - return (0, _Svg2.default)("sad-face"); + return Svg("sad-face"); } - return (0, _Svg2.default)("magnifying-glass"); - } - - renderNav() { - if (!(0, _devtoolsConfig.isEnabled)("searchNav")) { - return; - } - - var _props2 = this.props, - count = _props2.count, - handleNext = _props2.handleNext, - handlePrev = _props2.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 Svg("magnifying-glass"); + }, 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 _props2 = this.props, + query = _props2.query, + placeholder = _props2.placeholder, + count = _props2.count, + summaryMsg = _props2.summaryMsg, + onChange = _props2.onChange, + onKeyDown = _props2.onKeyDown, + onKeyUp = _props2.onKeyUp, + onFocus = _props2.onFocus, + onBlur = _props2.onBlur, + handleClose = _props2.handleClose, + size = _props2.size; - return _react.DOM.div({ + return dom.div({ className: `search-field ${size}` - }, this.renderSvg(), _react.DOM.input({ - className: (0, _classnames2.default)({ + }, this.renderSvg(), dom.input({ + className: classnames({ empty: count == 0 && query.trim() != "" }), onChange, @@ -33765,30 +51179,14 @@ return /******/ (function(modules) { // webpackBootstrap placeholder, value: query, spellCheck: false - }), _react.DOM.div({ className: "summary" }, query != "" ? summaryMsg : ""), this.renderNav(), (0, _Close2.default)({ + }), dom.div({ className: "summary" }, query != "" ? summaryMsg : ""), CloseButton({ handleClick: handleClose, buttonClass: size })); } - } + }); - SearchInput.propTypes = { - query: _react.PropTypes.string.isRequired, - count: _react.PropTypes.number.isRequired, - placeholder: _react.PropTypes.string.isRequired, - summaryMsg: _react.PropTypes.string.isRequired, - onChange: _react.PropTypes.func.isRequired, - handleClose: _react.PropTypes.func.isRequired, - onKeyUp: _react.PropTypes.func, - onKeyDown: _react.PropTypes.func, - onFocus: _react.PropTypes.func, - onBlur: _react.PropTypes.func, - size: _react.PropTypes.string, - handleNext: _react.PropTypes.func, - handlePrev: _react.PropTypes.func - }; - - exports.default = SearchInput; + module.exports = SearchInput; /***/ }, /* 378 */ @@ -33796,38 +51194,31 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); + var Svg = __webpack_require__(344); __webpack_require__(379); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function CloseButton(_ref) { var handleClick = _ref.handleClick, buttonClass = _ref.buttonClass, tooltip = _ref.tooltip; - return _react.DOM.div({ - className: buttonClass ? `close-btn ${buttonClass}` : "close-btn", + return dom.div({ + className: buttonClass ? `close-btn-${buttonClass}` : "close-btn", onClick: handleClick, title: tooltip - }, (0, _Svg2.default)("close")); + }, Svg("close")); } - CloseButton.propTypes = { - handleClick: _react.PropTypes.func.isRequired + handleClick: PropTypes.func.isRequired }; - exports.default = CloseButton; + module.exports = CloseButton; /***/ }, /* 379 */ @@ -33849,60 +51240,53 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); + var classnames = __webpack_require__(175); __webpack_require__(384); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var ResultList = React.createClass({ + propTypes: { + items: PropTypes.array.isRequired, + selected: PropTypes.number.isRequired, + selectItem: PropTypes.func.isRequired, + size: PropTypes.string + }, - class ResultList extends _react.Component { + displayName: "ResultList", - constructor(props) { - super(props); - this.renderListItem = this.renderListItem.bind(this); - } + getDefaultProps() { + return { + size: "" + }; + }, renderListItem(item, index) { - return _react.DOM.li({ - onClick: event => this.props.selectItem(event, item, index), + return dom.li({ + onClick: () => this.props.selectItem(item), key: `${item.id}${item.value}${index}`, ref: index, title: item.value, - className: (0, _classnames2.default)({ + className: classnames({ selected: index === this.props.selected }) - }, _react.DOM.div({ className: "title" }, item.title), _react.DOM.div({ className: "subtitle" }, item.subtitle)); - } + }, dom.div({ className: "title" }, item.title), dom.div({ className: "subtitle" }, item.subtitle)); + }, render() { var size = this.props.size; size = size || ""; - return _react.DOM.ul({ + return dom.ul({ className: `result-list ${size}` }, this.props.items.map(this.renderListItem)); } - } + }); - exports.default = ResultList; - ResultList.propTypes = { - items: _react.PropTypes.array.isRequired, - selected: _react.PropTypes.number.isRequired, - selectItem: _react.PropTypes.func.isRequired, - size: _react.PropTypes.string - }; - - ResultList.defaultProps = { - size: "" - }; + module.exports = ResultList; /***/ }, /* 384 */ @@ -33924,53 +51308,49 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); + var ImPropTypes = __webpack_require__(150); - var _reactImmutableProptypes = __webpack_require__(150); + var _require = __webpack_require__(3), + bindActionCreators = _require.bindActionCreators; - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); + var _require2 = __webpack_require__(151), + connect = _require2.connect; - var _redux = __webpack_require__(3); + var _require3 = __webpack_require__(389), + formatKeyShortcut = _require3.formatKeyShortcut; - var _reactRedux = __webpack_require__(151); + var SourcesTree = React.createFactory(__webpack_require__(390)); + var actions = __webpack_require__(244); - var _text = __webpack_require__(389); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _selectors = __webpack_require__(242); + var _require4 = __webpack_require__(242), + getSelectedSource = _require4.getSelectedSource, + getSources = _require4.getSources; __webpack_require__(424); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var Sources = React.createClass({ + propTypes: { + sources: ImPropTypes.map.isRequired, + selectSource: PropTypes.func.isRequired, + horizontal: PropTypes.bool.isRequired, + toggleFileSearch: PropTypes.func.isRequired + }, - var Outline = (0, _react.createFactory)(__webpack_require__(921).default); - - var SourcesTree = (0, _react.createFactory)(__webpack_require__(390).default); - - - class Sources extends _react.Component { - - constructor(props) { - super(props); - this.renderShortcut = this.renderShortcut.bind(this); - } + displayName: "Sources", renderShortcut() { if (this.props.horizontal) { - return _react.DOM.span({ + return dom.span({ className: "sources-header-info", dir: "ltr", - onClick: () => this.props.toggleProjectSearch() - }, L10N.getFormatStr("sources.search", (0, _text.formatKeyShortcut)(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`))); + onClick: () => this.props.toggleFileSearch() + }, L10N.getFormatStr("sources.search", formatKeyShortcut(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`))); } - } + }, render() { var _props = this.props, @@ -33978,22 +51358,12 @@ return /******/ (function(modules) { // webpackBootstrap selectSource = _props.selectSource; - return _react.DOM.div({ className: "sources-panel" }, _react.DOM.div({ className: "sources-header" }, this.renderShortcut()), SourcesTree({ sources, selectSource }), Outline({})); + return dom.div({ className: "sources-panel" }, dom.div({ className: "sources-header" }, this.renderShortcut()), SourcesTree({ sources, selectSource })); } - } + }); - Sources.propTypes = { - sources: _reactImmutableProptypes2.default.map.isRequired, - selectSource: _react.PropTypes.func.isRequired, - horizontal: _react.PropTypes.bool.isRequired, - toggleProjectSearch: _react.PropTypes.func.isRequired - }; - - Sources.displayName = "Sources"; - - exports.default = (0, _reactRedux.connect)(state => ({ - sources: (0, _selectors.getSources)(state) - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Sources); + module.exports = connect(state => ({ selectedSource: getSelectedSource(state), + sources: getSources(state) }), dispatch => bindActionCreators(actions, dispatch))(Sources); /***/ }, /* 389 */ @@ -34006,7 +51376,7 @@ return /******/ (function(modules) { // webpackBootstrap * @module utils/text */ - var _require = __webpack_require__(830), + var _require = __webpack_require__(28), appinfo = _require.Services.appinfo; var isMacOS = appinfo.OS === "Darwin"; @@ -34028,7 +51398,7 @@ return /******/ (function(modules) { // webpackBootstrap if (isMacOS) { return shortcut.replace(/Shift\+/g, "\u21E7+").replace(/Command\+|Cmd\+/g, "\u2318+").replace(/CommandOrControl\+|CmdOrCtrl\+/g, "\u2318+").replace(/Alt\+/g, "\u2325+"); } - return shortcut.replace(/CommandOrControl\+|CmdOrCtrl\+/g, `${L10N.getStr("ctrl")}+`); + return shortcut.replace(/CommandOrControl\+|CmdOrCtrl\+/g, "Ctrl+"); } module.exports = { @@ -34041,88 +51411,81 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); - var _redux = __webpack_require__(3); + var _require = __webpack_require__(3), + bindActionCreators = _require.bindActionCreators; - var _reactRedux = __webpack_require__(151); + var _require2 = __webpack_require__(151), + connect = _require2.connect; - var _react = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _classnames = __webpack_require__(175); + var classnames = __webpack_require__(175); + var ImPropTypes = __webpack_require__(150); - var _classnames2 = _interopRequireDefault(_classnames); + var _require3 = __webpack_require__(146), + Set = _require3.Set; - var _reactImmutableProptypes = __webpack_require__(150); + var _require4 = __webpack_require__(242), + getShownSource = _require4.getShownSource, + getSelectedSource = _require4.getSelectedSource; - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); + var _require5 = __webpack_require__(391), + nodeHasChildren = _require5.nodeHasChildren, + createParentMap = _require5.createParentMap, + isDirectory = _require5.isDirectory, + addToTree = _require5.addToTree, + collapseTree = _require5.collapseTree, + createTree = _require5.createTree, + getDirectories = _require5.getDirectories; - var _immutable = __webpack_require__(146); + var ManagedTree = React.createFactory(__webpack_require__(419)); + var actions = __webpack_require__(244); + var Svg = __webpack_require__(344); - var _selectors = __webpack_require__(242); + var _require6 = __webpack_require__(422), + showMenu = _require6.showMenu; - var _sourcesTree = __webpack_require__(391); + var _require7 = __webpack_require__(423), + copyToTheClipboard = _require7.copyToTheClipboard; - var _actions = __webpack_require__(244); + var _require8 = __webpack_require__(234), + throttle = _require8.throttle; - var _actions2 = _interopRequireDefault(_actions); + var SourcesTree = React.createClass({ + propTypes: { + sources: ImPropTypes.map.isRequired, + selectSource: PropTypes.func.isRequired, + shownSource: PropTypes.string, + selectedSource: ImPropTypes.map + }, - var _Svg = __webpack_require__(344); + displayName: "SourcesTree", - var _Svg2 = _interopRequireDefault(_Svg); + getInitialState() { + return createTree(this.props.sources); + }, - var _devtoolsLaunchpad = __webpack_require__(131); + queueUpdate: throttle(function () { + if (!this.isMounted()) { + return; + } - var _clipboard = __webpack_require__(423); - - var _utils = __webpack_require__(234); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var ManagedTree = (0, _react.createFactory)(__webpack_require__(419).default); - - - class SourcesTree extends _react.Component { - - constructor(props) { - super(props); - this.state = (0, _sourcesTree.createTree)(this.props.sources, this.props.debuggeeUrl); - - this.focusItem = this.focusItem.bind(this); - this.selectItem = this.selectItem.bind(this); - this.getIcon = this.getIcon.bind(this); - this.onContextMenu = this.onContextMenu.bind(this); - this.renderItem = this.renderItem.bind(this); - - this.queueUpdate = (0, _utils.throttle)(function () { - if (!this.mounted) { - return; - } - - this.forceUpdate(); - }, 50); - } - - componentDidMount() { - this.mounted = true; - } - - componentWillUnMount() { - this.mounted = false; - } + this.forceUpdate(); + }, 50), shouldComponentUpdate() { this.queueUpdate(); return false; - } + }, componentWillReceiveProps(nextProps) { var selectedSource = this.props.selectedSource; if (nextProps.shownSource && nextProps.shownSource != this.props.shownSource) { - var _listItems = (0, _sourcesTree.getDirectories)(nextProps.shownSource, this.state.sourceTree); + var _listItems = getDirectories(nextProps.shownSource, this.state.sourceTree); if (_listItems && _listItems[0]) { this.selectItem(_listItems[0]); @@ -34132,7 +51495,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (nextProps.selectedSource && nextProps.selectedSource != selectedSource) { - var _highlightItems = (0, _sourcesTree.getDirectories)(nextProps.selectedSource.get("url"), this.state.sourceTree); + var _highlightItems = getDirectories(nextProps.selectedSource.get("url"), this.state.sourceTree); return this.setState({ highlightItems: _highlightItems }); } @@ -34142,53 +51505,51 @@ return /******/ (function(modules) { // webpackBootstrap } if (nextProps.sources.size === 0) { - this.setState((0, _sourcesTree.createTree)(nextProps.sources, this.props.debuggeeUrl)); + this.setState(createTree(nextProps.sources)); return; } - var next = (0, _immutable.Set)(nextProps.sources.valueSeq()); - var prev = (0, _immutable.Set)(this.props.sources.valueSeq()); + var next = Set(nextProps.sources.valueSeq()); + var prev = Set(this.props.sources.valueSeq()); var newSet = next.subtract(prev); var uncollapsedTree = this.state.uncollapsedTree; for (var source of newSet) { - (0, _sourcesTree.addToTree)(uncollapsedTree, source, this.props.debuggeeUrl); + addToTree(uncollapsedTree, source); } // TODO: recreating the tree every time messes with the expanded // state of ManagedTree, because it depends on item instances // being the same. The result is that if a source is added at a // later time, all expanded state is lost. - var sourceTree = newSet.size > 0 ? (0, _sourcesTree.collapseTree)(uncollapsedTree) : this.state.sourceTree; + var sourceTree = newSet.size > 0 ? collapseTree(uncollapsedTree) : this.state.sourceTree; - this.setState({ - uncollapsedTree, + this.setState({ uncollapsedTree, sourceTree, - parentMap: (0, _sourcesTree.createParentMap)(sourceTree) - }); - } + parentMap: createParentMap(sourceTree) }); + }, focusItem(item) { this.setState({ focusedItem: item }); - } + }, selectItem(item) { - if (!(0, _sourcesTree.nodeHasChildren)(item)) { + if (!nodeHasChildren(item)) { this.props.selectSource(item.contents.get("id")); } - } + }, getIcon(item, depth) { if (depth === 0) { - return (0, _Svg2.default)("domain"); + return Svg("domain"); } - if (!(0, _sourcesTree.nodeHasChildren)(item)) { - return (0, _Svg2.default)("file"); + if (!nodeHasChildren(item)) { + return Svg("file"); } - return (0, _Svg2.default)("folder"); - } + return Svg("folder"); + }, onContextMenu(event, item) { var copySourceUrlLabel = L10N.getStr("copySourceUrl"); @@ -34199,30 +51560,28 @@ return /******/ (function(modules) { // webpackBootstrap var menuOptions = []; - if (!(0, _sourcesTree.isDirectory)(item)) { + if (!isDirectory(item)) { var source = item.contents.get("url"); var copySourceUrl = { id: "node-menu-copy-source", label: copySourceUrlLabel, accesskey: copySourceUrlKey, disabled: false, - click: () => (0, _clipboard.copyToTheClipboard)(source) + click: () => copyToTheClipboard(source) }; menuOptions.push(copySourceUrl); } - (0, _devtoolsLaunchpad.showMenu)(event, menuOptions); - } + showMenu(event, menuOptions); + }, renderItem(item, depth, focused, _, expanded, _ref) { var setExpanded = _ref.setExpanded; - var arrow = (0, _Svg2.default)("arrow", { - className: (0, _classnames2.default)({ - expanded: expanded, - hidden: !(0, _sourcesTree.nodeHasChildren)(item) - }), + var arrow = Svg("arrow", { + className: classnames({ expanded: expanded, + hidden: !nodeHasChildren(item) }), onClick: e => { e.stopPropagation(); setExpanded(item, !expanded); @@ -34235,8 +51594,8 @@ return /******/ (function(modules) { // webpackBootstrap paddingDir = document.body.parentElement.dir == "ltr" ? "paddingLeft" : "paddingRight"; } - return _react.DOM.div({ - className: (0, _classnames2.default)("node", { focused }), + return dom.div({ + className: classnames("node", { focused }), style: { [paddingDir]: `${depth * 15}px` }, key: item.path, onClick: () => { @@ -34244,10 +51603,10 @@ return /******/ (function(modules) { // webpackBootstrap setExpanded(item, !expanded); }, onContextMenu: e => this.onContextMenu(e, item) - }, _react.DOM.div(null, arrow, icon, item.name)); - } + }, dom.div(null, arrow, icon, item.name)); + }, - render() { + render: function () { var _state = this.state, focusedItem = _state.focusedItem, sourceTree = _state.sourceTree, @@ -34263,7 +51622,7 @@ return /******/ (function(modules) { // webpackBootstrap return parentMap.get(item); }, getChildren: item => { - if ((0, _sourcesTree.nodeHasChildren)(item)) { + if (nodeHasChildren(item)) { return item.contents; } return []; @@ -34279,14 +51638,7 @@ return /******/ (function(modules) { // webpackBootstrap renderItem: this.renderItem }); - var noSourcesMessage = _react.DOM.div({ - className: "no-sources-message" - }, L10N.getStr("sources.noSourcesAvailable")); - - if (isEmpty) { - return noSourcesMessage; - } - return _react.DOM.div({ + return dom.div({ className: "sources-list", onKeyDown: e => { if (e.keyCode === 13 && focusedItem) { @@ -34295,25 +51647,14 @@ return /******/ (function(modules) { // webpackBootstrap } }, tree); } - } + }); - SourcesTree.propTypes = { - sources: _reactImmutableProptypes2.default.map.isRequired, - selectSource: _react.PropTypes.func.isRequired, - shownSource: _react.PropTypes.string, - selectedSource: _reactImmutableProptypes2.default.map, - debuggeeUrl: _react.PropTypes.string.isRequired - }; - - SourcesTree.displayName = "SourcesTree"; - - exports.default = (0, _reactRedux.connect)(state => { + module.exports = connect(state => { return { - shownSource: (0, _selectors.getShownSource)(state), - selectedSource: (0, _selectors.getSelectedSource)(state), - debuggeeUrl: (0, _selectors.getDebuggeeUrl)(state) + shownSource: getShownSource(state), + selectedSource: getSelectedSource(state) }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SourcesTree); + }, dispatch => bindActionCreators(actions, dispatch))(SourcesTree); /***/ }, /* 391 */ @@ -34488,15 +51829,14 @@ return /******/ (function(modules) { // webpackBootstrap var parts = url.path.split("/").filter(p => p !== ""); // Assume that all urls point to files except when they end with '/' - // Or directory node has children - return parts.length === 0 || url.path.slice(-1) === "/" || nodeHasChildren(url); + return parts.length === 0 || url.path.slice(-1) === "/"; } /** * @memberof utils/sources-tree * @static */ - function addToTree(tree, source, debuggeeUrl) { + function addToTree(tree, source) { var url = getURL(source.get("url")); if (IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || !url.group || isPretty(source.toJS())) { @@ -34525,7 +51865,7 @@ return /******/ (function(modules) { // webpackBootstrap assert(nodeHasChildren(subtree), `${subtree.name} should have children`); var children = subtree.contents; - var index = determineFileSortOrder(children, part, isLastPart, i === 0 ? debuggeeUrl : ""); + var index = determineFileSortOrder(children, part, isLastPart); if (index >= 0 && children[index].name === part) { // A node with the same name already exists, simply traverse @@ -34553,28 +51893,13 @@ return /******/ (function(modules) { // webpackBootstrap } } - /** - * @memberof utils/sources-tree - * @static - */ - function isExactUrlMatch(pathPart, debuggeeUrl) { - // compare to hostname with an optional 'www.' prefix - var _parse2 = parse(debuggeeUrl), - host = _parse2.host; - - if (!host) { - return false; - } - return host.replace(/^www\./, "") === pathPart.replace(/^www\./, ""); - } - /** * Look at the nodes in the source tree, and determine the index of where to * insert a new node. The ordering is index -> folder -> file. * @memberof utils/sources-tree * @static */ - function determineFileSortOrder(nodes, pathPart, isLastPart, debuggeeUrl) { + function determineFileSortOrder(nodes, pathPart, isLastPart) { var partIsDir = !isLastPart || pathPart.indexOf(".") === -1; return nodes.findIndex(node => { @@ -34586,21 +51911,6 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - // Directory or not, checking root url must be done first - if (debuggeeUrl) { - var rootUrlMatch = isExactUrlMatch(pathPart, debuggeeUrl); - var nodeUrlMatch = isExactUrlMatch(node.name, debuggeeUrl); - if (rootUrlMatch) { - // pathPart matches root url and must go first - return true; - } - if (nodeUrlMatch) { - // Examined item matches root url and must go first - return false; - } - // If neither is the case, continue to compare alphabetically - } - // If both the pathPart and node are the same type, then compare them // alphabetically. if (partIsDir === nodeIsDir) { @@ -34643,19 +51953,17 @@ return /******/ (function(modules) { // webpackBootstrap * @memberof utils/sources-tree * @static */ - function createTree(sources, debuggeeUrl) { + function createTree(sources) { var uncollapsedTree = createNode("root", "", []); for (var source of sources.valueSeq()) { - addToTree(uncollapsedTree, source, debuggeeUrl); + addToTree(uncollapsedTree, source); } var sourceTree = collapseTree(uncollapsedTree); - return { - uncollapsedTree, + return { uncollapsedTree, sourceTree, parentMap: createParentMap(sourceTree), - focusedItem: null - }; + focusedItem: null }; } function findSource(sourceTree, sourceUrl) { @@ -34706,8 +52014,7 @@ return /******/ (function(modules) { // webpackBootstrap collapseTree, createTree, getDirectories, - getURL, - isExactUrlMatch + getURL }; /***/ }, @@ -35678,30 +52985,26 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _react = __webpack_require__(2); - var Tree = (0, _react.createFactory)(__webpack_require__(830).Tree); + var Tree = (0, _react.createFactory)(__webpack_require__(26).Tree); __webpack_require__(420); - class ManagedTree extends _react.Component { + var ManagedTree = (0, _react.createClass)({ + propTypes: Object.assign({}, Tree.propTypes, { + getExpanded: _react.PropTypes.func, + setExpanded: _react.PropTypes.func + }), - constructor() { - super(); + displayName: "ManagedTree", - this.state = { + getInitialState() { + return { expanded: new Set(), focusedItem: null }; - - var self = this; - self.setExpanded = this.setExpanded.bind(this); - self.focusItem = this.focusItem.bind(this); - } + }, componentWillReceiveProps(nextProps) { var listItems = nextProps.listItems; @@ -35713,20 +53016,20 @@ return /******/ (function(modules) { // webpackBootstrap if (highlightItems && highlightItems != this.props.highlightItems && highlightItems.length) { this.highlightItem(highlightItems); } - } + }, componentWillMount() { if (this.props.getExpanded) { var _expanded = this.props.getExpanded(); this.setState({ expanded: _expanded }); } - } + }, componentWillUnmount() { if (this.props.setExpanded) { this.props.setExpanded(this.state.expanded); } - } + }, setExpanded(item, isExpanded) { var expanded = this.state.expanded; @@ -35743,14 +53046,14 @@ return /******/ (function(modules) { // webpackBootstrap } else if (!expanded && this.props.onCollapse) { this.props.onCollapse(item); } - } + }, expandListItems(listItems) { var expanded = this.state.expanded; listItems.forEach(item => expanded.add(this.props.getKey(item))); this.focusItem(listItems[0]); this.setState({ expanded: expanded }); - } + }, highlightItem(highlightItems) { var expanded = this.state.expanded; @@ -35764,7 +53067,7 @@ return /******/ (function(modules) { // webpackBootstrap var index = highlightItems.reverse().findIndex(item => !expanded.has(this.props.getKey(item))); this.focusItem(highlightItems[index]); } - } + }, focusItem(item) { if (!this.props.disabledFocus && this.state.focusedItem !== item) { @@ -35774,7 +53077,7 @@ return /******/ (function(modules) { // webpackBootstrap this.props.onFocus(item); } } - } + }, render() { var _this = this; @@ -35807,16 +53110,9 @@ return /******/ (function(modules) { // webpackBootstrap return Tree(props); } - } - - ManagedTree.displayName = "ManagedTree"; - - ManagedTree.propTypes = Object.assign({}, Tree.propTypes, { - getExpanded: _react.PropTypes.func, - setExpanded: _react.PropTypes.func }); - exports.default = ManagedTree; + module.exports = ManagedTree; /***/ }, /* 420 */ @@ -35826,7 +53122,105 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 421 */, -/* 422 */, +/* 422 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var _require = __webpack_require__(26), + Menu = _require.Menu, + MenuItem = _require.MenuItem; + + var _require2 = __webpack_require__(65), + isFirefoxPanel = _require2.isFirefoxPanel; + + function createPopup(doc) { + var popup = doc.createElement("menupopup"); + + 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 + }; + +/***/ }, /* 423 */ /***/ function(module, exports) { @@ -35862,113 +53256,119 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; - var _react = __webpack_require__(2); - var _reactImmutableProptypes = __webpack_require__(150); + var ReactDOM = __webpack_require__(22); + var ImPropTypes = __webpack_require__(150); - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); + var _require = __webpack_require__(3), + bindActionCreators = _require.bindActionCreators; - var _redux = __webpack_require__(3); + var _require2 = __webpack_require__(151), + connect = _require2.connect; - var _reactRedux = __webpack_require__(151); + var classnames = __webpack_require__(175); - var _classnames = __webpack_require__(175); + var _require3 = __webpack_require__(233), + getMode = _require3.getMode; - var _classnames2 = _interopRequireDefault(_classnames); + var Footer = createFactory(__webpack_require__(427)); + var SearchBar = createFactory(__webpack_require__(433)); + var GutterMenu = __webpack_require__(655); + var EditorMenu = __webpack_require__(656); + var Preview = createFactory(__webpack_require__(657).default); - var _debounce = __webpack_require__(651); + var _require4 = __webpack_require__(711), + renderConditionalPanel = _require4.renderConditionalPanel; - var _debounce2 = _interopRequireDefault(_debounce); + var _require5 = __webpack_require__(131), + debugGlobal = _require5.debugGlobal; - var _source = __webpack_require__(233); + var _require6 = __webpack_require__(65), + isEnabled = _require6.isEnabled; - var _GutterMenu = __webpack_require__(655); + var _require7 = __webpack_require__(242), + getSourceText = _require7.getSourceText, + getBreakpointsForSource = _require7.getBreakpointsForSource, + getSelectedLocation = _require7.getSelectedLocation, + getSelectedFrame = _require7.getSelectedFrame, + getSelectedSource = _require7.getSelectedSource, + getHitCountForSource = _require7.getHitCountForSource, + getCoverageEnabled = _require7.getCoverageEnabled, + getLoadedObjects = _require7.getLoadedObjects; - var _GutterMenu2 = _interopRequireDefault(_GutterMenu); + var _require8 = __webpack_require__(236), + makeLocationId = _require8.makeLocationId; - var _EditorMenu = __webpack_require__(656); + var actions = __webpack_require__(244); + var Breakpoint = React.createFactory(__webpack_require__(714)); + var HitMarker = React.createFactory(__webpack_require__(715)); - var _EditorMenu2 = _interopRequireDefault(_EditorMenu); + var _require9 = __webpack_require__(257), + getDocument = _require9.getDocument, + setDocument = _require9.setDocument, + shouldShowFooter = _require9.shouldShowFooter, + clearLineClass = _require9.clearLineClass, + onKeyDown = _require9.onKeyDown, + createEditor = _require9.createEditor, + isTextForSource = _require9.isTextForSource, + breakpointAtLine = _require9.breakpointAtLine, + getTextForLine = _require9.getTextForLine, + getCursorLine = _require9.getCursorLine, + resizeBreakpointGutter = _require9.resizeBreakpointGutter, + traverseResults = _require9.traverseResults; - var _ConditionalPanel = __webpack_require__(711); - - var _devtoolsLaunchpad = __webpack_require__(131); - - var _devtoolsConfig = __webpack_require__(828); - - var _selectors = __webpack_require__(242); - - var _breakpoints = __webpack_require__(236); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _editor = __webpack_require__(257); - - var _scopes = __webpack_require__(732); + var _require10 = __webpack_require__(65), + isFirefox = _require10.isFirefox; __webpack_require__(716); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var Editor = React.createClass({ + propTypes: { + breakpoints: ImPropTypes.map.isRequired, + hitCount: PropTypes.object, + selectedLocation: PropTypes.object, + selectedSource: ImPropTypes.map, + sourceText: PropTypes.object, + addBreakpoint: PropTypes.func, + disableBreakpoint: PropTypes.func, + enableBreakpoint: PropTypes.func, + removeBreakpoint: PropTypes.func, + setBreakpointCondition: PropTypes.func, + selectSource: PropTypes.func, + jumpToMappedLocation: PropTypes.func, + showSource: PropTypes.func, + coverageOn: PropTypes.bool, + selectedFrame: PropTypes.object, + addExpression: PropTypes.func, + horizontal: PropTypes.bool + }, - 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"); }); }; } + displayName: "Editor", - var ReactDOM = __webpack_require__(22); - - - var Footer = (0, _react.createFactory)(__webpack_require__(427).default); - var SearchBar = (0, _react.createFactory)(__webpack_require__(433).default); - - var Preview = (0, _react.createFactory)(__webpack_require__(657).default); - - var Breakpoint = (0, _react.createFactory)(__webpack_require__(714).default); - var HitMarker = (0, _react.createFactory)(__webpack_require__(715).default); - - var cssVars = { - searchbarHeight: "var(--editor-searchbar-height)", - secondSearchbarHeight: "var(--editor-second-searchbar-height)", - footerHeight: "var(--editor-footer-height)" - }; - - class Editor extends _react.Component { - - constructor() { - super(); - - this.cbPanel = null; - this.editor = null; - this.pendingJumpLine = null; - this.lastJumpLine = null; - - this.state = { + getInitialState() { + return { + query: "", searchResults: { index: -1, count: 0 }, selectedToken: null, - selectedExpression: null + searchModifiers: { + caseSensitive: true, + wholeWord: false, + regexMatch: false + } }; + }, - var self = this; - self.closeConditionalPanel = this.closeConditionalPanel.bind(this); - self.onEscape = this.onEscape.bind(this); - self.onGutterClick = this.onGutterClick.bind(this); - self.onGutterContextMenu = this.onGutterContextMenu.bind(this); - self.onScroll = this.onScroll.bind(this); - self.onSearchAgain = this.onSearchAgain.bind(this); - self.onToggleBreakpoint = this.onToggleBreakpoint.bind(this); - self.previewSelectedToken = (0, _debounce2.default)(this.previewSelectedToken.bind(this), 100); - self.toggleBreakpoint = this.toggleBreakpoint.bind(this); - // eslint-disable-next-line max-len - self.toggleBreakpointDisabledStatus = this.toggleBreakpointDisabledStatus.bind(this); - self.toggleConditionalPanel = this.toggleConditionalPanel.bind(this); - self.updateSearchResults = this.updateSearchResults.bind(this); - } + contextTypes: { + shortcuts: PropTypes.object + }, componentWillReceiveProps(nextProps) { // This lifecycle method is responsible for updating the editor @@ -35980,42 +53380,46 @@ return /******/ (function(modules) { // webpackBootstrap if (!sourceText) { this.showMessage(""); - } else if (!(0, _editor.isTextForSource)(sourceText)) { + } else if (!isTextForSource(sourceText)) { this.showMessage(sourceText.get("error") || L10N.getStr("loadingText")); } else if (this.props.sourceText !== sourceText) { this.showSourceText(sourceText, selectedLocation); } this.setDebugLine(nextProps.selectedFrame, selectedLocation); - (0, _editor.resizeBreakpointGutter)(this.editor.codeMirror); - } + resizeBreakpointGutter(this.editor.codeMirror); + }, - setupEditor() { - var editor = (0, _editor.createEditor)(); + componentDidMount() { + this.cbPanel = null; + + this.editor = createEditor(); // disables the default search shortcuts - editor._initShortcuts = () => {}; + this.editor._initShortcuts = () => {}; - var node = ReactDOM.findDOMNode(this); - if (node instanceof HTMLElement) { - editor.appendToLocalElement(node.querySelector(".editor-mount")); - } - - var codeMirror = editor.codeMirror; + this.editor.appendToLocalElement(ReactDOM.findDOMNode(this).querySelector(".editor-mount")); + var codeMirror = this.editor.codeMirror; var codeMirrorWrapper = codeMirror.getWrapperElement(); - (0, _editor.resizeBreakpointGutter)(codeMirror); - (0, _devtoolsLaunchpad.debugGlobal)("cm", codeMirror); - codeMirror.on("gutterClick", this.onGutterClick); // Set code editor wrapper to be focusable codeMirrorWrapper.tabIndex = 0; - codeMirrorWrapper.addEventListener("keydown", e => this.onKeyDown(e)); - codeMirrorWrapper.addEventListener("mouseover", e => this.onMouseOver(e)); + codeMirrorWrapper.addEventListener("keydown", e => onKeyDown(codeMirror, e)); - if (!(0, _devtoolsConfig.isFirefox)()) { + var ctx = { ed: this.editor, cm: codeMirror }; + var _state = this.state, + query = _state.query, + searchModifiers = _state.searchModifiers; + + + codeMirrorWrapper.addEventListener("mouseup", e => this.onMouseUp(e, ctx, searchModifiers)); + + codeMirrorWrapper.addEventListener("mouseover", e => this.onMouseOver(e, ctx, searchModifiers)); + + if (!isFirefox()) { codeMirror.on("gutterContextMenu", (cm, line, eventName, event) => this.onGutterContextMenu(event)); codeMirror.on("contextmenu", (cm, event) => this.openMenu(event, cm)); @@ -36025,29 +53429,43 @@ return /******/ (function(modules) { // webpackBootstrap codeMirror.on("scroll", this.onScroll); - return editor; - } - - componentDidMount() { - this.cbPanel = null; - this.editor = this.setupEditor(); - - var _props = this.props, - selectedSource = _props.selectedSource, - sourceText = _props.sourceText; var shortcuts = this.context.shortcuts; + shortcuts.on("CmdOrCtrl+B", (key, e) => { + e.preventDefault(); + this.toggleBreakpoint(getCursorLine(codeMirror)); + }); + + shortcuts.on("CmdOrCtrl+Shift+B", (key, e) => { + e.preventDefault(); + this.toggleConditionalPanel(getCursorLine(codeMirror)); + }); + // The default Esc command is overridden in the CodeMirror keymap to allow + // the Esc keypress event to be catched by the toolbox and trigger the + // split console. Restore it here, but preventDefault if and only if there + // is a multiselection. + shortcuts.on("Esc", (key, e) => { + if (codeMirror.listSelections().length > 1) { + codeMirror.execCommand("singleSelection"); + e.preventDefault(); + } + }); var searchAgainKey = L10N.getStr("sourceSearch.search.again.key"); + shortcuts.on(`CmdOrCtrl+Shift+${searchAgainKey}`, (_, e) => traverseResults(e, ctx, query, "prev", searchModifiers)); + shortcuts.on(`CmdOrCtrl+${searchAgainKey}`, (_, e) => traverseResults(e, ctx, query, "next", searchModifiers)); - shortcuts.on("CmdOrCtrl+B", this.onToggleBreakpoint); - shortcuts.on("CmdOrCtrl+Shift+B", this.onToggleBreakpoint); - shortcuts.on("Esc", this.onEscape); - shortcuts.on(`CmdOrCtrl+Shift+${searchAgainKey}`, this.onSearchAgain); - shortcuts.on(`CmdOrCtrl+${searchAgainKey}`, this.onSearchAgain); + resizeBreakpointGutter(codeMirror); + debugGlobal("cm", codeMirror); - (0, _editor.updateDocument)(this.editor, selectedSource, sourceText); - } + if (this.props.selectedSource) { + var sourceId = this.props.selectedSource.get("id"); + var doc = getDocument(sourceId) || this.editor.createDocument(); + this.editor.replaceDocument(doc); + } else if (this.props.sourceText) { + this.setText(this.props.sourceText.get("text")); + } + }, componentWillUnmount() { this.editor.destroy(); @@ -36059,7 +53477,7 @@ return /******/ (function(modules) { // webpackBootstrap shortcuts.off("CmdOrCtrl+Shift+B"); shortcuts.off(`CmdOrCtrl+Shift+${searchAgainKey}`); shortcuts.off(`CmdOrCtrl+${searchAgainKey}`); - } + }, componentDidUpdate(prevProps) { // This is in `componentDidUpdate` so helper functions can expect @@ -36083,172 +53501,85 @@ return /******/ (function(modules) { // webpackBootstrap // Only update and jump around in real source texts. This will // keep the jump state around until the real source text is // loaded. - if (this.props.sourceText && (0, _editor.isTextForSource)(this.props.sourceText)) { + if (this.props.sourceText && isTextForSource(this.props.sourceText)) { this.highlightLine(); } - } - - onToggleBreakpoint(key, e) { - e.preventDefault(); - var codeMirror = this.editor.codeMirror; - - var line = (0, _editor.getCursorLine)(codeMirror); - - if (e.shiftKey) { - this.toggleConditionalPanel(line); - } else { - this.toggleBreakpoint(line); - } - } - - onKeyDown(e) { - var codeMirror = this.editor.codeMirror; - var key = e.key, - target = e.target; - - var codeWrapper = codeMirror.getWrapperElement(); - var textArea = codeWrapper.querySelector("textArea"); - - if (key === "Escape" && target == textArea) { - e.stopPropagation(); - e.preventDefault(); - codeWrapper.focus(); - } else if (key === "Enter" && target == codeWrapper) { - e.preventDefault(); - // Focus into editor's text area - textArea.focus(); - } - } - - /* - * The default Esc command is overridden in the CodeMirror keymap to allow - * the Esc keypress event to be catched by the toolbox and trigger the - * split console. Restore it here, but preventDefault if and only if there - * is a multiselection. - */ - onEscape(key, e) { - var codeMirror = this.editor.codeMirror; - - if (codeMirror.listSelections().length > 1) { - codeMirror.execCommand("singleSelection"); - e.preventDefault(); - } - } + }, onScroll(e) { - return this.setState({ selectedToken: null, selectedExpression: null }); - } + return this.setState({ selectedToken: null }); + }, - onMouseOver(e) { - this.previewSelectedToken(e); - } + onMouseUp(e, ctx, modifiers) { + if (e.metaKey) { + this.previewSelectedToken(e, ctx, modifiers); + } + }, - onSearchAgain(_, e) { - var _props2 = this.props, - query = _props2.query, - searchModifiers = _props2.searchModifiers; - var codeMirror = this.editor.editor.codeMirror; + onMouseOver(e, ctx, modifiers) { + this.previewSelectedToken(e, ctx, modifiers); + }, - var ctx = { ed: this.editor, cm: codeMirror }; + previewSelectedToken(e, ctx, modifiers) { + var selectedFrame = this.props.selectedFrame; + var selectedToken = this.state.selectedToken; - if (!searchModifiers) { + var token = e.target; + + if (!selectedFrame || !isEnabled("editorPreview")) { return; } - var direction = e.shiftKey ? "prev" : "next"; - (0, _editor.traverseResults)(e, ctx, query, direction, searchModifiers.toJS()); - } + if (selectedToken) { + selectedToken.classList.remove("selected-token"); + } - previewSelectedToken(e) { - var _this = this; + var variables = selectedFrame.scope.bindings.variables; - return _asyncToGenerator(function* () { - var _props3 = _this.props, - selectedFrame = _props3.selectedFrame, - selectedSource = _props3.selectedSource, - pauseData = _props3.pauseData, - sourceText = _props3.sourceText, - addExpression = _props3.addExpression; - var selectedToken = _this.state.selectedToken; + if (!variables.hasOwnProperty(token.innerText)) { + this.setState({ selectedToken: null }); + return; + } - var token = e.target; - - if (!selectedFrame || !sourceText || !(0, _devtoolsConfig.isEnabled)("editorPreview") || !selectedSource || selectedFrame.location.sourceId !== selectedSource.get("id")) { - return; - } - - if (selectedToken) { - selectedToken.classList.remove("selected-token"); - _this.setState({ selectedToken: null, selectedExpression: null }); - } - - var _ref = yield (0, _editor.resolveToken)(_this.editor.codeMirror, token, sourceText, selectedFrame), - expression = _ref.expression, - inScope = _ref.inScope; - - if (!inScope) { - return; - } - - var variables = (0, _scopes.getVisibleVariablesFromScope)(pauseData, selectedFrame); - - if (expression) { - addExpression(expression.value, { visible: false }); - } - - var displayedExpression = (0, _editor.previewExpression)({ - expression: expression, - variables, - selectedFrame, - tokenText: token.textContent - }); - - if (displayedExpression) { - _this.setState({ - selectedToken: token, - selectedExpression: displayedExpression - }); - } - })(); - } + this.setState({ + selectedToken: token + }); + }, openMenu(event, codeMirror) { - var _props4 = this.props, - selectedSource = _props4.selectedSource, - selectedLocation = _props4.selectedLocation, - showSource = _props4.showSource, - jumpToMappedLocation = _props4.jumpToMappedLocation, - addExpression = _props4.addExpression, - toggleBlackBox = _props4.toggleBlackBox; - - - return (0, _EditorMenu2.default)({ + return EditorMenu({ codeMirror, event, - selectedLocation, - selectedSource, - showSource, - jumpToMappedLocation, - addExpression, - toggleBlackBox, - onGutterContextMenu: this.onGutterContextMenu + selectedLocation: this.props.selectedLocation, + selectedSource: this.props.selectedSource, + showSource: this.props.showSource, + onGutterContextMenu: this.onGutterContextMenu, + jumpToMappedLocation: this.props.jumpToMappedLocation, + addExpression: this.props.addExpression }); - } + }, - updateSearchResults(_ref2) { - var count = _ref2.count, - _ref2$index = _ref2.index, - index = _ref2$index === undefined ? -1 : _ref2$index; + toggleModifier(searchModifiers) { + this.setState({ searchModifiers }); + }, + + updateQuery(query) { + if (this.state.query == query) { + return; + } + this.setState({ query }); + }, + + updateSearchResults(_ref) { + var count = _ref.count, + index = _ref.index; this.setState({ searchResults: { count, index } }); - } + }, onGutterClick(cm, line, gutter, ev) { - var selectedSource = this.props.selectedSource; - // ignore right clicks in the gutter - - if (ev.which === 3 || selectedSource && selectedSource.get("isBlackBoxed")) { + if (ev.which === 3) { return; } @@ -36256,56 +53587,42 @@ return /******/ (function(modules) { // webpackBootstrap return this.closeConditionalPanel(line); } - if (gutter !== "CodeMirror-foldgutter") { - this.toggleBreakpoint(line); - } - } + this.toggleBreakpoint(line); + }, onGutterContextMenu(event) { - var selectedSource = this.props.selectedSource; - - - if (selectedSource && selectedSource.get("isBlackBoxed")) { - event.preventDefault(); - return; - } - var line = this.editor.codeMirror.lineAtHeight(event.clientY); - var bp = (0, _editor.breakpointAtLine)(this.props.breakpoints, line); - (0, _GutterMenu2.default)({ - event, - line, - bp, + var bp = breakpointAtLine(this.props.breakpoints, line); + GutterMenu({ event, line, bp, toggleBreakpoint: this.toggleBreakpoint, showConditionalPanel: this.toggleConditionalPanel, toggleBreakpointDisabledStatus: this.toggleBreakpointDisabledStatus, isCbPanelOpen: this.isCbPanelOpen(), closeConditionalPanel: this.closeConditionalPanel }); - } + }, toggleConditionalPanel(line) { if (this.isCbPanelOpen()) { return this.closeConditionalPanel(); } - var _props5 = this.props, - selectedLocation = _props5.selectedLocation, - setBreakpointCondition = _props5.setBreakpointCondition, - breakpoints = _props5.breakpoints; + var _props = this.props, + sourceId = _props.selectedLocation.sourceId, + setBreakpointCondition = _props.setBreakpointCondition, + breakpoints = _props.breakpoints; - var sourceId = selectedLocation ? selectedLocation.sourceId : ""; - var bp = (0, _editor.breakpointAtLine)(breakpoints, line); + var bp = breakpointAtLine(breakpoints, line); var location = { sourceId, line: line + 1 }; var condition = bp ? bp.condition : ""; var setBreakpoint = value => setBreakpointCondition(location, { condition: value, - getTextForLine: l => (0, _editor.getTextForLine)(this.editor.codeMirror, l) + getTextForLine: l => getTextForLine(this.editor.codeMirror, l) }); - var panel = (0, _ConditionalPanel.renderConditionalPanel)({ + var panel = renderConditionalPanel({ condition, setBreakpoint, closePanel: this.closeConditionalPanel @@ -36316,94 +53633,76 @@ return /******/ (function(modules) { // webpackBootstrap noHScroll: true }); this.cbPanel.node.querySelector("input").focus(); - } + }, closeConditionalPanel() { this.cbPanel.clear(); this.cbPanel = null; - } + }, isCbPanelOpen() { return !!this.cbPanel; - } + }, toggleBreakpoint(line) { - var _props6 = this.props, - selectedSource = _props6.selectedSource, - selectedLocation = _props6.selectedLocation, - breakpoints = _props6.breakpoints, - addBreakpoint = _props6.addBreakpoint, - removeBreakpoint = _props6.removeBreakpoint; + var bp = breakpointAtLine(this.props.breakpoints, line); - var bp = (0, _editor.breakpointAtLine)(breakpoints, line); - - if (bp && bp.loading || !selectedLocation || !selectedSource) { + if (bp && bp.loading) { return; } - var sourceId = selectedLocation.sourceId; - - if (bp) { - removeBreakpoint({ - sourceId: sourceId, + this.props.removeBreakpoint({ + sourceId: this.props.selectedLocation.sourceId, line: line + 1 }); } else { - addBreakpoint({ - sourceId: sourceId, - sourceUrl: selectedSource.get("url"), - line: line + 1 - }, + this.props.addBreakpoint({ sourceId: this.props.selectedLocation.sourceId, + line: line + 1 }, // Pass in a function to get line text because the breakpoint // may slide and it needs to compute the value at the new // line. - { getTextForLine: l => (0, _editor.getTextForLine)(this.editor.codeMirror, l) }); + { getTextForLine: l => getTextForLine(this.editor.codeMirror, l) }); } - } + }, toggleBreakpointDisabledStatus(line) { - var bp = (0, _editor.breakpointAtLine)(this.props.breakpoints, line); - var selectedLocation = this.props.selectedLocation; + var bp = breakpointAtLine(this.props.breakpoints, line); - - if (bp && bp.loading || !selectedLocation) { + if (bp && bp.loading) { return; } - var sourceId = selectedLocation.sourceId; - - if (!bp) { throw new Error("attempt to disable breakpoint that does not exist"); } if (!bp.disabled) { this.props.disableBreakpoint({ - sourceId: sourceId, + sourceId: this.props.selectedLocation.sourceId, line: line + 1 }); } else { this.props.enableBreakpoint({ - sourceId: sourceId, + sourceId: this.props.selectedLocation.sourceId, line: line + 1 }); } - } + }, clearDebugLine(selectedFrame) { if (selectedFrame) { var line = selectedFrame.location.line; this.editor.codeMirror.removeLineClass(line - 1, "line", "debug-line"); } - } + }, setDebugLine(selectedFrame, selectedLocation) { if (selectedFrame && selectedLocation && selectedFrame.location.sourceId === selectedLocation.sourceId) { var line = selectedFrame.location.line; this.editor.codeMirror.addLineClass(line - 1, "line", "debug-line"); } - } + }, // If the location has changed and a specific line is requested, // move to that line and flash it. @@ -36417,7 +53716,7 @@ return /******/ (function(modules) { // webpackBootstrap // happening ever again (in case CodeMirror re-applies the // class, etc). if (this.lastJumpLine) { - (0, _editor.clearLineClass)(this.editor.codeMirror, "highlight-line"); + clearLineClass(this.editor.codeMirror, "highlight-line"); } var line = this.pendingJumpLine; @@ -36425,15 +53724,13 @@ return /******/ (function(modules) { // webpackBootstrap // We only want to do the flashing animation if it's not a debug // line, which has it's own styling. - // Also, if it the first time the debugger is being loaded, we don't want - // to flash the previously saved selected line. - if (this.lastJumpLine && (!this.props.selectedFrame || this.props.selectedFrame.location.line !== line)) { + if (!this.props.selectedFrame || this.props.selectedFrame.location.line !== line) { this.editor.codeMirror.addLineClass(line - 1, "line", "highlight-line"); } this.lastJumpLine = line; this.pendingJumpLine = null; - } + }, setText(text) { if (!text || !this.editor) { @@ -36441,13 +53738,13 @@ return /******/ (function(modules) { // webpackBootstrap } this.editor.setText(text); - } + }, showMessage(msg) { this.editor.replaceDocument(this.editor.createDocument()); this.setText(msg); this.editor.setMode({ name: "text" }); - } + }, /** * Handle getting the source document or creating a new @@ -36455,47 +53752,42 @@ return /******/ (function(modules) { // webpackBootstrap * */ showSourceText(sourceText, selectedLocation) { - if (!selectedLocation) { - return; - } - - var doc = (0, _editor.getDocument)(selectedLocation.sourceId); + var doc = getDocument(selectedLocation.sourceId); if (doc) { this.editor.replaceDocument(doc); return doc; } doc = this.editor.createDocument(); - (0, _editor.setDocument)(selectedLocation.sourceId, doc); + setDocument(selectedLocation.sourceId, doc); this.editor.replaceDocument(doc); this.setText(sourceText.get("text")); - this.editor.setMode((0, _source.getMode)(sourceText.toJS())); - } + this.editor.setMode(getMode(sourceText.toJS())); + }, renderBreakpoints() { - var _props7 = this.props, - breakpoints = _props7.breakpoints, - sourceText = _props7.sourceText, - selectedSource = _props7.selectedSource; + var _props2 = this.props, + breakpoints = _props2.breakpoints, + sourceText = _props2.sourceText; var isLoading = sourceText && sourceText.get("loading"); - if (isLoading || !breakpoints || selectedSource && selectedSource.get("isBlackBoxed")) { + if (isLoading) { return; } return breakpoints.valueSeq().map(bp => Breakpoint({ - key: (0, _breakpoints.makeLocationId)(bp.location), + key: makeLocationId(bp.location), breakpoint: bp, editor: this.editor && this.editor.codeMirror })); - } + }, renderHitCounts() { - var _props8 = this.props, - hitCount = _props8.hitCount, - sourceText = _props8.sourceText; + var _props3 = this.props, + hitCount = _props3.hitCount, + sourceText = _props3.sourceText; var isLoading = sourceText && sourceText.get("loading"); @@ -36508,63 +53800,40 @@ return /******/ (function(modules) { // webpackBootstrap hitData: marker.toJS(), editor: this.editor && this.editor.codeMirror })); - } + }, - getInlineEditorStyles() { - var _props9 = this.props, - selectedSource = _props9.selectedSource, - horizontal = _props9.horizontal, - searchOn = _props9.searchOn; + editorHeight() { + var _props4 = this.props, + selectedSource = _props4.selectedSource, + horizontal = _props4.horizontal; - var subtractions = []; - - if ((0, _editor.shouldShowFooter)(selectedSource, horizontal)) { - subtractions.push(cssVars.footerHeight); + if (!shouldShowFooter(selectedSource, horizontal)) { + return "100%"; } - if (searchOn) { - subtractions.push(cssVars.searchbarHeight); - - var secondSearchBarOn = (0, _devtoolsConfig.isEnabled)("searchModifiers") && (0, _devtoolsConfig.isEnabled)("symbolSearch"); - - if (secondSearchBarOn) { - subtractions.push(cssVars.secondSearchbarHeight); - } - } - - return { - height: subtractions.length === 0 ? "100%" : `calc(100% - ${subtractions.join(" - ")})` - }; - } + return ""; + }, renderPreview() { - var _state = this.state, - selectedToken = _state.selectedToken, - selectedExpression = _state.selectedExpression; - var _props10 = this.props, - selectedFrame = _props10.selectedFrame, - sourceText = _props10.sourceText; + var selectedToken = this.state.selectedToken; + var selectedFrame = this.props.selectedFrame; - if (!this.editor || !sourceText) { - return null; - } - - if (!(0, _devtoolsConfig.isEnabled)("editorPreview") || !selectedToken || !selectedFrame || !selectedExpression) { + if (!selectedToken || !selectedFrame || !isEnabled("editorPreview")) { + return; + } + + var token = selectedToken.innerText; + var variables = selectedFrame.scope.bindings.variables; + + if (!variables.hasOwnProperty(token)) { return; } - var token = selectedToken.textContent; selectedToken.classList.add("selected-token"); - var value = (0, _editor.getExpressionValue)(selectedExpression, { - getExpression: this.props.getExpression - }); - - if (!value) { - return; - } + var value = variables[token].value; return Preview({ value, @@ -36573,96 +53842,58 @@ return /******/ (function(modules) { // webpackBootstrap onClose: () => { selectedToken.classList.remove("selected-token"); this.setState({ - selectedToken: null, - selectedExpression: null + selectedToken: null }); } }); - } + }, render() { - var _props11 = this.props, - sourceText = _props11.sourceText, - selectSource = _props11.selectSource, - selectedSource = _props11.selectedSource, - coverageOn = _props11.coverageOn, - horizontal = _props11.horizontal; + var _props5 = this.props, + sourceText = _props5.sourceText, + selectSource = _props5.selectSource, + selectedSource = _props5.selectedSource, + coverageOn = _props5.coverageOn, + horizontal = _props5.horizontal; var searchResults = this.state.searchResults; - return _react.DOM.div({ - className: (0, _classnames2.default)("editor-wrapper", { "coverage-on": coverageOn }) + return dom.div({ + className: classnames("editor-wrapper", { "coverage-on": coverageOn }) }, SearchBar({ editor: this.editor, selectSource, selectedSource, sourceText, searchResults, + modifiers: this.state.searchModifiers, + toggleModifier: this.toggleModifier, + query: this.state.query, + updateQuery: this.updateQuery, updateSearchResults: this.updateSearchResults - }), _react.DOM.div({ + }), dom.div({ className: "editor-mount devtools-monospace", - style: this.getInlineEditorStyles() + style: { height: this.editorHeight() } }), this.renderBreakpoints(), this.renderHitCounts(), Footer({ editor: this.editor, horizontal }), this.renderPreview()); } - } + }); - Editor.displayName = "Editor"; - - Editor.propTypes = { - breakpoints: _reactImmutableProptypes2.default.map.isRequired, - hitCount: _react.PropTypes.object, - selectedLocation: _react.PropTypes.object, - selectedSource: _reactImmutableProptypes2.default.map, - sourceText: _reactImmutableProptypes2.default.map, - searchOn: _react.PropTypes.bool, - addBreakpoint: _react.PropTypes.func.isRequired, - disableBreakpoint: _react.PropTypes.func.isRequired, - enableBreakpoint: _react.PropTypes.func.isRequired, - removeBreakpoint: _react.PropTypes.func.isRequired, - setBreakpointCondition: _react.PropTypes.func.isRequired, - selectSource: _react.PropTypes.func, - jumpToMappedLocation: _react.PropTypes.func, - toggleBlackBox: _react.PropTypes.func, - showSource: _react.PropTypes.func, - coverageOn: _react.PropTypes.bool, - pauseData: _reactImmutableProptypes2.default.map, - selectedFrame: _react.PropTypes.object, - getExpression: _react.PropTypes.func.isRequired, - addExpression: _react.PropTypes.func.isRequired, - horizontal: _react.PropTypes.bool, - query: _react.PropTypes.string.isRequired, - searchModifiers: _reactImmutableProptypes2.default.recordOf({ - caseSensitive: _react.PropTypes.bool.isRequired, - regexMatch: _react.PropTypes.bool.isRequired, - wholeWord: _react.PropTypes.bool.isRequired - }).isRequired - }; - - Editor.contextTypes = { - shortcuts: _react.PropTypes.object - }; - - exports.default = (0, _reactRedux.connect)(state => { - var selectedLocation = (0, _selectors.getSelectedLocation)(state); + module.exports = connect(state => { + var selectedLocation = getSelectedLocation(state); var sourceId = selectedLocation && selectedLocation.sourceId; - var selectedSource = (0, _selectors.getSelectedSource)(state); + var selectedSource = getSelectedSource(state); return { selectedLocation, selectedSource, - searchOn: (0, _selectors.getFileSearchState)(state), - sourceText: (0, _selectors.getSourceText)(state, sourceId), - loadedObjects: (0, _selectors.getLoadedObjects)(state), - breakpoints: (0, _selectors.getBreakpointsForSource)(state, sourceId || ""), - hitCount: (0, _selectors.getHitCountForSource)(state, sourceId), - selectedFrame: (0, _selectors.getSelectedFrame)(state), - getExpression: _selectors.getExpression.bind(null, state), - pauseData: (0, _selectors.getPause)(state), - coverageOn: (0, _selectors.getCoverageEnabled)(state), - query: (0, _selectors.getFileSearchQueryState)(state), - searchModifiers: (0, _selectors.getFileSearchModifierState)(state) + sourceText: getSourceText(state, sourceId), + loadedObjects: getLoadedObjects(state), + breakpoints: getBreakpointsForSource(state, sourceId), + hitCount: getHitCountForSource(state, sourceId), + selectedFrame: getSelectedFrame(state), + coverageOn: getCoverageEnabled(state) }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Editor); + }, dispatch => bindActionCreators(actions, dispatch))(Editor); /***/ }, /* 427 */ @@ -36670,136 +53901,103 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); + var _require = __webpack_require__(151), + connect = _require.connect; - var _react2 = _interopRequireDefault(_react); + var _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; - var _reactRedux = __webpack_require__(151); + var actions = __webpack_require__(244); - var _redux = __webpack_require__(3); + var _require3 = __webpack_require__(242), + getSelectedSource = _require3.getSelectedSource, + getSourceText = _require3.getSourceText, + getPrettySource = _require3.getPrettySource, + getPaneCollapse = _require3.getPaneCollapse; - var _actions = __webpack_require__(244); + var Svg = __webpack_require__(344); + var ImPropTypes = __webpack_require__(150); + var classnames = __webpack_require__(175); - var _actions2 = _interopRequireDefault(_actions); + var _require4 = __webpack_require__(65), + isEnabled = _require4.isEnabled; - var _selectors = __webpack_require__(242); + var _require5 = __webpack_require__(233), + isPretty = _require5.isPretty; - var _Svg = __webpack_require__(344); + var _require6 = __webpack_require__(257), + shouldShowFooter = _require6.shouldShowFooter, + shouldShowPrettyPrint = _require6.shouldShowPrettyPrint; - var _Svg2 = _interopRequireDefault(_Svg); - - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _devtoolsConfig = __webpack_require__(828); - - var _source = __webpack_require__(233); - - var _editor = __webpack_require__(257); - - var _PaneToggle = __webpack_require__(428); - - var _PaneToggle2 = _interopRequireDefault(_PaneToggle); + var PaneToggleButton = React.createFactory(__webpack_require__(428)); __webpack_require__(431); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var SourceFooter = React.createClass({ + propTypes: { + selectedSource: ImPropTypes.map, + togglePrettyPrint: PropTypes.func, + recordCoverage: PropTypes.func, + sourceText: ImPropTypes.map, + selectSource: PropTypes.func, + prettySource: ImPropTypes.map, + editor: PropTypes.object, + endPanelCollapsed: PropTypes.bool, + togglePaneCollapse: PropTypes.func, + horizontal: PropTypes.bool + }, - var PaneToggleButton = _react2.default.createFactory(_PaneToggle2.default); + displayName: "SourceFooter", + + onClickPrettyPrint() { + this.props.togglePrettyPrint(this.props.selectedSource.get("id")); + }, - class SourceFooter extends _react.Component { prettyPrintButton() { var _props = this.props, selectedSource = _props.selectedSource, - sourceText = _props.sourceText, - togglePrettyPrint = _props.togglePrettyPrint; + sourceText = _props.sourceText; var sourceLoaded = selectedSource && sourceText && !sourceText.get("loading"); - if (!(0, _editor.shouldShowPrettyPrint)(selectedSource)) { + if (!shouldShowPrettyPrint(selectedSource)) { return; } - var tooltip = L10N.getStr("sourceTabs.prettyPrint"); + var tooltip = L10N.getStr("sourceFooter.debugBtnTooltip"); var type = "prettyPrint"; - return _react.DOM.button({ - onClick: () => togglePrettyPrint(selectedSource.get("id")), - className: (0, _classnames2.default)("action", type, { + return dom.button({ + onClick: this.onClickPrettyPrint, + className: classnames("action", type, { active: sourceLoaded, - pretty: (0, _source.isPretty)(selectedSource.toJS()) + pretty: isPretty(selectedSource.toJS()) }), key: type, title: tooltip, "aria-label": tooltip - }, (0, _Svg2.default)(type)); - } - - blackBoxButton() { - var _props2 = this.props, - selectedSource = _props2.selectedSource, - sourceText = _props2.sourceText, - toggleBlackBox = _props2.toggleBlackBox; - - var sourceLoaded = selectedSource && sourceText && !sourceText.get("loading"); - - var blackboxed = selectedSource.get("isBlackBoxed"); - - if (!(0, _devtoolsConfig.isEnabled)("blackbox")) { - return; - } - - var tooltip = L10N.getStr("sourceFooter.blackbox"); - var type = "black-box"; - - return _react.DOM.button({ - onClick: () => toggleBlackBox(selectedSource.toJS()), - className: (0, _classnames2.default)("action", type, { - active: sourceLoaded, - blackboxed - }), - key: type, - title: tooltip, - "aria-label": tooltip - }, (0, _Svg2.default)("blackBox")); - } - - blackBoxSummary() { - var selectedSource = this.props.selectedSource; - - var blackboxed = selectedSource.get("isBlackBoxed"); - - if (!blackboxed) { - return; - } - - return _react.DOM.span({ className: "blackbox-summary" }, L10N.getStr("sourceFooter.blackboxed")); - } + }, Svg(type)); + }, coverageButton() { var recordCoverage = this.props.recordCoverage; - if (!(0, _devtoolsConfig.isEnabled)("codeCoverage")) { + if (!isEnabled("codeCoverage")) { return; } - return _react.DOM.button({ + return dom.button({ className: "coverage action", title: "Code Coverage", onClick: () => recordCoverage(), "aria-label": "Code Coverage" }, "C"); - } + }, renderToggleButton() { if (this.props.horizontal) { @@ -36812,57 +54010,43 @@ return /******/ (function(modules) { // webpackBootstrap horizontal: this.props.horizontal, handleClick: this.props.togglePaneCollapse }); - } + }, renderCommands() { var selectedSource = this.props.selectedSource; - if (!(0, _editor.shouldShowPrettyPrint)(selectedSource)) { + + if (!shouldShowPrettyPrint(selectedSource)) { return null; } - return _react.DOM.div({ className: "commands" }, this.prettyPrintButton(), this.blackBoxButton(), this.blackBoxSummary(), this.coverageButton()); - } + return dom.div({ className: "commands" }, this.prettyPrintButton(), this.coverageButton()); + }, render() { - var _props3 = this.props, - selectedSource = _props3.selectedSource, - horizontal = _props3.horizontal; + var _props2 = this.props, + selectedSource = _props2.selectedSource, + horizontal = _props2.horizontal; - if (!(0, _editor.shouldShowFooter)(selectedSource, horizontal)) { + if (!shouldShowFooter(selectedSource, horizontal)) { return null; } - return _react.DOM.div({ className: "source-footer" }, this.renderCommands(), this.renderToggleButton()); + return dom.div({ className: "source-footer" }, this.renderCommands(), this.renderToggleButton()); } - } + }); - 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 => { - var selectedSource = (0, _selectors.getSelectedSource)(state); + module.exports = connect(state => { + var selectedSource = getSelectedSource(state); var selectedId = selectedSource && selectedSource.get("id"); return { selectedSource, - sourceText: (0, _selectors.getSourceText)(state, selectedId), - prettySource: (0, _selectors.getPrettySource)(state, selectedId), - endPanelCollapsed: (0, _selectors.getPaneCollapse)(state, "end") + sourceText: getSourceText(state, selectedId), + prettySource: getPrettySource(state, selectedId), + endPanelCollapsed: getPaneCollapse(state, "end") }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SourceFooter); + }, dispatch => bindActionCreators(actions, dispatch))(SourceFooter); /***/ }, /* 428 */ @@ -36870,25 +54054,25 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var _react = __webpack_require__(2); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); + var classnames = __webpack_require__(175); + var Svg = __webpack_require__(344); __webpack_require__(429); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var PaneToggleButton = React.createClass({ + propTypes: { + position: PropTypes.string.isRequired, + collapsed: PropTypes.bool.isRequired, + horizontal: PropTypes.bool, + handleClick: PropTypes.func.isRequired + }, + + displayName: "PaneToggleButton", - class PaneToggleButton extends _react.Component { shouldComponentUpdate(nextProps) { var _props = this.props, collapsed = _props.collapsed, @@ -36896,7 +54080,7 @@ return /******/ (function(modules) { // webpackBootstrap return horizontal !== nextProps.horizontal || collapsed !== nextProps.collapsed; - } + }, render() { var _props2 = this.props, @@ -36907,27 +54091,18 @@ return /******/ (function(modules) { // webpackBootstrap var title = !collapsed ? L10N.getStr("expandPanes") : L10N.getStr("collapsePanes"); - return _react.DOM.div({ - className: (0, _classnames2.default)(`toggle-button-${position}`, { + return dom.div({ + className: classnames(`toggle-button-${position}`, { collapsed, vertical: horizontal != null ? !horizontal : false }), onClick: () => handleClick(position, collapsed), title - }, (0, _Svg2.default)("togglePanes")); + }, Svg("togglePanes")); } - } + }); - PaneToggleButton.propTypes = { - position: _react.PropTypes.string.isRequired, - collapsed: _react.PropTypes.bool.isRequired, - horizontal: _react.PropTypes.bool, - handleClick: _react.PropTypes.func.isRequired - }; - - PaneToggleButton.displayName = "PaneToggleButton"; - - exports.default = PaneToggleButton; + module.exports = PaneToggleButton; /***/ }, /* 429 */ @@ -36949,113 +54124,88 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - 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); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _selectors = __webpack_require__(242); - - var _editor = __webpack_require__(257); - - var _parser = __webpack_require__(827); - - var _resultList = __webpack_require__(343); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _debounce = __webpack_require__(651); - - var _debounce2 = _interopRequireDefault(_debounce); - - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - - __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 React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; 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 _require2 = __webpack_require__(65), + isEnabled = _require2.isEnabled; + var _require3 = __webpack_require__(161), + filter = _require3.filter; + + var Svg = __webpack_require__(344); + + var _require4 = __webpack_require__(257), + find = _require4.find, + findNext = _require4.findNext, + findPrev = _require4.findPrev, + removeOverlay = _require4.removeOverlay, + countMatches = _require4.countMatches, + clearIndex = _require4.clearIndex; + + var _require5 = __webpack_require__(434), + getSymbols = _require5.getSymbols; + + var _require6 = __webpack_require__(343), + scrollList = _require6.scrollList; + + var classnames = __webpack_require__(175); + var debounce = __webpack_require__(651); + var SearchInput = createFactory(__webpack_require__(377)); + var ResultList = createFactory(__webpack_require__(383)); + var ImPropTypes = __webpack_require__(150); function getShortcuts() { var searchAgainKey = L10N.getStr("sourceSearch.search.again.key"); - var fnSearchKey = L10N.getStr("symbolSearch.search.key"); + var fnSearchKey = L10N.getStr("functionSearch.search.key"); return { shiftSearchAgainShortcut: `CmdOrCtrl+Shift+${searchAgainKey}`, searchAgainShortcut: `CmdOrCtrl+${searchAgainKey}`, - symbolSearchShortcut: `CmdOrCtrl+Shift+${fnSearchKey}`, + functionSearchShortcut: `CmdOrCtrl+Shift+${fnSearchKey}`, searchShortcut: `CmdOrCtrl+${L10N.getStr("sourceSearch.search.key")}` }; } - class SearchBar extends _react.Component { + __webpack_require__(653); - constructor(props) { - super(props); - this.state = { - symbolSearchEnabled: false, - selectedSymbolType: "functions", - symbolSearchResults: [], + var SearchBar = React.createClass({ + + propTypes: { + editor: PropTypes.object, + sourceText: ImPropTypes.map, + selectSource: PropTypes.func.isRequired, + selectedSource: ImPropTypes.map, + searchResults: PropTypes.object.isRequired, + modifiers: PropTypes.object.isRequired, + toggleModifier: PropTypes.func.isRequired, + query: PropTypes.string.isRequired, + updateQuery: PropTypes.func.isRequired, + updateSearchResults: PropTypes.func.isRequired + }, + + displayName: "SearchBar", + + getInitialState() { + return { + enabled: false, + functionSearchEnabled: false, + functionDeclarations: [], + functionSearchResults: [], selectedResultIndex: 0, count: 0, index: -1 }; + }, - var self = this; - self.onEscape = this.onEscape.bind(this); - self.clearSearch = this.clearSearch.bind(this); - self.closeSearch = this.closeSearch.bind(this); - self.toggleSearch = this.toggleSearch.bind(this); - self.toggleSymbolSearch = this.toggleSymbolSearch.bind(this); - self.setSearchValue = this.setSearchValue.bind(this); - self.selectSearchInput = this.selectSearchInput.bind(this); - self.searchInput = this.searchInput.bind(this); - self.updateSymbolSearchResults = this.updateSymbolSearchResults.bind(this); - self.doSearch = this.doSearch.bind(this); - self.searchContents = this.searchContents.bind(this); - self.traverseSymbolResults = this.traverseSymbolResults.bind(this); - self.traverseCodeResults = this.traverseCodeResults.bind(this); - self.traverseResults = this.traverseResults.bind(this); - self.selectResultItem = this.selectResultItem.bind(this); - self.onSelectResultItem = this.onSelectResultItem.bind(this); - self.onChange = this.onChange.bind(this); - self.onKeyUp = this.onKeyUp.bind(this); - self.onKeyDown = this.onKeyDown.bind(this); - self.buildSummaryMsg = this.buildSummaryMsg.bind(this); - self.buildPlaceHolder = this.buildPlaceHolder.bind(this); - self.renderSearchModifiers = this.renderSearchModifiers.bind(this); - self.renderSearchTypeToggle = this.renderSearchTypeToggle.bind(this); - self.renderBottomBar = this.renderBottomBar.bind(this); - self.renderResults = this.renderResults.bind(this); - } + contextTypes: { + shortcuts: PropTypes.object + }, componentWillUnmount() { var shortcuts = this.context.shortcuts; @@ -37064,28 +54214,23 @@ return /******/ (function(modules) { // webpackBootstrap searchShortcut = _getShortcuts.searchShortcut, searchAgainShortcut = _getShortcuts.searchAgainShortcut, shiftSearchAgainShortcut = _getShortcuts.shiftSearchAgainShortcut, - symbolSearchShortcut = _getShortcuts.symbolSearchShortcut; + functionSearchShortcut = _getShortcuts.functionSearchShortcut; shortcuts.off(searchShortcut); shortcuts.off("Escape"); shortcuts.off(searchAgainShortcut); shortcuts.off(shiftSearchAgainShortcut); - shortcuts.off(symbolSearchShortcut); - } + shortcuts.off(functionSearchShortcut); + }, componentDidMount() { - // overwrite searchContents with a debounced version to reduce the - // frequency of queries which improves perf on large files - // $FlowIgnore - this.searchContents = (0, _debounce2.default)(this.searchContents, 100); - var shortcuts = this.context.shortcuts; var _getShortcuts2 = getShortcuts(), searchShortcut = _getShortcuts2.searchShortcut, searchAgainShortcut = _getShortcuts2.searchAgainShortcut, shiftSearchAgainShortcut = _getShortcuts2.shiftSearchAgainShortcut, - symbolSearchShortcut = _getShortcuts2.symbolSearchShortcut; + functionSearchShortcut = _getShortcuts2.functionSearchShortcut; shortcuts.on(searchShortcut, (_, e) => this.toggleSearch(e)); shortcuts.on("Escape", (_, e) => this.onEscape(e)); @@ -37094,29 +54239,25 @@ 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" - })); + if (isEnabled("functionSearch")) { + shortcuts.on(functionSearchShortcut, (_, e) => this.toggleFunctionSearch(e, { toggle: false })); } - } + }, - componentDidUpdate(prevProps, prevState) { + componentDidUpdate(prevProps) { var _props = this.props, sourceText = _props.sourceText, selectedSource = _props.selectedSource, query = _props.query, modifiers = _props.modifiers; - var searchInput = this.searchInput(); - if (searchInput) { - searchInput.focus(); + if (this.searchInput()) { + this.searchInput().focus(); } if (this.refs.resultList && this.refs.resultList.refs) { - (0, _resultList.scrollList)(this.refs.resultList.refs, this.state.selectedResultIndex); + scrollList(this.refs.resultList.refs, this.state.selectedResultIndex); } var hasLoaded = sourceText && !sourceText.get("loading"); @@ -37124,23 +54265,18 @@ return /******/ (function(modules) { // webpackBootstrap var doneLoading = wasLoading && hasLoaded; var changedFiles = selectedSource != prevProps.selectedSource && hasLoaded; - var modifiersUpdated = modifiers && !modifiers.equals(prevProps.modifiers); + var modifiersUpdated = modifiers != prevProps.modifiers; - var isOpen = this.props.searchOn || this.state.symbolSearchEnabled; - var _state = this.state, - selectedSymbolType = _state.selectedSymbolType, - symbolSearchEnabled = _state.symbolSearchEnabled; + var isOpen = this.state.enabled || this.state.functionSearchEnabled; - var changedSearchType = selectedSymbolType != prevState.selectedSymbolType || symbolSearchEnabled != prevState.symbolSearchEnabled; - - if (isOpen && (doneLoading || changedFiles || modifiersUpdated || changedSearchType)) { + if (isOpen && (doneLoading || changedFiles || modifiersUpdated)) { this.doSearch(query); } - } + }, onEscape(e) { this.closeSearch(e); - } + }, clearSearch() { var _props2 = this.props, @@ -37148,27 +54284,23 @@ return /******/ (function(modules) { // webpackBootstrap query = _props2.query, modifiers = _props2.modifiers; - if (ed && modifiers) { + if (ed) { var ctx = { ed, cm: ed.codeMirror }; - (0, _editor.removeOverlay)(ctx, query, modifiers.toJS()); + removeOverlay(ctx, query, modifiers); } - } + }, closeSearch(e) { var ed = this.props.editor; - if (this.props.searchOn && ed) { + if (this.state.enabled && ed) { this.clearSearch(); - this.props.toggleFileSearch(false); - this.setState({ - symbolSearchEnabled: false, - selectedSymbolType: "functions" - }); + this.setState({ enabled: false, functionSearchEnabled: false }); e.stopPropagation(); e.preventDefault(); } - } + }, toggleSearch(e) { e.stopPropagation(); @@ -37176,19 +54308,16 @@ return /******/ (function(modules) { // webpackBootstrap var editor = this.props.editor; - if (!this.props.searchOn) { - this.props.toggleFileSearch(); + if (!this.state.enabled) { + this.setState({ enabled: true }); } - if (this.state.symbolSearchEnabled) { + if (this.state.functionSearchEnabled) { this.clearSearch(); - this.setState({ - symbolSearchEnabled: false, - selectedSymbolType: "functions" - }); + this.setState({ functionSearchEnabled: false }); } - if (this.props.searchOn && editor) { + if (this.state.enabled && editor) { var selection = editor.codeMirror.getSelection(); this.setSearchValue(selection); if (selection !== "") { @@ -37196,12 +54325,11 @@ return /******/ (function(modules) { // webpackBootstrap } this.selectSearchInput(); } - } + }, - toggleSymbolSearch(e) { + toggleFunctionSearch(e) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - toggle = _ref.toggle, - searchType = _ref.searchType; + toggle = _ref.toggle; var sourceText = this.props.sourceText; @@ -37215,155 +54343,103 @@ return /******/ (function(modules) { // webpackBootstrap return; } - if (!this.props.searchOn) { - this.props.toggleFileSearch(); + if (!this.state.enabled) { + this.setState({ enabled: true }); } - if (this.state.symbolSearchEnabled) { + if (this.state.functionSearchEnabled) { if (toggle) { - this.setState({ symbolSearchEnabled: false }); - } else { - this.setState({ selectedSymbolType: searchType }); + this.setState({ functionSearchEnabled: false }); } + return; } if (this.props.selectedSource) { this.clearSearch(); - this.setState({ - symbolSearchEnabled: true, - selectedSymbolType: searchType - }); + this.setState({ functionSearchEnabled: true }); } - } + }, setSearchValue(value) { - var searchInput = this.searchInput(); - if (value == "" || !searchInput) { + if (value == "") { return; } - searchInput.value = value; - } + this.searchInput().value = value; + }, selectSearchInput() { - var searchInput = this.searchInput(); - if (searchInput) { - searchInput.setSelectionRange(0, searchInput.value.length); + var node = this.searchInput(); + if (node) { + node.setSelectionRange(0, node.value.length); } - } + }, searchInput() { - var node = findDOMNode(this); - if (node instanceof HTMLElement) { - var input = node.querySelector("input"); - if (input instanceof HTMLInputElement) { - return input; - } + return findDOMNode(this).querySelector("input"); + }, + + updateFunctionSearchResults(query) { + var _props3 = this.props, + sourceText = _props3.sourceText, + updateSearchResults = _props3.updateSearchResults; + + + if (query == "" || !sourceText) { + return; } - return null; - } - updateSymbolSearchResults(query) { - var _this = this; + var functionDeclarations = getSymbols(sourceText.toJS()).functions; - return _asyncToGenerator(function* () { - var _props3 = _this.props, - sourceText = _props3.sourceText, - updateSearchResults = _props3.updateSearchResults; - var selectedSymbolType = _this.state.selectedSymbolType; + var functionSearchResults = filter(functionDeclarations, query, { key: "value" }); - - if (query == "" || !sourceText) { - return; - } - - var symbolDeclarations = yield (0, _parser.getSymbols)(sourceText.toJS()); - var symbolSearchResults = (0, _fuzzaldrinPlus.filter)(symbolDeclarations[selectedSymbolType], query, { key: "value" }); - - updateSearchResults({ count: symbolSearchResults.length }); - return _this.setState({ symbolSearchResults }); - })(); - } + updateSearchResults({ count: functionSearchResults.length }); + return this.setState({ functionSearchResults }); + }, doSearch(query) { - var _this2 = this; + var _props4 = this.props, + sourceText = _props4.sourceText, + modifiers = _props4.modifiers, + updateQuery = _props4.updateQuery, + ed = _props4.editor, + index = _props4.searchResults.index; - return _asyncToGenerator(function* () { - var _props4 = _this2.props, - sourceText = _props4.sourceText, - setFileSearchQuery = _props4.setFileSearchQuery, - ed = _props4.editor; + if (!sourceText || !sourceText.get("text")) { + return; + } - if (!sourceText || !sourceText.get("text")) { - return; - } + updateQuery(query); - setFileSearchQuery(query); + if (this.state.functionSearchEnabled) { + return this.updateFunctionSearchResults(query); + } - if (_this2.state.symbolSearchEnabled) { - return yield _this2.updateSymbolSearchResults(query); - } else if (ed) { - _this2.searchContents(query); - } - })(); - } - - searchContents(query) { - var _props5 = this.props, - sourceText = _props5.sourceText, - modifiers = _props5.modifiers, - ed = _props5.editor, - index = _props5.searchResults.index; - - - if (!ed || !sourceText || !sourceText.get("text") || !modifiers) { + if (!ed) { return; } var ctx = { ed, cm: ed.codeMirror }; - var newCount = (0, _editor.countMatches)(query, sourceText.get("text"), modifiers.toJS()); + var newCount = countMatches(query, sourceText.get("text"), modifiers); if (index == -1) { - (0, _editor.clearIndex)(ctx, query, modifiers.toJS()); + clearIndex(ctx, query, modifiers); } - var newIndex = (0, _editor.find)(ctx, query, true, modifiers.toJS()); - this.props.updateSearchResults({ + var newIndex = find(ctx, query, true, modifiers); + + debounce(() => this.props.updateSearchResults({ count: newCount, index: newIndex - }); - } + }), 100)(); + }, - traverseSymbolResults(rev) { - var _state2 = this.state, - symbolSearchResults = _state2.symbolSearchResults, - selectedResultIndex = _state2.selectedResultIndex; + traverseResults(e, rev) { + e.stopPropagation(); + e.preventDefault(); - var searchResults = symbolSearchResults; - var resultCount = searchResults.length; - - if (rev) { - var nextResultIndex = Math.max(0, selectedResultIndex - 1); - - if (selectedResultIndex === 0) { - nextResultIndex = resultCount - 1; - } - this.setState({ selectedResultIndex: nextResultIndex }); - this.onSelectResultItem(searchResults[nextResultIndex]); - } else { - var _nextResultIndex = Math.min(resultCount - 1, selectedResultIndex + 1); - - if (selectedResultIndex === resultCount - 1) { - _nextResultIndex = 0; - } - this.setState({ selectedResultIndex: _nextResultIndex }); - this.onSelectResultItem(searchResults[_nextResultIndex]); - } - } - - traverseCodeResults(rev) { var ed = this.props.editor; if (!ed) { @@ -37372,111 +54448,85 @@ return /******/ (function(modules) { // webpackBootstrap var ctx = { ed, cm: ed.codeMirror }; - var _props6 = this.props, - query = _props6.query, - modifiers = _props6.modifiers, - updateSearchResults = _props6.updateSearchResults, - _props6$searchResults = _props6.searchResults, - count = _props6$searchResults.count, - index = _props6$searchResults.index; + var _props5 = this.props, + query = _props5.query, + modifiers = _props5.modifiers, + updateSearchResults = _props5.updateSearchResults, + _props5$searchResults = _props5.searchResults, + count = _props5$searchResults.count, + index = _props5$searchResults.index; if (query === "") { - this.props.toggleFileSearch(true); + this.setState({ enabled: true }); } - if (index == -1 && modifiers) { - (0, _editor.clearIndex)(ctx, query, modifiers.toJS()); + if (index == -1) { + clearIndex(ctx, query, modifiers); } - if (modifiers) { - var findFnc = rev ? _editor.findPrev : _editor.findNext; - var newIndex = findFnc(ctx, query, true, modifiers.toJS()); - updateSearchResults({ - index: newIndex, - count - }); - } - } - - traverseResults(e, rev) { - e.stopPropagation(); - e.preventDefault(); - - var symbolSearchEnabled = this.state.symbolSearchEnabled; - - - if (symbolSearchEnabled) { - return this.traverseSymbolResults(rev); - } - - this.traverseCodeResults(rev); - } + var findFnc = rev ? findPrev : findNext; + var newIndex = findFnc(ctx, query, true, modifiers); + updateSearchResults({ + index: newIndex, + count + }); + }, // Handlers - selectResultItem(e, item) { + selectResultItem(item) { + var _props6 = this.props, + selectSource = _props6.selectSource, + selectedSource = _props6.selectedSource; + + if (selectedSource) { + selectSource(selectedSource.get("id"), { line: item.location.start.line }); + } + }, + + onSelectResultItem(item) { var _props7 = this.props, selectSource = _props7.selectSource, selectedSource = _props7.selectedSource; - if (selectedSource) { - selectSource(selectedSource.get("id"), { - line: item.location.start.line - }); - - this.closeSearch(e); + selectSource(selectedSource.get("id"), { line: item.location.start.line }); } - } - - onSelectResultItem(item) { - var _props8 = this.props, - selectSource = _props8.selectSource, - selectedSource = _props8.selectedSource; - - if (selectedSource) { - selectSource(selectedSource.get("id"), { - line: item.location.start.line - }); - } - } + }, onChange(e) { - var _this3 = this; - - return _asyncToGenerator(function* () { - return _this3.doSearch(e.target.value); - })(); - } + return this.doSearch(e.target.value); + }, onKeyUp(e) { - if (e.key !== "Enter" || e.key !== "F3") { + if (e.key != "Enter") { return; } this.traverseResults(e, e.shiftKey); - } + }, onKeyDown(e) { - var _state3 = this.state, - symbolSearchEnabled = _state3.symbolSearchEnabled, - symbolSearchResults = _state3.symbolSearchResults; - - if (!symbolSearchEnabled || this.props.query == "") { + if (!this.state.functionSearchEnabled || this.props.query == "") { return; } - var searchResults = symbolSearchResults; + var searchResults = this.state.functionSearchResults, + resultCount = searchResults.length; if (e.key === "ArrowUp") { - this.traverseSymbolResults(true); + var selectedResultIndex = Math.max(0, this.state.selectedResultIndex - 1); + this.setState({ selectedResultIndex }); + this.onSelectResultItem(searchResults[selectedResultIndex]); e.preventDefault(); } else if (e.key === "ArrowDown") { - this.traverseSymbolResults(false); + var _selectedResultIndex = Math.min(resultCount - 1, this.state.selectedResultIndex + 1); + this.setState({ selectedResultIndex: _selectedResultIndex }); + this.onSelectResultItem(searchResults[_selectedResultIndex]); e.preventDefault(); } else if (e.key === "Enter") { if (searchResults.length) { - this.selectResultItem(e, searchResults[this.state.selectedResultIndex]); + this.selectResultItem(searchResults[this.state.selectedResultIndex]); } this.closeSearch(e); e.preventDefault(); @@ -37484,23 +54534,18 @@ return /******/ (function(modules) { // webpackBootstrap this.closeSearch(e); e.preventDefault(); } - } + }, // Renderers buildSummaryMsg() { - if (this.state.symbolSearchEnabled) { - 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) { - return L10N.getFormatStr("editor.singleResult"); - } + if (this.state.functionSearchEnabled) { + return L10N.getFormatStr("sourceSearch.resultsSummary1", this.state.functionSearchResults.length); } - - var _props9 = this.props, - _props9$searchResults = _props9.searchResults, - count = _props9$searchResults.count, - index = _props9$searchResults.index, - query = _props9.query; + var _props8 = this.props, + _props8$searchResults = _props8.searchResults, + count = _props8$searchResults.count, + index = _props8$searchResults.index, + query = _props8.query; if (query.trim() == "") { @@ -37516,112 +54561,98 @@ return /******/ (function(modules) { // webpackBootstrap } return L10N.getFormatStr("editor.searchResults", index + 1, count); - } + }, buildPlaceHolder() { - var _state4 = this.state, - symbolSearchEnabled = _state4.symbolSearchEnabled, - selectedSymbolType = _state4.selectedSymbolType; - - if (symbolSearchEnabled) { - return L10N.getFormatStr(`symbolSearch.search.${selectedSymbolType}Placeholder`); + if (this.state.functionSearchEnabled) { + return L10N.getStr("functionSearch.search.placeholder"); } return L10N.getStr("sourceSearch.search.placeholder"); - } + }, renderSearchModifiers() { - if (!(0, _devtoolsConfig.isEnabled)("searchModifiers")) { + if (!isEnabled("searchModifiers")) { return; } - var _props10 = this.props, - modifiers = _props10.modifiers, - toggleFileSearchModifier = _props10.toggleFileSearchModifier; - var symbolSearchEnabled = this.state.symbolSearchEnabled; + var _props9 = this.props, + _props9$modifiers = _props9.modifiers, + caseSensitive = _props9$modifiers.caseSensitive, + wholeWord = _props9$modifiers.wholeWord, + regexMatch = _props9$modifiers.regexMatch, + toggleModifier = _props9.toggleModifier; + var functionSearchEnabled = this.state.functionSearchEnabled; - function searchModBtn(modVal, className, svgName, tooltip) { - return _react.DOM.button({ - className: (0, _classnames2.default)(className, { - active: !symbolSearchEnabled && modifiers && modifiers.get(modVal), - disabled: symbolSearchEnabled + function searchModBtn(modVal, className, svgName) { + var defaultMods = { caseSensitive, wholeWord, regexMatch }; + return dom.button({ + className: classnames(className, { + active: !functionSearchEnabled && !Object.values(modVal)[0], + disabled: functionSearchEnabled }), - onClick: () => !symbolSearchEnabled ? toggleFileSearchModifier(modVal) : null, - title: tooltip - }, (0, _Svg2.default)(svgName)); + onClick: () => !functionSearchEnabled ? toggleModifier(Object.assign(defaultMods, modVal)) : null + }, Svg(svgName)); } - return _react.DOM.div({ className: "search-modifiers" }, searchModBtn("regexMatch", "regex-match-btn", "regex-match", L10N.getStr("symbolSearch.searchModifier.regex")), searchModBtn("caseSensitive", "case-sensitive-btn", "case-match", L10N.getStr("symbolSearch.searchModifier.caseSensitive")), searchModBtn("wholeWord", "whole-word-btn", "whole-word-match", L10N.getStr("symbolSearch.searchModifier.wholeWord"))); - } + return dom.div({ className: "search-modifiers" }, searchModBtn({ + regexMatch: !regexMatch }, "regex-match-btn", "regex-match"), searchModBtn({ + caseSensitive: !caseSensitive }, "case-sensitive-btn", "case-match"), searchModBtn({ + wholeWord: !wholeWord }, "whole-word-btn", "whole-word-match")); + }, renderSearchTypeToggle() { - if (!(0, _devtoolsConfig.isEnabled)("symbolSearch")) { + if (!isEnabled("functionSearch")) { return; } - var toggleSymbolSearch = this.toggleSymbolSearch; - var _state5 = this.state, - symbolSearchEnabled = _state5.symbolSearchEnabled, - selectedSymbolType = _state5.selectedSymbolType; - - function searchTypeBtn(searchType) { - return _react.DOM.button({ - className: (0, _classnames2.default)("search-type-btn", { - active: symbolSearchEnabled && selectedSymbolType == searchType - }), - onClick: e => { - if (selectedSymbolType == searchType) { - toggleSymbolSearch(e, { toggle: true, searchType }); - return; - } - toggleSymbolSearch(e, { toggle: false, searchType }); - } - }, searchType); - } - - return _react.DOM.section({ className: "search-type-toggles" }, _react.DOM.h1({ className: "search-toggle-title" }, L10N.getStr("editor.searchTypeToggleTitle")), searchTypeBtn("functions"), searchTypeBtn("variables")); - } + return dom.section({ className: "search-type-toggles" }, dom.h1({ className: "search-toggle-title" }, "Search for:"), dom.button({ + className: classnames("search-type-btn", { + active: this.state.functionSearchEnabled + }), + onClick: e => this.toggleFunctionSearch(e, { toggle: true }) + }, "functions")); + }, renderBottomBar() { - if (!(0, _devtoolsConfig.isEnabled)("searchModifiers") || !(0, _devtoolsConfig.isEnabled)("symbolSearch")) { + if (!isEnabled("searchModifiers") || !isEnabled("functionSearch")) { return; } - return _react.DOM.div({ className: "search-bottom-bar" }, this.renderSearchTypeToggle(), this.renderSearchModifiers()); - } + return 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 _state = this.state, + functionSearchEnabled = _state.functionSearchEnabled, + functionSearchResults = _state.functionSearchResults, + selectedResultIndex = _state.selectedResultIndex; var query = this.props.query; - if (query == "" || !symbolSearchEnabled || !symbolSearchResults.length) { + if (query == "" || !functionSearchEnabled || !functionSearchResults.length) { return; } return ResultList({ - items: symbolSearchResults, + items: functionSearchResults, selected: selectedResultIndex, selectItem: this.selectResultItem, ref: "resultList" }); - } + }, render() { - var _props11 = this.props, - count = _props11.searchResults.count, - query = _props11.query, - searchOn = _props11.searchOn; + var _props10 = this.props, + count = _props10.searchResults.count, + query = _props10.query; - if (!searchOn) { - return _react.DOM.div(); + if (!this.state.enabled) { + return dom.div(); } - return _react.DOM.div({ className: "search-bar" }, SearchInput({ + return dom.div({ className: "search-bar" }, SearchInput({ query, count, placeholder: this.buildPlaceHolder(), @@ -37629,264 +54660,23839 @@ return /******/ (function(modules) { // webpackBootstrap onChange: this.onChange, onKeyUp: this.onKeyUp, onKeyDown: this.onKeyDown, - handleNext: e => this.traverseResults(e, false), - handlePrev: e => this.traverseResults(e, true), handleClose: this.closeSearch }), this.renderResults(), this.renderBottomBar()); } - } + }); - SearchBar.propTypes = { - editor: _react.PropTypes.object, - sourceText: _reactImmutableProptypes2.default.map, - selectSource: _react.PropTypes.func.isRequired, - selectedSource: _reactImmutableProptypes2.default.map, - searchOn: _react.PropTypes.bool, - toggleFileSearch: _react.PropTypes.func.isRequired, - searchResults: _react.PropTypes.object.isRequired, - modifiers: _reactImmutableProptypes2.default.recordOf({ - caseSensitive: _react.PropTypes.bool.isRequired, - regexMatch: _react.PropTypes.bool.isRequired, - wholeWord: _react.PropTypes.bool.isRequired - }).isRequired, - toggleFileSearchModifier: _react.PropTypes.func.isRequired, - query: _react.PropTypes.string.isRequired, - setFileSearchQuery: _react.PropTypes.func.isRequired, - updateSearchResults: _react.PropTypes.func.isRequired - }; - - SearchBar.displayName = "SearchBar"; - - SearchBar.contextTypes = { - shortcuts: _react.PropTypes.object - }; - - exports.default = (0, _reactRedux.connect)(state => { - return { - searchOn: (0, _selectors.getFileSearchState)(state), - query: (0, _selectors.getFileSearchQueryState)(state), - modifiers: (0, _selectors.getFileSearchModifierState)(state) - }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SearchBar); + module.exports = SearchBar; + +/***/ }, +/* 434 */ +/***/ 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"); } }; }(); + + 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 babylon = __webpack_require__(435); + var traverse = __webpack_require__(436).default; + var t = __webpack_require__(493); + + var _require = __webpack_require__(65), + isDevelopment = _require.isDevelopment; + + var toPairs = __webpack_require__(195); + var get = __webpack_require__(67); + + var ASTs = new Map(); + + var symbolDeclarations = new Map(); + + function _parse(code) { + return babylon.parse(code, { + sourceType: "module", + + plugins: ["jsx", "flow"] + }); + } + + function parse(sourceText) { + var ast = void 0; + try { + ast = _parse(sourceText.text); + } catch (error) { + if (isDevelopment()) { + console.warn("parse failed", sourceText); + } + + ast = {}; + } + + return ast; + } + + function getAst(sourceText) { + if (ASTs.has(sourceText.id)) { + return ASTs.get(sourceText.id); + } + + var ast = parse(sourceText); + ASTs.set(sourceText.id, ast); + return ast; + } + + function getFunctionName(path) { + if (path.node.id) { + return path.node.id.name; + } + + var parent = path.parent; + if (parent.type == "ObjectProperty") { + return parent.key.name; + } + + if (parent.type == "ObjectExpression" || path.node.type == "ClassMethod") { + return path.node.key.name; + } + + if (parent.type == "VariableDeclarator") { + return parent.id.name; + } + + return "anonymous"; + } + + function isFunction(path) { + return t.isFunction(path) || t.isArrowFunctionExpression(path) || t.isObjectMethod(path) || t.isClassMethod(path); + } + + function formatSymbol(symbol) { + return { + id: `${symbol.name}:${symbol.location.start.line}`, + title: symbol.name, + subtitle: `:${symbol.location.start.line}`, + value: symbol.name, + location: symbol.location + }; + } + + function getVariableNames(path) { + if (t.isObjectProperty(path) && !isFunction(path.node.value)) { + return [formatSymbol({ + name: path.node.key.name, + location: path.node.loc + })]; + } + + if (!path.node.declarations) { + return path.node.params.map(dec => formatSymbol({ + name: dec.name, + location: dec.loc + })); + } + + return path.node.declarations.map(dec => formatSymbol({ + name: dec.id.name, + location: dec.loc + })); + } + + function isVariable(path) { + return t.isVariableDeclaration(path) || isFunction(path) && path.node.params.length || t.isObjectProperty(path) && !isFunction(path.node.value); + } + + function getSymbols(source) { + if (symbolDeclarations.has(source.id)) { + var _symbols = symbolDeclarations.get(source.id); + if (_symbols) { + return _symbols; + } + } + + var ast = getAst(source); + var symbols = { functions: [], variables: [], classes: [] }; + + traverse(ast, { + enter(path) { + if (isVariable(path)) { + var _symbols$variables; + + (_symbols$variables = symbols.variables).push.apply(_symbols$variables, _toConsumableArray(getVariableNames(path))); + } + + if (isFunction(path)) { + symbols.functions.push(formatSymbol({ + name: getFunctionName(path), + location: path.node.loc + })); + } + + if (t.isClassDeclaration(path)) { + symbols.classes.push(formatSymbol({ + name: path.node.id.name, + location: path.node.loc + })); + } + } + }); + + symbolDeclarations.set(source.id, symbols); + return symbols; + } + + function nodeContainsLocation(_ref) { + var node = _ref.node, + location = _ref.location; + var _node$loc = node.loc, + start = _node$loc.start, + end = _node$loc.end; + var line = location.line, + column = location.column; + + + return !(start.line > line || start.line === line && start.column > column || end.line < line || end.line === line && end.column < column); + } + + function getPathClosestToLocation(source, location) { + var ast = getAst(source); + var pathClosestToLocation = null; + + traverse(ast, { + enter(path) { + if (nodeContainsLocation({ node: path.node, location })) { + pathClosestToLocation = path; + } + } + }); + + return pathClosestToLocation; + } + + function getVariablesInScope(source, location) { + var path = getPathClosestToLocation(source, location); + var bindings = get(path, "scope.bindings", {}); + + return toPairs(bindings).map((_ref2) => { + var _ref3 = _slicedToArray(_ref2, 2), + name = _ref3[0], + binding = _ref3[1]; + + return { + name, + references: binding.referencePaths + }; + }); + } + + module.exports = { + parse, + getSymbols, + getPathClosestToLocation, + getVariablesInScope + }; + +/***/ }, +/* 435 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { value: true }); + + /* eslint max-len: 0 */ + + // This is a trick taken from Esprima. It turns out that, on + // non-Chrome browsers, to check whether a string is in a set, a + // predicate containing a big ugly `switch` statement is faster than + // a regular expression, and on Chrome the two are about on par. + // This function uses `eval` (non-lexical) to produce such a + // predicate from a space-separated string of words. + // + // It starts by sorting the words by length. + + function makePredicate(words) { + words = words.split(" "); + return function (str) { + return words.indexOf(str) >= 0; + }; + } + + // Reserved word lists for various dialects of the language + + var reservedWords = { + 6: makePredicate("enum await"), + strict: makePredicate("implements interface let package private protected public static yield"), + strictBind: makePredicate("eval arguments") + }; + + // And the keywords + + var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); + + // ## Character categories + + // Big ugly regular expressions that match characters in the + // whitespace, identifier, and identifier-start categories. These + // are only applied when a character is found to actually have a + // code point above 128. + // Generated by `bin/generate-identifier-regex.js`. + + var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"; + var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; + + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + + nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; + + // These are a run-length and offset encoded representation of the + // >0xffff code points that are a valid part of identifiers. The + // offset starts at 0x10000, and each pair of numbers represents an + // offset to the next range, and then a size of the range. They were + // generated by `bin/generate-identifier-regex.js`. + // eslint-disable-next-line comma-spacing + var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541]; + // eslint-disable-next-line comma-spacing + var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; + + // This has a complexity linear to the value of the code. The + // assumption is that looking up astral identifier characters is + // rare. + function isInAstralSet(code, set) { + var pos = 0x10000; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code) return false; + + pos += set[i + 1]; + if (pos >= code) return true; + } + } + + // Test whether a given character code starts an identifier. + + function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes); + } + + // Test whether a given character is part of an identifier. + + function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); + } + + // A second optional argument can be given to further configure + var defaultOptions = { + // Source type ("script" or "module") for different semantics + sourceType: "script", + // Source filename. + sourceFilename: undefined, + // Line from which to start counting source. Useful for + // integration with other tools. + startLine: 1, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program. + allowImportExportEverywhere: false, + // TODO + allowSuperOutsideMethod: false, + // An array of plugins to enable + plugins: [], + // TODO + strictMode: null + }; + + // Interpret and default an options object + + function getOptions(opts) { + var options = {}; + for (var key in defaultOptions) { + options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; + } + return options; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + + + + + + + + + + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + + + + + + + + + + + var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + }; + + + + + + + + + + + + var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; + }; + + // ## Token types + + // The assignment of fine-grained, information-carrying type objects + // allows the tokenizer to store the information it has about a + // token in a way that is very cheap for the parser to look up. + + // All token type variables start with an underscore, to make them + // easy to recognize. + + // The `beforeExpr` property is used to disambiguate between regular + // expressions and divisions. It is set on all token types that can + // be followed by an expression (thus, a slash after them would be a + // regular expression). + // + // `isLoop` marks a keyword as starting a loop, which is important + // to know when parsing a label, in order to allow or disallow + // continue jumps to that label. + + var beforeExpr = true; + var startsExpr = true; + var isLoop = true; + var isAssign = true; + var prefix = true; + var postfix = true; + + var TokenType = function TokenType(label) { + var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, TokenType); + + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.rightAssociative = !!conf.rightAssociative; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; + }; + + var KeywordTokenType = function (_TokenType) { + inherits(KeywordTokenType, _TokenType); + + function KeywordTokenType(name) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, KeywordTokenType); + + options.keyword = name; + + return possibleConstructorReturn(this, _TokenType.call(this, name, options)); + } + + return KeywordTokenType; + }(TokenType); + + var BinopTokenType = function (_TokenType2) { + inherits(BinopTokenType, _TokenType2); + + function BinopTokenType(name, prec) { + classCallCheck(this, BinopTokenType); + return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec })); + } + + return BinopTokenType; + }(TokenType); + + var types = { + num: new TokenType("num", { startsExpr: startsExpr }), + regexp: new TokenType("regexp", { startsExpr: startsExpr }), + string: new TokenType("string", { startsExpr: startsExpr }), + name: new TokenType("name", { startsExpr: startsExpr }), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + bracketR: new TokenType("]"), + braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceR: new TokenType("}"), + braceBarR: new TokenType("|}"), + parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + parenR: new TokenType(")"), + comma: new TokenType(",", { beforeExpr: beforeExpr }), + semi: new TokenType(";", { beforeExpr: beforeExpr }), + colon: new TokenType(":", { beforeExpr: beforeExpr }), + doubleColon: new TokenType("::", { beforeExpr: beforeExpr }), + dot: new TokenType("."), + question: new TokenType("?", { beforeExpr: beforeExpr }), + arrow: new TokenType("=>", { beforeExpr: beforeExpr }), + template: new TokenType("template"), + ellipsis: new TokenType("...", { beforeExpr: beforeExpr }), + backQuote: new TokenType("`", { startsExpr: startsExpr }), + dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + at: new TokenType("@"), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }), + assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }), + incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }), + prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + logicalOR: new BinopTokenType("||", 1), + logicalAND: new BinopTokenType("&&", 2), + bitwiseOR: new BinopTokenType("|", 3), + bitwiseXOR: new BinopTokenType("^", 4), + bitwiseAND: new BinopTokenType("&", 5), + equality: new BinopTokenType("==/!=", 6), + relational: new BinopTokenType("", 7), + bitShift: new BinopTokenType("<>", 8), + plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }), + modulo: new BinopTokenType("%", 10), + star: new BinopTokenType("*", 10), + slash: new BinopTokenType("/", 10), + exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true }) + }; + + var keywords = { + "break": new KeywordTokenType("break"), + "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }), + "catch": new KeywordTokenType("catch"), + "continue": new KeywordTokenType("continue"), + "debugger": new KeywordTokenType("debugger"), + "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }), + "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }), + "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }), + "finally": new KeywordTokenType("finally"), + "for": new KeywordTokenType("for", { isLoop: isLoop }), + "function": new KeywordTokenType("function", { startsExpr: startsExpr }), + "if": new KeywordTokenType("if"), + "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }), + "switch": new KeywordTokenType("switch"), + "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }), + "try": new KeywordTokenType("try"), + "var": new KeywordTokenType("var"), + "let": new KeywordTokenType("let"), + "const": new KeywordTokenType("const"), + "while": new KeywordTokenType("while", { isLoop: isLoop }), + "with": new KeywordTokenType("with"), + "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "this": new KeywordTokenType("this", { startsExpr: startsExpr }), + "super": new KeywordTokenType("super", { startsExpr: startsExpr }), + "class": new KeywordTokenType("class"), + "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }), + "export": new KeywordTokenType("export"), + "import": new KeywordTokenType("import"), + "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "null": new KeywordTokenType("null", { startsExpr: startsExpr }), + "true": new KeywordTokenType("true", { startsExpr: startsExpr }), + "false": new KeywordTokenType("false", { startsExpr: startsExpr }), + "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }), + "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }), + "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }) + }; + + // Map keyword names to token types. + Object.keys(keywords).forEach(function (name) { + types["_" + name] = keywords[name]; + }); + + // Matches a whole line break (where CRLF is considered a single + // line break). Used to count lines. + + var lineBreak = /\r\n?|\n|\u2028|\u2029/; + var lineBreakG = new RegExp(lineBreak.source, "g"); + + function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; + } + + var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + + // The algorithm used to determine whether a regexp can appear at a + // given point in the program is loosely based on sweet.js' approach. + // See https://github.com/mozilla/sweet.js/wiki/design + + var TokContext = function TokContext(token, isExpr, preserveSpace, override) { + classCallCheck(this, TokContext); + + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + }; + + var types$1 = { + braceStatement: new TokContext("{", false), + braceExpression: new TokContext("{", true), + templateQuasi: new TokContext("${", true), + parenStatement: new TokContext("(", false), + parenExpression: new TokContext("(", true), + template: new TokContext("`", true, true, function (p) { + return p.readTmplToken(); + }), + functionExpression: new TokContext("function", true) + }; + + // Token-specific context update code + + types.parenR.updateContext = types.braceR.updateContext = function () { + if (this.state.context.length === 1) { + this.state.exprAllowed = true; + return; + } + + var out = this.state.context.pop(); + if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { + this.state.context.pop(); + this.state.exprAllowed = false; + } else if (out === types$1.templateQuasi) { + this.state.exprAllowed = true; + } else { + this.state.exprAllowed = !out.isExpr; + } + }; + + types.name.updateContext = function (prevType) { + this.state.exprAllowed = false; + + if (prevType === types._let || prevType === types._const || prevType === types._var) { + if (lineBreak.test(this.input.slice(this.state.end))) { + this.state.exprAllowed = true; + } + } + }; + + types.braceL.updateContext = function (prevType) { + this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); + this.state.exprAllowed = true; + }; + + types.dollarBraceL.updateContext = function () { + this.state.context.push(types$1.templateQuasi); + this.state.exprAllowed = true; + }; + + types.parenL.updateContext = function (prevType) { + var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; + this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); + this.state.exprAllowed = true; + }; + + types.incDec.updateContext = function () { + // tokExprAllowed stays unchanged + }; + + types._function.updateContext = function () { + if (this.curContext() !== types$1.braceStatement) { + this.state.context.push(types$1.functionExpression); + } + + this.state.exprAllowed = false; + }; + + types.backQuote.updateContext = function () { + if (this.curContext() === types$1.template) { + this.state.context.pop(); + } else { + this.state.context.push(types$1.template); + } + this.state.exprAllowed = false; + }; + + // These are used when `options.locations` is on, for the + // `startLoc` and `endLoc` properties. + + var Position = function Position(line, col) { + classCallCheck(this, Position); + + this.line = line; + this.column = col; + }; + + var SourceLocation = function SourceLocation(start, end) { + classCallCheck(this, SourceLocation); + + this.start = start; + this.end = end; + }; + + // The `getLineInfo` function is mostly useful when the + // `locations` option is off (for performance reasons) and you + // want to find the line/column position for a given character + // offset. `input` should be the code string that the offset refers + // into. + + function getLineInfo(input, offset) { + for (var line = 1, cur = 0;;) { + lineBreakG.lastIndex = cur; + var match = lineBreakG.exec(input); + if (match && match.index < offset) { + ++line; + cur = match.index + match[0].length; + } else { + return new Position(line, offset - cur); + } + } + } + + var State = function () { + function State() { + classCallCheck(this, State); + } + + State.prototype.init = function init(options, input) { + this.strict = options.strictMode === false ? false : options.sourceType === "module"; + + this.input = input; + + this.potentialArrowAt = -1; + + this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.noAnonFunctionType = false; + + this.labels = []; + + this.decorators = []; + + this.tokens = []; + + this.comments = []; + + this.trailingComments = []; + this.leadingComments = []; + this.commentStack = []; + + this.pos = this.lineStart = 0; + this.curLine = options.startLine; + + this.type = types.eof; + this.value = null; + this.start = this.end = this.pos; + this.startLoc = this.endLoc = this.curPosition(); + + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + + this.context = [types$1.braceStatement]; + this.exprAllowed = true; + + this.containsEsc = this.containsOctal = false; + this.octalPosition = null; + + this.exportedIdentifiers = []; + + return this; + }; + + // TODO + + + // TODO + + + // Used to signify the start of a potential arrow function + + + // Flags to track whether we are in a function, a generator. + + + // Labels in scope. + + + // Leading decorators. + + + // Token store. + + + // Comment store. + + + // Comment attachment store + + + // The current position of the tokenizer in the input. + + + // Properties of the current token: + // Its type + + + // For tokens that include more information than their type, the value + + + // Its start and end offset + + + // And, if locations are used, the {line, column} object + // corresponding to those offsets + + + // Position information for the previous token + + + // The context stack is used to superficially track syntactic + // context to predict whether a regular expression is allowed in a + // given position. + + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + + + // TODO + + + // Names of exports store. `default` is stored as a name for both + // `export default foo;` and `export { foo as default };`. + + + State.prototype.curPosition = function curPosition() { + return new Position(this.curLine, this.pos - this.lineStart); + }; + + State.prototype.clone = function clone(skipArrays) { + var state = new State(); + for (var key in this) { + var val = this[key]; + + if ((!skipArrays || key === "context") && Array.isArray(val)) { + val = val.slice(); + } + + state[key] = val; + } + return state; + }; + + return State; + }(); + + // Object type used to represent tokens. Note that normally, tokens + // simply exist as properties on the parser object. This is only + // used for the onToken callback and the external tokenizer. + + var Token = function Token(state) { + classCallCheck(this, Token); + + this.type = state.type; + this.value = state.value; + this.start = state.start; + this.end = state.end; + this.loc = new SourceLocation(state.startLoc, state.endLoc); + }; + + // ## Tokenizer + + function codePointToString(code) { + // UTF-16 Decoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } else { + return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); + } + } + + var Tokenizer = function () { + function Tokenizer(options, input) { + classCallCheck(this, Tokenizer); + + this.state = new State(); + this.state.init(options, input); + } + + // Move to the next token + + Tokenizer.prototype.next = function next() { + if (!this.isLookahead) { + this.state.tokens.push(new Token(this.state)); + } + + this.state.lastTokEnd = this.state.end; + this.state.lastTokStart = this.state.start; + this.state.lastTokEndLoc = this.state.endLoc; + this.state.lastTokStartLoc = this.state.startLoc; + this.nextToken(); + }; + + // TODO + + Tokenizer.prototype.eat = function eat(type) { + if (this.match(type)) { + this.next(); + return true; + } else { + return false; + } + }; + + // TODO + + Tokenizer.prototype.match = function match(type) { + return this.state.type === type; + }; + + // TODO + + Tokenizer.prototype.isKeyword = function isKeyword$$1(word) { + return isKeyword(word); + }; + + // TODO + + Tokenizer.prototype.lookahead = function lookahead() { + var old = this.state; + this.state = old.clone(true); + + this.isLookahead = true; + this.next(); + this.isLookahead = false; + + var curr = this.state.clone(true); + this.state = old; + return curr; + }; + + // Toggle strict mode. Re-reads the next number or string to please + // pedantic tests (`"use strict"; 010;` should fail). + + Tokenizer.prototype.setStrict = function setStrict(strict) { + this.state.strict = strict; + if (!this.match(types.num) && !this.match(types.string)) return; + this.state.pos = this.state.start; + while (this.state.pos < this.state.lineStart) { + this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; + --this.state.curLine; + } + this.nextToken(); + }; + + Tokenizer.prototype.curContext = function curContext() { + return this.state.context[this.state.context.length - 1]; + }; + + // Read a single token, updating the parser object's token-related + // properties. + + Tokenizer.prototype.nextToken = function nextToken() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) this.skipSpace(); + + this.state.containsOctal = false; + this.state.octalPosition = null; + this.state.start = this.state.pos; + this.state.startLoc = this.state.curPosition(); + if (this.state.pos >= this.input.length) return this.finishToken(types.eof); + + if (curContext.override) { + return curContext.override(this); + } else { + return this.readToken(this.fullCharCodeAtPos()); + } + }; + + Tokenizer.prototype.readToken = function readToken(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if (isIdentifierStart(code) || code === 92 /* '\' */) { + return this.readWord(); + } else { + return this.getTokenFromCode(code); + } + }; + + Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { + var code = this.input.charCodeAt(this.state.pos); + if (code <= 0xd7ff || code >= 0xe000) return code; + + var next = this.input.charCodeAt(this.state.pos + 1); + return (code << 10) + next - 0x35fdc00; + }; + + Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "CommentBlock" : "CommentLine", + value: text, + start: start, + end: end, + loc: new SourceLocation(startLoc, endLoc) + }; + + if (!this.isLookahead) { + this.state.tokens.push(comment); + this.state.comments.push(comment); + this.addComment(comment); + } + }; + + Tokenizer.prototype.skipBlockComment = function skipBlockComment() { + var startLoc = this.state.curPosition(); + var start = this.state.pos; + var end = this.input.indexOf("*/", this.state.pos += 2); + if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + + this.state.pos = end + 2; + lineBreakG.lastIndex = start; + var match = void 0; + while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { + ++this.state.curLine; + this.state.lineStart = match.index + match[0].length; + } + + this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { + var start = this.state.pos; + var startLoc = this.state.curPosition(); + var ch = this.input.charCodeAt(this.state.pos += startSkip); + while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { + ++this.state.pos; + ch = this.input.charCodeAt(this.state.pos); + } + + this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + // Called at the start of the parse and after every token. Skips + // whitespace and comments, and. + + Tokenizer.prototype.skipSpace = function skipSpace() { + loop: while (this.state.pos < this.input.length) { + var ch = this.input.charCodeAt(this.state.pos); + switch (ch) { + case 32:case 160: + // ' ' + ++this.state.pos; + break; + + case 13: + if (this.input.charCodeAt(this.state.pos + 1) === 10) { + ++this.state.pos; + } + + case 10:case 8232:case 8233: + ++this.state.pos; + ++this.state.curLine; + this.state.lineStart = this.state.pos; + break; + + case 47: + // '/' + switch (this.input.charCodeAt(this.state.pos + 1)) { + case 42: + // '*' + this.skipBlockComment(); + break; + + case 47: + this.skipLineComment(2); + break; + + default: + break loop; + } + break; + + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.state.pos; + } else { + break loop; + } + } + } + }; + + // Called at the end of every token. Sets `end`, `val`, and + // maintains `context` and `exprAllowed`, and skips the space after + // the token, so that the next one's `start` will point at the + // right position. + + Tokenizer.prototype.finishToken = function finishToken(type, val) { + this.state.end = this.state.pos; + this.state.endLoc = this.state.curPosition(); + var prevType = this.state.type; + this.state.type = type; + this.state.value = val; + + this.updateContext(prevType); + }; + + // ### Token reading + + // This is the function that is called to fetch the next token. It + // is somewhat obscure, because it works in character codes rather + // than characters, and because operator parsing has been inlined + // into it. + // + // All in the name of speed. + // + + + Tokenizer.prototype.readToken_dot = function readToken_dot() { + var next = this.input.charCodeAt(this.state.pos + 1); + if (next >= 48 && next <= 57) { + return this.readNumber(true); + } + + var next2 = this.input.charCodeAt(this.state.pos + 2); + if (next === 46 && next2 === 46) { + // 46 = dot '.' + this.state.pos += 3; + return this.finishToken(types.ellipsis); + } else { + ++this.state.pos; + return this.finishToken(types.dot); + } + }; + + Tokenizer.prototype.readToken_slash = function readToken_slash() { + // '/' + if (this.state.exprAllowed) { + ++this.state.pos; + return this.readRegexp(); + } + + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.slash, 1); + } + }; + + Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { + // '%*' + var type = code === 42 ? types.star : types.modulo; + var width = 1; + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === 42) { + // '*' + width++; + next = this.input.charCodeAt(this.state.pos + 2); + type = types.exponent; + } + + if (next === 61) { + width++; + type = types.assign; + } + + return this.finishOp(type, width); + }; + + Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { + // '|&' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); + if (next === 61) return this.finishOp(types.assign, 2); + if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); + return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); + }; + + Tokenizer.prototype.readToken_caret = function readToken_caret() { + // '^' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.bitwiseXOR, 1); + } + }; + + Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { + // '+-' + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === code) { + if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { + // A `-->` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken(); + } + return this.finishOp(types.incDec, 2); + } + + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.plusMin, 1); + } + }; + + Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { + // '<>' + var next = this.input.charCodeAt(this.state.pos + 1); + var size = 1; + + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); + return this.finishOp(types.bitShift, size); + } + + if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { + if (this.inModule) this.unexpected(); + // ``); + }), + }); + + // 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 + }; + + +/***/ }, +/* 686 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + + // Utils + const { + isGrip, + wrapRender, + } = __webpack_require__(662); + const { MODE } = __webpack_require__(660); + const nodeConstants = __webpack_require__(663); + const Svg = __webpack_require__(687); + + // Shortcuts + const { span } = React.DOM; + + /** + * Renders DOM element node. + */ + const 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) { + let {attributes, nodeName} = grip.preview; + const nodeNameElement = span({ + className: "tag-name theme-fg-color3" + }, nodeName); + + if (mode === MODE.TINY) { + let 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; + } + let 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) => { + let value = attributes[name]; + let attribute = span({}, + span({className: "attr-name theme-fg-color2"}, `${name}`), + `="`, + span({className: "attr-value theme-fg-color6"}, `${value}`), + `"` + ); + + return arr.concat([" ", attribute]); + }, []); + + return [ + "<", + nodeNameElement, + ...attributeElements, + ">", + ]; + }, + + render: wrapRender(function () { + let { + object, + mode, + attachedActorIds, + onDOMNodeMouseOver, + onDOMNodeMouseOut, + onInspectIconClick, + } = this.props; + let elements = this.getElements(object, mode); + let objectLink = this.props.objectLink || span; + + let isInTree = attachedActorIds ? attachedActorIds.includes(object.actor) : true; + + let baseConfig = {className: "objectBox objectBox-node"}; + let inspectIcon; + 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({object}, ...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 + }; + + +/***/ }, +/* 687 */ +/***/ function(module, exports, __webpack_require__) { + + const React = __webpack_require__(2); + const InlineSVG = __webpack_require__(346); + + const svg = { + "open-inspector": __webpack_require__(688), + }; + + module.exports = function(name, props) { // eslint-disable-line + if (!svg[name]) { + throw new Error("Unknown SVG: " + name); + } + let 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); + }; + + +/***/ }, /* 688 */ /***/ function(module, exports) { module.exports = "" /***/ }, -/* 689 */, -/* 690 */, -/* 691 */, -/* 692 */, -/* 693 */, -/* 694 */, -/* 695 */, +/* 689 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + + // Reps + const { + isGrip, + cropString, + wrapRender, + } = __webpack_require__(662); + const { MODE } = __webpack_require__(660); + const Svg = __webpack_require__(687); + + // Shortcuts + const DOM = React.DOM; + + /** + * Renders DOM #text node. + */ + let 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) { + const title = "#text"; + if (this.props.objectLink) { + return this.props.objectLink({ + object: grip + }, title); + } + return title; + }, + + render: wrapRender(function () { + let { + object: grip, + mode = MODE.SHORT, + attachedActorIds, + onDOMNodeMouseOver, + onDOMNodeMouseOut, + onInspectIconClick, + } = this.props; + + let baseConfig = {className: "objectBox objectBox-textNode"}; + let inspectIcon; + let 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 + }; + + +/***/ }, +/* 690 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + // Utils + const { + isGrip, + wrapRender, + } = __webpack_require__(662); + const { MODE } = __webpack_require__(660); + // Shortcuts + const { span } = React.DOM; + + /** + * Renders Error objects. + */ + const 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 () { + let object = this.props.object; + let preview = object.preview; + let name = preview && preview.name + ? preview.name + : "Error"; + + let 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}`; + } + + let objectLink = this.props.objectLink || span; + return ( + objectLink({object, className: "objectBox-stackTrace"}, + span({}, 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 + }; + + +/***/ }, +/* 691 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + + // Reps + const { + isGrip, + getURLDisplayString, + wrapRender + } = __webpack_require__(662); + + const { MODE } = __webpack_require__(660); + + // Shortcuts + const DOM = React.DOM; + + /** + * Renders a grip representing a window. + */ + let 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) { + let 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 () { + let { + mode, + object, + } = this.props; + + 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 + }; + + +/***/ }, +/* 692 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + + // Reps + const { + isGrip, + wrapRender, + } = __webpack_require__(662); + + // Shortcuts + const { span } = React.DOM; + + /** + * Renders a grip object with textual data. + */ + let 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 () { + let 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 + }; + + +/***/ }, +/* 693 */ +/***/ function(module, exports, __webpack_require__) { + + // ReactJS + const React = __webpack_require__(2); + + // Reps + const { + isGrip, + getURLDisplayString, + wrapRender, + } = __webpack_require__(662); + + // Shortcuts + const { span } = React.DOM; + + /** + * Renders a grip object with URL data. + */ + let 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 () { + let 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 + }; + + +/***/ }, +/* 694 */ +/***/ function(module, exports, __webpack_require__) { + + // Dependencies + const React = __webpack_require__(2); + const { + createFactories, + isGrip, + wrapRender, + } = __webpack_require__(662); + const Caption = React.createFactory(__webpack_require__(670)); + const { MODE } = __webpack_require__(660); + + // Shortcuts + const { span } = 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. + */ + let 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) { + let objectLink = this.props.objectLink || span; + if (this.props.mode !== MODE.TINY) { + let title = this.props.title || object.class || "Array"; + return objectLink({ + object: object + }, title, " "); + } + return ""; + }, + + getPreviewItems: function (grip) { + if (!grip.preview) { + return null; + } + + return grip.preview.items || grip.preview.childNodes || null; + }, + + arrayIterator: function (grip, max) { + let items = []; + const gripLength = this.getLength(grip); + + if (!gripLength) { + return items; + } + + const previewItems = this.getPreviewItems(grip); + if (!previewItems) { + return items; + } + + let delim; + // number of grip preview items is limited to 10, but we may have more + // items in grip-array. + let delimMax = gripLength > previewItems.length ? + previewItems.length : previewItems.length - 1; + let provider = this.props.provider; + + for (let i = 0; i < previewItems.length && i < max; i++) { + try { + let itemGrip = previewItems[i]; + let 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) { + let objectLink = this.props.objectLink || span; + let leftItemNum = gripLength - max > 0 ? + gripLength - max : gripLength - previewItems.length; + items.push(Caption({ + object: objectLink({ + object: this.props.object + }, leftItemNum + " more…") + })); + } + + return items; + }, + + render: wrapRender(function () { + let { + object, + mode = MODE.SHORT + } = this.props; + + let items; + let brackets; + let needSpace = function (space) { + return space ? { left: "[ ", right: " ]"} : { left: "[", right: "]"}; + }; + + if (mode === MODE.TINY) { + let objectLength = this.getLength(object); + let isEmpty = objectLength === 0; + items = [span({className: "length"}, isEmpty ? "" : objectLength)]; + brackets = needSpace(false); + } else { + let max = (mode === MODE.SHORT) ? 3 : 10; + items = this.arrayIterator(object, max); + brackets = needSpace(items.length > 0); + } + + let objectLink = this.props.objectLink || span; + let title = this.getTitle(object); + + return ( + span({ + className: "objectBox objectBox-array"}, + title, + objectLink({ + className: "arrayLeftBracket", + object: object + }, brackets.left), + ...items, + objectLink({ + className: "arrayRightBracket", + object: object + }, brackets.right), + span({ + className: "arrayProperties", + role: "group"} + ) + ) + ); + }), + }); + + /** + * Renders array item. Individual values are separated by + * a delimiter (a comma by default). + */ + let GripArrayItem = React.createFactory(React.createClass({ + displayName: "GripArrayItem", + + propTypes: { + delim: React.PropTypes.string, + 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])), + provider: React.PropTypes.object, + attachedActorIds: React.PropTypes.array, + onDOMNodeMouseOver: React.PropTypes.func, + onDOMNodeMouseOut: React.PropTypes.func, + onInspectIconClick: React.PropTypes.func, + }, + + render: function () { + let { Rep } = createFactories(__webpack_require__(661)); + + 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 + }; + + +/***/ }, +/* 695 */ +/***/ function(module, exports, __webpack_require__) { + + // Dependencies + const React = __webpack_require__(2); + const { + isGrip, + wrapRender, + } = __webpack_require__(662); + const Caption = React.createFactory(__webpack_require__(670)); + const PropRep = React.createFactory(__webpack_require__(672)); + const { MODE } = __webpack_require__(660); + // Shortcuts + const { span } = React.DOM; + /** + * Renders an map. A map is represented by a list of its + * entries enclosed in curly brackets. + */ + const 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) { + let title = this.props.title || (object && object.class ? object.class : "Map"); + if (this.props.objectLink) { + return this.props.objectLink({ + object: object + }, title); + } + return 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. + let isInterestingEntry = this.props.isInterestingEntry || ((type, value) => { + return ( + type == "boolean" || + type == "number" || + (type == "string" && value.length != 0) + ); + }); + + let mapEntries = object.preview && object.preview.entries + ? object.preview.entries : []; + + let 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); + }) + ); + } + + let entries = this.getEntries(mapEntries, indexes); + if (entries.length < mapEntries.length) { + // There are some undisplayed entries. Then display "more…". + let objectLink = this.props.objectLink || span; + + entries.push(Caption({ + key: "more", + object: objectLink({ + object: object + }, `${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) { + let { + objectLink, + attachedActorIds, + onDOMNodeMouseOver, + onDOMNodeMouseOut, + onInspectIconClick, + } = this.props; + + // Make indexes ordered by ascending. + indexes.sort(function (a, b) { + return a - b; + }); + + return indexes.map((index, i) => { + let [key, entryValue] = entries[index]; + let 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, [key, entry], i) => { + if (indexes.length < max) { + let value = (entry && entry.value !== undefined) ? entry.value : entry; + // Type is specified in grip's "class" field and for primitive + // values use typeof. + let type = (value && value.class ? value.class : typeof value).toLowerCase(); + + if (filter(type, value, key)) { + indexes.push(i); + } + } + + return indexes; + }, []); + }, + + render: wrapRender(function () { + let object = this.props.object; + let propsArray = this.safeEntriesIterator(object, + (this.props.mode === MODE.LONG) ? 10 : 3); + + let objectLink = this.props.objectLink || span; + if (this.props.mode === MODE.TINY) { + return ( + span({className: "objectBox objectBox-object"}, + this.getTitle(object), + objectLink({ + className: "objectLeftBrace", + object: object + }, "") + ) + ); + } + + return ( + span({className: "objectBox objectBox-object"}, + this.getTitle(object), + objectLink({ + className: "objectLeftBrace", + object: object + }, " { "), + propsArray, + objectLink({ + className: "objectRightBrace", + object: object + }, " }") + ) + ); + }), + }); + + 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 + }; + + +/***/ }, /* 696 */ /***/ function(module, exports, __webpack_require__) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var classnames = __webpack_require__(175); + var ManagedTree = React.createFactory(__webpack_require__(419)); + var Svg = __webpack_require__(344); + var Rep = __webpack_require__(697); - var _react = __webpack_require__(2); + var _require = __webpack_require__(659), + MODE = _require.MODE; - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _Rep = __webpack_require__(697); - - var _Rep2 = _interopRequireDefault(_Rep); - - var _previewFunction = __webpack_require__(701); - - var _previewFunction2 = _interopRequireDefault(_previewFunction); - - var _devtoolsReps = __webpack_require__(924); - - var _objectInspector = __webpack_require__(658); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var ManagedTree = (0, _react.createFactory)(__webpack_require__(419).default); + var _require2 = __webpack_require__(658), + nodeIsOptimizedOut = _require2.nodeIsOptimizedOut, + nodeIsMissingArguments = _require2.nodeIsMissingArguments, + nodeHasProperties = _require2.nodeHasProperties, + nodeIsPrimitive = _require2.nodeIsPrimitive, + isDefault = _require2.isDefault, + getChildren = _require2.getChildren, + createNode = _require2.createNode; + var dom = React.DOM, + PropTypes = React.PropTypes; // This implements a component that renders an interactive inspector // for looking at JavaScript objects. It expects descriptions of @@ -38878,64 +82992,80 @@ return /******/ (function(modules) { // webpackBootstrap // fetched, and a primitive value that should be displayed with no // children. - class ObjectInspector extends _react.Component { + var ObjectInspector = React.createClass({ + propTypes: { + autoExpandDepth: PropTypes.number, + name: PropTypes.string, + desc: PropTypes.object, + roots: PropTypes.array, + getObjectProperties: PropTypes.func.isRequired, + loadObjectProperties: PropTypes.func.isRequired, + onLabelClick: PropTypes.func, + onDoubleClick: PropTypes.func, + getExpanded: PropTypes.func, + setExpanded: PropTypes.func, + getActors: PropTypes.func, + setActors: PropTypes.func + }, - constructor() { - super(); + displayName: "ObjectInspector", - this.actors = null; + getInitialState() { + return {}; + }, - var self = this; - self.getChildren = this.getChildren.bind(this); - self.renderItem = this.renderItem.bind(this); - } + getDefaultProps() { + return { + onLabelClick: () => {}, + onDoubleClick: () => {}, + autoExpandDepth: 1, + getActors: () => { + return {}; + } + }; + }, componentWillMount() { // Cache of dynamically built nodes. We shouldn't need to clear // this out ever, since we don't ever "switch out" the object // being inspected. this.actors = this.props.getActors(); - } + }, componentWillUnmount() { if (this.props.setActors) { this.props.setActors(this.actors); } - } + }, getChildren(item) { var getObjectProperties = this.props.getObjectProperties; var actors = this.actors; - - return (0, _objectInspector.getChildren)({ + return getChildren({ getObjectProperties, actors, item }); - } + }, renderItem(item, depth, focused, _, expanded, _ref) { var setExpanded = _ref.setExpanded; var objectValue = void 0; - var label = item.name; - if ((0, _objectInspector.nodeIsOptimizedOut)(item)) { - objectValue = _react.DOM.span({ className: "unavailable" }, "(optimized away)"); - } else if ((0, _objectInspector.nodeIsMissingArguments)(item)) { - objectValue = _react.DOM.span({ className: "unavailable" }, "(unavailable)"); - } else if ((0, _objectInspector.nodeIsFunction)(item)) { - objectValue = null; - label = (0, _previewFunction2.default)(item); - } else if ((0, _objectInspector.nodeHasProperties)(item) || (0, _objectInspector.nodeIsPrimitive)(item)) { + if (nodeIsOptimizedOut(item)) { + objectValue = dom.span({ className: "unavailable" }, "(optimized away)"); + } else if (nodeIsMissingArguments(item)) { + objectValue = dom.span({ className: "unavailable" }, "(unavailable)"); + } else if (nodeHasProperties(item) || nodeIsPrimitive(item)) { var object = item.contents.value; - objectValue = (0, _Rep2.default)({ object, mode: _devtoolsReps.MODE.TINY }); + objectValue = Rep({ object, mode: MODE.TINY }); } - return _react.DOM.div({ - className: (0, _classnames2.default)("node object-node", { + return dom.div({ + className: classnames("node object-node", { focused, - "default-property": (0, _objectInspector.isDefault)(item) + "default-property": isDefault(item) }), style: { marginLeft: depth * 15 }, onClick: e => { @@ -38945,30 +83075,24 @@ return /******/ (function(modules) { // webpackBootstrap onDoubleClick: event => { event.stopPropagation(); this.props.onDoubleClick(item, { - depth, - focused, - expanded + depth, focused, expanded }); } - }, (0, _Svg2.default)("arrow", { - className: (0, _classnames2.default)({ + }, Svg("arrow", { + className: classnames({ expanded: expanded, - hidden: (0, _objectInspector.nodeIsPrimitive)(item) + hidden: nodeIsPrimitive(item) }) - }), _react.DOM.span({ + }), dom.span({ className: "object-label", - dir: "ltr", onClick: event => { event.stopPropagation(); this.props.onLabelClick(item, { - depth, - focused, - expanded, - setExpanded + depth, focused, expanded, setExpanded }); } - }, label), _react.DOM.span({ className: "object-delimiter" }, objectValue ? ": " : ""), _react.DOM.span({ className: "object-value" }, objectValue || "")); - } + }, item.name), dom.span({ className: "object-delimiter" }, objectValue ? ": " : ""), dom.span({ className: "object-value" }, objectValue || "")); + }, render() { var _props = this.props, @@ -38982,7 +83106,7 @@ return /******/ (function(modules) { // webpackBootstrap var roots = this.props.roots; if (!roots) { - roots = [(0, _objectInspector.createNode)(name, name, desc)]; + roots = [createNode(name, name, desc)]; } return ManagedTree({ @@ -38996,7 +83120,7 @@ return /******/ (function(modules) { // webpackBootstrap autoExpandAll: false, disabledFocus: true, onExpand: item => { - if ((0, _objectInspector.nodeHasProperties)(item)) { + if (nodeHasProperties(item)) { loadObjectProperties(item.contents.value); } }, @@ -39005,33 +83129,9 @@ return /******/ (function(modules) { // webpackBootstrap renderItem: this.renderItem }); } - } + }); - ObjectInspector.displayName = "ObjectInspector"; - - ObjectInspector.propTypes = { - autoExpandDepth: _react.PropTypes.number, - name: _react.PropTypes.string, - desc: _react.PropTypes.object, - roots: _react.PropTypes.array, - getObjectProperties: _react.PropTypes.func.isRequired, - loadObjectProperties: _react.PropTypes.func.isRequired, - onLabelClick: _react.PropTypes.func.isRequired, - onDoubleClick: _react.PropTypes.func.isRequired, - getExpanded: _react.PropTypes.func, - setExpanded: _react.PropTypes.func, - getActors: _react.PropTypes.func.isRequired, - setActors: _react.PropTypes.func - }; - - ObjectInspector.defaultProps = { - onLabelClick: () => {}, - onDoubleClick: () => {}, - autoExpandDepth: 1, - getActors: () => ({}) - }; - - exports.default = ObjectInspector; + module.exports = ObjectInspector; /***/ }, /* 697 */ @@ -39039,23 +83139,14 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.default = renderRep; + var React = __webpack_require__(2); - var _react = __webpack_require__(2); - - var _react2 = _interopRequireDefault(_react); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var _require = __webpack_require__(924), + var _require = __webpack_require__(659), _require$REPS = _require.REPS, Rep = _require$REPS.Rep, Grip = _require$REPS.Grip; - Rep = _react2.default.createFactory(Rep); + Rep = React.createFactory(Rep); function renderRep(_ref) { var object = _ref.object, @@ -39064,30 +83155,24 @@ return /******/ (function(modules) { // webpackBootstrap return Rep({ object, defaultRep: Grip, mode }); } + module.exports = renderRep; + /***/ }, /* 698 */ /***/ 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); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + Component = React.Component; var ReactDOM = __webpack_require__(22); - __webpack_require__(699); - class Popover extends _react.Component { + class Popover extends Component { constructor() { super(); this.state = { @@ -39097,123 +83182,54 @@ return /******/ (function(modules) { // webpackBootstrap } componentDidMount() { - var type = this.props.type; - - var _ref = type == "popover" ? this.getPopoverCoords() : this.getTooltipCoords(), - left = _ref.left, - top = _ref.top, - dir = _ref.dir; - - // eslint-disable-next-line react/no-did-mount-set-state - - - this.setState({ left, top, dir }); - } - - getPopoverCoords() { var el = ReactDOM.findDOMNode(this); var _el$getBoundingClient = el.getBoundingClientRect(), - width = _el$getBoundingClient.width, - height = _el$getBoundingClient.height; + width = _el$getBoundingClient.width; var _props$target$getBoun = this.props.target.getBoundingClientRect(), targetLeft = _props$target$getBoun.left, targetWidth = _props$target$getBoun.width, - targetBottom = _props$target$getBoun.bottom, - targetTop = _props$target$getBoun.top; + targetBottom = _props$target$getBoun.bottom; // width division corresponds to calc in Popover.css var left = targetLeft + targetWidth / 2 - width / 5; - var dir = targetBottom + height > window.innerHeight ? "up" : "down"; - var top = dir == "down" ? targetBottom : targetTop - height; + var top = targetBottom; - return { left, top, dir }; - } - - getTooltipCoords() { - var el = ReactDOM.findDOMNode(this); - - var _el$getBoundingClient2 = el.getBoundingClientRect(), - height = _el$getBoundingClient2.height; - - var _props$target$getBoun2 = this.props.target.getBoundingClientRect(), - targetLeft = _props$target$getBoun2.left, - targetWidth = _props$target$getBoun2.width, - targetTop = _props$target$getBoun2.top; - - var left = targetLeft + targetWidth / 4 - 10; - var top = targetTop - height; - - return { left, top, dir: "up" }; - } - - getChildren() { - var children = this.props.children; - var dir = this.state.dir; - - var gap = _react.DOM.div({ className: "gap", key: "gap" }); - return dir === "up" ? [children, gap] : [gap, children]; - } - - renderPopover() { - var onMouseLeave = this.props.onMouseLeave; - var _state = this.state, - top = _state.top, - left = _state.left, - dir = _state.dir; - - - return _react.DOM.div({ - className: (0, _classnames2.default)("popover", { up: dir === "up" }), - onMouseLeave, - style: { top, left } - }, this.getChildren()); - } - - renderTooltip() { - var onMouseLeave = this.props.onMouseLeave; - var _state2 = this.state, - top = _state2.top, - left = _state2.left; - - - return _react.DOM.div({ - className: "tooltip", - onMouseLeave, - style: { top, left } - }, this.getChildren()); + this.setState({ left, top }); } render() { - var type = this.props.type; + var _props = this.props, + children = _props.children, + onMouseLeave = _props.onMouseLeave; + var _state = this.state, + top = _state.top, + left = _state.left; - - if (type === "tooltip") { - return this.renderTooltip(); - } - - return this.renderPopover(); + return dom.div({ + className: "popover", + onMouseLeave, + style: { top, left } + }, dom.div({ className: "popover-gap" }), children); } } Popover.propTypes = { - target: _react.PropTypes.object, - children: _react.PropTypes.object, - onMouseLeave: _react.PropTypes.func, - type: _react.PropTypes.string + target: PropTypes.object, + children: PropTypes.object, + onMouseLeave: PropTypes.func }; Popover.defaultProps = { - onMouseLeave: () => {}, - type: "popover" + onMouseLeave: () => {} }; Popover.displayName = "Popover"; - exports.default = Popover; + module.exports = Popover; /***/ }, /* 699 */ @@ -39228,55 +83244,45 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _react = __webpack_require__(2); - var _times = __webpack_require__(702); - - var _times2 = _interopRequireDefault(_times); - - var _zip = __webpack_require__(704); - - var _zip2 = _interopRequireDefault(_zip); - - var _flatten = __webpack_require__(706); - - var _flatten2 = _interopRequireDefault(_flatten); + var _react2 = _interopRequireDefault(_react); 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); + var dom = _react2.default.DOM; + + + var times = __webpack_require__(702); + var zip = __webpack_require__(704); + var flatten = __webpack_require__(706); function renderFunctionName(value) { var name = value.userDisplayName || value.displayName || value.name || ""; - return _react.DOM.span({ className: "function-name" }, name); + return dom.span({ className: "function-name" }, name); } function renderParams(value) { - var _value$parameterNames = value.parameterNames, - parameterNames = _value$parameterNames === undefined ? [] : _value$parameterNames; + var parameterNames = value.parameterNames; - var params = parameterNames.filter(i => i).map(param => _react.DOM.span({ className: "param" }, param)); + var params = parameterNames.map(param => dom.span({ className: "param" }, param)); - var commas = (0, _times2.default)(params.length - 1).map(() => _react.DOM.span({ className: "delimiter" }, ", ")); + var commas = times(params.length - 1).map(() => dom.span({ className: "delimiter" }, ", ")); - return (0, _flatten2.default)((0, _zip2.default)(params, commas)); + return flatten(zip(params, commas)); } function renderParen(paren) { - return _react.DOM.span({ className: "paren" }, paren); + return dom.span({ className: "paren" }, paren); } function previewFunction(value) { - return _react.DOM.span.apply(_react.DOM, [{ className: "function-signature" }, renderFunctionName(value), renderParen("(")].concat(_toConsumableArray(renderParams(value)), [renderParen(")")])); + return dom.div.apply(dom, [{ className: "function-signature" }, renderFunctionName(value), renderParen("(")].concat(_toConsumableArray(renderParams(value)), [renderParen(")")])); } - exports.default = previewFunction; + module.exports = previewFunction; /***/ }, /* 702 */ @@ -39545,23 +83551,14 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.renderConditionalPanel = undefined; + var React = __webpack_require__(2); + var dom = React.DOM; - var _react = __webpack_require__(2); - - var _Close = __webpack_require__(378); - - var _Close2 = _interopRequireDefault(_Close); - - __webpack_require__(712); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ReactDOM = __webpack_require__(22); + var CloseButton = __webpack_require__(378); + __webpack_require__(712); function renderConditionalPanel(_ref) { var condition = _ref.condition, @@ -39591,12 +83588,12 @@ return /******/ (function(modules) { // webpackBootstrap } } - ReactDOM.render(_react.DOM.div({ className: "conditional-breakpoint-panel" }, _react.DOM.div({ className: "prompt" }, "»"), _react.DOM.input({ + ReactDOM.render(dom.div({ className: "conditional-breakpoint-panel" }, dom.div({ className: "prompt" }, "»"), dom.input({ defaultValue: condition, placeholder: L10N.getStr("editor.conditionalPanel.placeholder"), onKeyDown: onKey, ref: setInput - }), (0, _Close2.default)({ + }), CloseButton({ handleClick: closePanel, buttonClass: "big", tooltip: L10N.getStr("editor.conditionalPanel.close") @@ -39605,7 +83602,9 @@ return /******/ (function(modules) { // webpackBootstrap return panel; } - exports.renderConditionalPanel = renderConditionalPanel; + module.exports = { + renderConditionalPanel + }; /***/ }, /* 712 */ @@ -39620,45 +83619,31 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - var _devtoolsConfig = __webpack_require__(828); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - + var React = __webpack_require__(2); var ReactDOM = __webpack_require__(22); + var PropTypes = React.PropTypes; + + var classnames = __webpack_require__(175); + var Svg = __webpack_require__(344); + var breakpointSvg = document.createElement("div"); - ReactDOM.render((0, _Svg2.default)("breakpoint"), breakpointSvg); + ReactDOM.render(Svg("breakpoint"), breakpointSvg); function makeMarker(isDisabled) { var bp = breakpointSvg.cloneNode(true); - bp.className = (0, _classnames2.default)("editor new-breakpoint", { - "breakpoint-disabled": isDisabled, - "folding-enabled": (0, _devtoolsConfig.isEnabled)("codeFolding") - }); + bp.className = classnames("editor new-breakpoint", { "breakpoint-disabled": isDisabled }); return bp; } - class Breakpoint extends _react.Component { + var Breakpoint = React.createClass({ + propTypes: { + breakpoint: PropTypes.object.isRequired, + editor: PropTypes.object.isRequired + }, - constructor() { - super(); - this.addBreakpoint = this.addBreakpoint.bind(this); - } + displayName: "Breakpoint", addBreakpoint() { var bp = this.props.breakpoint; @@ -39671,20 +83656,24 @@ return /******/ (function(modules) { // webpackBootstrap } else { this.props.editor.removeLineClass(line, "line", "has-condition"); } - } + }, + 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) { return; @@ -39696,20 +83685,14 @@ return /******/ (function(modules) { // webpackBootstrap this.props.editor.setGutterMarker(line, "breakpoints", null); this.props.editor.removeLineClass(line, "line", "new-breakpoint"); this.props.editor.removeLineClass(line, "line", "has-condition"); - } + }, + render() { return null; } - } + }); - Breakpoint.propTypes = { - breakpoint: _react.PropTypes.object.isRequired, - editor: _react.PropTypes.object.isRequired - }; - - Breakpoint.displayName = "Breakpoint"; - - exports.default = Breakpoint; + module.exports = Breakpoint; /***/ }, /* 715 */ @@ -39717,22 +83700,26 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var PropTypes = React.PropTypes; - var _react = __webpack_require__(2); var markerEl = document.createElement("div"); - function makeMarker() { var marker = markerEl.cloneNode(true); marker.className = "editor hit-marker"; return marker; } - class HitMarker extends _react.Component { + var HitMarker = React.createClass({ + propTypes: { + hitData: PropTypes.object.isRequired, + editor: PropTypes.object.isRequired + }, + + displayName: "HitMarker", + addMarker() { var hitData = this.props.hitData; var line = hitData.line - 1; @@ -39740,11 +83727,11 @@ return /******/ (function(modules) { // webpackBootstrap this.props.editor.setGutterMarker(line, "hit-markers", makeMarker()); this.props.editor.addLineClass(line, "line", "hit-marker"); - } + }, shouldComponentUpdate(nextProps) { return this.props.editor !== nextProps.editor || this.props.hitData !== nextProps.hitData; - } + }, componentDidMount() { if (!this.props.editor) { @@ -39752,11 +83739,11 @@ return /******/ (function(modules) { // webpackBootstrap } this.addMarker(); - } + }, componentDidUpdate() { this.addMarker(); - } + }, componentWillUnmount() { if (!this.props.editor) { @@ -39768,21 +83755,14 @@ return /******/ (function(modules) { // webpackBootstrap this.props.editor.setGutterMarker(line, "hit-markers", null); this.props.editor.removeLineClass(line, "line", "hit-marker"); - } + }, render() { return null; } - } + }); - HitMarker.displayName = "HitMarker"; - - HitMarker.propTypes = { - hitData: _react.PropTypes.object.isRequired, - editor: _react.PropTypes.object.isRequired - }; - - exports.default = HitMarker; + module.exports = HitMarker; /***/ }, /* 716 */ @@ -39797,63 +83777,78 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); - - var _reactRedux = __webpack_require__(151); - - var _redux = __webpack_require__(3); - - var _reactImmutableProptypes = __webpack_require__(150); - - var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _selectors = __webpack_require__(242); - - var _devtoolsConfig = __webpack_require__(828); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _prefs = __webpack_require__(226); - var _Expressions2 = __webpack_require__(719); var _Expressions3 = _interopRequireDefault(_Expressions2); - __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 React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; - var Expressions = (0, _react.createFactory)(_Expressions3.default); + var _require = __webpack_require__(151), + connect = _require.connect; - 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 _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; - 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 _require3 = __webpack_require__(65), + isEnabled = _require3.isEnabled; + + var Svg = __webpack_require__(344); + var ImPropTypes = __webpack_require__(150); + + var _require4 = __webpack_require__(242), + getPause = _require4.getPause, + getBreakpoints = _require4.getBreakpoints, + getBreakpointsDisabled = _require4.getBreakpointsDisabled, + getBreakpointsLoading = _require4.getBreakpointsLoading; + + var _require5 = __webpack_require__(226), + prefs = _require5.prefs; + + var actions = __webpack_require__(244); + + var WhyPaused = React.createFactory(__webpack_require__(722).default); + var Breakpoints = React.createFactory(__webpack_require__(725).default); + + var Expressions = React.createFactory(_Expressions3.default); + + var SplitBox = createFactory(__webpack_require__(28).SplitBox); + var Scopes = isEnabled("chromeScopes") ? React.createFactory(__webpack_require__(728).default) : React.createFactory(__webpack_require__(731).default); + + var Frames = React.createFactory(__webpack_require__(733).default); + var EventListeners = React.createFactory(__webpack_require__(736).default); + var Accordion = React.createFactory(__webpack_require__(739)); + var CommandBar = React.createFactory(__webpack_require__(742).default); + __webpack_require__(745); function debugBtn(onClick, type, className, tooltip) { className = `${type} ${className}`; - return _react.DOM.button({ onClick, className, key: type, title: tooltip }, (0, _Svg2.default)(type, { title: tooltip, "aria-label": tooltip })); + return dom.button({ onClick, className, key: type, title: tooltip }, Svg(type, { title: tooltip, "aria-label": tooltip })); } - class SecondaryPanes extends _react.Component { + var SecondaryPanes = React.createClass({ + propTypes: { + evaluateExpressions: PropTypes.func.isRequired, + pauseData: ImPropTypes.map, + horizontal: PropTypes.bool, + breakpoints: ImPropTypes.map.isRequired, + breakpointsDisabled: PropTypes.bool, + breakpointsLoading: PropTypes.bool, + toggleAllBreakpoints: PropTypes.func.isRequired + }, + + contextTypes: { + shortcuts: PropTypes.object + }, + + displayName: "SecondaryPanes", + renderBreakpointsToggle() { var _props = this.props, toggleAllBreakpoints = _props.toggleAllBreakpoints, @@ -39868,7 +83863,7 @@ return /******/ (function(modules) { // webpackBootstrap return null; } - return _react.DOM.input({ + return dom.input({ type: "checkbox", "aria-label": breakpointsDisabled ? L10N.getStr("breakpoints.enable") : L10N.getStr("breakpoints.disable"), className: boxClassName, @@ -39882,14 +83877,14 @@ return /******/ (function(modules) { // webpackBootstrap }, title: breakpointsDisabled ? L10N.getStr("breakpoints.enable") : L10N.getStr("breakpoints.disable") }); - } + }, watchExpressionHeaderButtons() { return [debugBtn(evt => { evt.stopPropagation(); this.props.evaluateExpressions(); }, "refresh", "refresh", L10N.getStr("watchExpressions.refreshButton"))]; - } + }, getScopeItem() { var isPaused = () => !!this.props.pauseData; @@ -39897,61 +83892,56 @@ return /******/ (function(modules) { // webpackBootstrap return { header: L10N.getStr("scopes.header"), component: Scopes, - opened: _prefs.prefs.scopesVisible, + opened: prefs.scopesVisible, onToggle: opened => { - _prefs.prefs.scopesVisible = opened; + prefs.scopesVisible = opened; }, shouldOpen: isPaused }; - } + }, getWatchItem() { - return { - header: L10N.getStr("watchExpressions.header"), + return { header: L10N.getStr("watchExpressions.header"), buttons: this.watchExpressionHeaderButtons(), component: Expressions, opened: true }; - } + }, getStartItems() { var scopesContent = this.props.horizontal ? this.getScopeItem() : null; var isPaused = () => !!this.props.pauseData; - var items = [{ - header: L10N.getStr("breakpoints.header"), + var items = [{ header: L10N.getStr("breakpoints.header"), buttons: this.renderBreakpointsToggle(), component: Breakpoints, - opened: true - }, { - header: L10N.getStr("callStack.header"), + opened: true }, { header: L10N.getStr("callStack.header"), component: Frames, - opened: _prefs.prefs.callStackVisible, + opened: prefs.callStackVisible, onToggle: opened => { - _prefs.prefs.callStackVisible = opened; + prefs.callStackVisible = opened; }, - shouldOpen: isPaused - }, scopesContent]; + shouldOpen: isPaused }, scopesContent]; - if ((0, _devtoolsConfig.isEnabled)("eventListeners")) { + if (isEnabled("eventListeners")) { items.push({ header: L10N.getStr("eventListenersHeader"), component: EventListeners }); } - if ((0, _devtoolsConfig.isEnabled)("watchExpressions") && this.props.horizontal) { + if (isEnabled("watchExpressions") && this.props.horizontal) { items.unshift(this.getWatchItem()); } return items.filter(item => item); - } + }, renderHorizontalLayout() { return Accordion({ items: this.getItems() }); - } + }, getEndItems() { var items = []; @@ -39960,16 +83950,16 @@ return /******/ (function(modules) { // webpackBootstrap items.unshift(this.getScopeItem()); } - if ((0, _devtoolsConfig.isEnabled)("watchExpressions") && !this.props.horizontal) { + if (isEnabled("watchExpressions") && !this.props.horizontal) { items.unshift(this.getWatchItem()); } return items; - } + }, getItems() { return [].concat(_toConsumableArray(this.getStartItems()), _toConsumableArray(this.getEndItems())); - } + }, renderVerticalLayout() { return SplitBox({ @@ -39981,38 +83971,20 @@ return /******/ (function(modules) { // webpackBootstrap startPanel: Accordion({ items: this.getStartItems() }), endPanel: Accordion({ items: this.getEndItems() }) }); - } + }, render() { - return _react.DOM.div({ - className: "secondary-panes", - style: { overflowX: "hidden" } - }, CommandBar(), WhyPaused(), this.props.horizontal ? this.renderHorizontalLayout() : this.renderVerticalLayout()); + return dom.div({ className: "secondary-panes", + style: { overflowX: "hidden" } }, CommandBar(), WhyPaused(), this.props.horizontal ? this.renderHorizontalLayout() : this.renderVerticalLayout()); } - } + }); - SecondaryPanes.propTypes = { - evaluateExpressions: _react.PropTypes.func.isRequired, - pauseData: _reactImmutableProptypes2.default.map, - horizontal: _react.PropTypes.bool, - breakpoints: _reactImmutableProptypes2.default.map.isRequired, - breakpointsDisabled: _react.PropTypes.bool, - breakpointsLoading: _react.PropTypes.bool, - toggleAllBreakpoints: _react.PropTypes.func.isRequired - }; - - SecondaryPanes.contextTypes = { - shortcuts: _react.PropTypes.object - }; - - SecondaryPanes.displayName = "SecondaryPanes"; - - exports.default = (0, _reactRedux.connect)(state => ({ - pauseData: (0, _selectors.getPause)(state), - breakpoints: (0, _selectors.getBreakpoints)(state), - breakpointsDisabled: (0, _selectors.getBreakpointsDisabled)(state), - breakpointsLoading: (0, _selectors.getBreakpointsLoading)(state) - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SecondaryPanes); + module.exports = connect(state => ({ + pauseData: getPause(state), + breakpoints: getBreakpoints(state), + breakpointsDisabled: getBreakpointsDisabled(state), + breakpointsLoading: getBreakpointsLoading(state) + }), dispatch => bindActionCreators(actions, dispatch))(SecondaryPanes); /***/ }, /* 719 */ @@ -40046,8 +84018,8 @@ return /******/ (function(modules) { // webpackBootstrap 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 CloseButton = _react2.default.createFactory(__webpack_require__(378)); + var ObjectInspector = _react2.default.createFactory(__webpack_require__(696)); var dom = _react2.default.DOM, PropTypes = _react2.default.PropTypes; @@ -40080,36 +84052,34 @@ return /******/ (function(modules) { // webpackBootstrap }; } - class Expressions extends _react2.default.Component { + var Expressions = _react2.default.createClass({ + propTypes: { + expressions: _reactImmutableProptypes2.default.list.isRequired, + addExpression: PropTypes.func.isRequired, + updateExpression: PropTypes.func.isRequired, + deleteExpression: PropTypes.func.isRequired, + loadObjectProperties: PropTypes.func, + loadedObjects: _reactImmutableProptypes2.default.map.isRequired + }, - constructor() { - super(...arguments); + _input: null, - this.state = { + displayName: "Expressions", + + getInitialState() { + return { editing: null }; - - this.renderExpression = this.renderExpression.bind(this); - } - - componentDidMount() { - var _props = this.props, - expressions = _props.expressions, - evaluateExpressions = _props.evaluateExpressions; - - if (expressions.size > 0) { - evaluateExpressions(); - } - } + }, shouldComponentUpdate(nextProps, nextState) { var editing = this.state.editing; - var _props2 = this.props, - expressions = _props2.expressions, - loadedObjects = _props2.loadedObjects; + var _props = this.props, + expressions = _props.expressions, + loadedObjects = _props.loadedObjects; return expressions !== nextProps.expressions || loadedObjects !== nextProps.loadedObjects || editing !== nextState.editing; - } + }, editExpression(expression, _ref) { var depth = _ref.depth; @@ -40119,14 +84089,14 @@ return /******/ (function(modules) { // webpackBootstrap } this.setState({ editing: expression.input }); - } + }, deleteExpression(e, expression) { e.stopPropagation(); var deleteExpression = this.props.deleteExpression; deleteExpression(expression); - } + }, inputKeyPress(e, expression) { if (e.key !== "Enter") { @@ -40141,11 +84111,10 @@ return /******/ (function(modules) { // webpackBootstrap this.setState({ editing: null }); e.target.value = ""; this.props.updateExpression(value, expression); - } + }, renderExpressionEditInput(expression) { - return dom.span({ className: "expression-input-container" }, dom.input({ - type: "text", + return dom.span({ className: "expression-input-container" }, dom.input({ type: "text", className: "input-expression", onKeyPress: e => this.inputKeyPress(e, expression), onBlur: () => { @@ -40156,25 +84125,19 @@ return /******/ (function(modules) { // webpackBootstrap this._input = c; } })); - } + }, renderExpression(expression) { - var _props3 = this.props, - loadObjectProperties = _props3.loadObjectProperties, - loadedObjects = _props3.loadedObjects; + var _props2 = this.props, + loadObjectProperties = _props2.loadObjectProperties, + loadedObjects = _props2.loadedObjects; var editing = this.state.editing; - var input = expression.input, - updating = expression.updating; - + var input = expression.input; if (editing == input) { return this.renderExpressionEditInput(expression); } - if (updating) { - return; - } - var _getValue = getValue(expression), value = _getValue.value, path = _getValue.path; @@ -40193,16 +84156,15 @@ return /******/ (function(modules) { // webpackBootstrap getObjectProperties: id => loadedObjects.get(id), autoExpandDepth: 0, onDoubleClick: (item, options) => this.editExpression(expression, options), - loadObjectProperties, - getActors: () => ({}) + loadObjectProperties }), CloseButton({ handleClick: e => this.deleteExpression(e, expression) })); - } + }, componentDidUpdate() { if (this._input) { this._input.focus(); } - } + }, renderNewExpressionInput() { var onKeyPress = e => { @@ -40223,35 +84185,21 @@ return /******/ (function(modules) { // webpackBootstrap type: "text", className: "input-expression", placeholder: L10N.getStr("expressions.placeholder"), - onBlur: e => { - e.target.value = ""; - }, + onBlur: e => e.target.value = "", onKeyPress })); - } + }, render() { var expressions = this.props.expressions; return 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, - loadedObjects: _reactImmutableProptypes2.default.map.isRequired - }; - - Expressions.displayName = "Expressions"; + }); exports.default = (0, _reactRedux.connect)(state => ({ pauseInfo: (0, _selectors.getPause)(state), - expressions: (0, _selectors.getVisibleExpressions)(state), + expressions: (0, _selectors.getExpressions)(state), loadedObjects: (0, _selectors.getLoadedObjects)(state) }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Expressions); @@ -40295,6 +84243,7 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } class WhyPaused extends _react.Component { + renderMessage(pauseInfo) { if (!pauseInfo) { return null; @@ -40400,12 +84349,22 @@ return /******/ (function(modules) { // webpackBootstrap return url ? _react.DOM.div({ className: "location" }, `${(0, _utils.endTruncateStr)(url, 30)}: ${line}`) : null; } - class Breakpoints extends _react.Component { + var Breakpoints = (0, _react.createClass)({ + propTypes: { + breakpoints: _reactImmutableProptypes2.default.map.isRequired, + enableBreakpoint: _react.PropTypes.func.isRequired, + disableBreakpoint: _react.PropTypes.func.isRequired, + selectSource: _react.PropTypes.func.isRequired, + removeBreakpoint: _react.PropTypes.func.isRequired + }, + + displayName: "Breakpoints", + shouldComponentUpdate(nextProps, nextState) { var breakpoints = this.props.breakpoints; return breakpoints !== nextProps.breakpoints; - } + }, handleCheckbox(breakpoint) { if (breakpoint.loading) { @@ -40417,18 +84376,18 @@ return /******/ (function(modules) { // webpackBootstrap } else { this.props.disableBreakpoint(breakpoint.location); } - } + }, selectBreakpoint(breakpoint) { var sourceId = breakpoint.location.sourceId; var line = breakpoint.location.line; this.props.selectSource(sourceId, { line }); - } + }, removeBreakpoint(event, breakpoint) { event.stopPropagation(); this.props.removeBreakpoint(breakpoint.location); - } + }, renderBreakpoint(breakpoint) { var snippet = breakpoint.text || ""; @@ -40436,7 +84395,7 @@ return /******/ (function(modules) { // webpackBootstrap var line = breakpoint.location.line; var isCurrentlyPaused = breakpoint.isCurrentlyPaused; var isDisabled = breakpoint.disabled; - var isConditional = !!breakpoint.condition; + var isConditional = breakpoint.condition !== null; return _react.DOM.div({ className: (0, _classnames2.default)({ @@ -40459,7 +84418,7 @@ return /******/ (function(modules) { // webpackBootstrap handleClick: ev => this.removeBreakpoint(ev, breakpoint), tooltip: L10N.getStr("breakpoints.removeBreakpointTooltip") })); - } + }, render() { var breakpoints = this.props.breakpoints; @@ -40468,24 +84427,17 @@ return /******/ (function(modules) { // webpackBootstrap return this.renderBreakpoint(bp); })); } - } - - Breakpoints.displayName = "Breakpoints"; - - Breakpoints.propTypes = { - breakpoints: _reactImmutableProptypes2.default.map.isRequired, - enableBreakpoint: _react.PropTypes.func.isRequired, - disableBreakpoint: _react.PropTypes.func.isRequired, - selectSource: _react.PropTypes.func.isRequired, - removeBreakpoint: _react.PropTypes.func.isRequired - }; + }); function updateLocation(state, bp) { var source = (0, _selectors.getSource)(state, bp.location.sourceId); var isCurrentlyPaused = isCurrentlyPausedAtBreakpoint(state, bp); var locationId = (0, _breakpoints.makeLocationId)(bp.location); - var location = Object.assign({}, bp.location, { source }); + var location = Object.assign({}, bp.location, { + source + }); + var localBP = Object.assign({}, bp, { location, locationId, @@ -40496,10 +84448,12 @@ return /******/ (function(modules) { // webpackBootstrap } function _getBreakpoints(state) { - return (0, _selectors.getBreakpoints)(state).map(bp => updateLocation(state, bp)).filter(bp => bp.location.source && !bp.location.source.get("isBlackBoxed")); + return (0, _selectors.getBreakpoints)(state).map(bp => updateLocation(state, bp)).filter(bp => bp.location.source); } - exports.default = (0, _reactRedux.connect)((state, props) => ({ breakpoints: _getBreakpoints(state) }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Breakpoints); + exports.default = (0, _reactRedux.connect)((state, props) => ({ + breakpoints: _getBreakpoints(state) + }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Breakpoints); /***/ }, /* 726 */ @@ -40546,7 +84500,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)(__webpack_require__(419)); function info(text) { @@ -40573,20 +84527,23 @@ return /******/ (function(modules) { // webpackBootstrap return { name, path, contents }; } - class Scopes extends _react.Component { + var Scopes = (0, _react.createClass)({ + propTypes: { + scopes: _react.PropTypes.array, + loadedObjects: _reactImmutableProptypes2.default.map, + loadObjectProperties: _react.PropTypes.func, + pauseInfo: _react.PropTypes.object + }, - constructor() { - super(...arguments); + displayName: "Scopes", + getInitialState() { // Cache of dynamically built nodes. We shouldn't need to clear // this out ever, since we don't ever "switch out" the object // being inspected. this.objectCache = {}; - - this.getChildren = this.getChildren.bind(this); - this.onExpand = this.onExpand.bind(this); - this.renderItem = this.renderItem.bind(this); - } + return {}; + }, makeNodesForProperties(objProps, parentPath) { var ownProperties = objProps.ownProperties, @@ -40603,13 +84560,11 @@ return /******/ (function(modules) { // webpackBootstrap // Add the prototype if it exists and is not null if (prototype && prototype.type !== "null") { - nodes.push(createNode("__proto__", `${parentPath}/__proto__`, { - value: prototype - })); + nodes.push(createNode("__proto__", `${parentPath}/__proto__`, { value: prototype })); } return nodes; - } + }, renderItem(item, depth, focused, _, expanded, _ref) { var setExpanded = _ref.setExpanded; @@ -40634,11 +84589,11 @@ return /******/ (function(modules) { // webpackBootstrap hidden: nodeIsPrimitive(item) }) }), _react.DOM.span({ className: "object-label" }, item.name), _react.DOM.span({ className: "object-delimiter" }, objectValue ? ": " : ""), _react.DOM.span({ className: "object-value" }, objectValue || "")); - } + }, getObjectProperties(item) { this.props.loadedObjects.get(item.contents.value.objectId); - } + }, getChildren(item) { var obj = item.contents; @@ -40670,7 +84625,7 @@ return /******/ (function(modules) { // webpackBootstrap return []; } return []; - } + }, onExpand(item) { var loadObjectProperties = this.props.loadObjectProperties; @@ -40679,7 +84634,7 @@ return /******/ (function(modules) { // webpackBootstrap if (nodeHasProperties(item)) { loadObjectProperties(item.contents.value); } - } + }, getRoots() { return this.props.scopes.map(scope => { @@ -40691,7 +84646,7 @@ return /******/ (function(modules) { // webpackBootstrap contents: { value: scope.object } }; }); - } + }, render() { var pauseInfo = this.props.pauseInfo; @@ -40717,16 +84672,7 @@ return /******/ (function(modules) { // webpackBootstrap renderItem: this.renderItem })); } - } - - Scopes.propTypes = { - scopes: _react.PropTypes.array, - loadedObjects: _reactImmutableProptypes2.default.map, - loadObjectProperties: _react.PropTypes.func, - pauseInfo: _react.PropTypes.object - }; - - Scopes.displayName = "Scopes"; + }); exports.default = (0, _reactRedux.connect)(state => ({ pauseInfo: (0, _selectors.getPause)(state), @@ -40773,7 +84719,7 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var ObjectInspector = (0, _react.createFactory)(__webpack_require__(696).default); + var ObjectInspector = (0, _react.createFactory)(__webpack_require__(696)); function info(text) { @@ -40783,22 +84729,15 @@ return /******/ (function(modules) { // webpackBootstrap var expandedCache = new Set(); var actorsCache = []; - class Scopes extends _react.Component { + var Scopes = (0, _react.createClass)({ + propTypes: { + pauseInfo: _reactImmutableProptypes2.default.map, + loadedObjects: _reactImmutableProptypes2.default.map, + loadObjectProperties: _react.PropTypes.func, + selectedFrame: _react.PropTypes.object + }, - constructor(props) { - var pauseInfo = props.pauseInfo, - selectedFrame = props.selectedFrame; - - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - super(props, ...args); - - this.state = { - scopes: (0, _scopes.getScopes)(pauseInfo, selectedFrame) - }; - } + displayName: "Scopes", shouldComponentUpdate(nextProps, nextState) { var _props = this.props, @@ -40807,13 +84746,21 @@ return /******/ (function(modules) { // webpackBootstrap loadedObjects = _props.loadedObjects; return pauseInfo !== nextProps.pauseInfo || selectedFrame !== nextProps.selectedFrame || loadedObjects !== nextProps.loadedObjects; - } + }, - componentWillReceiveProps(nextProps) { + getInitialState() { var _props2 = this.props, pauseInfo = _props2.pauseInfo, selectedFrame = _props2.selectedFrame; + return { scopes: (0, _scopes.getScopes)(pauseInfo, selectedFrame) }; + }, + + componentWillReceiveProps(nextProps) { + var _props3 = this.props, + pauseInfo = _props3.pauseInfo, + selectedFrame = _props3.selectedFrame; + var pauseInfoChanged = pauseInfo !== nextProps.pauseInfo; var selectedFrameChange = selectedFrame !== nextProps.selectedFrame; @@ -40822,13 +84769,13 @@ return /******/ (function(modules) { // webpackBootstrap scopes: (0, _scopes.getScopes)(nextProps.pauseInfo, nextProps.selectedFrame) }); } - } + }, render() { - var _props3 = this.props, - pauseInfo = _props3.pauseInfo, - loadObjectProperties = _props3.loadObjectProperties, - loadedObjects = _props3.loadedObjects; + var _props4 = this.props, + pauseInfo = _props4.pauseInfo, + loadObjectProperties = _props4.loadObjectProperties, + loadedObjects = _props4.loadedObjects; var scopes = this.state.scopes; @@ -40857,16 +84804,7 @@ return /******/ (function(modules) { // webpackBootstrap return _react.DOM.div({ className: "pane scopes-list" }, pauseInfo ? scopeInspector : info(L10N.getStr("scopes.notPaused"))); } - } - - Scopes.propTypes = { - pauseInfo: _reactImmutableProptypes2.default.map, - loadedObjects: _reactImmutableProptypes2.default.map, - loadObjectProperties: _react.PropTypes.func, - selectedFrame: _react.PropTypes.object - }; - - Scopes.displayName = "Scopes"; + }); exports.default = (0, _reactRedux.connect)(state => ({ pauseInfo: (0, _selectors.getPause)(state), @@ -40886,8 +84824,6 @@ return /******/ (function(modules) { // webpackBootstrap 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); } } - // Create the tree nodes representing all the variables and arguments // for the bindings from a scope. function getBindingVariables(bindings, parentName) { @@ -41022,35 +84958,9 @@ return /******/ (function(modules) { // webpackBootstrap return scopes; } - /** - * Returns variables that are visible from this scope. - * TODO: returns global variables as well - */ - function getVisibleVariablesFromScope(pauseInfo, selectedFrame) { - var _ref; - - var result = new Map(); - - var scopes = getScopes(pauseInfo, selectedFrame); - if (!scopes) { - return result; - } - - // reverse so that the local variables shadow global variables - var scopeContents = scopes.reverse().map(scope => scope.contents); - scopeContents = (_ref = []).concat.apply(_ref, _toConsumableArray(scopeContents)); - - scopeContents.forEach(content => { - result.set(content.name || null, content); - }); - - return result; - } - module.exports = { getScopes, - getSpecialVariables, - getVisibleVariablesFromScope + getSpecialVariables }; /***/ }, @@ -41063,8 +84973,6 @@ return /******/ (function(modules) { // webpackBootstrap 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); @@ -41079,21 +84987,7 @@ return /******/ (function(modules) { // webpackBootstrap 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 _menu = __webpack_require__(422); var _clipboard = __webpack_require__(423); @@ -41115,41 +85009,30 @@ return /******/ (function(modules) { // webpackBootstrap 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); + return _react.DOM.div({ className: "title" }, (0, _utils.endTruncateStr)(displayName, 40)); } function renderFrameLocation(_ref2) { var source = _ref2.source, - location = _ref2.location, - library = _ref2.library; + location = _ref2.location; 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 { + var Frames = (0, _react.createClass)({ + propTypes: { + frames: _react.PropTypes.array, + selectedFrame: _react.PropTypes.object, + selectFrame: _react.PropTypes.func.isRequired + }, - constructor() { - super(...arguments); - - this.state = { - showAllFrames: false - }; - - this.renderFrame = this.renderFrame.bind(this); - this.toggleFramesDisplay = this.toggleFramesDisplay.bind(this); - } + displayName: "Frames", shouldComponentUpdate(nextProps, nextState) { var _props = this.props, @@ -41158,13 +85041,17 @@ return /******/ (function(modules) { // webpackBootstrap var showAllFrames = this.state.showAllFrames; return frames !== nextProps.frames || selectedFrame !== nextProps.selectedFrame || showAllFrames !== nextState.showAllFrames; - } + }, + + getInitialState() { + return { showAllFrames: false }; + }, toggleFramesDisplay() { this.setState({ showAllFrames: !this.state.showAllFrames }); - } + }, onContextMenu(event, frame) { var copySourceUrlLabel = L10N.getStr("copySourceUrl"); @@ -41188,45 +85075,44 @@ return /******/ (function(modules) { // webpackBootstrap menuOptions.push(copySourceUrl); } - (0, _devtoolsLaunchpad.showMenu)(event, menuOptions); - } + (0, _menu.showMenu)(event, menuOptions); + }, renderFrame(frame) { var selectedFrame = this.props.selectedFrame; - return _react.DOM.li({ - key: frame.id, + + return _react.DOM.li({ key: frame.id, className: (0, _classnames2.default)("frame", { - selected: selectedFrame && selectedFrame.id === frame.id + "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"); @@ -41236,7 +85122,7 @@ return /******/ (function(modules) { // webpackBootstrap } return _react.DOM.div({ className: "show-more", onClick: this.toggleFramesDisplay }, buttonMessage); - } + }, render() { var frames = this.props.frames; @@ -41248,61 +85134,21 @@ return /******/ (function(modules) { // webpackBootstrap 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, { + return 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 => ({ @@ -41350,17 +85196,20 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var dom = _react2.default.DOM, - PropTypes = _react2.default.PropTypes, - Component = _react2.default.Component; + PropTypes = _react2.default.PropTypes; - class EventListeners extends Component { + var EventListeners = _react2.default.createClass({ + propTypes: { + listeners: PropTypes.array.isRequired, + selectSource: PropTypes.func.isRequired, + addBreakpoint: PropTypes.func.isRequired, + enableBreakpoint: PropTypes.func.isRequired, + disableBreakpoint: PropTypes.func.isRequired, + removeBreakpoint: PropTypes.func.isRequired + }, - constructor() { - super(...arguments); - - this.renderListener = this.renderListener.bind(this); - } + displayName: "EventListeners", renderListener(_ref) { var type = _ref.type, @@ -41384,7 +85233,7 @@ return /******/ (function(modules) { // webpackBootstrap }), dom.span({ className: "type" }, type), dom.span({ className: "selector" }, selector), breakpoint ? (0, _Close2.default)({ handleClick: ev => this.removeBreakpoint(ev, breakpoint) }) : ""); - } + }, handleCheckbox(breakpoint, location) { if (!breakpoint) { @@ -41400,12 +85249,12 @@ return /******/ (function(modules) { // webpackBootstrap } else { this.props.disableBreakpoint(breakpoint.location); } - } + }, removeBreakpoint(event, breakpoint) { event.stopPropagation(); this.props.removeBreakpoint(breakpoint.location); - } + }, render() { var listeners = this.props.listeners; @@ -41414,25 +85263,11 @@ return /******/ (function(modules) { // webpackBootstrap className: "pane event-listeners" }, listeners.map(this.renderListener)); } - } - - EventListeners.propTypes = { - listeners: PropTypes.array.isRequired, - selectSource: PropTypes.func.isRequired, - addBreakpoint: PropTypes.func.isRequired, - enableBreakpoint: PropTypes.func.isRequired, - disableBreakpoint: PropTypes.func.isRequired, - removeBreakpoint: PropTypes.func.isRequired - }; - - EventListeners.displayName = "EventListeners"; + }); exports.default = (0, _reactRedux.connect)(state => { var listeners = (0, _selectors.getEventListeners)(state).map(l => Object.assign({}, l, { - breakpoint: (0, _selectors.getBreakpoint)(state, { - sourceId: l.sourceId, - line: l.line - }) + breakpoint: (0, _selectors.getBreakpoint)(state, { sourceId: l.sourceId, line: l.line }) })); return { listeners }; @@ -41451,37 +85286,28 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - 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); } } - var _react = __webpack_require__(2); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; + var div = dom.div; - var _react2 = _interopRequireDefault(_react); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); + var Svg = __webpack_require__(344); __webpack_require__(740); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var Accordion = React.createClass({ + propTypes: { + items: PropTypes.array.isRequired + }, - 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); } } + displayName: "Accordion", - class Accordion extends _react2.default.Component { - - constructor(props) { - super(); - - this.state = { - opened: props.items.map(item => item.opened), - created: [] - }; - - var self = this; - self.renderContainer = this.renderContainer.bind(this); - } + getInitialState() { + return { opened: this.props.items.map(item => item.opened), + created: [] }; + }, componentWillReceiveProps(nextProps) { var newOpened = this.state.opened.map((isOpen, i) => { @@ -41492,7 +85318,7 @@ return /******/ (function(modules) { // webpackBootstrap }); this.setState({ opened: newOpened }); - } + }, handleHeaderClick(i) { var opened = [].concat(_toConsumableArray(this.state.opened)); @@ -41511,7 +85337,7 @@ return /******/ (function(modules) { // webpackBootstrap } this.setState({ opened, created }); - } + }, renderContainer(item, i) { var _state = this.state, @@ -41520,24 +85346,18 @@ return /******/ (function(modules) { // webpackBootstrap var containerClassName = `${item.header.toLowerCase().replace(/\s/g, "-")}-pane`; - return _react.DOM.div({ className: containerClassName, key: i }, _react.DOM.div({ className: "_header", onClick: () => this.handleHeaderClick(i) }, (0, _Svg2.default)("arrow", { className: opened[i] ? "expanded" : "" }), item.header, item.buttons ? _react.DOM.div({ className: "header-buttons" }, item.buttons) : null), created[i] || opened[i] ? _react.DOM.div({ - className: "_content", + return div({ className: containerClassName, key: i }, div({ className: "_header", + onClick: () => this.handleHeaderClick(i) }, Svg("arrow", { className: opened[i] ? "expanded" : "" }), item.header, item.buttons ? dom.div({ className: "header-buttons" }, item.buttons) : null), created[i] || opened[i] ? div({ className: "_content", style: { display: opened[i] ? "block" : "none" } - }, (0, _react.createElement)(item.component, item.componentProps || {})) : null); - } + }, React.createElement(item.component, item.componentProps || {})) : null); + }, render() { - return _react.DOM.div({ className: "accordion" }, this.props.items.map(this.renderContainer)); + return div({ className: "accordion" }, this.props.items.map(this.renderContainer)); } - } + }); - Accordion.displayName = "Accordion"; - - Accordion.propTypes = { - items: _react.PropTypes.array.isRequired - }; - - exports.default = Accordion; + module.exports = Accordion; /***/ }, /* 740 */ @@ -41585,7 +85405,7 @@ return /******/ (function(modules) { // webpackBootstrap var _require = __webpack_require__(22), findDOMNode = _require.findDOMNode; - var _require2 = __webpack_require__(830), + var _require2 = __webpack_require__(28), appinfo = _require2.Services.appinfo; var isMacOS = appinfo.OS === "Darwin"; @@ -41593,27 +85413,27 @@ return /******/ (function(modules) { // webpackBootstrap var COMMANDS = ["resume", "stepOver", "stepIn", "stepOut"]; var KEYS = { - WINNT: { - resume: "F8", - pause: "F8", - stepOver: "F10", - stepIn: "F11", - stepOut: "Shift+F11" + "WINNT": { + "resume": "F8", + "pause": "F8", + "stepOver": "F10", + "stepIn": "F11", + "stepOut": "Shift+F11" }, - Darwin: { - resume: "Cmd+\\", - pause: "Cmd+\\", - stepOver: "Cmd+'", - stepIn: "Cmd+;", - stepOut: "Cmd+Shift+:", - stepOutDisplay: "Cmd+Shift+;" + "Darwin": { + "resume": "Cmd+\\", + "pause": "Cmd+\\", + "stepOver": "Cmd+'", + "stepIn": "Cmd+;", + "stepOut": "Cmd+Shift+:", + "stepOutDisplay": "Cmd+Shift+;" }, - Linux: { - resume: "F8", - pause: "F8", - stepOver: "F10", - stepIn: "Ctrl+F11", - stepOut: "Ctrl+Shift+F11" + "Linux": { + "resume": "F8", + "pause": "F8", + "stepOver": "F10", + "stepIn": "Ctrl+F11", + "stepOut": "Ctrl+Shift+F11" } }; @@ -41643,10 +85463,8 @@ return /******/ (function(modules) { // webpackBootstrap button.style.opacity = "0"; button.style.transform = "scale(1.3)"; setTimeout(() => { - if (button) { - button.style.opacity = "1"; - button.style.transform = "none"; - } + button.style.opacity = "1"; + button.style.transform = "none"; }, 200); } @@ -41664,14 +85482,35 @@ return /******/ (function(modules) { // webpackBootstrap }, (0, _Svg2.default)(type)); } - class CommandBar extends _react.Component { + var CommandBar = (0, _react.createClass)({ + propTypes: { + sources: _react.PropTypes.object, + selectedSource: _react.PropTypes.object, + resume: _react.PropTypes.func, + stepIn: _react.PropTypes.func, + stepOut: _react.PropTypes.func, + stepOver: _react.PropTypes.func, + breakOnNext: _react.PropTypes.func, + pause: _reactImmutableProptypes2.default.map, + pauseOnExceptions: _react.PropTypes.func, + shouldPauseOnExceptions: _react.PropTypes.bool, + shouldIgnoreCaughtExceptions: _react.PropTypes.bool, + isWaitingOnBreak: _react.PropTypes.bool + }, + + contextTypes: { + shortcuts: _react.PropTypes.object + }, + + displayName: "CommandBar", + componentWillUnmount() { var shortcuts = this.context.shortcuts; COMMANDS.forEach(action => shortcuts.off(getKey(action))); if (isMacOS) { COMMANDS.forEach(action => shortcuts.off(getKeyForOS("WINNT", action))); } - } + }, componentDidMount() { var shortcuts = this.context.shortcuts; @@ -41683,18 +85522,16 @@ return /******/ (function(modules) { // webpackBootstrap // as well as the Mac non-Function keys COMMANDS.forEach(action => shortcuts.on(getKeyForOS("WINNT", action), (_, e) => this.handleEvent(e, action))); } - } + }, handleEvent(e, action) { e.preventDefault(); e.stopPropagation(); this.props[action](); - var node = findDOMNode(this); - if (node instanceof HTMLElement) { - handlePressAnimation(node.querySelector(`.${action}`)); - } - } + var button = findDOMNode(this).querySelector(`.${action}`); + handlePressAnimation(button); + }, renderStepButtons() { var isPaused = this.props.pause; @@ -41702,7 +85539,7 @@ return /******/ (function(modules) { // webpackBootstrap var isDisabled = !this.props.pause; return [debugBtn(this.props.stepOver, "stepOver", className, L10N.getFormatStr("stepOverTooltip", formatKey("stepOver")), isDisabled), debugBtn(this.props.stepIn, "stepIn", className, L10N.getFormatStr("stepInTooltip", formatKey("stepIn")), isDisabled), debugBtn(this.props.stepOut, "stepOut", className, L10N.getFormatStr("stepOutTooltip", formatKey("stepOut")), isDisabled)]; - } + }, renderPauseButton() { var _props = this.props, @@ -41720,7 +85557,7 @@ return /******/ (function(modules) { // webpackBootstrap } return debugBtn(breakOnNext, "pause", "active", L10N.getFormatStr("pauseButtonTooltip", formatKey("pause"))); - } + }, /* * The pause on exception button has three states in this order: @@ -41744,33 +85581,12 @@ return /******/ (function(modules) { // webpackBootstrap } return debugBtn(() => pauseOnExceptions(false, false), "pause-exceptions", "all enabled", L10N.getStr("pauseOnExceptions")); - } + }, render() { return _react.DOM.div({ className: "command-bar" }, this.renderPauseButton(), this.renderStepButtons(), this.renderPauseOnExceptions()); } - } - - CommandBar.propTypes = { - sources: _react.PropTypes.object, - selectedSource: _react.PropTypes.object, - resume: _react.PropTypes.func, - stepIn: _react.PropTypes.func, - stepOut: _react.PropTypes.func, - stepOver: _react.PropTypes.func, - breakOnNext: _react.PropTypes.func, - pause: _reactImmutableProptypes2.default.map, - pauseOnExceptions: _react.PropTypes.func, - shouldPauseOnExceptions: _react.PropTypes.bool, - shouldIgnoreCaughtExceptions: _react.PropTypes.bool, - isWaitingOnBreak: _react.PropTypes.bool - }; - - CommandBar.contextTypes = { - shortcuts: _react.PropTypes.object - }; - - CommandBar.displayName = "CommandBar"; + }); exports.default = (0, _reactRedux.connect)(state => { return { @@ -41801,31 +85617,38 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes, + createFactory = React.createFactory; - var _react = __webpack_require__(2); + var _require = __webpack_require__(151), + connect = _require.connect; - var _reactRedux = __webpack_require__(151); + var _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; - var _redux = __webpack_require__(3); + var actions = __webpack_require__(244); - var _actions = __webpack_require__(244); + var _require3 = __webpack_require__(242), + getPaneCollapse = _require3.getPaneCollapse; - var _actions2 = _interopRequireDefault(_actions); + var _require4 = __webpack_require__(389), + formatKeyShortcut = _require4.formatKeyShortcut; - var _selectors = __webpack_require__(242); - - var _text = __webpack_require__(389); + var PaneToggleButton = createFactory(__webpack_require__(428)); __webpack_require__(748); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var WelcomeBox = React.createClass({ + propTypes: { + horizontal: PropTypes.bool, + togglePaneCollapse: PropTypes.func, + endPanelCollapsed: PropTypes.bool + }, - var PaneToggleButton = (0, _react.createFactory)(__webpack_require__(428).default); + displayName: "WelcomeBox", - class WelcomeBox extends _react.Component { renderToggleButton() { if (this.props.horizontal) { return; @@ -41837,25 +85660,17 @@ return /******/ (function(modules) { // webpackBootstrap horizontal: this.props.horizontal, handleClick: this.props.togglePaneCollapse }); - } + }, render() { - var searchLabel = L10N.getFormatStr("welcome.search", (0, _text.formatKeyShortcut)(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`)); - return _react.DOM.div({ className: "welcomebox" }, searchLabel, this.renderToggleButton()); + var searchLabel = L10N.getFormatStr("welcome.search", formatKeyShortcut(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`)); + return dom.div({ className: "welcomebox" }, searchLabel, this.renderToggleButton()); } - } + }); - WelcomeBox.propTypes = { - horizontal: _react.PropTypes.bool, - togglePaneCollapse: _react.PropTypes.func, - endPanelCollapsed: _react.PropTypes.bool - }; - - WelcomeBox.displayName = "WelcomeBox"; - - exports.default = (0, _reactRedux.connect)(state => ({ - endPanelCollapsed: (0, _selectors.getPaneCollapse)(state, "end") - }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(WelcomeBox); + module.exports = connect(state => ({ + endPanelCollapsed: getPaneCollapse(state, "end") + }), dispatch => bindActionCreators(actions, dispatch))(WelcomeBox); /***/ }, /* 748 */ @@ -41870,54 +85685,47 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - 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 _selectors = __webpack_require__(242); - - var _source = __webpack_require__(233); - - var _classnames = __webpack_require__(175); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _actions = __webpack_require__(244); - - var _actions2 = _interopRequireDefault(_actions); - - var _Close = __webpack_require__(378); - - var _Close2 = _interopRequireDefault(_Close); - - var _Svg = __webpack_require__(344); - - var _Svg2 = _interopRequireDefault(_Svg); - - var _devtoolsLaunchpad = __webpack_require__(131); - - var _debounce = __webpack_require__(651); - - var _debounce2 = _interopRequireDefault(_debounce); - - var _text = __webpack_require__(389); - - __webpack_require__(754); - - 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 PaneToggleButton = (0, _react.createFactory)(__webpack_require__(428).default); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; - var Dropdown = (0, _react.createFactory)(__webpack_require__(751).default); + var ImPropTypes = __webpack_require__(150); + var _require = __webpack_require__(151), + connect = _require.connect; + + var _require2 = __webpack_require__(3), + bindActionCreators = _require2.bindActionCreators; + + var _require3 = __webpack_require__(242), + getSelectedSource = _require3.getSelectedSource, + getSourceTabs = _require3.getSourceTabs, + getFileSearchState = _require3.getFileSearchState, + getSourceByURL = _require3.getSourceByURL; + + var _require4 = __webpack_require__(233), + getFilename = _require4.getFilename, + isPretty = _require4.isPretty; + + var classnames = __webpack_require__(175); + var actions = __webpack_require__(244); + var CloseButton = __webpack_require__(378); + var PaneToggleButton = React.createFactory(__webpack_require__(428)); + var Svg = __webpack_require__(344); + var Dropdown = React.createFactory(__webpack_require__(751)); + + var _require5 = __webpack_require__(422), + showMenu = _require5.showMenu, + buildMenu = _require5.buildMenu; + + var debounce = __webpack_require__(651); + + var _require6 = __webpack_require__(389), + formatKeyShortcut = _require6.formatKeyShortcut; + + __webpack_require__(754); /* * Finds the hidden tabs by comparing the tabs' top offset. @@ -41956,51 +85764,50 @@ return /******/ (function(modules) { // webpackBootstrap document.removeEventListener("copy", doCopy); } - class SourceTabs extends _react.Component { + var SourceTabs = React.createClass({ + propTypes: { + sourceTabs: ImPropTypes.list.isRequired, + selectedSource: ImPropTypes.map, + selectSource: PropTypes.func.isRequired, + closeTab: PropTypes.func.isRequired, + closeTabs: PropTypes.func.isRequired, + toggleFileSearch: PropTypes.func.isRequired, + togglePrettyPrint: PropTypes.func.isRequired, + togglePaneCollapse: PropTypes.func.isRequired, + showSource: PropTypes.func.isRequired, + horizontal: PropTypes.bool.isRequired, + startPanelCollapsed: PropTypes.bool.isRequired, + endPanelCollapsed: PropTypes.bool.isRequired + }, - constructor(props) { - super(props); - this.state = { + displayName: "SourceTabs", + + getInitialState() { + return { dropdownShown: false, hiddenSourceTabs: null }; - - this.onTabContextMenu = this.onTabContextMenu.bind(this); - this.showContextMenu = this.showContextMenu.bind(this); - this.updateHiddenSourceTabs = this.updateHiddenSourceTabs.bind(this); - this.toggleSourcesDropdown = this.toggleSourcesDropdown.bind(this); - this.renderDropdownSource = this.renderDropdownSource.bind(this); - this.renderTabs = this.renderTabs.bind(this); - this.renderTab = this.renderTab.bind(this); - this.renderNewButton = this.renderNewButton.bind(this); - this.renderDropDown = this.renderDropdown.bind(this); - this.renderStartPanelToggleButton = this.renderStartPanelToggleButton.bind(this); - this.renderEndPanelToggleButton = this.renderEndPanelToggleButton.bind(this); - - this.onResize = (0, _debounce2.default)(() => { - this.updateHiddenSourceTabs(); - }); - } + }, componentDidUpdate(prevProps) { if (!(prevProps === this.props)) { this.updateHiddenSourceTabs(); } - } + }, componentDidMount() { this.updateHiddenSourceTabs(); window.addEventListener("resize", this.onResize); - } + }, componentWillUnmount() { window.removeEventListener("resize", this.onResize); - } + }, onTabContextMenu(event, tab) { event.preventDefault(); this.showContextMenu(event, tab); - } + }, showContextMenu(e, tab) { var _props = this.props, @@ -42032,7 +85839,7 @@ 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")); - var isPrettySource = (0, _source.isPretty)(sourceTab.toJS()); + var isPrettySource = isPretty(sourceTab.toJS()); var closeTabMenuItem = { id: "node-menu-close-tab", @@ -42093,18 +85900,18 @@ return /******/ (function(modules) { // webpackBootstrap click: () => togglePrettyPrint(sourceTab.get("id")) }; - var items = [{ item: closeTabMenuItem }, { item: closeOtherTabsMenuItem, hidden: () => tabs.size === 1 }, { - item: closeTabsToEndMenuItem, - hidden: () => tabs.some((t, i) => t === tab && tabs.size - 1 === i) - }, { item: closeAllTabsMenuItem }, { item: { type: "separator" } }, { item: copySourceUrl }]; + var items = [{ item: closeTabMenuItem }, { item: closeOtherTabsMenuItem, hidden: () => tabs.size === 1 }, { item: closeTabsToEndMenuItem, hidden: () => tabs.some((t, i) => t === tab && tabs.size - 1 === i) }, { item: closeAllTabsMenuItem }, { item: { type: "separator" } }, { item: copySourceUrl }, { item: showSourceMenuItem }]; if (!isPrettySource) { - items.push({ item: showSourceMenuItem }); items.push({ item: prettyPrint }); } - (0, _devtoolsLaunchpad.showMenu)(e, (0, _devtoolsLaunchpad.buildMenu)(items)); - } + showMenu(e, buildMenu(items)); + }, + + onResize: debounce(function () { + this.updateHiddenSourceTabs(); + }), /* * Updates the hiddenSourceTabs state, by @@ -42114,33 +85921,26 @@ return /******/ (function(modules) { // webpackBootstrap if (!this.refs.sourceTabs) { return; } - var _props2 = this.props, - selectedSource = _props2.selectedSource, - sourceTabs = _props2.sourceTabs, - selectSource = _props2.selectSource; + var sourceTabs = this.props.sourceTabs; var sourceTabEls = this.refs.sourceTabs.children; var hiddenSourceTabs = getHiddenTabs(sourceTabs, sourceTabEls); - if (hiddenSourceTabs.indexOf(selectedSource) !== -1) { - return selectSource(selectedSource.get("id"), { tabIndex: 0 }); - } - this.setState({ hiddenSourceTabs }); - } + }, toggleSourcesDropdown(e) { this.setState({ dropdownShown: !this.state.dropdownShown }); - } + }, renderDropdownSource(source) { var selectSource = this.props.selectSource; - var filename = (0, _source.getFilename)(source.toJS()); + var filename = getFilename(source.toJS()); - return _react.DOM.li({ + return dom.li({ key: source.get("id"), onClick: () => { // const tabIndex = getLastVisibleTabIndex(sourceTabs, sourceTabEls); @@ -42148,62 +85948,62 @@ return /******/ (function(modules) { // webpackBootstrap selectSource(source.get("id"), { tabIndex }); } }, filename); - } + }, renderTabs() { var sourceTabs = this.props.sourceTabs; - return _react.DOM.div({ className: "source-tabs", ref: "sourceTabs" }, sourceTabs.map(this.renderTab)); - } + return dom.div({ className: "source-tabs", ref: "sourceTabs" }, sourceTabs.map(this.renderTab)); + }, renderTab(source) { - var _props3 = this.props, - selectedSource = _props3.selectedSource, - selectSource = _props3.selectSource, - closeTab = _props3.closeTab; + var _props2 = this.props, + selectedSource = _props2.selectedSource, + selectSource = _props2.selectSource, + closeTab = _props2.closeTab; - var filename = (0, _source.getFilename)(source.toJS()); + var filename = getFilename(source.toJS()); var active = selectedSource && source.get("id") == selectedSource.get("id"); - var isPrettyCode = (0, _source.isPretty)(source.toJS()); + var isPrettyCode = isPretty(source.toJS()); function onClickClose(ev) { ev.stopPropagation(); closeTab(source.get("url")); } - return _react.DOM.div({ - className: (0, _classnames2.default)("source-tab", { + return dom.div({ + className: classnames("source-tab", { active, pretty: isPrettyCode }), key: source.get("id"), 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)({ + title: getFilename(source.toJS()) + }, isPrettyCode ? Svg("prettyPrint") : null, dom.div({ className: "filename" }, filename), CloseButton({ handleClick: onClickClose, tooltip: L10N.getStr("sourceTabs.closeTabButtonTooltip") })); - } + }, renderNewButton() { - var newTabTooltip = L10N.getFormatStr("sourceTabs.newTabButtonTooltip", (0, _text.formatKeyShortcut)(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`)); - return _react.DOM.div({ + var newTabTooltip = L10N.getFormatStr("sourceTabs.newTabButtonTooltip", formatKeyShortcut(`CmdOrCtrl+${L10N.getStr("sources.search.key")}`)); + return dom.div({ className: "new-tab-btn", - onClick: () => this.props.toggleProjectSearch(), + onClick: () => this.props.toggleFileSearch(), title: newTabTooltip - }, (0, _Svg2.default)("plus")); - } + }, Svg("plus")); + }, renderDropdown() { var hiddenSourceTabs = this.state.hiddenSourceTabs; if (!hiddenSourceTabs || hiddenSourceTabs.size == 0) { - return _react.DOM.div({}); + return dom.div({}); } return Dropdown({ - panel: _react.DOM.ul({}, hiddenSourceTabs.map(this.renderDropdownSource)) + panel: dom.ul({}, hiddenSourceTabs.map(this.renderDropdownSource)) }); - } + }, renderStartPanelToggleButton() { return PaneToggleButton({ @@ -42211,7 +86011,7 @@ return /******/ (function(modules) { // webpackBootstrap collapsed: !this.props.startPanelCollapsed, handleClick: this.props.togglePaneCollapse }); - } + }, renderEndPanelToggleButton() { if (!this.props.horizontal) { @@ -42224,41 +86024,24 @@ return /******/ (function(modules) { // webpackBootstrap handleClick: this.props.togglePaneCollapse, horizontal: this.props.horizontal }); - } + }, render() { - return _react.DOM.div({ className: "source-header" }, this.renderStartPanelToggleButton(), this.renderTabs(), this.renderNewButton(), this.renderDropdown(), this.renderEndPanelToggleButton()); + return 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)); + return getSourceTabs(state).map(url => getSourceByURL(state, url)); } - module.exports = (0, _reactRedux.connect)(state => { + module.exports = connect(state => { return { - selectedSource: (0, _selectors.getSelectedSource)(state), + selectedSource: getSelectedSource(state), sourceTabs: getTabs(state), - searchOn: (0, _selectors.getProjectSearchState)(state) + searchOn: getFileSearchState(state) }; - }, dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(SourceTabs); + }, dispatch => bindActionCreators(actions, dispatch))(SourceTabs); /***/ }, /* 751 */ @@ -42266,69 +86049,61 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(2); + var React = __webpack_require__(2); + var dom = React.DOM, + PropTypes = React.PropTypes; __webpack_require__(752); - class Dropdown extends _react.Component { + var Dropdown = React.createClass({ + propTypes: { + panel: PropTypes.object + }, - constructor(props) { - super(props); - this.state = { + displayName: "Dropdown", + + getInitialState() { + return { dropdownShown: false }; - - this.toggleDropdown = this.toggleDropdown.bind(this); - this.renderPanel = this.renderPanel.bind(this); - this.renderButton = this.renderButton.bind(this); - this.renderMask = this.renderMask.bind(this); - } + }, toggleDropdown(e) { this.setState({ dropdownShown: !this.state.dropdownShown }); - } + }, renderPanel() { - return _react.DOM.div({ + return dom.div({ className: "dropdown", onClick: this.toggleDropdown, style: { display: this.state.dropdownShown ? "block" : "none" } }, this.props.panel); - } + }, renderButton() { - return _react.DOM.button({ + return dom.button({ className: "dropdown-button", onClick: this.toggleDropdown }, "»"); - } + }, renderMask() { - return _react.DOM.div({ + return dom.div({ className: "dropdown-mask", onClick: this.toggleDropdown, style: { display: this.state.dropdownShown ? "block" : "none" } }); - } + }, render() { - return _react.DOM.div({ className: "dropdown-block" }, this.renderPanel(), this.renderButton(), this.renderMask()); + return dom.div({ className: "dropdown-block" }, this.renderPanel(), this.renderButton(), this.renderMask()); } - } - Dropdown.propTypes = { - panel: _react.PropTypes.object - }; + }); - Dropdown.displayName = "Dropdown"; - - exports.default = Dropdown; + module.exports = Dropdown; /***/ }, /* 752 */ @@ -42345,28773 +86120,98 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 755 */, -/* 756 */, -/* 757 */, -/* 758 */, -/* 759 */, -/* 760 */, -/* 761 */, -/* 762 */, -/* 763 */, -/* 764 */, -/* 765 */, -/* 766 */, -/* 767 */, -/* 768 */, -/* 769 */, -/* 770 */, -/* 771 */, -/* 772 */, -/* 773 */, -/* 774 */, -/* 775 */, -/* 776 */, -/* 777 */, -/* 778 */, -/* 779 */, -/* 780 */, -/* 781 */, -/* 782 */, -/* 783 */, -/* 784 */, -/* 785 */, -/* 786 */, -/* 787 */, -/* 788 */, -/* 789 */, -/* 790 */, -/* 791 */, -/* 792 */, -/* 793 */, -/* 794 */, -/* 795 */, -/* 796 */, -/* 797 */, -/* 798 */, -/* 799 */, -/* 800 */, -/* 801 */, -/* 802 */, -/* 803 */, -/* 804 */, -/* 805 */, -/* 806 */, -/* 807 */, -/* 808 */, -/* 809 */, -/* 810 */, -/* 811 */, -/* 812 */, -/* 813 */, -/* 814 */, -/* 815 */, -/* 816 */, -/* 817 */, -/* 818 */, -/* 819 */, -/* 820 */, -/* 821 */, -/* 822 */, -/* 823 */, -/* 824 */, -/* 825 */, -/* 826 */, -/* 827 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var _require = __webpack_require__(900), - WorkerDispatcher = _require.workerUtils.WorkerDispatcher; - - var dispatcher = new WorkerDispatcher(); - - var getSymbols = dispatcher.task("getSymbols"); - var getVariablesInScope = dispatcher.task("getVariablesInScope"); - var resolveToken = dispatcher.task("resolveToken"); - - module.exports = { - getSymbols, - getVariablesInScope, - resolveToken, - startParserWorker: dispatcher.start.bind(dispatcher), - stopParserWorker: dispatcher.stop.bind(dispatcher) - }; - -/***/ }, -/* 828 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var feature = __webpack_require__(829); - - module.exports = feature; - -/***/ }, -/* 829 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - var pick = __webpack_require__(67); - var put = __webpack_require__(112); - var fs = __webpack_require__(118); - var path = __webpack_require__(119); - - var config = void 0; - - var flag = __webpack_require__(121); - - /** - * Gets a config value for a given key - * e.g "chrome.webSocketPort" - */ - function getValue(key) { - return pick(config, key); - } - - function setValue(key, value) { - return put(config, key, value); - } - - function isEnabled(key) { - return config.features && typeof config.features[key] == "object" ? config.features[key].enabled : config.features[key]; - } - - function isDevelopment() { - if (isFirefoxPanel()) { - // Default to production if compiling for the Firefox panel - return ("production") === "development"; - } - return ("production") !== "production"; - } - - function isTesting() { - return flag.testing; - } - - function isFirefoxPanel() { - return ("firefox-panel") == "firefox-panel"; - } - - function isApplication() { - return ("firefox-panel") == "application"; - } - - function isFirefox() { - return (/firefox/i.test(navigator.userAgent) - ); - } - - function setConfig(value) { - config = value; - } - - function getConfig() { - return config; - } - - 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 "{}"; - } - } - - module.exports = { - isEnabled, - getValue, - setValue, - isDevelopment, - isTesting, - isFirefoxPanel, - isApplication, - isFirefox, - getConfig, - setConfig, - updateLocalConfig - }; - -/***/ }, -/* 830 */ -/***/ function(module, exports, __webpack_require__) { - - "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 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"); - - 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 - }; - -/***/ }, -/* 831 */ +/* 756 */ /***/ function(module, exports) { - "use strict"; - - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/AppConstants.jsm - */ - - module.exports = { AppConstants: {} }; - -/***/ }, -/* 832 */ -/***/ function(module, exports) { - - "use strict"; - - /** - * 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); - } - - module.exports = { copyString }; - -/***/ }, -/* 833 */ -/***/ 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/. */ - - /* 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; - - /** - * 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; - } - }; - - 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; - } - } - - /** - * 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]; - }); - }; - - var _require4 = __webpack_require__(841), - NetUtil = _require4.NetUtil; - - var _require5 = __webpack_require__(842), - TextDecoder = _require5.TextDecoder, - OS = _require5.OS; - - var NetworkHelper = __webpack_require__(843); - - /** - * Performs a request to load the desired URL and returns a promise. - * - * @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/ - */ - 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; - } - - 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); - } - } - }; - - // Open the channel - try { - NetUtil.asyncFetch(channel, onResponse); - } catch (ex) { - return promise.reject(ex); - } - - return deferred.promise; - } - - /** - * Opens a channel for given URL. Tries a bit harder than NetUtil.newChannel. - * - * @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. - */ - 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); - }; - } - - /** - * 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; - } - }); - - /** - * Open the file at the given path for reading. - * - * @param {String} filePath - * - * @returns Promise - */ - 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; - } - 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]"; - }; - -/***/ }, -/* 834 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - /* - * A sham for https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/chrome - */ - - var _require = __webpack_require__(835), - inDOMUtils = _require.inDOMUtils; - - var ourServices = { - inIDOMUtils: inDOMUtils, - 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 - } + "breakpoints.header": "Breakpoints", + "breakpoints.none": "No Breakpoints", + "breakpoints.enable": "Enable Breakpoints", + "breakpoints.disable": "Disable Breakpoints", + "breakpoints.removeBreakpointTooltip": "Remove Breakpoint", + "callStack.header": "Call Stack", + "callStack.notPaused": "Not Paused", + "callStack.collapse": "Collapse Rows", + "callStack.expand": "Expand Rows", + "editor.searchResults": "%d of %d results", + "editor.noResults": "no results", + "editor.addBreakpoint": "Add Breakpoint", + "editor.disableBreakpoint": "Disable Breakpoint", + "editor.enableBreakpoint": "Enable Breakpoint", + "editor.removeBreakpoint": "Remove Breakpoint", + "editor.editBreakpoint": "Edit Breakpoint", + "editor.addConditionalBreakpoint": "Add Conditional Breakpoint", + "editor.conditionalPanel.placeholder": "This breakpoint will pause when the expression is true", + "editor.conditionalPanel.close": "Cancel edit breakpoint and close", + "editor.jumpToMappedLocation1": "Jump to %S location", + "generated": "generated", + "original": "original", + "eventListenersHeader": "Event Listeners", + "expressions.placeholder": "Add Watch Expression", + "scopes.header": "Scopes", + "scopes.notAvailable": "Scopes Unavailable", + "scopes.block": "Block", + "scopes.notPaused": "Not Paused", + "sources.header": "Sources", + "sources.search": "%S to search", + "sources.search.key": "P", + "sources.searchAlt.key": "O", + "watchExpressions.header": "Watch Expressions", + "watchExpressions.refreshButton": "Refresh", + "welcome.search": "%S to search for sources", + "sourceSearch.search": "Search Sources...", + "sourceSearch.search.key": "F", + "sourceSearch.search.placeholder": "Search in file…", + "sourceSearch.search.again.key": "G", + "sourceSearch.resultsSummary1": "%d results", + "sourceSearch.noResults": "No files matching %S found", + "functionSearch.search.placeholder": "Search Functions...", + "functionSearch.search.key": "o", + "sourceFooter.debugBtnTooltip": "Prettify Source", + "ignoreExceptions": "Ignore exceptions. Click to pause on uncaught exceptions", + "pauseOnUncaughtExceptions": "Pause on uncaught exceptions. Click to pause on all exceptions", + "pauseOnExceptions": "Pause on all exceptions. Click to ignore exceptions", + "stepOutTooltip": "Step Out %S", + "stepInTooltip": "Step In %S", + "stepOverTooltip": "Step Over %S", + "resumeButtonTooltip": "Resume %S", + "pausePendingButtonTooltip": "Waiting for next execution", + "pauseButtonTooltip": "Pause %S", + "sourceTabs.closeTab": "Close tab", + "sourceTabs.closeTab.accesskey": "c", + "sourceTabs.closeOtherTabs": "Close others", + "sourceTabs.closeOtherTabs.accesskey": "o", + "sourceTabs.closeTabsToEnd": "Close tabs to the right", + "sourceTabs.closeTabsToEnd.accesskey": "r", + "sourceTabs.closeAllTabs": "Close all tabs", + "sourceTabs.closeAllTabs.accesskey": "a", + "sourceTabs.closeTabButtonTooltip": "Close tab", + "sourceTabs.newTabButtonTooltip": "Search for sources (%S)", + "sourceTabs.revealInTree": "Reveal in Tree", + "sourceTabs.revealInTree.accesskey": "s", + "sourceTabs.copyLink": "Copy Link Address", + "sourceTabs.copyLink.accesskey": "x", + "sourceTabs.prettyPrint": "Pretty Print Source", + "sourceTabs.prettyPrint.accesskey": "z", + "loadingText": "Loading…", + "whyPaused.debuggerStatement": "Paused on debugger statement", + "whyPaused.breakpoint": "Paused on breakpoint", + "whyPaused.exception": "Paused on exception", + "whyPaused.resumeLimit": "Paused while stepping", + "whyPaused.pauseOnDOMEvents": "Paused on event listener", + "whyPaused.breakpointConditionThrown": "Error with conditional breakpoint", + "whyPaused.xhr": "Paused on XMLHttpRequest", + "whyPaused.promiseRejection": "Paused on promise rejection", + "whyPaused.assert": "Paused on assertion", + "whyPaused.debugCommand": "Paused on debugged function", + "whyPaused.other": "Debugger paused", + "collapsePanes": "Collapse panes", + "expandPanes": "Expand panes", + "copySourceUrl": "Copy Source Url", + "copySourceUrl.accesskey": "c" }; -/***/ }, -/* 835 */ -/***/ function(module, exports, __webpack_require__) { - - // A sham for inDOMUtils. - - "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; - - var _require2 = __webpack_require__(837), - cssColors = _require2.cssColors; - - var _require3 = __webpack_require__(838), - cssProperties = _require3.cssProperties; - - var cssRGBMap; - - // 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 - */ - - /** - * 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 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; - -/***/ }, -/* 840 */ -/***/ function(module, exports) { - - /* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/FileUtils.jsm - */ - "use strict"; - -/***/ }, -/* 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(); - - /** - * Helper object for networking stuff. - * - * Most of the following functions have been taken from the Firebug source. They - * have been modified to match the Firefox coding rules. - */ - 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; - } - }, - - /** - * 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; - } - }, - - /** - * 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; - - var isSeekableStream = false; - if (iStream instanceof Ci.nsISeekableStream) { - isSeekableStream = true; - } - - var prevOffset = void 0; - if (isSeekableStream) { - prevOffset = iStream.tell(); - iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); - } - - // Read data from the stream. - var text = this.readAndConvertFromStream(iStream, aCharset); - - // 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; - }, - - /** - * 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); - }, - - /** - * 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; - } - } - - return false; - }, - - /** - * 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 }); - - // 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; - - NetUtil.asyncFetch(channel, (aInputStream, aStatusCode, aRequest) => { - if (!components.isSuccessCode(aStatusCode)) { - aCallback(null); - return; - } - - // 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; - } - - /** - * 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" - */ - - 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; - } - 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; - } - - return info; - }, - - /** - * 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."); - } - - 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]; - } - -/***/ }, -/* 844 */ -/***/ 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/. */ - - /** - * EventEmitter. - */ - - var EventEmitter = function EventEmitter() {}; - module.exports = EventEmitter; - - var _require = __webpack_require__(834), - Cu = _require.Cu; - - var promise = __webpack_require__(839); - - /** - * 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; - } - } - }; - -/***/ }, -/* 845 */ -/***/ 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. - */ - - function saveAs(blob) { - var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; - - 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(); - } - - exports.saveAs = saveAs; - -/***/ }, -/* 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 */ -/***/ 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"; - - /** - * A partial implementation of the MenuItem API provided by electron: - * https://github.com/electron/electron/blob/master/docs/api/menu-item.md. - * - * Missing features: - * - id String - Unique within a single menu. If defined then it can be used - * as a reference to this item by the position attribute. - * - role String - Define the action of the menu item; when specified the - * click property will be ignored - * - sublabel String - * - accelerator Accelerator - * - icon NativeImage - * - position String - This field allows fine-grained definition of the - * specific location within a given menu. - * - * Implemented features: - * @param Object options - * Function click - * Will be called with click(menuItem, browserWindow) when the menu item - * is clicked - * String type - * Can be normal, separator, submenu, checkbox or radio - * String label - * Boolean enabled - * If false, the menu item will be greyed out and unclickable. - * Boolean checked - * Should only be specified for checkbox or radio type menu items. - * Menu submenu - * Should be specified for submenu type menu items. If submenu is specified, - * the type: 'submenu' can be omitted. If the value is not a Menu then it - * will be automatically converted to one using Menu.buildFromTemplate. - * 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, - accesskey = _ref$accesskey === undefined ? null : _ref$accesskey, - _ref$checked = _ref.checked, - checked = _ref$checked === undefined ? false : _ref$checked, - _ref$click = _ref.click, - click = _ref$click === undefined ? () => {} : _ref$click, - _ref$disabled = _ref.disabled, - disabled = _ref$disabled === undefined ? false : _ref$disabled, - _ref$label = _ref.label, - label = _ref$label === undefined ? "" : _ref$label, - _ref$id = _ref.id, - id = _ref$id === undefined ? null : _ref$id, - _ref$submenu = _ref.submenu, - submenu = _ref$submenu === undefined ? null : _ref$submenu, - _ref$type = _ref.type, - type = _ref$type === undefined ? "normal" : _ref$type, - _ref$visible = _ref.visible, - visible = _ref$visible === undefined ? true : _ref$visible; - - this.accesskey = accesskey; - this.checked = checked; - this.click = click; - this.disabled = disabled; - this.id = id; - this.label = label; - this.submenu = submenu; - this.type = type; - this.visible = visible; - } - - 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 */ -/***/ 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 Services = __webpack_require__(29); - var EventEmitter = __webpack_require__(844); - - /** - * Shortcuts for lazily accessing and setting various preferences. - * Usage: - * let prefs = new Prefs("root.path.to.branch", { - * myIntPref: ["Int", "leaf.path.to.my-int-pref"], - * myCharPref: ["Char", "leaf.path.to.my-char-pref"], - * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], - * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] - * ... - * }); - * - * Get/set: - * prefs.myCharPref = "foo"; - * let aux = prefs.myCharPref; - * - * Observe: - * prefs.registerObserver(); - * prefs.on("pref-changed", (prefName, prefValue) => { - * ... - * }); - * - * @param string prefsRoot - * The root path to the required preferences branch. - * @param object prefsBlueprint - * An object containing { accessorName: [prefType, prefName] } keys. - */ - function PrefsHelper() { - var prefsRoot = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; - var prefsBlueprint = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - EventEmitter.decorate(this); - - var cache = new Map(); - - for (var accessorName in prefsBlueprint) { - var _prefsBlueprint$acces = _slicedToArray(prefsBlueprint[accessorName], 2), - prefType = _prefsBlueprint$acces[0], - prefName = _prefsBlueprint$acces[1]; - - map(this, cache, accessorName, prefType, prefsRoot, prefName); - } - - var observer = makeObserver(this, cache, prefsRoot, prefsBlueprint); - this.registerObserver = () => observer.register(); - this.unregisterObserver = () => observer.unregister(); - } - - /** - * Helper method for getting a pref value. - * - * @param Map cache - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @return any - */ - function get(cache, prefType, prefsRoot, prefName) { - var cachedPref = cache.get(prefName); - if (cachedPref !== undefined) { - return cachedPref; - } - var value = Services.prefs["get" + prefType + "Pref"]([prefsRoot, prefName].join(".")); - cache.set(prefName, value); - return value; - } - - /** - * Helper method for setting a pref value. - * - * @param Map cache - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @param any value - */ - function set(cache, prefType, prefsRoot, prefName, value) { - Services.prefs["set" + prefType + "Pref"]([prefsRoot, prefName].join("."), value); - cache.set(prefName, value); - } - - /** - * Maps a property name to a pref, defining lazy getters and setters. - * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" - * type and casting), and "Json" (which is basically just sugar for "Char" - * using the standard JSON serializer). - * - * @param PrefsHelper self - * @param Map cache - * @param string accessorName - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @param array serializer [optional] - */ - function map(self, cache, accessorName, prefType, prefsRoot, prefName) { - var serializer = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : { in: e => e, out: e => e }; - - if (prefName in self) { - throw new Error(`Can't use ${prefName} because it overrides a property` + "on the instance."); - } - if (prefType == "Json") { - map(self, cache, accessorName, "Char", prefsRoot, prefName, { - in: JSON.parse, - out: JSON.stringify - }); - return; - } - if (prefType == "Float") { - map(self, cache, accessorName, "Char", prefsRoot, prefName, { - in: Number.parseFloat, - out: n => n + "" - }); - return; - } - - Object.defineProperty(self, accessorName, { - get: () => serializer.in(get(cache, prefType, prefsRoot, prefName)), - set: e => set(cache, prefType, prefsRoot, prefName, serializer.out(e)) - }); - } - - /** - * Finds the accessor for the provided pref, based on the blueprint object - * used in the constructor. - * - * @param PrefsHelper self - * @param object prefsBlueprint - * @return string - */ - function accessorNameForPref(somePrefName, prefsBlueprint) { - for (var accessorName in prefsBlueprint) { - var _prefsBlueprint$acces2 = _slicedToArray(prefsBlueprint[accessorName], 2), - prefName = _prefsBlueprint$acces2[1]; - - if (somePrefName == prefName) { - return accessorName; - } - } - return ""; - } - - /** - * Creates a pref observer for `self`. - * - * @param PrefsHelper self - * @param Map cache - * @param string prefsRoot - * @param object prefsBlueprint - * @return object - */ - function makeObserver(self, cache, prefsRoot, prefsBlueprint) { - return { - register: function () { - this._branch = Services.prefs.getBranch(prefsRoot + "."); - this._branch.addObserver("", this); - }, - unregister: function () { - this._branch.removeObserver("", this); - }, - observe: function (subject, topic, prefName) { - // If this particular pref isn't handled by the blueprint object, - // even though it's in the specified branch, ignore it. - var accessorName = accessorNameForPref(prefName, prefsBlueprint); - if (!(accessorName in self)) { - return; - } - cache.delete(prefName); - self.emit("pref-changed", accessorName, self[accessorName]); - } - }; - } - - 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 */ -/***/ 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 isOSX = appinfo.OS === "Darwin"; - "use strict"; - - // List of electron keys mapped to DOM API (DOM_VK_*) key code - var ElectronKeysMapping = { - "F1": "DOM_VK_F1", - "F2": "DOM_VK_F2", - "F3": "DOM_VK_F3", - "F4": "DOM_VK_F4", - "F5": "DOM_VK_F5", - "F6": "DOM_VK_F6", - "F7": "DOM_VK_F7", - "F8": "DOM_VK_F8", - "F9": "DOM_VK_F9", - "F10": "DOM_VK_F10", - "F11": "DOM_VK_F11", - "F12": "DOM_VK_F12", - "F13": "DOM_VK_F13", - "F14": "DOM_VK_F14", - "F15": "DOM_VK_F15", - "F16": "DOM_VK_F16", - "F17": "DOM_VK_F17", - "F18": "DOM_VK_F18", - "F19": "DOM_VK_F19", - "F20": "DOM_VK_F20", - "F21": "DOM_VK_F21", - "F22": "DOM_VK_F22", - "F23": "DOM_VK_F23", - "F24": "DOM_VK_F24", - "Space": "DOM_VK_SPACE", - "Backspace": "DOM_VK_BACK_SPACE", - "Delete": "DOM_VK_DELETE", - "Insert": "DOM_VK_INSERT", - "Return": "DOM_VK_RETURN", - "Enter": "DOM_VK_RETURN", - "Up": "DOM_VK_UP", - "Down": "DOM_VK_DOWN", - "Left": "DOM_VK_LEFT", - "Right": "DOM_VK_RIGHT", - "Home": "DOM_VK_HOME", - "End": "DOM_VK_END", - "PageUp": "DOM_VK_PAGE_UP", - "PageDown": "DOM_VK_PAGE_DOWN", - "Escape": "DOM_VK_ESCAPE", - "Esc": "DOM_VK_ESCAPE", - "Tab": "DOM_VK_TAB", - "VolumeUp": "DOM_VK_VOLUME_UP", - "VolumeDown": "DOM_VK_VOLUME_DOWN", - "VolumeMute": "DOM_VK_VOLUME_MUTE", - "PrintScreen": "DOM_VK_PRINTSCREEN" - }; - - /** - * Helper to listen for keyboard events decribed in .properties file. - * - * let shortcuts = new KeyShortcuts({ - * window - * }); - * shortcuts.on("Ctrl+F", event => { - * // `event` is the KeyboardEvent which relates to the key shortcuts - * }); - * - * @param DOMWindow window - * The window object of the document to listen events from. - * @param DOMElement target - * Optional DOM Element on which we should listen events from. - * If omitted, we listen for all events fired on `window`. - */ - function KeyShortcuts(_ref) { - var window = _ref.window, - target = _ref.target; - - this.window = window; - this.target = target || window; - this.keys = new Map(); - this.eventEmitter = new EventEmitter(); - this.target.addEventListener("keydown", this); - } - - /* - * Parse an electron-like key string and return a normalized object which - * allow efficient match on DOM key event. The normalized object matches DOM - * API. - * - * @param DOMWindow window - * Any DOM Window object, just to fetch its `KeyboardEvent` object - * @param String str - * The shortcut string to parse, following this document: - * https://github.com/electron/electron/blob/master/docs/api/accelerator.md - */ - KeyShortcuts.parseElectronKey = function (window, str) { - var modifiers = str.split("+"); - var key = modifiers.pop(); - - var shortcut = { - ctrl: false, - meta: false, - alt: false, - shift: false, - // Set for character keys - key: undefined, - // Set for non-character keys - keyCode: undefined - }; - for (var mod of modifiers) { - if (mod === "Alt") { - shortcut.alt = true; - } else if (["Command", "Cmd"].includes(mod)) { - shortcut.meta = true; - } else if (["CommandOrControl", "CmdOrCtrl"].includes(mod)) { - if (isOSX) { - shortcut.meta = true; - } else { - shortcut.ctrl = true; - } - } else if (["Control", "Ctrl"].includes(mod)) { - shortcut.ctrl = true; - } else if (mod === "Shift") { - shortcut.shift = true; - } else { - console.error("Unsupported modifier:", mod, "from key:", str); - return null; - } - } - - // Plus is a special case. It's a character key and shouldn't be matched - // against a keycode as it is only accessible via Shift/Capslock - if (key === "Plus") { - key = "+"; - } - - if (typeof key === "string" && key.length === 1) { - // Match any single character - shortcut.key = key.toLowerCase(); - } else if (key in ElectronKeysMapping) { - // Maps the others manually to DOM API DOM_VK_* - key = ElectronKeysMapping[key]; - shortcut.keyCode = window.KeyboardEvent[key]; - // Used only to stringify the shortcut - shortcut.keyCodeString = key; - shortcut.key = key; - } else { - console.error("Unsupported key:", key); - return null; - } - - return shortcut; - }; - - KeyShortcuts.stringify = function (shortcut) { - var list = []; - if (shortcut.alt) { - list.push("Alt"); - } - if (shortcut.ctrl) { - list.push("Ctrl"); - } - if (shortcut.meta) { - list.push("Cmd"); - } - if (shortcut.shift) { - list.push("Shift"); - } - var key = void 0; - if (shortcut.key) { - key = shortcut.key.toUpperCase(); - } else { - key = shortcut.keyCodeString; - } - list.push(key); - return list.join("+"); - }; - - KeyShortcuts.prototype = { - destroy() { - this.target.removeEventListener("keydown", this); - this.keys.clear(); - }, - - doesEventMatchShortcut(event, shortcut) { - if (shortcut.meta != event.metaKey) { - return false; - } - if (shortcut.ctrl != event.ctrlKey) { - return false; - } - if (shortcut.alt != event.altKey) { - return false; - } - // Shift is a special modifier, it may implicitely be required if the - // expected key is a special character accessible via shift. - if (shortcut.shift != event.shiftKey && event.key && event.key.match(/[a-zA-Z]/)) { - return false; - } - if (shortcut.keyCode) { - return event.keyCode == shortcut.keyCode; - } else if (event.key in ElectronKeysMapping) { - return ElectronKeysMapping[event.key] === shortcut.key; - } - - // get the key from the keyCode if key is not provided. - var key = event.key || String.fromCharCode(event.keyCode); - - // For character keys, we match if the final character is the expected one. - // But for digits we also accept indirect match to please azerty keyboard, - // which requires Shift to be pressed to get digits. - return key.toLowerCase() == shortcut.key || shortcut.key.match(/^[0-9]$/) && event.keyCode == shortcut.key.charCodeAt(0); - }, - - handleEvent(event) { - for (var _ref2 of this.keys) { - var _ref3 = _slicedToArray(_ref2, 2); - - var key = _ref3[0]; - var shortcut = _ref3[1]; - - if (this.doesEventMatchShortcut(event, shortcut)) { - this.eventEmitter.emit(key, event); - } - } - }, - - on(key, listener) { - if (typeof listener !== "function") { - throw new Error("KeyShortcuts.on() expects a function as " + "second argument"); - } - if (!this.keys.has(key)) { - var shortcut = KeyShortcuts.parseElectronKey(this.window, key); - // The key string is wrong and we were unable to compute the key shortcut - if (!shortcut) { - return; - } - this.keys.set(key, shortcut); - } - this.eventEmitter.on(key, listener); - }, - - off(key, listener) { - this.eventEmitter.off(key, listener); - } - }; - exports.KeyShortcuts = KeyShortcuts; - -/***/ }, -/* 854 */ -/***/ function(module, exports, __webpack_require__) { - - "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; - -/***/ }, -/* 855 */ -/***/ 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. - * - */ - - /* globals window, exports, define */ - - (function (window) { - 'use strict'; - - var re = { - not_string: /[^s]/, - not_bool: /[^t]/, - not_type: /[^T]/, - not_primitive: /[^v]/, - number: /[diefg]/, - numeric_arg: /bcdiefguxX/, - json: /[j]/, - not_json: /[^j]/, - text: /^[^\x25]+/, - modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosStTuvxX])/, - key: /^([a-z_][a-z_\d]*)/i, - key_access: /^\.([a-z_][a-z_\d]*)/i, - index_access: /^\[(\d+)\]/, - sign: /^[\+\-]/ - }; - - function sprintf() { - var key = arguments[0], - cache = sprintf.cache; - if (!(cache[key] && cache.hasOwnProperty(key))) { - cache[key] = sprintf.parse(key); - } - return sprintf.format.call(null, cache[key], arguments); - } - - sprintf.format = function (parse_tree, argv) { - var cursor = 1, - tree_length = parse_tree.length, - node_type = '', - arg, - output = [], - i, - k, - match, - pad, - pad_character, - pad_length, - is_positive = true, - sign = ''; - for (i = 0; i < tree_length; i++) { - node_type = get_type(parse_tree[i]); - if (node_type === 'string') { - output[output.length] = parse_tree[i]; - } else if (node_type === 'array') { - match = parse_tree[i]; // convenience purposes only - if (match[2]) { - // keyword argument - arg = argv[cursor]; - for (k = 0; k < match[2].length; k++) { - if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])); - } - arg = arg[match[2][k]]; - } - } else if (match[1]) { - // positional argument (explicit) - arg = argv[match[1]]; - } else { - // positional argument (implicit) - arg = argv[cursor++]; - } - - if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && get_type(arg) == 'function') { - arg = arg(); - } - - if (re.numeric_arg.test(match[8]) && get_type(arg) != 'number' && isNaN(arg)) { - throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))); - } - - if (re.number.test(match[8])) { - is_positive = arg >= 0; - } - - switch (match[8]) { - case 'b': - arg = parseInt(arg, 10).toString(2); - break; - case 'c': - arg = String.fromCharCode(parseInt(arg, 10)); - break; - case 'd': - case 'i': - arg = parseInt(arg, 10); - break; - case 'j': - arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0); - break; - case 'e': - arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential(); - break; - case 'f': - arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); - break; - case 'g': - arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg); - break; - case 'o': - arg = arg.toString(8); - break; - case 's': - case 'S': - arg = String(arg); - arg = match[7] ? arg.substring(0, match[7]) : arg; - break; - case 't': - arg = String(!!arg); - arg = match[7] ? arg.substring(0, match[7]) : arg; - break; - case 'T': - arg = get_type(arg); - arg = match[7] ? arg.substring(0, match[7]) : arg; - break; - case 'u': - arg = parseInt(arg, 10) >>> 0; - break; - case 'v': - arg = arg.valueOf(); - arg = match[7] ? arg.substring(0, match[7]) : arg; - break; - case 'x': - arg = parseInt(arg, 10).toString(16); - break; - case 'X': - arg = parseInt(arg, 10).toString(16).toUpperCase(); - break; - } - if (re.json.test(match[8])) { - output[output.length] = arg; - } else { - if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? '+' : '-'; - arg = arg.toString().replace(re.sign, ''); - } else { - sign = ''; - } - pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' '; - pad_length = match[6] - (sign + arg).length; - pad = match[6] ? pad_length > 0 ? str_repeat(pad_character, pad_length) : '' : ''; - output[output.length] = match[5] ? sign + arg + pad : pad_character === '0' ? sign + pad + arg : pad + sign + arg; - } - } - } - return output.join(''); - }; - - sprintf.cache = {}; - - sprintf.parse = function (fmt) { - var _fmt = fmt, - match = [], - parse_tree = [], - arg_names = 0; - while (_fmt) { - if ((match = re.text.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = match[0]; - } else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = '%'; - } else if ((match = re.placeholder.exec(_fmt)) !== null) { - if (match[2]) { - arg_names |= 1; - var field_list = [], - replacement_field = match[2], - field_match = []; - if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1]; - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { - if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1]; - } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1]; - } else { - throw new SyntaxError("[sprintf] failed to parse named argument key"); - } - } - } else { - throw new SyntaxError("[sprintf] failed to parse named argument key"); - } - match[2] = field_list; - } else { - arg_names |= 2; - } - if (arg_names === 3) { - throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported"); - } - parse_tree[parse_tree.length] = match; - } else { - throw new SyntaxError("[sprintf] unexpected placeholder"); - } - _fmt = _fmt.substring(match[0].length); - } - return parse_tree; - }; - - var vsprintf = function (fmt, argv, _argv) { - _argv = (argv || []).slice(0); - _argv.splice(0, 0, fmt); - return sprintf.apply(null, _argv); - }; - - /** - * helpers - */ - function get_type(variable) { - if (typeof variable === 'number') { - return 'number'; - } else if (typeof variable === 'string') { - return 'string'; - } else { - return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); - } - } - - var preformattedPadding = { - '0': ['', '0', '00', '000', '0000', '00000', '000000', '0000000'], - ' ': ['', ' ', ' ', ' ', ' ', ' ', ' ', ' '], - '_': ['', '_', '__', '___', '____', '_____', '______', '_______'] - }; - function str_repeat(input, multiplier) { - if (multiplier >= 0 && multiplier <= 7 && preformattedPadding[input]) { - return preformattedPadding[input][multiplier]; - } - return Array(multiplier + 1).join(input); - } - - /** - * export to either browser or node.js - */ - if (true) { - exports.sprintf = sprintf; - exports.vsprintf = vsprintf; - } else { - window.sprintf = sprintf; - window.vsprintf = vsprintf; - - if (typeof define === 'function' && define.amd) { - define(function () { - return { - sprintf: sprintf, - vsprintf: vsprintf - }; - }); - } - } - })(typeof window === 'undefined' ? undefined : window); - -/***/ }, -/* 857 */ -/***/ 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/. */ - - 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 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); - }); - }; - } - - module.exports = { - workerTask - }; - -/***/ }, -/* 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 */ -/***/ 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), - Ci = _require.Ci, - Cu = _require.Cu, - components = _require.components; - - var Services = __webpack_require__(29); - var DevToolsUtils = __webpack_require__(833); - - // 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), - WebConsoleClient = _require2.WebConsoleClient; - /* const { DebuggerSocket } = require("../shared/security/socket");*/ - /* const Authentication = require("../shared/security/auth");*/ - - var noop = () => {}; - - /** - * TODO: Get rid of this API in favor of EventTarget (bug 1042642) - * - * Add simple event notification to a prototype object. Any object that has - * some use for event notifications or the observer pattern in general can be - * augmented with the necessary facilities by passing its prototype to this - * function. - * - * @param aProto object - * The prototype object that will be modified. - */ - function eventSource(aProto) { - /** - * Add a listener to the event source for a given event. - * - * @param aName string - * The event to listen for. - * @param aListener function - * Called when the event is fired. If the same listener - * is added more than once, it will be called once per - * addListener call. - */ - aProto.addListener = function (aName, aListener) { - if (typeof aListener != "function") { - throw TypeError("Listeners must be functions."); - } - - if (!this._listeners) { - this._listeners = {}; - } - - this._getListeners(aName).push(aListener); - }; - - /** - * Add a listener to the event source for a given event. The - * listener will be removed after it is called for the first time. - * - * @param aName string - * The event to listen for. - * @param aListener function - * Called when the event is fired. - */ - aProto.addOneTimeListener = function (aName, aListener) { - var _this = this; - - var l = function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this.removeListener(aName, l); - aListener.apply(null, args); - }; - this.addListener(aName, l); - }; - - /** - * Remove a listener from the event source previously added with - * addListener(). - * - * @param aName string - * The event name used during addListener to add the listener. - * @param aListener function - * The callback to remove. If addListener was called multiple - * times, all instances will be removed. - */ - aProto.removeListener = function (aName, aListener) { - if (!this._listeners || aListener && !this._listeners[aName]) { - return; - } - - if (!aListener) { - this._listeners[aName] = []; - } else { - this._listeners[aName] = this._listeners[aName].filter(function (l) { - return l != aListener; - }); - } - }; - - /** - * Returns the listeners for the specified event name. If none are defined it - * initializes an empty list and returns that. - * - * @param aName string - * The event name. - */ - aProto._getListeners = function (aName) { - if (aName in this._listeners) { - return this._listeners[aName]; - } - this._listeners[aName] = []; - return this._listeners[aName]; - }; - - /** - * Notify listeners of an event. - * - * @param aName string - * The event to fire. - * @param arguments - * All arguments will be passed along to the listeners, - * including the name argument. - */ - aProto.emit = function () { - if (!this._listeners) { - return; - } - - var name = arguments[0]; - var listeners = this._getListeners(name).slice(0); - - for (var listener of listeners) { - try { - listener.apply(null, arguments); - } catch (e) { - // Prevent a bad listener from interfering with the others. - DevToolsUtils.reportException(`notify event '${name}'`, e); - } - } - }; - } - - /** - * Set of protocol messages that affect thread state, and the - * state the actor is in after each message. - */ - var ThreadStateTypes = { - "paused": "paused", - "resumed": "attached", - "detached": "detached" - }; - - /** - * Set of protocol messages that are sent by the server without a prior request - * 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" - }; - - /** - * Set of pause types that are sent by the server and not as an immediate - * response to a client request. - */ - var UnsolicitedPauses = { - "resumeLimit": "resumeLimit", - "debuggerStatement": "debuggerStatement", - "breakpoint": "breakpoint", - "DOMEvent": "DOMEvent", - "watchpoint": "watchpoint", - "exception": "exception" - }; - - /** - * Creates a client for the remote debugging protocol server. This client - * provides the means to communicate with the server and exchange the messages - * required by the protocol in a traditional JavaScript API. - */ - var DebuggerClient = exports.DebuggerClient = function (aTransport) { - this._transport = aTransport; - this._transport.hooks = this; - - // Map actor ID to client instance for each actor type. - this._clients = new Map(); - - this._pendingRequests = new Map(); - this._activeRequests = new Map(); - this._eventsEnabled = true; - - this.traits = {}; - - this.request = this.request.bind(this); - this.localTransport = this._transport.onOutputStreamReady === undefined; - - /* - * As the first thing on the connection, expect a greeting packet from - * the connection's root actor. - */ - this.mainRoot = null; - this.expectReply("root", aPacket => { - this.mainRoot = new RootClient(this, aPacket); - this.emit("connected", aPacket.applicationType, aPacket.traits); - }); - }; - - /** - * A declarative helper for defining methods that send requests to the server. - * - * @param aPacketSkeleton - * The form of the packet to send. Can specify fields to be filled from - * the parameters by using the |args| function. - * @param telemetry - * The unique suffix of the telemetry histogram id. - * @param before - * The function to call before sending the packet. Is passed the packet, - * and the return value is used as the new packet. The |this| context is - * the instance of the client object we are defining a method for. - * @param after - * The function to call after the response is received. It is passed the - * response, and the return value is considered the new response that - * will be passed to the callback. The |this| context is the instance of - * the client object we are defining a method for. - * @return Request - * The `Request` object that is a Promise object and resolves once - * we receive the response. (See request method for more details) - */ - DebuggerClient.requester = function (aPacketSkeleton) { - var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var telemetry = config.telemetry, - before = config.before, - after = config.after; - - return DevToolsUtils.makeInfallible(function () { - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var histogram = void 0, - startTime = void 0; - 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 = { - to: aPacketSkeleton.to || this.actor - }; - - var maxPosition = -1; - for (var k of Object.keys(aPacketSkeleton)) { - if (aPacketSkeleton[k] instanceof DebuggerClient.Argument) { - var position = aPacketSkeleton[k].position; - - outgoingPacket[k] = aPacketSkeleton[k].getArgument(args); - maxPosition = Math.max(position, maxPosition); - } else { - outgoingPacket[k] = aPacketSkeleton[k]; - } - } - - if (before) { - outgoingPacket = before.call(this, outgoingPacket); - } - - return this.request(outgoingPacket, DevToolsUtils.makeInfallible(aResponse => { - if (after) { - var _aResponse = aResponse, - from = _aResponse.from; - - aResponse = after.call(this, aResponse); - if (!aResponse.from) { - aResponse.from = from; - } - } - - // The callback is always the last parameter. - var thisCallback = args[maxPosition + 1]; - if (thisCallback) { - thisCallback(aResponse); - } - - if (histogram) { - histogram.add(+new Date() - startTime); - } - }, "DebuggerClient.requester request callback")); - }, "DebuggerClient.requester"); - }; - - function args(aPos) { - return new DebuggerClient.Argument(aPos); - } - - DebuggerClient.Argument = function (aPosition) { - this.position = aPosition; - }; - - DebuggerClient.Argument.prototype.getArgument = function (aParams) { - if (!(this.position in aParams)) { - throw new Error(`Bad index into params: ${this.position}`); - } - return aParams[this.position]; - }; - - // Expose these to save callers the trouble of importing DebuggerSocket - DebuggerClient.socketConnect = function (options) { - // Defined here instead of just copying the function to allow lazy-load - return DebuggerSocket.connect(options); - }; - DevToolsUtils.defineLazyGetter(DebuggerClient, "Authenticators", () => { - return Authentication.Authenticators; - }); - DevToolsUtils.defineLazyGetter(DebuggerClient, "AuthenticationResult", () => { - return Authentication.AuthenticationResult; - }); - - DebuggerClient.prototype = { - /** - * Connect to the server and start exchanging protocol messages. - * - * @param aOnConnected function - * If specified, will be called when the greeting packet is - * received from the debugging server. - * - * @return Promise - * Resolves once connected with an array whose first element - * is the application type, by default "browser", and the second - * element is the traits object (help figure out the features - * and behaviors of the server we connect to. See RootActor). - */ - connect: function (aOnConnected) { - return Promise.race([new Promise((resolve, reject) => { - this.emit("connect"); - - // Also emit the event on the |DebuggerClient| object (not on the instance), - // so it's possible to track all instances. - events.emit(DebuggerClient, "connect", this); - - this.addOneTimeListener("connected", (aName, aApplicationType, aTraits) => { - this.traits = aTraits; - if (aOnConnected) { - aOnConnected(aApplicationType, aTraits); - } - resolve([aApplicationType, aTraits]); - }); - - this._transport.ready(); - }), new Promise((resolve, reject) => { - setTimeout(() => reject(new Error("Connect timeout error")), 6000); - })]); - }, - - /** - * Shut down communication with the debugging server. - * - * @param aOnClosed function - * If specified, will be called when the debugging connection - * has been closed. - */ - close: function (aOnClosed) { - // Disable detach event notifications, because event handlers will be in a - // cleared scope by the time they run. - this._eventsEnabled = false; - - var cleanup = () => { - this._transport.close(); - this._transport = null; - }; - - // If the connection is already closed, - // there is no need to detach client - // as we won't be able to send any message. - if (this._closed) { - cleanup(); - if (aOnClosed) { - aOnClosed(); - } - return; - } - - if (aOnClosed) { - this.addOneTimeListener("closed", function (aEvent) { - aOnClosed(); - }); - } - - // Call each client's `detach` method by calling - // lastly registered ones first to give a chance - // to detach child clients first. - var clients = [].concat(_toConsumableArray(this._clients.values())); - this._clients.clear(); - var detachClients = () => { - var client = clients.pop(); - if (!client) { - // All clients detached. - cleanup(); - return; - } - if (client.detach) { - client.detach(detachClients); - return; - } - detachClients(); - }; - detachClients(); - }, - - /* - * This function exists only to preserve DebuggerClient's interface; - * new code should say 'client.mainRoot.listTabs()'. - */ - listTabs: function (aOnResponse) { - return this.mainRoot.listTabs(aOnResponse); - }, - - /* - * This function exists only to preserve DebuggerClient's interface; - * new code should say 'client.mainRoot.listAddons()'. - */ - listAddons: function (aOnResponse) { - return this.mainRoot.listAddons(aOnResponse); - }, - - getTab: function (aFilter) { - return this.mainRoot.getTab(aFilter); - }, - - /** - * Attach to a tab actor. - * - * @param string aTabActor - * The actor ID for the tab to attach. - * @param function aOnResponse - * Called with the response packet and a TabClient - * (which will be undefined on error). - */ - attachTab: function (aTabActor) { - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - if (this._clients.has(aTabActor)) { - var cachedTab = this._clients.get(aTabActor); - var cachedResponse = { - cacheDisabled: cachedTab.cacheDisabled, - javascriptEnabled: cachedTab.javascriptEnabled, - traits: cachedTab.traits - }; - DevToolsUtils.executeSoon(() => aOnResponse(cachedResponse, cachedTab)); - return promise.resolve([cachedResponse, cachedTab]); - } - - var packet = { - to: aTabActor, - type: "attach" - }; - return this.request(packet).then(aResponse => { - var tabClient = void 0; - if (!aResponse.error) { - tabClient = new TabClient(this, aResponse); - this.registerClient(tabClient); - } - aOnResponse(aResponse, tabClient); - return [aResponse, tabClient]; - }); - }, - - attachWorker: function DC_attachWorker(aWorkerActor) { - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - var workerClient = this._clients.get(aWorkerActor); - if (workerClient !== undefined) { - var response = { - from: workerClient.actor, - type: "attached", - url: workerClient.url - }; - DevToolsUtils.executeSoon(() => aOnResponse(response, workerClient)); - return promise.resolve([response, workerClient]); - } - - return this.request({ to: aWorkerActor, type: "attach" }).then(aResponse => { - if (aResponse.error) { - aOnResponse(aResponse, null); - return [aResponse, null]; - } - - var workerClient = new WorkerClient(this, aResponse); - this.registerClient(workerClient); - aOnResponse(aResponse, workerClient); - return [aResponse, workerClient]; - }); - }, - - /** - * Attach to an addon actor. - * - * @param string aAddonActor - * The actor ID for the addon to attach. - * @param function aOnResponse - * Called with the response packet and a AddonClient - * (which will be undefined on error). - */ - attachAddon: function DC_attachAddon(aAddonActor) { - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - var packet = { - to: aAddonActor, - type: "attach" - }; - return this.request(packet).then(aResponse => { - var addonClient = void 0; - if (!aResponse.error) { - addonClient = new AddonClient(this, aAddonActor); - this.registerClient(addonClient); - this.activeAddon = addonClient; - } - aOnResponse(aResponse, addonClient); - return [aResponse, addonClient]; - }); - }, - - /** - * Attach to a Web Console actor. - * - * @param string aConsoleActor - * The ID for the console actor to attach to. - * @param array aListeners - * The console listeners you want to start. - * @param function aOnResponse - * Called with the response packet and a WebConsoleClient - * instance (which will be undefined on error). - */ - attachConsole: function (aConsoleActor, aListeners) { - var aOnResponse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; - - var packet = { - to: aConsoleActor, - type: "startListeners", - listeners: aListeners - }; - - return this.request(packet).then(aResponse => { - var consoleClient = void 0; - if (!aResponse.error) { - if (this._clients.has(aConsoleActor)) { - consoleClient = this._clients.get(aConsoleActor); - } else { - consoleClient = new WebConsoleClient(this, aResponse, LongStringClient); - this.registerClient(consoleClient); - } - } - aOnResponse(aResponse, consoleClient); - return [aResponse, consoleClient]; - }); - }, - - /** - * Attach to a global-scoped thread actor for chrome debugging. - * - * @param string aThreadActor - * The actor ID for the thread to attach. - * @param function aOnResponse - * Called with the response packet and a ThreadClient - * (which will be undefined on error). - * @param object aOptions - * Configuration options. - * - useSourceMaps: whether to use source maps or not. - */ - attachThread: function (aThreadActor) { - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - var aOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (this._clients.has(aThreadActor)) { - var client = this._clients.get(aThreadActor); - DevToolsUtils.executeSoon(() => aOnResponse({}, client)); - return promise.resolve([{}, client]); - } - - var packet = { - to: aThreadActor, - type: "attach", - options: aOptions - }; - return this.request(packet).then(aResponse => { - if (!aResponse.error) { - var threadClient = new ThreadClient(this, aThreadActor); - this.registerClient(threadClient); - } - aOnResponse(aResponse, threadClient); - return [aResponse, threadClient]; - }); - }, - - /** - * Attach to a trace actor. - * - * @param string aTraceActor - * The actor ID for the tracer to attach. - * @param function aOnResponse - * Called with the response packet and a TraceClient - * (which will be undefined on error). - */ - attachTracer: function (aTraceActor) { - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - if (this._clients.has(aTraceActor)) { - var client = this._clients.get(aTraceActor); - DevToolsUtils.executeSoon(() => aOnResponse({}, client)); - return promise.resolve([{}, client]); - } - - var packet = { - to: aTraceActor, - type: "attach" - }; - return this.request(packet).then(aResponse => { - if (!aResponse.error) { - var traceClient = new TraceClient(this, aTraceActor); - this.registerClient(traceClient); - } - aOnResponse(aResponse, traceClient); - return [aResponse, traceClient]; - }); - }, - - /** - * Fetch the ChromeActor for the main process or ChildProcessActor for a - * a given child process ID. - * - * @param number aId - * The ID for the process to attach (returned by `listProcesses`). - * Connected to the main process if omitted, or is 0. - */ - getProcess: function (aId) { - var packet = { - to: "root", - type: "getProcess" - }; - if (typeof aId == "number") { - packet.id = aId; - } - return this.request(packet); - }, - - /** - * Release an object actor. - * - * @param string aActor - * The actor ID to send the request to. - * @param aOnResponse function - * If specified, will be called with the response packet when - * debugging server responds. - */ - release: DebuggerClient.requester({ - to: args(0), - type: "release" - }, { - telemetry: "RELEASE" - }), - - /** - * Send a request to the debugging server. - * - * @param aRequest object - * A JSON packet to send to the debugging server. - * @param aOnResponse function - * If specified, will be called with the JSON response packet when - * debugging server responds. - * @return Request - * This object emits a number of events to allow you to respond to - * different parts of the request lifecycle. - * It is also a Promise object, with a `then` method, that is resolved - * whenever a JSON or a Bulk response is received; and is rejected - * if the response is an error. - * Note: This return value can be ignored if you are using JSON alone, - * because the callback provided in |aOnResponse| will be bound to the - * "json-reply" event automatically. - * - * Events emitted: - * * json-reply: The server replied with a JSON packet, which is - * passed as event data. - * * bulk-reply: The server replied with bulk data, which you can read - * using the event data object containing: - * * actor: Name of actor that received the packet - * * type: Name of actor's method that was called on receipt - * * length: Size of the data to be read - * * stream: This input stream should only be used directly if you - * can ensure that you will read exactly |length| bytes - * and will not close the stream when reading is complete - * * done: If you use the stream directly (instead of |copyTo| - * below), you must signal completion by resolving / - * rejecting this deferred. If it's rejected, the - * transport will be closed. If an Error is supplied as a - * rejection value, it will be logged via |dumpn|. If you - * do use |copyTo|, resolving is taken care of for you - * when copying completes. - * * copyTo: A helper function for getting your data out of the - * stream that meets the stream handling requirements - * above, and has the following signature: - * @param output nsIAsyncOutputStream - * The stream to copy to. - * @return Promise - * The promise is resolved when copying completes or - * rejected if any (unexpected) errors occur. - * This object also emits "progress" events for each chunk - * that is copied. See stream-utils.js. - */ - request: function (aRequest, aOnResponse) { - if (!this.mainRoot) { - throw Error("Have not yet received a hello packet from the server."); - } - var type = aRequest.type || ""; - if (!aRequest.to) { - throw Error(`'${type}' request packet has no destination.`); - } - if (this._closed) { - var msg = `'${type}' request packet to ` + `'${aRequest.to}' ` + "can't be sent as the connection is closed."; - var resp = { error: "connectionClosed", message: msg }; - if (aOnResponse) { - aOnResponse(resp); - } - return promise.reject(resp); - } - - var request = new Request(aRequest); - request.format = "json"; - request.stack = components.stack; - if (aOnResponse) { - request.on("json-reply", aOnResponse); - } - - this._sendOrQueueRequest(request); - - // Implement a Promise like API on the returned object - // that resolves/rejects on request response - var deferred = promise.defer(); - function listenerJson(resp) { - request.off("json-reply", listenerJson); - request.off("bulk-reply", listenerBulk); - if (resp.error) { - deferred.reject(resp); - } else { - deferred.resolve(resp); - } - } - function listenerBulk(resp) { - request.off("json-reply", listenerJson); - request.off("bulk-reply", listenerBulk); - deferred.resolve(resp); - } - request.on("json-reply", listenerJson); - request.on("bulk-reply", listenerBulk); - request.then = deferred.promise.then.bind(deferred.promise); - - return request; - }, - - /** - * Transmit streaming data via a bulk request. - * - * This method initiates the bulk send process by queuing up the header data. - * The caller receives eventual access to a stream for writing. - * - * Since this opens up more options for how the server might respond (it could - * send back either JSON or bulk data), and the returned Request object emits - * events for different stages of the request process that you may want to - * react to. - * - * @param request Object - * This is modeled after the format of JSON packets above, but does not - * actually contain the data, but is instead just a routing header: - * * actor: Name of actor that will receive the packet - * * type: Name of actor's method that should be called on receipt - * * length: Size of the data to be sent - * @return Request - * This object emits a number of events to allow you to respond to - * different parts of the request lifecycle. - * - * Events emitted: - * * bulk-send-ready: Ready to send bulk data to the server, using the - * event data object containing: - * * stream: This output stream should only be used directly if - * you can ensure that you will write exactly |length| - * bytes and will not close the stream when writing is - * complete - * * done: If you use the stream directly (instead of |copyFrom| - * below), you must signal completion by resolving / - * rejecting this deferred. If it's rejected, the - * transport will be closed. If an Error is supplied as - * a rejection value, it will be logged via |dumpn|. If - * you do use |copyFrom|, resolving is taken care of for - * you when copying completes. - * * copyFrom: A helper function for getting your data onto the - * stream that meets the stream handling requirements - * above, and has the following signature: - * @param input nsIAsyncInputStream - * The stream to copy from. - * @return Promise - * The promise is resolved when copying completes or - * rejected if any (unexpected) errors occur. - * This object also emits "progress" events for each chunk - * that is copied. See stream-utils.js. - * * json-reply: The server replied with a JSON packet, which is - * passed as event data. - * * bulk-reply: The server replied with bulk data, which you can read - * using the event data object containing: - * * actor: Name of actor that received the packet - * * type: Name of actor's method that was called on receipt - * * length: Size of the data to be read - * * stream: This input stream should only be used directly if you - * can ensure that you will read exactly |length| bytes - * and will not close the stream when reading is complete - * * done: If you use the stream directly (instead of |copyTo| - * below), you must signal completion by resolving / - * rejecting this deferred. If it's rejected, the - * transport will be closed. If an Error is supplied as a - * rejection value, it will be logged via |dumpn|. If you - * do use |copyTo|, resolving is taken care of for you - * when copying completes. - * * copyTo: A helper function for getting your data out of the - * stream that meets the stream handling requirements - * above, and has the following signature: - * @param output nsIAsyncOutputStream - * The stream to copy to. - * @return Promise - * The promise is resolved when copying completes or - * rejected if any (unexpected) errors occur. - * This object also emits "progress" events for each chunk - * that is copied. See stream-utils.js. - */ - startBulkRequest: function (request) { - if (!this.traits.bulk) { - throw Error("Server doesn't support bulk transfers"); - } - if (!this.mainRoot) { - throw Error("Have not yet received a hello packet from the server."); - } - if (!request.type) { - throw Error("Bulk packet is missing the required 'type' field."); - } - if (!request.actor) { - throw Error(`'${request.type}' bulk packet has no destination.`); - } - if (!request.length) { - throw Error(`'${request.type}' bulk packet has no length.`); - } - - request = new Request(request); - request.format = "bulk"; - - this._sendOrQueueRequest(request); - - return request; - }, - - /** - * If a new request can be sent immediately, do so. Otherwise, queue it. - */ - _sendOrQueueRequest(request) { - var actor = request.actor; - if (!this._activeRequests.has(actor)) { - this._sendRequest(request); - } else { - this._queueRequest(request); - } - }, - - /** - * Send a request. - * @throws Error if there is already an active request in flight for the same - * actor. - */ - _sendRequest(request) { - var actor = request.actor; - this.expectReply(actor, request); - - if (request.format === "json") { - this._transport.send(request.request); - return false; - } - - this._transport.startBulkSend(request.request).then(function () { - for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - request.emit.apply(request, ["bulk-send-ready"].concat(args)); - }); - }, - - /** - * Queue a request to be sent later. Queues are only drained when an in - * flight request to a given actor completes. - */ - _queueRequest(request) { - var actor = request.actor; - var queue = this._pendingRequests.get(actor) || []; - queue.push(request); - this._pendingRequests.set(actor, queue); - }, - - /** - * Attempt the next request to a given actor (if any). - */ - _attemptNextRequest(actor) { - if (this._activeRequests.has(actor)) { - return; - } - var queue = this._pendingRequests.get(actor); - if (!queue) { - return; - } - var request = queue.shift(); - if (queue.length === 0) { - this._pendingRequests.delete(actor); - } - this._sendRequest(request); - }, - - /** - * Arrange to hand the next reply from |aActor| to the handler bound to - * |aRequest|. - * - * DebuggerClient.prototype.request / startBulkRequest usually takes care of - * establishing the handler for a given request, but in rare cases (well, - * greetings from new root actors, is the only case at the moment) we must be - * prepared for a "reply" that doesn't correspond to any request we sent. - */ - expectReply: function (aActor, aRequest) { - if (this._activeRequests.has(aActor)) { - throw Error(`clashing handlers for next reply from ${uneval(aActor)}`); - } - - // If a handler is passed directly (as it is with the handler for the root - // actor greeting), create a dummy request to bind this to. - if (typeof aRequest === "function") { - var handler = aRequest; - aRequest = new Request(); - aRequest.on("json-reply", handler); - } - - this._activeRequests.set(aActor, aRequest); - }, - - // Transport hooks. - - /** - * Called by DebuggerTransport to dispatch incoming packets as appropriate. - * - * @param aPacket object - * The incoming packet. - */ - onPacket: function (aPacket) { - if (!aPacket.from) { - DevToolsUtils.reportException("onPacket", new Error(`Server did not specify an actor, dropping packet: ${JSON.stringify(aPacket)}`)); - return; - } - - // If we have a registered Front for this actor, let it handle the packet - // and skip all the rest of this unpleasantness. - var front = this.getActor(aPacket.from); - if (front) { - front.onPacket(aPacket); - return; - } - - if (this._clients.has(aPacket.from) && aPacket.type) { - var client = this._clients.get(aPacket.from); - var type = aPacket.type; - if (client.events.indexOf(type) != -1) { - client.emit(type, aPacket); - // we ignore the rest, as the client is expected to handle this packet. - return; - } - } - - var activeRequest = void 0; - // See if we have a handler function waiting for a reply from this - // actor. (Don't count unsolicited notifications or pauses as - // replies.) - if (this._activeRequests.has(aPacket.from) && !(aPacket.type in UnsolicitedNotifications) && !(aPacket.type == ThreadStateTypes.paused && aPacket.why.type in UnsolicitedPauses)) { - activeRequest = this._activeRequests.get(aPacket.from); - this._activeRequests.delete(aPacket.from); - } - - // If there is a subsequent request for the same actor, hand it off to the - // transport. Delivery of packets on the other end is always async, even - // in the local transport case. - this._attemptNextRequest(aPacket.from); - - // Packets that indicate thread state changes get special treatment. - if (aPacket.type in ThreadStateTypes && this._clients.has(aPacket.from) && typeof this._clients.get(aPacket.from)._onThreadState == "function") { - this._clients.get(aPacket.from)._onThreadState(aPacket); - } - - // TODO: Bug 1151156 - Remove once Gecko 40 is on b2g-stable. - if (!this.traits.noNeedToFakeResumptionOnNavigation) { - // On navigation the server resumes, so the client must resume as well. - // We achieve that by generating a fake resumption packet that triggers - // the client's thread state change listeners. - if (aPacket.type == UnsolicitedNotifications.tabNavigated && this._clients.has(aPacket.from) && this._clients.get(aPacket.from).thread) { - var thread = this._clients.get(aPacket.from).thread; - var resumption = { from: thread._actor, type: "resumed" }; - thread._onThreadState(resumption); - } - } - - // Only try to notify listeners on events, not responses to requests - // that lack a packet type. - if (aPacket.type) { - this.emit(aPacket.type, aPacket); - } - - if (activeRequest) { - var emitReply = () => activeRequest.emit("json-reply", aPacket); - if (activeRequest.stack) { - Cu.callFunctionWithAsyncStack(emitReply, activeRequest.stack, "DevTools RDP"); - } else { - emitReply(); - } - } - }, - - /** - * Called by the DebuggerTransport to dispatch incoming bulk packets as - * appropriate. - * - * @param packet object - * The incoming packet, which contains: - * * actor: Name of actor that will receive the packet - * * type: Name of actor's method that should be called on receipt - * * length: Size of the data to be read - * * stream: This input stream should only be used directly if you can - * ensure that you will read exactly |length| bytes and will - * not close the stream when reading is complete - * * done: If you use the stream directly (instead of |copyTo| - * below), you must signal completion by resolving / - * rejecting this deferred. If it's rejected, the transport - * will be closed. If an Error is supplied as a rejection - * value, it will be logged via |dumpn|. If you do use - * |copyTo|, resolving is taken care of for you when copying - * completes. - * * copyTo: A helper function for getting your data out of the stream - * that meets the stream handling requirements above, and has - * the following signature: - * @param output nsIAsyncOutputStream - * The stream to copy to. - * @return Promise - * The promise is resolved when copying completes or rejected - * if any (unexpected) errors occur. - * This object also emits "progress" events for each chunk - * that is copied. See stream-utils.js. - */ - onBulkPacket: function (packet) { - var actor = packet.actor, - type = packet.type, - length = packet.length; - - - if (!actor) { - DevToolsUtils.reportException("onBulkPacket", new Error(`Server did not specify an actor, dropping bulk packet: ${JSON.stringify(packet)}`)); - return; - } - - // See if we have a handler function waiting for a reply from this - // actor. - if (!this._activeRequests.has(actor)) { - return; - } - - var activeRequest = this._activeRequests.get(actor); - this._activeRequests.delete(actor); - - // If there is a subsequent request for the same actor, hand it off to the - // transport. Delivery of packets on the other end is always async, even - // in the local transport case. - this._attemptNextRequest(actor); - - activeRequest.emit("bulk-reply", packet); - }, - - /** - * Called by DebuggerTransport when the underlying stream is closed. - * - * @param aStatus nsresult - * The status code that corresponds to the reason for closing - * the stream. - */ - onClosed: function (aStatus) { - this._closed = true; - this.emit("closed"); - - // Reject all pending and active requests - var reject = function (type, request, actor) { - // Server can send packets on its own and client only pass a callback - // to expectReply, so that there is no request object. - var msg = void 0; - if (request.request) { - msg = `'${request.request.type}' ${type} request packet` + ` to '${actor}' ` + "can't be sent as the connection just closed."; - } else { - msg = `server side packet from '${actor}' can't be received ` + "as the connection just closed."; - } - var packet = { error: "connectionClosed", message: msg }; - request.emit("json-reply", packet); - }; - - var pendingRequests = new Map(this._pendingRequests); - this._pendingRequests.clear(); - pendingRequests.forEach((list, actor) => { - list.forEach(request => reject("pending", request, actor)); - }); - var activeRequests = new Map(this._activeRequests); - this._activeRequests.clear(); - activeRequests.forEach(reject.bind(null, "active")); - - // The |_pools| array on the client-side currently is used only by - // protocol.js to store active fronts, mirroring the actor pools found in - // the server. So, read all usages of "pool" as "protocol.js front". - // - // In the normal case where we shutdown cleanly, the toolbox tells each tool - // to close, and they each call |destroy| on any fronts they were using. - // When |destroy| or |cleanup| is called on a protocol.js front, it also - // removes itself from the |_pools| array. Once the toolbox has shutdown, - // the connection is closed, and we reach here. All fronts (should have - // been) |destroy|ed, so |_pools| should empty. - // - // If the connection instead aborts unexpectedly, we may end up here with - // all fronts used during the life of the connection. So, we call |cleanup| - // on them clear their state, reject pending requests, and remove themselves - // from |_pools|. This saves the toolbox from hanging indefinitely, in case - // it waits for some server response before shutdown that will now never - // arrive. - for (var pool of this._pools) { - pool.cleanup(); - } - }, - - registerClient: function (client) { - var actorID = client.actor; - if (!actorID) { - throw new Error("DebuggerServer.registerClient expects " + "a client instance with an `actor` attribute."); - } - if (!Array.isArray(client.events)) { - throw new Error("DebuggerServer.registerClient expects " + "a client instance with an `events` attribute " + "that is an array."); - } - if (client.events.length > 0 && typeof client.emit != "function") { - throw new Error("DebuggerServer.registerClient expects " + "a client instance with non-empty `events` array to" + "have an `emit` function."); - } - if (this._clients.has(actorID)) { - throw new Error("DebuggerServer.registerClient already registered " + "a client for this actor."); - } - this._clients.set(actorID, client); - }, - - unregisterClient: function (client) { - var actorID = client.actor; - if (!actorID) { - throw new Error("DebuggerServer.unregisterClient expects " + "a Client instance with a `actor` attribute."); - } - this._clients.delete(actorID); - }, - - /** - * Actor lifetime management, echos the server's actor pools. - */ - __pools: null, - get _pools() { - if (this.__pools) { - return this.__pools; - } - this.__pools = new Set(); - return this.__pools; - }, - - addActorPool: function (pool) { - this._pools.add(pool); - }, - removeActorPool: function (pool) { - this._pools.delete(pool); - }, - getActor: function (actorID) { - var pool = this.poolFor(actorID); - return pool ? pool.get(actorID) : null; - }, - - poolFor: function (actorID) { - for (var pool of this._pools) { - if (pool.has(actorID)) { - return pool; - } - } - return null; - }, - - /** - * Currently attached addon. - */ - activeAddon: null - }; - - eventSource(DebuggerClient.prototype); - - function Request(request) { - this.request = request; - } - - Request.prototype = { - - on: function (type, listener) { - events.on(this, type, listener); - }, - - off: function (type, listener) { - events.off(this, type, listener); - }, - - once: function (type, listener) { - events.once(this, type, listener); - }, - - emit: function (type) { - for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - - events.emit.apply(events, [this, type].concat(args)); - }, - - get actor() { - return this.request.to || this.request.actor; - } - - }; - - /** - * Creates a tab client for the remote debugging protocol server. This client - * is a front to the tab actor created in the server side, hiding the protocol - * details in a traditional JavaScript API. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aForm object - * The protocol form for this tab. - */ - function TabClient(aClient, aForm) { - this.client = aClient; - this._actor = aForm.from; - this._threadActor = aForm.threadActor; - this.javascriptEnabled = aForm.javascriptEnabled; - this.cacheDisabled = aForm.cacheDisabled; - this.thread = null; - this.request = this.client.request; - this.traits = aForm.traits || {}; - this.events = ["workerListChanged"]; - } - - TabClient.prototype = { - get actor() { - return this._actor; - }, - get _transport() { - return this.client._transport; - }, - - /** - * Attach to a thread actor. - * - * @param object aOptions - * Configuration options. - * - useSourceMaps: whether to use source maps or not. - * @param function aOnResponse - * Called with the response packet and a ThreadClient - * (which will be undefined on error). - */ - attachThread: function () { - var aOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - if (this.thread) { - DevToolsUtils.executeSoon(() => aOnResponse({}, this.thread)); - return promise.resolve([{}, this.thread]); - } - - var packet = { - to: this._threadActor, - type: "attach", - options: aOptions - }; - return this.request(packet).then(aResponse => { - if (!aResponse.error) { - this.thread = new ThreadClient(this, this._threadActor); - this.client.registerClient(this.thread); - } - aOnResponse(aResponse, this.thread); - return [aResponse, this.thread]; - }); - }, - - /** - * Detach the client from the tab actor. - * - * @param function aOnResponse - * Called with the response packet. - */ - detach: DebuggerClient.requester({ - type: "detach" - }, { - before: function (aPacket) { - if (this.thread) { - this.thread.detach(); - } - return aPacket; - }, - after: function (aResponse) { - this.client.unregisterClient(this); - return aResponse; - }, - telemetry: "TABDETACH" - }), - - /** - * Bring the window to the front. - */ - focus: DebuggerClient.requester({ - type: "focus" - }, {}), - - /** - * Reload the page in this tab. - * - * @param [optional] object options - * An object with a `force` property indicating whether or not - * this reload should skip the cache - */ - reload: function () { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { force: false }; - - return this._reload(options); - }, - _reload: DebuggerClient.requester({ - type: "reload", - options: args(0) - }, { - telemetry: "RELOAD" - }), - - /** - * Navigate to another URL. - * - * @param string url - * The URL to navigate to. - */ - navigateTo: DebuggerClient.requester({ - type: "navigateTo", - url: args(0) - }, { - telemetry: "NAVIGATETO" - }), - - /** - * Reconfigure the tab actor. - * - * @param object aOptions - * A dictionary object of the new options to use in the tab actor. - * @param function aOnResponse - * Called with the response packet. - */ - reconfigure: DebuggerClient.requester({ - type: "reconfigure", - options: args(0) - }, { - telemetry: "RECONFIGURETAB" - }), - - listWorkers: DebuggerClient.requester({ - type: "listWorkers" - }, { - telemetry: "LISTWORKERS" - }), - - attachWorker: function (aWorkerActor, aOnResponse) { - this.client.attachWorker(aWorkerActor, aOnResponse); - }, - - /** - * Resolve a location ({ url, line, column }) to its current - * source mapping location. - * - * @param {String} arg[0].url - * @param {Number} arg[0].line - * @param {Number?} arg[0].column - */ - resolveLocation: DebuggerClient.requester({ - type: "resolveLocation", - location: args(0) - }) - }; - - eventSource(TabClient.prototype); - - function WorkerClient(aClient, aForm) { - this.client = aClient; - this._actor = aForm.from; - this._isClosed = false; - this._url = aForm.url; - - this._onClose = this._onClose.bind(this); - - this.addListener("close", this._onClose); - - this.traits = {}; - } - - WorkerClient.prototype = { - get _transport() { - return this.client._transport; - }, - - get request() { - return this.client.request; - }, - - get actor() { - return this._actor; - }, - - get url() { - return this._url; - }, - - get isClosed() { - return this._isClosed; - }, - - detach: DebuggerClient.requester({ type: "detach" }, { - after: function (aResponse) { - if (this.thread) { - this.client.unregisterClient(this.thread); - } - this.client.unregisterClient(this); - return aResponse; - }, - - telemetry: "WORKERDETACH" - }), - - attachThread: function () { - var aOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var aOnResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - if (this.thread) { - var response = [{ - type: "connected", - threadActor: this.thread._actor, - consoleActor: this.consoleActor - }, this.thread]; - DevToolsUtils.executeSoon(() => aOnResponse(response)); - return response; - } - - // The connect call on server doesn't attach the thread as of version 44. - return this.request({ - to: this._actor, - type: "connect", - options: aOptions - }).then(connectReponse => { - if (connectReponse.error) { - aOnResponse(connectReponse, null); - return [connectResponse, null]; - } - - return this.request({ - to: connectReponse.threadActor, - type: "attach", - options: aOptions - }).then(attachResponse => { - if (attachResponse.error) { - aOnResponse(attachResponse, null); - } - - this.thread = new ThreadClient(this, connectReponse.threadActor); - this.consoleActor = connectReponse.consoleActor; - this.client.registerClient(this.thread); - - aOnResponse(connectReponse, this.thread); - return [connectResponse, this.thread]; - }); - }); - }, - - _onClose: function () { - this.removeListener("close", this._onClose); - - if (this.thread) { - this.client.unregisterClient(this.thread); - } - this.client.unregisterClient(this); - this._isClosed = true; - }, - - reconfigure: function () { - return Promise.resolve(); - }, - - events: ["close"] - }; - - eventSource(WorkerClient.prototype); - - function AddonClient(aClient, aActor) { - this._client = aClient; - this._actor = aActor; - this.request = this._client.request; - this.events = []; - } - - AddonClient.prototype = { - get actor() { - return this._actor; - }, - get _transport() { - return this._client._transport; - }, - - /** - * Detach the client from the addon actor. - * - * @param function aOnResponse - * Called with the response packet. - */ - detach: DebuggerClient.requester({ - type: "detach" - }, { - after: function (aResponse) { - if (this._client.activeAddon === this) { - this._client.activeAddon = null; - } - this._client.unregisterClient(this); - return aResponse; - }, - telemetry: "ADDONDETACH" - }) - }; - - /** - * A RootClient object represents a root actor on the server. Each - * DebuggerClient keeps a RootClient instance representing the root actor - * for the initial connection; DebuggerClient's 'listTabs' and - * 'listChildProcesses' methods forward to that root actor. - * - * @param aClient object - * The client connection to which this actor belongs. - * @param aGreeting string - * The greeting packet from the root actor we're to represent. - * - * Properties of a RootClient instance: - * - * @property actor string - * The name of this child's root actor. - * @property applicationType string - * The application type, as given in the root actor's greeting packet. - * @property traits object - * The traits object, as given in the root actor's greeting packet. - */ - function RootClient(aClient, aGreeting) { - this._client = aClient; - this.actor = aGreeting.from; - this.applicationType = aGreeting.applicationType; - this.traits = aGreeting.traits; - } - exports.RootClient = RootClient; - - RootClient.prototype = { - constructor: RootClient, - - /** - * List the open tabs. - * - * @param function aOnResponse - * Called with the response packet. - */ - listTabs: DebuggerClient.requester({ type: "listTabs" }, { telemetry: "LISTTABS" }), - - /** - * List the installed addons. - * - * @param function aOnResponse - * Called with the response packet. - */ - listAddons: DebuggerClient.requester({ type: "listAddons" }, { telemetry: "LISTADDONS" }), - - /** - * List the registered workers. - * - * @param function aOnResponse - * Called with the response packet. - */ - listWorkers: DebuggerClient.requester({ type: "listWorkers" }, { telemetry: "LISTWORKERS" }), - - /** - * List the registered service workers. - * - * @param function aOnResponse - * Called with the response packet. - */ - listServiceWorkerRegistrations: DebuggerClient.requester({ type: "listServiceWorkerRegistrations" }, { telemetry: "LISTSERVICEWORKERREGISTRATIONS" }), - - /** - * List the running processes. - * - * @param function aOnResponse - * Called with the response packet. - */ - listProcesses: DebuggerClient.requester({ type: "listProcesses" }, { telemetry: "LISTPROCESSES" }), - - /** - * Fetch the TabActor for the currently selected tab, or for a specific - * tab given as first parameter. - * - * @param [optional] object aFilter - * A dictionary object with following optional attributes: - * - outerWindowID: used to match tabs in parent process - * - tabId: used to match tabs in child processes - * - tab: a reference to xul:tab element - * If nothing is specified, returns the actor for the currently - * selected tab. - */ - getTab: function (aFilter) { - var packet = { - to: this.actor, - type: "getTab" - }; - - if (aFilter) { - if (typeof aFilter.outerWindowID == "number") { - packet.outerWindowID = aFilter.outerWindowID; - } else if (typeof aFilter.tabId == "number") { - packet.tabId = aFilter.tabId; - } else if ("tab" in aFilter) { - var browser = aFilter.tab.linkedBrowser; - if (browser.frameLoader.tabParent) { - // Tabs in child process - packet.tabId = browser.frameLoader.tabParent.tabId; - } else { - // Tabs in parent process - var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); - packet.outerWindowID = windowUtils.outerWindowID; - } - } else { - // Throw if a filter object have been passed but without - // any clearly idenfified filter. - throw new Error("Unsupported argument given to getTab request"); - } - } - - return this.request(packet); - }, - - /** - * Description of protocol's actors and methods. - * - * @param function aOnResponse - * Called with the response packet. - */ - protocolDescription: DebuggerClient.requester({ type: "protocolDescription" }, { telemetry: "PROTOCOLDESCRIPTION" }), - - /* - * Methods constructed by DebuggerClient.requester require these forwards - * on their 'this'. - */ - get _transport() { - return this._client._transport; - }, - get request() { - return this._client.request; - } - }; - - /** - * Creates a thread client for the remote debugging protocol server. This client - * is a front to the thread actor created in the server side, hiding the - * protocol details in a traditional JavaScript API. - * - * @param aClient DebuggerClient|TabClient - * The parent of the thread (tab for tab-scoped debuggers, DebuggerClient - * for chrome debuggers). - * @param aActor string - * The actor ID for this thread. - */ - function ThreadClient(aClient, aActor) { - this._parent = aClient; - this.client = aClient instanceof DebuggerClient ? aClient : aClient.client; - this._actor = aActor; - this._frameCache = []; - this._scriptCache = {}; - this._pauseGrips = {}; - this._threadGrips = {}; - this.request = this.client.request; - } - - ThreadClient.prototype = { - _state: "paused", - get state() { - return this._state; - }, - get paused() { - return this._state === "paused"; - }, - - _pauseOnExceptions: false, - _ignoreCaughtExceptions: false, - _pauseOnDOMEvents: null, - - _actor: null, - get actor() { - return this._actor; - }, - - get _transport() { - return this.client._transport; - }, - - _assertPaused: function (aCommand) { - if (!this.paused) { - throw Error(`${aCommand} command sent while not paused. Currently ${this._state}`); - } - }, - - /** - * Resume a paused thread. If the optional aLimit parameter is present, then - * the thread will also pause when that limit is reached. - * - * @param [optional] object aLimit - * An object with a type property set to the appropriate limit (next, - * step, or finish) per the remote debugging protocol specification. - * Use null to specify no limit. - * @param function aOnResponse - * Called with the response packet. - */ - _doResume: DebuggerClient.requester({ - type: "resume", - resumeLimit: args(0) - }, { - before: function (aPacket) { - this._assertPaused("resume"); - - // Put the client in a tentative "resuming" state so we can prevent - // further requests that should only be sent in the paused state. - this._state = "resuming"; - - if (this._pauseOnExceptions) { - aPacket.pauseOnExceptions = this._pauseOnExceptions; - } - if (this._ignoreCaughtExceptions) { - aPacket.ignoreCaughtExceptions = this._ignoreCaughtExceptions; - } - if (this._pauseOnDOMEvents) { - aPacket.pauseOnDOMEvents = this._pauseOnDOMEvents; - } - return aPacket; - }, - after: function (aResponse) { - if (aResponse.error) { - // There was an error resuming, back to paused state. - this._state = "paused"; - } - return aResponse; - }, - telemetry: "RESUME" - }), - - /** - * Reconfigure the thread actor. - * - * @param object aOptions - * A dictionary object of the new options to use in the thread actor. - * @param function aOnResponse - * Called with the response packet. - */ - reconfigure: DebuggerClient.requester({ - type: "reconfigure", - options: args(0) - }, { - telemetry: "RECONFIGURETHREAD" - }), - - /** - * Resume a paused thread. - */ - resume: function (aOnResponse) { - return this._doResume(null, aOnResponse); - }, - - /** - * Resume then pause without stepping. - * - * @param function aOnResponse - * Called with the response packet. - */ - resumeThenPause: function (aOnResponse) { - return this._doResume({ type: "break" }, aOnResponse); - }, - - /** - * Step over a function call. - * - * @param function aOnResponse - * Called with the response packet. - */ - stepOver: function (aOnResponse) { - return this._doResume({ type: "next" }, aOnResponse); - }, - - /** - * Step into a function call. - * - * @param function aOnResponse - * Called with the response packet. - */ - stepIn: function (aOnResponse) { - return this._doResume({ type: "step" }, aOnResponse); - }, - - /** - * Step out of a function call. - * - * @param function aOnResponse - * Called with the response packet. - */ - stepOut: function (aOnResponse) { - return this._doResume({ type: "finish" }, aOnResponse); - }, - - /** - * Immediately interrupt a running thread. - * - * @param function aOnResponse - * Called with the response packet. - */ - interrupt: function (aOnResponse) { - return this._doInterrupt(null, aOnResponse); - }, - - /** - * Pause execution right before the next JavaScript bytecode is executed. - * - * @param function aOnResponse - * Called with the response packet. - */ - breakOnNext: function (aOnResponse) { - return this._doInterrupt("onNext", aOnResponse); - }, - - /** - * Interrupt a running thread. - * - * @param function aOnResponse - * Called with the response packet. - */ - _doInterrupt: DebuggerClient.requester({ - type: "interrupt", - when: args(0) - }, { - telemetry: "INTERRUPT" - }), - - /** - * Enable or disable pausing when an exception is thrown. - * - * @param boolean aFlag - * Enables pausing if true, disables otherwise. - * @param function aOnResponse - * Called with the response packet. - */ - pauseOnExceptions: function (aPauseOnExceptions, aIgnoreCaughtExceptions) { - var aOnResponse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; - - this._pauseOnExceptions = aPauseOnExceptions; - this._ignoreCaughtExceptions = aIgnoreCaughtExceptions; - - // Otherwise send the flag using a standard resume request. - if (!this.paused) { - return this.interrupt(aResponse => { - if (aResponse.error) { - // Can't continue if pausing failed. - aOnResponse(aResponse); - return aResponse; - } - return this.resume(aOnResponse); - }); - } - - aOnResponse(); - return promise.resolve(); - }, - - /** - * Enable pausing when the specified DOM events are triggered. Disabling - * pausing on an event can be realized by calling this method with the updated - * array of events that doesn't contain it. - * - * @param array|string events - * An array of strings, representing the DOM event types to pause on, - * or "*" to pause on all DOM events. Pass an empty array to - * completely disable pausing on DOM events. - * @param function onResponse - * Called with the response packet in a future turn of the event loop. - */ - pauseOnDOMEvents: function (events) { - var onResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - this._pauseOnDOMEvents = events; - // If the debuggee is paused, the value of the array will be communicated in - // the next resumption. Otherwise we have to force a pause in order to send - // the array. - if (this.paused) { - DevToolsUtils.executeSoon(() => onResponse({})); - return {}; - } - return this.interrupt(response => { - // Can't continue if pausing failed. - if (response.error) { - onResponse(response); - return response; - } - return this.resume(onResponse); - }); - }, - - /** - * Send a clientEvaluate packet to the debuggee. Response - * will be a resume packet. - * - * @param string aFrame - * The actor ID of the frame where the evaluation should take place. - * @param string aExpression - * The expression that will be evaluated in the scope of the frame - * above. - * @param function aOnResponse - * Called with the response packet. - */ - eval: DebuggerClient.requester({ - type: "clientEvaluate", - frame: args(0), - expression: args(1) - }, { - before: function (aPacket) { - this._assertPaused("eval"); - // Put the client in a tentative "resuming" state so we can prevent - // further requests that should only be sent in the paused state. - this._state = "resuming"; - return aPacket; - }, - after: function (aResponse) { - if (aResponse.error) { - // There was an error resuming, back to paused state. - this._state = "paused"; - } - return aResponse; - }, - telemetry: "CLIENTEVALUATE" - }), - - /** - * Detach from the thread actor. - * - * @param function aOnResponse - * Called with the response packet. - */ - detach: DebuggerClient.requester({ - type: "detach" - }, { - after: function (aResponse) { - this.client.unregisterClient(this); - this._parent.thread = null; - return aResponse; - }, - telemetry: "THREADDETACH" - }), - - /** - * Release multiple thread-lifetime object actors. If any pause-lifetime - * actors are included in the request, a |notReleasable| error will return, - * but all the thread-lifetime ones will have been released. - * - * @param array actors - * An array with actor IDs to release. - */ - releaseMany: DebuggerClient.requester({ - type: "releaseMany", - actors: args(0) - }, { - telemetry: "RELEASEMANY" - }), - - /** - * Promote multiple pause-lifetime object actors to thread-lifetime ones. - * - * @param array actors - * An array with actor IDs to promote. - */ - threadGrips: DebuggerClient.requester({ - type: "threadGrips", - actors: args(0) - }, { - telemetry: "THREADGRIPS" - }), - - /** - * Return the event listeners defined on the page. - * - * @param aOnResponse Function - * Called with the thread's response. - */ - eventListeners: DebuggerClient.requester({ - type: "eventListeners" - }, { - telemetry: "EVENTLISTENERS" - }), - - /** - * Request the loaded sources for the current thread. - * - * @param aOnResponse Function - * Called with the thread's response. - */ - getSources: DebuggerClient.requester({ - type: "sources" - }, { - telemetry: "SOURCES" - }), - - /** - * Clear the thread's source script cache. A scriptscleared event - * will be sent. - */ - _clearScripts: function () { - if (Object.keys(this._scriptCache).length > 0) { - this._scriptCache = {}; - this.emit("scriptscleared"); - } - }, - - /** - * Request frames from the callstack for the current thread. - * - * @param aStart integer - * The number of the youngest stack frame to return (the youngest - * frame is 0). - * @param aCount integer - * The maximum number of frames to return, or null to return all - * frames. - * @param aOnResponse function - * Called with the thread's response. - */ - getFrames: DebuggerClient.requester({ - type: "frames", - start: args(0), - count: args(1) - }, { - telemetry: "FRAMES" - }), - - /** - * An array of cached frames. Clients can observe the framesadded and - * framescleared event to keep up to date on changes to this cache, - * and can fill it using the fillFrames method. - */ - get cachedFrames() { - return this._frameCache; - }, - - /** - * true if there are more stack frames available on the server. - */ - get moreFrames() { - return this.paused && (!this._frameCache || this._frameCache.length == 0 || !this._frameCache[this._frameCache.length - 1].oldest); - }, - - /** - * Ensure that at least aTotal stack frames have been loaded in the - * ThreadClient's stack frame cache. A framesadded event will be - * sent when the stack frame cache is updated. - * - * @param aTotal number - * The minimum number of stack frames to be included. - * @param aCallback function - * Optional callback function called when frames have been loaded - * @returns true if a framesadded notification should be expected. - */ - fillFrames: function (aTotal) { - var aCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - this._assertPaused("fillFrames"); - if (this._frameCache.length >= aTotal) { - return false; - } - - var numFrames = this._frameCache.length; - - this.getFrames(numFrames, aTotal - numFrames, aResponse => { - if (aResponse.error) { - aCallback(aResponse); - return; - } - - var threadGrips = DevToolsUtils.values(this._threadGrips); - - for (var i in aResponse.frames) { - var frame = aResponse.frames[i]; - if (!frame.where.source) { - // Older servers use urls instead, so we need to resolve - // them to source actors - for (var grip of threadGrips) { - if (grip instanceof SourceClient && grip.url === frame.url) { - frame.where.source = grip._form; - } - } - } - - this._frameCache[frame.depth] = frame; - } - - // If we got as many frames as we asked for, there might be more - // frames available. - this.emit("framesadded"); - - aCallback(aResponse); - }); - - return true; - }, - - /** - * Clear the thread's stack frame cache. A framescleared event - * will be sent. - */ - _clearFrames: function () { - if (this._frameCache.length > 0) { - this._frameCache = []; - this.emit("framescleared"); - } - }, - - /** - * Return a ObjectClient object for the given object grip. - * - * @param aGrip object - * A pause-lifetime object grip returned by the protocol. - */ - pauseGrip: function (aGrip) { - if (aGrip.actor in this._pauseGrips) { - return this._pauseGrips[aGrip.actor]; - } - - var client = new ObjectClient(this.client, aGrip); - this._pauseGrips[aGrip.actor] = client; - return client; - }, - - /** - * Get or create a long string client, checking the grip client cache if it - * already exists. - * - * @param aGrip Object - * The long string grip returned by the protocol. - * @param aGripCacheName String - * The property name of the grip client cache to check for existing - * clients in. - */ - _longString: function (aGrip, aGripCacheName) { - if (aGrip.actor in this[aGripCacheName]) { - return this[aGripCacheName][aGrip.actor]; - } - - var client = new LongStringClient(this.client, aGrip); - this[aGripCacheName][aGrip.actor] = client; - return client; - }, - - /** - * Return an instance of LongStringClient for the given long string grip that - * is scoped to the current pause. - * - * @param aGrip Object - * The long string grip returned by the protocol. - */ - pauseLongString: function (aGrip) { - return this._longString(aGrip, "_pauseGrips"); - }, - - /** - * Return an instance of LongStringClient for the given long string grip that - * is scoped to the thread lifetime. - * - * @param aGrip Object - * The long string grip returned by the protocol. - */ - threadLongString: function (aGrip) { - return this._longString(aGrip, "_threadGrips"); - }, - - /** - * Clear and invalidate all the grip clients from the given cache. - * - * @param aGripCacheName - * The property name of the grip cache we want to clear. - */ - _clearObjectClients: function (aGripCacheName) { - for (var id in this[aGripCacheName]) { - this[aGripCacheName][id].valid = false; - } - this[aGripCacheName] = {}; - }, - - /** - * Invalidate pause-lifetime grip clients and clear the list of current grip - * clients. - */ - _clearPauseGrips: function () { - this._clearObjectClients("_pauseGrips"); - }, - - /** - * Invalidate thread-lifetime grip clients and clear the list of current grip - * clients. - */ - _clearThreadGrips: function () { - this._clearObjectClients("_threadGrips"); - }, - - /** - * Handle thread state change by doing necessary cleanup and notifying all - * registered listeners. - */ - _onThreadState: function (aPacket) { - this._state = ThreadStateTypes[aPacket.type]; - // The debugger UI may not be initialized yet so we want to keep - // the packet around so it knows what to pause state to display - // when it's initialized - this._lastPausePacket = aPacket.type === "resumed" ? null : aPacket; - this._clearFrames(); - this._clearPauseGrips(); - aPacket.type === ThreadStateTypes.detached && this._clearThreadGrips(); - this.client._eventsEnabled && this.emit(aPacket.type, aPacket); - }, - - getLastPausePacket: function () { - return this._lastPausePacket; - }, - - /** - * Return an EnvironmentClient instance for the given environment actor form. - */ - environment: function (aForm) { - return new EnvironmentClient(this.client, aForm); - }, - - /** - * Return an instance of SourceClient for the given source actor form. - */ - source: function (aForm) { - if (aForm.actor in this._threadGrips) { - return this._threadGrips[aForm.actor]; - } - - return this._threadGrips[aForm.actor] = new SourceClient(this, aForm); - }, - - /** - * Request the prototype and own properties of mutlipleObjects. - * - * @param aOnResponse function - * Called with the request's response. - * @param actors [string] - * List of actor ID of the queried objects. - */ - getPrototypesAndProperties: DebuggerClient.requester({ - type: "prototypesAndProperties", - actors: args(0) - }, { - telemetry: "PROTOTYPESANDPROPERTIES" - }), - - events: ["newSource"] - }; - - eventSource(ThreadClient.prototype); - - /** - * Creates a tracing profiler client for the remote debugging protocol - * server. This client is a front to the trace actor created on the - * server side, hiding the protocol details in a traditional - * JavaScript API. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aActor string - * The actor ID for this thread. - */ - function TraceClient(aClient, aActor) { - this._client = aClient; - this._actor = aActor; - this._activeTraces = new Set(); - this._waitingPackets = new Map(); - this._expectedPacket = 0; - this.request = this._client.request; - this.events = []; - } - - TraceClient.prototype = { - get actor() { - return this._actor; - }, - get tracing() { - return this._activeTraces.size > 0; - }, - - get _transport() { - return this._client._transport; - }, - - /** - * Detach from the trace actor. - */ - detach: DebuggerClient.requester({ - type: "detach" - }, { - after: function (aResponse) { - this._client.unregisterClient(this); - return aResponse; - }, - telemetry: "TRACERDETACH" - }), - - /** - * Start a new trace. - * - * @param aTrace [string] - * An array of trace types to be recorded by the new trace. - * - * @param aName string - * The name of the new trace. - * - * @param aOnResponse function - * Called with the request's response. - */ - startTrace: DebuggerClient.requester({ - type: "startTrace", - name: args(1), - trace: args(0) - }, { - after: function (aResponse) { - if (aResponse.error) { - return aResponse; - } - - if (!this.tracing) { - this._waitingPackets.clear(); - this._expectedPacket = 0; - } - this._activeTraces.add(aResponse.name); - - return aResponse; - }, - telemetry: "STARTTRACE" - }), - - /** - * End a trace. If a name is provided, stop the named - * trace. Otherwise, stop the most recently started trace. - * - * @param aName string - * The name of the trace to stop. - * - * @param aOnResponse function - * Called with the request's response. - */ - stopTrace: DebuggerClient.requester({ - type: "stopTrace", - name: args(0) - }, { - after: function (aResponse) { - if (aResponse.error) { - return aResponse; - } - - this._activeTraces.delete(aResponse.name); - - return aResponse; - }, - telemetry: "STOPTRACE" - }) - }; - - /** - * Grip clients are used to retrieve information about the relevant object. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aGrip object - * A pause-lifetime object grip returned by the protocol. - */ - function ObjectClient(aClient, aGrip) { - this._grip = aGrip; - this._client = aClient; - this.request = this._client.request; - } - exports.ObjectClient = ObjectClient; - - ObjectClient.prototype = { - get actor() { - return this._grip.actor; - }, - get _transport() { - return this._client._transport; - }, - - valid: true, - - get isFrozen() { - return this._grip.frozen; - }, - get isSealed() { - return this._grip.sealed; - }, - get isExtensible() { - return this._grip.extensible; - }, - - getDefinitionSite: DebuggerClient.requester({ - type: "definitionSite" - }, { - before: function (aPacket) { - if (this._grip.class != "Function") { - throw new Error("getDefinitionSite is only valid for function grips."); - } - return aPacket; - } - }), - - /** - * Request the names of a function's formal parameters. - * - * @param aOnResponse function - * Called with an object of the form: - * { parameterNames:[, ...] } - * where each is the name of a parameter. - */ - getParameterNames: DebuggerClient.requester({ - type: "parameterNames" - }, { - before: function (aPacket) { - if (this._grip.class !== "Function") { - throw new Error("getParameterNames is only valid for function grips."); - } - return aPacket; - }, - telemetry: "PARAMETERNAMES" - }), - - /** - * Request the names of the properties defined on the object and not its - * prototype. - * - * @param aOnResponse function Called with the request's response. - */ - getOwnPropertyNames: DebuggerClient.requester({ - type: "ownPropertyNames" - }, { - telemetry: "OWNPROPERTYNAMES" - }), - - /** - * Request the prototype and own properties of the object. - * - * @param aOnResponse function Called with the request's response. - */ - getPrototypeAndProperties: DebuggerClient.requester({ - type: "prototypeAndProperties" - }, { - telemetry: "PROTOTYPEANDPROPERTIES" - }), - - /** - * Request a PropertyIteratorClient instance to ease listing - * properties for this object. - * - * @param options Object - * A dictionary object with various boolean attributes: - * - ignoreSafeGetters Boolean - * If true, do not iterate over safe getters. - * - ignoreIndexedProperties Boolean - * If true, filters out Array items. - * e.g. properties names between `0` and `object.length`. - * - ignoreNonIndexedProperties Boolean - * If true, filters out items that aren't array items - * e.g. properties names that are not a number between `0` - * and `object.length`. - * - sort Boolean - * If true, the iterator will sort the properties by name - * before dispatching them. - * @param aOnResponse function Called with the client instance. - */ - enumProperties: DebuggerClient.requester({ - type: "enumProperties", - options: args(0) - }, { - after: function (aResponse) { - if (aResponse.iterator) { - return { iterator: new PropertyIteratorClient(this._client, aResponse.iterator) }; - } - return aResponse; - }, - telemetry: "ENUMPROPERTIES" - }), - - /** - * Request a PropertyIteratorClient instance to enumerate entries in a - * Map/Set-like object. - * - * @param aOnResponse function Called with the request's response. - */ - enumEntries: DebuggerClient.requester({ - type: "enumEntries" - }, { - before: function (packet) { - if (!["Map", "WeakMap", "Set", "WeakSet"].includes(this._grip.class)) { - throw new Error("enumEntries is only valid for Map/Set-like grips."); - } - return packet; - }, - after: function (response) { - if (response.iterator) { - return { - iterator: new PropertyIteratorClient(this._client, response.iterator) - }; - } - return response; - } - }), - - /** - * Request the property descriptor of the object's specified property. - * - * @param aName string The name of the requested property. - * @param aOnResponse function Called with the request's response. - */ - getProperty: DebuggerClient.requester({ - type: "property", - name: args(0) - }, { - telemetry: "PROPERTY" - }), - - /** - * Request the prototype of the object. - * - * @param aOnResponse function Called with the request's response. - */ - getPrototype: DebuggerClient.requester({ - type: "prototype" - }, { - telemetry: "PROTOTYPE" - }), - - /** - * Request the display string of the object. - * - * @param aOnResponse function Called with the request's response. - */ - getDisplayString: DebuggerClient.requester({ - type: "displayString" - }, { - telemetry: "DISPLAYSTRING" - }), - - /** - * Request the scope of the object. - * - * @param aOnResponse function Called with the request's response. - */ - getScope: DebuggerClient.requester({ - type: "scope" - }, { - before: function (aPacket) { - if (this._grip.class !== "Function") { - throw new Error("scope is only valid for function grips."); - } - return aPacket; - }, - telemetry: "SCOPE" - }), - - /** - * Request the promises directly depending on the current promise. - */ - getDependentPromises: DebuggerClient.requester({ - type: "dependentPromises" - }, { - before: function (aPacket) { - if (this._grip.class !== "Promise") { - throw new Error("getDependentPromises is only valid for promise " + "grips."); - } - return aPacket; - } - }), - - /** - * Request the stack to the promise's allocation point. - */ - getPromiseAllocationStack: DebuggerClient.requester({ - type: "allocationStack" - }, { - before: function (aPacket) { - if (this._grip.class !== "Promise") { - throw new Error("getAllocationStack is only valid for promise grips."); - } - return aPacket; - } - }), - - /** - * Request the stack to the promise's fulfillment point. - */ - getPromiseFulfillmentStack: DebuggerClient.requester({ - type: "fulfillmentStack" - }, { - before: function (packet) { - if (this._grip.class !== "Promise") { - throw new Error("getPromiseFulfillmentStack is only valid for " + "promise grips."); - } - return packet; - } - }), - - /** - * Request the stack to the promise's rejection point. - */ - getPromiseRejectionStack: DebuggerClient.requester({ - type: "rejectionStack" - }, { - before: function (packet) { - if (this._grip.class !== "Promise") { - throw new Error("getPromiseRejectionStack is only valid for " + "promise grips."); - } - return packet; - } - }) - }; - - /** - * A PropertyIteratorClient provides a way to access to property names and - * values of an object efficiently, slice by slice. - * Note that the properties can be sorted in the backend, - * this is controled while creating the PropertyIteratorClient - * from ObjectClient.enumProperties. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aGrip Object - * A PropertyIteratorActor grip returned by the protocol via - * TabActor.enumProperties request. - */ - function PropertyIteratorClient(aClient, aGrip) { - this._grip = aGrip; - this._client = aClient; - this.request = this._client.request; - } - - PropertyIteratorClient.prototype = { - get actor() { - return this._grip.actor; - }, - - /** - * Get the total number of properties available in the iterator. - */ - get count() { - return this._grip.count; - }, - - /** - * Get one or more property names that correspond to the positions in the - * indexes parameter. - * - * @param indexes Array - * An array of property indexes. - * @param aCallback Function - * The function called when we receive the property names. - */ - names: DebuggerClient.requester({ - type: "names", - indexes: args(0) - }, {}), - - /** - * Get a set of following property value(s). - * - * @param start Number - * The index of the first property to fetch. - * @param count Number - * The number of properties to fetch. - * @param aCallback Function - * The function called when we receive the property values. - */ - slice: DebuggerClient.requester({ - type: "slice", - start: args(0), - count: args(1) - }, {}), - - /** - * Get all the property values. - * - * @param aCallback Function - * The function called when we receive the property values. - */ - all: DebuggerClient.requester({ - type: "all" - }, {}) - }; - - /** - * A LongStringClient provides a way to access "very long" strings from the - * debugger server. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aGrip Object - * A pause-lifetime long string grip returned by the protocol. - */ - function LongStringClient(aClient, aGrip) { - this._grip = aGrip; - this._client = aClient; - this.request = this._client.request; - } - exports.LongStringClient = LongStringClient; - - LongStringClient.prototype = { - get actor() { - return this._grip.actor; - }, - get length() { - return this._grip.length; - }, - get initial() { - return this._grip.initial; - }, - get _transport() { - return this._client._transport; - }, - - valid: true, - - /** - * Get the substring of this LongString from aStart to aEnd. - * - * @param aStart Number - * The starting index. - * @param aEnd Number - * The ending index. - * @param aCallback Function - * The function called when we receive the substring. - */ - substring: DebuggerClient.requester({ - type: "substring", - start: args(0), - end: args(1) - }, { - telemetry: "SUBSTRING" - }) - }; - - /** - * A SourceClient provides a way to access the source text of a script. - * - * @param aClient ThreadClient - * The thread client parent. - * @param aForm Object - * The form sent across the remote debugging protocol. - */ - function SourceClient(aClient, aForm) { - this._form = aForm; - this._isBlackBoxed = aForm.isBlackBoxed; - this._isPrettyPrinted = aForm.isPrettyPrinted; - this._activeThread = aClient; - this._client = aClient.client; - } - - SourceClient.prototype = { - get _transport() { - return this._client._transport; - }, - get isBlackBoxed() { - return this._isBlackBoxed; - }, - get isPrettyPrinted() { - return this._isPrettyPrinted; - }, - get actor() { - return this._form.actor; - }, - get request() { - return this._client.request; - }, - get url() { - return this._form.url; - }, - - /** - * Black box this SourceClient's source. - * - * @param aCallback Function - * The callback function called when we receive the response from the server. - */ - blackBox: DebuggerClient.requester({ - type: "blackbox" - }, { - telemetry: "BLACKBOX", - after: function (aResponse) { - if (!aResponse.error) { - this._isBlackBoxed = true; - if (this._activeThread) { - this._activeThread.emit("blackboxchange", this); - } - } - return aResponse; - } - }), - - /** - * Un-black box this SourceClient's source. - * - * @param aCallback Function - * The callback function called when we receive the response from the server. - */ - unblackBox: DebuggerClient.requester({ - type: "unblackbox" - }, { - telemetry: "UNBLACKBOX", - after: function (aResponse) { - if (!aResponse.error) { - this._isBlackBoxed = false; - if (this._activeThread) { - this._activeThread.emit("blackboxchange", this); - } - } - return aResponse; - } - }), - - /** - * Get Executable Lines from a source - * - * @param aCallback Function - * The callback function called when we receive the response from the server. - */ - getExecutableLines: function () { - var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop; - - var packet = { - to: this._form.actor, - type: "getExecutableLines" - }; - - return this._client.request(packet).then(res => { - cb(res.lines); - return res.lines; - }); - }, - - /** - * Get a long string grip for this SourceClient's source. - */ - source: function () { - var aCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop; - - var packet = { - to: this._form.actor, - type: "source" - }; - return this._client.request(packet).then(aResponse => { - return this._onSourceResponse(aResponse, aCallback); - }); - }, - - /** - * Pretty print this source's text. - */ - prettyPrint: function (aIndent) { - var aCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - var packet = { - to: this._form.actor, - type: "prettyPrint", - indent: aIndent - }; - return this._client.request(packet).then(aResponse => { - if (!aResponse.error) { - this._isPrettyPrinted = true; - this._activeThread._clearFrames(); - this._activeThread.emit("prettyprintchange", this); - } - return this._onSourceResponse(aResponse, aCallback); - }); - }, - - /** - * Stop pretty printing this source's text. - */ - disablePrettyPrint: function () { - var aCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop; - - var packet = { - to: this._form.actor, - type: "disablePrettyPrint" - }; - return this._client.request(packet).then(aResponse => { - if (!aResponse.error) { - this._isPrettyPrinted = false; - this._activeThread._clearFrames(); - this._activeThread.emit("prettyprintchange", this); - } - return this._onSourceResponse(aResponse, aCallback); - }); - }, - - _onSourceResponse: function (aResponse, aCallback) { - if (aResponse.error) { - aCallback(aResponse); - return aResponse; - } - - if (typeof aResponse.source === "string") { - aCallback(aResponse); - return aResponse; - } - - var contentType = aResponse.contentType, - source = aResponse.source; - - var longString = this._activeThread.threadLongString(source); - return longString.substring(0, longString.length).then(function (aResponse) { - if (aResponse.error) { - aCallback(aResponse); - return aReponse; - } - - var response = { - source: aResponse.substring, - contentType: contentType - }; - aCallback(response); - return response; - }); - }, - - /** - * Request to set a breakpoint in the specified location. - * - * @param object aLocation - * The location and condition of the breakpoint in - * the form of { line[, column, condition] }. - * @param function aOnResponse - * Called with the thread's response. - */ - setBreakpoint: function (_ref) { - var line = _ref.line, - column = _ref.column, - condition = _ref.condition, - noSliding = _ref.noSliding; - var onResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; - - // A helper function that sets the breakpoint. - var doSetBreakpoint = aCallback => { - var root = this._client.mainRoot; - var location = { - line: line, - column: column - }; - - var packet = { - to: this.actor, - type: "setBreakpoint", - location: location, - condition: condition, - noSliding: noSliding - }; - - // Backwards compatibility: send the breakpoint request to the - // thread if the server doesn't support Debugger.Source actors. - if (!root.traits.debuggerSourceActors) { - packet.to = this._activeThread.actor; - packet.location.url = this.url; - } - - return this._client.request(packet).then(response => { - // Ignoring errors, since the user may be setting a breakpoint in a - // dead script that will reappear on a page reload. - var bpClient = void 0; - if (response.actor) { - bpClient = new BreakpointClient(this._client, this, response.actor, location, root.traits.conditionalBreakpoints ? condition : undefined); - } - onResponse(response, bpClient); - if (aCallback) { - aCallback(); - } - return [response, bpClient]; - }); - }; - - // If the debuggee is paused, just set the breakpoint. - if (this._activeThread.paused) { - return doSetBreakpoint(); - } - // Otherwise, force a pause in order to set the breakpoint. - return this._activeThread.interrupt().then(aResponse => { - if (aResponse.error) { - // Can't set the breakpoint if pausing failed. - onResponse(aResponse); - return aResponse; - } - - var type = aResponse.type, - why = aResponse.why; - - var cleanUp = type == "paused" && why.type == "interrupted" ? () => this._activeThread.resume() : noop; - - return doSetBreakpoint(cleanUp); - }); - } - }; - - /** - * Breakpoint clients are used to remove breakpoints that are no longer used. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aSourceClient SourceClient - * The source where this breakpoint exists - * @param aActor string - * The actor ID for this breakpoint. - * @param aLocation object - * The location of the breakpoint. This is an object with two properties: - * url and line. - * @param aCondition string - * The conditional expression of the breakpoint - */ - function BreakpointClient(aClient, aSourceClient, aActor, aLocation, aCondition) { - this._client = aClient; - this._actor = aActor; - this.location = aLocation; - this.location.actor = aSourceClient.actor; - this.location.url = aSourceClient.url; - this.source = aSourceClient; - this.request = this._client.request; - - // The condition property should only exist if it's a truthy value - if (aCondition) { - this.condition = aCondition; - } - } - - BreakpointClient.prototype = { - - _actor: null, - get actor() { - return this._actor; - }, - get _transport() { - return this._client._transport; - }, - - /** - * Remove the breakpoint from the server. - */ - remove: DebuggerClient.requester({ - type: "delete" - }, { - telemetry: "DELETE" - }), - - /** - * Determines if this breakpoint has a condition - */ - hasCondition: function () { - var root = this._client.mainRoot; - // XXX bug 990137: We will remove support for client-side handling of - // conditional breakpoints - if (root.traits.conditionalBreakpoints) { - return "condition" in this; - } else { - return "conditionalExpression" in this; - } - }, - - /** - * Get the condition of this breakpoint. Currently we have to - * support locally emulated conditional breakpoints until the - * debugger servers are updated (see bug 990137). We used a - * different property when moving it server-side to ensure that we - * are testing the right code. - */ - getCondition: function () { - var root = this._client.mainRoot; - if (root.traits.conditionalBreakpoints) { - return this.condition; - } else { - return this.conditionalExpression; - } - }, - - /** - * Set the condition of this breakpoint - */ - setCondition: function (gThreadClient, aCondition, noSliding) { - var root = this._client.mainRoot; - var deferred = promise.defer(); - - if (root.traits.conditionalBreakpoints) { - var info = { - line: this.location.line, - column: this.location.column, - condition: aCondition, - noSliding - }; - - // Remove the current breakpoint and add a new one with the - // condition. - this.remove(aResponse => { - if (aResponse && aResponse.error) { - deferred.reject(aResponse); - return; - } - - this.source.setBreakpoint(info, (aResponse, aNewBreakpoint) => { - if (aResponse && aResponse.error) { - deferred.reject(aResponse); - } else { - deferred.resolve(aNewBreakpoint); - } - }); - }); - } else { - // The property shouldn't even exist if the condition is blank - if (aCondition === "") { - delete this.conditionalExpression; - } else { - this.conditionalExpression = aCondition; - } - deferred.resolve(this); - } - - return deferred.promise; - } - }; - - eventSource(BreakpointClient.prototype); - - /** - * Environment clients are used to manipulate the lexical environment actors. - * - * @param aClient DebuggerClient - * The debugger client parent. - * @param aForm Object - * The form sent across the remote debugging protocol. - */ - function EnvironmentClient(aClient, aForm) { - this._client = aClient; - this._form = aForm; - this.request = this._client.request; - } - exports.EnvironmentClient = EnvironmentClient; - - EnvironmentClient.prototype = { - - get actor() { - return this._form.actor; - }, - get _transport() { - return this._client._transport; - }, - - /** - * Fetches the bindings introduced by this lexical environment. - */ - getBindings: DebuggerClient.requester({ - type: "bindings" - }, { - telemetry: "BINDINGS" - }), - - /** - * Changes the value of the identifier whose name is name (a string) to that - * represented by value (a grip). - */ - assign: DebuggerClient.requester({ - type: "assign", - name: args(0), - value: args(1) - }, { - telemetry: "ASSIGN" - }) - }; - - eventSource(EnvironmentClient.prototype); - -/***/ }, -/* 863 */ -/***/ 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"; - - module.metadata = { - "stability": "unstable" - }; - - 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), - ns = _require.ns; - - var event = ns(); - - var EVENT_TYPE_PATTERN = /^on([A-Z]\w+$)/; - exports.EVENT_TYPE_PATTERN = EVENT_TYPE_PATTERN; - - // Utility function to access given event `target` object's event listeners for - // the specific event `type`. If listeners for this type does not exists they - // will be created. - var observers = function observers(target, type) { - if (!target) throw TypeError("Event target must be an object"); - var listeners = event(target); - return type in listeners ? listeners[type] : listeners[type] = []; - }; - - /** - * Registers an event `listener` that is called every time events of - * specified `type` is emitted on the given event `target`. - * @param {Object} target - * Event target object. - * @param {String} type - * The type of event. - * @param {Function} listener - * The listener function that processes the event. - */ - function on(target, type, listener) { - if (typeof listener !== 'function') throw new Error(BAD_LISTENER); - - var listeners = observers(target, type); - if (!~listeners.indexOf(listener)) listeners.push(listener); - } - exports.on = on; - - var onceWeakMap = new WeakMap(); - - /** - * Registers an event `listener` that is called only the next time an event - * of the specified `type` is emitted on the given event `target`. - * @param {Object} target - * Event target object. - * @param {String} type - * The type of the event. - * @param {Function} listener - * The listener function that processes the event. - */ - function once(target, type, listener) { - var replacement = function observer() { - off(target, type, observer); - onceWeakMap.delete(listener); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - listener.apply(target, args); - }; - onceWeakMap.set(listener, replacement); - on(target, type, replacement); - } - exports.once = once; - - /** - * Execute each of the listeners in order with the supplied arguments. - * All the exceptions that are thrown by listeners during the emit - * are caught and can be handled by listeners of 'error' event. Thrown - * exceptions are passed as an argument to an 'error' event listener. - * If no 'error' listener is registered exception will be logged into an - * error console. - * @param {Object} target - * Event target object. - * @param {String} type - * The type of event. - * @params {Object|Number|String|Boolean} args - * Arguments that will be passed to listeners. - */ - function emit(target, type) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - emitOnObject.apply(undefined, [target, type, target].concat(args)); - } - exports.emit = emit; - - /** - * A variant of emit that allows setting the this property for event listeners - */ - function emitOnObject(target, type, thisArg) { - var all = observers(target, '*').length; - var state = observers(target, type); - var listeners = state.slice(); - var count = listeners.length; - var index = 0; - - // If error event and there are no handlers (explicit or catch-all) - // then print error message to the console. - - for (var _len3 = arguments.length, args = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) { - args[_key3 - 3] = arguments[_key3]; - } - - if (count === 0 && type === 'error' && all === 0) console.exception(args[0]); - while (index < count) { - try { - var listener = listeners[index]; - // Dispatch only if listener is still registered. - if (~state.indexOf(listener)) listener.apply(thisArg, args); - } catch (error) { - // If exception is not thrown by a error listener and error listener is - // registered emit `error` event. Otherwise dump exception to the console. - if (type !== 'error') emit(target, 'error', error);else console.exception(error); - } - index++; - } - // Also emit on `"*"` so that one could listen for all events. - if (type !== '*') emit.apply(undefined, [target, '*', type].concat(args)); - } - exports.emitOnObject = emitOnObject; - - /** - * Removes an event `listener` for the given event `type` on the given event - * `target`. If no `listener` is passed removes all listeners of the given - * `type`. If `type` is not passed removes all the listeners of the given - * event `target`. - * @param {Object} target - * The event target object. - * @param {String} type - * The type of event. - * @param {Function} listener - * The listener function that processes the event. - */ - function off(target, type, listener) { - var length = arguments.length; - if (length === 3) { - if (onceWeakMap.has(listener)) { - listener = onceWeakMap.get(listener); - onceWeakMap.delete(listener); - } - - var listeners = observers(target, type); - var index = listeners.indexOf(listener); - if (~index) listeners.splice(index, 1); - } else if (length === 2) { - observers(target, type).splice(0); - } else if (length === 1) { - var _listeners = event(target); - Object.keys(_listeners).forEach(type => delete _listeners[type]); - } - } - exports.off = off; - - /** - * Returns a number of event listeners registered for the given event `type` - * on the given event `target`. - */ - function count(target, type) { - return observers(target, type).length; - } - exports.count = count; - - /** - * Registers listeners on the given event `target` from the given `listeners` - * dictionary. Iterates over the listeners and if property name matches name - * pattern `onEventType` and property is a function, then registers it as - * an `eventType` listener on `target`. - * - * @param {Object} target - * The type of event. - * @param {Object} listeners - * Dictionary of listeners. - */ - function setListeners(target, listeners) { - Object.keys(listeners || {}).forEach(key => { - var match = EVENT_TYPE_PATTERN.exec(key); - var type = match && match[1].toLowerCase(); - if (!type) return; - - var listener = listeners[key]; - if (typeof listener === 'function') on(target, type, listener); - }); - } - exports.setListeners = setListeners; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) - -/***/ }, -/* 864 */ -/***/ 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"; - - module.metadata = { - "stability": "unstable" - }; - - var create = Object.create; - var prototypeOf = Object.getPrototypeOf; - - /** - * Returns a new namespace, function that may can be used to access an - * namespaced object of the argument argument. Namespaced object are associated - * with owner objects via weak references. Namespaced objects inherit from the - * owners ancestor namespaced object. If owner's ancestor is `null` then - * namespaced object inherits from given `prototype`. Namespaces can be used - * to define internal APIs that can be shared via enclosing `namespace` - * function. - * @examples - * const internals = ns(); - * internals(object).secret = secret; - */ - function ns() { - var map = new WeakMap(); - return function namespace(target) { - if (!target) // If `target` is not an object return `target` itself. - return target; - // If target has no namespaced object yet, create one that inherits from - // the target prototype's namespaced object. - if (!map.has(target)) map.set(target, create(namespace(prototypeOf(target) || null))); - - return map.get(target); - }; - }; - - // `Namespace` is a e4x function in the scope, so we export the function also as - // `ns` as alias to avoid clashing. - exports.ns = ns; - exports.Namespace = ns; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) - -/***/ }, -/* 865 */ -/***/ 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), - Cc = _require.Cc, - Ci = _require.Ci, - Cu = _require.Cu; - - var DevToolsUtils = __webpack_require__(833); - var EventEmitter = __webpack_require__(844); - var promise = __webpack_require__(839); - - /** - * A WebConsoleClient is used as a front end for the WebConsoleActor that is - * created on the server, hiding implementation details. - * - * @param object aDebuggerClient - * The DebuggerClient instance we live for. - * @param object aResponse - * The response packet received from the "startListeners" request sent to - * the WebConsoleActor. - * @param object LongStringClient - * LongStringClient constructor to get full string from server - */ - function WebConsoleClient(aDebuggerClient, aResponse, LongStringClient) { - this._actor = aResponse.from; - this._client = aDebuggerClient; - this.LongStringClient = LongStringClient; - this._longStrings = {}; - this.traits = aResponse.traits || {}; - this.events = []; - this._networkRequests = new Map(); - - this.pendingEvaluationResults = new Map(); - this.onEvaluationResult = this.onEvaluationResult.bind(this); - this.onNetworkEvent = this._onNetworkEvent.bind(this); - this.onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this); - - this._client.addListener("evaluationResult", this.onEvaluationResult); - this._client.addListener("networkEvent", this.onNetworkEvent); - this._client.addListener("networkEventUpdate", this.onNetworkEventUpdate); - EventEmitter.decorate(this); - } - - exports.WebConsoleClient = WebConsoleClient; - - WebConsoleClient.prototype = { - _longStrings: null, - traits: null, - - /** - * Holds the network requests currently displayed by the Web Console. Each key - * represents the connection ID and the value is network request information. - * @private - * @type object - */ - _networkRequests: null, - - getNetworkRequest(actorId) { - return this._networkRequests.get(actorId); - }, - - hasNetworkRequest(actorId) { - return this._networkRequests.has(actorId); - }, - - removeNetworkRequest(actorId) { - this._networkRequests.delete(actorId); - }, - - getNetworkEvents() { - return this._networkRequests.values(); - }, - - get actor() { - return this._actor; - }, - - /** - * The "networkEvent" message type handler. We redirect any message to - * the UI for displaying. - * - * @private - * @param string type - * Message type. - * @param object packet - * The message received from the server. - */ - _onNetworkEvent: function (type, packet) { - if (packet.from == this._actor) { - var actor = packet.eventActor; - var networkInfo = { - _type: "NetworkEvent", - timeStamp: actor.timeStamp, - node: null, - actor: actor.actor, - discardRequestBody: true, - discardResponseBody: true, - startedDateTime: actor.startedDateTime, - request: { - url: actor.url, - method: actor.method - }, - isXHR: actor.isXHR, - response: {}, - timings: {}, - updates: [], // track the list of network event updates - private: actor.private, - fromCache: actor.fromCache - }; - this._networkRequests.set(actor.actor, networkInfo); - - this.emit("networkEvent", networkInfo); - } - }, - - /** - * The "networkEventUpdate" message type handler. We redirect any message to - * the UI for displaying. - * - * @private - * @param string type - * Message type. - * @param object packet - * The message received from the server. - */ - _onNetworkEventUpdate: function (type, packet) { - var networkInfo = this.getNetworkRequest(packet.from); - if (!networkInfo) { - return; - } - - networkInfo.updates.push(packet.updateType); - - switch (packet.updateType) { - case "requestHeaders": - networkInfo.request.headersSize = packet.headersSize; - break; - case "requestPostData": - networkInfo.discardRequestBody = packet.discardRequestBody; - networkInfo.request.bodySize = packet.dataSize; - break; - case "responseStart": - networkInfo.response.httpVersion = packet.response.httpVersion; - networkInfo.response.status = packet.response.status; - networkInfo.response.statusText = packet.response.statusText; - networkInfo.response.headersSize = packet.response.headersSize; - networkInfo.response.remoteAddress = packet.response.remoteAddress; - networkInfo.response.remotePort = packet.response.remotePort; - networkInfo.discardResponseBody = packet.response.discardResponseBody; - break; - case "responseContent": - networkInfo.response.content = { - mimeType: packet.mimeType - }; - networkInfo.response.bodySize = packet.contentSize; - networkInfo.response.transferredSize = packet.transferredSize; - networkInfo.discardResponseBody = packet.discardResponseBody; - break; - case "eventTimings": - networkInfo.totalTime = packet.totalTime; - break; - case "securityInfo": - networkInfo.securityInfo = packet.state; - break; - } - - this.emit("networkEventUpdate", { - packet: packet, - networkInfo - }); - }, - - /** - * Retrieve the cached messages from the server. - * - * @see this.CACHED_MESSAGES - * @param array types - * The array of message types you want from the server. See - * this.CACHED_MESSAGES for known types. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getCachedMessages: function WCC_getCachedMessages(types, aOnResponse) { - var packet = { - to: this._actor, - type: "getCachedMessages", - messageTypes: types - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Inspect the properties of an object. - * - * @param string aActor - * The WebConsoleObjectActor ID to send the request to. - * @param function aOnResponse - * The function invoked when the response is received. - */ - inspectObjectProperties: function WCC_inspectObjectProperties(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "inspectProperties" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Evaluate a JavaScript expression. - * - * @param string aString - * The code you want to evaluate. - * @param function aOnResponse - * The function invoked when the response is received. - * @param object [aOptions={}] - * Options for evaluation: - * - * - bindObjectActor: an ObjectActor ID. The OA holds a reference to - * a Debugger.Object that wraps a content object. This option allows - * you to bind |_self| to the D.O of the given OA, during string - * evaluation. - * - * See: Debugger.Object.executeInGlobalWithBindings() for information - * about bindings. - * - * Use case: the variable view needs to update objects and it does so - * by knowing the ObjectActor it inspects and binding |_self| to the - * D.O of the OA. As such, variable view sends strings like these for - * eval: - * _self["prop"] = value; - * - * - frameActor: a FrameActor ID. The FA holds a reference to - * a Debugger.Frame. This option allows you to evaluate the string in - * the frame of the given FA. - * - * - url: the url to evaluate the script as. Defaults to - * "debugger eval code". - * - * - selectedNodeActor: the NodeActor ID of the current selection in the - * Inspector, if such a selection exists. This is used by helper functions - * that can reference the currently selected node in the Inspector, like - * $0. - */ - evaluateJS: function WCC_evaluateJS(aString, aOnResponse) { - var aOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var packet = { - to: this._actor, - type: "evaluateJS", - text: aString, - bindObjectActor: aOptions.bindObjectActor, - frameActor: aOptions.frameActor, - url: aOptions.url, - selectedNodeActor: aOptions.selectedNodeActor, - selectedObjectActor: aOptions.selectedObjectActor - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Evaluate a JavaScript expression asynchronously. - * See evaluateJS for parameter and response information. - */ - evaluateJSAsync: function (aString, aOnResponse) { - var aOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - // Pre-37 servers don't support async evaluation. - if (!this.traits.evaluateJSAsync) { - this.evaluateJS(aString, aOnResponse, aOptions); - return; - } - - var packet = { - to: this._actor, - type: "evaluateJSAsync", - text: aString, - bindObjectActor: aOptions.bindObjectActor, - frameActor: aOptions.frameActor, - url: aOptions.url, - selectedNodeActor: aOptions.selectedNodeActor, - selectedObjectActor: aOptions.selectedObjectActor - }; - - this._client.request(packet, response => { - // Null check this in case the client has been detached while waiting - // for a response. - if (this.pendingEvaluationResults) { - this.pendingEvaluationResults.set(response.resultID, aOnResponse); - } - }); - }, - - /** - * Handler for the actors's unsolicited evaluationResult packet. - */ - onEvaluationResult: function (aNotification, aPacket) { - // The client on the main thread can receive notification packets from - // multiple webconsole actors: the one on the main thread and the ones - // on worker threads. So make sure we should be handling this request. - if (aPacket.from !== this._actor) { - return; - } - - // Find the associated callback based on this ID, and fire it. - // In a sync evaluation, this would have already been called in - // direct response to the client.request function. - var onResponse = this.pendingEvaluationResults.get(aPacket.resultID); - if (onResponse) { - onResponse(aPacket); - this.pendingEvaluationResults.delete(aPacket.resultID); - } else { - DevToolsUtils.reportException("onEvaluationResult", "No response handler for an evaluateJSAsync result (resultID: " + aPacket.resultID + ")"); - } - }, - - /** - * Autocomplete a JavaScript expression. - * - * @param string aString - * The code you want to autocomplete. - * @param number aCursor - * Cursor location inside the string. Index starts from 0. - * @param function aOnResponse - * The function invoked when the response is received. - * @param string aFrameActor - * The id of the frame actor that made the call. - */ - autocomplete: function WCC_autocomplete(aString, aCursor, aOnResponse, aFrameActor) { - var packet = { - to: this._actor, - type: "autocomplete", - text: aString, - cursor: aCursor, - frameActor: aFrameActor - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Clear the cache of messages (page errors and console API calls). - */ - clearMessagesCache: function WCC_clearMessagesCache() { - var packet = { - to: this._actor, - type: "clearMessagesCache" - }; - this._client.request(packet); - }, - - /** - * Get Web Console-related preferences on the server. - * - * @param array aPreferences - * An array with the preferences you want to retrieve. - * @param function [aOnResponse] - * Optional function to invoke when the response is received. - */ - getPreferences: function WCC_getPreferences(aPreferences, aOnResponse) { - var packet = { - to: this._actor, - type: "getPreferences", - preferences: aPreferences - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Set Web Console-related preferences on the server. - * - * @param object aPreferences - * An object with the preferences you want to change. - * @param function [aOnResponse] - * Optional function to invoke when the response is received. - */ - setPreferences: function WCC_setPreferences(aPreferences, aOnResponse) { - var packet = { - to: this._actor, - type: "setPreferences", - preferences: aPreferences - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the request headers from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getRequestHeaders: function WCC_getRequestHeaders(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getRequestHeaders" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the request cookies from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getRequestCookies: function WCC_getRequestCookies(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getRequestCookies" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the request post data from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getRequestPostData: function WCC_getRequestPostData(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getRequestPostData" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the response headers from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getResponseHeaders: function WCC_getResponseHeaders(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getResponseHeaders" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the response cookies from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getResponseCookies: function WCC_getResponseCookies(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getResponseCookies" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the response content from the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getResponseContent: function WCC_getResponseContent(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getResponseContent" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the timing information for the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getEventTimings: function WCC_getEventTimings(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getEventTimings" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Retrieve the security information for the given NetworkEventActor. - * - * @param string aActor - * The NetworkEventActor ID. - * @param function aOnResponse - * The function invoked when the response is received. - */ - getSecurityInfo: function WCC_getSecurityInfo(aActor, aOnResponse) { - var packet = { - to: aActor, - type: "getSecurityInfo" - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Send a HTTP request with the given data. - * - * @param string aData - * The details of the HTTP request. - * @param function aOnResponse - * The function invoked when the response is received. - */ - sendHTTPRequest: function WCC_sendHTTPRequest(aData, aOnResponse) { - var packet = { - to: this._actor, - type: "sendHTTPRequest", - request: aData - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Start the given Web Console listeners. - * - * @see this.LISTENERS - * @param array aListeners - * Array of listeners you want to start. See this.LISTENERS for - * known listeners. - * @param function aOnResponse - * Function to invoke when the server response is received. - */ - startListeners: function WCC_startListeners(aListeners, aOnResponse) { - var packet = { - to: this._actor, - type: "startListeners", - listeners: aListeners - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Stop the given Web Console listeners. - * - * @see this.LISTENERS - * @param array aListeners - * Array of listeners you want to stop. See this.LISTENERS for - * known listeners. - * @param function aOnResponse - * Function to invoke when the server response is received. - */ - stopListeners: function WCC_stopListeners(aListeners, aOnResponse) { - var packet = { - to: this._actor, - type: "stopListeners", - listeners: aListeners - }; - this._client.request(packet, aOnResponse); - }, - - /** - * Return an instance of LongStringClient for the given long string grip. - * - * @param object aGrip - * The long string grip returned by the protocol. - * @return object - * The LongStringClient for the given long string grip. - */ - longString: function WCC_longString(aGrip) { - if (aGrip.actor in this._longStrings) { - return this._longStrings[aGrip.actor]; - } - - var LongStringClient = this.LongStringClient.bind(this); - var client = new LongStringClient(this._client, aGrip); - this._longStrings[aGrip.actor] = client; - return client; - }, - - /** - * Close the WebConsoleClient. This stops all the listeners on the server and - * detaches from the console actor. - * - * @param function aOnResponse - * Function to invoke when the server response is received. - */ - detach: function WCC_detach(aOnResponse) { - this._client.removeListener("evaluationResult", this.onEvaluationResult); - this._client.removeListener("networkEvent", this.onNetworkEvent); - this._client.removeListener("networkEventUpdate", this.onNetworkEventUpdate); - this.stopListeners(null, aOnResponse); - this._longStrings = null; - this._client = null; - this.pendingEvaluationResults.clear(); - this.pendingEvaluationResults = null; - this.clearNetworkRequests(); - this._networkRequests = null; - }, - - clearNetworkRequests: function () { - this._networkRequests.clear(); - }, - - /** - * Fetches the full text of a LongString. - * - * @param object | string stringGrip - * The long string grip containing the corresponding actor. - * If you pass in a plain string (by accident or because you're lazy), - * then a promise of the same string is simply returned. - * @return object Promise - * A promise that is resolved when the full string contents - * are available, or rejected if something goes wrong. - */ - getString: function (stringGrip) { - // Make sure this is a long string. - if (typeof stringGrip != "object" || stringGrip.type != "longString") { - return promise.resolve(stringGrip); // Go home string, you're drunk. - } - - // Fetch the long string only once. - if (stringGrip._fullText) { - return stringGrip._fullText.promise; - } - - var deferred = stringGrip._fullText = promise.defer(); - var actor = stringGrip.actor, - initial = stringGrip.initial, - length = stringGrip.length; - - var longStringClient = this.longString(stringGrip); - - longStringClient.substring(initial.length, length, aResponse => { - if (aResponse.error) { - DevToolsUtils.reportException("getString", aResponse.error + ": " + aResponse.message); - - deferred.reject(aResponse); - return; - } - deferred.resolve(initial + aResponse.substring); - }); - - return deferred.promise; - } - }; - -/***/ }, -/* 866 */ -/***/ 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: */ - /* 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) - - "use strict"; - - var DevToolsUtils = __webpack_require__(833); - var dumpn = DevToolsUtils.dumpn, - dumpv = DevToolsUtils.dumpv; - - var StreamUtils = __webpack_require__(867); - - var _require = __webpack_require__(868), - 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 PACKET_HEADER_MAX = 200; - - /** - * An adapter that handles data transfers between the debugger client and - * server. It can work with both nsIPipe and nsIServerSocket transports so - * long as the properly created input and output streams are specified. - * (However, for intra-process connections, LocalDebuggerTransport, below, - * is more efficient than using an nsIPipe pair with DebuggerTransport.) - * - * @param input nsIAsyncInputStream - * The input stream. - * @param output nsIAsyncOutputStream - * The output stream. - * - * Given a DebuggerTransport instance dt: - * 1) Set dt.hooks to a packet handler object (described below). - * 2) Call dt.ready() to begin watching for input packets. - * 3) Call dt.send() / dt.startBulkSend() to send packets. - * 4) Call dt.close() to close the connection, and disengage from the event - * loop. - * - * A packet handler is an object with the following methods: - * - * - onPacket(packet) - called when we have received a complete packet. - * |packet| is the parsed form of the packet --- a JavaScript value, not - * a JSON-syntax string. - * - * - onBulkPacket(packet) - called when we have switched to bulk packet - * receiving mode. |packet| is an object containing: - * * actor: Name of actor that will receive the packet - * * type: Name of actor's method that should be called on receipt - * * length: Size of the data to be read - * * stream: This input stream should only be used directly if you can ensure - * that you will read exactly |length| bytes and will not close the - * stream when reading is complete - * * done: If you use the stream directly (instead of |copyTo| below), you - * must signal completion by resolving / rejecting this deferred. - * If it's rejected, the transport will be closed. If an Error is - * supplied as a rejection value, it will be logged via |dumpn|. - * If you do use |copyTo|, resolving is taken care of for you when - * copying completes. - * * copyTo: A helper function for getting your data out of the stream that - * meets the stream handling requirements above, and has the - * following signature: - * @param output nsIAsyncOutputStream - * The stream to copy to. - * @return Promise - * The promise is resolved when copying completes or rejected if any - * (unexpected) errors occur. - * This object also emits "progress" events for each chunk that is - * copied. See stream-utils.js. - * - * - onClosed(reason) - called when the connection is closed. |reason| is - * an optional nsresult or object, typically passed when the transport is - * closed due to some error in a underlying stream. - * - * See ./packets.js and the Remote Debugging Protocol specification for more - * details on the format of these packets. - */ - function DebuggerTransport(socket) { - EventEmitter.decorate(this); - - this._socket = socket; - - // The current incoming (possibly partial) header, which will determine which - // type of Packet |_incoming| below will become. - this._incomingHeader = ""; - // The current incoming Packet object - this._incoming = null; - // A queue of outgoing Packet objects - this._outgoing = []; - - this.hooks = null; - this.active = false; - - this._incomingEnabled = true; - this._outgoingEnabled = true; - - this.close = this.close.bind(this); - } - - DebuggerTransport.prototype = { - /** - * Transmit an object as a JSON packet. - * - * This method returns immediately, without waiting for the entire - * packet to be transmitted, registering event handlers as needed to - * transmit the entire packet. Packets are transmitted in the order - * they are passed to this method. - */ - send: function (object) { - this.emit("send", object); - - var packet = new JSONPacket(this); - packet.object = object; - this._outgoing.push(packet); - this._flushOutgoing(); - }, - - /** - * Transmit streaming data via a bulk packet. - * - * This method initiates the bulk send process by queuing up the header data. - * The caller receives eventual access to a stream for writing. - * - * N.B.: Do *not* attempt to close the stream handed to you, as it will - * continue to be used by this transport afterwards. Most users should - * instead use the provided |copyFrom| function instead. - * - * @param header Object - * This is modeled after the format of JSON packets above, but does not - * actually contain the data, but is instead just a routing header: - * * actor: Name of actor that will receive the packet - * * type: Name of actor's method that should be called on receipt - * * length: Size of the data to be sent - * @return Promise - * The promise will be resolved when you are allowed to write to the - * stream with an object containing: - * * stream: This output stream should only be used directly if - * you can ensure that you will write exactly |length| - * bytes and will not close the stream when writing is - * complete - * * done: If you use the stream directly (instead of |copyFrom| - * below), you must signal completion by resolving / - * rejecting this deferred. If it's rejected, the - * transport will be closed. If an Error is supplied as - * a rejection value, it will be logged via |dumpn|. If - * you do use |copyFrom|, resolving is taken care of for - * you when copying completes. - * * copyFrom: A helper function for getting your data onto the - * stream that meets the stream handling requirements - * above, and has the following signature: - * @param input nsIAsyncInputStream - * The stream to copy from. - * @return Promise - * The promise is resolved when copying completes or - * rejected if any (unexpected) errors occur. - * This object also emits "progress" events for each chunk - * that is copied. See stream-utils.js. - */ - startBulkSend: function (header) { - this.emit("startBulkSend", header); - - var packet = new BulkPacket(this); - packet.header = header; - this._outgoing.push(packet); - this._flushOutgoing(); - return packet.streamReadyForWriting; - }, - - /** - * Close the transport. - * @param reason nsresult / object (optional) - * The status code or error message that corresponds to the reason for - * closing the transport (likely because a stream closed or failed). - */ - close: function (reason) { - this.emit("onClosed", reason); - - this.active = false; - this._socket.close(); - this._destroyIncoming(); - this._destroyAllOutgoing(); - if (this.hooks) { - this.hooks.onClosed(reason); - this.hooks = null; - } - if (reason) { - dumpn("Transport closed: " + DevToolsUtils.safeErrorString(reason)); - } else { - dumpn("Transport closed."); - } - }, - - /** - * The currently outgoing packet (at the top of the queue). - */ - get _currentOutgoing() { - return this._outgoing[0]; - }, - - /** - * Flush data to the outgoing stream. Waits until the output stream notifies - * us that it is ready to be written to (via onOutputStreamReady). - */ - _flushOutgoing: function () { - if (!this._outgoingEnabled || this._outgoing.length === 0) { - return; - } - - // If the top of the packet queue has nothing more to send, remove it. - if (this._currentOutgoing.done) { - this._finishCurrentOutgoing(); - } - - if (this._outgoing.length > 0) { - setTimeout(this.onOutputStreamReady.bind(this), 0); - } - }, - - /** - * Pause this transport's attempts to write to the output stream. This is - * used when we've temporarily handed off our output stream for writing bulk - * data. - */ - pauseOutgoing: function () { - this._outgoingEnabled = false; - }, - - /** - * Resume this transport's attempts to write to the output stream. - */ - resumeOutgoing: function () { - this._outgoingEnabled = true; - this._flushOutgoing(); - }, - - // nsIOutputStreamCallback - /** - * This is called when the output stream is ready for more data to be written. - * The current outgoing packet will attempt to write some amount of data, but - * may not complete. - */ - onOutputStreamReady: DevToolsUtils.makeInfallible(function () { - if (!this._outgoingEnabled || this._outgoing.length === 0) { - return; - } - - try { - this._currentOutgoing.write({ - write: data => { - var count = data.length; - this._socket.send(data); - return count; - } - }); - } catch (e) { - if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK) { - this.close(e.result); - return; - } else { - throw e; - } - } - - this._flushOutgoing(); - }, "DebuggerTransport.prototype.onOutputStreamReady"), - - /** - * Remove the current outgoing packet from the queue upon completion. - */ - _finishCurrentOutgoing: function () { - if (this._currentOutgoing) { - this._currentOutgoing.destroy(); - this._outgoing.shift(); - } - }, - - /** - * Clear the entire outgoing queue. - */ - _destroyAllOutgoing: function () { - for (var packet of this._outgoing) { - packet.destroy(); - } - this._outgoing = []; - }, - - /** - * Initialize the input stream for reading. Once this method has been called, - * we watch for packets on the input stream, and pass them to the appropriate - * handlers via this.hooks. - */ - ready: function () { - this.active = true; - this._waitForIncoming(); - }, - - /** - * Asks the input stream to notify us (via onInputStreamReady) when it is - * ready for reading. - */ - _waitForIncoming: function () { - if (this._incomingEnabled && !this._socket.onmessage) { - this._socket.onmessage = this.onInputStreamReady.bind(this); - } - }, - - /** - * Pause this transport's attempts to read from the input stream. This is - * used when we've temporarily handed off our input stream for reading bulk - * data. - */ - pauseIncoming: function () { - this._incomingEnabled = false; - }, - - /** - * Resume this transport's attempts to read from the input stream. - */ - resumeIncoming: function () { - this._incomingEnabled = true; - this._flushIncoming(); - this._waitForIncoming(); - }, - - // nsIInputStreamCallback - /** - * Called when the stream is either readable or closed. - */ - onInputStreamReady: DevToolsUtils.makeInfallible(function (event) { - var data = event.data; - // TODO: ws-tcp-proxy decodes utf-8, but the transport expects to see the - // encoded bytes. Simplest step is to re-encode for now. - data = utf8.encode(data); - var stream = { - available() { - return data.length; - }, - readBytes(count) { - var result = data.slice(0, count); - data = data.slice(count); - return result; - } - }; - - try { - while (data && this._incomingEnabled && this._processIncoming(stream, stream.available())) {} - this._waitForIncoming(); - } catch (e) { - if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK) { - this.close(e.result); - } else { - throw e; - } - } - }, "DebuggerTransport.prototype.onInputStreamReady"), - - /** - * Process the incoming data. Will create a new currently incoming Packet if - * needed. Tells the incoming Packet to read as much data as it can, but - * reading may not complete. The Packet signals that its data is ready for - * delivery by calling one of this transport's _on*Ready methods (see - * ./packets.js and the _on*Ready methods below). - * @return boolean - * Whether incoming stream processing should continue for any - * remaining data. - */ - _processIncoming: function (stream, count) { - dumpv("Data available: " + count); - - if (!count) { - dumpv("Nothing to read, skipping"); - return false; - } - - try { - if (!this._incoming) { - dumpv("Creating a new packet from incoming"); - - if (!this._readHeader(stream)) { - return false; // Not enough data to read packet type - } - - // Attempt to create a new Packet by trying to parse each possible - // header pattern. - this._incoming = Packet.fromHeader(this._incomingHeader, this); - if (!this._incoming) { - throw new Error("No packet types for header: " + this._incomingHeader); - } - } - - if (!this._incoming.done) { - // We have an incomplete packet, keep reading it. - dumpv("Existing packet incomplete, keep reading"); - this._incoming.read(stream); - } - } catch (e) { - var msg = "Error reading incoming packet: (" + e + " - " + e.stack + ")"; - dumpn(msg); - - // Now in an invalid state, shut down the transport. - this.close(); - return false; - } - - if (!this._incoming.done) { - // Still not complete, we'll wait for more data. - dumpv("Packet not done, wait for more"); - return true; - } - - // Ready for next packet - this._flushIncoming(); - return true; - }, - - /** - * Read as far as we can into the incoming data, attempting to build up a - * complete packet header (which terminates with ":"). We'll only read up to - * PACKET_HEADER_MAX characters. - * @return boolean - * True if we now have a complete header. - */ - _readHeader: function (stream) { - var amountToRead = PACKET_HEADER_MAX - this._incomingHeader.length; - this._incomingHeader += StreamUtils.delimitedRead(stream, ":", amountToRead); - if (dumpv.wantVerbose) { - dumpv("Header read: " + this._incomingHeader); - } - - if (this._incomingHeader.endsWith(":")) { - if (dumpv.wantVerbose) { - dumpv("Found packet header successfully: " + this._incomingHeader); - } - return true; - } - - if (this._incomingHeader.length >= PACKET_HEADER_MAX) { - throw new Error("Failed to parse packet header!"); - } - - // Not enough data yet. - return false; - }, - - /** - * If the incoming packet is done, log it as needed and clear the buffer. - */ - _flushIncoming: function () { - if (!this._incoming.done) { - return; - } - if (dumpn.wantLogging) { - dumpn("Got: " + this._incoming); - } - this._destroyIncoming(); - }, - - /** - * Handler triggered by an incoming JSONPacket completing it's |read| method. - * Delivers the packet to this.hooks.onPacket. - */ - _onJSONObjectReady: function (object) { - DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { - // Ensure the transport is still alive by the time this runs. - if (this.active) { - this.emit("onPacket", object); - this.hooks.onPacket(object); - } - }, "DebuggerTransport instance's this.hooks.onPacket")); - }, - - /** - * Handler triggered by an incoming BulkPacket entering the |read| phase for - * the stream portion of the packet. Delivers info about the incoming - * streaming data to this.hooks.onBulkPacket. See the main comment on the - * transport at the top of this file for more details. - */ - _onBulkReadReady: function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { - // Ensure the transport is still alive by the time this runs. - if (this.active) { - var _hooks; - - this.emit.apply(this, ["onBulkPacket"].concat(args)); - (_hooks = this.hooks).onBulkPacket.apply(_hooks, args); - } - }, "DebuggerTransport instance's this.hooks.onBulkPacket")); - }, - - /** - * Remove all handlers and references related to the current incoming packet, - * either because it is now complete or because the transport is closing. - */ - _destroyIncoming: function () { - if (this._incoming) { - this._incoming.destroy(); - } - this._incomingHeader = ""; - this._incoming = null; - } - - }; - - exports.DebuggerTransport = DebuggerTransport; - - /** - * An adapter that handles data transfers between the debugger client and - * server when they both run in the same process. It presents the same API as - * DebuggerTransport, but instead of transmitting serialized messages across a - * connection it merely calls the packet dispatcher of the other side. - * - * @param other LocalDebuggerTransport - * The other endpoint for this debugger connection. - * - * @see DebuggerTransport - */ - function LocalDebuggerTransport(other) { - EventEmitter.decorate(this); - - this.other = other; - this.hooks = null; - - /* - * A packet number, shared between this and this.other. This isn't used - * by the protocol at all, but it makes the packet traces a lot easier to - * follow. - */ - this._serial = this.other ? this.other._serial : { count: 0 }; - this.close = this.close.bind(this); - } - - LocalDebuggerTransport.prototype = { - /** - * Transmit a message by directly calling the onPacket handler of the other - * endpoint. - */ - send: function (packet) { - this.emit("send", packet); - - var serial = this._serial.count++; - if (dumpn.wantLogging) { - /* Check 'from' first, as 'echo' packets have both. */ - if (packet.from) { - dumpn("Packet " + serial + " sent from " + uneval(packet.from)); - } else if (packet.to) { - dumpn("Packet " + serial + " sent to " + uneval(packet.to)); - } - } - this._deepFreeze(packet); - var other = this.other; - if (other) { - 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)); - } - if (other.hooks) { - other.emit("onPacket", packet); - other.hooks.onPacket(packet); - } - }, "LocalDebuggerTransport instance's this.other.hooks.onPacket")); - } - }, - - /** - * Send a streaming bulk packet directly to the onBulkPacket handler of the - * other endpoint. - * - * This case is much simpler than the full DebuggerTransport, since there is - * no primary stream we have to worry about managing while we hand it off to - * others temporarily. Instead, we can just make a single use pipe and be - * done with it. - */ - startBulkSend: function (_ref) { - var actor = _ref.actor, - type = _ref.type, - length = _ref.length; - - this.emit("startBulkSend", { actor, type, length }); - - var serial = this._serial.count++; - - dumpn("Sent bulk packet " + serial + " for actor " + actor); - if (!this.other) { - return; - } - - var pipe = new Pipe(true, true, 0, 0, null); - - DevToolsUtils.executeSoon(DevToolsUtils.makeInfallible(() => { - dumpn("Received bulk packet " + serial); - if (!this.other.hooks) { - return; - } - - // Receiver - var deferred = promise.defer(); - var packet = { - actor: actor, - type: type, - length: length, - copyTo: output => { - var copying = StreamUtils.copyStream(pipe.inputStream, output, length); - deferred.resolve(copying); - return copying; - }, - stream: pipe.inputStream, - done: deferred - }; - - this.other.emit("onBulkPacket", packet); - this.other.hooks.onBulkPacket(packet); - - // Await the result of reading from the stream - deferred.promise.then(() => pipe.inputStream.close(), this.close); - }, "LocalDebuggerTransport instance's this.other.hooks.onBulkPacket")); - - // Sender - var sendDeferred = promise.defer(); - - // The remote transport is not capable of resolving immediately here, so we - // shouldn't be able to either. - DevToolsUtils.executeSoon(() => { - var copyDeferred = promise.defer(); - - sendDeferred.resolve({ - copyFrom: input => { - var copying = StreamUtils.copyStream(input, pipe.outputStream, length); - copyDeferred.resolve(copying); - return copying; - }, - stream: pipe.outputStream, - done: copyDeferred - }); - - // Await the result of writing to the stream - copyDeferred.promise.then(() => pipe.outputStream.close(), this.close); - }); - - return sendDeferred.promise; - }, - - /** - * Close the transport. - */ - close: function () { - this.emit("close"); - - if (this.other) { - // Remove the reference to the other endpoint before calling close(), to - // avoid infinite recursion. - var other = this.other; - this.other = null; - other.close(); - } - if (this.hooks) { - try { - this.hooks.onClosed(); - } catch (ex) { - console.error(ex); - } - this.hooks = null; - } - }, - - /** - * An empty method for emulating the DebuggerTransport API. - */ - ready: function () {}, - - /** - * Helper function that makes an object fully immutable. - */ - _deepFreeze: function (object) { - Object.freeze(object); - for (var prop in object) { - // Freeze the properties that are objects, not on the prototype, and not - // already frozen. Note that this might leave an unfrozen reference - // somewhere in the object if there is an already frozen object containing - // an unfrozen object. - if (object.hasOwnProperty(prop) && typeof object === "object" && !Object.isFrozen(object)) { - this._deepFreeze(o[prop]); - } - } - } - }; - - exports.LocalDebuggerTransport = LocalDebuggerTransport; - - /** - * A transport for the debugging protocol that uses nsIMessageSenders to - * exchange packets with servers running in child processes. - * - * In the parent process, |sender| should be the nsIMessageSender for the - * child process. In a child process, |sender| should be the child process - * message manager, which sends packets to the parent. - * - * |prefix| is a string included in the message names, to distinguish - * multiple servers running in the same child process. - * - * This transport exchanges messages named 'debug::packet', where - * is |prefix|, whose data is the protocol packet. - */ - function ChildDebuggerTransport(sender, prefix) { - EventEmitter.decorate(this); - - this._sender = sender.QueryInterface(Ci.nsIMessageSender); - this._messageName = "debug:" + prefix + ":packet"; - } - - /* - * To avoid confusion, we use 'message' to mean something that - * nsIMessageSender conveys, and 'packet' to mean a remote debugging - * protocol packet. - */ - ChildDebuggerTransport.prototype = { - constructor: ChildDebuggerTransport, - - hooks: null, - - ready: function () { - this._sender.addMessageListener(this._messageName, this); - }, - - close: function () { - this._sender.removeMessageListener(this._messageName, this); - this.emit("onClosed"); - this.hooks.onClosed(); - }, - - receiveMessage: function (_ref2) { - var data = _ref2.data; - - this.emit("onPacket", data); - this.hooks.onPacket(data); - }, - - send: function (packet) { - this.emit("send", packet); - this._sender.sendAsyncMessage(this._messageName, packet); - }, - - startBulkSend: function () { - throw new Error("Can't send bulk data to child processes."); - } - }; - - exports.ChildDebuggerTransport = ChildDebuggerTransport; - - // WorkerDebuggerTransport is defined differently depending on whether we are - // on the main thread or a worker thread. In the former case, we are required - // by the devtools loader, and isWorker will be false. Otherwise, we are - // required by the worker loader, and isWorker will be true. - // - // Each worker debugger supports only a single connection to the main thread. - // However, its theoretically possible for multiple servers to connect to the - // 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') { - // i.e. not in a worker - (function () { - // Main thread - /** - * A transport that uses a WorkerDebugger to send packets from the main - * thread to a worker thread. - */ - function WorkerDebuggerTransport(dbg, id) { - this._dbg = dbg; - this._id = id; - this.onMessage = this._onMessage.bind(this); - } - - WorkerDebuggerTransport.prototype = { - constructor: WorkerDebuggerTransport, - - ready: function () { - this._dbg.addListener(this); - }, - - close: function () { - this._dbg.removeListener(this); - if (this.hooks) { - this.hooks.onClosed(); - } - }, - - send: function (packet) { - this._dbg.postMessage(JSON.stringify({ - type: "message", - id: this._id, - message: packet - })); - }, - - startBulkSend: function () { - throw new Error("Can't send bulk data from worker threads!"); - }, - - _onMessage: function (message) { - var packet = JSON.parse(message); - if (packet.type !== "message" || packet.id !== this._id) { - return; - } - - if (this.hooks) { - this.hooks.onPacket(packet.message); - } - } - }; - - exports.WorkerDebuggerTransport = WorkerDebuggerTransport; - }).call(undefined); - } else { - (function () { - // Worker thread - /* - * A transport that uses a WorkerDebuggerGlobalScope to send packets from a - * worker thread to the main thread. - */ - function WorkerDebuggerTransport(scope, id) { - this._scope = scope; - this._id = id; - this._onMessage = this._onMessage.bind(this); - } - - WorkerDebuggerTransport.prototype = { - constructor: WorkerDebuggerTransport, - - ready: function () { - this._scope.addEventListener("message", this._onMessage); - }, - - close: function () { - this._scope.removeEventListener("message", this._onMessage); - if (this.hooks) { - this.hooks.onClosed(); - } - }, - - send: function (packet) { - this._scope.postMessage(JSON.stringify({ - type: "message", - id: this._id, - message: packet - })); - }, - - startBulkSend: function () { - throw new Error("Can't send bulk data from worker threads!"); - }, - - _onMessage: function (event) { - var packet = JSON.parse(event.data); - if (packet.type !== "message" || packet.id !== this._id) { - return; - } - - if (this.hooks) { - this.hooks.onPacket(packet.message); - } - } - }; - - exports.WorkerDebuggerTransport = WorkerDebuggerTransport; - }).call(undefined); - } - -/***/ }, -/* 867 */ -/***/ 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__(834), - Ci = _require.Ci, - Cc = _require.Cc, - Cr = _require.Cr, - CC = _require.CC; - - var _require2 = __webpack_require__(29), - Services = _require2.Services; - - 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 ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream", "init"); - - var BUFFER_SIZE = 0x8000; - - /** - * This helper function (and its companion object) are used by bulk senders and - * receivers to read and write data in and out of other streams. Functions that - * make use of this tool are passed to callers when it is time to read or write - * bulk data. It is highly recommended to use these copier functions instead of - * the stream directly because the copier enforces the agreed upon length. - * Since bulk mode reuses an existing stream, the sender and receiver must write - * and read exactly the agreed upon amount of data, or else the entire transport - * will be left in a invalid state. Additionally, other methods of stream - * copying (such as NetUtil.asyncCopy) close the streams involved, which would - * terminate the debugging transport, and so it is avoided here. - * - * Overall, this *works*, but clearly the optimal solution would be able to just - * use the streams directly. If it were possible to fully implement - * nsIInputStream / nsIOutputStream in JS, wrapper streams could be created to - * enforce the length and avoid closing, and consumers could use familiar stream - * utilities like NetUtil.asyncCopy. - * - * The function takes two async streams and copies a precise number of bytes - * from one to the other. Copying begins immediately, but may complete at some - * future time depending on data size. Use the returned promise to know when - * it's complete. - * - * @param input nsIAsyncInputStream - * The stream to copy from. - * @param output nsIAsyncOutputStream - * The stream to copy to. - * @param length Integer - * The amount of data that needs to be copied. - * @return Promise - * 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); - } - - }; - - /** - * Read from a stream, one byte at a time, up to the next |delimiter| - * character, but stopping if we've read |count| without finding it. Reading - * also terminates early if there are less than |count| bytes available on the - * stream. In that case, we only read as many bytes as the stream currently has - * to offer. - * TODO: This implementation could be removed if bug 984651 is fixed, which - * provides a native version of the same idea. - * @param stream nsIInputStream - * The input stream to read from. - * @param delimiter string - * The character we're trying to find. - * @param count integer - * The max number of characters to read while searching. - * @return string - * The data collected. If the delimiter was found, this string will - * end with it. - */ - function delimitedRead(stream, delimiter, count) { - dumpv("Starting delimited read for " + delimiter + " up to " + count + " bytes"); - - var scriptableStream = void 0; - if (stream.readBytes) { - scriptableStream = stream; - } else { - scriptableStream = new ScriptableInputStream(stream); - } - - var data = ""; - - // Don't exceed what's available on the stream - count = Math.min(count, stream.available()); - - if (count <= 0) { - return data; - } - - var char = void 0; - while (char !== delimiter && count > 0) { - char = scriptableStream.readBytes(1); - count--; - data += char; - } - - return data; - } - - module.exports = { - copyStream: copyStream, - delimitedRead: delimitedRead - }; - -/***/ }, -/* 868 */ -/***/ 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"; - - /** - * Packets contain read / write functionality for the different packet types - * supported by the debugging protocol, so that a transport can focus on - * delivery and queue management without worrying too much about the specific - * packet types. - * - * They are intended to be "one use only", so a new packet should be - * instantiated for each incoming or outgoing packet. - * - * A complete Packet type should expose at least the following: - * * read(stream, scriptableStream) - * Called when the input stream has data to read - * * write(stream) - * Called when the output stream is ready to write - * * get done() - * Returns true once the packet is done being read / written - * * destroy() - * Called to clean up at the end of use - */ - - var _require = __webpack_require__(834), - Cc = _require.Cc, - Ci = _require.Ci, - Cu = _require.Cu; - - var DevToolsUtils = __webpack_require__(833); - var dumpn = DevToolsUtils.dumpn, - dumpv = DevToolsUtils.dumpv; - - var StreamUtils = __webpack_require__(867); - var promise = __webpack_require__(839); - - /*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); - - // 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 - // 1 TiB. - var PACKET_LENGTH_MAX = Math.pow(2, 40); - - /** - * A generic Packet processing object (extended by two subtypes below). - */ - function Packet(transport) { - this._transport = transport; - this._length = 0; - } - - /** - * Attempt to initialize a new Packet based on the incoming packet header we've - * received so far. We try each of the types in succession, trying JSON packets - * first since they are much more common. - * @param header string - * The packet header string to attempt parsing. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - * @return Packet - * The parsed packet of the matching type, or null if no types matched. - */ - Packet.fromHeader = function (header, transport) { - return JSONPacket.fromHeader(header, transport) || BulkPacket.fromHeader(header, transport); - }; - - Packet.prototype = { - - get length() { - return this._length; - }, - - set length(length) { - if (length > PACKET_LENGTH_MAX) { - throw Error("Packet length " + length + " exceeds the max length of " + PACKET_LENGTH_MAX); - } - this._length = length; - }, - - destroy: function () { - this._transport = null; - } - - }; - - exports.Packet = Packet; - - /** - * With a JSON packet (the typical packet type sent via the transport), data is - * transferred as a JSON packet serialized into a string, with the string length - * prepended to the packet, followed by a colon ([length]:[packet]). The - * contents of the JSON packet are specified in the Remote Debugging Protocol - * specification. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - */ - function JSONPacket(transport) { - Packet.call(this, transport); - this._data = ""; - this._done = false; - } - - /** - * Attempt to initialize a new JSONPacket based on the incoming packet header - * we've received so far. - * @param header string - * The packet header string to attempt parsing. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - * @return JSONPacket - * The parsed packet, or null if it's not a match. - */ - JSONPacket.fromHeader = function (header, transport) { - var match = this.HEADER_PATTERN.exec(header); - - if (!match) { - return null; - } - - dumpv("Header matches JSON packet"); - var packet = new JSONPacket(transport); - packet.length = +match[1]; - return packet; - }; - - JSONPacket.HEADER_PATTERN = /^(\d+):$/; - - JSONPacket.prototype = Object.create(Packet.prototype); - - Object.defineProperty(JSONPacket.prototype, "object", { - /** - * Gets the object (not the serialized string) being read or written. - */ - get: function () { - return this._object; - }, - - /** - * Sets the object to be sent when write() is called. - */ - set: function (object) { - this._object = object; - var data = JSON.stringify(object); - this._data = data; - this.length = this._data.length; - } - }); - - JSONPacket.prototype.read = function (stream, scriptableStream) { - dumpv("Reading JSON packet"); - - // Read in more packet data. - this._readData(stream, scriptableStream); - - if (!this.done) { - // Don't have a complete packet yet. - return; - } - - var json = this._data; - try { - json = utf8.decode(json); - this._object = JSON.parse(json); - } catch (e) { - var msg = "Error parsing incoming packet: " + json + " (" + e + " - " + e.stack + ")"; - if (console.error) { - console.error(msg); - } - dumpn(msg); - return; - } - - this._transport._onJSONObjectReady(this._object); - }; - - JSONPacket.prototype._readData = function (stream, scriptableStream) { - if (!scriptableStream) { - scriptableStream = stream; - } - if (dumpv.wantVerbose) { - dumpv("Reading JSON data: _l: " + this.length + " dL: " + this._data.length + " sA: " + stream.available()); - } - var bytesToRead = Math.min(this.length - this._data.length, stream.available()); - this._data += scriptableStream.readBytes(bytesToRead); - this._done = this._data.length === this.length; - }; - - JSONPacket.prototype.write = function (stream) { - dumpv("Writing JSON packet"); - - if (this._outgoing === undefined) { - // Format the serialized packet to a buffer - this._outgoing = this.length + ":" + this._data; - } - - var written = stream.write(this._outgoing, this._outgoing.length); - this._outgoing = this._outgoing.slice(written); - this._done = !this._outgoing.length; - }; - - Object.defineProperty(JSONPacket.prototype, "done", { - get: function () { - return this._done; - } - }); - - JSONPacket.prototype.toString = function () { - return JSON.stringify(this._object, null, 2); - }; - - exports.JSONPacket = JSONPacket; - - /** - * With a bulk packet, data is transferred by temporarily handing over the - * transport's input or output stream to the application layer for writing data - * directly. This can be much faster for large data sets, and avoids various - * stages of copies and data duplication inherent in the JSON packet type. The - * bulk packet looks like: - * - * bulk [actor] [type] [length]:[data] - * - * The interpretation of the data portion depends on the kind of actor and the - * packet's type. See the Remote Debugging Protocol Stream Transport spec for - * more details. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - */ - function BulkPacket(transport) { - Packet.call(this, transport); - this._done = false; - this._readyForWriting = promise.defer(); - } - - /** - * Attempt to initialize a new BulkPacket based on the incoming packet header - * we've received so far. - * @param header string - * The packet header string to attempt parsing. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - * @return BulkPacket - * The parsed packet, or null if it's not a match. - */ - BulkPacket.fromHeader = function (header, transport) { - var match = this.HEADER_PATTERN.exec(header); - - if (!match) { - return null; - } - - dumpv("Header matches bulk packet"); - var packet = new BulkPacket(transport); - packet.header = { - actor: match[1], - type: match[2], - length: +match[3] - }; - return packet; - }; - - BulkPacket.HEADER_PATTERN = /^bulk ([^: ]+) ([^: ]+) (\d+):$/; - - BulkPacket.prototype = Object.create(Packet.prototype); - - BulkPacket.prototype.read = function (stream) { - dumpv("Reading bulk packet, handing off input stream"); - - // Temporarily pause monitoring of the input stream - this._transport.pauseIncoming(); - - var deferred = promise.defer(); - - this._transport._onBulkReadReady({ - actor: this.actor, - type: this.type, - length: this.length, - copyTo: output => { - dumpv("CT length: " + this.length); - var copying = StreamUtils.copyStream(stream, output, this.length); - deferred.resolve(copying); - return copying; - }, - stream: stream, - done: deferred - }); - - // Await the result of reading from the stream - deferred.promise.then(() => { - dumpv("onReadDone called, ending bulk mode"); - this._done = true; - this._transport.resumeIncoming(); - }, this._transport.close); - - // Ensure this is only done once - this.read = () => { - throw new Error("Tried to read() a BulkPacket's stream multiple times."); - }; - }; - - BulkPacket.prototype.write = function (stream) { - dumpv("Writing bulk packet"); - - if (this._outgoingHeader === undefined) { - dumpv("Serializing bulk packet header"); - // Format the serialized packet header to a buffer - this._outgoingHeader = "bulk " + this.actor + " " + this.type + " " + this.length + ":"; - } - - // Write the header, or whatever's left of it to write. - if (this._outgoingHeader.length) { - dumpv("Writing bulk packet header"); - var written = stream.write(this._outgoingHeader, this._outgoingHeader.length); - this._outgoingHeader = this._outgoingHeader.slice(written); - return; - } - - dumpv("Handing off output stream"); - - // Temporarily pause the monitoring of the output stream - this._transport.pauseOutgoing(); - - var deferred = promise.defer(); - - this._readyForWriting.resolve({ - copyFrom: input => { - dumpv("CF length: " + this.length); - var copying = StreamUtils.copyStream(input, stream, this.length); - deferred.resolve(copying); - return copying; - }, - stream: stream, - done: deferred - }); - - // Await the result of writing to the stream - deferred.promise.then(() => { - dumpv("onWriteDone called, ending bulk mode"); - this._done = true; - this._transport.resumeOutgoing(); - }, this._transport.close); - - // Ensure this is only done once - this.write = () => { - throw new Error("Tried to write() a BulkPacket's stream multiple times."); - }; - }; - - Object.defineProperty(BulkPacket.prototype, "streamReadyForWriting", { - get: function () { - return this._readyForWriting.promise; - } - }); - - Object.defineProperty(BulkPacket.prototype, "header", { - get: function () { - return { - actor: this.actor, - type: this.type, - length: this.length - }; - }, - - set: function (header) { - this.actor = header.actor; - this.type = header.type; - this.length = header.length; - } - }); - - Object.defineProperty(BulkPacket.prototype, "done", { - get: function () { - return this._done; - } - }); - - BulkPacket.prototype.toString = function () { - return "Bulk: " + JSON.stringify(this.header, null, 2); - }; - - exports.BulkPacket = BulkPacket; - - /** - * RawPacket is used to test the transport's error handling of malformed - * packets, by writing data directly onto the stream. - * @param transport DebuggerTransport - * The transport instance that will own the packet. - * @param data string - * The raw string to send out onto the stream. - */ - function RawPacket(transport, data) { - Packet.call(this, transport); - this._data = data; - this.length = data.length; - this._done = false; - } - - RawPacket.prototype = Object.create(Packet.prototype); - - RawPacket.prototype.read = function (stream) { - // This hasn't yet been needed for testing. - throw Error("Not implmented."); - }; - - RawPacket.prototype.write = function (stream) { - var written = stream.write(this._data, this._data.length); - this._data = this._data.slice(written); - this._done = !this._data.length; - }; - - Object.defineProperty(RawPacket.prototype, "done", { - get: function () { - return this._done; - } - }); - - exports.RawPacket = RawPacket; - -/***/ }, -/* 869 */ -/***/ 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; }()))) - -/***/ }, -/* 870 */ -/***/ 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__) { - - /* 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; - - 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); - } - } - - 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"); - return; - } - - this.topWindow.removeEventListener("click", this._onClick, true); - this.container.classList.remove("tooltip-visible"); - if (this.useXulWrapper) { - yield this._hideXulWrapper(); - } - - 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"); - }, - - /** - * 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(); - } - }, - - _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; - }, - - _onClick: function (e) { - if (this._isInTooltipContainer(e.target)) { - return; - } - - this.hide(); - if (this.consumeOutsideClicks && e.button === 0) { - // Consume only left click events (button === 0). - e.preventDefault(); - e.stopPropagation(); - } - }, - - _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(); - } - }, - - /** - * 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(); - } - }, - - _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(); - } - - 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); - } - }; - -/***/ }, -/* 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 */ -/***/ 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__(839); - var EventEmitter = __webpack_require__(844); - - /* const { DebuggerServer } = require("../../server/main");*/ - - var _require = __webpack_require__(862), - DebuggerClient = _require.DebuggerClient; - - var targets = new WeakMap(); - var promiseTargets = new WeakMap(); - - /** - * Functions for creating Targets - */ - exports.TargetFactory = { - /** - * Construct a Target - * @param {XULTab} tab - * The tab to use in creating a new target. - * - * @return A target object - */ - forTab: function (tab) { - var target = targets.get(tab); - if (target == null) { - target = new TabTarget(tab); - targets.set(tab, target); - } - return target; - }, - - /** - * Return a promise of a Target for a remote tab. - * @param {Object} options - * The options object has the following properties: - * { - * form: the remote protocol form of a tab, - * client: a DebuggerClient instance - * (caller owns this and is responsible for closing), - * chrome: true if the remote target is the whole process - * } - * - * @return A promise of a target object - */ - forRemoteTab: function (options) { - var targetPromise = promiseTargets.get(options); - if (targetPromise == null) { - var target = new TabTarget(options); - targetPromise = target.makeRemote().then(() => target); - promiseTargets.set(options, targetPromise); - } - return targetPromise; - }, - - forWorker: function (workerClient) { - var target = targets.get(workerClient); - if (target == null) { - target = new WorkerTarget(workerClient); - targets.set(workerClient, target); - } - return target; - }, - - /** - * Creating a target for a tab that is being closed is a problem because it - * allows a leak as a result of coming after the close event which normally - * clears things up. This function allows us to ask if there is a known - * target for a tab without creating a target - * @return true/false - */ - isKnownTab: function (tab) { - return targets.has(tab); - } - }; - - /** - * A Target represents something that we can debug. Targets are generally - * read-only. Any changes that you wish to make to a target should be done via - * a Tool that attaches to the target. i.e. a Target is just a pointer saying - * "the thing to debug is over there". - * - * Providing a generalized abstraction of a web-page or web-browser (available - * either locally or remotely) is beyond the scope of this class (and maybe - * also beyond the scope of this universe) However Target does attempt to - * abstract some common events and read-only properties common to many Tools. - * - * Supported read-only properties: - * - name, isRemote, url - * - * Target extends EventEmitter and provides support for the following events: - * - close: The target window has been closed. All tools attached to this - * target should close. This event is not currently cancelable. - * - navigate: The target window has navigated to a different URL - * - * Optional events: - * - will-navigate: The target window will navigate to a different URL - * - hidden: The target is not visible anymore (for TargetTab, another tab is - * selected) - * - visible: The target is visible (for TargetTab, tab is selected) - * - * Comparing Targets: 2 instances of a Target object can point at the same - * thing, so t1 !== t2 and t1 != t2 even when they represent the same object. - * To compare to targets use 't1.equals(t2)'. - */ - - /** - * A TabTarget represents a page living in a browser tab. Generally these will - * be web pages served over http(s), but they don't have to be. - */ - function TabTarget(tab) { - EventEmitter.decorate(this); - this.destroy = this.destroy.bind(this); - this._handleThreadState = this._handleThreadState.bind(this); - this.on("thread-resumed", this._handleThreadState); - this.on("thread-paused", this._handleThreadState); - this.activeTab = this.activeConsole = null; - // Only real tabs need initialization here. Placeholder objects for remote - // targets will be initialized after a makeRemote method call. - if (tab && !["client", "form", "chrome"].every(tab.hasOwnProperty, tab)) { - this._tab = tab; - this._setupListeners(); - } else { - this._form = tab.form; - this._client = tab.client; - this._chrome = tab.chrome; - } - // Default isTabActor to true if not explicitly specified - if (typeof tab.isTabActor == "boolean") { - this._isTabActor = tab.isTabActor; - } else { - this._isTabActor = true; - } - } - - TabTarget.prototype = { - _webProgressListener: null, - - /** - * Returns a promise for the protocol description from the root actor. Used - * internally with `target.actorHasMethod`. Takes advantage of caching if - * definition was fetched previously with the corresponding actor information. - * Actors are lazily loaded, so not only must the tool using a specific actor - * be in use, the actors are only registered after invoking a method (for - * performance reasons, added in bug 988237), so to use these actor detection - * methods, one must already be communicating with a specific actor of that - * type. - * - * Must be a remote target. - * - * @return {Promise} - * { - * "category": "actor", - * "typeName": "longstractor", - * "methods": [{ - * "name": "substring", - * "request": { - * "type": "substring", - * "start": { - * "_arg": 0, - * "type": "primitive" - * }, - * "end": { - * "_arg": 1, - * "type": "primitive" - * } - * }, - * "response": { - * "substring": { - * "_retval": "primitive" - * } - * } - * }], - * "events": {} - * } - */ - getActorDescription: function (actorName) { - if (!this.client) { - throw new Error("TabTarget#getActorDescription() can only be called on " + "remote tabs."); - } - - var deferred = promise.defer(); - - if (this._protocolDescription && this._protocolDescription.types[actorName]) { - deferred.resolve(this._protocolDescription.types[actorName]); - } else { - this.client.mainRoot.protocolDescription(description => { - this._protocolDescription = description; - deferred.resolve(description.types[actorName]); - }); - } - - return deferred.promise; - }, - - /** - * Returns a boolean indicating whether or not the specific actor - * type exists. Must be a remote target. - * - * @param {String} actorName - * @return {Boolean} - */ - hasActor: function (actorName) { - if (!this.client) { - throw new Error("TabTarget#hasActor() can only be called on remote " + "tabs."); - } - if (this.form) { - return !!this.form[actorName + "Actor"]; - } - return false; - }, - - /** - * Queries the protocol description to see if an actor has - * an available method. The actor must already be lazily-loaded (read - * the restrictions in the `getActorDescription` comments), - * so this is for use inside of tool. Returns a promise that - * resolves to a boolean. Must be a remote target. - * - * @param {String} actorName - * @param {String} methodName - * @return {Promise} - */ - actorHasMethod: function (actorName, methodName) { - if (!this.client) { - throw new Error("TabTarget#actorHasMethod() can only be called on " + "remote tabs."); - } - return this.getActorDescription(actorName).then(desc => { - if (desc && desc.methods) { - return !!desc.methods.find(method => method.name === methodName); - } - return false; - }); - }, - - /** - * Returns a trait from the root actor. - * - * @param {String} traitName - * @return {Mixed} - */ - getTrait: function (traitName) { - if (!this.client) { - throw new Error("TabTarget#getTrait() can only be called on remote " + "tabs."); - } - - // If the targeted actor exposes traits and has a defined value for this - // traits, override the root actor traits - if (this.form.traits && traitName in this.form.traits) { - return this.form.traits[traitName]; - } - - return this.client.traits[traitName]; - }, - - get tab() { - return this._tab; - }, - - get form() { - return this._form; - }, - - // Get a promise of the root form returned by a listTabs request. This promise - // is cached. - get root() { - if (!this._root) { - this._root = this._getRoot(); - } - return this._root; - }, - - _getRoot: function () { - return new Promise((resolve, reject) => { - this.client.listTabs(response => { - if (response.error) { - reject(new Error(response.error + ": " + response.message)); - return; - } - - resolve(response); - }); - }); - }, - - get client() { - return this._client; - }, - - // Tells us if we are debugging content document - // or if we are debugging chrome stuff. - // Allows to controls which features are available against - // a chrome or a content document. - get chrome() { - return this._chrome; - }, - - // Tells us if the related actor implements TabActor interface - // and requires to call `attach` request before being used - // and `detach` during cleanup - get isTabActor() { - return this._isTabActor; - }, - - get window() { - // XXX - this is a footgun for e10s - there .contentWindow will be null, - // and even though .contentWindowAsCPOW *might* work, it will not work - // in all contexts. Consumers of .window need to be refactored to not - // rely on this. - // if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { - // console.error("The .window getter on devtools' |target| object isn't " + - // "e10s friendly!\n" + Error().stack); - // } - // Be extra careful here, since this may be called by HS_getHudByWindow - // during shutdown. - if (this._tab && this._tab.linkedBrowser) { - return this._tab.linkedBrowser.contentWindow; - } - return null; - }, - - get name() { - if (this._tab && this._tab.linkedBrowser.contentDocument) { - return this._tab.linkedBrowser.contentDocument.title; - } - if (this.isAddon) { - return this._form.name; - } - return this._form.title; - }, - - get url() { - return this._tab ? this._tab.linkedBrowser.currentURI.spec : this._form.url; - }, - - get isRemote() { - return !this.isLocalTab; - }, - - get isAddon() { - return !!(this._form && this._form.actor && this._form.actor.match(/conn\d+\.addon\d+/)); - }, - - get isLocalTab() { - return !!this._tab; - }, - - get isMultiProcess() { - return !this.window; - }, - - get isThreadPaused() { - return !!this._isThreadPaused; - }, - - /** - * Adds remote protocol capabilities to the target, so that it can be used - * for tools that support the Remote Debugging Protocol even for local - * connections. - */ - makeRemote: function () { - if (this._remote) { - return this._remote.promise; - } - - this._remote = promise.defer(); - - if (this.isLocalTab) { - // Since a remote protocol connection will be made, let's start the - // DebuggerServer here, once and for all tools. - if (!DebuggerServer.initialized) { - DebuggerServer.init(); - DebuggerServer.addBrowserActors(); - } - - this._client = new DebuggerClient(DebuggerServer.connectPipe()); - // A local TabTarget will never perform chrome debugging. - this._chrome = false; - } - - this._setupRemoteListeners(); - - var attachTab = () => { - this._client.attachTab(this._form.actor, (response, tabClient) => { - if (!tabClient) { - this._remote.reject("Unable to attach to the tab"); - return; - } - this.activeTab = tabClient; - this.threadActor = response.threadActor; - attachConsole(); - }); - }; - - var onConsoleAttached = (response, consoleClient) => { - if (!consoleClient) { - this._remote.reject("Unable to attach to the console"); - return; - } - this.activeConsole = consoleClient; - this._remote.resolve(null); - }; - - var attachConsole = () => { - this._client.attachConsole(this._form.consoleActor, ["NetworkActivity"], onConsoleAttached); - }; - - if (this.isLocalTab) { - this._client.connect(() => { - this._client.getTab({ tab: this.tab }).then(response => { - this._form = response.tab; - attachTab(); - }); - }); - } else if (this.isTabActor) { - // In the remote debugging case, the protocol connection will have been - // already initialized in the connection screen code. - attachTab(); - } else { - // AddonActor and chrome debugging on RootActor doesn't inherits from - // TabActor and doesn't need to be attached. - attachConsole(); - } - - return this._remote.promise; - }, - - /** - * Listen to the different events. - */ - _setupListeners: function () { - this._webProgressListener = new TabWebProgressListener(this); - this.tab.linkedBrowser.addProgressListener(this._webProgressListener); - this.tab.addEventListener("TabClose", this); - this.tab.parentNode.addEventListener("TabSelect", this); - this.tab.ownerDocument.defaultView.addEventListener("unload", this); - }, - - /** - * Teardown event listeners. - */ - _teardownListeners: function () { - if (this._webProgressListener) { - this._webProgressListener.destroy(); - } - - this._tab.ownerDocument.defaultView.removeEventListener("unload", this); - this._tab.removeEventListener("TabClose", this); - this._tab.parentNode.removeEventListener("TabSelect", this); - }, - - /** - * Setup listeners for remote debugging, updating existing ones as necessary. - */ - _setupRemoteListeners: function () { - this.client.addListener("closed", this.destroy); - - this._onTabDetached = (aType, aPacket) => { - // We have to filter message to ensure that this detach is for this tab - if (aPacket.from == this._form.actor) { - this.destroy(); - } - }; - this.client.addListener("tabDetached", this._onTabDetached); - - this._onTabNavigated = (aType, aPacket) => { - var event = Object.create(null); - event.url = aPacket.url; - event.title = aPacket.title; - event.nativeConsoleAPI = aPacket.nativeConsoleAPI; - event.isFrameSwitching = aPacket.isFrameSwitching; - // Send any stored event payload (DOMWindow or nsIRequest) for backwards - // compatibility with non-remotable tools. - if (aPacket.state == "start") { - event._navPayload = this._navRequest; - this.emit("will-navigate", event); - this._navRequest = null; - } else { - event._navPayload = this._navWindow; - this.emit("navigate", event); - this._navWindow = null; - } - }; - this.client.addListener("tabNavigated", this._onTabNavigated); - - this._onFrameUpdate = (aType, aPacket) => { - this.emit("frame-update", aPacket); - }; - this.client.addListener("frameUpdate", this._onFrameUpdate); - }, - - /** - * Teardown listeners for remote debugging. - */ - _teardownRemoteListeners: function () { - this.client.removeListener("closed", this.destroy); - this.client.removeListener("tabNavigated", this._onTabNavigated); - this.client.removeListener("tabDetached", this._onTabDetached); - this.client.removeListener("frameUpdate", this._onFrameUpdate); - }, - - /** - * Handle tabs events. - */ - handleEvent: function (event) { - switch (event.type) { - case "TabClose": - case "unload": - this.destroy(); - break; - case "TabSelect": - if (this.tab.selected) { - this.emit("visible", event); - } else { - this.emit("hidden", event); - } - break; - } - }, - - /** - * Handle script status. - */ - _handleThreadState: function (event) { - switch (event) { - case "thread-resumed": - this._isThreadPaused = false; - break; - case "thread-paused": - this._isThreadPaused = true; - break; - } - }, - - /** - * Target is not alive anymore. - */ - destroy: function () { - // If several things call destroy then we give them all the same - // destruction promise so we're sure to destroy only once - if (this._destroyer) { - return this._destroyer.promise; - } - - this._destroyer = promise.defer(); - - // Before taking any action, notify listeners that destruction is imminent. - this.emit("close"); - - // First of all, do cleanup tasks that pertain to both remoted and - // non-remoted targets. - this.off("thread-resumed", this._handleThreadState); - this.off("thread-paused", this._handleThreadState); - - if (this._tab) { - this._teardownListeners(); - } - - var cleanupAndResolve = () => { - this._cleanup(); - this._destroyer.resolve(null); - }; - // If this target was not remoted, the promise will be resolved before the - // function returns. - if (this._tab && !this._client) { - cleanupAndResolve(); - } else if (this._client) { - // If, on the other hand, this target was remoted, the promise will be - // resolved after the remote connection is closed. - this._teardownRemoteListeners(); - - if (this.isLocalTab) { - // We started with a local tab and created the client ourselves, so we - // should close it. - this._client.close(cleanupAndResolve); - } else if (this.activeTab) { - // The client was handed to us, so we are not responsible for closing - // it. We just need to detach from the tab, if already attached. - // |detach| may fail if the connection is already dead, so proceed with - // cleanup directly after this. - this.activeTab.detach(); - cleanupAndResolve(); - } else { - cleanupAndResolve(); - } - } - - return this._destroyer.promise; - }, - - /** - * Clean up references to what this target points to. - */ - _cleanup: function () { - if (this._tab) { - targets.delete(this._tab); - } else { - promiseTargets.delete(this._form); - } - this.activeTab = null; - this.activeConsole = null; - this._client = null; - this._tab = null; - this._form = null; - this._remote = null; - }, - - toString: function () { - var id = this._tab ? this._tab : this._form && this._form.actor; - return `TabTarget:${id}`; - } - }; - - function WorkerTarget(workerClient) { - EventEmitter.decorate(this); - this._workerClient = workerClient; - } - - /** - * A WorkerTarget represents a worker. Unlike TabTarget, which can represent - * either a local or remote tab, WorkerTarget always represents a remote worker. - * Moreover, unlike TabTarget, which is constructed with a placeholder object - * for remote tabs (from which a TabClient can then be lazily obtained), - * WorkerTarget is constructed with a WorkerClient directly. - * - * WorkerClient is designed to mimic the interface of TabClient as closely as - * possible. This allows us to debug workers as if they were ordinary tabs, - * requiring only minimal changes to the rest of the frontend. - */ - WorkerTarget.prototype = { - destroy: function () {}, - - get isRemote() { - return true; - }, - - get isTabActor() { - return true; - }, - - get url() { - return this._workerClient.url; - }, - - get isWorkerTarget() { - return true; - }, - - get form() { - return { - consoleActor: this._workerClient.consoleActor - }; - }, - - get activeTab() { - return this._workerClient; - }, - - get client() { - return this._workerClient.client; - }, - - destroy: function () {}, - - hasActor: function (name) { - return false; - }, - - getTrait: function () { - return undefined; - }, - - makeRemote: function () { - return Promise.resolve(); - } - }; - -/***/ }, -/* 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 */ -/***/ 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 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)) { - 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 - })); - } - } - - 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 - }; - -/***/ }, -/* 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 - })); - } - - return span({}, key, span({ - "className": "objectEqual" - }, equal), Rep(Object.assign({}, this.props)), span({ - "className": "objectComma" - }, delim)); - }) - }); - - // Exports from this module - module.exports = 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), - 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; - } - return object.preview && object.preview.ownProperties; - } - - // Grip is used in propIterator and has to be defined here. - var Grip = { - rep: GripRep, - supportsObject: 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. - */ - - 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]; - } - - 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: "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)); - }; - - return objectLink({ - className: "objectBox objectBox-regexp regexpSource" - }, this.getSource(object)); - }) - }); - - // Registration - - function supportsObject(object, type) { - if (!isGrip(object)) { - return false; - } - - return type == "RegExp"; - } - - // Exports from this module - module.exports = { - rep: RegExp, - supportsObject: 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, - 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; - } - - return type == "CSSStyleSheet"; - } - - // 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 (blackBoxCheckboxTooltip): The tooltip text to display when\n# the user hovers over the checkbox used to toggle black boxing its associated\n# source.\nblackBoxCheckboxTooltip=Toggle black boxing\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.jumpToMappedLocation): Context menu item\n# for navigating to a source mapped location\neditor.jumpToMappedLocation=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 black box button\nsourceFooter.blackbox=Blackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.unblackbox): Tooltip text associated\n# with the black box button\nsourceFooter.unblackbox=Unblackbox Source\n\n# LOCALIZATION NOTE (sourceFooter.blackbox.accesskey): Access key to black box\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, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.SourceEditorUtils = exports.SourceEditor = undefined; - - var _sourceEditor = __webpack_require__(966); - - var _sourceEditor2 = _interopRequireDefault(_sourceEditor); - - var _utils = __webpack_require__(969); - - var SourceEditorUtils = _interopRequireWildcard(_utils); - - 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 }; } - - exports.SourceEditor = _sourceEditor2.default; - 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 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, -/* 968 */, -/* 969 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.removeLineClass = removeLineClass; - exports.clearLineClass = clearLineClass; - exports.getTextForLine = getTextForLine; - exports.getCursorLine = getCursorLine; - exports.resizeBreakpointGutter = resizeBreakpointGutter; - function forEachLine(codeMirror, iter) { - codeMirror.doc.iter(0, codeMirror.lineCount(), iter); - } - - function removeLineClass(codeMirror, line, className) { - codeMirror.removeLineClass(line, "line", className); - } - - function clearLineClass(codeMirror, className) { - forEachLine(codeMirror, line => { - removeLineClass(codeMirror, line, className); - }); - } - - function getTextForLine(codeMirror, line) { - return codeMirror.getLine(line - 1).trim(); - } - - function getCursorLine(codeMirror) { - return codeMirror.getCursor().line; - } - - /** - * Forces the breakpoint gutter to be the same size as the line - * numbers gutter. Editor CSS will absolutely position the gutter - * beneath the line numbers. This makes it easy to be flexible with - * how we overlay breakpoints. - */ - function resizeBreakpointGutter(editor) { - var gutters = editor.display.gutters; - var lineNumbers = gutters.querySelector(".CodeMirror-linenumbers"); - var breakpoints = gutters.querySelector(".breakpoints"); - breakpoints.style.width = `${lineNumbers.clientWidth}px`; - } - -/***/ }, -/* 970 */ -/***/ function(module, exports) { - - module.exports = "" - -/***/ }, -/* 971 */ -/***/ function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }, -/* 972 */, -/* 973 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.default = simplifyDisplayName; - // Decodes an anonymous naming scheme that - // spider monkey implements based on "Naming Anonymous JavaScript Functions" - // http://johnjbarton.github.io/nonymous/index.html - var objectProperty = /([\w\d]+)$/; - var arrayProperty = /\[(.*?)\]$/; - var functionProperty = /([\w\d]+)[\/\.<]*?$/; - var annonymousProperty = /([\w\d]+)\(\^\)$/; - - function simplifyDisplayName(displayName) { - var scenarios = [objectProperty, arrayProperty, functionProperty, annonymousProperty]; - - for (var reg of scenarios) { - var match = reg.exec(displayName); - if (match) { - return match[1]; - } - } - - return displayName; - } - /***/ } /******/ ]) }); -; \ No newline at end of file +; diff --git a/devtools/client/debugger/new/moz.build b/devtools/client/debugger/new/moz.build index 2711b17f3ce5..b08bea976d5e 100644 --- a/devtools/client/debugger/new/moz.build +++ b/devtools/client/debugger/new/moz.build @@ -7,6 +7,6 @@ DevToolsModules( 'debugger.css', 'debugger.js', 'panel.js', - 'parser-worker.js', 'pretty-print-worker.js', + 'source-map-worker.js' ) diff --git a/devtools/client/debugger/new/panel.js b/devtools/client/debugger/new/panel.js index d51164e8a3af..62d4a9f4f6dc 100644 --- a/devtools/client/debugger/new/panel.js +++ b/devtools/client/debugger/new/panel.js @@ -4,7 +4,7 @@ "use strict"; const { Task } = require("devtools/shared/task"); -var { LocalizationHelper } = require("devtools/shared/l10n"); +var {LocalizationHelper} = require("devtools/shared/l10n"); const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties"; var L10N = new LocalizationHelper(DBG_STRINGS_URI); @@ -16,46 +16,38 @@ function DebuggerPanel(iframeWindow, toolbox) { } DebuggerPanel.prototype = { - open: async function() { + open: Task.async(function* () { if (!this.toolbox.target.isRemote) { - await this.toolbox.target.makeRemote(); + yield this.toolbox.target.makeRemote(); } - const { - actions, - store, - selectors, - client - } = await this.panelWin.Debugger.bootstrap({ + yield this.panelWin.Debugger.bootstrap({ threadClient: this.toolbox.threadClient, - tabTarget: this.toolbox.target, - debuggerClient: this.toolbox.target._client, - sourceMaps: this.toolbox.sourceMapService + tabTarget: this.toolbox.target }); - this._actions = actions; - this._store = store; - this._selectors = selectors; - this._client = client; this.isReady = true; return this; + }), + + _store: function () { + return this.panelWin.Debugger.store; }, - getVarsForTests() { - return { - store: this._store, - selectors: this._selectors, - actions: this._actions, - client: this._client - }; + _getState: function () { + return this._store().getState(); }, - _getState: function() { - return this._store.getState(); + _actions: function () { + return this.panelWin.Debugger.actions; }, - getFrames: function() { - let frames = this._selectors.getFrames(this._getState()); + _selectors: function () { + return this.panelWin.Debugger.selectors; + }, + + getFrames: function () { + let frames = this._selectors().getFrames(this._getState()); // Frames is null when the debugger is not paused. if (!frames) { @@ -66,7 +58,7 @@ DebuggerPanel.prototype = { } frames = frames.toJS(); - const selectedFrame = this._selectors.getSelectedFrame(this._getState()); + const selectedFrame = this._selectors().getSelectedFrame(this._getState()); const selected = frames.findIndex(frame => frame.id == selectedFrame.id); frames.forEach(frame => { @@ -76,15 +68,7 @@ DebuggerPanel.prototype = { return { frames, selected }; }, - selectSource(sourceURL, sourceLine) { - this._actions.selectSourceURL(sourceURL, { line: sourceLine }); - }, - - getSource(sourceURL) { - return this._selectors.getSourceByURL(this._getState(), sourceURL); - }, - - destroy: function() { + destroy: function () { this.panelWin.Debugger.destroy(); this.emit("destroyed"); } diff --git a/devtools/client/debugger/new/parser-worker.js b/devtools/client/debugger/new/parser-worker.js deleted file mode 100644 index f36c068fcf03..000000000000 --- a/devtools/client/debugger/new/parser-worker.js +++ /dev/null @@ -1,29381 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("devtools/shared/flags")); - else if(typeof define === 'function' && define.amd) - define(["devtools/shared/flags"], factory); - else { - var a = typeof exports === 'object' ? factory(require("devtools/shared/flags")) : factory(root["devtools/shared/flags"]); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; - } -})(this, function(__WEBPACK_EXTERNAL_MODULE_121__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/assets/build"; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(961); - - -/***/ }, -/* 1 */, -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetTag = __webpack_require__(6), - getPrototype = __webpack_require__(12), - isObjectLike = __webpack_require__(14); - - /** `Object#toString` result references. */ - var objectTag = '[object Object]'; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - module.exports = isPlainObject; - - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - var Symbol = __webpack_require__(7), - getRawTag = __webpack_require__(10), - objectToString = __webpack_require__(11); - - /** `Object#toString` result references. */ - var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - - /** Built-in value references. */ - var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - module.exports = baseGetTag; - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - var root = __webpack_require__(8); - - /** Built-in value references. */ - var Symbol = root.Symbol; - - module.exports = Symbol; - - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - var freeGlobal = __webpack_require__(9); - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - module.exports = root; - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - module.exports = freeGlobal; - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - var Symbol = __webpack_require__(7); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Built-in value references. */ - var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - module.exports = getRawTag; - - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - module.exports = objectToString; - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - var overArg = __webpack_require__(13); - - /** Built-in value references. */ - var getPrototype = overArg(Object.getPrototypeOf, Object); - - module.exports = getPrototype; - - -/***/ }, -/* 13 */ -/***/ function(module, exports) { - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - module.exports = overArg; - - -/***/ }, -/* 14 */ -/***/ function(module, exports) { - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - module.exports = isObjectLike; - - -/***/ }, -/* 15 */, -/* 16 */, -/* 17 */, -/* 18 */, -/* 19 */, -/* 20 */, -/* 21 */, -/* 22 */, -/* 23 */, -/* 24 */, -/* 25 */, -/* 26 */, -/* 27 */, -/* 28 */, -/* 29 */, -/* 30 */, -/* 31 */, -/* 32 */, -/* 33 */, -/* 34 */, -/* 35 */, -/* 36 */, -/* 37 */, -/* 38 */, -/* 39 */, -/* 40 */, -/* 41 */, -/* 42 */, -/* 43 */, -/* 44 */, -/* 45 */, -/* 46 */, -/* 47 */, -/* 48 */, -/* 49 */, -/* 50 */, -/* 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; - } - - -/***/ }, -/* 52 */, -/* 53 */, -/* 54 */, -/* 55 */, -/* 56 */, -/* 57 */, -/* 58 */, -/* 59 */, -/* 60 */, -/* 61 */, -/* 62 */, -/* 63 */, -/* 64 */, -/* 65 */, -/* 66 */, -/* 67 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGet = __webpack_require__(68); - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - module.exports = get; - - -/***/ }, -/* 68 */ -/***/ function(module, exports, __webpack_require__) { - - var castPath = __webpack_require__(69), - toKey = __webpack_require__(111); - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; - } - - module.exports = baseGet; - - -/***/ }, -/* 69 */ -/***/ function(module, exports, __webpack_require__) { - - var isArray = __webpack_require__(70), - isKey = __webpack_require__(71), - stringToPath = __webpack_require__(73), - toString = __webpack_require__(108); - - /** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); - } - - module.exports = castPath; - - -/***/ }, -/* 70 */ -/***/ function(module, exports) { - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - module.exports = isArray; - - -/***/ }, -/* 71 */ -/***/ function(module, exports, __webpack_require__) { - - var isArray = __webpack_require__(70), - isSymbol = __webpack_require__(72); - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/; - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); - } - - module.exports = isKey; - - -/***/ }, -/* 72 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetTag = __webpack_require__(6), - isObjectLike = __webpack_require__(14); - - /** `Object#toString` result references. */ - var symbolTag = '[object Symbol]'; - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); - } - - module.exports = isSymbol; - - -/***/ }, -/* 73 */ -/***/ function(module, exports, __webpack_require__) { - - var memoizeCapped = __webpack_require__(74); - - /** Used to match property names within property paths. */ - var reLeadingDot = /^\./, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - var stringToPath = memoizeCapped(function(string) { - var result = []; - if (reLeadingDot.test(string)) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - module.exports = stringToPath; - - -/***/ }, -/* 74 */ -/***/ function(module, exports, __webpack_require__) { - - var memoize = __webpack_require__(75); - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ - function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; - } - - module.exports = memoizeCapped; - - -/***/ }, -/* 75 */ -/***/ function(module, exports, __webpack_require__) { - - var MapCache = __webpack_require__(76); - - /** Error message constants. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; - } - - // Expose `MapCache`. - memoize.Cache = MapCache; - - module.exports = memoize; - - -/***/ }, -/* 76 */ -/***/ function(module, exports, __webpack_require__) { - - var mapCacheClear = __webpack_require__(77), - mapCacheDelete = __webpack_require__(102), - mapCacheGet = __webpack_require__(105), - mapCacheHas = __webpack_require__(106), - mapCacheSet = __webpack_require__(107); - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - module.exports = MapCache; - - -/***/ }, -/* 77 */ -/***/ function(module, exports, __webpack_require__) { - - var Hash = __webpack_require__(78), - ListCache = __webpack_require__(93), - Map = __webpack_require__(101); - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } - - module.exports = mapCacheClear; - - -/***/ }, -/* 78 */ -/***/ function(module, exports, __webpack_require__) { - - var hashClear = __webpack_require__(79), - hashDelete = __webpack_require__(89), - hashGet = __webpack_require__(90), - hashHas = __webpack_require__(91), - hashSet = __webpack_require__(92); - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - module.exports = Hash; - - -/***/ }, -/* 79 */ -/***/ function(module, exports, __webpack_require__) { - - var nativeCreate = __webpack_require__(80); - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - module.exports = hashClear; - - -/***/ }, -/* 80 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81); - - /* Built-in method references that are verified to be native. */ - var nativeCreate = getNative(Object, 'create'); - - module.exports = nativeCreate; - - -/***/ }, -/* 81 */ -/***/ function(module, exports, __webpack_require__) { - - var baseIsNative = __webpack_require__(82), - getValue = __webpack_require__(88); - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - module.exports = getNative; - - -/***/ }, -/* 82 */ -/***/ function(module, exports, __webpack_require__) { - - var isFunction = __webpack_require__(83), - isMasked = __webpack_require__(85), - isObject = __webpack_require__(84), - toSource = __webpack_require__(87); - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - module.exports = baseIsNative; - - -/***/ }, -/* 83 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetTag = __webpack_require__(6), - isObject = __webpack_require__(84); - - /** `Object#toString` result references. */ - var asyncTag = '[object AsyncFunction]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - module.exports = isFunction; - - -/***/ }, -/* 84 */ -/***/ function(module, exports) { - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - module.exports = isObject; - - -/***/ }, -/* 85 */ -/***/ function(module, exports, __webpack_require__) { - - var coreJsData = __webpack_require__(86); - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - module.exports = isMasked; - - -/***/ }, -/* 86 */ -/***/ function(module, exports, __webpack_require__) { - - var root = __webpack_require__(8); - - /** Used to detect overreaching core-js shims. */ - var coreJsData = root['__core-js_shared__']; - - module.exports = coreJsData; - - -/***/ }, -/* 87 */ -/***/ function(module, exports) { - - /** Used for built-in method references. */ - var funcProto = Function.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - module.exports = toSource; - - -/***/ }, -/* 88 */ -/***/ function(module, exports) { - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - module.exports = getValue; - - -/***/ }, -/* 89 */ -/***/ function(module, exports) { - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - module.exports = hashDelete; - - -/***/ }, -/* 90 */ -/***/ function(module, exports, __webpack_require__) { - - var nativeCreate = __webpack_require__(80); - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - module.exports = hashGet; - - -/***/ }, -/* 91 */ -/***/ function(module, exports, __webpack_require__) { - - var nativeCreate = __webpack_require__(80); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - module.exports = hashHas; - - -/***/ }, -/* 92 */ -/***/ function(module, exports, __webpack_require__) { - - var nativeCreate = __webpack_require__(80); - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - module.exports = hashSet; - - -/***/ }, -/* 93 */ -/***/ function(module, exports, __webpack_require__) { - - var listCacheClear = __webpack_require__(94), - listCacheDelete = __webpack_require__(95), - listCacheGet = __webpack_require__(98), - listCacheHas = __webpack_require__(99), - listCacheSet = __webpack_require__(100); - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - module.exports = ListCache; - - -/***/ }, -/* 94 */ -/***/ function(module, exports) { - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - module.exports = listCacheClear; - - -/***/ }, -/* 95 */ -/***/ function(module, exports, __webpack_require__) { - - var assocIndexOf = __webpack_require__(96); - - /** Used for built-in method references. */ - var arrayProto = Array.prototype; - - /** Built-in value references. */ - var splice = arrayProto.splice; - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - module.exports = listCacheDelete; - - -/***/ }, -/* 96 */ -/***/ function(module, exports, __webpack_require__) { - - var eq = __webpack_require__(97); - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - module.exports = assocIndexOf; - - -/***/ }, -/* 97 */ -/***/ function(module, exports) { - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - module.exports = eq; - - -/***/ }, -/* 98 */ -/***/ function(module, exports, __webpack_require__) { - - var assocIndexOf = __webpack_require__(96); - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - module.exports = listCacheGet; - - -/***/ }, -/* 99 */ -/***/ function(module, exports, __webpack_require__) { - - var assocIndexOf = __webpack_require__(96); - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - module.exports = listCacheHas; - - -/***/ }, -/* 100 */ -/***/ function(module, exports, __webpack_require__) { - - var assocIndexOf = __webpack_require__(96); - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - module.exports = listCacheSet; - - -/***/ }, -/* 101 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81), - root = __webpack_require__(8); - - /* Built-in method references that are verified to be native. */ - var Map = getNative(root, 'Map'); - - module.exports = Map; - - -/***/ }, -/* 102 */ -/***/ function(module, exports, __webpack_require__) { - - var getMapData = __webpack_require__(103); - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - module.exports = mapCacheDelete; - - -/***/ }, -/* 103 */ -/***/ function(module, exports, __webpack_require__) { - - var isKeyable = __webpack_require__(104); - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - module.exports = getMapData; - - -/***/ }, -/* 104 */ -/***/ function(module, exports) { - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - module.exports = isKeyable; - - -/***/ }, -/* 105 */ -/***/ function(module, exports, __webpack_require__) { - - var getMapData = __webpack_require__(103); - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - module.exports = mapCacheGet; - - -/***/ }, -/* 106 */ -/***/ function(module, exports, __webpack_require__) { - - var getMapData = __webpack_require__(103); - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - module.exports = mapCacheHas; - - -/***/ }, -/* 107 */ -/***/ function(module, exports, __webpack_require__) { - - var getMapData = __webpack_require__(103); - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - module.exports = mapCacheSet; - - -/***/ }, -/* 108 */ -/***/ function(module, exports, __webpack_require__) { - - var baseToString = __webpack_require__(109); - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - return value == null ? '' : baseToString(value); - } - - module.exports = toString; - - -/***/ }, -/* 109 */ -/***/ function(module, exports, __webpack_require__) { - - var Symbol = __webpack_require__(7), - arrayMap = __webpack_require__(110), - isArray = __webpack_require__(70), - isSymbol = __webpack_require__(72); - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0; - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - module.exports = baseToString; - - -/***/ }, -/* 110 */ -/***/ function(module, exports) { - - /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - module.exports = arrayMap; - - -/***/ }, -/* 111 */ -/***/ function(module, exports, __webpack_require__) { - - var isSymbol = __webpack_require__(72); - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0; - - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - module.exports = toKey; - - -/***/ }, -/* 112 */ -/***/ function(module, exports, __webpack_require__) { - - var baseSet = __webpack_require__(113); - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - module.exports = set; - - -/***/ }, -/* 113 */ -/***/ function(module, exports, __webpack_require__) { - - var assignValue = __webpack_require__(114), - castPath = __webpack_require__(69), - isIndex = __webpack_require__(117), - isObject = __webpack_require__(84), - toKey = __webpack_require__(111); - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - module.exports = baseSet; - - -/***/ }, -/* 114 */ -/***/ function(module, exports, __webpack_require__) { - - var baseAssignValue = __webpack_require__(115), - eq = __webpack_require__(97); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - module.exports = assignValue; - - -/***/ }, -/* 115 */ -/***/ function(module, exports, __webpack_require__) { - - var defineProperty = __webpack_require__(116); - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - module.exports = baseAssignValue; - - -/***/ }, -/* 116 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81); - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - module.exports = defineProperty; - - -/***/ }, -/* 117 */ -/***/ function(module, exports) { - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); - } - - module.exports = isIndex; - - -/***/ }, -/* 118 */ -/***/ function(module, exports) { - - - -/***/ }, -/* 119 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - // resolves . and .. elements in a path array with directory names there - // must be no slashes, empty elements, or device names (c:\) in the array - // (so also no leading and trailing slashes - it does not distinguish - // relative and absolute paths) - function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; - } - - // Split a filename into [root, dir, basename, ext], unix version - // 'root' is just a slash, or nothing. - var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; - var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); - }; - - // path.resolve([from ...], to) - // posix version - exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; - }; - - // path.normalize(path) - // posix version - exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; - }; - - // posix version - exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; - }; - - // posix version - exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); - }; - - - // path.relative(from, to) - // posix version - exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); - }; - - exports.sep = '/'; - exports.delimiter = ':'; - - exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; - }; - - - exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; - }; - - - exports.extname = function(path) { - return splitPath(path)[3]; - }; - - function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; - } - - // String.prototype.substr - negative index don't work in IE8 - var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } - ; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(120))) - -/***/ }, -/* 120 */ -/***/ function(module, exports) { - - // shim for using process in browser - var process = module.exports = {}; - - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { return 0; }; - - -/***/ }, -/* 121 */ -/***/ function(module, exports) { - - module.exports = __WEBPACK_EXTERNAL_MODULE_121__; - -/***/ }, -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */, -/* 126 */, -/* 127 */, -/* 128 */, -/* 129 */, -/* 130 */, -/* 131 */, -/* 132 */, -/* 133 */, -/* 134 */, -/* 135 */, -/* 136 */, -/* 137 */, -/* 138 */, -/* 139 */, -/* 140 */, -/* 141 */, -/* 142 */, -/* 143 */, -/* 144 */, -/* 145 */, -/* 146 */, -/* 147 */, -/* 148 */, -/* 149 */, -/* 150 */, -/* 151 */, -/* 152 */, -/* 153 */, -/* 154 */, -/* 155 */, -/* 156 */, -/* 157 */, -/* 158 */, -/* 159 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - - 'use strict'; - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - - var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } - - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - }; - - module.exports = invariant; - - -/***/ }, -/* 160 */, -/* 161 */, -/* 162 */, -/* 163 */, -/* 164 */, -/* 165 */, -/* 166 */, -/* 167 */, -/* 168 */, -/* 169 */, -/* 170 */, -/* 171 */, -/* 172 */, -/* 173 */, -/* 174 */, -/* 175 */, -/* 176 */, -/* 177 */, -/* 178 */, -/* 179 */, -/* 180 */, -/* 181 */, -/* 182 */, -/* 183 */, -/* 184 */, -/* 185 */, -/* 186 */, -/* 187 */, -/* 188 */, -/* 189 */, -/* 190 */, -/* 191 */, -/* 192 */, -/* 193 */, -/* 194 */, -/* 195 */ -/***/ function(module, exports, __webpack_require__) { - - var createToPairs = __webpack_require__(196), - keys = __webpack_require__(205); - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - module.exports = toPairs; - - -/***/ }, -/* 196 */ -/***/ function(module, exports, __webpack_require__) { - - var baseToPairs = __webpack_require__(197), - getTag = __webpack_require__(198), - mapToArray = __webpack_require__(203), - setToPairs = __webpack_require__(204); - - /** `Object#toString` result references. */ - var mapTag = '[object Map]', - setTag = '[object Set]'; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - module.exports = createToPairs; - - -/***/ }, -/* 197 */ -/***/ function(module, exports, __webpack_require__) { - - var arrayMap = __webpack_require__(110); - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - module.exports = baseToPairs; - - -/***/ }, -/* 198 */ -/***/ function(module, exports, __webpack_require__) { - - var DataView = __webpack_require__(199), - Map = __webpack_require__(101), - Promise = __webpack_require__(200), - Set = __webpack_require__(201), - WeakMap = __webpack_require__(202), - baseGetTag = __webpack_require__(6), - toSource = __webpack_require__(87); - - /** `Object#toString` result references. */ - var mapTag = '[object Map]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - setTag = '[object Set]', - weakMapTag = '[object WeakMap]'; - - var dataViewTag = '[object DataView]'; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - module.exports = getTag; - - -/***/ }, -/* 199 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81), - root = __webpack_require__(8); - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(root, 'DataView'); - - module.exports = DataView; - - -/***/ }, -/* 200 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81), - root = __webpack_require__(8); - - /* Built-in method references that are verified to be native. */ - var Promise = getNative(root, 'Promise'); - - module.exports = Promise; - - -/***/ }, -/* 201 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81), - root = __webpack_require__(8); - - /* Built-in method references that are verified to be native. */ - var Set = getNative(root, 'Set'); - - module.exports = Set; - - -/***/ }, -/* 202 */ -/***/ function(module, exports, __webpack_require__) { - - var getNative = __webpack_require__(81), - root = __webpack_require__(8); - - /* Built-in method references that are verified to be native. */ - var WeakMap = getNative(root, 'WeakMap'); - - module.exports = WeakMap; - - -/***/ }, -/* 203 */ -/***/ function(module, exports) { - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - module.exports = mapToArray; - - -/***/ }, -/* 204 */ -/***/ function(module, exports) { - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - module.exports = setToPairs; - - -/***/ }, -/* 205 */ -/***/ function(module, exports, __webpack_require__) { - - var arrayLikeKeys = __webpack_require__(206), - baseKeys = __webpack_require__(217), - isArrayLike = __webpack_require__(220); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - module.exports = keys; - - -/***/ }, -/* 206 */ -/***/ function(module, exports, __webpack_require__) { - - var baseTimes = __webpack_require__(207), - isArguments = __webpack_require__(208), - isArray = __webpack_require__(70), - isBuffer = __webpack_require__(210), - isIndex = __webpack_require__(117), - isTypedArray = __webpack_require__(212); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - module.exports = arrayLikeKeys; - - -/***/ }, -/* 207 */ -/***/ function(module, exports) { - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - module.exports = baseTimes; - - -/***/ }, -/* 208 */ -/***/ function(module, exports, __webpack_require__) { - - var baseIsArguments = __webpack_require__(209), - isObjectLike = __webpack_require__(14); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - module.exports = isArguments; - - -/***/ }, -/* 209 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetTag = __webpack_require__(6), - isObjectLike = __webpack_require__(14); - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]'; - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - - module.exports = baseIsArguments; - - -/***/ }, -/* 210 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(8), - stubFalse = __webpack_require__(211); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Built-in value references. */ - var Buffer = moduleExports ? root.Buffer : undefined; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - module.exports = isBuffer; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) - -/***/ }, -/* 211 */ -/***/ function(module, exports) { - - /** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - module.exports = stubFalse; - - -/***/ }, -/* 212 */ -/***/ function(module, exports, __webpack_require__) { - - var baseIsTypedArray = __webpack_require__(213), - baseUnary = __webpack_require__(215), - nodeUtil = __webpack_require__(216); - - /* Node.js helper references. */ - var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - module.exports = isTypedArray; - - -/***/ }, -/* 213 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetTag = __webpack_require__(6), - isLength = __webpack_require__(214), - isObjectLike = __webpack_require__(14); - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - module.exports = baseIsTypedArray; - - -/***/ }, -/* 214 */ -/***/ function(module, exports) { - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - module.exports = isLength; - - -/***/ }, -/* 215 */ -/***/ function(module, exports) { - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - module.exports = baseUnary; - - -/***/ }, -/* 216 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(9); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - module.exports = nodeUtil; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) - -/***/ }, -/* 217 */ -/***/ function(module, exports, __webpack_require__) { - - var isPrototype = __webpack_require__(218), - nativeKeys = __webpack_require__(219); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - module.exports = baseKeys; - - -/***/ }, -/* 218 */ -/***/ function(module, exports) { - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - module.exports = isPrototype; - - -/***/ }, -/* 219 */ -/***/ function(module, exports, __webpack_require__) { - - var overArg = __webpack_require__(13); - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - - module.exports = nativeKeys; - - -/***/ }, -/* 220 */ -/***/ function(module, exports, __webpack_require__) { - - var isFunction = __webpack_require__(83), - isLength = __webpack_require__(214); - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - module.exports = isArrayLike; - - -/***/ }, -/* 221 */, -/* 222 */, -/* 223 */, -/* 224 */, -/* 225 */, -/* 226 */, -/* 227 */, -/* 228 */, -/* 229 */, -/* 230 */, -/* 231 */, -/* 232 */, -/* 233 */, -/* 234 */, -/* 235 */, -/* 236 */, -/* 237 */, -/* 238 */, -/* 239 */, -/* 240 */, -/* 241 */, -/* 242 */, -/* 243 */, -/* 244 */, -/* 245 */, -/* 246 */, -/* 247 */, -/* 248 */, -/* 249 */, -/* 250 */, -/* 251 */, -/* 252 */, -/* 253 */, -/* 254 */, -/* 255 */, -/* 256 */, -/* 257 */, -/* 258 */, -/* 259 */, -/* 260 */, -/* 261 */, -/* 262 */, -/* 263 */ -/***/ function(module, exports) { - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - module.exports = baseFindIndex; - - -/***/ }, -/* 264 */, -/* 265 */, -/* 266 */, -/* 267 */ -/***/ function(module, exports, __webpack_require__) { - - var ListCache = __webpack_require__(93), - stackClear = __webpack_require__(268), - stackDelete = __webpack_require__(269), - stackGet = __webpack_require__(270), - stackHas = __webpack_require__(271), - stackSet = __webpack_require__(272); - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - module.exports = Stack; - - -/***/ }, -/* 268 */ -/***/ function(module, exports, __webpack_require__) { - - var ListCache = __webpack_require__(93); - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - module.exports = stackClear; - - -/***/ }, -/* 269 */ -/***/ function(module, exports) { - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - module.exports = stackDelete; - - -/***/ }, -/* 270 */ -/***/ function(module, exports) { - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - module.exports = stackGet; - - -/***/ }, -/* 271 */ -/***/ function(module, exports) { - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - module.exports = stackHas; - - -/***/ }, -/* 272 */ -/***/ function(module, exports, __webpack_require__) { - - var ListCache = __webpack_require__(93), - Map = __webpack_require__(101), - MapCache = __webpack_require__(76); - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - module.exports = stackSet; - - -/***/ }, -/* 273 */, -/* 274 */, -/* 275 */, -/* 276 */ -/***/ function(module, exports, __webpack_require__) { - - var MapCache = __webpack_require__(76), - setCacheAdd = __webpack_require__(277), - setCacheHas = __webpack_require__(278); - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - module.exports = SetCache; - - -/***/ }, -/* 277 */ -/***/ function(module, exports) { - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - module.exports = setCacheAdd; - - -/***/ }, -/* 278 */ -/***/ function(module, exports) { - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - module.exports = setCacheHas; - - -/***/ }, -/* 279 */, -/* 280 */ -/***/ function(module, exports) { - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - module.exports = cacheHas; - - -/***/ }, -/* 281 */, -/* 282 */ -/***/ function(module, exports, __webpack_require__) { - - var root = __webpack_require__(8); - - /** Built-in value references. */ - var Uint8Array = root.Uint8Array; - - module.exports = Uint8Array; - - -/***/ }, -/* 283 */ -/***/ function(module, exports) { - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - module.exports = setToArray; - - -/***/ }, -/* 284 */, -/* 285 */ -/***/ function(module, exports, __webpack_require__) { - - var baseGetAllKeys = __webpack_require__(286), - getSymbols = __webpack_require__(288), - keys = __webpack_require__(205); - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - module.exports = getAllKeys; - - -/***/ }, -/* 286 */ -/***/ function(module, exports, __webpack_require__) { - - var arrayPush = __webpack_require__(287), - isArray = __webpack_require__(70); - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - module.exports = baseGetAllKeys; - - -/***/ }, -/* 287 */ -/***/ function(module, exports) { - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - module.exports = arrayPush; - - -/***/ }, -/* 288 */ -/***/ function(module, exports, __webpack_require__) { - - var arrayFilter = __webpack_require__(289), - stubArray = __webpack_require__(290); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - module.exports = getSymbols; - - -/***/ }, -/* 289 */ -/***/ function(module, exports) { - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - module.exports = arrayFilter; - - -/***/ }, -/* 290 */ -/***/ function(module, exports) { - - /** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - module.exports = stubArray; - - -/***/ }, -/* 291 */, -/* 292 */, -/* 293 */, -/* 294 */, -/* 295 */, -/* 296 */, -/* 297 */, -/* 298 */ -/***/ function(module, exports) { - - /** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; - * - * console.log(_.identity(object) === object); - * // => true - */ - function identity(value) { - return value; - } - - module.exports = identity; - - -/***/ }, -/* 299 */, -/* 300 */, -/* 301 */, -/* 302 */ -/***/ function(module, exports, __webpack_require__) { - - var toFinite = __webpack_require__(303); - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; - } - - module.exports = toInteger; - - -/***/ }, -/* 303 */ -/***/ function(module, exports, __webpack_require__) { - - var toNumber = __webpack_require__(304); - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_INTEGER = 1.7976931348623157e+308; - - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - - module.exports = toFinite; - - -/***/ }, -/* 304 */ -/***/ function(module, exports, __webpack_require__) { - - var isObject = __webpack_require__(84), - isSymbol = __webpack_require__(72); - - /** Used as references for various `Number` constants. */ - var NAN = 0 / 0; - - /** Used to match leading and trailing whitespace. */ - var reTrim = /^\s+|\s+$/g; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Built-in method references without a dependency on `root`. */ - var freeParseInt = parseInt; - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - module.exports = toNumber; - - -/***/ }, -/* 305 */, -/* 306 */, -/* 307 */, -/* 308 */, -/* 309 */, -/* 310 */, -/* 311 */, -/* 312 */, -/* 313 */, -/* 314 */, -/* 315 */, -/* 316 */, -/* 317 */, -/* 318 */, -/* 319 */, -/* 320 */, -/* 321 */, -/* 322 */, -/* 323 */, -/* 324 */, -/* 325 */, -/* 326 */, -/* 327 */, -/* 328 */, -/* 329 */, -/* 330 */, -/* 331 */, -/* 332 */, -/* 333 */, -/* 334 */, -/* 335 */, -/* 336 */, -/* 337 */, -/* 338 */, -/* 339 */, -/* 340 */, -/* 341 */, -/* 342 */, -/* 343 */, -/* 344 */, -/* 345 */, -/* 346 */, -/* 347 */, -/* 348 */, -/* 349 */, -/* 350 */, -/* 351 */, -/* 352 */, -/* 353 */, -/* 354 */, -/* 355 */, -/* 356 */, -/* 357 */, -/* 358 */, -/* 359 */, -/* 360 */, -/* 361 */, -/* 362 */, -/* 363 */, -/* 364 */, -/* 365 */, -/* 366 */, -/* 367 */, -/* 368 */, -/* 369 */, -/* 370 */, -/* 371 */, -/* 372 */, -/* 373 */, -/* 374 */, -/* 375 */, -/* 376 */, -/* 377 */, -/* 378 */, -/* 379 */, -/* 380 */, -/* 381 */, -/* 382 */, -/* 383 */, -/* 384 */, -/* 385 */, -/* 386 */, -/* 387 */, -/* 388 */, -/* 389 */, -/* 390 */, -/* 391 */, -/* 392 */, -/* 393 */, -/* 394 */, -/* 395 */, -/* 396 */, -/* 397 */, -/* 398 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(8); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Built-in value references. */ - var Buffer = moduleExports ? root.Buffer : undefined, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - module.exports = cloneBuffer; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)(module))) - -/***/ }, -/* 399 */ -/***/ function(module, exports, __webpack_require__) { - - var cloneArrayBuffer = __webpack_require__(400); - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - module.exports = cloneTypedArray; - - -/***/ }, -/* 400 */ -/***/ function(module, exports, __webpack_require__) { - - var Uint8Array = __webpack_require__(282); - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - module.exports = cloneArrayBuffer; - - -/***/ }, -/* 401 */ -/***/ function(module, exports) { - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - module.exports = copyArray; - - -/***/ }, -/* 402 */ -/***/ function(module, exports, __webpack_require__) { - - var baseCreate = __webpack_require__(403), - getPrototype = __webpack_require__(12), - isPrototype = __webpack_require__(218); - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - module.exports = initCloneObject; - - -/***/ }, -/* 403 */ -/***/ function(module, exports, __webpack_require__) { - - var isObject = __webpack_require__(84); - - /** Built-in value references. */ - var objectCreate = Object.create; - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - module.exports = baseCreate; - - -/***/ }, -/* 404 */, -/* 405 */, -/* 406 */ -/***/ function(module, exports, __webpack_require__) { - - var assignValue = __webpack_require__(114), - baseAssignValue = __webpack_require__(115); - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - module.exports = copyObject; - - -/***/ }, -/* 407 */ -/***/ function(module, exports, __webpack_require__) { - - var arrayLikeKeys = __webpack_require__(206), - baseKeysIn = __webpack_require__(408), - isArrayLike = __webpack_require__(220); - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - module.exports = keysIn; - - -/***/ }, -/* 408 */ -/***/ function(module, exports, __webpack_require__) { - - var isObject = __webpack_require__(84), - isPrototype = __webpack_require__(218), - nativeKeysIn = __webpack_require__(409); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - module.exports = baseKeysIn; - - -/***/ }, -/* 409 */ -/***/ function(module, exports) { - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - module.exports = nativeKeysIn; - - -/***/ }, -/* 410 */ -/***/ function(module, exports, __webpack_require__) { - - var baseRest = __webpack_require__(411), - isIterateeCall = __webpack_require__(418); - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - module.exports = createAssigner; - - -/***/ }, -/* 411 */ -/***/ function(module, exports, __webpack_require__) { - - var identity = __webpack_require__(298), - overRest = __webpack_require__(412), - setToString = __webpack_require__(414); - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - module.exports = baseRest; - - -/***/ }, -/* 412 */ -/***/ function(module, exports, __webpack_require__) { - - var apply = __webpack_require__(413); - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeMax = Math.max; - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; - } - - module.exports = overRest; - - -/***/ }, -/* 413 */ -/***/ function(module, exports) { - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - module.exports = apply; - - -/***/ }, -/* 414 */ -/***/ function(module, exports, __webpack_require__) { - - var baseSetToString = __webpack_require__(415), - shortOut = __webpack_require__(417); - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = shortOut(baseSetToString); - - module.exports = setToString; - - -/***/ }, -/* 415 */ -/***/ function(module, exports, __webpack_require__) { - - var constant = __webpack_require__(416), - defineProperty = __webpack_require__(116), - identity = __webpack_require__(298); - - /** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - module.exports = baseSetToString; - - -/***/ }, -/* 416 */ -/***/ function(module, exports) { - - /** - * Creates a function that returns `value`. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Util - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new constant function. - * @example - * - * var objects = _.times(2, _.constant({ 'a': 1 })); - * - * console.log(objects); - * // => [{ 'a': 1 }, { 'a': 1 }] - * - * console.log(objects[0] === objects[1]); - * // => true - */ - function constant(value) { - return function() { - return value; - }; - } - - module.exports = constant; - - -/***/ }, -/* 417 */ -/***/ function(module, exports) { - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeNow = Date.now; - - /** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ - function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; - } - - module.exports = shortOut; - - -/***/ }, -/* 418 */ -/***/ function(module, exports, __webpack_require__) { - - var eq = __webpack_require__(97), - isArrayLike = __webpack_require__(220), - isIndex = __webpack_require__(117), - isObject = __webpack_require__(84); - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - module.exports = isIterateeCall; - - -/***/ }, -/* 419 */, -/* 420 */, -/* 421 */, -/* 422 */, -/* 423 */, -/* 424 */, -/* 425 */, -/* 426 */, -/* 427 */, -/* 428 */, -/* 429 */, -/* 430 */, -/* 431 */, -/* 432 */, -/* 433 */, -/* 434 */, -/* 435 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - /* eslint max-len: 0 */ - - // This is a trick taken from Esprima. It turns out that, on - // non-Chrome browsers, to check whether a string is in a set, a - // predicate containing a big ugly `switch` statement is faster than - // a regular expression, and on Chrome the two are about on par. - // This function uses `eval` (non-lexical) to produce such a - // predicate from a space-separated string of words. - // - // It starts by sorting the words by length. - - function makePredicate(words) { - words = words.split(" "); - return function (str) { - return words.indexOf(str) >= 0; - }; - } - - // Reserved word lists for various dialects of the language - - var reservedWords = { - 6: makePredicate("enum await"), - strict: makePredicate("implements interface let package private protected public static yield"), - strictBind: makePredicate("eval arguments") - }; - - // And the keywords - - var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); - - // ## Character categories - - // Big ugly regular expressions that match characters in the - // whitespace, identifier, and identifier-start categories. These - // are only applied when a character is found to actually have a - // code point above 128. - // Generated by `bin/generate-identifier-regex.js`. - - var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"; - var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; - - var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); - var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); - - nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - - // These are a run-length and offset encoded representation of the - // >0xffff code points that are a valid part of identifiers. The - // offset starts at 0x10000, and each pair of numbers represents an - // offset to the next range, and then a size of the range. They were - // generated by `bin/generate-identifier-regex.js`. - // eslint-disable-next-line comma-spacing - var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541]; - // eslint-disable-next-line comma-spacing - var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; - - // This has a complexity linear to the value of the code. The - // assumption is that looking up astral identifier characters is - // rare. - function isInAstralSet(code, set) { - var pos = 0x10000; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) return false; - - pos += set[i + 1]; - if (pos >= code) return true; - } - } - - // Test whether a given character code starts an identifier. - - function isIdentifierStart(code) { - if (code < 65) return code === 36; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes); - } - - // Test whether a given character is part of an identifier. - - function isIdentifierChar(code) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); - } - - // A second optional argument can be given to further configure - var defaultOptions = { - // Source type ("script" or "module") for different semantics - sourceType: "script", - // Source filename. - sourceFilename: undefined, - // Line from which to start counting source. Useful for - // integration with other tools. - startLine: 1, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // TODO - allowSuperOutsideMethod: false, - // An array of plugins to enable - plugins: [], - // TODO - strictMode: null - }; - - // Interpret and default an options object - - function getOptions(opts) { - var options = {}; - for (var key in defaultOptions) { - options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; - } - return options; - } - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - - - - - - - - - - - - var classCallCheck = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - }; - - - - - - - - - - - - var inherits = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; - }; - - - - - - - - - - - - var possibleConstructorReturn = function (self, call) { - if (!self) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return call && (typeof call === "object" || typeof call === "function") ? call : self; - }; - - // ## Token types - - // The assignment of fine-grained, information-carrying type objects - // allows the tokenizer to store the information it has about a - // token in a way that is very cheap for the parser to look up. - - // All token type variables start with an underscore, to make them - // easy to recognize. - - // The `beforeExpr` property is used to disambiguate between regular - // expressions and divisions. It is set on all token types that can - // be followed by an expression (thus, a slash after them would be a - // regular expression). - // - // `isLoop` marks a keyword as starting a loop, which is important - // to know when parsing a label, in order to allow or disallow - // continue jumps to that label. - - var beforeExpr = true; - var startsExpr = true; - var isLoop = true; - var isAssign = true; - var prefix = true; - var postfix = true; - - var TokenType = function TokenType(label) { - var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, TokenType); - - this.label = label; - this.keyword = conf.keyword; - this.beforeExpr = !!conf.beforeExpr; - this.startsExpr = !!conf.startsExpr; - this.rightAssociative = !!conf.rightAssociative; - this.isLoop = !!conf.isLoop; - this.isAssign = !!conf.isAssign; - this.prefix = !!conf.prefix; - this.postfix = !!conf.postfix; - this.binop = conf.binop || null; - this.updateContext = null; - }; - - var KeywordTokenType = function (_TokenType) { - inherits(KeywordTokenType, _TokenType); - - function KeywordTokenType(name) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, KeywordTokenType); - - options.keyword = name; - - return possibleConstructorReturn(this, _TokenType.call(this, name, options)); - } - - return KeywordTokenType; - }(TokenType); - - var BinopTokenType = function (_TokenType2) { - inherits(BinopTokenType, _TokenType2); - - function BinopTokenType(name, prec) { - classCallCheck(this, BinopTokenType); - return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec })); - } - - return BinopTokenType; - }(TokenType); - - var types = { - num: new TokenType("num", { startsExpr: startsExpr }), - regexp: new TokenType("regexp", { startsExpr: startsExpr }), - string: new TokenType("string", { startsExpr: startsExpr }), - name: new TokenType("name", { startsExpr: startsExpr }), - eof: new TokenType("eof"), - - // Punctuation token types. - bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - bracketR: new TokenType("]"), - braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - braceR: new TokenType("}"), - braceBarR: new TokenType("|}"), - parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - parenR: new TokenType(")"), - comma: new TokenType(",", { beforeExpr: beforeExpr }), - semi: new TokenType(";", { beforeExpr: beforeExpr }), - colon: new TokenType(":", { beforeExpr: beforeExpr }), - doubleColon: new TokenType("::", { beforeExpr: beforeExpr }), - dot: new TokenType("."), - question: new TokenType("?", { beforeExpr: beforeExpr }), - arrow: new TokenType("=>", { beforeExpr: beforeExpr }), - template: new TokenType("template"), - ellipsis: new TokenType("...", { beforeExpr: beforeExpr }), - backQuote: new TokenType("`", { startsExpr: startsExpr }), - dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - at: new TokenType("@"), - - // Operators. These carry several kinds of properties to help the - // parser use them properly (the presence of these properties is - // what categorizes them as operators). - // - // `binop`, when present, specifies that this operator is a binary - // operator, and will refer to its precedence. - // - // `prefix` and `postfix` mark the operator as a prefix or postfix - // unary operator. - // - // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as - // binary operators with a very low precedence, that should result - // in AssignmentExpression nodes. - - eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }), - assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }), - incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }), - prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), - logicalOR: new BinopTokenType("||", 1), - logicalAND: new BinopTokenType("&&", 2), - bitwiseOR: new BinopTokenType("|", 3), - bitwiseXOR: new BinopTokenType("^", 4), - bitwiseAND: new BinopTokenType("&", 5), - equality: new BinopTokenType("==/!=", 6), - relational: new BinopTokenType("", 7), - bitShift: new BinopTokenType("<>", 8), - plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }), - modulo: new BinopTokenType("%", 10), - star: new BinopTokenType("*", 10), - slash: new BinopTokenType("/", 10), - exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true }) - }; - - var keywords = { - "break": new KeywordTokenType("break"), - "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }), - "catch": new KeywordTokenType("catch"), - "continue": new KeywordTokenType("continue"), - "debugger": new KeywordTokenType("debugger"), - "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }), - "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }), - "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }), - "finally": new KeywordTokenType("finally"), - "for": new KeywordTokenType("for", { isLoop: isLoop }), - "function": new KeywordTokenType("function", { startsExpr: startsExpr }), - "if": new KeywordTokenType("if"), - "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }), - "switch": new KeywordTokenType("switch"), - "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }), - "try": new KeywordTokenType("try"), - "var": new KeywordTokenType("var"), - "let": new KeywordTokenType("let"), - "const": new KeywordTokenType("const"), - "while": new KeywordTokenType("while", { isLoop: isLoop }), - "with": new KeywordTokenType("with"), - "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - "this": new KeywordTokenType("this", { startsExpr: startsExpr }), - "super": new KeywordTokenType("super", { startsExpr: startsExpr }), - "class": new KeywordTokenType("class"), - "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }), - "export": new KeywordTokenType("export"), - "import": new KeywordTokenType("import"), - "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }), - "null": new KeywordTokenType("null", { startsExpr: startsExpr }), - "true": new KeywordTokenType("true", { startsExpr: startsExpr }), - "false": new KeywordTokenType("false", { startsExpr: startsExpr }), - "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }), - "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }), - "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), - "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), - "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }) - }; - - // Map keyword names to token types. - Object.keys(keywords).forEach(function (name) { - types["_" + name] = keywords[name]; - }); - - // Matches a whole line break (where CRLF is considered a single - // line break). Used to count lines. - - var lineBreak = /\r\n?|\n|\u2028|\u2029/; - var lineBreakG = new RegExp(lineBreak.source, "g"); - - function isNewLine(code) { - return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; - } - - var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; - - // The algorithm used to determine whether a regexp can appear at a - // given point in the program is loosely based on sweet.js' approach. - // See https://github.com/mozilla/sweet.js/wiki/design - - var TokContext = function TokContext(token, isExpr, preserveSpace, override) { - classCallCheck(this, TokContext); - - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; - }; - - var types$1 = { - braceStatement: new TokContext("{", false), - braceExpression: new TokContext("{", true), - templateQuasi: new TokContext("${", true), - parenStatement: new TokContext("(", false), - parenExpression: new TokContext("(", true), - template: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - functionExpression: new TokContext("function", true) - }; - - // Token-specific context update code - - types.parenR.updateContext = types.braceR.updateContext = function () { - if (this.state.context.length === 1) { - this.state.exprAllowed = true; - return; - } - - var out = this.state.context.pop(); - if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { - this.state.context.pop(); - this.state.exprAllowed = false; - } else if (out === types$1.templateQuasi) { - this.state.exprAllowed = true; - } else { - this.state.exprAllowed = !out.isExpr; - } - }; - - types.name.updateContext = function (prevType) { - this.state.exprAllowed = false; - - if (prevType === types._let || prevType === types._const || prevType === types._var) { - if (lineBreak.test(this.input.slice(this.state.end))) { - this.state.exprAllowed = true; - } - } - }; - - types.braceL.updateContext = function (prevType) { - this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); - this.state.exprAllowed = true; - }; - - types.dollarBraceL.updateContext = function () { - this.state.context.push(types$1.templateQuasi); - this.state.exprAllowed = true; - }; - - types.parenL.updateContext = function (prevType) { - var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; - this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); - this.state.exprAllowed = true; - }; - - types.incDec.updateContext = function () { - // tokExprAllowed stays unchanged - }; - - types._function.updateContext = function () { - if (this.curContext() !== types$1.braceStatement) { - this.state.context.push(types$1.functionExpression); - } - - this.state.exprAllowed = false; - }; - - types.backQuote.updateContext = function () { - if (this.curContext() === types$1.template) { - this.state.context.pop(); - } else { - this.state.context.push(types$1.template); - } - this.state.exprAllowed = false; - }; - - // These are used when `options.locations` is on, for the - // `startLoc` and `endLoc` properties. - - var Position = function Position(line, col) { - classCallCheck(this, Position); - - this.line = line; - this.column = col; - }; - - var SourceLocation = function SourceLocation(start, end) { - classCallCheck(this, SourceLocation); - - this.start = start; - this.end = end; - }; - - // The `getLineInfo` function is mostly useful when the - // `locations` option is off (for performance reasons) and you - // want to find the line/column position for a given character - // offset. `input` should be the code string that the offset refers - // into. - - function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - lineBreakG.lastIndex = cur; - var match = lineBreakG.exec(input); - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } - } - - var State = function () { - function State() { - classCallCheck(this, State); - } - - State.prototype.init = function init(options, input) { - this.strict = options.strictMode === false ? false : options.sourceType === "module"; - - this.input = input; - - this.potentialArrowAt = -1; - - this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.noAnonFunctionType = false; - - this.labels = []; - - this.decorators = []; - - this.tokens = []; - - this.comments = []; - - this.trailingComments = []; - this.leadingComments = []; - this.commentStack = []; - - this.pos = this.lineStart = 0; - this.curLine = options.startLine; - - this.type = types.eof; - this.value = null; - this.start = this.end = this.pos; - this.startLoc = this.endLoc = this.curPosition(); - - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - - this.context = [types$1.braceStatement]; - this.exprAllowed = true; - - this.containsEsc = this.containsOctal = false; - this.octalPosition = null; - - this.exportedIdentifiers = []; - - return this; - }; - - // TODO - - - // TODO - - - // Used to signify the start of a potential arrow function - - - // Flags to track whether we are in a function, a generator. - - - // Labels in scope. - - - // Leading decorators. - - - // Token store. - - - // Comment store. - - - // Comment attachment store - - - // The current position of the tokenizer in the input. - - - // Properties of the current token: - // Its type - - - // For tokens that include more information than their type, the value - - - // Its start and end offset - - - // And, if locations are used, the {line, column} object - // corresponding to those offsets - - - // Position information for the previous token - - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - - - // Used to signal to callers of `readWord1` whether the word - // contained any escape sequences. This is needed because words with - // escape sequences must not be interpreted as keywords. - - - // TODO - - - // Names of exports store. `default` is stored as a name for both - // `export default foo;` and `export { foo as default };`. - - - State.prototype.curPosition = function curPosition() { - return new Position(this.curLine, this.pos - this.lineStart); - }; - - State.prototype.clone = function clone(skipArrays) { - var state = new State(); - for (var key in this) { - var val = this[key]; - - if ((!skipArrays || key === "context") && Array.isArray(val)) { - val = val.slice(); - } - - state[key] = val; - } - return state; - }; - - return State; - }(); - - // Object type used to represent tokens. Note that normally, tokens - // simply exist as properties on the parser object. This is only - // used for the onToken callback and the external tokenizer. - - var Token = function Token(state) { - classCallCheck(this, Token); - - this.type = state.type; - this.value = state.value; - this.start = state.start; - this.end = state.end; - this.loc = new SourceLocation(state.startLoc, state.endLoc); - }; - - // ## Tokenizer - - function codePointToString(code) { - // UTF-16 Decoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } else { - return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); - } - } - - var Tokenizer = function () { - function Tokenizer(options, input) { - classCallCheck(this, Tokenizer); - - this.state = new State(); - this.state.init(options, input); - } - - // Move to the next token - - Tokenizer.prototype.next = function next() { - if (!this.isLookahead) { - this.state.tokens.push(new Token(this.state)); - } - - this.state.lastTokEnd = this.state.end; - this.state.lastTokStart = this.state.start; - this.state.lastTokEndLoc = this.state.endLoc; - this.state.lastTokStartLoc = this.state.startLoc; - this.nextToken(); - }; - - // TODO - - Tokenizer.prototype.eat = function eat(type) { - if (this.match(type)) { - this.next(); - return true; - } else { - return false; - } - }; - - // TODO - - Tokenizer.prototype.match = function match(type) { - return this.state.type === type; - }; - - // TODO - - Tokenizer.prototype.isKeyword = function isKeyword$$1(word) { - return isKeyword(word); - }; - - // TODO - - Tokenizer.prototype.lookahead = function lookahead() { - var old = this.state; - this.state = old.clone(true); - - this.isLookahead = true; - this.next(); - this.isLookahead = false; - - var curr = this.state.clone(true); - this.state = old; - return curr; - }; - - // Toggle strict mode. Re-reads the next number or string to please - // pedantic tests (`"use strict"; 010;` should fail). - - Tokenizer.prototype.setStrict = function setStrict(strict) { - this.state.strict = strict; - if (!this.match(types.num) && !this.match(types.string)) return; - this.state.pos = this.state.start; - while (this.state.pos < this.state.lineStart) { - this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; - --this.state.curLine; - } - this.nextToken(); - }; - - Tokenizer.prototype.curContext = function curContext() { - return this.state.context[this.state.context.length - 1]; - }; - - // Read a single token, updating the parser object's token-related - // properties. - - Tokenizer.prototype.nextToken = function nextToken() { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - - this.state.containsOctal = false; - this.state.octalPosition = null; - this.state.start = this.state.pos; - this.state.startLoc = this.state.curPosition(); - if (this.state.pos >= this.input.length) return this.finishToken(types.eof); - - if (curContext.override) { - return curContext.override(this); - } else { - return this.readToken(this.fullCharCodeAtPos()); - } - }; - - Tokenizer.prototype.readToken = function readToken(code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (isIdentifierStart(code) || code === 92 /* '\' */) { - return this.readWord(); - } else { - return this.getTokenFromCode(code); - } - }; - - Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { - var code = this.input.charCodeAt(this.state.pos); - if (code <= 0xd7ff || code >= 0xe000) return code; - - var next = this.input.charCodeAt(this.state.pos + 1); - return (code << 10) + next - 0x35fdc00; - }; - - Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? "CommentBlock" : "CommentLine", - value: text, - start: start, - end: end, - loc: new SourceLocation(startLoc, endLoc) - }; - - if (!this.isLookahead) { - this.state.tokens.push(comment); - this.state.comments.push(comment); - this.addComment(comment); - } - }; - - Tokenizer.prototype.skipBlockComment = function skipBlockComment() { - var startLoc = this.state.curPosition(); - var start = this.state.pos; - var end = this.input.indexOf("*/", this.state.pos += 2); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); - - this.state.pos = end + 2; - lineBreakG.lastIndex = start; - var match = void 0; - while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { - ++this.state.curLine; - this.state.lineStart = match.index + match[0].length; - } - - this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { - var start = this.state.pos; - var startLoc = this.state.curPosition(); - var ch = this.input.charCodeAt(this.state.pos += startSkip); - while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this.state.pos; - ch = this.input.charCodeAt(this.state.pos); - } - - this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - // Called at the start of the parse and after every token. Skips - // whitespace and comments, and. - - Tokenizer.prototype.skipSpace = function skipSpace() { - loop: while (this.state.pos < this.input.length) { - var ch = this.input.charCodeAt(this.state.pos); - switch (ch) { - case 32:case 160: - // ' ' - ++this.state.pos; - break; - - case 13: - if (this.input.charCodeAt(this.state.pos + 1) === 10) { - ++this.state.pos; - } - - case 10:case 8232:case 8233: - ++this.state.pos; - ++this.state.curLine; - this.state.lineStart = this.state.pos; - break; - - case 47: - // '/' - switch (this.input.charCodeAt(this.state.pos + 1)) { - case 42: - // '*' - this.skipBlockComment(); - break; - - case 47: - this.skipLineComment(2); - break; - - default: - break loop; - } - break; - - default: - if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.state.pos; - } else { - break loop; - } - } - } - }; - - // Called at the end of every token. Sets `end`, `val`, and - // maintains `context` and `exprAllowed`, and skips the space after - // the token, so that the next one's `start` will point at the - // right position. - - Tokenizer.prototype.finishToken = function finishToken(type, val) { - this.state.end = this.state.pos; - this.state.endLoc = this.state.curPosition(); - var prevType = this.state.type; - this.state.type = type; - this.state.value = val; - - this.updateContext(prevType); - }; - - // ### Token reading - - // This is the function that is called to fetch the next token. It - // is somewhat obscure, because it works in character codes rather - // than characters, and because operator parsing has been inlined - // into it. - // - // All in the name of speed. - // - - - Tokenizer.prototype.readToken_dot = function readToken_dot() { - var next = this.input.charCodeAt(this.state.pos + 1); - if (next >= 48 && next <= 57) { - return this.readNumber(true); - } - - var next2 = this.input.charCodeAt(this.state.pos + 2); - if (next === 46 && next2 === 46) { - // 46 = dot '.' - this.state.pos += 3; - return this.finishToken(types.ellipsis); - } else { - ++this.state.pos; - return this.finishToken(types.dot); - } - }; - - Tokenizer.prototype.readToken_slash = function readToken_slash() { - // '/' - if (this.state.exprAllowed) { - ++this.state.pos; - return this.readRegexp(); - } - - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.slash, 1); - } - }; - - Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { - // '%*' - var type = code === 42 ? types.star : types.modulo; - var width = 1; - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === 42) { - // '*' - width++; - next = this.input.charCodeAt(this.state.pos + 2); - type = types.exponent; - } - - if (next === 61) { - width++; - type = types.assign; - } - - return this.finishOp(type, width); - }; - - Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { - // '|&' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); - if (next === 61) return this.finishOp(types.assign, 2); - if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); - return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); - }; - - Tokenizer.prototype.readToken_caret = function readToken_caret() { - // '^' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.bitwiseXOR, 1); - } - }; - - Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { - // '+-' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === code) { - if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(types.incDec, 2); - } - - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.plusMin, 1); - } - }; - - Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { - // '<>' - var next = this.input.charCodeAt(this.state.pos + 1); - var size = 1; - - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); - return this.finishOp(types.bitShift, size); - } - - if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { - if (this.inModule) this.unexpected(); - // `